Skip to contentSkip to conversation

Renesas RZ/N1 SoC initial support

PATCH Superseded Ralph Siemsen 2 participants 44 messages Mar 8, 2023 – Apr 18, 2023

Subsystems (7)

v4 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v4 cover Renesas RZ/N1 SoC initial support

The RZ/N1 is a family of SoC devices from Renesas [1], featuring ARM Cortex-A7 and/or Cortex-M3 CPU, industrial ethernet protocols, integrated Ethernet switch, and numerous peripherals.

This is a first step in upstreaming support for the RZ/N1 family. Currently it contains just enough to boot to the u-boot prompt. Additional patches will follow to support flash, SD, USB, Ethernet, etc.

This work is based on a vendor-supplied u-boot 2017.01 tree [2], which supports several eval boards, none of which I have access to. Instead development has been done on a Schneider RZN1 board, which is fairly similar to the Renesas RZ/N1D-DB Demo board.

[1] https://www.renesas.com/us/en/products/microcontrollers-microprocessors/rz-mpus/rzn1
[2] https://github.com/renesas-rz/rzn1_u-boot/tree/rzn1-stable

Changes in v4:
- rebase to u-boot v2023.04-rc3
- remove RFC prefix
- cc entire series to Marek by request
- clock tables synced with linux (pending patches)
- documentation and comment improvements

Changes in v3:
- many tweaks to clock driver based on reviewer feedback
- rebased to u-boot v2023.04-rc2
- reviewer suggestions added to spkgimage.c
- many small cleanups, checkpatch, FIXMEs resolved

Changes in v2:
- rewrote the stand-alone spkg_utility to integrate into mkimage

Ralph Siemsen (10):
ARM: armv7: add non-SPL enable for Cortex SMPEN
clk: renesas: prepare for non-RCAR clock drivers
clk: renesas: add R906G032 driver
pinctrl: renesas: add R906G032 driver
ram: cadence: add driver for Cadence EDAC
dts: basic devicetree for Renesas RZ/N1 SoC
ARM: rzn1: basic support for Renesas RZ/N1 SoC
board: schneider: add RZN1 board support
tools: spkgimage: add Renesas SPKG format
doc: renesas: add Renesas board docs

 arch/arm/Kconfig                              |   17 +
 arch/arm/Makefile                             |    1 +
 arch/arm/cpu/armv7/Kconfig                    |    5 +
 arch/arm/dts/r9a06g032-rzn1-snarc-u-boot.dtsi |   23 +
 arch/arm/dts/r9a06g032-rzn1-snarc.dts         |   51 +
 arch/arm/dts/r9a06g032.dtsi                   |  226 ++++
 arch/arm/mach-rzn1/Kconfig                    |   32 +
 arch/arm/mach-rzn1/Makefile                   |    3 +
 arch/arm/mach-rzn1/cpu_info.c                 |   19 +
 board/schneider/rzn1-snarc/Kconfig            |   18 +
 board/schneider/rzn1-snarc/Makefile           |    3 +
 board/schneider/rzn1-snarc/ddr_timing.c       |  140 +++
 .../jedec_ddr3_2g_x16_1333h_500_cl8.h         |  399 ++++++
 board/schneider/rzn1-snarc/rzn1.c             |   39 +
 board/schneider/rzn1-snarc/spkgimage.cfg      |   26 +
 boot/image.c                                  |    1 +
 configs/rzn1_snarc_defconfig                  |   21 +
 doc/board/renesas/index.rst                   |    9 +
 doc/board/renesas/renesas.rst                 |  115 ++
 doc/mkimage.1                                 |   45 +
 drivers/clk/renesas/Kconfig                   |    8 +-
 drivers/clk/renesas/Makefile                  |    6 +-
 drivers/clk/renesas/r9a06g032-clocks.c        | 1096 +++++++++++++++++
 drivers/pinctrl/Makefile                      |    1 +
 drivers/pinctrl/renesas/Kconfig               |    7 +
 drivers/pinctrl/renesas/Makefile              |    1 +
 drivers/pinctrl/renesas/pinctrl-rzn1.c        |  379 ++++++
 drivers/ram/Kconfig                           |    1 +
 drivers/ram/Makefile                          |    2 +
 drivers/ram/cadence/Kconfig                   |   12 +
 drivers/ram/cadence/Makefile                  |    1 +
 drivers/ram/cadence/ddr_async.c               |  311 +++++
 drivers/ram/cadence/ddr_ctrl.c                |  414 +++++++
 drivers/ram/cadence/ddr_ctrl.h                |  175 +++
 include/configs/rzn1-snarc.h                  |   17 +
 include/dt-bindings/clock/r9a06g032-sysctrl.h |  148 +++
 include/dt-bindings/pinctrl/rzn1-pinctrl.h    |  141 +++
 include/image.h                               |    1 +
 tools/Makefile                                |    1 +
 tools/spkgimage.c                             |  330 +++++
 tools/spkgimage.h                             |   87 ++
 41 files changed, 4328 insertions(+), 4 deletions(-)
 create mode 100644 arch/arm/dts/r9a06g032-rzn1-snarc-u-boot.dtsi
 create mode 100644 arch/arm/dts/r9a06g032-rzn1-snarc.dts
 create mode 100644 arch/arm/dts/r9a06g032.dtsi
 create mode 100644 arch/arm/mach-rzn1/Kconfig
 create mode 100644 arch/arm/mach-rzn1/Makefile
 create mode 100644 arch/arm/mach-rzn1/cpu_info.c
 create mode 100644 board/schneider/rzn1-snarc/Kconfig
 create mode 100644 board/schneider/rzn1-snarc/Makefile
 create mode 100644 board/schneider/rzn1-snarc/ddr_timing.c
 create mode 100644 board/schneider/rzn1-snarc/jedec_ddr3_2g_x16_1333h_500_cl8.h
 create mode 100644 board/schneider/rzn1-snarc/rzn1.c
 create mode 100644 board/schneider/rzn1-snarc/spkgimage.cfg
 create mode 100644 configs/rzn1_snarc_defconfig
 create mode 100644 doc/board/renesas/index.rst
 create mode 100644 doc/board/renesas/renesas.rst
 create mode 100644 drivers/clk/renesas/r9a06g032-clocks.c
 create mode 100644 drivers/pinctrl/renesas/pinctrl-rzn1.c
 create mode 100644 drivers/ram/cadence/Kconfig
 create mode 100644 drivers/ram/cadence/Makefile
 create mode 100644 drivers/ram/cadence/ddr_async.c
 create mode 100644 drivers/ram/cadence/ddr_ctrl.c
 create mode 100644 drivers/ram/cadence/ddr_ctrl.h
 create mode 100644 include/configs/rzn1-snarc.h
 create mode 100644 include/dt-bindings/clock/r9a06g032-sysctrl.h
 create mode 100644 include/dt-bindings/pinctrl/rzn1-pinctrl.h
 create mode 100644 tools/spkgimage.c
 create mode 100644 tools/spkgimage.h
Signature · 1 line
2.25.1
#1 lore raw

PATCH v4 1/10 ARM: armv7: add non-SPL enable for Cortex SMPEN

Commit 2564fce7eea3 ("sunxi: move Cortex SMPEN setting into start.S") added SPL_ARMV7_SET_CORTEX_SMPEN to enable setting SMP bit. For platforms not using SPL boot, add the corresponding non-SPL config, so that CONFIG_IS_ENABLED(ARMV7_SET_CORTEX_SMPEN) works as expected.

---
This will be used by the following commit that adds ARCH_RZN1.

(no changes since v1)

 arch/arm/cpu/armv7/Kconfig | 5 +++++
 1 file changed, 5 insertions(+)
arch/arm/cpu/armv7/Kconfig +5 -0
index f1e4e26b8f..e33e53636a 100644
@@ -107,6 +107,11 @@ config ARMV7_LPAE
 	Say Y here to use the long descriptor page table format. This is
 	required if U-Boot runs in HYP mode.
 
+config ARMV7_SET_CORTEX_SMPEN
+	bool
+	help
+	  Enable the ARM Cortex ACTLR.SMP enable bit in U-boot.
+
 config SPL_ARMV7_SET_CORTEX_SMPEN
 	bool
 	help
Signature · 1 line
2.25.1
Reviewed-by on v4 1/10
#2 lore raw

Re: [PATCH v4 01/10] ARM: armv7: add non-SPL enable for Cortex SMPEN

Quoted 6 lines · Ralph Siemsen

Commit 2564fce7eea3 ("sunxi: move Cortex SMPEN setting into start.S") added SPL_ARMV7_SET_CORTEX_SMPEN to enable setting SMP bit. For platforms not using SPL boot, add the corresponding non-SPL config, so that CONFIG_IS_ENABLED(ARMV7_SET_CORTEX_SMPEN) works as expected.

You could send this patch as a separate one.

#3 lore raw

Re: [PATCH v4 01/10] ARM: armv7: add non-SPL enable for Cortex SMPEN

Quoted 11 lines · Marek Vasut
Quoted 6 lines · Ralph Siemsen

Commit 2564fce7eea3 ("sunxi: move Cortex SMPEN setting into start.S") added SPL_ARMV7_SET_CORTEX_SMPEN to enable setting SMP bit. For platforms not using SPL boot, add the corresponding non-SPL config, so that CONFIG_IS_ENABLED(ARMV7_SET_CORTEX_SMPEN) works as expected.

You could send this patch as a separate one.

In fact I did that almost a year ago:
https://lore.kernel.org/u-boot/[email protected]/T/#u

Ralph

#4 lore raw

Re: [PATCH v4 01/10] ARM: armv7: add non-SPL enable for Cortex SMPEN

Quoted 7 lines · Ralph Siemsen
Quoted 6 lines · Marek Vasut
Quoted 5 lines · Ralph Siemsen

Commit 2564fce7eea3 ("sunxi: move Cortex SMPEN setting into start.S") added SPL_ARMV7_SET_CORTEX_SMPEN to enable setting SMP bit. For platforms not using SPL boot, add the corresponding non-SPL config, so that CONFIG_IS_ENABLED(ARMV7_SET_CORTEX_SMPEN) works as expected.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

You could send this patch as a separate one.

In fact I did that almost a year ago:
https://lore.kernel.org/u-boot/[email protected]/T/#u

Hmmm, Tom (+Cc) pointed out the patch does not do anything, but that is not correct, is it ? If I look at 2564fce7eea3 ("sunxi: move Cortex SMPEN setting into start.S") , this extra Kconfig symbol just makes that functionality available outside of SPL (i.e. in normal U-Boot), while before this change the functionality was only available in SPL. Right ?

(so yeah, I think this patch should go in, and could go in separately)

But please correct me if I'm wrong.

#5 lore raw

Re: [PATCH v4 01/10] ARM: armv7: add non-SPL enable for Cortex SMPEN

Quoted 5 lines · Marek Vasut
Quoted 3 lines · Ralph Siemsen
Quoted 1 line · Marek Vasut

You could send this patch as a separate one.

Quoted 8 lines
Quoted 2 lines

In fact I did that almost a year ago:
https://lore.kernel.org/u-boot/[email protected]/T/#u

Hmmm, Tom (+Cc) pointed out the patch does not do anything, but that is not correct, is it ? If I look at 2564fce7eea3 ("sunxi: move Cortex SMPEN setting into start.S") , this extra Kconfig symbol just makes that functionality available outside of SPL (i.e. in normal U-Boot), while before this change the functionality was only available in SPL. Right ?

Correct, my patch makes the symbol available outside of SPL.

I think Tom's objection was to adding the symbol without any users. This is rectified by patch 07 ("ARM: rzn1: basic support"),

Ralph

#6 lore raw

Re: [PATCH v4 01/10] ARM: armv7: add non-SPL enable for Cortex SMPEN

Quoted 15 lines · Ralph Siemsen
Quoted 5 lines · Marek Vasut
Quoted 3 lines · Ralph Siemsen
Quoted 1 line · Marek Vasut

You could send this patch as a separate one.

Quoted 8 lines
Quoted 2 lines

In fact I did that almost a year ago:
https://lore.kernel.org/u-boot/[email protected]/T/#u

Hmmm, Tom (+Cc) pointed out the patch does not do anything, but that is not correct, is it ? If I look at 2564fce7eea3 ("sunxi: move Cortex SMPEN setting into start.S") , this extra Kconfig symbol just makes that functionality available outside of SPL (i.e. in normal U-Boot), while before this change the functionality was only available in SPL. Right ?

Quoted 4 lines

Correct, my patch makes the symbol available outside of SPL.

I think Tom's objection was to adding the symbol without any users. This is rectified by patch 07 ("ARM: rzn1: basic support"),

ACK

#7 lore raw

PATCH v4 2/10 clk: renesas: prepare for non-RCAR clock drivers

In reply to Ralph Siemsen

Allow CONFIG_CLK_RENESAS to be set without bringing in RCAR-GEN2/3 code.

CONFIG_RENESAS is used in drivers/clk/Makefile to control recursion into the drivers/clk/renesas subdirectory. It also controls compilation of renesas-cpg-mssr.c support code for the RCAR-GEN2 and RCAR-GEN3 devices.

The support code contains platform specific hardware access (TMU_BASE), and it is not needed for other Renesas devices such as RZ/N1. Therefore, alter Makefile to build renesas-cpg-mssr.c only for RCAR-GEN2/3.

---

(no changes since v3)

Changes in v3:
- added tags

 drivers/clk/renesas/Kconfig  | 2 +-
 drivers/clk/renesas/Makefile | 5 ++---
 2 files changed, 3 insertions(+), 4 deletions(-)
drivers/clk/renesas/Kconfig +1 -1
index 1686410d6d..6788415eed 100644
@@ -1,6 +1,6 @@
 config CLK_RENESAS
 	bool "Renesas clock drivers"
-	depends on CLK && ARCH_RMOBILE
+	depends on CLK && (ARCH_RMOBILE || ARCH_RZN1)
 	help
 	  Enable support for clock present on Renesas RCar SoCs.
 
drivers/clk/renesas/Makefile +2 -3
index 8f82a7aa3e..a0d8c10bdb 100644
@@ -1,6 +1,5 @@
-obj-$(CONFIG_CLK_RENESAS) += renesas-cpg-mssr.o
 obj-$(CONFIG_CLK_RCAR_CPG_LIB) += rcar-cpg-lib.o
-obj-$(CONFIG_CLK_RCAR_GEN2) += clk-rcar-gen2.o
+obj-$(CONFIG_CLK_RCAR_GEN2) += clk-rcar-gen2.o renesas-cpg-mssr.o
 obj-$(CONFIG_CLK_R8A774A1) += r8a774a1-cpg-mssr.o
 obj-$(CONFIG_CLK_R8A774B1) += r8a774b1-cpg-mssr.o
 obj-$(CONFIG_CLK_R8A774C0) += r8a774c0-cpg-mssr.o
@@ -10,7 +9,7 @@ obj-$(CONFIG_CLK_R8A7791) += r8a7791-cpg-mssr.o
 obj-$(CONFIG_CLK_R8A7792) += r8a7792-cpg-mssr.o
 obj-$(CONFIG_CLK_R8A7793) += r8a7791-cpg-mssr.o
 obj-$(CONFIG_CLK_R8A7794) += r8a7794-cpg-mssr.o
