| 1 |
|
| 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 |
|
| 16 |
write32(&rk3399_grf->iomux_uart2c, IOMUX_UART2C); |
| 17 |
|
| 18 |
|
| 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)); |
| 26 |
gpio_input(GPIO(1, B, 0)); |
| 27 |
gpio_input(GPIO(1, B, 1)); |
| 28 |
gpio_input(GPIO(1, B, 2)); |
| 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 |
} |