coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
bootblock.c
Go to the documentation of this file.
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 
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 */
17 
18  /* grf soc_con7[11:10] use for uart2 select */
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 
35 }
36 
38 {
40 }
static void write32(void *addr, uint32_t val)
Definition: mmio.h:40
#define MHz
Definition: helpers.h:80
@ GPIO
Definition: chip.h:84
@ CONFIG
Definition: dsi_common.h:201
void gpio_input(gpio_t gpio)
Definition: gpio.c:189
__weak void bootblock_mainboard_init(void)
Definition: bootblock.c:19
__weak void bootblock_mainboard_early_init(void)
Definition: bootblock.c:16
static void configure_spi_flash(void)
Definition: bootblock.c:23
_Static_assert(sizeof(hls_t)==HLS_SIZE, "HLS_SIZE must equal to sizeof(hls_t)")
#define UART2C_SEL
Definition: grf.h:325
#define IOMUX_UART2C
Definition: grf.h:331
#define IOMUX_SPI1_CSCLKTX
Definition: grf.h:335
#define IOMUX_SPI1_RX
Definition: grf.h:334
static struct rk3399_pmugrf_regs *const rk3399_pmugrf
Definition: grf.h:320
static struct rk3399_grf_regs *const rk3399_grf
Definition: grf.h:319
void rockchip_spi_set_sample_delay(unsigned int bus, unsigned int delay_ns)
Definition: spi.c:122
void rockchip_spi_init(unsigned int bus, unsigned int speed_hz)
Definition: spi.c:84
#define UART2_BASE
Definition: addressmap.h:45
u32 iomux_uart2c
Definition: grf.h:139
u32 soc_con7
Definition: grf.h:161
u32 spi1_csclktx
Definition: grf.h:204