Debian Codegraph @

src/mainboard/pine64/rockpro64/bootblock.c

raw symbols SCIP
1 /* SPDX-License-Identifier: GPL-2.0-only */
2
3 #include <device/mmio.h>
4 #include <bootblock_common.h>
5 #include <soc/grf.h>
6 #include <gpio.h>
7 #include <soc/spi.h>
8
9 void bootblock_mainboard_early_init(void)
10 {
11 if (CONFIG(CONSOLE_SERIAL)) {
12 _Static_assert(CONFIG_CONSOLE_SERIAL_UART_ADDRESS == UART2_BASE,
13 "CONSOLE_SERIAL_UART should be UART2");
14
15 /* iomux: select gpio4c[4:3] as uart2 dbg port */
16 write32(&rk3399_grf->iomux_uart2c, IOMUX_UART2C);
17
18 /* grf soc_con7[11:10] use for uart2 select */
19 write32(&rk3399_grf->soc_con7, UART2C_SEL);
20 }
21 }
22
23 static void configure_spi_flash(void)
24 {
25 gpio_input(GPIO(1, A, 7)); /* SPI1_MISO remove pull-up */
26 gpio_input(GPIO(1, B, 0)); /* SPI1_MOSI remove pull-up */
27 gpio_input(GPIO(1, B, 1)); /* SPI1_CLK remove pull-up */
28 gpio_input(GPIO(1, B, 2)); /* SPI1_CS remove pull-up */
29
30 rockchip_spi_init(CONFIG_BOOT_DEVICE_SPI_FLASH_BUS, 33 * MHz);
31 rockchip_spi_set_sample_delay(CONFIG_BOOT_DEVICE_SPI_FLASH_BUS, 5);
32
33 write32(&rk3399_pmugrf->spi1_rxd, IOMUX_SPI1_RX);
34 write32(&rk3399_pmugrf->spi1_csclktx, IOMUX_SPI1_CSCLKTX);
35 }
36
37 void bootblock_mainboard_init(void)
38 {
39 configure_spi_flash();
40 }