-obj-$(CONFIG_CLK_RCAR_GEN3) += clk-rcar-gen3.o
+obj-$(CONFIG_CLK_RCAR_GEN3) += clk-rcar-gen3.o renesas-cpg-mssr.o
 obj-$(CONFIG_CLK_R8A7795) += r8a7795-cpg-mssr.o
 obj-$(CONFIG_CLK_R8A77960) += r8a7796-cpg-mssr.o
 obj-$(CONFIG_CLK_R8A77961) += r8a7796-cpg-mssr.o
Signature · 1 line
2.25.1
#8 lore raw

Re: [PATCH v4 02/10] clk: renesas: prepare for non-RCAR clock drivers

Quoted 40 lines · Ralph Siemsen

Allow CONFIG_CLK_RENESAS to be set without bringing in RCAR-GEN2/3 code.

CONFIG_RENESAS is used in drivers/clk/Makefile to control recursion into the drivers/clk/renesas subdirectory. It also controls compilation of renesas-cpg-mssr.c support code for the RCAR-GEN2 and RCAR-GEN3 devices.

The support code contains platform specific hardware access (TMU_BASE), and it is not needed for other Renesas devices such as RZ/N1. Therefore, alter Makefile to build renesas-cpg-mssr.c only for RCAR-GEN2/3.

---

(no changes since v3)

Changes in v3:
- added tags

  drivers/clk/renesas/Kconfig  | 2 +-
  drivers/clk/renesas/Makefile | 5 ++---
  2 files changed, 3 insertions(+), 4 deletions(-)
drivers/clk/renesas/Kconfig +1 -1
index 1686410d6d..6788415eed 100644
@@ -1,6 +1,6 @@
  config CLK_RENESAS
  	bool "Renesas clock drivers"
-	depends on CLK && ARCH_RMOBILE
+	depends on CLK && (ARCH_RMOBILE || ARCH_RZN1)
  	help
  	  Enable support for clock present on Renesas RCar SoCs.
 
drivers/clk/renesas/Makefile +0 -0
index 8f82a7aa3e..a0d8c10bdb 100644

drivers/clk/renesas/Makefile line 2

Quoted 4 lines
drivers/clk/renesas/Makefile +1 -2
@@ -1,6 +1,5 @@
-obj-$(CONFIG_CLK_RENESAS) += renesas-cpg-mssr.o
  obj-$(CONFIG_CLK_RCAR_CPG_LIB) += rcar-cpg-lib.o
-obj-$(CONFIG_CLK_RCAR_GEN2) += clk-rcar-gen2.o
+obj-$(CONFIG_CLK_RCAR_GEN2) += clk-rcar-gen2.o renesas-cpg-mssr.o

Why not move the renesas-cpg-mssr.o into obj-$(CONFIG_CLK_RCAR_CPG_LIB) line instead ? I suspect RZN1 is not using the CPG lib anyway ?

#9 lore raw

Re: [PATCH v4 02/10] clk: renesas: prepare for non-RCAR clock drivers

Hi Marek,

Quoted 12 lines · Marek Vasut

drivers/clk/renesas/Makefile line 2

Quoted 9 lines · Ralph Siemsen
drivers/clk/renesas/Makefile +1 -2
index 8f82a7aa3e..a0d8c10bdb 100644
@@ -1,6 +1,5 @@
-obj-$(CONFIG_CLK_RENESAS) += renesas-cpg-mssr.o
 obj-$(CONFIG_CLK_RCAR_CPG_LIB) += rcar-cpg-lib.o
-obj-$(CONFIG_CLK_RCAR_GEN2) += clk-rcar-gen2.o
+obj-$(CONFIG_CLK_RCAR_GEN2) += clk-rcar-gen2.o renesas-cpg-mssr.o

Why not move the renesas-cpg-mssr.o into obj-$(CONFIG_CLK_RCAR_CPG_LIB) line instead ?

I think this would break the build for gen2 devices, because they make calls to CPG functions (eg. renesas_clk_endisable from clk-rcar-gen2.c), however Kconfig only selects CPG lib for gen3.

Perhaps we could change Kconfig to select CPG also for gen2. I can make this patch, but how to test that this does not introduce any new problems? Might there be an autobuilder for R-Car somewhere?

Quoted 1 line

I suspect RZN1 is not using the CPG lib anyway ?

You are correct, RZN1 does not use the CPG lib.

Regards
Ralph

#10 lore raw

Re: [PATCH v4 02/10] clk: renesas: prepare for non-RCAR clock drivers

Quoted 16 lines · Ralph Siemsen

Hi Marek,

Quoted 12 lines · Marek Vasut

drivers/clk/renesas/Makefile line 2

Quoted 9 lines · Ralph Siemsen
drivers/clk/renesas/Makefile +0 -1
index 8f82a7aa3e..a0d8c10bdb 100644
@@ -1,6 +1,5 @@
-obj-$(CONFIG_CLK_RENESAS) += renesas-cpg-mssr.o

 obj-$(CONFIG_CLK_RCAR_CPG_LIB) += rcar-cpg-lib.o

drivers/clk/renesas/Makefile +1 -1
-obj-$(CONFIG_CLK_RCAR_GEN2) += clk-rcar-gen2.o
+obj-$(CONFIG_CLK_RCAR_GEN2) += clk-rcar-gen2.o renesas-cpg-mssr.o

Why not move the renesas-cpg-mssr.o into obj-$(CONFIG_CLK_RCAR_CPG_LIB) line instead ?

Quoted 1 line

I think this would break the build for gen2 devices, because they make calls to CPG functions (eg. renesas_clk_endisable from clk-rcar-gen2.c), however Kconfig only selects CPG lib for gen3.

Good point

Quoted 1 line

Perhaps we could change Kconfig to select CPG also for gen2. I can make this patch, but how to test that this does not introduce any new problems?  Might there be an autobuilder for R-Car somewhere?

You could introduce CONFIG_CLK_RCAR Kconfig symbol and use that for renesas-cpg-mssr.o . Would that work ?

#11 lore raw

Re: [PATCH v4 02/10] clk: renesas: prepare for non-RCAR clock drivers

Quoted 4 lines · Marek Vasut
Quoted 1 line · Ralph Siemsen

Perhaps we could change Kconfig to select CPG also for gen2. I can make this patch, but how to test that this does not introduce any new problems?  Might there be an autobuilder for R-Car somewhere?

You could introduce CONFIG_CLK_RCAR Kconfig symbol and use that for renesas-cpg-mssr.o . Would that work ?

I can certainly make the patch, and hopefully also do at least a compile-test. Though I will need to figure out which defconfigs I need to test...

Ralph

#12 lore raw

Re: [PATCH v4 02/10] clk: renesas: prepare for non-RCAR clock drivers

Quoted 7 lines · Ralph Siemsen
Quoted 4 lines · Marek Vasut
Quoted 1 line · Ralph Siemsen

Perhaps we could change Kconfig to select CPG also for gen2. I can make this patch, but how to test that this does not introduce any new problems?  Might there be an autobuilder for R-Car somewhere?

You could introduce CONFIG_CLK_RCAR Kconfig symbol and use that for renesas-cpg-mssr.o . Would that work ?

I can certainly make the patch, and hopefully also do at least a compile-test. Though I will need to figure out which defconfigs I need to test...

Try 'grep RENESAS configs/*' , that should give you a decent list.

#13 lore raw

PATCH v4 3/10 clk: renesas: add R906G032 driver

In reply to Ralph Siemsen

Clock driver for the Renesas RZ/N1 SoC family. This is based on Linux kernel 6.2.y drivers/clk/renesas/r9a06g032-clocks.c as found in commit 02693e11611e ("clk: renesas: r9a06g032: Repair grave increment error"), with the following additional patch series applied:
https://lore.kernel.org/linux-renesas-soc/[email protected]/

Notable difference: this version avoids allocating a 'struct clk' for each clock source, as this is problematic before relocation. Instead, it uses the same approach as existing Renesas RCAR2/3 clock drivers, using a temporary structure filled on-the-fly.

---

Changes in v4:
- commit message now includes hash of Linux upon which this is based as well as the additional patches (clock table cleanups)
- sync changes from review on linux patches, including
- move RB macro higher up and document it, matching Linux driver
- use multiply/divide instead of shifts for computing reg address
- improve comments for clock gate, descriptor structures

Changes in v3:
- convert data table to explicit reg/bit numbers
- drop the unused scon, mirack, mirstat fields
- added some kernel docs to structures
- use enum for type field of struct r9a06g032_clkdesc
- cleanup macros for one assignment per line
- add a macro for top-most clock ID value ~0
- use dev_dbg() instead of debug/print
- minor reformatting, declarations before code, etc
- !foo instead of foo == 0
- IS_ERR / PTR_ERR where appropriate
- implement div_table handling
- remove some #if 0 old test code

 drivers/clk/renesas/Kconfig            |    6 +
 drivers/clk/renesas/Makefile           |    1 +
 drivers/clk/renesas/r9a06g032-clocks.c | 1096 ++++++++++++++++++++++++
 3 files changed, 1103 insertions(+)
 create mode 100644 drivers/clk/renesas/r9a06g032-clocks.c
drivers/clk/renesas/Kconfig +6 -0
index 6788415eed..bbc618f464 100644
@@ -130,3 +130,9 @@ config CLK_R8A779A0
 	depends on CLK_RCAR_GEN3
 	help
 	  Enable this to support the clocks on Renesas R8A779A0 SoC.
+
+config CLK_R9A06G032
+	bool "Renesas R9A06G032 clock driver"
+	depends on CLK_RENESAS
+	help
+	  Enable this to support the clocks on Renesas R9A06G032 SoC.
drivers/clk/renesas/Makefile +1 -0
index a0d8c10bdb..7f0ef28367 100644
@@ -19,3 +19,4 @@ obj-$(CONFIG_CLK_R8A77980) += r8a77980-cpg-mssr.o
 obj-$(CONFIG_CLK_R8A77990) += r8a77990-cpg-mssr.o
 obj-$(CONFIG_CLK_R8A77995) += r8a77995-cpg-mssr.o
 obj-$(CONFIG_CLK_R8A779A0) += r8a779a0-cpg-mssr.o
+obj-$(CONFIG_CLK_R9A06G032) += r9a06g032-clocks.o
drivers/clk/renesas/r9a06g032-clocks.c new file +1096 -0

1,096 lines not on this page · raw message

Signature · 1 line
2.25.1
#14 lore raw

Re: [PATCH v4 03/10] clk: renesas: add R906G032 driver

Quoted 9 lines · Ralph Siemsen

Clock driver for the Renesas RZ/N1 SoC family. This is based on Linux kernel 6.2.y drivers/clk/renesas/r9a06g032-clocks.c as found in commit 02693e11611e ("clk: renesas: r9a06g032: Repair grave increment error"), with the following additional patch series applied:
https://lore.kernel.org/linux-renesas-soc/[email protected]/

Notable difference: this version avoids allocating a 'struct clk' for each clock source, as this is problematic before relocation. Instead, it uses the same approach as existing Renesas RCAR2/3

R-Car , not RCAR .

[...]

