Skip to contentSkip to conversation

ARM: Add RV1103B Omega4 board support

PATCH In review Fabio Estevam 4 participants 16 messages Feb 8 – Jul 8

Subsystems (8)
lore
Share & tools
lore
#0 lore raw

v2 cover ARM: Add RV1103B Omega4 board support

From: Fabio Estevam <[email protected]>

Hi,

This patch series adds support for the Onion RV1103B Omega4 board.

It covers SPL, SPI NAND boot, and the minimal board devicetree required to boot the board.

Upstreaming the RV1103B devicetree in Linux is ongoing, but to avoid blocking U-Boot support, this series introduces board-specific devicetrees for now.

Once the Linux RV1103B devicetrees are upstreamed, the OF_UPSTREAM mechanism can be enabled.

In v2, the correct SoC name was used: RV1103B instead of RV1103 (Thanks Jonas!), the RV1103B dt-bindings, devicetrees, clock and pinctrl drivers have been submitted upstream.

The dt-bindings have already been reviewed by the Linux DT maintainer:

https://lore.kernel.org/linux-devicetree/[email protected]/

https://lore.kernel.org/linux-devicetree/[email protected]/

https://lore.kernel.org/linux-devicetree/[email protected]/

https://lore.kernel.org/linux-devicetree/20260207-hulking-elegant-ferret-8efcea@quoll/

https://lore.kernel.org/linux-devicetree/20260208-analytic-fine-grouse-e17baa@quoll/

https://lore.kernel.org/linux-devicetree/20260208-pearl-ammonite-of-warranty-2c9212@quoll/

Tested the boot of a 6.6 OpenWRT kernel and also a 6.19-rc8 mainline kernel.

This series has successfully passed through CI.

Elaine Zhang (1):
clk: rockchip: Add RV1103B clock driver

Fabio Estevam (4):
ARM: dts: Add RV1103B Omega4 support
rockchip: spl-boot-order: Add SPI NAND support
spl: add SPI NAND support via MTD in SPL
omega4-rv1103b: Add the initial support

Xuhui Lin (1):
tools: rkcommon: Add RV1103B support

Ye Zhang (1):
pinctrl: rockchip: Add RV1103B support

 arch/arm/dts/rv1103b-omega4-u-boot.dtsi       |   10 +
 arch/arm/dts/rv1103b-omega4.dts               |  105 ++
 arch/arm/dts/rv1103b-pinctrl.dtsi             |  831 +++++++++++++
 arch/arm/dts/rv1103b-u-boot.dtsi              |    4 +
 arch/arm/dts/rv1103b.dtsi                     |  266 ++++
 .../include/asm/arch-rockchip/cru_rv1103b.h   |  266 ++++
 .../include/asm/arch-rockchip/grf_rv1103b.h   |   31 +
 arch/arm/include/asm/arch-rv1103b/boot0.h     |   11 +
 arch/arm/mach-rockchip/Kconfig                |   14 +
 arch/arm/mach-rockchip/Makefile               |    1 +
 arch/arm/mach-rockchip/rv1103b/Kconfig        |   23 +
 arch/arm/mach-rockchip/rv1103b/Makefile       |   12 +
 arch/arm/mach-rockchip/rv1103b/boot0.h        |    5 +
 arch/arm/mach-rockchip/rv1103b/clk_rv1103b.c  |   32 +
 arch/arm/mach-rockchip/rv1103b/rv1103b.c      |  133 ++
 .../mach-rockchip/rv1103b/syscon_rv1103b.c    |   19 +
 arch/arm/mach-rockchip/spl-boot-order.c       |   11 +-
 board/onion/omega4_rv1103b/Kconfig            |   12 +
 board/onion/omega4_rv1103b/MAINTAINERS        |    6 +
 board/onion/omega4_rv1103b/Makefile           |    7 +
 board/onion/omega4_rv1103b/omega4_rv1103b.c   |   19 +
 board/onion/omega4_rv1103b/omega4_rv1103b.env |    5 +
 common/spl/Kconfig                            |   10 +-
 common/spl/Makefile                           |    1 +
 common/spl/spl_spi_nand.c                     |   82 ++
 configs/omega4-rv1103b_defconfig              |   82 ++
 doc/board/index.rst                           |    1 +
 doc/board/onion/index.rst                     |    9 +
 doc/board/onion/omega4-rv1103b.rst            |   56 +
 drivers/clk/rockchip/Makefile                 |    1 +
 drivers/clk/rockchip/clk_rv1103b.c            | 1068 +++++++++++++++++
 drivers/mtd/Makefile                          |    1 +
 drivers/mtd/nand/Makefile                     |   13 +-
 drivers/pinctrl/rockchip/Makefile             |    1 +
 drivers/pinctrl/rockchip/pinctrl-rv1103b.c    |  398 ++++++
 include/configs/omega4_rv1103b.h              |   11 +
 include/configs/rv1103b_common.h              |   14 +
 .../dt-bindings/clock/rockchip,rv1103b-cru.h  |  220 ++++
 tools/rkcommon.c                              |    1 +
 39 files changed, 3788 insertions(+), 4 deletions(-)
 create mode 100644 arch/arm/dts/rv1103b-omega4-u-boot.dtsi
 create mode 100644 arch/arm/dts/rv1103b-omega4.dts
 create mode 100644 arch/arm/dts/rv1103b-pinctrl.dtsi
 create mode 100644 arch/arm/dts/rv1103b-u-boot.dtsi
 create mode 100644 arch/arm/dts/rv1103b.dtsi
 create mode 100644 arch/arm/include/asm/arch-rockchip/cru_rv1103b.h
 create mode 100644 arch/arm/include/asm/arch-rockchip/grf_rv1103b.h
 create mode 100644 arch/arm/include/asm/arch-rv1103b/boot0.h
 create mode 100644 arch/arm/mach-rockchip/rv1103b/Kconfig
 create mode 100644 arch/arm/mach-rockchip/rv1103b/Makefile
 create mode 100644 arch/arm/mach-rockchip/rv1103b/boot0.h
 create mode 100644 arch/arm/mach-rockchip/rv1103b/clk_rv1103b.c
 create mode 100644 arch/arm/mach-rockchip/rv1103b/rv1103b.c
 create mode 100644 arch/arm/mach-rockchip/rv1103b/syscon_rv1103b.c
 create mode 100644 board/onion/omega4_rv1103b/Kconfig
 create mode 100644 board/onion/omega4_rv1103b/MAINTAINERS
 create mode 100644 board/onion/omega4_rv1103b/Makefile
 create mode 100644 board/onion/omega4_rv1103b/omega4_rv1103b.c
 create mode 100644 board/onion/omega4_rv1103b/omega4_rv1103b.env
 create mode 100644 common/spl/spl_spi_nand.c
 create mode 100644 configs/omega4-rv1103b_defconfig
 create mode 100644 doc/board/onion/index.rst
 create mode 100644 doc/board/onion/omega4-rv1103b.rst
 create mode 100644 drivers/clk/rockchip/clk_rv1103b.c
 create mode 100644 drivers/pinctrl/rockchip/pinctrl-rv1103b.c
 create mode 100644 include/configs/omega4_rv1103b.h
 create mode 100644 include/configs/rv1103b_common.h
 create mode 100644 include/dt-bindings/clock/rockchip,rv1103b-cru.h
