diff --git a/src/mainboard/pine64/Kconfig b/src/mainboard/pine64/Kconfig new file mode 100644 index 0000000000..238192e1b2 --- /dev/null +++ b/src/mainboard/pine64/Kconfig @@ -0,0 +1,17 @@ +## SPDX-License-Identifier: GPL-2.0-only + +if VENDOR_PINE64 + +choice + prompt "Mainboard model" + +source "src/mainboard/pine64/*/Kconfig.name" + +endchoice + +source "src/mainboard/pine64/*/Kconfig" + +config MAINBOARD_VENDOR + default "Pine64" + +endif # VENDOR_PINE64 diff --git a/src/mainboard/pine64/Kconfig.name b/src/mainboard/pine64/Kconfig.name new file mode 100644 index 0000000000..209cff97f2 --- /dev/null +++ b/src/mainboard/pine64/Kconfig.name @@ -0,0 +1,2 @@ +config VENDOR_PINE64 + bool "Pine64" diff --git a/src/mainboard/pine64/rockpro64/Kconfig b/src/mainboard/pine64/rockpro64/Kconfig new file mode 100644 index 0000000000..4408d77499 --- /dev/null +++ b/src/mainboard/pine64/rockpro64/Kconfig @@ -0,0 +1,36 @@ +## SPDX-License-Identifier: GPL-2.0-only + +if BOARD_PINE64_ROCKPRO64 + +config BOARD_SPECIFIC_OPTIONS + def_bool y + select BOARD_ROMSIZE_KB_16384 + select COMMON_CBFS_SPI_WRAPPER + select SOC_ROCKCHIP_RK3399 + select SPI_FLASH + select SPI_FLASH_GIGADEVICE + +config MAINBOARD_DIR + string + default "pine64/rockpro64" + +config BOOT_DEVICE_SPI_FLASH_BUS + int + default 1 + +config CONSOLE_SERIAL_UART_ADDRESS + hex + depends on DRIVERS_UART + default 0xFF1A0000 + +########################################################## +#### Update below when adding a new derivative board. #### +########################################################## +config DEVICETREE + string + default "devicetree.cb" if BOARD_PINE64_ROCKPRO64 + +config MAINBOARD_PART_NUMBER + string + default "ROCKPro64" if BOARD_PINE64_ROCKPRO64 +endif # BOARD_PINE64_ROCKPRO64 diff --git a/src/mainboard/pine64/rockpro64/Kconfig.name b/src/mainboard/pine64/rockpro64/Kconfig.name new file mode 100644 index 0000000000..03b539f290 --- /dev/null +++ b/src/mainboard/pine64/rockpro64/Kconfig.name @@ -0,0 +1,2 @@ +config BOARD_PINE64_ROCKPRO64 + bool "ROCKPro64" diff --git a/src/mainboard/pine64/rockpro64/Makefile.inc b/src/mainboard/pine64/rockpro64/Makefile.inc new file mode 100644 index 0000000000..575b6f7392 --- /dev/null +++ b/src/mainboard/pine64/rockpro64/Makefile.inc @@ -0,0 +1,5 @@ +## SPDX-License-Identifier: GPL-2.0-only + +all-y += reset.c + +bootblock-y += bootblock.c diff --git a/src/mainboard/pine64/rockpro64/board.h b/src/mainboard/pine64/rockpro64/board.h new file mode 100644 index 0000000000..e775d3ad03 --- /dev/null +++ b/src/mainboard/pine64/rockpro64/board.h @@ -0,0 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef __COREBOOT_SRC_MAINBOARD_PINE64_ROCKPRO64_BOARD_H +#define __COREBOOT_SRC_MAINBOARD_PINE64_ROCKPRO64_BOARD_H + +#include + +#define GPIO_RESET GPIO(1, A, 6) + +#endif /* ! __COREBOOT_SRC_MAINBOARD_PINE64_ROCKPRO64_BOARD_H */ diff --git a/src/mainboard/pine64/rockpro64/board_info.txt b/src/mainboard/pine64/rockpro64/board_info.txt new file mode 100644 index 0000000000..f70801a005 --- /dev/null +++ b/src/mainboard/pine64/rockpro64/board_info.txt @@ -0,0 +1,6 @@ +Vendor name: Pine64 +Board name: ROCKPro64 +Category: sbc +ROM protocol: SPI +ROM socketed: n +Flashrom support: n diff --git a/src/mainboard/pine64/rockpro64/bootblock.c b/src/mainboard/pine64/rockpro64/bootblock.c new file mode 100644 index 0000000000..012bd66b75 --- /dev/null +++ b/src/mainboard/pine64/rockpro64/bootblock.c @@ -0,0 +1,40 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include +#include +#include +#include +#include + +void bootblock_mainboard_early_init(void) +{ + if (CONFIG(CONSOLE_SERIAL)) { + _Static_assert(CONFIG_CONSOLE_SERIAL_UART_ADDRESS == UART2_BASE, + "CONSOLE_SERIAL_UART should be UART2"); + + /* iomux: select gpio4c[4:3] as uart2 dbg port */ + write32(&rk3399_grf->iomux_uart2c, IOMUX_UART2C); + + /* grf soc_con7[11:10] use for uart2 select */ + write32(&rk3399_grf->soc_con7, UART2C_SEL); + } +} + +static void configure_spi_flash(void) +{ + gpio_input(GPIO(1, A, 7)); /* SPI1_MISO remove pull-up */ + gpio_input(GPIO(1, B, 0)); /* SPI1_MOSI remove pull-up */ + gpio_input(GPIO(1, B, 1)); /* SPI1_CLK remove pull-up */ + gpio_input(GPIO(1, B, 2)); /* SPI1_CS remove pull-up */ + + rockchip_spi_init(CONFIG_BOOT_DEVICE_SPI_FLASH_BUS, 33 * MHz); + rockchip_spi_set_sample_delay(CONFIG_BOOT_DEVICE_SPI_FLASH_BUS, 5); + + write32(&rk3399_pmugrf->spi1_rxd, IOMUX_SPI1_RX); + write32(&rk3399_pmugrf->spi1_csclktx, IOMUX_SPI1_CSCLKTX); +} + +void bootblock_mainboard_init(void) +{ + configure_spi_flash(); +} diff --git a/src/mainboard/pine64/rockpro64/devicetree.cb b/src/mainboard/pine64/rockpro64/devicetree.cb new file mode 100644 index 0000000000..5f01ccfda9 --- /dev/null +++ b/src/mainboard/pine64/rockpro64/devicetree.cb @@ -0,0 +1,5 @@ +## SPDX-License-Identifier: GPL-2.0-only + +chip soc/rockchip/rk3399 + device cpu_cluster 0 on end +end diff --git a/src/mainboard/pine64/rockpro64/reset.c b/src/mainboard/pine64/rockpro64/reset.c new file mode 100644 index 0000000000..46235da267 --- /dev/null +++ b/src/mainboard/pine64/rockpro64/reset.c @@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include +#include + +#include "board.h" + +void do_board_reset(void) +{ + gpio_output(GPIO_RESET, 1); +}