Quoted 10 lines
drivers/clk/renesas/r9a06g032-clocks.c new file +10 -0
+static int r9a06g032_clk_probe(struct udevice *dev)
+{
+	struct r9a06g032_priv *priv = dev_get_priv(dev);
+	int err;
+
+	priv->regmap = syscon_regmap_lookup_by_phandle(dev, "regmap");
+	if (IS_ERR(priv->regmap)) {
+		dev_dbg(dev, "unable to find regmap\n");
+		return PTR_ERR(priv->regmap);
+	}

drivers/clk/renesas/r9a06g032-clocks.c line 1080

Quoted 10 lines
drivers/clk/renesas/r9a06g032-clocks.c new file +10 -0
+
+	/* Enable S/W reset */
+	regmap_write(priv->regmap, 0x120, 0x41);
+
+	/* Get master clock */
+	err = clk_get_by_name(dev, "mclk", &priv->mclk);
+	if (err)
+		return err;
+
+	return 0;

You can use 'return clk_get_by_name(...)' here directly instead of the '
err = ...
if (err)
return err;
return 0;
'

#15 lore raw

Re: [PATCH v4 03/10] clk: renesas: add R906G032 driver

Quoted 2 lines · Marek Vasut

R-Car , not RCAR .

Ack, will fix in next version (including in some commit msg)

Quoted 14 lines
Quoted 14 lines
drivers/clk/renesas/r9a06g032-clocks.c new file +14 -0
+static int r9a06g032_clk_probe(struct udevice *dev)
+{
+	struct r9a06g032_priv *priv = dev_get_priv(dev);
+	int err;
+
+	priv->regmap = syscon_regmap_lookup_by_phandle(dev, "regmap");
+	if (IS_ERR(priv->regmap)) {
+		dev_dbg(dev, "unable to find regmap\n");
+		return PTR_ERR(priv->regmap);
+	}
+
+	/* Enable S/W reset */
+	regmap_write(priv->regmap, 0x120, 0x41);
+
Quoted 8 lines

drivers/clk/renesas/r9a06g032-clocks.c line 1080

Quoted 6 lines
drivers/clk/renesas/r9a06g032-clocks.c new file +6 -0
+	/* Get master clock */
+	err = clk_get_by_name(dev, "mclk", &priv->mclk);
+	if (err)
+		return err;
+
+	return 0;

You can use 'return clk_get_by_name(...)' here directly instead of the

Will do.

Ralph

#16 lore raw

PATCH v4 4/10 pinctrl: renesas: add R906G032 driver

In reply to Ralph Siemsen

Pinctrl/pinconf driver for Renesas RZ/N1 (R906G032) SoC.

This is quite rudimentary right now, and only supports applying a default pin configuration as specified by the device tree.

---

(no changes since v1)

 drivers/pinctrl/Makefile                   |   1 +
 drivers/pinctrl/renesas/Kconfig            |   7 +
 drivers/pinctrl/renesas/Makefile           |   1 +
 drivers/pinctrl/renesas/pinctrl-rzn1.c     | 379 +++++++++++++++++++++
 include/dt-bindings/pinctrl/rzn1-pinctrl.h | 141 ++++++++
 5 files changed, 529 insertions(+)
 create mode 100644 drivers/pinctrl/renesas/pinctrl-rzn1.c
 create mode 100644 include/dt-bindings/pinctrl/rzn1-pinctrl.h
drivers/pinctrl/Makefile +1 -0
index 3b167d099f..450267732c 100644
@@ -14,6 +14,7 @@ obj-$(CONFIG_PINCTRL_INTEL) += intel/
 obj-$(CONFIG_ARCH_MTMIPS) += mtmips/
 obj-$(CONFIG_ARCH_NPCM)         += nuvoton/
 obj-$(CONFIG_ARCH_RMOBILE) += renesas/
+obj-$(CONFIG_ARCH_RZN1) += renesas/
 obj-$(CONFIG_PINCTRL_SANDBOX)	+= pinctrl-sandbox.o
 obj-$(CONFIG_PINCTRL_SUNXI)	+= sunxi/
 obj-$(CONFIG_PINCTRL_UNIPHIER)	+= uniphier/
drivers/pinctrl/renesas/Kconfig +7 -0
index 8f994d8d76..b707d7549b 100644
@@ -127,3 +127,10 @@ config PINCTRL_PFC_R7S72100
 	  Support pin multiplexing control on Renesas RZ/A1 R7S72100 SoCs.
 
 endif
+
+config PINCTRL_RZN1
+	bool "Renesas RZ/N1 R906G032 pin control driver"
+	depends on ARCH_RZN1
+	default y if ARCH_RZN1
+	help
+	  Support pin multiplexing control on Renesas RZ/N1 R906G032 SoCs.
drivers/pinctrl/renesas/Makefile +1 -0
index 1198c86855..39b2f65f2e 100644
@@ -18,3 +18,4 @@ obj-$(CONFIG_PINCTRL_PFC_R8A77990) += pfc-r8a77990.o
 obj-$(CONFIG_PINCTRL_PFC_R8A77995) += pfc-r8a77995.o
 obj-$(CONFIG_PINCTRL_PFC_R8A779A0) += pfc-r8a779a0.o
 obj-$(CONFIG_PINCTRL_PFC_R7S72100) += pfc-r7s72100.o
+obj-$(CONFIG_PINCTRL_RZN1) += pinctrl-rzn1.o
drivers/pinctrl/renesas/pinctrl-rzn1.c new file +379 -0

379 lines not on this page · raw message

include/dt-bindings/pinctrl/rzn1-pinctrl.h new file +141 -0

141 lines not on this page · raw message

Signature · 1 line
2.25.1
#18 lore raw

PATCH v4 5/10 ram: cadence: add driver for Cadence EDAC

In reply to Ralph Siemsen

Driver for Cadence EDAC DDR controller, as found in the Renesas RZ/N1.

---

(no changes since v3)

Changes in v3:
- assorted small cleanups
- support version 1.0 silicon (previously #if 0...)

 drivers/ram/Kconfig             |   1 +
 drivers/ram/Makefile            |   2 +
 drivers/ram/cadence/Kconfig     |  12 +
 drivers/ram/cadence/Makefile    |   1 +
 drivers/ram/cadence/ddr_async.c | 311 ++++++++++++++++++++++++
 drivers/ram/cadence/ddr_ctrl.c  | 414 ++++++++++++++++++++++++++++++++
 drivers/ram/cadence/ddr_ctrl.h  | 175 ++++++++++++++
 7 files changed, 916 insertions(+)
 create mode 100644 drivers/ram/cadence/Kconfig
 create mode 100644 drivers/ram/cadence/Makefile
 create mode 100644 drivers/ram/cadence/ddr_async.c
 create mode 100644 drivers/ram/cadence/ddr_ctrl.c
 create mode 100644 drivers/ram/cadence/ddr_ctrl.h
drivers/ram/Kconfig +1 -0
index e085119963..2b6d8f1c7b 100644
@@ -108,6 +108,7 @@ config IMXRT_SDRAM
 	  This driver is for the sdram memory interface with the SEMC.
 
 source "drivers/ram/aspeed/Kconfig"
+source "drivers/ram/cadence/Kconfig"
 source "drivers/ram/rockchip/Kconfig"
 source "drivers/ram/sifive/Kconfig"
 source "drivers/ram/stm32mp1/Kconfig"
drivers/ram/Makefile +2 -0
index 83948e2c43..e2d5e730d1 100644
@@ -22,3 +22,5 @@ obj-$(CONFIG_IMXRT_SDRAM) += imxrt_sdram.o
 obj-$(CONFIG_RAM_SIFIVE) += sifive/
 
 obj-$(CONFIG_ARCH_OCTEON) += octeon/
+
+obj-$(CONFIG_CADENCE_DDR_CTRL) += cadence/
drivers/ram/cadence/Kconfig new file +12 -0
new file mode 100644
index 0000000000..2d5469cb8e
@@ -0,0 +1,12 @@
+if RAM || SPL_RAM
+
+config CADENCE_DDR_CTRL
+	bool "Enable Cadence DDR controller"
+	depends on DM
+	help
+	  Enable support for Cadence DDR controller, as found on
+	  the Renesas RZ/N1 SoC. This controller has a large number
+	  of registers which need to be programmed, mostly using values
+	  obtained from Denali SOMA files via a TCL script.
+
+endif
drivers/ram/cadence/Makefile new file +1 -0
new file mode 100644
index 0000000000..16c7fe8488
@@ -0,0 +1 @@
+obj-$(CONFIG_CADENCE_DDR_CTRL) += ddr_async.o ddr_ctrl.o
drivers/ram/cadence/ddr_async.c new file +311 -0

311 lines not on this page · raw message

drivers/ram/cadence/ddr_ctrl.c new file +414 -0

414 lines not on this page · raw message

drivers/ram/cadence/ddr_ctrl.h new file +175 -0

175 lines not on this page · raw message

Signature · 1 line
2.25.1
#19 lore raw

Re: [PATCH v4 05/10] ram: cadence: add driver for Cadence EDAC

On 3/8/23 21:26, Ralph Siemsen wrote:

[...]

drivers/ram/cadence/ddr_async.c line 67

Quoted 8 lines
drivers/ram/cadence/ddr_async.c new file +8 -0
+#define FUNCCTRL	0x00
+#define  FUNCCTRL_MASKSDLOFS	(0x18 << 16)
+#define  FUNCCTRL_DVDDQ_1_5V	(1 << 8)
+#define  FUNCCTRL_RESET_N	(1 << 0)
+#define DLLCTRL		0x04
+#define  DLLCTRL_ASDLLOCK	(1 << 26)
+#define  DLLCTRL_MFSL_500MHz	(2 << 1)
+#define  DLLCTRL_MDLLSTBY	(1 << 0)

Use BIT() macro where applicable.

Quoted 45 lines
drivers/ram/cadence/ddr_async.c new file +45 -0
+#define ZQCALCTRL	0x08
+#define  ZQCALCTRL_ZQCALEND	(1 << 30)
+#define  ZQCALCTRL_ZQCALRSTB	(1 << 0)
+#define ZQODTCTRL	0x0c
+#define RDCTRL		0x10
+#define RDTMG		0x14
+#define FIFOINIT	0x18
+#define  FIFOINIT_RDPTINITEXE	(1 << 8)
+#define  FIFOINIT_WRPTINITEXE	(1 << 0)
+#define OUTCTRL		0x1c
+#define  OUTCTRL_ADCMDOE	(1 << 0)
+#define WLCTRL1		0x40
+#define  WLCTRL1_WLSTR		(1 << 24)
+#define DQCALOFS1	0xe8
+
+/* DDR PHY setup */
+void ddr_phy_init(struct cadence_ddr_info *priv, int ddr_type)
+{
+	u32 val;
+
+	/* Disable DDR Controller clock and FlexWAY connection */
+	clk_disable(&priv->hclk_ddrc);
+	clk_disable(&priv->clk_ddrc);
+
+	clk_rzn1_reset_state(&priv->hclk_ddrc, 0);
+	clk_rzn1_reset_state(&priv->clk_ddrc, 0);
+
+	/* Enable DDR Controller clock and FlexWAY connection */
+	clk_enable(&priv->clk_ddrc);
+	clk_enable(&priv->hclk_ddrc);
+
+	/* DDR PHY Soft reset assert */
+	ddrc_writel(FUNCCTRL_MASKSDLOFS | FUNCCTRL_DVDDQ_1_5V, FUNCCTRL);
+
+	clk_rzn1_reset_state(&priv->hclk_ddrc, 1);
+	clk_rzn1_reset_state(&priv->clk_ddrc, 1);
+
+	/* DDR PHY setup */
+	phy_writel(DLLCTRL_MFSL_500MHz | DLLCTRL_MDLLSTBY, DLLCTRL);
+	phy_writel(0x00000182, ZQCALCTRL);
+	if (ddr_type == RZN1_DDR3_DUAL_BANK)
+		phy_writel(0xAB330031, ZQODTCTRL);
+	else if (ddr_type == RZN1_DDR3_SINGLE_BANK)
+		phy_writel(0xAB320051, ZQODTCTRL);
+	else /* DDR2 */

drivers/ram/cadence/ddr_async.c line 122

Quoted 10 lines
drivers/ram/cadence/ddr_async.c new file +10 -0
+		phy_writel(0xAB330071, ZQODTCTRL);
+	phy_writel(0xB545B544, RDCTRL);
+	phy_writel(0x000000B0, RDTMG);
+	phy_writel(0x020A0806, OUTCTRL);
+	if (ddr_type == RZN1_DDR3_DUAL_BANK)
+		phy_writel(0x80005556, WLCTRL1);
+	else
+		phy_writel(0x80005C5D, WLCTRL1);
+	phy_writel(0x00000101, FIFOINIT);
+	phy_writel(0x00004545, DQCALOFS1);

Is there any macro which defines those magic bits in magic numbers ? If so, please use them.

Quoted 32 lines
drivers/ram/cadence/ddr_async.c new file +32 -0
+	/* Step 9 MDLL reset release */
+	val = phy_readl(DLLCTRL);
+	val &= ~DLLCTRL_MDLLSTBY;
+	phy_writel(val, DLLCTRL);
+
+	/* Step 12 Soft reset release */
+	val = phy_readl(FUNCCTRL);
+	val |= FUNCCTRL_RESET_N;
+	phy_writel(val, FUNCCTRL);
+
+	/* Step 13 FIFO pointer initialize */
+	phy_writel(FIFOINIT_RDPTINITEXE | FIFOINIT_WRPTINITEXE, FIFOINIT);
+
+	/* Step 14 Execute ZQ Calibration */
+	val = phy_readl(ZQCALCTRL);
+	val |= ZQCALCTRL_ZQCALRSTB;
+	phy_writel(val, ZQCALCTRL);
+
+	/* Step 15 Wait for 200us or more, or wait for DFIINITCOMPLETE to be "1" */
+	while (!(phy_readl(DLLCTRL) & DLLCTRL_ASDLLOCK))
+		;
+	while (!(phy_readl(ZQCALCTRL) & ZQCALCTRL_ZQCALEND))
+		;
+
+	/* Step 16 Enable Address and Command output */
+	val = phy_readl(OUTCTRL);
+	val |= OUTCTRL_ADCMDOE;
+	phy_writel(val, OUTCTRL);
+
+	/* Step 17 Wait for 200us or more(from MRESETB=0) */
+	udelay(200);
+}

[...]

Quoted 29 lines
drivers/ram/cadence/ddr_async.c new file +29 -0
+int rzn1_dram_init(struct cadence_ddr_info *priv)
+{
+	u32 version;
+	u32 ddr_start_addr = 0;
+
+	ddr_phy_init(priv, RZN1_DDR3_SINGLE_BANK);
+
+	/*
+	 * Override DDR PHY Interface (DFI) related settings
+	 * DFI is the internal interface between the DDR controller and the DDR PHY.
+	 * These settings are specific to the board and can't be known by the settings
+	 * provided for each DDR model within the generated include.
+	 */
+	ddr_350_374_async[351 - 350] = 0x001e0000;
+	ddr_350_374_async[352 - 350] = 0x1e680000;
+	ddr_350_374_async[353 - 350] = 0x02000020;
+	ddr_350_374_async[354 - 350] = 0x02000200;
+	ddr_350_374_async[355 - 350] = 0x00000c30;
+	ddr_350_374_async[356 - 350] = 0x00009808;
+	ddr_350_374_async[357 - 350] = 0x020a0706;
+	ddr_350_374_async[372 - 350] = 0x01000000;
+
+	/*
+	 * On ES1.0 devices, the DDR start address that the DDR Controller sees
+	 * is the physical address of the DDR. However, later devices changed it
+	 * to be 0 in order to fix an issue with DDR out-of-range detection.
+	 */
+#define RZN1_SYSCTRL_REG_VERSION 412
+	regmap_read(priv->syscon, RZN1_SYSCTRL_REG_VERSION, &version);

drivers/ram/cadence/ddr_async.c line 222

Quoted 10 lines
drivers/ram/cadence/ddr_async.c new file +10 -0
+	if (version == 0x10)
+		ddr_start_addr = RZN1_V_DDR_BASE;
+
+	/* DDR Controller is always in ASYNC mode */
+	cdns_ddr_ctrl_init((void *)RZN1_DDR_BASE, 1,
+			   ddr_00_87_async, ddr_350_374_async,
+			   ddr_start_addr, CFG_SYS_SDRAM_SIZE,
+			   priv->enable_ecc, priv->enable_8bit);
+
+	rzn1_ddr3_single_bank((void *)RZN1_DDR_BASE);

Can you obtain the DRAM base from DT ?

Quoted 55 lines
drivers/ram/cadence/ddr_async.c new file +55 -0
+	cdns_ddr_set_diff_cs_delays((void *)RZN1_DDR_BASE, 2, 7, 2, 2);
+	cdns_ddr_set_same_cs_delays((void *)RZN1_DDR_BASE, 0, 7, 0, 0);
+	cdns_ddr_set_odt_times((void *)RZN1_DDR_BASE, 5, 6, 6, 0, 4);
+	cdns_ddr_ctrl_start((void *)RZN1_DDR_BASE);
+
+	ddr_phy_enable_wl(priv);
+
+	if (priv->enable_ecc) {
+		/*
+		 * Any read before a write will trigger an ECC un-correctable error,
+		 * causing a data abort. However, this is also true for any read with a
+		 * size less than the AXI bus width. So, the only sensible solution is
+		 * to write to all of DDR now and take the hit...
+		 */
+		memset((void *)RZN1_V_DDR_BASE, 0xff, CFG_SYS_SDRAM_SIZE);
+	}
+
+	return 0;
+}
+
+static int cadence_ddr_get_info(struct udevice *udev, struct ram_info *info)
+{
+	info->base = 0;
+	info->size = gd->ram_size;
+
+	return 0;
+}
+
+static struct ram_ops cadence_ddr_ops = {
+	.get_info = cadence_ddr_get_info,
+};
+
+static int cadence_ddr_probe(struct udevice *dev)
+{
+	struct cadence_ddr_info *priv = dev_get_priv(dev);
+	int ret;
+
+	priv->ddrc = dev_remap_addr_name(dev, "ddrc");
+	if (!priv->ddrc) {
+		dev_err(dev, "No reg property for Cadence DDR CTRL\n");
+		return -EINVAL;
+	}
+
+	priv->phy = dev_remap_addr_name(dev, "phy");
+	if (!priv->phy) {
+		dev_err(dev, "No reg property for Cadence DDR PHY\n");
+		return -EINVAL;
+	}
+
+	ret = clk_get_by_name(dev, "clk_ddrc", &priv->clk_ddrc);
+	if (ret) {
+		dev_err(dev, "No clock for Cadence DDR\n");
+		return ret;
+	}
+

drivers/ram/cadence/ddr_async.c line 287

Quoted 10 lines
drivers/ram/cadence/ddr_async.c new file +10 -0
+	ret = clk_get_by_name(dev, "hclk_ddrc", &priv->hclk_ddrc);
+	if (ret) {
+		dev_err(dev, "No HCLK for Cadence DDR\n");
+		return ret;
+	}
+
+	priv->syscon = syscon_regmap_lookup_by_phandle(dev, "syscon");
+	if (IS_ERR(priv->syscon)) {
+		dev_err(dev, "No syscon node found\n");
+		//return PTR_ERR(priv->syscon);

This shouldn't be commented out, right ?

Quoted 24 lines
drivers/ram/cadence/ddr_async.c new file +24 -0
+	}
+
+	priv->enable_ecc = dev_read_bool(dev, "enable-ecc");
+	priv->enable_8bit = dev_read_bool(dev, "enable-8bit");
+
+	rzn1_dram_init(priv);
+
+	return 0;
+}
+
+static const struct udevice_id cadence_ddr_ids[] = {
+	{ .compatible = "cadence,ddr-ctrl" },
+	{ }
+};
+
+U_BOOT_DRIVER(cadence_ddr) = {
+	.name		= "cadence_ddr",
+	.id		= UCLASS_RAM,
+	.of_match	= cadence_ddr_ids,
+	.ops		= &cadence_ddr_ops,
+	.probe		= cadence_ddr_probe,
+	.priv_auto	= sizeof(struct cadence_ddr_info),
+	.flags		= DM_FLAG_PRE_RELOC,
+};

[...]

#20 lore raw

Re: [PATCH v4 05/10] ram: cadence: add driver for Cadence EDAC

Quoted 4 lines · Marek Vasut

On 3/8/23 21:26, Ralph Siemsen wrote:

[...]

Quoted 10 lines

drivers/ram/cadence/ddr_async.c line 67

Quoted 8 lines
drivers/ram/cadence/ddr_async.c new file +8 -0
+#define FUNCCTRL	0x00
+#define  FUNCCTRL_MASKSDLOFS	(0x18 << 16)
+#define  FUNCCTRL_DVDDQ_1_5V	(1 << 8)
+#define  FUNCCTRL_RESET_N	(1 << 0)
+#define DLLCTRL		0x04
+#define  DLLCTRL_ASDLLOCK	(1 << 26)
+#define  DLLCTRL_MFSL_500MHz	(2 << 1)
+#define  DLLCTRL_MDLLSTBY	(1 << 0)

Use BIT() macro where applicable.

Will do.

Quoted 13 lines
Quoted 13 lines
drivers/ram/cadence/ddr_async.c new file +13 -0
+	/* DDR PHY setup */
+	phy_writel(DLLCTRL_MFSL_500MHz | DLLCTRL_MDLLSTBY, DLLCTRL);
+	phy_writel(0x00000182, ZQCALCTRL);
+	if (ddr_type == RZN1_DDR3_DUAL_BANK)
+		phy_writel(0xAB330031, ZQODTCTRL);
+	else if (ddr_type == RZN1_DDR3_SINGLE_BANK)
+		phy_writel(0xAB320051, ZQODTCTRL);
+	else /* DDR2 */
+		phy_writel(0xAB330071, ZQODTCTRL);
+	phy_writel(0xB545B544, RDCTRL);
+	phy_writel(0x000000B0, RDTMG);
+	phy_writel(0x020A0806, OUTCTRL);
+	if (ddr_type == RZN1_DDR3_DUAL_BANK)
Quoted 8 lines

drivers/ram/cadence/ddr_async.c line 122

Quoted 5 lines
drivers/ram/cadence/ddr_async.c new file +5 -0
+		phy_writel(0x80005556, WLCTRL1);
+	else
+		phy_writel(0x80005C5D, WLCTRL1);
+	phy_writel(0x00000101, FIFOINIT);
+	phy_writel(0x00004545, DQCALOFS1);

Is there any macro which defines those magic bits in magic numbers ? If so, please use them.

This init sequence came from the u-boot 2017 repo published by Renesas. There do not appear to be any macros to help with all these magic numbers.

Quoted 9 lines

drivers/ram/cadence/ddr_async.c line 222

Quoted 7 lines
drivers/ram/cadence/ddr_async.c new file +7 -0
+	/* DDR Controller is always in ASYNC mode */
+	cdns_ddr_ctrl_init((void *)RZN1_DDR_BASE, 1,
+			   ddr_00_87_async, ddr_350_374_async,
+			   ddr_start_addr, CFG_SYS_SDRAM_SIZE,
+			   priv->enable_ecc, priv->enable_8bit);
+
+	rzn1_ddr3_single_bank((void *)RZN1_DDR_BASE);

Can you obtain the DRAM base from DT ?

I'll check if it is possible.

Quoted 6 lines

drivers/ram/cadence/ddr_async.c line 287

Quoted 4 lines
drivers/ram/cadence/ddr_async.c new file +4 -0
+	priv->syscon = syscon_regmap_lookup_by_phandle(dev, "syscon");
+	if (IS_ERR(priv->syscon)) {
+		dev_err(dev, "No syscon node found\n");
+		//return PTR_ERR(priv->syscon);

This shouldn't be commented out, right ?

Does indeed look like an oversight. I'll fix it up, thanks for spotting!

Ralph

#21 lore raw

PATCH v4 6/10 dts: basic devicetree for Renesas RZ/N1 SoC

In reply to Ralph Siemsen

This is taken from Linux kernel 5.17, and contains just bare minimum
functionality: CPU, UART and system timer.

Additional functionality (from newer kernel versions) will be added later. Note that the Linux side is under active development.

---
The following changes were made, compared with Linux 5.17:

1) Add node for system controller registers. Declare it as syscon to provide a regmap interface.

2) In the clock controller node (renesas,r9a06g032-sysctrl), replace regs with regmap.

3) Add syscon-reset node, making use of the syscon regmap.

4) Add syscon phandle to ddrctrl. Used for checking h/w version.