Signature · 1 line
2.34.1
#1 lore raw

PATCH v2 1/7 ARM: dts: Add RV1103B Omega4 support

From: Fabio Estevam <[email protected]>

Add the necessary devicetrees to support the RV1103B Omega4 board.

The RV1103B is a Rockchip SoC that is still not supported in Linux mainline.

The initial RV1103B support has already been submitted to Linux kernel and it is under review.

Once the Linux RV1103 devicetrees are upstreamed, the OF_UPSTREAM mechanism can be enabled.

---
Changes since v1:
- Used the devicetrees submitted to upstream Linux.

 arch/arm/dts/rv1103b-omega4-u-boot.dtsi       |  10 +
 arch/arm/dts/rv1103b-omega4.dts               | 105 +++
 arch/arm/dts/rv1103b-pinctrl.dtsi             | 831 ++++++++++++++++++
 arch/arm/dts/rv1103b-u-boot.dtsi              |   4 +
 arch/arm/dts/rv1103b.dtsi                     | 266 ++++++
 .../dt-bindings/clock/rockchip,rv1103b-cru.h  | 220 +++++
 6 files changed, 1436 insertions(+)
 create mode 100644 arch/arm/dts/rv1103b-omega4-u-boot.dtsi
 create mode 100644 arch/arm/dts/rv1103b-omega4.dts
 create mode 100644 arch/arm/dts/rv1103b-pinctrl.dtsi
 create mode 100644 arch/arm/dts/rv1103b-u-boot.dtsi
 create mode 100644 arch/arm/dts/rv1103b.dtsi
 create mode 100644 include/dt-bindings/clock/rockchip,rv1103b-cru.h
arch/arm/dts/rv1103b-omega4-u-boot.dtsi new file +10 -0
new file mode 100644
index 000000000000..c7616de1715c
@@ -0,0 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0+
+// (C) Copyright 2024 Rockchip Electronics Co., Ltd
+
+#include "rockchip-u-boot.dtsi"
+
+/ {
+	chosen {
+		u-boot,spl-boot-order = &spi_nand;
+	};
+};
arch/arm/dts/rv1103b-omega4.dts new file +105 -0

105 lines not on this page · raw message

arch/arm/dts/rv1103b-pinctrl.dtsi new file +831 -0

831 lines not on this page · raw message

arch/arm/dts/rv1103b-u-boot.dtsi new file +4 -0
new file mode 100644
index 000000000000..3b77dd31152f
@@ -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/rv1103b.dtsi new file +266 -0

266 lines not on this page · raw message

include/dt-bindings/clock/rockchip,rv1103b-cru.h new file +220 -0

220 lines not on this page · raw message

Signature · 1 line
2.34.1
#2 lore raw

Re: [PATCH v2 1/7] ARM: dts: Add RV1103B Omega4 support

Hi Fabio,

Quoted 4 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

Add the necessary devicetrees to support the RV1103B Omega4 board.

Quoted 8 lines

The RV1103B is a Rockchip SoC that is still not supported in Linux mainline.

The initial RV1103B support has already been submitted to Linux kernel and it is under review.

Once the Linux RV1103 devicetrees are upstreamed, the OF_UPSTREAM mechanism can be enabled.

Please address my upstream DT review and give it some more time before adding DTs that cannot be picked to dts/upstream in U-Boot.

For the past two years the Rockchip platform has only allowed adding arch and boards using DTs that come from dts/upstream. So please give a good explanation why your arch/board cannot wait until that is the case and need exception from this.

Quoted 5 lines

---
Changes since v1:
- Used the devicetrees submitted to upstream Linux.

Quoted 9 lines
 arch/arm/dts/rv1103b-omega4-u-boot.dtsi       |  10 +
 arch/arm/dts/rv1103b-omega4.dts               | 105 +++
 arch/arm/dts/rv1103b-pinctrl.dtsi             | 831 ++++++++++++++++++
 arch/arm/dts/rv1103b-u-boot.dtsi              |   4 +
 arch/arm/dts/rv1103b.dtsi                     | 266 ++++++
 .../dt-bindings/clock/rockchip,rv1103b-cru.h  | 220 +++++
 6 files changed, 1436 insertions(+)
 create mode 100644 arch/arm/dts/rv1103b-omega4-u-boot.dtsi
 create mode 100644 arch/arm/dts/rv1103b-omega4.dts

Please split patch 7/7 in two, one that add rv1103b arch support and a second that add the omega4 board. Then please move the board DTs to the patch that adds support for the omega4 board.

Quoted 2 lines
 create mode 100644 arch/arm/dts/rv1103b-pinctrl.dtsi
 create mode 100644 arch/arm/dts/rv1103b-u-boot.dtsi

The soc u-boot.dtsi is better to add in the patch that add rv1103b arch support, i.e. this patch should only include DTs and headers that is a drop in replacement for future files that are expected to land in dts/upstream.

