1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <device/mmio.h>
4 #include <boot/coreboot_tables.h>
5 #include <device/device.h>
6 #include <device/i2c_simple.h>
8 #include <soc/display.h>
12 #include <soc/clock.h>
13 #include <soc/rk808.h>
20 static void configure_usb(void)
22 gpio_output(GPIO(0, B
, 4), 1); /* USB2_PWR_EN */
25 static void configure_emmc(void)
27 write32(&rk3288_grf
->iomux_emmcdata
, IOMUX_EMMCDATA
);
28 write32(&rk3288_grf
->iomux_emmcpwren
, IOMUX_EMMCPWREN
);
29 write32(&rk3288_grf
->iomux_emmccmd
, IOMUX_EMMCCMD
);
31 gpio_output(GPIO(2, B
, 1), 1); /* EMMC_RST_L */
34 static void configure_i2s(void)
36 write32(&rk3288_grf
->iomux_i2s
, IOMUX_I2S
);
37 write32(&rk3288_grf
->iomux_i2sclk
, IOMUX_I2SCLK
);
39 /* AUDIO IO domain 1.8V voltage selection */
40 write32(&rk3288_grf
->io_vsel
, RK_SETBITS(1 << 6));
41 rkclk_configure_i2s(12288000);
44 static void configure_vop(void)
46 write32(&rk3288_grf
->iomux_lcdc
, IOMUX_LCDC
);
48 /* lcdc(vop) iodomain select 1.8V */
49 write32(&rk3288_grf
->io_vsel
, RK_SETBITS(1 << 0));
51 rk808_configure_ldo(8, 1800); /* VCC18_LCD (HDMI_AVDD_1V8) */
52 rk808_configure_ldo(7, 1000); /* VDD10_LCD (HDMI_AVDD_1V0) */
53 rk808_configure_switch(1, 1); /* VCC33_LCD */
56 static void configure_hdmi(void)
58 gpio_output(GPIO(7, B
, 3), 1); /* POWER_HDMI_ON */
61 static void mainboard_init(struct device
*dev
)
63 gpio_output(GPIO_RESET
, 0);
72 static void mainboard_enable(struct device
*dev
)
74 dev
->ops
->init
= &mainboard_init
;
77 struct chip_operations mainboard_ops
= {
78 .enable_dev
= mainboard_enable
,
81 void lb_board(struct lb_header
*header
)
85 dma
= (struct lb_range
*)lb_new_record(header
);
86 dma
->tag
= LB_TAG_DMA
;
87 dma
->size
= sizeof(*dma
);
88 dma
->range_start
= (uintptr_t)_dma_coherent
;
89 dma
->range_size
= REGION_SIZE(dma_coherent
);
92 void mainboard_power_on_backlight(void)