ARM: Add RV1103 Omega4 board support
Subsystems (8)
cover ARM: Add RV1103 Omega4 board support
From: Fabio Estevam <[email protected]>
Hi,
This patch series adds support for the Onion RV1103 Omega4 board to U-Boot. It covers SPL, SPI NAND boot, and the minimal board devicetree required to boot the board.
Upstreaming the RV1103 devicetree in Linux is ongoing, but to avoid blocking U-Boot support, this series introduces board-specific devicetrees for now. Once the Linux RV1103 devicetrees are upstreamed, the OF_UPSTREAM mechanism can be enabled.
Fabio Estevam (7):
pinctrl: rockchip: Add support for RV1103
clk: rockchip: Add support for RV1103
tools: rkcommon: Add rv1103 support
rockchip: spl-boot-order: Add SPI NAND support
spl: Add SPI NAND support via MTD in SPL
ARM: dts: Add RV1103 Omega4 support
omega4-rv1103: Add initial support
arch/arm/dts/rv1103-omega4-u-boot.dtsi | 11 + arch/arm/dts/rv1103-omega4.dts | 40 + arch/arm/dts/rv1103-u-boot.dtsi | 4 + arch/arm/dts/rv1103.dtsi | 267 +++++ .../include/asm/arch-rockchip/cru_rv1103.h | 271 +++++ .../include/asm/arch-rockchip/grf_rv1103.h | 31 + arch/arm/include/asm/arch-rv1103/boot0.h | 11 + arch/arm/mach-rockchip/Kconfig | 14 + arch/arm/mach-rockchip/Makefile | 1 + arch/arm/mach-rockchip/rv1103/Kconfig | 23 + arch/arm/mach-rockchip/rv1103/Makefile | 12 + arch/arm/mach-rockchip/rv1103/boot0.h | 5 + arch/arm/mach-rockchip/rv1103/clk_rv1103.c | 32 + arch/arm/mach-rockchip/rv1103/rv1103.c | 133 ++ arch/arm/mach-rockchip/rv1103/syscon_rv1103.c | 19 + arch/arm/mach-rockchip/spl-boot-order.c | 11 +- board/onion/omega4_rv1103/Kconfig | 12 + board/onion/omega4_rv1103/MAINTAINERS | 6 + board/onion/omega4_rv1103/Makefile | 7 + board/onion/omega4_rv1103/omega4_rv1103.c | 19 + board/onion/omega4_rv1103/omega4_rv1103.env | 5 + common/spl/Kconfig | 10 +- common/spl/Makefile | 1 + common/spl/spl_spi_nand.c | 82 ++ configs/omega4-rv1103_defconfig | 82 ++ doc/board/index.rst | 1 + doc/board/onion/index.rst | 9 + doc/board/onion/omega4-rv1103.rst | 56 + drivers/clk/rockchip/Makefile | 1 + drivers/clk/rockchip/clk_rv1103.c | 1068 +++++++++++++++++ drivers/mtd/Makefile | 1 + drivers/mtd/nand/Makefile | 13 +- drivers/pinctrl/Kconfig | 10 + drivers/pinctrl/rockchip/Makefile | 1 + drivers/pinctrl/rockchip/pinctrl-rv1103.c | 411 +++++++ include/configs/omega4_rv1103.h | 11 + include/configs/rv1103_common.h | 14 + include/dt-bindings/clock/rv1103-cru.h | 489 ++++++++ tools/rkcommon.c | 1 + 39 files changed, 3191 insertions(+), 4 deletions(-) create mode 100644 arch/arm/dts/rv1103-omega4-u-boot.dtsi create mode 100644 arch/arm/dts/rv1103-omega4.dts create mode 100644 arch/arm/dts/rv1103-u-boot.dtsi create mode 100644 arch/arm/dts/rv1103.dtsi create mode 100644 arch/arm/include/asm/arch-rockchip/cru_rv1103.h create mode 100644 arch/arm/include/asm/arch-rockchip/grf_rv1103.h create mode 100644 arch/arm/include/asm/arch-rv1103/boot0.h create mode 100644 arch/arm/mach-rockchip/rv1103/Kconfig create mode 100644 arch/arm/mach-rockchip/rv1103/Makefile create mode 100644 arch/arm/mach-rockchip/rv1103/boot0.h create mode 100644 arch/arm/mach-rockchip/rv1103/clk_rv1103.c create mode 100644 arch/arm/mach-rockchip/rv1103/rv1103.c create mode 100644 arch/arm/mach-rockchip/rv1103/syscon_rv1103.c create mode 100644 board/onion/omega4_rv1103/Kconfig create mode 100644 board/onion/omega4_rv1103/MAINTAINERS create mode 100644 board/onion/omega4_rv1103/Makefile create mode 100644 board/onion/omega4_rv1103/omega4_rv1103.c create mode 100644 board/onion/omega4_rv1103/omega4_rv1103.env create mode 100644 common/spl/spl_spi_nand.c create mode 100644 configs/omega4-rv1103_defconfig create mode 100644 doc/board/onion/index.rst create mode 100644 doc/board/onion/omega4-rv1103.rst create mode 100644 drivers/clk/rockchip/clk_rv1103.c create mode 100644 drivers/pinctrl/rockchip/pinctrl-rv1103.c create mode 100644 include/configs/omega4_rv1103.h create mode 100644 include/configs/rv1103_common.h create mode 100644 include/dt-bindings/clock/rv1103-cru.h
Signature · 1 line
2.34.1
PATCH 1/7 pinctrl: rockchip: Add support for RV1103
From: Fabio Estevam <[email protected]>
Add pinctrl driver for RV1103.
Imported from Rockchip U-Boot 2017.09 next-dev branch.
--- drivers/pinctrl/Kconfig | 10 + drivers/pinctrl/rockchip/Makefile | 1 + drivers/pinctrl/rockchip/pinctrl-rv1103.c | 411 ++++++++++++++++++++++ 3 files changed, 422 insertions(+) create mode 100644 drivers/pinctrl/rockchip/pinctrl-rv1103.c
drivers/pinctrl/Kconfig +10 -0
@@ -254,6 +254,16 @@ config PINCTRL_QE This option is to enable the QE pinctrl driver for QE based io controller. +config PINCTRL_ROCKCHIP_RV1103 + bool "Rockchip rv1103 pin control driver" + depends on DM + help + Support pin multiplexing control on Rockchip rv1103 SoC. + + The driver is controlled by a device tree node which contains + both the GPIO definitions and pin control functions for each + available multiplex function. + config PINCTRL_ROCKCHIP_RV1108 bool "Rockchip rv1108 pin control driver" depends on DM
drivers/pinctrl/rockchip/Makefile +1 -0
@@ -18,5 +18,6 @@ obj-$(CONFIG_ROCKCHIP_RK3528) += pinctrl-rk3528.o obj-$(CONFIG_ROCKCHIP_RK3568) += pinctrl-rk3568.o obj-$(CONFIG_ROCKCHIP_RK3576) += pinctrl-rk3576.o obj-$(CONFIG_ROCKCHIP_RK3588) += pinctrl-rk3588.o +obj-$(CONFIG_ROCKCHIP_RV1103) += pinctrl-rv1103.o obj-$(CONFIG_ROCKCHIP_RV1108) += pinctrl-rv1108.o obj-$(CONFIG_ROCKCHIP_RV1126) += pinctrl-rv1126.o
drivers/pinctrl/rockchip/pinctrl-rv1103.c new file +411 -0
411 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH 2/7 clk: rockchip: Add support for RV1103
In reply to Fabio EstevamFrom: Fabio Estevam <[email protected]>
Add clock driver for RV1103.
Imported from Rockchip U-Boot 2017.09 next-dev branch.
--- .../include/asm/arch-rockchip/cru_rv1103.h | 271 +++++ .../include/asm/arch-rockchip/grf_rv1103.h | 31 + drivers/clk/rockchip/Makefile | 1 + drivers/clk/rockchip/clk_rv1103.c | 1068 +++++++++++++++++ 4 files changed, 1371 insertions(+) create mode 100644 arch/arm/include/asm/arch-rockchip/cru_rv1103.h create mode 100644 arch/arm/include/asm/arch-rockchip/grf_rv1103.h create mode 100644 drivers/clk/rockchip/clk_rv1103.c
arch/arm/include/asm/arch-rockchip/cru_rv1103.h new file +271 -0
@@ -0,0 +1,271 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (c) 2024 Rockchip Electronics Co. Ltd. +* Author: Elaine Zhang <[email protected]> +*/ + +#ifndef _ASM_ARCH_CRU_RV1103B_H +#define _ASM_ARCH_CRU_RV1103B_H + +#define MHz 1000000 +#define KHz 1000 +#define OSC_HZ (24 * MHz) +#define RC_OSC_HZ (125 * MHz) + +#define GPLL_HZ (1188 * MHz) + +/* RV1103B pll id */ +enum rv1103b_pll_id { +GPLL , +PLL_COUNT , +}; + +struct rv1103b_clk_info { +unsigned long id; +char *name; +bool is_cru; +}; + +struct rv1103b_clk_priv { +struct rv1103b_cru *cru; +struct rv1103b_grf *grf; +ulong gpll_hz; +ulong armclk_hz; +ulong armclk_enter_hz; +ulong armclk_init_hz; +bool sync_kernel; +bool set_armclk_rate; +}; + +struct rv1103b_grf_clk_priv { +struct rv1103b_grf *grf; +}; + +struct rv1103b_pll { +unsigned int con0; +unsigned int con1; +unsigned int con2; +unsigned int con3; +unsigned int con4; +unsigned int reserved0[3 ]; +}; + +struct rv1103_clk_priv { +struct rv1103b_cru *cru; +ulong rate; +}; + +struct rv1103b_cru { +unsigned int reserved0[192 ]; +unsigned int peri_clksel_con[4 ]; +unsigned int reserved1[316 ]; +unsigned int peri_clkgate_con[12 ]; +unsigned int reserved2[116 ]; +unsigned int peri_softrst_con[12 ]; +unsigned int reserved3[15924 ]; +unsigned int vepu_clksel_con[3 ]; +unsigned int reserved4[317 ]; +unsigned int vepu_clkgate_con[1 ]; +unsigned int reserved5[127 ]; +unsigned int vepu_softrst_con[1 ]; +unsigned int reserved6[15935 ]; +unsigned int npu_clksel_con[3 ]; +unsigned int reserved7[317 ]; +unsigned int npu_clkgate_con[1 ]; +unsigned int reserved8[127 ]; +unsigned int npu_softrst_con[1 ]; +unsigned int reserved9[15935 ]; +unsigned int vi_clksel_con[1 ]; +unsigned int reserved10[319 ]; +unsigned int vi_clkgate_con[3 ]; +unsigned int reserved11[125 ]; +unsigned int vi_softrst_con[3 ]; +unsigned int reserved12[15933 ]; +unsigned int core_clksel_con[3 ]; +unsigned int reserved13[16381 ]; +unsigned int ddr_clksel_con[1 ]; +unsigned int reserved14[16207 ]; +struct rv1103b_pll pll[2 ]; +unsigned int reserved15[128 ]; +unsigned int mode; +unsigned int reserved16[31 ]; +unsigned int clksel_con[42 ]; +unsigned int reserved17[278 ]; +unsigned int clkgate_con[7 ]; +unsigned int reserved18[121 ]; +unsigned int softrst_con[1 ]; +unsigned int reserved19[127 ]; +unsigned int glb_cnt_th; +unsigned int glb_rst_st; +unsigned int glb_srst_fst; +unsigned int glb_srst_snd; +unsigned int glb_rst_con; +unsigned int reserved20[15803 ]; +unsigned int pmu_clksel_con[3 ]; +unsigned int reserved21[317 ]; +unsigned int pmu_clkgate_con[3 ]; +unsigned int reserved22[125 ]; +unsigned int pmu_softrst_con[3 ]; +unsigned int reserved23[15933 ]; +unsigned int pmu1_clksel_con[1 ]; +unsigned int reserved24[319 ]; +unsigned int pmu1_clkgate_con[2 ]; +unsigned int reserved25[126 ]; +unsigned int pmu1_softrst_con[2 ]; +}; + +check_member (rv1103b_cru, pmu1_softrst_con[1 ],0x80a04 ); + +struct pll_rate_table { +unsigned long rate; +unsigned int fbdiv; +unsigned int postdiv1; +unsigned int refdiv; +unsigned int postdiv2; +unsigned int dsmpd; +unsigned int frac; +}; + +#define RV1103B_TOPCRU_BASE 0x60000 +#define RV1103B_PERICRU_BASE 0x0 +#define RV1103B_VICRU_BASE 0x30000 +#define RV1103B_NPUCRU_BASE 0x20000 +#define RV1103B_CORECRU_BASE 0x40000 +#define RV1103B_VEPUCRU_BASE 0x10000 +#define RV1103B_DDRCRU_BASE 0x50000 +#define RV1103B_SUBDDRCRU_BASE 0x58000 +#define RV1103B_PMUCRU_BASE 0x70000 +#define RV1103B_PMU1CRU_BASE 0x80000 + +#define RV1103B_CRU_BASE 0x20000000 + +#define RV1103B_PLL_CON (x) ((x) * 0x4 + RV1103B_TOPCRU_BASE) +#define RV1103B_MODE_CON (0x280 + RV1103B_TOPCRU_BASE) +#define RV1103B_CLKSEL_CON (x) ((x) * 0x4 + 0x300 + RV1103B_TOPCRU_BASE) +#define RV1103B_SUBDDRMODE_CON (0x280 + RV1103B_SUBDDRCRU_BASE) + +enum { +/* CORECRU_CLK_SEL0_CON */ +CLK_CORE_SRC_SEL_SHIFT =1 , +CLK_CORE_SRC_SEL_MASK =0x1 <<CLK_CORE_SRC_SEL_SHIFT , +CLK_CORE_SRC_SEL_GPLL =0 , +CLK_CORE_SRC_SEL_PVTPLL , + +/* CRU_PERI_CLK_SEL0_CON */ +CLK_TSADC_TSEN_DIV_SHIFT =10 , +CLK_TSADC_TSEN_DIV_MASK =0x1f <<CLK_TSADC_TSEN_DIV_SHIFT , +CLK_TSADC_DIV_SHIFT =4 , +CLK_TSADC_DIV_MASK =0x1f <<CLK_TSADC_DIV_SHIFT , +PCLK_PERI_DIV_SHIFT =0 , +PCLK_PERI_DIV_MASK =0x3 <<PCLK_PERI_DIV_SHIFT , + +/* CRU_PERI_CLK_SEL1_CON */ +CLK_SARADC_DIV_SHIFT =0 , +CLK_SARADC_DIV_MASK =0x7 <<CLK_SARADC_DIV_SHIFT , + +/* CRU_CLK_SEL5_CON */ +CLK_UART2_SRC_DIV_SHIFT =10 , +CLK_UART2_SRC_DIV_MASK =0x1f <<CLK_UART2_SRC_DIV_SHIFT , +CLK_UART1_SRC_DIV_SHIFT =5 , +CLK_UART1_SRC_DIV_MASK =0x1f <<CLK_UART1_SRC_DIV_SHIFT , +CLK_UART0_SRC_DIV_SHIFT =0 , +CLK_UART0_SRC_DIV_MASK =0x1f <<CLK_UART0_SRC_DIV_SHIFT , + +/* CRU_CLK_SEL10_CON */ +CLK_UART_FRAC_NUMERATOR_SHIFT =16 , +CLK_UART_FRAC_NUMERATOR_MASK =0xffff <<16 , +CLK_UART_FRAC_DENOMINATOR_SHIFT =0 , +CLK_UART_FRAC_DENOMINATOR_MASK =0xffff , + +/* CRU_CLK_SEL31_CON */ +CLK_EMMC_SEL_SHIFT =15 , +CLK_EMMC_SEL_MASK =0x1 <<CLK_EMMC_SEL_SHIFT , +ACLK_PERI_SEL_SHIFT =10 , +ACLK_PERI_SEL_MASK =0x3 <<ACLK_PERI_SEL_SHIFT , +ACLK_PERI_SEL_600M =0 , +ACLK_PERI_SEL_480M , +ACLK_PERI_SEL_400M , +LSCLK_PERI_SEL_SHIFT =9 , +LSCLK_PERI_SEL_MASK =0x1 <<LSCLK_PERI_SEL_SHIFT , +LSCLK_PERI_SEL_300M =0 , +LSCLK_PERI_SEL_200M , +CLK_EMMC_DIV_SHIFT =0 , +CLK_EMMC_DIV_MASK =0xff <<CLK_EMMC_DIV_SHIFT , + +/* CRU_CLK_SEL32_CON */ +CLK_SDMMC_SEL_SHIFT =15 , +CLK_SDMMC_SEL_MASK =0x1 <<CLK_SDMMC_SEL_SHIFT , +CLK_MMC_SEL_GPLL =0 , +CLK_MMC_SEL_OSC , +CLK_UART2_SEL_SHIFT =12 , +CLK_UART2_SEL_MASK =3 <<CLK_UART2_SEL_SHIFT , +CLK_UART1_SEL_SHIFT =10 , +CLK_UART1_SEL_MASK =3 <<CLK_UART1_SEL_SHIFT , +CLK_UART0_SEL_SHIFT =8 , +CLK_UART0_SEL_MASK =3 <<CLK_UART0_SEL_SHIFT , +CLK_UART_SEL_SRC =0 , +CLK_UART_SEL_FRAC , +CLK_UART_SEL_OSC , +CLK_SDMMC_DIV_SHIFT =0 , +CLK_SDMMC_DIV_MASK =0xff <<CLK_SDMMC_DIV_SHIFT , + +/* CRU_CLK_SEL33_CON */ +CLK_SFC_SEL_SHIFT =15 , +CLK_SFC_SEL_MASK =0x1 <<CLK_SFC_SEL_SHIFT , +CLK_SFC_DIV_SHIFT =0 , +CLK_SFC_DIV_MASK =0xff <<CLK_SFC_DIV_SHIFT , + +/* CRU_CLK_SEL34_CON */ +CLK_PWM2_SEL_SHIFT =14 , +CLK_PWM2_SEL_MASK =1 <<CLK_PWM2_SEL_SHIFT , +CLK_PWM1_SEL_SHIFT =13 , +CLK_PWM1_SEL_MASK =1 <<CLK_PWM1_SEL_SHIFT , +CLK_PWM0_SEL_SHIFT =12 , +CLK_PWM0_SEL_MASK =1 <<CLK_PWM0_SEL_SHIFT , +CLK_PWM_SEL_100M =0 , +CLK_PWM_SEL_24M , +CLK_SPI0_SEL_SHIFT =2 , +CLK_SPI0_SEL_MASK =3 <<CLK_SPI0_SEL_SHIFT , +CLK_SPI0_SEL_200M =0 , +CLK_SPI0_SEL_100M , +CLK_SPI0_SEL_50M , +CLK_SPI0_SEL_24M , +CLK_I2C1_SEL_SHIFT =1 , +CLK_I2C1_SEL_MASK =0x1 <<CLK_I2C1_SEL_SHIFT , +CLK_I2C0_SEL_SHIFT =0 , +CLK_I2C0_SEL_MASK =0x1 <<CLK_I2C0_SEL_SHIFT , +CLK_I2C_SEL_100M =0 , +CLK_I2C_SEL_24M , + +/* CRU_CLK_SEL35_CON */ +CLK_PKA_CRYPTO_SEL_SHIFT =4 , +CLK_PKA_CRYPTO_SEL_MASK =0x3 <<CLK_PKA_CRYPTO_SEL_SHIFT , +CLK_CORE_CRYPTO_SEL_SHIFT =2 , +CLK_CORE_CRYPTO_SEL_MASK =0x3 <<CLK_CORE_CRYPTO_SEL_SHIFT , +CLK_CORE_CRYPTO_SEL_300M =0 , +CLK_CORE_CRYPTO_SEL_200M , +CLK_CORE_CRYPTO_SEL_100M , +DCLK_DECOM_SEL_SHIFT =0 , +DCLK_DECOM_SEL_MASK =0x3 <<DCLK_DECOM_SEL_SHIFT , +DCLK_DECOM_SEL_480M =0 , +DCLK_DECOM_SEL_400M , +DCLK_DECOM_SEL_300M , + +/* CRU_CLK_SEL37_CON */ +CLK_CORE_GPLL_DIV_SHIFT =13 , +CLK_CORE_GPLL_DIV_MASK =0x7 <<CLK_CORE_GPLL_DIV_SHIFT , +CLK_CORE_GPLL_SEL_SHIFT =12 , +CLK_CORE_GPLL_SEL_MASK =0x1 <<CLK_CORE_GPLL_SEL_SHIFT , +CLK_CORE_GPLL_SEL_GPLL =0 , +CLK_CORE_GPLL_SEL_OSC , + +/* CRU_PMU_CLK_SEL2_CON */ +LSCLK_PMU_SEL_SHIFT =4 , +LSCLK_PMU_SEL_MASK =0x1 <<LSCLK_PMU_SEL_SHIFT , +LSCLK_PMU_SEL_24M =0 , +LSCLK_PMU_SEL_RC_OSC , +LSCLK_PMU_DIV_SHIFT =0 , +LSCLK_PMU_DIV_MASK =0x3 <<LSCLK_PMU_DIV_SHIFT , + +}; +#endif
arch/arm/include/asm/arch-rockchip/grf_rv1103.h new file +31 -0
@@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ + +/* +* (C) Copyright 2024 Rockchip Electronics Co., Ltd. +*/ + +#ifndef _ASM_ARCH_GRF_RV1103B_H +#define _ASM_ARCH_GRF_RV1103B_H + +#define VEPU_GRF 0x20100000 +#define NPU_GRF 0x20110000 +#define VI_GRF 0x20120000 +#define CPU_GRF 0x20130000 +#define DDR_GRF 0x20140000 +#define SYS_GRF 0x20150000 +#define PMU_GRF 0x20160000 + +struct rv1103_grf { +u32 reserved0[(SYS_GRF +0xA0 -VEPU_GRF ) /4 ]; +u32 gmac_con0;/* address offset: 0x00a0 */ +u32 gmac_clk_con;/* address offset: 0x00a4 */ +u32 gmac_st;/* address offset: 0x00a8 */ +u32 reserved00ac;/* address offset: 0x00ac */ +u32 macphy_con0;/* address offset: 0x00b0 */ +u32 macphy_con1;/* address offset: 0x00b4 */ +u32 reserved1[(PMU_GRF +0x10000 - (SYS_GRF +0xB4 )) /4 ]; +}; + +check_member (rv1103_grf, macphy_con1,SYS_GRF +0xB4 -VEPU_GRF ); + +#endif /* _ASM_ARCH_GRF_RV1103B_H */
drivers/clk/rockchip/Makefile +1 -0
@@ -19,5 +19,6 @@ obj-$(CONFIG_ROCKCHIP_RK3528) += clk_rk3528.o obj-$(CONFIG_ROCKCHIP_RK3568) += clk_rk3568.o obj-$(CONFIG_ROCKCHIP_RK3576) += clk_rk3576.o obj-$(CONFIG_ROCKCHIP_RK3588) += clk_rk3588.o +obj-$(CONFIG_ROCKCHIP_RV1103) += clk_rv1103.o obj-$(CONFIG_ROCKCHIP_RV1108) += clk_rv1108.o obj-$(CONFIG_ROCKCHIP_RV1126) += clk_rv1126.o
drivers/clk/rockchip/clk_rv1103.c new file +1068 -0
1,068 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH 4/7 rockchip: spl-boot-order: Add SPI NAND support
In reply to Fabio EstevamFrom: Fabio Estevam <[email protected]>
Make spl-boot-order to accept booting from SPI NAND as well.
With this change, it is possible to specify spi_nand as the boot medium like this:
u-boot,spl-boot-order = &spi_nand;
--- arch/arm/mach-rockchip/spl-boot-order.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
arch/arm/mach-rockchip/spl-boot-order.c +9 -2
@@ -4,6 +4,7 @@*/ #include <dm.h> +#include <dm/device_compat.h> #include <fdt_support.h> #include <log.h> #include <mmc.h>
@@ -75,6 +76,8 @@ static int spl_node_to_boot_device(int node)*/ if (!uclass_find_device_by_of_offset (UCLASS_SPI_FLASH , node, &parent))return BOOT_DEVICE_SPI ; +if (fdt_node_check_compatible (gd->fdt_blob, node,"spi-nand" ) ==0 ) +return BOOT_DEVICE_SPI ;return -1 ; }
@@ -221,8 +224,12 @@ int spl_decode_boot_device(u32 boot_device, char *buf, size_t buflen) ret =uclass_find_device_by_of_offset (UCLASS_SPI_FLASH , node, &dev);if (ret) { -debug ("%s: could not find udevice for %s\n" , __func__, conf); -continue ; + ret =uclass_find_device_by_of_offset (UCLASS_MTD , node, &dev); +if (ret || !device_is_compatible (dev,"spi-nand" )) { +debug ("%s: could not find udevice for %s\n" , + __func__, conf); +continue ; + } }return ofnode_get_path (dev_ofnode (dev), buf, buflen);
Signature · 1 line
2.34.1
PATCH 5/7 spl: Add SPI NAND support via MTD in SPL
In reply to Fabio EstevamFrom: Fabio Estevam <[email protected]>
Add support for booting U-Boot SPL from SPI NAND devices using the MTD subsystem.
- Introduce CONFIG_SPL_SPI_NAND_LOAD to enable SPL loading from SPI NAND flash.
- Implement spl_spi_nand.c as a dedicated SPL loader that reads the FIT image from SPI NAND via MTD.
- Update common/spl/Kconfig and Makefiles to include the new loader in SPL builds.
- Adjust drivers/mtd/Makefile and drivers/mtd/nand/Makefile to build the necessary SPI NAND MTD objects only when CONFIG_SPL_SPI_NAND_LOAD is enabled, avoiding size impact on other boards.
This allows boards like the Omega4 RV1103 to boot SPL directly from SPI NAND, keeping the SPL small and avoiding unnecessary inclusion of SPI NOR code.
--- common/spl/Kconfig | 10 ++++- common/spl/Makefile | 1 + common/spl/spl_spi_nand.c | 82 +++++++++++++++++++++++++++++++++++++++ drivers/mtd/Makefile | 1 + drivers/mtd/nand/Makefile | 13 ++++++- 5 files changed, 105 insertions(+), 2 deletions(-) create mode 100644 common/spl/spl_spi_nand.c
common/spl/Kconfig +9 -1
@@ -1576,13 +1576,21 @@ config SPL_SPI_LOAD Enable support for loading next stage, U-Boot or otherwise, from SPI NOR in U-Boot SPL. +config SPL_SPI_NAND_LOAD + bool "Support loading from SPI NAND flash" + depends on SPL + depends on MTD && DM_MTD + help + Enable support for loading next stage, U-Boot or otherwise, from + SPI NAND in U-Boot SPL. + endif # SPL_SPI_FLASH_SUPPORT config SYS_SPI_U_BOOT_OFFS hex "address of u-boot payload in SPI flash" default 0x8000 if ARCH_SUNXI default 0x0 - depends on SPL_SPI_LOAD || SPL_SPI_SUNXI + depends on SPL_SPI_LOAD || SPL_SPI_NAND_LOAD || SPL_SPI_SUNXI help Address within SPI-Flash from where the u-boot payload is fetched from.
common/spl/Makefile +1 -0
@@ -35,6 +35,7 @@ obj-$(CONFIG_$(PHASE_)NVME) += spl_nvme.o obj-$(CONFIG_$(PHASE_)SEMIHOSTING) += spl_semihosting.o obj-$(CONFIG_$(PHASE_)DFU) += spl_dfu.o obj-$(CONFIG_$(PHASE_)SPI_LOAD) += spl_spi.o +obj-$(CONFIG_$(PHASE_)SPI_NAND_LOAD) += spl_spi_nand.o obj-$(CONFIG_$(PHASE_)RAM_SUPPORT) += spl_ram.o obj-$(CONFIG_$(PHASE_)USB_SDP_SUPPORT) += spl_sdp.o endif
common/spl/spl_spi_nand.c new file +82 -0
82 lines not on this page · raw message
drivers/mtd/Makefile +1 -0
@@ -34,6 +34,7 @@ else ifneq ($(mtd-y),) obj-$(CONFIG_SPL_MTD) += mtd.o endif +obj-$(CONFIG_SPL_SPI_NAND_LOAD) += nand/ obj-$(CONFIG_$(PHASE_)NAND_SUPPORT) += nand/ obj-$(CONFIG_SPL_ONENAND_SUPPORT) += onenand/ obj-$(CONFIG_$(PHASE_)SPI_FLASH_SUPPORT) += spi/
drivers/mtd/nand/Makefile +12 -1
@@ -1,10 +1,21 @@ # SPDX-License-Identifier: GPL-2.0+ -ifeq ($(CONFIG_XPL_BUILD)$(CONFIG_TPL_BUILD),) nandcore-objs := core.o bbt.o + +ifeq ($(CONFIG_XPL_BUILD)$(CONFIG_TPL_BUILD),) + +# U-Boot proper obj-$(CONFIG_MTD_NAND_CORE) += nandcore.o obj-$(CONFIG_MTD_RAW_NAND) += raw/ obj-$(CONFIG_MTD_SPI_NAND) += spi/ + else + +# SPL / XPL / TPL +# SPL has no MTD_NAND_CORE symbol, so we must key off SPI NAND usage +obj-$(CONFIG_SPL_SPI_NAND_LOAD) += nandcore.o +obj-$(CONFIG_SPL_SPI_NAND_LOAD) += spi/ + +# raw NAND still follows the normal SPL rule obj-$(CONFIG_$(PHASE_)NAND_SUPPORT) += raw/ endif
Signature · 1 line
2.34.1
PATCH 3/7 tools: rkcommon: Add rv1103 support
In reply to Fabio EstevamFrom: Fabio Estevam <[email protected]>
Allow rkcommon to generate an image for the RV1103.
Based on Rockchip U-Boot 2017.09 next-dev branch.
--- tools/rkcommon.c | 1 + 1 file changed, 1 insertion(+)
tools/rkcommon.c +1 -0
@@ -148,6 +148,7 @@ static struct spl_info spl_infos[] = { { "rk3328", "RK32", 0x8000 - 0x800, false, RK_HEADER_V1 }, { "rk3368", "RK33", 0x8000 - 0x1000, false, RK_HEADER_V1 }, { "rk3399", "RK33", 0x30000 - 0x2000, false, RK_HEADER_V1 }, + { "rv1103", "RV11", 0x40000 - 0x1000, false, RK_HEADER_V2 }, { "rv1108", "RK11", 0x1800, false, RK_HEADER_V1 }, { "rv1126", "110B", 0x10000 - 0x1000, false, RK_HEADER_V1 }, { "rk3528", "RK35", 0x10000 - 0x1000, false, RK_HEADER_V2 },
Signature · 1 line
2.34.1
PATCH 6/7 ARM: dts: Add RV1103 Omega4 support
In reply to Fabio EstevamFrom: Fabio Estevam <[email protected]>
Add minimal devicetree support for the Onion RV1103 Omega4 board.
These devicetrees are currently not upstream in Linux. They allow U-Boot to boot the board and progress with development, independent of the Linux RV1103 upstream process.
Once the RV1103 devicetrees are merged into the upstream Linux kernel, he OF_UPSTREAM mechanism can be enabled to use the kernel-provided devicetree.
This patch enables the Onion's Omega4 board to be supported in U-Boot without blocking other upstreaming efforts.
--- arch/arm/dts/rv1103-omega4-u-boot.dtsi | 11 + arch/arm/dts/rv1103-omega4.dts | 40 ++++ arch/arm/dts/rv1103-u-boot.dtsi | 4 + arch/arm/dts/rv1103.dtsi | 267 +++++++++++++++++++++++++ 4 files changed, 322 insertions(+) create mode 100644 arch/arm/dts/rv1103-omega4-u-boot.dtsi create mode 100644 arch/arm/dts/rv1103-omega4.dts create mode 100644 arch/arm/dts/rv1103-u-boot.dtsi create mode 100644 arch/arm/dts/rv1103.dtsi
arch/arm/dts/rv1103-omega4-u-boot.dtsi new file +11 -0
@@ -0,0 +1,11 @@ +// SPDX-License-Identifier: GPL-2.0+ +// (C) Copyright 2024 Rockchip Electronics Co., Ltd + +#include "rockchip-u-boot.dtsi" + +/ { + chosen { + stdout-path = &uart0; + u-boot,spl-boot-order = &spi_nand; + }; +};
arch/arm/dts/rv1103-omega4.dts new file +40 -0
@@ -0,0 +1,40 @@ +// SPDX-License-Identifier: GPL-2.0+ +// (C) Copyright 2024 Rockchip Electronics Co., Ltd + +/dts-v1/; +#include "rv1103.dtsi" + +/ { + model = "Onion RV1103 Omega4 board"; + compatible = "onion,rv1103-omega4", "rockchip,rv1103"; + + chosen { + stdout-path = &uart0; + }; +}; + +&sfc { + bootph-all; + status = "okay"; + + #address-cells = <1>; + #size-cells = <0>; + spi_nand: flash@0 { + compatible = "spi-nand"; + reg = <0>; + spi-tx-bus-width = <1>; + spi-rx-bus-width = <4>; + spi-max-frequency = <24000000>; + bootph-all; + }; +}; + +&uart0 { + bootph-pre-ram; + status = "okay"; +}; + +&wdt { + bootph-pre-ram; + status = "okay"; +};
arch/arm/dts/rv1103-u-boot.dtsi new file +4 -0
@@ -0,0 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+ +// (C) Copyright 2024 Rockchip Electronics Co., Ltd + +#include "rockchip-u-boot.dtsi"
arch/arm/dts/rv1103.dtsi new file +267 -0
267 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH 7/7 omega4-rv1103: Add initial support
In reply to Fabio EstevamFrom: Fabio Estevam <[email protected]>
Add the initial support for Onion's Omega4 RV1103 board.
It boots from the SPI NAND.
Tested the boot of a 6.6 OpenWRT kernel.
--- arch/arm/include/asm/arch-rv1103/boot0.h | 11 + arch/arm/mach-rockchip/Kconfig | 14 + arch/arm/mach-rockchip/Makefile | 1 + arch/arm/mach-rockchip/rv1103/Kconfig | 23 + arch/arm/mach-rockchip/rv1103/Makefile | 12 + arch/arm/mach-rockchip/rv1103/boot0.h | 5 + arch/arm/mach-rockchip/rv1103/clk_rv1103.c | 32 ++ arch/arm/mach-rockchip/rv1103/rv1103.c | 133 +++++ arch/arm/mach-rockchip/rv1103/syscon_rv1103.c | 19 + board/onion/omega4_rv1103/Kconfig | 12 + board/onion/omega4_rv1103/MAINTAINERS | 6 + board/onion/omega4_rv1103/Makefile | 7 + board/onion/omega4_rv1103/omega4_rv1103.c | 19 + board/onion/omega4_rv1103/omega4_rv1103.env | 5 + configs/omega4-rv1103_defconfig | 82 +++ doc/board/index.rst | 1 + doc/board/onion/index.rst | 9 + doc/board/onion/omega4-rv1103.rst | 56 ++ include/configs/omega4_rv1103.h | 11 + include/configs/rv1103_common.h | 14 + include/dt-bindings/clock/rv1103-cru.h | 489 ++++++++++++++++++ 21 files changed, 961 insertions(+) create mode 100644 arch/arm/include/asm/arch-rv1103/boot0.h create mode 100644 arch/arm/mach-rockchip/rv1103/Kconfig create mode 100644 arch/arm/mach-rockchip/rv1103/Makefile create mode 100644 arch/arm/mach-rockchip/rv1103/boot0.h create mode 100644 arch/arm/mach-rockchip/rv1103/clk_rv1103.c create mode 100644 arch/arm/mach-rockchip/rv1103/rv1103.c create mode 100644 arch/arm/mach-rockchip/rv1103/syscon_rv1103.c create mode 100644 board/onion/omega4_rv1103/Kconfig create mode 100644 board/onion/omega4_rv1103/MAINTAINERS create mode 100644 board/onion/omega4_rv1103/Makefile create mode 100644 board/onion/omega4_rv1103/omega4_rv1103.c create mode 100644 board/onion/omega4_rv1103/omega4_rv1103.env create mode 100644 configs/omega4-rv1103_defconfig create mode 100644 doc/board/onion/index.rst create mode 100644 doc/board/onion/omega4-rv1103.rst create mode 100644 include/configs/omega4_rv1103.h create mode 100644 include/configs/rv1103_common.h create mode 100644 include/dt-bindings/clock/rv1103-cru.h
arch/arm/include/asm/arch-rv1103/boot0.h new file +11 -0
@@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* (C) Copyright 2019 Rockchip Electronics Co., Ltd +*/ + +#ifndef __ASM_ARCH_BOOT0_H__ +#define __ASM_ARCH_BOOT0_H__ + +#include <asm/arch-rockchip/boot0.h> + +#endif
arch/arm/mach-rockchip/Kconfig +14 -0
@@ -487,6 +487,19 @@ config ROCKCHIP_RK3588 SD3.0/MMC4.5, USB OTG 3.0, Type-C, USB 2.0, PCIe 3.0, SATA 3, Ethernet, SDIO3.0 I2C, UART, SPI, GPIO and PWM. +config ROCKCHIP_RV1103 + bool "Support Rockchip RV1103" + select CPU_V7A + select SPL_ARMV7_SET_CORTEX_SMPEN + select SUPPORT_SPL + select SPL + imply ROCKCHIP_COMMON_BOARD + + help + The Rockchip RV1103 is an ARM-based SoC with a single Cortex-A7 + 32-bit core which integrates NEON and FPU. + It contains a built-in NPU for AI related applications. + config ROCKCHIP_RV1108 bool "Support Rockchip RV1108" select CPU_V7A
@@ -749,6 +762,7 @@ source "arch/arm/mach-rockchip/rk3528/Kconfig" source "arch/arm/mach-rockchip/rk3568/Kconfig" source "arch/arm/mach-rockchip/rk3576/Kconfig" source "arch/arm/mach-rockchip/rk3588/Kconfig" +source "arch/arm/mach-rockchip/rv1103/Kconfig" source "arch/arm/mach-rockchip/rv1108/Kconfig" source "arch/arm/mach-rockchip/rv1126/Kconfig"
arch/arm/mach-rockchip/Makefile +1 -0
@@ -46,6 +46,7 @@ obj-$(CONFIG_ROCKCHIP_RK3528) += rk3528/ obj-$(CONFIG_ROCKCHIP_RK3568) += rk3568/ obj-$(CONFIG_ROCKCHIP_RK3576) += rk3576/ obj-$(CONFIG_ROCKCHIP_RK3588) += rk3588/ +obj-$(CONFIG_ROCKCHIP_RV1103) += rv1103/ obj-$(CONFIG_ROCKCHIP_RV1108) += rv1108/ obj-$(CONFIG_ROCKCHIP_RV1126) += rv1126/
arch/arm/mach-rockchip/rv1103/Kconfig new file +23 -0
@@ -0,0 +1,23 @@ +if ROCKCHIP_RV1103 + + +config TARGET_OMEGA4_RV1103 + bool "OMEGA4_RV1103" + help + Support Onion's Omega4 RV1103 board. + +config ROCKCHIP_BOOT_MODE_REG + default 0x20160200 + +config ROCKCHIP_STIMER_BASE + default 0x20500000 + +config SYS_SOC + default "rv1103" + +config SYS_MALLOC_F_LEN + default 0x400 + +source "board/onion/omega4_rv1103/Kconfig" + +endif
arch/arm/mach-rockchip/rv1103/Makefile new file +12 -0
@@ -0,0 +1,12 @@ +# +# (C) Copyright 2016 Rockchip Electronics Co., Ltd +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y += rv1103.o +obj-y += clk_rv1103.o + +ifndef CONFIG_XPL_BUILD +obj-y += syscon_rv1103.o +endif
arch/arm/mach-rockchip/rv1103/boot0.h new file +5 -0
@@ -0,0 +1,5 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* Dummy boot0.h for RV1103 — SoC does not require special boot0 setup. */ +#ifndef __ASM_ARCH_BOOT0_H__ +#define __ASM_ARCH_BOOT0_H__ +#endif
arch/arm/mach-rockchip/rv1103/clk_rv1103.c new file +32 -0
@@ -0,0 +1,32 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* (C) Copyright 2016 Rockchip Electronics Co., Ltd +* Author: Andy Yan <[email protected]> +*/ + +#include <dm.h> +#include <syscon.h> +#include <asm/arch-rockchip/clock.h> +#include <asm/arch-rockchip/cru_rv1103.h> +#include <linux/err.h> + +int rockchip_get_clk (struct udevice **devp) +{ +return uclass_get_device_by_driver (UCLASS_CLK , +DM_DRIVER_GET (clk_rv1103), devp); +} + +void *rockchip_get_cru (void ) +{ +struct rv1103_clk_priv *priv; +struct udevice *dev; +int ret; + + ret =rockchip_get_clk (&dev); +if (ret) +return ERR_PTR (ret); + + priv =dev_get_priv (dev); + +return priv->cru; +}
arch/arm/mach-rockchip/rv1103/rv1103.c new file +133 -0
133 lines not on this page · raw message
arch/arm/mach-rockchip/rv1103/syscon_rv1103.c new file +19 -0
@@ -0,0 +1,19 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* (C) Copyright 2016 Rockchip Electronics Co., Ltd +*/ + +#include <dm.h> +#include <syscon.h> +#include <asm/arch-rockchip/clock.h> + +static const struct udevice_id rv1103_syscon_ids[] = { + { .compatible ="rockchip,rv1103-grf" , .data =ROCKCHIP_SYSCON_GRF }, + { } +}; + +U_BOOT_DRIVER (syscon_rv1103) = { + .name ="rv1103_syscon" , + .id =UCLASS_SYSCON , + .of_match = rv1103_syscon_ids, +};
board/onion/omega4_rv1103/Kconfig new file +12 -0
@@ -0,0 +1,12 @@ +if TARGET_OMEGA4_RV1103 + +config SYS_BOARD + default "omega4_rv1103" + +config SYS_VENDOR + default "onion" + +config SYS_CONFIG_NAME + default "omega4_rv1103" + +endif
board/onion/omega4_rv1103/MAINTAINERS new file +6 -0
@@ -0,0 +1,6 @@ +OMEGA4 RV1103 +M: Fabio Estevam <[email protected]> +S: Maintained +F: board/onion/omega4_rv1103 +F: include/configs/omega4_rv1103.h +F: configs/omega4-rv1103_defconfig
board/onion/omega4_rv1103/Makefile new file +7 -0
@@ -0,0 +1,7 @@ +# +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright 2026 Fabio Estevam <[email protected]> +# + +obj-y += omega4_rv1103.o
board/onion/omega4_rv1103/omega4_rv1103.c new file +19 -0
@@ -0,0 +1,19 @@ +// SPDX-License-Identifier: GPL-2.0+ +// +// Copyright 2026 Fabio Estevam <[email protected]> + +#include <asm/global_data.h> + +DECLARE_GLOBAL_DATA_PTR ; + +int dram_init (void ) +{ + gd->ram_size =SZ_256M ; + +return 0 ; +} + +phys_addr_t board_get_usable_ram_top (phys_size_t total_size) +{ +return gd->ram_top; +}
board/onion/omega4_rv1103/omega4_rv1103.env new file +5 -0
@@ -0,0 +1,5 @@ +kernel_addr_r=0x00800000 +fdt_addr_r=0x02000000 +ramdisk_addr_r=0x04000000 +bootargs=console=ttyS0,115200 mtdparts=spi1.0:256K(env),1M@256K(idblock),1M(uboot),8M(boot),-(ubi) ro rootwait ubi.mtd=ubi ubi.block=0,rootfs root=/dev/ubiblock0_0 rootfstype=squashfs +bootcmd=mtd read spi-nand0 0x04000000 0x240000 0x800000;imxtract 0x04000000 kernel 0x00800000; imxtract 0x04000000 fdt 0x02000000; bootz 0x00800000 - 0x02000000
configs/omega4-rv1103_defconfig new file +82 -0
82 lines not on this page · raw message
doc/board/index.rst +1 -0
@@ -45,6 +45,7 @@ Board-specific doc motorola/index nvidia/index nxp/index + onion/index openpiton/index ouya/index pegatron/index
doc/board/onion/index.rst new file +9 -0
@@ -0,0 +1,9 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +Onion +===== + +.. toctree:: + :maxdepth: 2 + + omega4-rv1103
doc/board/onion/omega4-rv1103.rst new file +56 -0
56 lines not on this page · raw message
include/configs/omega4_rv1103.h new file +11 -0
@@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* (C) Copyright 2016 Rockchip Electronics Co., Ltd +*/ + +#ifndef __CONFIG_H +#define __CONFIG_H + +#include <configs/rv1103_common.h> + +#endif
include/configs/rv1103_common.h new file +14 -0
@@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* (C) Copyright 2016 Rockchip Electronics Co., Ltd +*/ +#ifndef __CONFIG_RV1103_COMMON_H +#define __CONFIG_RV1103_COMMON_H + +#include "rockchip-common.h" +#include <config_distro_bootcmd.h> + +#define CFG_IRAM_BASE 0x210f6000 +#define CFG_SYS_SDRAM_BASE 0x00000000 + +#endif
include/dt-bindings/clock/rv1103-cru.h new file +489 -0
489 lines not on this page · raw message
Signature · 1 line
2.34.1
Hi Fabio,
Quoted 7 lines · Fabio Estevam
From: Fabio Estevam <[email protected]>
Hi,
This patch series adds support for the Onion RV1103 Omega4 board to U-Boot. It covers SPL, SPI NAND boot, and the minimal board devicetree required to boot the board.
This series seem to handle the RV1103B variant and not the RV1106/RV1103 variant, please name parts as rv1103b to match vendor U-Boot or is the rv1106/rv1103 and rv1103b fully compatible?
Quoted 4 lines
Upstreaming the RV1103 devicetree in Linux is ongoing, but to avoid blocking U-Boot support, this series introduces board-specific devicetrees for now. Once the Linux RV1103 devicetrees are upstreamed, the
OF_UPSTREAMmechanism can be enabled.
For the Rockchip platform we typically expect e.g. dt-bindings headers for core parts to be upstreamed to Linux and picked from dts/upstream for new SoC support.
Please at least send out clk and pinctrl dt-bindings and drivers for Linux before a v2 of this series :-)
Regards,
Jonas
Quoted 76 lines
Fabio Estevam (7):
pinctrl: rockchip: Add support for RV1103
clk: rockchip: Add support for RV1103
tools: rkcommon: Add rv1103 support
rockchip: spl-boot-order: Add SPI NAND support
spl: Add SPI NAND support via MTD in SPL
ARM: dts: Add RV1103 Omega4 support
omega4-rv1103: Add initial supportarch/arm/dts/rv1103-omega4-u-boot.dtsi | 11 + arch/arm/dts/rv1103-omega4.dts | 40 + arch/arm/dts/rv1103-u-boot.dtsi | 4 + arch/arm/dts/rv1103.dtsi | 267 +++++ .../include/asm/arch-rockchip/cru_rv1103.h | 271 +++++ .../include/asm/arch-rockchip/grf_rv1103.h | 31 + arch/arm/include/asm/arch-rv1103/boot0.h | 11 + arch/arm/mach-rockchip/Kconfig | 14 + arch/arm/mach-rockchip/Makefile | 1 + arch/arm/mach-rockchip/rv1103/Kconfig | 23 + arch/arm/mach-rockchip/rv1103/Makefile | 12 + arch/arm/mach-rockchip/rv1103/boot0.h | 5 + arch/arm/mach-rockchip/rv1103/clk_rv1103.c | 32 + arch/arm/mach-rockchip/rv1103/rv1103.c | 133 ++ arch/arm/mach-rockchip/rv1103/syscon_rv1103.c | 19 + arch/arm/mach-rockchip/spl-boot-order.c | 11 +- board/onion/omega4_rv1103/Kconfig | 12 + board/onion/omega4_rv1103/MAINTAINERS | 6 + board/onion/omega4_rv1103/Makefile | 7 + board/onion/omega4_rv1103/omega4_rv1103.c | 19 + board/onion/omega4_rv1103/omega4_rv1103.env | 5 + common/spl/Kconfig | 10 +- common/spl/Makefile | 1 + common/spl/spl_spi_nand.c | 82 ++ configs/omega4-rv1103_defconfig | 82 ++ doc/board/index.rst | 1 + doc/board/onion/index.rst | 9 + doc/board/onion/omega4-rv1103.rst | 56 + drivers/clk/rockchip/Makefile | 1 + drivers/clk/rockchip/clk_rv1103.c | 1068 +++++++++++++++++ drivers/mtd/Makefile | 1 + drivers/mtd/nand/Makefile | 13 +- drivers/pinctrl/Kconfig | 10 + drivers/pinctrl/rockchip/Makefile | 1 + drivers/pinctrl/rockchip/pinctrl-rv1103.c | 411 +++++++ include/configs/omega4_rv1103.h | 11 + include/configs/rv1103_common.h | 14 + include/dt-bindings/clock/rv1103-cru.h | 489 ++++++++ tools/rkcommon.c | 1 + 39 files changed, 3191 insertions(+), 4 deletions(-) create mode 100644 arch/arm/dts/rv1103-omega4-u-boot.dtsi create mode 100644 arch/arm/dts/rv1103-omega4.dts create mode 100644 arch/arm/dts/rv1103-u-boot.dtsi create mode 100644 arch/arm/dts/rv1103.dtsi create mode 100644 arch/arm/include/asm/arch-rockchip/cru_rv1103.h create mode 100644 arch/arm/include/asm/arch-rockchip/grf_rv1103.h create mode 100644 arch/arm/include/asm/arch-rv1103/boot0.h create mode 100644 arch/arm/mach-rockchip/rv1103/Kconfig create mode 100644 arch/arm/mach-rockchip/rv1103/Makefile create mode 100644 arch/arm/mach-rockchip/rv1103/boot0.h create mode 100644 arch/arm/mach-rockchip/rv1103/clk_rv1103.c create mode 100644 arch/arm/mach-rockchip/rv1103/rv1103.c create mode 100644 arch/arm/mach-rockchip/rv1103/syscon_rv1103.c create mode 100644 board/onion/omega4_rv1103/Kconfig create mode 100644 board/onion/omega4_rv1103/MAINTAINERS create mode 100644 board/onion/omega4_rv1103/Makefile create mode 100644 board/onion/omega4_rv1103/omega4_rv1103.c create mode 100644 board/onion/omega4_rv1103/omega4_rv1103.env create mode 100644 common/spl/spl_spi_nand.c create mode 100644 configs/omega4-rv1103_defconfig create mode 100644 doc/board/onion/index.rst create mode 100644 doc/board/onion/omega4-rv1103.rst create mode 100644 drivers/clk/rockchip/clk_rv1103.c create mode 100644 drivers/pinctrl/rockchip/pinctrl-rv1103.c create mode 100644 include/configs/omega4_rv1103.h create mode 100644 include/configs/rv1103_common.h create mode 100644 include/dt-bindings/clock/rv1103-cru.h
Re: [PATCH 1/7] pinctrl: rockchip: Add support for RV1103
In reply to Fabio EstevamHi Fabio,
Quoted 3 lines · Fabio Estevam
From: Fabio Estevam <[email protected]>
Add pinctrl driver for RV1103.
See prior note about rv1103b vs rv1106/rv1103 compatibility and naming.
Quoted 1 line
Imported from Rockchip U-Boot 2017.09 next-dev branch.
This driver looks very close to vendor version [1], maybe this patch should be From/Signed-off-by the original author? That is the practice we typically follow for Rockchip platform.
[1] https://github.com/rockchip-linux/u-boot/commit/b73745f4bfe57b0a3ff47ae0bd8eea687a26f456
Quoted 15 lines
Signed-off-by Fabio Estevam <[email protected]>--- drivers/pinctrl/Kconfig | 10 + drivers/pinctrl/rockchip/Makefile | 1 + drivers/pinctrl/rockchip/pinctrl-rv1103.c | 411 ++++++++++++++++++++++ 3 files changed, 422 insertions(+) create mode 100644 drivers/pinctrl/rockchip/pinctrl-rv1103.cdrivers/pinctrl/Kconfig +0
-0@@ -254,6 +254,16 @@ config PINCTRL_QE This option is to enable the QE pinctrl driver for QE based io controller.
drivers/pinctrl/Kconfig config PINCTRL_QE · line 265
Quoted 10 lines
drivers/pinctrl/Kconfig +9
-0+config PINCTRL_ROCKCHIP_RV1103 + bool "Rockchip rv1103 pin control driver" + depends on DM + help + Support pin multiplexing control on Rockchip rv1103 SoC. + + The driver is controlled by a device tree node which contains + both the GPIO definitions and pin control functions for each + available multiplex function.
This Kconfig is not use for anything, please drop.
Quoted 34 lines
drivers/pinctrl/Kconfig +0
-0config PINCTRL_ROCKCHIP_RV1108 bool "Rockchip rv1108 pin control driver" depends on DMdrivers/pinctrl/rockchip/Makefile +1
-0@@ -18,5 +18,6 @@ obj-$(CONFIG_ROCKCHIP_RK3528) += pinctrl-rk3528.o obj-$(CONFIG_ROCKCHIP_RK3568) += pinctrl-rk3568.o obj-$(CONFIG_ROCKCHIP_RK3576) += pinctrl-rk3576.o obj-$(CONFIG_ROCKCHIP_RK3588) += pinctrl-rk3588.o +obj-$(CONFIG_ROCKCHIP_RV1103) += pinctrl-rv1103.o obj-$(CONFIG_ROCKCHIP_RV1108) += pinctrl-rv1108.o obj-$(CONFIG_ROCKCHIP_RV1126) += pinctrl-rv1126.odrivers/pinctrl/rockchip/pinctrl-rv1103.c new file +14
-0@@ -0,0 +1,411 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* (C) Copyright 2024 Rockchip Electronics Co., Ltd +*/ + +#include <dm.h> +#include <log.h> +#include <dm/pinctrl.h> +#include <regmap.h> +#include <syscon.h> +#include <linux/bitops.h> + +#include "pinctrl-rockchip.h" +
drivers/pinctrl/rockchip/pinctrl-rv1103.c line 24
Quoted 10 lines
drivers/pinctrl/rockchip/pinctrl-rv1103.c new file +10
-0+static int rv1103_set_mux (struct rockchip_pin_bank *bank,int pin,int mux) +{ +struct rockchip_pinctrl_priv *priv = bank->priv; +int iomux_num = (pin /8 ); +struct regmap *regmap; +int reg, ret, mask; +u8 bit; +u32 data; + +debug ("setting mux of GPIO%d-%d to %d\n" , bank->bank_num, pin, mux);
This is already logged in pinctrl-rockchip-core, please drop.
Quoted 6 lines
drivers/pinctrl/rockchip/pinctrl-rv1103.c new file +6
-0+if (bank->bank_num ==2 && pin >=12 ) +return 0 ; + + regmap = priv->regmap_base; + reg = bank->iomux[iomux_num].offset; +if ((pin %8 ) >=4 )
drivers/pinctrl/rockchip/pinctrl-rv1103.c line 41
Quoted 10 lines
drivers/pinctrl/rockchip/pinctrl-rv1103.c new file +10
-0+ reg +=0x4 ; + bit = (pin %4 ) *4 ; + mask =0xf ; + +if (bank->recalced_mask &BIT (pin)) +rockchip_get_recalced_mux (bank, pin, ®, &bit, &mask); + data = (mask << (bit +16 )); + data |= (mux & mask) << bit; + +debug ("iomux write reg = %x data = %x\n" , reg, data);
Please be consistent, log for all reg write or none.
drivers/pinctrl/rockchip/pinctrl-rv1103.c line 42
Quoted 2 lines
drivers/pinctrl/rockchip/pinctrl-rv1103.c new file +2
-0+ + ret =regmap_write (regmap, reg, data);
Please update this driver to use regmap_update_bits instead of regmap_write, see e.g. pinctrl for rk3528 or pending rk3506.
Quoted 53 lines
drivers/pinctrl/rockchip/pinctrl-rv1103.c new file +53
-0+ +return ret; +} + +#define RV1103_DRV_BITS_PER_PIN 8 +#define RV1103_DRV_PINS_PER_REG 2 +#define RV1103_DRV_GPIO0_A_OFFSET 0x40100 +#define RV1103_DRV_GPIO0_B_OFFSET 0x50110 +#define RV1103_DRV_GPIO1_A01_OFFSET 0x140 +#define RV1103_DRV_GPIO1_A67_OFFSET 0x1014C +#define RV1103_DRV_GPIO2_OFFSET 0x30180 +#define RV1103_DRV_GPIO2_SARADC_OFFSET 0x3080C + +static int rv1103_calc_drv_reg_and_bit (struct rockchip_pin_bank *bank, +int pin_num,struct regmap **regmap, +int *reg,u8 *bit) +{ +struct rockchip_pinctrl_priv *priv = bank->priv; +int ret =0 ; + + *regmap = priv->regmap_base; +switch (bank->bank_num) { +case 0 : +if (pin_num <7 ) + *reg =RV1103_DRV_GPIO0_A_OFFSET ; +else if (pin_num >7 && pin_num <14 ) + *reg =RV1103_DRV_GPIO0_B_OFFSET -0x10 ; +else + ret = -EINVAL ; +break ; + +case 1 : +if (pin_num <6 ) + *reg =RV1103_DRV_GPIO1_A01_OFFSET ; +else if (pin_num >=6 && pin_num <23 ) + *reg =RV1103_DRV_GPIO1_A67_OFFSET -0xc ; +else if (pin_num >=24 && pin_num <30 ) + *reg =RV1103_DRV_GPIO1_A67_OFFSET -0xc ; +else + ret = -EINVAL ; +break ; + +case 2 : +if (pin_num <12 ) { + *reg =RV1103_DRV_GPIO2_OFFSET ; + }else if (pin_num >=16 ) { + ret = -EINVAL ; + }else { + *reg =RV1103_DRV_GPIO2_SARADC_OFFSET ; + *bit =10 ; + +return 0 ; + }
drivers/pinctrl/rockchip/pinctrl-rv1103.c line 106
Quoted 10 lines
drivers/pinctrl/rockchip/pinctrl-rv1103.c new file +10
-0+break ; + +default : + ret = -EINVAL ; +break ; + } + +if (ret) { +printf ("unsupported bank_num %d pin_num %d\n" , bank->bank_num, pin_num); +
Please drop unnecessary blank lines in this file.
Quoted 279 lines
drivers/pinctrl/rockchip/pinctrl-rv1103.c new file +279
-0+return ret; + } + + *reg += ((pin_num /RV1103_DRV_PINS_PER_REG ) *4 ); + *bit = pin_num %RV1103_DRV_PINS_PER_REG ; + *bit *=RV1103_DRV_BITS_PER_PIN ; + +return 0 ; +} + +static int rv1103_set_drive (struct rockchip_pin_bank *bank, +int pin_num,int strength) +{ +struct regmap *regmap; +int reg, ret, i; +u32 data; +u8 bit; +int rmask_bits =RV1103_DRV_BITS_PER_PIN ; + + ret =rv1103_calc_drv_reg_and_bit (bank, pin_num, ®map, ®, &bit); +if (ret) +return ret; + +for (i =0 , ret =1 ; i < strength; i++) + ret = (ret <<1 ) |1 ; + +if (bank->bank_num ==2 && pin_num >=12 ) { + rmask_bits =2 ; + ret = strength; + } + +/* enable the write to the equivalent lower bits */ + data = ((1 << rmask_bits) -1 ) << (bit +16 ); + data |= (ret << bit); + ret =regmap_write (regmap, reg, data); + +return ret; +} + +#define RV1103_PULL_BITS_PER_PIN 2 +#define RV1103_PULL_PINS_PER_REG 8 +#define RV1103_PULL_GPIO0_A_OFFSET 0x40200 +#define RV1103_PULL_GPIO0_B_OFFSET 0x50204 +#define RV1103_PULL_GPIO1_A01_OFFSET 0x210 +#define RV1103_PULL_GPIO1_A67_OFFSET 0x10210 +#define RV1103_PULL_GPIO2_OFFSET 0x30220 +#define RV1103_PULL_GPIO2_SARADC_OFFSET 0x3080C + +static int rv1103_calc_pull_reg_and_bit (struct rockchip_pin_bank *bank, +int pin_num,struct regmap **regmap, +int *reg,u8 *bit) +{ +struct rockchip_pinctrl_priv *priv = bank->priv; +int ret =0 ; + + *regmap = priv->regmap_base; +switch (bank->bank_num) { +case 0 : +if (pin_num <7 ) + *reg =RV1103_PULL_GPIO0_A_OFFSET ; +else if (pin_num >7 && pin_num <14 ) + *reg =RV1103_PULL_GPIO0_B_OFFSET -0x4 ; +else + ret = -EINVAL ; +break ; + +case 1 : +if (pin_num <6 ) + *reg =RV1103_PULL_GPIO1_A01_OFFSET ; +else if (pin_num >=6 && pin_num <23 ) + *reg =RV1103_PULL_GPIO1_A67_OFFSET ; +else if (pin_num >=24 && pin_num <30 ) + *reg =RV1103_PULL_GPIO1_A67_OFFSET ; +else + ret = -EINVAL ; +break ; + +case 2 : +if (pin_num <12 ) { + *reg =RV1103_PULL_GPIO2_OFFSET ; + }else if (pin_num >=16 ) { + ret = -EINVAL ; + }else { + *reg =RV1103_PULL_GPIO2_SARADC_OFFSET ; + *bit =13 ; + +return 0 ; + } +break ; + +default : + ret = -EINVAL ; +break ; + } + +if (ret) { +printf ("unsupported bank_num %d pin_num %d\n" , bank->bank_num, pin_num); + +return ret; + } + + *reg += ((pin_num /RV1103_PULL_PINS_PER_REG ) *4 ); + *bit = pin_num %RV1103_PULL_PINS_PER_REG ; + *bit *=RV1103_PULL_BITS_PER_PIN ; + +return 0 ; +} + +static int rv1103_set_pull (struct rockchip_pin_bank *bank, +int pin_num,int pull) +{ +struct regmap *regmap; +int reg, ret; +u8 bit, type; +u32 data; + +if (pull ==PIN_CONFIG_BIAS_PULL_PIN_DEFAULT ) +return -EINVAL ; + + ret =rv1103_calc_pull_reg_and_bit (bank, pin_num, ®map, ®, &bit); +if (ret) +return ret; + type = bank->pull_type[pin_num /8 ]; + +if (bank->bank_num ==2 && pin_num >=12 ) + type =1 ; + + ret =rockchip_translate_pull_value (type, pull); +if (ret <0 ) { +debug ("unsupported pull setting %d\n" , pull); + +return ret; + } + +/* enable the write to the equivalent lower bits */ + data = ((1 <<RV1103_PULL_BITS_PER_PIN ) -1 ) << (bit +16 ); + + data |= (ret << bit); + ret =regmap_write (regmap, reg, data); + +return ret; +} + +#define RV1103_SMT_BITS_PER_PIN 1 +#define RV1103_SMT_PINS_PER_REG 8 +#define RV1103_SMT_GPIO0_A_OFFSET 0x40400 +#define RV1103_SMT_GPIO0_B_OFFSET 0x50404 +#define RV1103_SMT_GPIO1_A01_OFFSET 0x410 +#define RV1103_SMT_GPIO1_A67_OFFSET 0x10410 +#define RV1103_SMT_GPIO2_OFFSET 0x30420 +#define RV1103_SMT_GPIO2_SARADC_OFFSET 0x3080C + +static int rv1103_calc_schmitt_reg_and_bit (struct rockchip_pin_bank *bank, +int pin_num, +struct regmap **regmap, +int *reg,u8 *bit) +{ +struct rockchip_pinctrl_priv *priv = bank->priv; +int ret =0 ; + + *regmap = priv->regmap_base; +switch (bank->bank_num) { +case 0 : +if (pin_num <7 ) + *reg =RV1103_SMT_GPIO0_A_OFFSET ; +else if (pin_num >7 && pin_num <14 ) + *reg =RV1103_SMT_GPIO0_B_OFFSET -0x4 ; +else + ret = -EINVAL ; +break ; + +case 1 : +if (pin_num <6 ) + *reg =RV1103_SMT_GPIO1_A01_OFFSET ; +else if (pin_num >=6 && pin_num <23 ) + *reg =RV1103_SMT_GPIO1_A67_OFFSET ; +else if (pin_num >=24 && pin_num <30 ) + *reg =RV1103_SMT_GPIO1_A67_OFFSET ; +else + ret = -EINVAL ; +break ; + +case 2 : +if (pin_num <12 ) { + *reg =RV1103_SMT_GPIO2_OFFSET ; + }else if (pin_num >=16 ) { + ret = -EINVAL ; + }else { + *reg =RV1103_SMT_GPIO2_SARADC_OFFSET ; + *bit =8 ; + +return 0 ; + } +break ; + +default : + ret = -EINVAL ; +break ; + } + +if (ret) { +printf ("unsupported bank_num %d pin_num %d\n" , bank->bank_num, pin_num); + +return ret; + } + + *reg += ((pin_num /RV1103_SMT_PINS_PER_REG ) *4 ); + *bit = pin_num %RV1103_SMT_PINS_PER_REG ; + *bit *=RV1103_SMT_BITS_PER_PIN ; + +return 0 ; +} + +static int rv1103_set_schmitt (struct rockchip_pin_bank *bank, +int pin_num,int enable) +{ +struct regmap *regmap; +int reg, ret; +u32 data; +u8 bit; + + ret =rv1103_calc_schmitt_reg_and_bit (bank, pin_num, ®map, ®, &bit); +if (ret) +return ret; + +/* enable the write to the equivalent lower bits */ + data = ((1 <<RV1103_SMT_BITS_PER_PIN ) -1 ) << (bit +16 ); + data |= (enable << bit); + +if (bank->bank_num ==2 && pin_num >=12 ) { + data =0x3 << (bit +16 ); + data |= ((enable ?0x3 :0 ) << bit); + } + ret =regmap_write (regmap, reg, data); + +return ret; +} + +static struct rockchip_mux_recalced_data rv1103_mux_recalced_data[] = { + { + .num =1 , + .pin =6 , + .reg =0x10024 , + .bit =8 , + .mask =0xf + }, { + .num =1 , + .pin =7 , + .reg =0x10024 , + .bit =12 , + .mask =0xf + }, +}; + +static struct rockchip_pin_bank rv1103_pin_banks[] = { +PIN_BANK_IOMUX_FLAGS_OFFSET (0 ,32 ,"gpio0" , +IOMUX_WIDTH_4BIT , +IOMUX_WIDTH_4BIT , +IOMUX_WIDTH_4BIT , +IOMUX_WIDTH_4BIT , +0x40000 ,0x50008 ,0x50010 ,0x50018 ), +PIN_BANK_IOMUX_FLAGS_OFFSET (1 ,32 ,"gpio1" , +IOMUX_WIDTH_4BIT , +IOMUX_WIDTH_4BIT , +IOMUX_WIDTH_4BIT , +IOMUX_WIDTH_4BIT , +0x20 ,0x10028 ,0x10030 ,0x10038 ), +PIN_BANK_IOMUX_FLAGS_OFFSET (2 ,32 ,"gpio2" , +IOMUX_WIDTH_4BIT , +IOMUX_WIDTH_4BIT , +IOMUX_WIDTH_4BIT , +IOMUX_WIDTH_4BIT , +0x30040 ,0x30048 ,0x30050 ,0x30058 ), +}; + +static const struct rockchip_pin_ctrl rv1103_pin_ctrl = { + .pin_banks = rv1103_pin_banks, + .nr_banks =ARRAY_SIZE (rv1103_pin_banks), + .iomux_recalced = rv1103_mux_recalced_data,
drivers/pinctrl/rockchip/pinctrl-rv1103.c line 395
Quoted 10 lines
drivers/pinctrl/rockchip/pinctrl-rv1103.c new file +10
-0+ .niomux_recalced = ARRAY_SIZE(rv1103_mux_recalced_data), + .set_mux = rv1103_set_mux, + .set_pull = rv1103_set_pull, + .set_drive = rv1103_set_drive, + .set_schmitt = rv1103_set_schmitt, +}; + +static const struct udevice_id rv1103_pinctrl_ids[] = { + { + .compatible ="rockchip,rv1103-pinctrl" ,
As already mentioned, please send out and get this complatible acked in Linux, especially with the rv1103b vs rv1106/rv1103 confusion.
Regards,
Jonas
Quoted 16 lines
drivers/pinctrl/rockchip/pinctrl-rv1103.c new file +16
-0+ .data = (ulong)&rv1103_pin_ctrl + }, + { } +}; + +U_BOOT_DRIVER (pinctrl_rv1103) = { + .name ="rockchip_rv1103_pinctrl" , + .id =UCLASS_PINCTRL , + .of_match = rv1103_pinctrl_ids, + .priv_auto =sizeof (struct rockchip_pinctrl_priv ), + .ops = &rockchip_pinctrl_ops, +#if !CONFIG_IS_ENABLED(OF_PLATDATA) + .bind = dm_scan_fdt_dev, +#endif + .probe = rockchip_pinctrl_probe, +};
Re: [PATCH 3/7] tools: rkcommon: Add rv1103 support
In reply to Fabio EstevamHi Fabio,
Quoted 5 lines · Fabio Estevam
From: Fabio Estevam <[email protected]>
Allow rkcommon to generate an image for the RV1103.
Based on Rockchip U-Boot 2017.09 next-dev branch.
This very closely matches the vendor version [1] and should most likely keep source From/Signed-off-by tags?
[1] https://github.com/rockchip-linux/u-boot/commit/05a029d3fe9ad682fb6fa13ff81b2cb7a9e6fe34
Quoted 10 lines
Signed-off-by Fabio Estevam <[email protected]>--- tools/rkcommon.c | 1 + 1 file changed, 1 insertion(+)tools/rkcommon.c +0
-0
tools/rkcommon.c static struct spl_info spl_infos[] = { · line 151
Quoted 4 lines
tools/rkcommon.c +1
-0@@ -148,6 +148,7 @@ static struct spl_info spl_infos[] = { { "rk3328", "RK32", 0x8000 - 0x800, false, RK_HEADER_V1 }, { "rk3368", "RK33", 0x8000 - 0x1000, false, RK_HEADER_V1 }, { "rk3399", "RK33", 0x30000 - 0x2000, false, RK_HEADER_V1 }, + { "rv1103", "RV11", 0x40000 - 0x1000, false, RK_HEADER_V2 },
This should most likely use rv1103b, and also please keep the vendor header tag 110E, something I expect matches the maskrom usb pid.
The rv11 line seem to use following usb pid enumeration:
rv1108 - 0x110a
rv1126 - 0x110b
rv1106 - 0x110c
???
rv1103b - 0x110e
rv1126b - 0x110f
Regards,
Jonas
Quoted 3 lines
tools/rkcommon.c +0
-0{ "rv1108", "RK11", 0x1800, false, RK_HEADER_V1 }, { "rv1126", "110B", 0x10000 - 0x1000, false, RK_HEADER_V1 }, { "rk3528", "RK35", 0x10000 - 0x1000, false, RK_HEADER_V2 },
Hi Jonas,
Quoted 3 lines · Jonas Karlman
This series seem to handle the RV1103B variant and not the RV1106/RV1103 variant, please name parts as rv1103b to match vendor U-Boot or is the rv1106/rv1103 and rv1103b fully compatible?
Thanks for your review. I appreciate it.
Initially, I was unaware of the differences between the RV1106/RV1103 and RV1103B.
After reading your message, I investigated Rockchip's SDK and confirmed that RV1106/RV1103 are compatible, but RV1103B has a completely different memory map.
For v2, I'll change the references to RV1103B accordingly.
Quoted 6 lines
For the Rockchip platform we typically expect e.g. dt-bindings headers for core parts to be upstreamed to Linux and picked from dts/upstream for new SoC support.
Please at least send out clk and pinctrl dt-bindings and drivers for Linux before a v2 of this series :-)
I'll work on upstreaming support for the RV1103B in Linux. I was able to get some early kernel messages via earlycon, but the clock driver is still not functional at the moment.
Thanks,
Fabio Estevam