Regards,
Jonas

Quoted 2 lines
 create mode 100644 arch/arm/dts/rv1103b.dtsi
 create mode 100644 include/dt-bindings/clock/rockchip,rv1103b-cru.h

[snip]

#3 lore raw

PATCH v2 2/7 pinctrl: rockchip: Add RV1103B support

In reply to Fabio Estevam

From: Ye Zhang <[email protected]>

Add pinctrl driver for RV1103.

---
Changes since v1:
- Use the original author from Rockchip's vendor U-Boot tree.
- Use regmap_update_bits()
- Removed unneeded blank lines.
- Removed unneeded logging functions.

 drivers/pinctrl/rockchip/Makefile          |   1 +
 drivers/pinctrl/rockchip/pinctrl-rv1103b.c | 398 +++++++++++++++++++++
 2 files changed, 399 insertions(+)
 create mode 100644 drivers/pinctrl/rockchip/pinctrl-rv1103b.c
drivers/pinctrl/rockchip/Makefile +1 -0
index e17415e1ca68..2bbee66bd3ca 100644
@@ -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_RV1103B) += pinctrl-rv1103b.o
 obj-$(CONFIG_ROCKCHIP_RV1108) += pinctrl-rv1108.o
 obj-$(CONFIG_ROCKCHIP_RV1126) += pinctrl-rv1126.o
drivers/pinctrl/rockchip/pinctrl-rv1103b.c new file +398 -0

398 lines not on this page · raw message

Signature · 1 line
2.34.1
#4 lore raw

Re: [PATCH v2 2/7] pinctrl: rockchip: Add RV1103B support

Hi Fabio,

Quoted 65 lines · Fabio Estevam

From: Ye Zhang <[email protected]>

Add pinctrl driver for RV1103.

---
Changes since v1:
- Use the original author from Rockchip's vendor U-Boot tree.
- Use regmap_update_bits()
- Removed unneeded blank lines.
- Removed unneeded logging functions.

 drivers/pinctrl/rockchip/Makefile          |   1 +
 drivers/pinctrl/rockchip/pinctrl-rv1103b.c | 398 +++++++++++++++++++++
 2 files changed, 399 insertions(+)
 create mode 100644 drivers/pinctrl/rockchip/pinctrl-rv1103b.c
drivers/pinctrl/rockchip/Makefile +1 -0
index e17415e1ca68..2bbee66bd3ca 100644
@@ -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_RV1103B) += pinctrl-rv1103b.o
 obj-$(CONFIG_ROCKCHIP_RV1108) += pinctrl-rv1108.o
 obj-$(CONFIG_ROCKCHIP_RV1126) += pinctrl-rv1126.o
drivers/pinctrl/rockchip/pinctrl-rv1103b.c new file +30 -0
new file mode 100644
index 000000000000..fb946b036661
@@ -0,0 +1,398 @@
+// 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"
+
+static int rv1103b_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;
+	u32 data, rmask;
+	int reg, mask;
+	u8 bit;
+
+	if (bank->bank_num == 2 && pin >= 12)
+		return 0;
+
+	regmap = priv->regmap_base;
+	reg = bank->iomux[iomux_num].offset;
+	if ((pin % 8) >= 4)
+		reg += 0x4;

drivers/pinctrl/rockchip/pinctrl-rv1103b.c line 40

Quoted 10 lines
drivers/pinctrl/rockchip/pinctrl-rv1103b.c new file +10 -0
+	bit = (pin % 4) * 4;
+	mask = 0xf;
+
+	if (bank->recalced_mask & BIT(pin))
+		rockchip_get_recalced_mux(bank, pin, &reg, &bit, &mask);
+	data = (mask << (bit + 16));
+	rmask = data | (data >> 16);
+	data |= (mux & mask) << bit;
+
+	return regmap_update_bits(regmap, reg, rmask, data);

This seem to have been updated to use regmap_update_bits(), thanks.

Quoted 85 lines
drivers/pinctrl/rockchip/pinctrl-rv1103b.c new file +85 -0
+}
+
+#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 rv1103b_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;
+		}
+		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_DRV_PINS_PER_REG) * 4);
+	*bit = pin_num % RV1103_DRV_PINS_PER_REG;
+	*bit *= RV1103_DRV_BITS_PER_PIN;
+
+	return 0;
+}
+
+static int rv1103b_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 = rv1103b_calc_drv_reg_and_bit(bank, pin_num, &regmap, &reg, &bit);
+	if (ret)
+		return ret;
+
+	for (i = 0, ret = 1; i < strength; i++)
+		ret = (ret << 1) | 1;

drivers/pinctrl/rockchip/pinctrl-rv1103b.c line 135

Quoted 10 lines
drivers/pinctrl/rockchip/pinctrl-rv1103b.c new file +10 -0
+
+	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);
+	return regmap_write(regmap, reg, data);

However, this and all remaining places still use regmap_write, please change all instances of regmap_write to use regmap_update_bits.

This ensure the pins configuration in DT cannot overflow the fields, that is something that has happened in the past and is why I ensure all new rk pinctrl drivers matches Linux kernel and use regmap_update_bits instead of regmap_write.

Regards,
Jonas

Quoted 1 line
drivers/pinctrl/rockchip/pinctrl-rv1103b.c new file +1 -0
+}

[snip]

#5 lore raw

PATCH v2 3/7 clk: rockchip: Add RV1103B clock driver

In reply to Fabio Estevam

From: Elaine Zhang <[email protected]>

Add basic clock for the RV1103B clock driver.

---
Changes since v1:
- Use the original author from Rockchip's vendor U-Boot tree.

 .../include/asm/arch-rockchip/cru_rv1103b.h   |  266 ++++
 .../include/asm/arch-rockchip/grf_rv1103b.h   |   31 +
 drivers/clk/rockchip/Makefile                 |    1 +
 drivers/clk/rockchip/clk_rv1103b.c            | 1068 +++++++++++++++++
 4 files changed, 1366 insertions(+)
 create mode 100644 arch/arm/include/asm/arch-rockchip/cru_rv1103b.h
 create mode 100644 arch/arm/include/asm/arch-rockchip/grf_rv1103b.h
 create mode 100644 drivers/clk/rockchip/clk_rv1103b.c
