1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <device/mmio.h>
5 #include <bootblock_common.h>
11 #include <soc/rk808.h>
13 #include <vendorcode/google/chromeos/chromeos.h>
17 void bootblock_mainboard_early_init(void)
19 if (CONFIG(CONSOLE_SERIAL
)) {
20 assert(CONFIG_CONSOLE_SERIAL_UART_ADDRESS
== UART2_BASE
);
21 write32(&rk3288_grf
->iomux_uart2
, IOMUX_UART2
);
25 void bootblock_mainboard_init(void)
27 if (rkclk_was_watchdog_reset())
28 reboot_from_watchdog();
30 /* Turn on all leds */
31 gpio_output(GPIO(7, A
, 0), 1); /* LED_READY */
32 gpio_output(GPIO(7, B
, 5), 1); /* Ready2_LED */
33 gpio_output(GPIO(7, B
, 3), 1); /* LED_SYNCING */
34 gpio_output(GPIO(7, B
, 7), 1); /* LED_ERROR */
36 /* Up VDD_CPU (BUCK1) to 1.4V to support max CPU frequency (1.8GHz). */
37 setbits32(&rk3288_pmu
->iomux_i2c0scl
, IOMUX_I2C0SCL
);
38 setbits32(&rk3288_pmu
->iomux_i2c0sda
, IOMUX_I2C0SDA
);
39 assert(CONFIG_PMIC_BUS
== 0); /* must correspond with IOMUX */
40 i2c_init(CONFIG_PMIC_BUS
, 400*KHz
);
42 /* Slowly raise to max CPU voltage to prevent overshoot */
43 rk808_configure_buck(1, 1200);
44 udelay(175);/* Must wait for voltage to stabilize,2mV/us */
45 rkclk_configure_cpu(APLL_1416_MHZ
);
48 write32(&rk3288_grf
->iomux_i2c1
, IOMUX_I2C1
);
51 /* spi2 for firmware ROM */
52 write32(&rk3288_grf
->iomux_spi2csclk
, IOMUX_SPI2_CSCLK
);
53 write32(&rk3288_grf
->iomux_spi2txrx
, IOMUX_SPI2_TXRX
);
54 rockchip_spi_init(CONFIG_BOOT_DEVICE_SPI_FLASH_BUS
, 24750*KHz
);
56 setup_chromeos_gpios();