5) Simplify the compatible string for all the UARTS, as per doc/device-tree-bindings/serial/snps-dw-apb-uart.txt

I could not find a way to avoid 1) and 2). Putting "syscon" in the compatible string for the clock controller leads to a catch-22, where the driver fails to initialize, and then boot hangs.

(no changes since v3)

Changes in v3:
- add syscon phandle to ddrctl
- simplify UART compatible strings

 arch/arm/dts/r9a06g032.dtsi                   | 226 ++++++++++++++++++
 include/dt-bindings/clock/r9a06g032-sysctrl.h | 148 ++++++++++++
 2 files changed, 374 insertions(+)
 create mode 100644 arch/arm/dts/r9a06g032.dtsi
 create mode 100644 include/dt-bindings/clock/r9a06g032-sysctrl.h
arch/arm/dts/r9a06g032.dtsi new file +226 -0
new file mode 100644
index 0000000000..e0ddffb074
@@ -0,0 +1,226 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Base Device Tree Source for the Renesas RZ/N1D (R9A06G032)
+ *
+ * Copyright (C) 2018 Renesas Electronics Europe Limited
+ *
+ */
+
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+#include <dt-bindings/clock/r9a06g032-sysctrl.h>
+
+/ {
+	compatible = "renesas,r9a06g032";
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	cpus {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		cpu@0 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a7";
+			reg = <0>;
+			clocks = <&sysctrl R9A06G032_CLK_A7MP>;
+		};
+
+		cpu@1 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a7";
+			reg = <1>;
+			clocks = <&sysctrl R9A06G032_CLK_A7MP>;
+			enable-method = "renesas,r9a06g032-smp";
+			cpu-release-addr = <0 0x4000c204>;
+		};
+	};
+
+	ext_jtag_clk: extjtagclk {
+		#clock-cells = <0>;
+		compatible = "fixed-clock";
+		clock-frequency = <0>;
+	};
+
+	ext_mclk: extmclk {
+		#clock-cells = <0>;
+		compatible = "fixed-clock";
+		clock-frequency = <40000000>;
+	};
+
+	ext_rgmii_ref: extrgmiiref {
+		#clock-cells = <0>;
+		compatible = "fixed-clock";
+		clock-frequency = <0>;
+	};
+
+	ext_rtc_clk: extrtcclk {
+		#clock-cells = <0>;
+		compatible = "fixed-clock";
+		clock-frequency = <0>;
+	};
+
+	soc {
+		compatible = "simple-bus";
+		#address-cells = <1>;
+		#size-cells = <1>;
+		interrupt-parent = <&gic>;
+		ranges;
+
+		plat_regs: system-controller@4000c000 {
+			compatible = "syscon";
+			reg = <0x4000c000 0x1000>;
+			u-boot,dm-pre-reloc;
+		};
+
+		sysctrl: clock {
+			compatible = "renesas,r9a06g032-sysctrl";
+			#clock-cells = <1>;
+			regmap = <&plat_regs>;
+			u-boot,dm-pre-reloc;
+
+			clocks = <&ext_mclk>, <&ext_rtc_clk>,
+					<&ext_jtag_clk>, <&ext_rgmii_ref>;
+			clock-names = "mclk", "rtc", "jtag", "rgmii_ref_ext";
+		};
+
+		ddrctrl: memory-controller@4000d000 {
+			compatible = "cadence,ddr-ctrl";
+			reg = <0x4000d000 0x1000>, <0x4000e000 0x100>;
+			reg-names = "ddrc", "phy";
+			interrupts = <GIC_SPI 76 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&sysctrl R9A06G032_CLK_DDRC>, <&sysctrl R9A06G032_HCLK_DDRC>;
+			clock-names = "clk_ddrc", "hclk_ddrc";
+			syscon = <&plat_regs>;
+			status = "disabled";
+		};
+
+		uart0: serial@40060000 {
+			compatible = "snps,dw-apb-uart";
+			reg = <0x40060000 0x400>;
+			interrupts = <GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>;
+			reg-shift = <2>;
+			reg-io-width = <4>;
+			clocks = <&sysctrl R9A06G032_CLK_UART0>, <&sysctrl R9A06G032_HCLK_UART0>;
+			clock-names = "baudclk", "apb_pclk";
+			status = "disabled";
+		};
+
+		uart1: serial@40061000 {
+			compatible = "snps,dw-apb-uart";
+			reg = <0x40061000 0x400>;
+			interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>;
+			reg-shift = <2>;
+			reg-io-width = <4>;
+			clocks = <&sysctrl R9A06G032_CLK_UART1>, <&sysctrl R9A06G032_HCLK_UART1>;
+			clock-names = "baudclk", "apb_pclk";
+			status = "disabled";
+		};
+
+		uart2: serial@40062000 {
+			compatible = "snps,dw-apb-uart";
+			reg = <0x40062000 0x400>;
+			interrupts = <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>;
+			reg-shift = <2>;
+			reg-io-width = <4>;
+			clocks = <&sysctrl R9A06G032_CLK_UART2>, <&sysctrl R9A06G032_HCLK_UART2>;
+			clock-names = "baudclk", "apb_pclk";
+			status = "disabled";
+		};
+
+		uart3: serial@50000000 {
+			compatible = "snps,dw-apb-uart";
+			reg = <0x50000000 0x400>;
+			interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
+			reg-shift = <2>;
+			reg-io-width = <4>;
+			clocks = <&sysctrl R9A06G032_CLK_UART3>, <&sysctrl R9A06G032_HCLK_UART3>;
+			clock-names = "baudclk", "apb_pclk";
+			status = "disabled";
+		};
+
+		uart4: serial@50001000 {
+			compatible = "snps,dw-apb-uart";
+			reg = <0x50001000 0x400>;
+			interrupts = <GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>;
+			reg-shift = <2>;
+			reg-io-width = <4>;
+			clocks = <&sysctrl R9A06G032_CLK_UART4>, <&sysctrl R9A06G032_HCLK_UART4>;
+			clock-names = "baudclk", "apb_pclk";
+			status = "disabled";
+		};
+
+		uart5: serial@50002000 {
+			compatible = "snps,dw-apb-uart";
+			reg = <0x50002000 0x400>;
+			interrupts = <GIC_SPI 88 IRQ_TYPE_LEVEL_HIGH>;
+			reg-shift = <2>;
+			reg-io-width = <4>;
+			clocks = <&sysctrl R9A06G032_CLK_UART5>, <&sysctrl R9A06G032_HCLK_UART5>;
+			clock-names = "baudclk", "apb_pclk";
+			status = "disabled";
+		};
+
+		uart6: serial@50003000 {
+			compatible = "snps,dw-apb-uart";
+			reg = <0x50003000 0x400>;
+			interrupts = <GIC_SPI 89 IRQ_TYPE_LEVEL_HIGH>;
+			reg-shift = <2>;
+			reg-io-width = <4>;
+			clocks = <&sysctrl R9A06G032_CLK_UART6>, <&sysctrl R9A06G032_HCLK_UART6>;
+			clock-names = "baudclk", "apb_pclk";
+			status = "disabled";
+		};
+
+		uart7: serial@50004000 {
+			compatible = "snps,dw-apb-uart";
+			reg = <0x50004000 0x400>;
+			interrupts = <GIC_SPI 90 IRQ_TYPE_LEVEL_HIGH>;
+			reg-shift = <2>;
+			reg-io-width = <4>;
+			clocks = <&sysctrl R9A06G032_CLK_UART7>, <&sysctrl R9A06G032_HCLK_UART7>;
+			clock-names = "baudclk", "apb_pclk";
+			status = "disabled";
+		};
+
+		pinctrl: pinctrl@40067000 {
+			compatible = "renesas,r9a06g032-pinctrl", "renesas,rzn1-pinctrl";
+			reg = <0x40067000 0x1000>, <0x51000000 0x480>;
+			clocks = <&sysctrl R9A06G032_HCLK_PINCONFIG>;
+			clock-names = "bus";
+			status = "disabled";
+		};
+
+		gic: interrupt-controller@44101000 {
+			compatible = "arm,gic-400", "arm,cortex-a7-gic";
+			interrupt-controller;
+			#interrupt-cells = <3>;
+			reg = <0x44101000 0x1000>, /* Distributer */
+			      <0x44102000 0x2000>, /* CPU interface */
+			      <0x44104000 0x2000>, /* Virt interface control */
+			      <0x44106000 0x2000>; /* Virt CPU interface */
+			interrupts =
+				<GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_HIGH)>;
+		};
+	};
+
+	timer {
+		compatible = "arm,cortex-a7-timer",
+			     "arm,armv7-timer";
+		interrupt-parent = <&gic>;
+		arm,cpu-registers-not-fw-configured;
+		always-on;
+		interrupts =
+			<GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>,
+			<GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>,
+			<GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>,
+			<GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>;
+	};
+
+	reboot {
+		compatible = "syscon-reboot";
+		regmap = <&plat_regs>;
+		offset = <0x198>;       /* sysctrl.RSTEN */
+		mask = <0x40>;          /* bit 6 = SWRST_REQ */
+		value = <0x40>;
+	};
+};
include/dt-bindings/clock/r9a06g032-sysctrl.h new file +148 -0

148 lines not on this page · raw message

Signature · 1 line
2.25.1
#22 lore raw

Re: [PATCH v4 06/10] dts: basic devicetree for Renesas RZ/N1 SoC

Quoted 2 lines · Ralph Siemsen

This is taken from Linux kernel 5.17, and contains just bare minimum
functionality: CPU, UART and system timer.

Why Linux 5.17 and not e.g. 6.2 or 6.1 LTS ?

Quoted 15 lines

Additional functionality (from newer kernel versions) will be added later. Note that the Linux side is under active development.

---
The following changes were made, compared with Linux 5.17:

1) Add node for system controller registers. Declare it as syscon to provide a regmap interface.

2) In the clock controller node (renesas,r9a06g032-sysctrl), replace regs with regmap.

3) Add syscon-reset node, making use of the syscon regmap.

Quoted 8 lines

4) Add syscon phandle to ddrctrl. Used for checking h/w version.

5) Simplify the compatible string for all the UARTS, as per doc/device-tree-bindings/serial/snps-dw-apb-uart.txt

I could not find a way to avoid 1) and 2). Putting "syscon" in the compatible string for the clock controller leads to a catch-22, where the driver fails to initialize, and then boot hangs.

Can you extract all the changes to arch/arm/dts/r9a06g032-u-boot.dtsi and include that u-boot dtsi in your board DT, so the arch/arm/dts/r9a06g032.dtsi can be synchronized with Linux with ease due to no changes in it ?

#23 lore raw

