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 <assert.h>
5 #include <bootblock_common.h>
6 #include <delay.h>
7 #include <soc/clock.h>
8 #include <soc/i2c.h>
9 #include <soc/grf.h>
10 #include <soc/pmu.h>
11 #include <soc/rk808.h>
12 #include <soc/spi.h>
13 #include <vendorcode/google/chromeos/chromeos.h>
14 
15 #include "board.h"
16 
18 {
19  if (CONFIG(CONSOLE_SERIAL)) {
20  assert(CONFIG_CONSOLE_SERIAL_UART_ADDRESS == UART2_BASE);
22  }
23 }
24 
26 {
28  reboot_from_watchdog();
29 
30  gpio_output(GPIO(7, A, 0), 1); /* Power LED */
31 
32  /* Up VDD_CPU (BUCK1) to 1.4V to support max CPU frequency (1.8GHz). */
35  assert(CONFIG_PMIC_BUS == 0); /* must correspond with IOMUX */
36  i2c_init(CONFIG_PMIC_BUS, 400*KHz);
37 
38  /* Slowly raise to max CPU voltage to prevent overshoot */
39  rk808_configure_buck(1, 1200);
40  udelay(175);/* Must wait for voltage to stabilize,2mV/us */
41  rk808_configure_buck(1, 1400);
42  udelay(100);/* Must wait for voltage to stabilize,2mV/us */
44 
45  /* i2c1 for tpm */
47  i2c_init(1, 400*KHz);
48 
49  /* spi2 for firmware ROM */
52  rockchip_spi_init(CONFIG_BOOT_DEVICE_SPI_FLASH_BUS, 24750*KHz);
53 
55 }
static void write32(void *addr, uint32_t val)
Definition: mmio.h:40
#define assert(statement)
Definition: assert.h:74
#define KHz
Definition: helpers.h:79
@ GPIO
Definition: chip.h:84
@ CONFIG
Definition: dsi_common.h:201
void setup_chromeos_gpios(void)
Definition: chromeos.c:10
#define setbits32(addr, set)
Definition: mmio.h:21
void gpio_output(gpio_t gpio, int value)
Definition: gpio.c:194
__weak void bootblock_mainboard_init(void)
Definition: bootblock.c:19
__weak void bootblock_mainboard_early_init(void)
Definition: bootblock.c:16
static struct rk3288_pmu_regs *const rk3288_pmu
Definition: pmu.h:55
#define IOMUX_I2C0SDA
Definition: pmu.h:57
#define IOMUX_I2C0SCL
Definition: pmu.h:58
static struct rk3288_grf_regs *const rk3288_grf
Definition: grf.h:181
#define IOMUX_UART2
Definition: grf.h:196
#define IOMUX_I2C1
Definition: grf.h:184
#define IOMUX_SPI2_TXRX
Definition: grf.h:193
#define IOMUX_SPI2_CSCLK
Definition: grf.h:192
void rk808_configure_buck(int buck, int millivolts)
Definition: rk808.c:98
void i2c_init(unsigned int bus)
Definition: i2c.c:198
void rockchip_spi_init(unsigned int bus, unsigned int speed_hz)
Definition: spi.c:84
void rkclk_configure_cpu(enum apll_frequencies apll_freq)
Definition: clock.c:309
int rkclk_was_watchdog_reset(void)
Definition: clock.c:652
#define UART2_BASE
Definition: addressmap.h:45
@ APLL_1800_MHZ
Definition: clock.h:16
u32 iomux_spi2csclk
Definition: grf.h:92
u32 iomux_spi2txrx
Definition: grf.h:97
u32 iomux_uart2
Definition: grf.h:86
u32 iomux_i2c1
Definition: grf.h:93
u32 iomux_i2c0scl
Definition: pmu.h:45
u32 iomux_i2c0sda
Definition: pmu.h:40
void udelay(uint32_t us)
Definition: udelay.c:15