arch/arm/include/asm/arch-rockchip/cru_rv1103b.h new file +266 -0
new file mode 100644
index 000000000000..fc7aa4dfc0db
@@ -0,0 +1,266 @@
+/* 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 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_rv1103b.h new file +31 -0
new file mode 100644
index 000000000000..6bb382a8e079
@@ -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 rv1103b_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(rv1103b_grf, macphy_con1, SYS_GRF + 0xB4 - VEPU_GRF);
+
+#endif /*  _ASM_ARCH_GRF_RV1103B_H  */
drivers/clk/rockchip/Makefile +1 -0
index 34b63d4df34a..7bb0df6748cc 100644
@@ -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_RV1103B) += clk_rv1103b.o
 obj-$(CONFIG_ROCKCHIP_RV1108) += clk_rv1108.o
 obj-$(CONFIG_ROCKCHIP_RV1126) += clk_rv1126.o
drivers/clk/rockchip/clk_rv1103b.c new file +1068 -0

1,068 lines not on this page · raw message

Signature · 1 line
2.34.1
#6 lore raw

PATCH v2 4/7 tools: rkcommon: Add RV1103B support

In reply to Fabio Estevam

From: Xuhui Lin <[email protected]>

Allow rkcommon to generate an image for the RV1103B.

---
Changes since v1:
- Use the original author from Rockchip's vendor U-Boot tre

 tools/rkcommon.c | 1 +
 1 file changed, 1 insertion(+)
tools/rkcommon.c +1 -0
index e7e78ef7e5b7..15aaf8f890aa 100644
@@ -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 },
+	{ "rv1103b", "110E", 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
#7 lore raw

PATCH v2 5/7 rockchip: spl-boot-order: Add SPI NAND support

In reply to Fabio Estevam

From: Fabio Estevam <[email protected]>

Make spl-boot-order to accept boot 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;

---
Changes since v1:
- None.

 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
index 6572dde29f65..e5897536934a 100644
@@ -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
#8 lore raw

Re: [PATCH v2 5/7] rockchip: spl-boot-order: Add SPI NAND support

Hi Fabio,

Quoted 8 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

Make spl-boot-order to accept boot 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;

You should probably include something like following (after DT has been updated as per DT review) in rv1103b.c to also allow "same-as-spl" to work.

const char * const boot_devices[BROM_LAST_BOOTSOURCE + 1] = {
	[BROM_BOOTSOURCE_EMMC] = "/soc/mmc@20d30000",
	[BROM_BOOTSOURCE_SPINOR] = "/soc/spi@20d40000/flash@0",
	[BROM_BOOTSOURCE_SD] = "/soc/mmc@20d20000",
};
Quoted 21 lines

---
Changes since v1:
- None.

 arch/arm/mach-rockchip/spl-boot-order.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
arch/arm/mach-rockchip/spl-boot-order.c +1 -0
index 6572dde29f65..e5897536934a 100644
@@ -4,6 +4,7 @@
  */
 
 #include <dm.h>
+#include <dm/device_compat.h>
 #include <fdt_support.h>
 #include <log.h>
 #include <mmc.h>

arch/arm/mach-rockchip/spl-boot-order.c static int spl_node_to_boot_device(int node) · line 80

Quoted 5 lines
arch/arm/mach-rockchip/spl-boot-order.c +2 -0
@@ -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;

I think something like following will be better:

	if (!uclass_find_device_by_of_offset(UCLASS_MTD, node, &parent))
		return BOOT_DEVICE_MTD;

And possible also with a protect check (should probably be fixed for MMC/SPI_FLASH in a separate future patch/series).

	if (CONFIG_IS_ENABLED(MTD_LOAD_SUPPORT) &&
	    !uclass_find_device_by_of_offset(UCLASS_MTD, node, &parent))
		return BOOT_DEVICE_MTD;

Or whatever Kconfig option is used to ensure both UCLASS and SPL loader is supported in the build. To avoid error messages about missing UCLASS like following (from a different rk soc/board):

board_spl_was_booted_from: brom_bootdevice_id 3 maps to '/soc/spi@ffac0000/flash@0' Cannot find uclass for id 119: please add the UCLASS_DRIVER() declaration for this UCLASS_... id
board_boot_order: could not map node /soc/spi@ffac0000/flash@0 to a boot-device Cannot find uclass for id 119: please add the UCLASS_DRIVER() declaration for this UCLASS_... id

arch/arm/mach-rockchip/spl-boot-order.c int spl_decode_boot_device(u32 boot_device, char *buf, size_t buflen) · line 228

Quoted 11 lines
arch/arm/mach-rockchip/spl-boot-order.c +2 -2
 	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")) {

I do not think we need to check for spi-nand compatible here, make it generic and only check for UCLASS_MTD. If the node binds to a UCLASS_MTD driver it is likely we could use a generic SPL MTD loader that used mtd read ops to load next stage.

With that we could possible also support SPI_FLASH_MTD and consolidate and/or simplify SPL code, something that can be looked at in future once we have a more generic SPL MTD loader in place.

Regards,
Jonas

Quoted 7 lines
arch/arm/mach-rockchip/spl-boot-order.c +4 -0
+					debug("%s: could not find udevice for %s\n",
+					      __func__, conf);
+					continue;
+				}
 			}
 
 			return ofnode_get_path(dev_ofnode(dev), buf, buflen);
#9 lore raw

PATCH v2 6/7 spl: add SPI NAND support via MTD in SPL

In reply to Fabio Estevam

From: 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.

---
Changes since v1:
- None.

 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
index 2998b7acb75f..126855b804ce 100644
@@ -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
index 4c9482bd3096..4628902e7e31 100644
@@ -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
index ce05e206073d..a12d880a9e90 100644
@@ -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
index c8169cf73902..7cd2a5f1af9b 100644
@@ -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
#10 lore raw

Re: [PATCH v2 6/7] spl: add SPI NAND support via MTD in SPL