Re: [PATCH v4 06/10] dts: basic devicetree for Renesas RZ/N1 SoC

Quoted 5 lines · Marek Vasut
Quoted 2 lines · Ralph Siemsen

This is taken from Linux kernel 5.17, and contains just bare minimum
functionality: CPU, UART and system timer.

Why Linux 5.17 and not e.g. 6.2 or 6.1 LTS ?

It was the current version at the time when this work was started. I fully intend to update it, especially now that much of the RZ/N1 support has landed in mainline.

Quoted 1 line

Can you extract all the changes to arch/arm/dts/r9a06g032-u-boot.dtsi and include that u-boot dtsi in your board DT, so the arch/arm/dts/r9a06g032.dtsi can be synchronized with Linux with ease due to no changes in it ?

I'll see if I can make that work.

Ralph

#24 lore raw

Re: [PATCH v4 06/10] dts: basic devicetree for Renesas RZ/N1 SoC

Quoted 8 lines · Ralph Siemsen
Quoted 5 lines · Marek Vasut
Quoted 2 lines · Ralph Siemsen

This is taken from Linux kernel 5.17, and contains just bare minimum
functionality: CPU, UART and system timer.

Why Linux 5.17 and not e.g. 6.2 or 6.1 LTS ?

It was the current version at the time when this work was started. I fully intend to update it, especially now that much of the RZ/N1 support has landed in mainline.

Thank you

Quoted 3 lines
Quoted 1 line

Can you extract all the changes to arch/arm/dts/r9a06g032-u-boot.dtsi and include that u-boot dtsi in your board DT, so the arch/arm/dts/r9a06g032.dtsi can be synchronized with Linux with ease due to no changes in it ?

I'll see if I can make that work.

That should be really easy, basically just move the diff between Linux .dtsi and this .dtsi into -u-boot.dtsi and that's just about it.

#25 lore raw

PATCH v4 7/10 ARM: rzn1: basic support for Renesas RZ/N1 SoC

In reply to Ralph Siemsen

The RZ/N1 is a family of SoC devics from Renesas, featuring:

* ARM Cortex-A7 CPU (single/dual core) and/or Cortex-M3
* Integrated SRAM up to 6MB
* Integrated gigabit ethernet switch
* Optional DDR2/3 controller
* I2C, SPI, UART, NAND, QSPI, SDIO, USB, CAN, RTC, LCD

Add basic support in the form of ARCH_RZN1 symbol.

---

(no changes since v1)

 arch/arm/Kconfig              | 17 +++++++++++++++++
 arch/arm/Makefile             |  1 +
 arch/arm/mach-rzn1/Kconfig    | 18 ++++++++++++++++++
 arch/arm/mach-rzn1/Makefile   |  3 +++
 arch/arm/mach-rzn1/cpu_info.c | 19 +++++++++++++++++++
 5 files changed, 58 insertions(+)
 create mode 100644 arch/arm/mach-rzn1/Kconfig
 create mode 100644 arch/arm/mach-rzn1/Makefile
 create mode 100644 arch/arm/mach-rzn1/cpu_info.c
arch/arm/Kconfig +17 -0
index bd7fffcce0..8e2a30f852 100644
@@ -1031,6 +1031,21 @@ config ARCH_RMOBILE
 	imply SYS_THUMB_BUILD
 	imply ARCH_MISC_INIT if DISPLAY_CPUINFO
 
+config ARCH_RZN1
+	bool "Reneasa RZ/N1 SoC"
+	select CLK
+	select CLK_RENESAS
+	select CLK_R9A06G032
+	select DM
+	select DM_ETH
+	select DM_SERIAL
+	select PINCTRL
+	select PINCONF
+	select REGMAP
+	select SYSRESET
+	select SYSRESET_SYSCON
+	imply CMD_DM
+
 config ARCH_SNAPDRAGON
 	bool "Qualcomm Snapdragon SoCs"
 	select ARM64
@@ -2207,6 +2222,8 @@ source "arch/arm/mach-owl/Kconfig"
 
 source "arch/arm/mach-rmobile/Kconfig"
 
+source "arch/arm/mach-rzn1/Kconfig"
+
 source "arch/arm/mach-meson/Kconfig"
 
 source "arch/arm/mach-mediatek/Kconfig"
arch/arm/Makefile +1 -0
index ac602aed9c..1ec95a87e1 100644
@@ -76,6 +76,7 @@ machine-$(CONFIG_ARCH_ORION5X)		+= orion5x
 machine-$(CONFIG_ARCH_OWL)		+= owl
 machine-$(CONFIG_ARCH_RMOBILE)		+= rmobile
 machine-$(CONFIG_ARCH_ROCKCHIP)		+= rockchip
+machine-$(CONFIG_ARCH_RZN1)		+= rzn1
 machine-$(CONFIG_ARCH_S5PC1XX)		+= s5pc1xx
 machine-$(CONFIG_ARCH_SNAPDRAGON)	+= snapdragon
 machine-$(CONFIG_ARCH_SOCFPGA)		+= socfpga
arch/arm/mach-rzn1/Kconfig new file +18 -0
new file mode 100644
index 0000000000..707895874d
@@ -0,0 +1,18 @@
+if ARCH_RZN1
+
+choice
+	prompt "Target Renesas RZ/N1 SoC select"
+	default RZN1
+
+config RZN1
+	bool "Renesas ARM SoCs RZ/N1 (32bit)"
+	select CPU_V7A
+	select ARMV7_SET_CORTEX_SMPEN if !SPL
+	select SPL_ARMV7_SET_CORTEX_SMPEN if SPL
+
+endchoice
+
+config SYS_SOC
+	default "rzn1"
+
+endif
arch/arm/mach-rzn1/Makefile new file +3 -0
new file mode 100644
index 0000000000..b20f845c0f
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0+
+
+obj-y = cpu_info.o
arch/arm/mach-rzn1/cpu_info.c new file +19 -0
new file mode 100644
index 0000000000..37c2492b51
@@ -0,0 +1,19 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+#include <common.h>
+#include <cpu_func.h>
+
+#if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF)
+void enable_caches(void)
+{
+	dcache_enable();
+}
+#endif
+
+#ifdef CONFIG_DISPLAY_CPUINFO
+int print_cpuinfo(void)
+{
+	printf("CPU: Renesas Electronics RZ/N1\n");
+	return 0;
+}
+#endif
Signature · 1 line
2.25.1
#26 lore raw

Re: [PATCH v4 07/10] ARM: rzn1: basic support for Renesas RZ/N1 SoC

On 3/8/23 21:26, Ralph Siemsen wrote:

[...]

arch/arm/Kconfig config ARCH_RMOBILE · line 1038

Quoted 10 lines

+++ b/arch/arm/Kconfig

arch/arm/Kconfig +5 -0
@@ -1031,6 +1031,21 @@ config ARCH_RMOBILE
  	imply SYS_THUMB_BUILD
  	imply ARCH_MISC_INIT if DISPLAY_CPUINFO
 
+config ARCH_RZN1
+	bool "Reneasa RZ/N1 SoC"
+	select CLK
+	select CLK_RENESAS
+	select CLK_R9A06G032

Does 'select CLK_R9A06G032' automatically activate the dependencies like 'CLK_RENESAS' too ?

Quoted 14 lines
arch/arm/Kconfig +10 -0
+	select DM
+	select DM_ETH
+	select DM_SERIAL
+	select PINCTRL
+	select PINCONF
+	select REGMAP
+	select SYSRESET
+	select SYSRESET_SYSCON
+	imply CMD_DM
+
  config ARCH_SNAPDRAGON
  	bool "Qualcomm Snapdragon SoCs"
  	select ARM64

arch/arm/Kconfig source "arch/arm/mach-owl/Kconfig" · line 2225

Quoted 4 lines
arch/arm/Kconfig +1 -0
@@ -2207,6 +2222,8 @@ source "arch/arm/mach-owl/Kconfig"
 
  source "arch/arm/mach-rmobile/Kconfig"
 
+source "arch/arm/mach-rzn1/Kconfig"

Should this be in mach-rmobile (which, maybe, should be renamed to mach-renesas) ?

[...]

Quoted 6 lines
arch/arm/mach-rzn1/cpu_info.c new file +0 -0
new file mode 100644
index 0000000000..37c2492b51

arch/arm/mach-rzn1/cpu_info.c line 8

Quoted 8 lines
arch/arm/mach-rzn1/cpu_info.c new file +8 -0
@@ -0,0 +1,19 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+#include <common.h>
+#include <cpu_func.h>
+
+#if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF)
+void enable_caches(void)
+{

Why not enable icache with icache_enable() too ?

Quoted 11 lines
arch/arm/mach-rzn1/cpu_info.c new file +11 -0
+	dcache_enable();
+}
+#endif
+
+#ifdef CONFIG_DISPLAY_CPUINFO
+int print_cpuinfo(void)
+{
+	printf("CPU: Renesas Electronics RZ/N1\n");
+	return 0;
+}
+#endif
#27 lore raw

Re: [PATCH v4 07/10] ARM: rzn1: basic support for Renesas RZ/N1 SoC

Quoted 4 lines · Marek Vasut

On 3/8/23 21:26, Ralph Siemsen wrote:

[...]

Quoted 11 lines

arch/arm/Kconfig config ARCH_RMOBILE · line 1037

Quoted 9 lines

+++ b/arch/arm/Kconfig

arch/arm/Kconfig +5 -0
@@ -1031,6 +1031,21 @@ config ARCH_RMOBILE
 	imply SYS_THUMB_BUILD
 	imply ARCH_MISC_INIT if DISPLAY_CPUINFO
+config ARCH_RZN1
+	bool "Reneasa RZ/N1 SoC"
+	select CLK
+	select CLK_RENESAS
+	select CLK_R9A06G032

Does 'select CLK_R9A06G032' automatically activate the dependencies like 'CLK_RENESAS' too ?

Do you mean things like CLK_RCAR_CPG_LIB for example?

The new clock driver has no dependencies (except perhaps ARCH_RZN1). Since this clock driver is essential to boot, I figured it was best to select it in Kconfig, rather than require each board defconfig to specify the same options.

If there is a better/preferred approach, I will implement it.

Quoted 11 lines
Quoted 11 lines
arch/arm/Kconfig +10 -0
+	select DM
+	select DM_ETH
+	select DM_SERIAL
+	select PINCTRL
+	select PINCONF
+	select REGMAP
+	select SYSRESET
+	select SYSRESET_SYSCON
+	imply CMD_DM
+
Quoted 8 lines

arch/arm/Kconfig source "arch/arm/mach-owl/Kconfig" · line 2223

Quoted 6 lines
arch/arm/Kconfig +1 -0
 config ARCH_SNAPDRAGON
 	bool "Qualcomm Snapdragon SoCs"
 	select ARM64
@@ -2207,6 +2222,8 @@ source "arch/arm/mach-owl/Kconfig"
 source "arch/arm/mach-rmobile/Kconfig"
+source "arch/arm/mach-rzn1/Kconfig"

Should this be in mach-rmobile (which, maybe, should be renamed to mach-renesas) ?

I vaguely recall that I discussed this with someone (possibly you), likely on IRC. And I think the conclusion was there was a significant enough difference (possibly Cortex-A7 versus A9?).

I don't have a strong preference, if moving to mach-rmobile makes sense, let me know and I can give it a go.

Quoted 5 lines

arch/arm/mach-rzn1/cpu_info.c line 8

