drivers/mipi: Add support for KD_KD110N11_51IE panel
[coreboot2.git] / src / mainboard / google / veyron_rialto / mainboard.c
blobf3fdc21ed4f0f85c7feb41c4faf1d2159f23b9e0
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <device/mmio.h>
4 #include <boot/coreboot_tables.h>
5 #include <console/console.h>
6 #include <device/device.h>
7 #include <device/i2c_simple.h>
8 #include <gpio.h>
9 #include <soc/display.h>
10 #include <soc/grf.h>
11 #include <soc/soc.h>
12 #include <soc/pmu.h>
13 #include <soc/clock.h>
14 #include <soc/rk808.h>
15 #include <soc/spi.h>
16 #include <soc/i2c.h>
17 #include <symbols.h>
18 #include <security/vboot/vboot_common.h>
20 #include "board.h"
22 static void configure_usb(void)
24 gpio_output(GPIO(0, B, 4), 1); /* USB2_PWR_EN */
27 static void configure_emmc(void)
29 write32(&rk3288_grf->iomux_emmcdata, IOMUX_EMMCDATA);
30 write32(&rk3288_grf->iomux_emmcpwren, IOMUX_EMMCPWREN);
31 write32(&rk3288_grf->iomux_emmccmd, IOMUX_EMMCCMD);
33 gpio_output(GPIO(2, B, 1), 1); /* EMMC_RST_L */
36 static void configure_codec(void)
38 write32(&rk3288_grf->iomux_i2c2, IOMUX_I2C2); /* CODEC I2C */
39 i2c_init(2, 400*KHz); /* CODEC I2C */
41 write32(&rk3288_grf->iomux_i2s, IOMUX_I2S);
42 write32(&rk3288_grf->iomux_i2sclk, IOMUX_I2SCLK);
44 rk808_configure_ldo(6, 1800); /* VCC18_CODEC */
46 /* AUDIO IO domain 1.8V voltage selection */
47 write32(&rk3288_grf->io_vsel, RK_SETBITS(1 << 6));
48 rkclk_configure_i2s(12288000);
51 static void configure_3g(void)
53 /* Force 3G modem off to avoid confusing the EHCI host and
54 * causing problems during enumeration/init */
55 gpio_output(GPIO(5, C, 1), 1); /* 3G_SHUTDOWN */
56 gpio_output(GPIO(4, D, 2), 0); /* 3G_ON_OFF */
59 static void mainboard_init(struct device *dev)
61 gpio_output(GPIO_RESET, 0);
63 configure_usb();
64 configure_emmc();
65 configure_codec();
66 configure_3g();
67 /* No video. */
69 /* If recovery mode is detected, reduce frequency and voltage to reduce
70 * heat in case machine is left unattended. chrome-os-partner:41201. */
71 if (vboot_recovery_mode_enabled()) {
72 printk(BIOS_DEBUG, "Reducing APLL freq for recovery mode.\n");
73 rkclk_configure_cpu(APLL_600_MHZ);
74 rk808_configure_buck(1, 900);
78 static void mainboard_enable(struct device *dev)
80 dev->ops->init = &mainboard_init;
83 struct chip_operations mainboard_ops = {
84 .enable_dev = mainboard_enable,
87 void lb_board(struct lb_header *header)
89 struct lb_range *dma;
91 dma = (struct lb_range *)lb_new_record(header);
92 dma->tag = LB_TAG_DMA;
93 dma->size = sizeof(*dma);
94 dma->range_start = (uintptr_t)_dma_coherent;
95 dma->range_size = REGION_SIZE(dma_coherent);
98 void mainboard_power_on_backlight(void)