Hi Fabio,

Quoted 16 lines · Fabio Estevam

From: 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.

Quoted 3 lines

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.

The content in this patch seem very generic and could possible be sent as a separate series that adds a generic SPL MTD loader.

There also seem to be another SPL NAND loader part of the series at [1] that may be related.

[1] https://lore.kernel.org/all/[email protected]/

Quoted 88 lines

---
Changes since v1:
- None.

 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
index 2998b7acb75f..126855b804ce 100644
@@ -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
index 4c9482bd3096..4628902e7e31 100644
@@ -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 +29 -0
new file mode 100644
index 000000000000..20b877f75a05
@@ -0,0 +1,82 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/*
+ * SPL loader for SPI NAND devices using the MTD subsystem.
+ *
+ * Based on spl_spi.c, which is:
+ *
+ * Copyright (C) 2011 OMICRON electronics GmbH
+ *
+ * based on drivers/mtd/nand/raw/nand_spl_load.c
+ *
+ * Copyright (C) 2011
+ * Heiko Schocher, DENX Software Engineering, [email protected].
+ */
+
+#include <config.h>
+#include <image.h>
+#include <log.h>
+#include <errno.h>
+#include <spl.h>
+#include <spl_load.h>
+#include <asm/io.h>
+#include <dm/device_compat.h>
+#include <dm/ofnode.h>
+#include <dm/uclass.h>
+#include <mtd.h>
+
+static struct mtd_info *spl_spi_nand_get_mtd(void)
+{

common/spl/spl_spi_nand.c line 39

Quoted 10 lines
common/spl/spl_spi_nand.c new file +10 -0
+	struct udevice *dev;
+	int ret;
+
+	for (ret = uclass_first_device_err(UCLASS_MTD, &dev);
+	     dev;
+	     ret = uclass_next_device_err(&dev)) {
+		if (ret)
+			continue;
+		if (device_is_compatible(dev, "spi-nand"))
+			return dev_get_uclass_priv(dev);

Is there a reason why you limit this to only spi-nand?

I think it would be better to pivot this into a more generic SPL MTD loader.

common/spl/spl_spi_nand.c line 46

Quoted 7 lines
common/spl/spl_spi_nand.c new file +7 -0
+	}
+
+	return NULL;
+}
+
+static ulong spl_spinand_fit_read(struct spl_load_info *load, ulong offs,
+				  ulong size, void *buf)

The _fit_ part can probably be dropped.

common/spl/spl_spi_nand.c line 53

Quoted 7 lines
common/spl/spl_spi_nand.c new file +7 -0
+{
+	struct mtd_info *mtd = load->priv;
+	size_t retlen = 0;
+	int ret;
+
+	ret = mtd_read(mtd, offs, size, &retlen, buf);
+	if (ret && ret != -EUCLEAN) {

Maybe use mtd_is_bitflip(ret)

common/spl/spl_spi_nand.c line 58

Quoted 5 lines
common/spl/spl_spi_nand.c new file +5 -0
+		printf("SPI NAND read failed offs=0x%lx size=0x%lx ret=%d\n",
+		       offs, size, ret);
+		return 0;
+	}
+	if (retlen != size)

Why do we need an error message above and not here?

Quoted 8 lines
common/spl/spl_spi_nand.c new file +8 -0
+		return 0;
+
+	return retlen;
+}
+
+static int spl_spinand_load_image(struct spl_image_info *spl_image,
+				  struct spl_boot_device *bootdev)
+{

common/spl/spl_spi_nand.c line 76

Quoted 10 lines
common/spl/spl_spi_nand.c new file +10 -0
+	struct spl_load_info load;
+	struct mtd_info *mtd;
+
+	mtd = spl_spi_nand_get_mtd();
+	if (!mtd) {
+		puts("SPI NAND probe failed.\n");
+		return -ENODEV;
+	}
+
+	spl_load_init(&load, spl_spinand_fit_read, mtd, 1);

Should probably use mtd->writesize as bl_len.

	spl_load_init(&load, spl_mtd_read, mtd, mtd->writesize);

common/spl/spl_spi_nand.c line 78

Quoted 2 lines
common/spl/spl_spi_nand.c new file +2 -0
+
+	return spl_load(spl_image, bootdev, &load, 0, CONFIG_SYS_SPI_U_BOOT_OFFS);

Suggest you could use something like following to closer match SPL flash.

	offset = CONFIG_SYS_SPI_U_BOOT_OFFS;
	if (CONFIG_IS_ENABLED(OF_REAL))
		offset = ofnode_conf_read_int("u-boot,spl-payload-offset",
					      offset);

	return spl_load(spl_image, bootdev, &load, 0, offset);
Quoted 21 lines
common/spl/spl_spi_nand.c new file +4 -0
+}
+
+/* Use priority 1 so that boards can override this */
+SPL_LOAD_IMAGE_METHOD("SPI NAND", 1, BOOT_DEVICE_SPI, spl_spinand_load_image);
drivers/mtd/Makefile +1 -0
index ce05e206073d..a12d880a9e90 100644
@@ -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 +0 -0
index c8169cf73902..7cd2a5f1af9b 100644

drivers/mtd/nand/Makefile line 5

Quoted 6 lines
drivers/mtd/nand/Makefile +2 -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),)

Having both XPL and TPL is redundant and could be cleaned up to just have ($(CONFIG_XPL_BUILD),).

Regards,
Jonas

Quoted 16 lines
drivers/mtd/nand/Makefile +10 -0
+
+# 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
#11 lore raw

PATCH v2 7/7 omega4-rv1103b: Add the initial support

In reply to Fabio Estevam

From: Fabio Estevam <[email protected]>

Add the initial support for Onion's Omega4 RV1103B board.

It boots from the SPI NAND.

Tested the boot of a 6.6 OpenWRT kernel and also a 6.19-rc8 mainline kernel.