Quoted 3 lines
arch/arm/mach-rzn1/cpu_info.c new file +3 -0
+#if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF)
+void enable_caches(void)
+{

Why not enable icache with icache_enable() too ?

The I-cache is enabled quite early in arch/arm/cpu/armv7/start.S

Ralph

#28 lore raw

Re: [PATCH v4 07/10] ARM: rzn1: basic support for Renesas RZ/N1 SoC

Quoted 17 lines · Ralph Siemsen
Quoted 4 lines · Marek Vasut

On 3/8/23 21:26, Ralph Siemsen wrote:

[...]

Quoted 11 lines
Quoted 9 lines

+++ b/arch/arm/Kconfig

(quoted diff) +0 -0
@@ -1031,6 +1031,21 @@ config ARCH_RMOBILE

     imply SYS_THUMB_BUILD
     imply ARCH_MISC_INIT if DISPLAY_CPUINFO
+config ARCH_RZN1
+    bool "Reneasa RZ/N1 SoC"
+    select CLK
+    select CLK_RENESAS
+    select CLK_R9A06G032

Does 'select CLK_R9A06G032' automatically activate the dependencies like 'CLK_RENESAS' too ?

Quoted 5 lines

Do you mean things like CLK_RCAR_CPG_LIB for example?

The new clock driver has no dependencies (except perhaps ARCH_RZN1). Since this clock driver is essential to boot, I figured it was best to select it in Kconfig, rather than require each board defconfig to specify the same options.

If there is a better/preferred approach, I will implement it.

I mean, if you drop 'CLK' and 'CLK_RENESAS' from this list, do they still get selected because 'CLK_R8A06G032' is in this list ? If yes, then drop them from this list, else keep them.

Quoted 19 lines
Quoted 10 lines
Quoted 10 lines

+    select DM
+    select DM_ETH
+    select DM_SERIAL
+    select PINCTRL
+    select PINCONF
+    select REGMAP
+    select SYSRESET
+    select SYSRESET_SYSCON
+    imply CMD_DM
+

Quoted 8 lines
Quoted 6 lines

 config ARCH_SNAPDRAGON
     bool "Qualcomm Snapdragon SoCs"
     select ARM64

(quoted diff) +0 -0
@@ -2207,6 +2222,8 @@ source "arch/arm/mach-owl/Kconfig"

 source "arch/arm/mach-rmobile/Kconfig"
+source "arch/arm/mach-rzn1/Kconfig"

Should this be in mach-rmobile (which, maybe, should be renamed to mach-renesas) ?

Quoted 3 lines

I vaguely recall that I discussed this with someone (possibly you), likely on IRC. And I think the conclusion was there was a significant enough difference (possibly Cortex-A7 versus A9?).

I don't have a strong preference, if moving to mach-rmobile makes sense, let me know and I can give it a go.

I think it does make sense to keep all the renesas stuff in mach-rmobile . We can rename that to mach-renesas in some subsequent patch.

Quoted 7 lines
Quoted 5 lines

arch/arm/mach-rzn1/cpu_info.c line 8

Quoted 3 lines
arch/arm/mach-rzn1/cpu_info.c new file +3 -0
+#if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF)
+void enable_caches(void)
+{

Why not enable icache with icache_enable() too ?

The I-cache is enabled quite early in arch/arm/cpu/armv7/start.S

Add a comment please.

#29 lore raw

Re: [PATCH v4 07/10] ARM: rzn1: basic support for Renesas RZ/N1 SoC

Quoted 1 line · Marek Vasut

I mean, if you drop 'CLK' and 'CLK_RENESAS' from this list, do they still get selected because 'CLK_R8A06G032' is in this list ? If yes, then drop them from this list, else keep them.

If I drop the first two, I get some kconfig warnings:

WARNING: unmet direct dependencies detected for CLK_R9A06G032
Depends on [n]: CLK_RENESAS [=n]
Selected by [y]:
- ARCH_RZN1 [=y] && <choice>

And there is no output on the UART.

Quoted 3 lines
Quoted 1 line

I don't have a strong preference, if moving to mach-rmobile makes sense, let me know and I can give it a go.

I think it does make sense to keep all the renesas stuff in mach-rmobile . We can rename that to mach-renesas in some subsequent patch.

Okay, I will try moving it. Does this also then mean I should abandon ARCH_RZN1 in favour of ARCH_RMOBILE? This could be more challenging...

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Why not enable icache with icache_enable() too ?

The I-cache is enabled quite early in arch/arm/cpu/armv7/start.S

Add a comment please.

Done!

Ralph

#30 lore raw

Re: [PATCH v4 07/10] ARM: rzn1: basic support for Renesas RZ/N1 SoC

Quoted 11 lines · Ralph Siemsen
Quoted 1 line · Marek Vasut

I mean, if you drop 'CLK' and 'CLK_RENESAS' from this list, do they still get selected because 'CLK_R8A06G032' is in this list ? If yes, then drop them from this list, else keep them.

If I drop the first two, I get some kconfig warnings:

WARNING: unmet direct dependencies detected for CLK_R9A06G032
  Depends on [n]: CLK_RENESAS [=n]
  Selected by [y]:
  - ARCH_RZN1 [=y] && <choice>

And there is no output on the UART.

Aha, so one has to list all of them deps. In that case, no change needed here.

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

I don't have a strong preference, if moving to mach-rmobile makes sense, let me know and I can give it a go.

I think it does make sense to keep all the renesas stuff in mach-rmobile . We can rename that to mach-renesas in some subsequent patch.

Okay, I will try moving it. Does this also then mean I should abandon ARCH_RZN1 in favour of ARCH_RMOBILE? This could be more challenging...

I think so, RZA1 is also not rmobile and I think it has its own RZA1 thing already, see:
arch/arm/mach-rmobile/Kconfig:config RZA1

So in your case, it would be RZN1 , just like that.

#31 lore raw

PATCH v4 8/10 board: schneider: add RZN1 board support

In reply to Ralph Siemsen

Add support for Schneider Electronics RZ/N1D and RZ/N1S boards, which are based on the Reneasas RZ/N1 SoC devices.

The intention is to support both boards using a single defconfig, and to handle the differences at runtime.

---

Changes in v4:
- add binman support via r9a06g032-rzn1-snarc-u-boot.dtsi

Changes in v3:
- rename board LCES to rzn1-snarc
- move CONFIG_SYS_NS16550_MEM32 to Kconfig
- define CFG_SYS_INIT_RAM_{ADDR,SIZE}
- removed debug uart settings from defconfig

 arch/arm/dts/r9a06g032-rzn1-snarc-u-boot.dtsi |  23 +
 arch/arm/dts/r9a06g032-rzn1-snarc.dts         |  51 +++
 arch/arm/mach-rzn1/Kconfig                    |  14 +
 board/schneider/rzn1-snarc/Kconfig            |  18 +
 board/schneider/rzn1-snarc/Makefile           |   3 +
 board/schneider/rzn1-snarc/ddr_timing.c       | 140 ++++++
 .../jedec_ddr3_2g_x16_1333h_500_cl8.h         | 399 ++++++++++++++++++
 board/schneider/rzn1-snarc/rzn1.c             |  39 ++
 configs/rzn1_snarc_defconfig                  |  21 +
 include/configs/rzn1-snarc.h                  |  17 +
 10 files changed, 725 insertions(+)
 create mode 100644 arch/arm/dts/r9a06g032-rzn1-snarc-u-boot.dtsi
 create mode 100644 arch/arm/dts/r9a06g032-rzn1-snarc.dts
 create mode 100644 board/schneider/rzn1-snarc/Kconfig
 create mode 100644 board/schneider/rzn1-snarc/Makefile
 create mode 100644 board/schneider/rzn1-snarc/ddr_timing.c
 create mode 100644 board/schneider/rzn1-snarc/jedec_ddr3_2g_x16_1333h_500_cl8.h
 create mode 100644 board/schneider/rzn1-snarc/rzn1.c
 create mode 100644 configs/rzn1_snarc_defconfig
 create mode 100644 include/configs/rzn1-snarc.h
arch/arm/dts/r9a06g032-rzn1-snarc-u-boot.dtsi new file +23 -0
new file mode 100644
index 0000000000..794e711103
@@ -0,0 +1,23 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Configuration file for binman
+ *
+ * After building u-boot, can generate the SPKG output by running:
+ * tools/binman/binman build -d arch/arm/dts/r9a06g032-rzn1-snarc.dtb -O <outdir>
+ */
+
+#include <config.h>
+
+/ {
+	binman: binman {
+	};
+};
+
+&binman {
+	mkimage {
+		filename = "u-boot.bin.spkg";
+		args = "-n board/schneider/rzn1-snarc/spkgimage.cfg -T spkgimage -a 0x20040000 -e 0x20040000";
+		u-boot {
+		};
+	};
+};
arch/arm/dts/r9a06g032-rzn1-snarc.dts new file +51 -0

51 lines not on this page · raw message

arch/arm/mach-rzn1/Kconfig +14 -0
index 707895874d..4b13afbb32 100644
@@ -15,4 +15,18 @@ endchoice
 config SYS_SOC
 	default "rzn1"
 
+choice
+	prompt "Board select"
+	default TARGET_SCHNEIDER_RZN1
+
+config TARGET_SCHNEIDER_RZN1
+	bool "Schneider RZN1 board"
+	help
+	  Support the Schneider RZN1D and RZN1S boards, which are based
+	  on the Renesas RZ/N1 SoC.
+
+endchoice
+
+source "board/schneider/rzn1-snarc/Kconfig"
+
 endif
board/schneider/rzn1-snarc/Kconfig new file +18 -0
new file mode 100644
index 0000000000..bb6d394077
@@ -0,0 +1,18 @@
+if TARGET_SCHNEIDER_RZN1
+
+config TEXT_BASE
+	default 0x20040000 if ARCH_RZN1
+
+config SYS_MONITOR_LEN
+	default 524288 if ARCH_RZN1
+
+config SYS_BOARD
+	default "rzn1-snarc"
+
+config SYS_VENDOR
+	default "schneider"
+
+config SYS_CONFIG_NAME
+	default "rzn1-snarc"
+
+endif
board/schneider/rzn1-snarc/Makefile new file +3 -0
new file mode 100644
index 0000000000..95c151898b
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier:	GPL-2.0+
+
+obj-y	:= rzn1.o ddr_timing.o
board/schneider/rzn1-snarc/ddr_timing.c new file +140 -0

140 lines not on this page · raw message

board/schneider/rzn1-snarc/jedec_ddr3_2g_x16_1333h_500_cl8.h new file +399 -0

399 lines not on this page · raw message

board/schneider/rzn1-snarc/rzn1.c new file +39 -0
new file mode 100644
index 0000000000..a6cb21822f
@@ -0,0 +1,39 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+#include <common.h>
+#include <dm.h>
+#include <asm/global_data.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int board_init(void)
+{
+	gd->bd->bi_boot_params = CFG_SYS_SDRAM_BASE + 0x100;
+
+	return 0;
+}
+
+int dram_init(void)
+{
+	struct udevice *dev;
+	int err;
+
+	/* This will end up calling cadence_ddr_probe() */
+	err = uclass_get_device(UCLASS_RAM, 0, &dev);
+	if (err) {
+		debug("DRAM init failed: %d\n", err);
+		return err;
+	}
+
+	if (fdtdec_setup_mem_size_base() != 0)
+		return -EINVAL;
+
+	return 0;
+}
+
+int dram_init_banksize(void)
+{
+	fdtdec_setup_memory_banksize();
+
+	return 0;
+}
configs/rzn1_snarc_defconfig new file +21 -0
new file mode 100644
index 0000000000..f0df13bcd9
@@ -0,0 +1,21 @@
+CONFIG_ARM=y
+CONFIG_SYS_ARCH_TIMER=y
+CONFIG_SYS_THUMB_BUILD=y
+CONFIG_ARCH_RZN1=y
+CONFIG_SYS_MALLOC_LEN=0xb0000
+CONFIG_SYS_MALLOC_F_LEN=0x800
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_DEFAULT_DEVICE_TREE="r9a06g032-rzn1-snarc"
+CONFIG_SYS_LOAD_ADDR=0x80008000
+CONFIG_SYS_MEMTEST_START=0x80000000
+CONFIG_SYS_MEMTEST_END=0x8fffffff
+CONFIG_CMD_MEMTEST=y
+CONFIG_SYS_ALT_MEMTEST=y
+# CONFIG_SYS_ALT_MEMTEST_BITFLIP is not set
+CONFIG_CMD_CLK=y
+CONFIG_OF_CONTROL=y
+CONFIG_RAM=y
+CONFIG_CADENCE_DDR_CTRL=y
+CONFIG_SYS_NS16550=y
+CONFIG_SYS_NS16550_MEM32=y
+# CONFIG_EFI_LOADER is not set
include/configs/rzn1-snarc.h new file +17 -0
new file mode 100644
index 0000000000..b97cb48eaa
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Configuration settings for the Schneider RZ/N1 board
+ */
+
+#ifndef __RZN1_H
+#define __RZN1_H
+
+/* Internal RAM */
+#define CFG_SYS_INIT_RAM_ADDR	0x20000000
+#define CFG_SYS_INIT_RAM_SIZE	(1 * 1024 * 1024)
+
+/* DDR */
+#define CFG_SYS_SDRAM_BASE	0x80000000
+#define CFG_SYS_SDRAM_SIZE	(256 * 1024 * 1024)
+
+#endif	/* __RZN1_H */
Signature · 1 line
2.25.1
#32 lore raw

Re: [PATCH v4 08/10] board: schneider: add RZN1 board support

On 3/8/23 21:26, Ralph Siemsen wrote:

[...]

board/schneider/rzn1-snarc/ddr_timing.c line 7

Quoted 13 lines
board/schneider/rzn1-snarc/ddr_timing.c new file +7 -0
new file mode 100644
index 0000000000..8bc3fe7be4
@@ -0,0 +1,140 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <asm/types.h>
+
+#include "jedec_ddr3_2g_x16_1333h_500_cl8.h"
+
+u32 ddr_00_87_async[] = {

Should this be 'static u32...' ?

Quoted 10 lines
board/schneider/rzn1-snarc/ddr_timing.c new file +10 -0
+	DENALI_CTL_00_DATA,
+	DENALI_CTL_01_DATA,
+	DENALI_CTL_02_DATA,
+	DENALI_CTL_03_DATA,
+	DENALI_CTL_04_DATA,
+	DENALI_CTL_05_DATA,
+	DENALI_CTL_06_DATA,
+	DENALI_CTL_07_DATA,
+	DENALI_CTL_08_DATA,
+	DENALI_CTL_09_DATA,

[...]

Quoted 21 lines
board/schneider/rzn1-snarc/jedec_ddr3_2g_x16_1333h_500_cl8.h new file +15 -0
new file mode 100644
index 0000000000..5c55518bc1
@@ -0,0 +1,399 @@
+
+/* ****************************************************************
+ *        CADENCE                    Copyright (c) 2001-2011      *
+ *                                   Cadence Design Systems, Inc. *
+ *                                   All rights reserved.         *
+ *                                                                *
+ ******************************************************************
+ *  The values calculated from this script are meant to be        *
+ *  representative programmings.   The values may not reflect the *
+ *  actual required programming for production use.   Please      *
+ *  closely review all programmed values for technical accuracy   *
+ *  before use in production parts.                               *
+ ******************************************************************
+ *
+ *   Module:         regconfig.h

board/schneider/rzn1-snarc/jedec_ddr3_2g_x16_1333h_500_cl8.h line 25

Quoted 10 lines
board/schneider/rzn1-snarc/jedec_ddr3_2g_x16_1333h_500_cl8.h new file +10 -0
+ *   Documentation:  Register programming header file
+ *
+ ******************************************************************
+ ******************************************************************
+ * WARNING:  This file was automatically generated.  Manual
+ * editing may result in undetermined behavior.
+ ******************************************************************
+ ******************************************************************/
+
+#define               DENALI_CTL_00_DATA 0x00000600

You might want to run checkpatch --f --fix --fix-inplace on this to fix formatting , esp. use one space after #define and tab after the macro name. Note that diff -wdb will let you diff updates to this file while ignoring space changes.

Quoted 4 lines
board/schneider/rzn1-snarc/jedec_ddr3_2g_x16_1333h_500_cl8.h new file +4 -0
+#define               DENALI_CTL_01_DATA 0x00000000
+#define               DENALI_CTL_02_DATA 0x00000000
+#define               DENALI_CTL_03_DATA 0x00000000
+#define               DENALI_CTL_04_DATA 0x00000000

[...]

Quoted 31 lines

+++ b/board/schneider/rzn1-snarc/rzn1.c

board/schneider/rzn1-snarc/jedec_ddr3_2g_x16_1333h_500_cl8.h new file +29 -0
@@ -0,0 +1,39 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+#include <common.h>
+#include <dm.h>
+#include <asm/global_data.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int board_init(void)
+{
+	gd->bd->bi_boot_params = CFG_SYS_SDRAM_BASE + 0x100;
+
+	return 0;
+}
+
+int dram_init(void)
+{
+	struct udevice *dev;
+	int err;
+
+	/* This will end up calling cadence_ddr_probe() */
+	err = uclass_get_device(UCLASS_RAM, 0, &dev);
+	if (err) {
+		debug("DRAM init failed: %d\n", err);
+		return err;
+	}
+
+	if (fdtdec_setup_mem_size_base() != 0)
+		return -EINVAL;

board/schneider/rzn1-snarc/jedec_ddr3_2g_x16_1333h_500_cl8.h line 39

Quoted 10 lines
board/schneider/rzn1-snarc/jedec_ddr3_2g_x16_1333h_500_cl8.h new file +10 -0
+
+	return 0;
+}
+
+int dram_init_banksize(void)
+{
+	fdtdec_setup_memory_banksize();
+
+	return 0;
+}

I wonder how much of this should really be in arch/... since this is common to all machines with RZN1 . Maybe move it there instead ?

[...]

#33 lore raw

Re: [PATCH v4 08/10] board: schneider: add RZN1 board support

Quoted 16 lines · Marek Vasut

board/schneider/rzn1-snarc/ddr_timing.c line 7

Quoted 13 lines · Ralph Siemsen
board/schneider/rzn1-snarc/ddr_timing.c new file +7 -0
new file mode 100644
index 0000000000..8bc3fe7be4
@@ -0,0 +1,140 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <asm/types.h>
+
+#include "jedec_ddr3_2g_x16_1333h_500_cl8.h"
+
+u32 ddr_00_87_async[] = {

Should this be 'static u32...' ?

It should, but there is bit of kludge going on here. This table is used when starting the DDR controller, in drivers/ram/cadence/ddr_async.c

There are several other boards in u-boot already which appear to use the same (or a similar) DDR controller from Cadence. Some of these also use a similar kludge as I have done. Others instead put the DDR parameters into the device tree.

While using the devicetree is cleaner, it does increase the size of the DTB by quite a bit, which creates some additional challenges. Even more so when you need to support multiple DDR chips, each with their own configuration parameters.

So I opted for the low-tech approach, at least in this initial version.

Quoted 8 lines

board/schneider/rzn1-snarc/ddr_timing.c line 8

Quoted 1 line
board/schneider/rzn1-snarc/ddr_timing.c new file +1 -0
+#define               DENALI_CTL_00_DATA 0x00000600

You might want to run checkpatch --f --fix --fix-inplace on this to fix formatting , esp. use one space after #define and tab after the macro name. Note that diff -wdb will let you diff updates to this file while ignoring space changes.

board/schneider/rzn1-snarc/ddr_timing.c line 12

Quoted 4 lines
board/schneider/rzn1-snarc/ddr_timing.c new file +4 -0
+#define               DENALI_CTL_01_DATA 0x00000000
+#define               DENALI_CTL_02_DATA 0x00000000
+#define               DENALI_CTL_03_DATA 0x00000000
+#define               DENALI_CTL_04_DATA 0x00000000

I had also considered eliminating the header file entirely, and just putting the values directly into the array in the .c file. It is not like the names of the #defines are particularly illuminating.

However, this runs into friction each time a new DDR appears, along with the new set of parameters (autogenerated by some vendor tool). In fact I've had to add some new DDR devices quite recently (but that didn't make it into the current patches).

I'm happy to reformat this to match upstream preference. But I would also be happy to discuss how we can better handle this type of "large binary blob" of configuration data, to make it simpler for everyone.

Quoted 35 lines
Quoted 35 lines
board/schneider/rzn1-snarc/ddr_timing.c new file +34 -0
+++ b/board/schneider/rzn1-snarc/rzn1.c
@@ -0,0 +1,39 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+#include <common.h>
+#include <dm.h>
+#include <asm/global_data.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int board_init(void)
+{
+	gd->bd->bi_boot_params = CFG_SYS_SDRAM_BASE + 0x100;
+
+	return 0;
+}
+
+int dram_init(void)
+{
+	struct udevice *dev;
+	int err;
+
+	/* This will end up calling cadence_ddr_probe() */
+	err = uclass_get_device(UCLASS_RAM, 0, &dev);
+	if (err) {
+		debug("DRAM init failed: %d\n", err);
+		return err;
+	}
+
+	if (fdtdec_setup_mem_size_base() != 0)
+		return -EINVAL;
+
+	return 0;
+}
+
Quoted 8 lines

board/schneider/rzn1-snarc/ddr_timing.c line 39

Quoted 6 lines
board/schneider/rzn1-snarc/ddr_timing.c new file +6 -0
+int dram_init_banksize(void)
+{
+	fdtdec_setup_memory_banksize();
+
+	return 0;
+}

I wonder how much of this should really be in arch/... since this is common to all machines with RZN1 . Maybe move it there instead ?

I can certainly do that. When I first put this together, I looked at many other dram_init() functions, both in arch/... and board/...

Ralph

#34 lore raw

Re: [PATCH v4 08/10] board: schneider: add RZN1 board support

Quoted 18 lines · Ralph Siemsen
Quoted 16 lines · Marek Vasut

board/schneider/rzn1-snarc/ddr_timing.c line 7

Quoted 13 lines · Ralph Siemsen
board/schneider/rzn1-snarc/ddr_timing.c new file +7 -0
new file mode 100644
index 0000000000..8bc3fe7be4
@@ -0,0 +1,140 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <asm/types.h>
+
+#include "jedec_ddr3_2g_x16_1333h_500_cl8.h"
+
+u32 ddr_00_87_async[] = {

Should this be 'static u32...' ?

Quoted 3 lines

It should, but there is bit of kludge going on here. This table is used when starting the DDR controller, in drivers/ram/cadence/ddr_async.c

There are several other boards in u-boot already which appear to use the same (or a similar) DDR controller from Cadence. Some of these also use a similar kludge as I have done. Others instead put the DDR parameters into the device tree.

The DT alternative would be nice indeed.

Quoted 1 line

While using the devicetree is cleaner, it does increase the size of the DTB by quite a bit, which creates some additional challenges. Even more so when you need to support multiple DDR chips, each with their own configuration parameters.

Hmmm, stm32mp15xx does use the DT this way, indeed.

I don't suppose one can calculate those register values from some input parameters (like, properties of the DRAM chip(s), bus, etc.) ?

It might be better to not expose the table itself, but provide some sort of accessor function. In the worst case, add a comment to explain this table is used elsewhere.

Quoted 13 lines

So I opted for the low-tech approach, at least in this initial version.

Quoted 8 lines

board/schneider/rzn1-snarc/ddr_timing.c line 8

Quoted 1 line
board/schneider/rzn1-snarc/ddr_timing.c new file +1 -0
+#define               DENALI_CTL_00_DATA 0x00000600

You might want to run checkpatch --f --fix --fix-inplace on this to fix formatting , esp. use one space after #define and tab after the macro name. Note that diff -wdb will let you diff updates to this file while ignoring space changes.

board/schneider/rzn1-snarc/ddr_timing.c line 12

Quoted 4 lines
board/schneider/rzn1-snarc/ddr_timing.c new file +4 -0
+#define               DENALI_CTL_01_DATA 0x00000000
+#define               DENALI_CTL_02_DATA 0x00000000
+#define               DENALI_CTL_03_DATA 0x00000000
+#define               DENALI_CTL_04_DATA 0x00000000

I had also considered eliminating the header file entirely, and just putting the values directly into the array in the .c file. It is not like the names of the #defines are particularly illuminating.

Quoted 3 lines

However, this runs into friction each time a new DDR appears, along with the new set of parameters (autogenerated by some vendor tool). In fact I've had to add some new DDR devices quite recently (but that didn't make it into the current patches).

I'm happy to reformat this to match upstream preference. But I would also be happy to discuss how we can better handle this type of "large binary blob" of configuration data, to make it simpler for everyone.

NXP has the same problem on MX8M* , large tables of binary goo.
I think the best option would be to figure out how to calculate those values based on input properties of the DRAM chips/bus/... , but while that would be fantastic to have, that would be also a LOT of effort . If you have the willpower to do it, woohoo ! Else, see above for low-tech options.

[...]

#35 lore raw

PATCH v4 9/10 tools: spkgimage: add Renesas SPKG format

In reply to Ralph Siemsen

Renesas RZ/N1 devices contain BootROM code that loads a custom SPKG image from QSPI, NAND or USB DFU. Support this format in mkimage tool.

SPKGs can optionally be signed, however creation of signed SPKG is not currently supported.

Example of how to use it:

tools/mkimage -n board/schneider/rzn1-snarc/spkgimage.cfg \
	-T spkgimage -a 0x20040000 -e 0x20040000 \
	-d u-boot.bin u-boot.bin.spkg

The config file (spkgimage.cfg in this example) contains additional parameters such as NAND ECC settings.

---

Changes in v4:
- added tags
- add RZ/N1 board documentation
- added binman support

Changes in v3:
- provide definition of __packed (as done in kwbimage.h)
- explain why a local copy of roundup() is needed
- document spkgimage in doc/mkimage.1
- add range checks when parsing config file values
- add line numbers for reporting errors in config file
- rename SPKG_HEADER_SIGNATURE to SPKG_HEADER_MARKER
- fix segfault when image is padded by less than 4 bytes
- minor style and typo fixes

Changes in v2:
- rewrote the stand-alone spkg_utility to integrate into mkimage

 board/schneider/rzn1-snarc/spkgimage.cfg |  26 ++
 boot/image.c                             |   1 +
 doc/mkimage.1                            |  45 ++++
 include/image.h                          |   1 +
 tools/Makefile                           |   1 +
 tools/spkgimage.c                        | 330 +++++++++++++++++++++++
 tools/spkgimage.h                        |  87 ++++++
 7 files changed, 491 insertions(+)
 create mode 100644 board/schneider/rzn1-snarc/spkgimage.cfg
 create mode 100644 tools/spkgimage.c
 create mode 100644 tools/spkgimage.h
board/schneider/rzn1-snarc/spkgimage.cfg new file +26 -0
new file mode 100644
index 0000000000..b5faf96b00
@@ -0,0 +1,26 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# (C) Copyright 2022 Schneider Electric
+#
+# SPKG image header, for booting on RZ/N1
+
+# b[35:32] SPKG version
+VERSION			1
+
+# b[42:41]  ECC Block size: 0=256 bytes, 1=512 bytes, 2=1024 bytes
+NAND_ECC_BLOCK_SIZE	1
+
+# b[45]     NAND enable (boolean)
+NAND_ECC_ENABLE		1
+
+# b[50:48]  ECC Scheme: 0=BCH2 1=BCH4 2=BCH8 3=BCH16 4=BCH24 5=BCH32
+NAND_ECC_SCHEME		3
+
+# b[63:56]  ECC bytes per block
+NAND_BYTES_PER_ECC_BLOCK 28
+
+# Provide dummy BLp header (boolean)
+ADD_DUMMY_BLP		1
+
+# Pad the image to a multiple of
+PADDING			64K
boot/image.c +1 -0
index 958dbf8534..5c4f9b807d 100644
@@ -181,6 +181,7 @@ static const table_entry_t uimage_type[] = {
 	{	IH_TYPE_SUNXI_EGON, "sunxi_egon",  "Allwinner eGON Boot Image" },
 	{	IH_TYPE_SUNXI_TOC0, "sunxi_toc0",  "Allwinner TOC0 Boot Image" },
 	{	IH_TYPE_FDT_LEGACY, "fdt_legacy", "legacy Image with Flat Device Tree ", },
+	{	IH_TYPE_RENESAS_SPKG, "spkgimage", "Renesas SPKG Image" },
 	{	-1,		    "",		  "",			},
 };
 
doc/mkimage.1 +45 -0

51 lines not on this page · raw message

include/image.h +1 -0
index 7717a4c13d..acfbb6a53a 100644
@@ -230,6 +230,7 @@ enum image_type_t {
 	IH_TYPE_SUNXI_EGON,		/* Allwinner eGON Boot Image */
 	IH_TYPE_SUNXI_TOC0,		/* Allwinner TOC0 Boot Image */
 	IH_TYPE_FDT_LEGACY,		/* Binary Flat Device Tree Blob	in a Legacy Image */
+	IH_TYPE_RENESAS_SPKG,		/* Renesas SPKG image */
 
 	IH_TYPE_COUNT,			/* Number of image types */
 };
tools/Makefile +1 -0
index e13effbb66..1d7abcb916 100644
@@ -125,6 +125,7 @@ dumpimage-mkimage-objs := aisimage.o \
 			stm32image.o \
 			$(ROCKCHIP_OBS) \
 			socfpgaimage.o \
+			spkgimage.o \
 			sunxi_egon.o \
 			lib/crc16-ccitt.o \
 			lib/hash-checksum.o \
tools/spkgimage.c new file +330 -0

330 lines not on this page · raw message

tools/spkgimage.h new file +87 -0

87 lines not on this page · raw message

Signature · 1 line
2.25.1
#36 lore raw

Re: [PATCH v4 09/10] tools: spkgimage: add Renesas SPKG format

On 3/8/23 21:26, Ralph Siemsen wrote:

[...]

tools/Makefile dumpimage-mkimage-objs := aisimage.o \ · line 128

Quoted 9 lines
tools/Makefile +1 -0
index e13effbb66..1d7abcb916 100644
@@ -125,6 +125,7 @@ dumpimage-mkimage-objs := aisimage.o \
  			stm32image.o \
  			$(ROCKCHIP_OBS) \
  			socfpgaimage.o \
+			spkgimage.o \

Maybe just call the file renesas_spkgimage.o so its clear which SoC/vendor this file is associtated with.

Quoted 19 lines
tools/Makefile +0 -0
  			sunxi_egon.o \
  			lib/crc16-ccitt.o \
  			lib/hash-checksum.o \
tools/spkgimage.c new file +10 -0
new file mode 100644
index 0000000000..ea8036e114
@@ -0,0 +1,330 @@
+// SPDX-License-Identifier: BSD-2-Clause
+/*
+ * Generate Renesas RZ/N1 BootROM header (SPKG)
+ * (C) Copyright 2022 Schneider Electric
+ *
+ * Based on spkg_utility.c
+ * (C) Copyright 2016 Renesas Electronics Europe Ltd
+ */
+
+#include "imagetool.h"

tools/spkgimage.c line 20

Quoted 10 lines
tools/spkgimage.c new file +10 -0
+#include <limits.h>
+#include <image.h>
+#include <stdarg.h>
+#include <stdint.h>
+#include <u-boot/crc.h>
+#include "spkgimage.h"
+
+static struct spkg_file out_buf;
+
+static uint32_t padding;

Is this padding here and the padding in struct config_file below different padding ? Can we get rid of these static global variables ?

Quoted 14 lines
tools/spkgimage.c new file +14 -0
+/* Note: the ordering of the bitfields does not matter */
+static struct config_file {
+	unsigned int version:1;
+	unsigned int ecc_block_size:2;
+	unsigned int ecc_enable:1;
+	unsigned int ecc_scheme:3;
+	unsigned int ecc_bytes:8;
+	unsigned int blp_len;
+	unsigned int padding;
+} conf;
+
+static int check_range(const char *name, int val, int min, int max)
+{
+	if (val < min) {

tools/spkgimage.c line 45

Quoted 10 lines
tools/spkgimage.c new file +10 -0
+		fprintf(stderr, "Warning: param '%s' adjusted to min %d\n",
+			name, min);
+		val = min;
+	}
+
+	if (val > max) {
+		fprintf(stderr, "Warning: param '%s' adjusted to max %d\n",
+			name, max);
+		val = max;
+	}

There is a macro clamp() which implements range limiting .

Quoted 51 lines
tools/spkgimage.c new file +51 -0
+	return val;
+}
+
+static int spkgimage_parse_config_line(char *line, size_t line_num)
+{
+	char *saveptr;
+	char *delim = "\t ";
+	char *name = strtok_r(line, delim, &saveptr);
+	char *val_str = strtok_r(NULL, delim, &saveptr);
+	int value = atoi(val_str);
+
+	if (!strcmp("VERSION", name)) {
+		conf.version = check_range(name, value, 1, 15);
+	} else if (!strcmp("NAND_ECC_ENABLE", name)) {
+		conf.ecc_enable = check_range(name, value, 0, 1);
+	} else if (!strcmp("NAND_ECC_BLOCK_SIZE", name)) {
+		conf.ecc_block_size = check_range(name, value, 0, 2);
+	} else if (!strcmp("NAND_ECC_SCHEME", name)) {
+		conf.ecc_scheme = check_range(name, value, 0, 7);
+	} else if (!strcmp("NAND_BYTES_PER_ECC_BLOCK", name)) {
+		conf.ecc_bytes = check_range(name, value, 0, 255);
+	} else if (!strcmp("ADD_DUMMY_BLP", name)) {
+		conf.blp_len = value ? SPKG_BLP_SIZE : 0;
+	} else if (!strcmp("PADDING", name)) {
+		if (strrchr(val_str, 'K'))
+			value = value * 1024;
+		else if (strrchr(val_str, 'M'))
+			value = value * 1024 * 1024;
+		conf.padding = check_range(name, value, 1, INT_MAX);
+	} else {
+		fprintf(stderr,
+			"config error: unknown keyword on line %ld\n",
+			line_num);
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
+static int spkgimage_parse_config_file(char *filename)
+{
+	FILE *fcfg;
+	char line[256];
+	size_t len;
+	size_t line_num = 0;
+
+	fcfg = fopen(filename, "r");
+	if (!fcfg)
+		return -EINVAL;
+
+	while (fgets(line, sizeof(line), fcfg)) {

tools/spkgimage.c line 107

Quoted 10 lines
tools/spkgimage.c new file +10 -0
+		line_num += 1;
+
+		/* Skip blank lines and comments */
+		if (line[0] == '\n' || line[0] == '#')
+			continue;
+
+		/* Strip the trailing newline */
+		len = strlen(line);
+		if (line[len - 1] == '\n')
+			line[--len] = 0;

Use len - 1 here too to avoid confusion ?

Quoted 14 lines
tools/spkgimage.c new file +14 -0
+
+		/* Parse the line */
+		if (spkgimage_parse_config_line(line, line_num))
+			return -EINVAL;
+	}
+
+	fclose(fcfg);
+
+	/* Avoid divide-by-zero later on */
+	if (!conf.padding)
+		conf.padding = 1;
+
+	return 0;
+}

[...]

#37 lore raw

Re: [PATCH v4 09/10] tools: spkgimage: add Renesas SPKG format

Quoted 4 lines · Marek Vasut

tools/Makefile dumpimage-mkimage-objs := aisimage.o \ · line 128

Quoted 1 line · Ralph Siemsen
tools/Makefile +1 -0
+			spkgimage.o \

Maybe just call the file renesas_spkgimage.o so its clear which SoC/vendor this file is associtated with.

Okay, will do.

Quoted 5 lines

tools/spkgimage.c line 20

Quoted 3 lines
tools/spkgimage.c new file +3 -0
+static struct spkg_file out_buf;
+
+static uint32_t padding;

Is this padding here and the padding in struct config_file below different padding ? Can we get rid of these static global variables ?

I will give it a try.

Quoted 16 lines
Quoted 4 lines
tools/spkgimage.c new file +3 -0
+static int check_range(const char *name, int val, int min, int max)
+{
+	if (val < min) {

tools/spkgimage.c line 45

Quoted 10 lines
tools/spkgimage.c new file +10 -0
+		fprintf(stderr, "Warning: param '%s' adjusted to min %d\n",
+			name, min);
+		val = min;
+	}
+
+	if (val > max) {
+		fprintf(stderr, "Warning: param '%s' adjusted to max %d\n",
+			name, max);
+		val = max;
+	}

There is a macro clamp() which implements range limiting .

Thanks for pointing that out. However I think there is value in the diagnostic print when the value is clamped. Ideally it should help the user to fix their invoking script/binman/etc.

Of course, I could call clamp() and check if the value differs, but that seems just as complex as the check_range().

Quoted 5 lines
Quoted 5 lines
tools/spkgimage.c new file +5 -0
+	while (fgets(line, sizeof(line), fcfg)) {
+		line_num += 1;
+
+		/* Skip blank lines and comments */
+		if (line[0] == '\n' || line[0] == '#')
Quoted 8 lines

tools/spkgimage.c line 107

Quoted 6 lines
tools/spkgimage.c new file +6 -0
+			continue;
+
+		/* Strip the trailing newline */
+		len = strlen(line);
+		if (line[len - 1] == '\n')
+			line[--len] = 0;

Use len - 1 here too to avoid confusion ?

Old habit. I always try to update the length in sync with modifying the string. If done as a separate line/statement, it is more likely to be lost during subsequent modifications.

In this case I do not need "len" at all, so I could just do:

		line[strcspn(line, "\n")] = 0;

Ralph

#38 lore raw

Re: [PATCH v4 09/10] tools: spkgimage: add Renesas SPKG format

Quoted 33 lines · Ralph Siemsen
Quoted 4 lines · Marek Vasut
Quoted 1 line · Ralph Siemsen

+            spkgimage.o \

Maybe just call the file renesas_spkgimage.o so its clear which SoC/vendor this file is associtated with.

Okay, will do.

Quoted 5 lines

tools/spkgimage.c line 20

Quoted 3 lines
tools/spkgimage.c new file +3 -0
+static struct spkg_file out_buf;
+
+static uint32_t padding;

Is this padding here and the padding in struct config_file below different padding ? Can we get rid of these static global variables ?

I will give it a try.

Quoted 16 lines
Quoted 4 lines
tools/spkgimage.c new file +3 -0
+static int check_range(const char *name, int val, int min, int max)
+{
+    if (val < min) {

tools/spkgimage.c line 45

Quoted 10 lines
tools/spkgimage.c new file +10 -0
+        fprintf(stderr, "Warning: param '%s' adjusted to min %d\n",
+            name, min);
+        val = min;
+    }
+
+    if (val > max) {
+        fprintf(stderr, "Warning: param '%s' adjusted to max %d\n",
+            name, max);
+        val = max;
+    }

There is a macro clamp() which implements range limiting .

Quoted 3 lines

Thanks for pointing that out. However I think there is value in the diagnostic print when the value is clamped. Ideally it should help the user to fix their invoking script/binman/etc.

Of course, I could call clamp() and check if the value differs, but that seems just as complex as the check_range().

ACK

Quoted 14 lines
Quoted 5 lines
Quoted 5 lines

+    while (fgets(line, sizeof(line), fcfg)) {
+        line_num += 1;
+
+        /* Skip blank lines and comments */
+        if (line[0] == '\n' || line[0] == '#')

Quoted 8 lines
Quoted 6 lines

+            continue;
+
+        /* Strip the trailing newline */
+        len = strlen(line);
+        if (line[len - 1] == '\n')
+            line[--len] = 0;

Use len - 1 here too to avoid confusion ?

Quoted 3 lines

Old habit. I always try to update the length in sync with modifying the string. If done as a separate line/statement, it is more likely to be lost during subsequent modifications.

In this case I do not need "len" at all, so I could just do:

Nice

#39 lore raw

PATCH v4 10/10 doc: renesas: add Renesas board docs

In reply to Ralph Siemsen

Collect the list of currerently supported Renesas boards.

For the RZ/N1 board, add details about booting and flashing.

---

(no changes since v1)

 doc/board/renesas/index.rst   |   9 +++
 doc/board/renesas/renesas.rst | 115 ++++++++++++++++++++++++++++++++++
 2 files changed, 124 insertions(+)
 create mode 100644 doc/board/renesas/index.rst
 create mode 100644 doc/board/renesas/renesas.rst
doc/board/renesas/index.rst new file +9 -0
new file mode 100644
index 0000000000..3244c9d45e
@@ -0,0 +1,9 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+Renesas
+=======
+
+.. toctree::
+   :maxdepth: 2
+
+   renesas
doc/board/renesas/renesas.rst new file +115 -0

115 lines not on this page · raw message

Signature · 1 line
2.25.1
#40 lore raw

Re: [PATCH v4 10/10] doc: renesas: add Renesas board docs

Quoted 1 line · Ralph Siemsen

Collect the list of currerently

Typo, curr... .

Quoted 3 lines

supported Renesas boards.

For the RZ/N1 board, add details about booting and flashing.

[...]

doc/board/renesas/renesas.rst line 15

Quoted 4 lines
doc/board/renesas/renesas.rst new file +4 -0
+Renesas boards
+--------------
+
+Renesas is a SoC solutions provider for industrial applications.

Automotive too.

Quoted 1 line

+U-boot supports several Renesas SoC families:

U-Boot .

Quoted 1 line

+* rcar gen1/gen2 (32-bit)

R-Car Gen2 (they are all Gen2 as far as I can tell)

doc/board/renesas/renesas.rst line 27

Quoted 8 lines
doc/board/renesas/renesas.rst new file +8 -0
+    - Blanche board
+    - Gose board
+    - Koelsch board
+    - Lager board
+    - Silk board
+    - Porter board
+    - Stout board
+* rcar gen3 (64-bit)

R-Car Gen3

doc/board/renesas/renesas.rst line 32

Quoted 5 lines
doc/board/renesas/renesas.rst new file +5 -0
+    - Condor board
+    - Draak board
+    - Eagle board
+    - Ebisu board
+    - Falcon board

This one is in fact R-Car Gen4, as is Spider and Whitehawk (which are missing here)

Quoted 1 line

+ - Salvator-x board

Salvator-X and Salvator-XS boards

Quoted 1 line

+ - Ulcb board

ULCB (that's an abbreviation) .

doc/board/renesas/renesas.rst line 37

Quoted 3 lines
doc/board/renesas/renesas.rst new file +3 -0
+    - Beacon-rzg2 board
+    - Hihope-rzg2 board
+    - ek874 board

Those three are RZ/G

Quoted 1 line

+* rza1 (32-bit)

RZ/A1

doc/board/renesas/renesas.rst line 40

Quoted 2 lines
doc/board/renesas/renesas.rst new file +2 -0
+    - GR-PEACH board
+* rzn1 (32-bit)

RZ/N1

doc/board/renesas/renesas.rst line 46

Quoted 6 lines
doc/board/renesas/renesas.rst new file +6 -0
+    - Schneider rzn1-snarc board
+
+Building
+--------
+
+NOTE: the following information is for the rzn1 board only.

Maybe this should be in a separate document , some rzn1 specific .rst file ?

Quoted 20 lines
doc/board/renesas/renesas.rst new file +20 -0
+U-Boot
+^^^^^^
+
+Clone the u-boot repository and build it as follows:
+
+.. code-block:: bash
+
+        git clone --depth 1 https://source.denx.de/u-boot/u-boot.git
+        cd u-boot
+        make rzn1_snarc_defconfig
+        make CROSS_COMPILE=arm-linux-gnu-
+
+This produces `u-boot` which is an ELF executable, suitable for use with `gdb`
+and JTAG debugging tools.
+
+It also produceds `u-boot.bin` which is a raw binary.
+
+SPKG image
+^^^^^^^^^^
+

doc/board/renesas/renesas.rst line 77

Quoted 10 lines
doc/board/renesas/renesas.rst new file +10 -0
+The BootROM in the RZ/N1 SoC expects to find the boot image in SPKG format.
+This format is documented in Chapter 7.4 of the RZ/N1 User Manual.
+
+The raw u-boot binary can be wrapped into SPKG format as follows:
+
+.. code-block:: bash
+
+    tools/mkimage -n board/schneider/rzn1-snarc/spkgimage.cfg \
+            -T spkgimage -a 0x20040000 -e 0x20040000 \
+            -d u-boot.bin u-boot.bin.spkg

Shouldn't binman do this for you ? That should be the primary option.

Quoted 37 lines
doc/board/renesas/renesas.rst new file +37 -0
+This produces `u-boot.bin.spkg` which can be flashed into QSPI, NAND, or loaded
+via USB-DFU mode.
+
+Take note of the load and execution address, which are encoded into the SPKG
+headers. For development convenience, mkimage computes the execution offset
+(part of the SPKG header) by subtracting the supplied load address from the
+supplied execution address.
+
+Also note there are other parameters, notably ECC configuration in the case of
+boot from NAND, specified in the `spkgimage.cfg` configuration file.
+
+Binman
+^^^^^^
+
+Alternatively `binman` may be used to generate the SPKG format for booting.
+This tool and its pre-requisites must be installed as per
+:doc:`../../../tools/binman/binman.rst``
+
+.. code-block:: bash
+
+    binman -d arch/arm/dts/r9a06g032-rzn1-snarc.dtb -o <OUT>
+
+This will produce `u-boot.bin.spkg` in the specified <OUT> directory.
+
+Flashing
+--------
+
+The RZ/N1 is able to boot from QSPI, NAND, or via USB (DFU). In all cases the
+on-board BootROM expects for the binary to be wrapped with a "SPKG" header.
+This format is detailed in the RZ/N1 User Manual, and can be produced using
+the u-boot `mkimage` utility.
+
+It is possible to recover a bricked unit by using the USB (DFU) boot mode. This
+allows uploading u-boot into the internal RAM. Thereafter u-boot can be used to
+program the QSPI and/or NAND, making use of u-boot dfu mode.
+
+Otherwise the only other option for recovery is via JTAG.
#41 lore raw

Re: [PATCH v4 10/10] doc: renesas: add Renesas board docs

Quoted 11 lines · Marek Vasut

On 3/8/23 21:26, Ralph Siemsen wrote:
RZ/N1

doc/board/renesas/renesas.rst line 46

Quoted 6 lines
doc/board/renesas/renesas.rst new file +6 -0
+    - Schneider rzn1-snarc board
+
+Building
+--------
+
+NOTE: the following information is for the rzn1 board only.

Maybe this should be in a separate document , some rzn1 specific .rst file ?

Originally I did just document the RZ/N1 stuff, since I really have no experience or knowledge of the other ones. But it felt wrong to create "doc/board/renesas" containing only RZ/N1 information. So I tried to at least collect the names of the other Renesas boards from U-Boot sources.

I'll make the fixes you suggested, and will move the RZ/N1 details into their own file.

Quoted 5 lines

doc/board/renesas/renesas.rst line 77

Quoted 3 lines
doc/board/renesas/renesas.rst new file +3 -0
+    tools/mkimage -n board/schneider/rzn1-snarc/spkgimage.cfg \
+            -T spkgimage -a 0x20040000 -e 0x20040000 \
+            -d u-boot.bin u-boot.bin.spkg

Shouldn't binman do this for you ? That should be the primary option.

Indeed it does, see below. I did however want to document how to call mkimage manually, since it took me a while to work out the right arguments (especially using -n for the config file).

Quoted 4 lines
Quoted 4 lines
doc/board/renesas/renesas.rst new file +4 -0
+Binman
+^^^^^^
+
+Alternatively `binman` may be used to generate the SPKG format for booting.
Quoted 8 lines

doc/board/renesas/renesas.rst line 101

Quoted 8 lines
doc/board/renesas/renesas.rst new file +8 -0
+This tool and its pre-requisites must be installed as per
+:doc:`../../../tools/binman/binman.rst``
+
+.. code-block:: bash
+
+    binman -d arch/arm/dts/r9a06g032-rzn1-snarc.dtb -o <OUT>
+
+This will produce `u-boot.bin.spkg` in the specified <OUT> directory.

Ralph

#42 lore raw

Re: [PATCH v4 10/10] doc: renesas: add Renesas board docs

Quoted 17 lines · Ralph Siemsen
Quoted 11 lines · Marek Vasut

On 3/8/23 21:26, Ralph Siemsen wrote:
RZ/N1

doc/board/renesas/renesas.rst line 46

Quoted 6 lines

+    - Schneider rzn1-snarc board

doc/board/renesas/renesas.rst new file +5 -0
+
+Building
+--------
+
+NOTE: the following information is for the rzn1 board only.

Maybe this should be in a separate document , some rzn1 specific .rst file ?

Originally I did just document the RZ/N1 stuff, since I really have no experience or knowledge of the other ones. But it felt wrong to create "doc/board/renesas" containing only RZ/N1 information. So I tried to at least collect the names of the other Renesas boards from U-Boot sources.

I'll make the fixes you suggested, and will move the RZ/N1 details into their own file.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

+    tools/mkimage -n board/schneider/rzn1-snarc/spkgimage.cfg \
+            -T spkgimage -a 0x20040000 -e 0x20040000 \
+            -d u-boot.bin u-boot.bin.spkg

Shouldn't binman do this for you ? That should be the primary option.

Indeed it does, see below. I did however want to document how to call mkimage manually, since it took me a while to work out the right arguments (especially using -n for the config file).

Then maybe just swap the binman and mkimage chapters and be done with it ?

#43 lore raw

Re: [PATCH v4 10/10] doc: renesas: add Renesas board docs

Quoted 4 lines · Marek Vasut
Quoted 1 line · Ralph Siemsen

Indeed it does, see below. I did however want to document how to call mkimage manually, since it took me a while to work out the right arguments (especially using -n for the config file).

Then maybe just swap the binman and mkimage chapters and be done with it ?

You mean put binman info first? Sure, I can do that ;-)

Ralph