---
Changes since v1:
- Only adapted to the correct SoC name: RV1103B instead of RV1103.

 arch/arm/include/asm/arch-rv1103b/boot0.h     |  11 ++
 arch/arm/mach-rockchip/Kconfig                |  14 ++
 arch/arm/mach-rockchip/Makefile               |   1 +
 arch/arm/mach-rockchip/rv1103b/Kconfig        |  23 +++
 arch/arm/mach-rockchip/rv1103b/Makefile       |  12 ++
 arch/arm/mach-rockchip/rv1103b/boot0.h        |   5 +
 arch/arm/mach-rockchip/rv1103b/clk_rv1103b.c  |  32 +++++
 arch/arm/mach-rockchip/rv1103b/rv1103b.c      | 133 ++++++++++++++++++
 .../mach-rockchip/rv1103b/syscon_rv1103b.c    |  19 +++
 board/onion/omega4_rv1103b/Kconfig            |  12 ++
 board/onion/omega4_rv1103b/MAINTAINERS        |   6 +
 board/onion/omega4_rv1103b/Makefile           |   7 +
 board/onion/omega4_rv1103b/omega4_rv1103b.c   |  19 +++
 board/onion/omega4_rv1103b/omega4_rv1103b.env |   5 +
 configs/omega4-rv1103b_defconfig              |  82 +++++++++++
 doc/board/index.rst                           |   1 +
 doc/board/onion/index.rst                     |   9 ++
 doc/board/onion/omega4-rv1103b.rst            |  56 ++++++++
 include/configs/omega4_rv1103b.h              |  11 ++
 include/configs/rv1103b_common.h              |  14 ++
 20 files changed, 472 insertions(+)
 create mode 100644 arch/arm/include/asm/arch-rv1103b/boot0.h
 create mode 100644 arch/arm/mach-rockchip/rv1103b/Kconfig
 create mode 100644 arch/arm/mach-rockchip/rv1103b/Makefile
 create mode 100644 arch/arm/mach-rockchip/rv1103b/boot0.h
 create mode 100644 arch/arm/mach-rockchip/rv1103b/clk_rv1103b.c
 create mode 100644 arch/arm/mach-rockchip/rv1103b/rv1103b.c
 create mode 100644 arch/arm/mach-rockchip/rv1103b/syscon_rv1103b.c
 create mode 100644 board/onion/omega4_rv1103b/Kconfig
 create mode 100644 board/onion/omega4_rv1103b/MAINTAINERS
 create mode 100644 board/onion/omega4_rv1103b/Makefile
 create mode 100644 board/onion/omega4_rv1103b/omega4_rv1103b.c
 create mode 100644 board/onion/omega4_rv1103b/omega4_rv1103b.env
 create mode 100644 configs/omega4-rv1103b_defconfig
 create mode 100644 doc/board/onion/index.rst
 create mode 100644 doc/board/onion/omega4-rv1103b.rst
 create mode 100644 include/configs/omega4_rv1103b.h
 create mode 100644 include/configs/rv1103b_common.h
arch/arm/include/asm/arch-rv1103b/boot0.h new file +11 -0
new file mode 100644
index 000000000000..2e78b074ade8
@@ -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
index 92bb4aa62f11..c1faeb974328 100644
@@ -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_RV1103B
+	bool "Support Rockchip RV1103B"
+	select CPU_V7A
+	select SPL_ARMV7_SET_CORTEX_SMPEN
+	select SUPPORT_SPL
+	select SPL
+	imply ROCKCHIP_COMMON_BOARD
+
+	help
+	  The Rockchip RV1103B 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/rv1103b/Kconfig"
 source "arch/arm/mach-rockchip/rv1108/Kconfig"
 source "arch/arm/mach-rockchip/rv1126/Kconfig"
 
arch/arm/mach-rockchip/Makefile +1 -0
index 06fb527b21a0..7bbb1697836c 100644
@@ -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_RV1103B) += rv1103b/
 obj-$(CONFIG_ROCKCHIP_RV1108) += rv1108/
 obj-$(CONFIG_ROCKCHIP_RV1126) += rv1126/
 
arch/arm/mach-rockchip/rv1103b/Kconfig new file +23 -0
new file mode 100644
index 000000000000..6b5f5b0b9e14
@@ -0,0 +1,23 @@
+if ROCKCHIP_RV1103B
+
+
+config TARGET_OMEGA4_RV1103B
+	bool "OMEGA4_RV1103B"
+	help
+	  Support Onion's Omega4 RV1103B board.
+
+config ROCKCHIP_BOOT_MODE_REG
+	default 0x20160200
+
+config ROCKCHIP_STIMER_BASE
+	default 0x20500000
+
+config SYS_SOC
+	default "rv1103b"
+
+config SYS_MALLOC_F_LEN
+	default 0x400
+
+source "board/onion/omega4_rv1103b/Kconfig"
+
+endif
arch/arm/mach-rockchip/rv1103b/Makefile new file +12 -0
new file mode 100644
index 000000000000..2f34853adac5
@@ -0,0 +1,12 @@
+#
+# (C) Copyright 2016 Rockchip Electronics Co., Ltd
+#
+# SPDX-License-Identifier:     GPL-2.0+
+#
+
+obj-y += rv1103b.o
+obj-y += clk_rv1103b.o
+
+ifndef CONFIG_XPL_BUILD
+obj-y += syscon_rv1103b.o
+endif
arch/arm/mach-rockchip/rv1103b/boot0.h new file +5 -0
new file mode 100644
index 000000000000..466ab0e80770
@@ -0,0 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/* Dummy boot0.h for RV1103B — SoC does not require special boot0 setup. */
+#ifndef __ASM_ARCH_BOOT0_H__
+#define __ASM_ARCH_BOOT0_H__
+#endif
arch/arm/mach-rockchip/rv1103b/clk_rv1103b.c new file +32 -0
new file mode 100644
index 000000000000..2bcbb08537e8
@@ -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_rv1103b.h>
+#include <linux/err.h>
+
+int rockchip_get_clk(struct udevice **devp)
+{
+	return uclass_get_device_by_driver(UCLASS_CLK,
+			DM_DRIVER_GET(clk_rv1103b), devp);
+}
+
+void *rockchip_get_cru(void)
+{
+	struct rv1103b_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/rv1103b/rv1103b.c new file +133 -0

133 lines not on this page · raw message

arch/arm/mach-rockchip/rv1103b/syscon_rv1103b.c new file +19 -0
new file mode 100644
index 000000000000..545b4d8ebe12
@@ -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 rv1103b_syscon_ids[] = {
+	{ .compatible = "rockchip,rv1103b-grf", .data = ROCKCHIP_SYSCON_GRF },
+	{ }
+};
+
+U_BOOT_DRIVER(syscon_rv1103b) = {
+	.name = "rv1103b_syscon",
+	.id = UCLASS_SYSCON,
+	.of_match = rv1103b_syscon_ids,
+};
board/onion/omega4_rv1103b/Kconfig new file +12 -0
new file mode 100644
index 000000000000..43b126c20e9c
@@ -0,0 +1,12 @@
+if TARGET_OMEGA4_RV1103B
+
+config SYS_BOARD
+	default "omega4_rv1103b"
+
+config SYS_VENDOR
+	default "onion"
+
+config SYS_CONFIG_NAME
+	default "omega4_rv1103b"
+
+endif
board/onion/omega4_rv1103b/MAINTAINERS new file +6 -0
new file mode 100644
index 000000000000..53d774535bdd
@@ -0,0 +1,6 @@
+OMEGA4 RV1103B
+M:      Fabio Estevam <[email protected]>
+S:      Maintained
+F:      board/onion/omega4_rv1103b
+F:      include/configs/omega4_rv1103b.h
+F:      configs/omega4-rv1103b_defconfig
board/onion/omega4_rv1103b/Makefile new file +7 -0
new file mode 100644
index 000000000000..afa0a7f7a932
@@ -0,0 +1,7 @@
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+# Copyright 2026 Fabio Estevam <[email protected]>
+#
+
+obj-y	+= omega4_rv1103b.o
board/onion/omega4_rv1103b/omega4_rv1103b.c new file +19 -0
new file mode 100644
index 000000000000..9bdec3c396a8
@@ -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_rv1103b/omega4_rv1103b.env new file +5 -0
new file mode 100644
index 000000000000..7ed232cab916
@@ -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-rv1103b_defconfig new file +82 -0

82 lines not on this page · raw message

doc/board/index.rst +1 -0
index 7870f1bc2461..d859f8a22bfe 100644
@@ -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
new file mode 100644
index 000000000000..2e106c8b7734
@@ -0,0 +1,9 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+Onion
+=====
+
+.. toctree::
+   :maxdepth: 2
+
+   omega4-rv1103b
doc/board/onion/omega4-rv1103b.rst new file +56 -0

56 lines not on this page · raw message

include/configs/omega4_rv1103b.h new file +11 -0
new file mode 100644
index 000000000000..8430b0b4d091
@@ -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/rv1103b_common.h>
+
+#endif
include/configs/rv1103b_common.h new file +14 -0
new file mode 100644
index 000000000000..8e970d710514
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * (C) Copyright 2016 Rockchip Electronics Co., Ltd
+ */
+#ifndef __CONFIG_RV1103B_COMMON_H
+#define __CONFIG_RV1103B_COMMON_H
+
+#include "rockchip-common.h"
+#include <config_distro_bootcmd.h>
+
+#define CFG_IRAM_BASE			0x210f6000
+#define CFG_SYS_SDRAM_BASE		0x00000000
+
+#endif
Signature · 1 line
2.34.1
#12 lore raw
In reply to Fabio Estevam

Hi Fabio,

Quoted 122 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

Hi,

This patch series adds support for the Onion RV1103B Omega4 board.

It covers SPL, SPI NAND boot, and the minimal board devicetree required to boot the board.

Upstreaming the RV1103B devicetree in Linux is ongoing, but to avoid blocking U-Boot support, this series introduces board-specific devicetrees for now.

Once the Linux RV1103B devicetrees are upstreamed, the OF_UPSTREAM mechanism can be enabled.

In v2, the correct SoC name was used: RV1103B instead of RV1103 (Thanks Jonas!), the RV1103B dt-bindings, devicetrees, clock and pinctrl drivers have been submitted upstream.

The dt-bindings have already been reviewed by the Linux DT maintainer:

https://lore.kernel.org/linux-devicetree/[email protected]/

https://lore.kernel.org/linux-devicetree/[email protected]/

https://lore.kernel.org/linux-devicetree/[email protected]/

https://lore.kernel.org/linux-devicetree/20260207-hulking-elegant-ferret-8efcea@quoll/

https://lore.kernel.org/linux-devicetree/20260208-analytic-fine-grouse-e17baa@quoll/

https://lore.kernel.org/linux-devicetree/20260208-pearl-ammonite-of-warranty-2c9212@quoll/

Tested the boot of a 6.6 OpenWRT kernel and also a 6.19-rc8 mainline kernel.

This series has successfully passed through CI.

Elaine Zhang (1):
clk: rockchip: Add RV1103B clock driver

Fabio Estevam (4):
ARM: dts: Add RV1103B Omega4 support
rockchip: spl-boot-order: Add SPI NAND support
spl: add SPI NAND support via MTD in SPL
omega4-rv1103b: Add the initial support

Xuhui Lin (1):
tools: rkcommon: Add RV1103B support

Ye Zhang (1):
pinctrl: rockchip: Add RV1103B support

 arch/arm/dts/rv1103b-omega4-u-boot.dtsi       |   10 +
 arch/arm/dts/rv1103b-omega4.dts               |  105 ++
 arch/arm/dts/rv1103b-pinctrl.dtsi             |  831 +++++++++++++
 arch/arm/dts/rv1103b-u-boot.dtsi              |    4 +
 arch/arm/dts/rv1103b.dtsi                     |  266 ++++
 .../include/asm/arch-rockchip/cru_rv1103b.h   |  266 ++++
 .../include/asm/arch-rockchip/grf_rv1103b.h   |   31 +
 arch/arm/include/asm/arch-rv1103b/boot0.h     |   11 +
 arch/arm/mach-rockchip/Kconfig                |   14 +
 arch/arm/mach-rockchip/Makefile               |    1 +
 arch/arm/mach-rockchip/rv1103b/Kconfig        |   23 +
 arch/arm/mach-rockchip/rv1103b/Makefile       |   12 +
 arch/arm/mach-rockchip/rv1103b/boot0.h        |    5 +
 arch/arm/mach-rockchip/rv1103b/clk_rv1103b.c  |   32 +
 arch/arm/mach-rockchip/rv1103b/rv1103b.c      |  133 ++
 .../mach-rockchip/rv1103b/syscon_rv1103b.c    |   19 +
 arch/arm/mach-rockchip/spl-boot-order.c       |   11 +-
 board/onion/omega4_rv1103b/Kconfig            |   12 +
 board/onion/omega4_rv1103b/MAINTAINERS        |    6 +
 board/onion/omega4_rv1103b/Makefile           |    7 +
 board/onion/omega4_rv1103b/omega4_rv1103b.c   |   19 +
 board/onion/omega4_rv1103b/omega4_rv1103b.env |    5 +
 common/spl/Kconfig                            |   10 +-
 common/spl/Makefile                           |    1 +
 common/spl/spl_spi_nand.c                     |   82 ++
 configs/omega4-rv1103b_defconfig              |   82 ++
 doc/board/index.rst                           |    1 +
 doc/board/onion/index.rst                     |    9 +
 doc/board/onion/omega4-rv1103b.rst            |   56 +
 drivers/clk/rockchip/Makefile                 |    1 +
 drivers/clk/rockchip/clk_rv1103b.c            | 1068 +++++++++++++++++
 drivers/mtd/Makefile                          |    1 +
 drivers/mtd/nand/Makefile                     |   13 +-
 drivers/pinctrl/rockchip/Makefile             |    1 +
 drivers/pinctrl/rockchip/pinctrl-rv1103b.c    |  398 ++++++
 include/configs/omega4_rv1103b.h              |   11 +
 include/configs/rv1103b_common.h              |   14 +
 .../dt-bindings/clock/rockchip,rv1103b-cru.h  |  220 ++++
 tools/rkcommon.c                              |    1 +
 39 files changed, 3788 insertions(+), 4 deletions(-)
 create mode 100644 arch/arm/dts/rv1103b-omega4-u-boot.dtsi
 create mode 100644 arch/arm/dts/rv1103b-omega4.dts
 create mode 100644 arch/arm/dts/rv1103b-pinctrl.dtsi
 create mode 100644 arch/arm/dts/rv1103b-u-boot.dtsi
 create mode 100644 arch/arm/dts/rv1103b.dtsi
 create mode 100644 arch/arm/include/asm/arch-rockchip/cru_rv1103b.h
 create mode 100644 arch/arm/include/asm/arch-rockchip/grf_rv1103b.h
 create mode 100644 arch/arm/include/asm/arch-rv1103b/boot0.h
 create mode 100644 arch/arm/mach-rockchip/rv1103b/Kconfig
 create mode 100644 arch/arm/mach-rockchip/rv1103b/Makefile
 create mode 100644 arch/arm/mach-rockchip/rv1103b/boot0.h
 create mode 100644 arch/arm/mach-rockchip/rv1103b/clk_rv1103b.c
 create mode 100644 arch/arm/mach-rockchip/rv1103b/rv1103b.c
 create mode 100644 arch/arm/mach-rockchip/rv1103b/syscon_rv1103b.c
 create mode 100644 board/onion/omega4_rv1103b/Kconfig
 create mode 100644 board/onion/omega4_rv1103b/MAINTAINERS
 create mode 100644 board/onion/omega4_rv1103b/Makefile
 create mode 100644 board/onion/omega4_rv1103b/omega4_rv1103b.c
 create mode 100644 board/onion/omega4_rv1103b/omega4_rv1103b.env
 create mode 100644 common/spl/spl_spi_nand.c
 create mode 100644 configs/omega4-rv1103b_defconfig
 create mode 100644 doc/board/onion/index.rst
 create mode 100644 doc/board/onion/omega4-rv1103b.rst
 create mode 100644 drivers/clk/rockchip/clk_rv1103b.c
 create mode 100644 drivers/pinctrl/rockchip/pinctrl-rv1103b.c
 create mode 100644 include/configs/omega4_rv1103b.h
 create mode 100644 include/configs/rv1103b_common.h
 create mode 100644 include/dt-bindings/clock/rockchip,rv1103b-cru.h
Quoted 3 lines

--
2.34.1

I recently got one of these boards and have it running in my lab at a basic level (boot to prompt, SPI-NAND and MMC).

Are you still planning to send a v3? If not I could handle Jonas's feedback and send out a v3?

Regards,
Simon

#13 lore raw

Hi Simon,

Quoted 5 lines · Simon Glass

I recently got one of these boards and have it running in my lab at a basic level (boot to prompt, SPI-NAND and MMC).

Are you still planning to send a v3? If not I could handle Jonas's feedback and send out a v3?

Please go ahead and submit a v3.

Thanks,

Fabio Estevam

#14 lore raw
Quoted 11 lines · Fabio Estevam

Hi Simon,

Quoted 5 lines · Simon Glass

I recently got one of these boards and have it running in my lab at a basic level (boot to prompt, SPI-NAND and MMC).

Are you still planning to send a v3? If not I could handle Jonas's feedback and send out a v3?

Please go ahead and submit a v3.

Until the situation with u-boot.org is resolved, it would be better for you to handle a v3 Fabio, thanks.

Signature · 1 line
Tom
#15 lore raw

Hi Tom,

Quoted 9 lines · Tom Rini
Quoted 7 lines · Fabio Estevam

Hi Simon,

Quoted 3 lines · Simon Glass

I recently got one of these boards and have it running in my lab at a basic level (boot to prompt, SPI-NAND and MMC).

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Are you still planning to send a v3? If not I could handle Jonas's feedback and send out a v3?

Please go ahead and submit a v3.

Until the situation with u-boot.org is resolved, it would be better for you to handle a v3 Fabio, thanks.

Oh well a bit behind on email and I already sent it, but perhaps Fabio could send a v4.

Regards,
Simon