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

2023-04-17 Thread Ralph Siemsen

On Mon, Apr 17, 2023 at 10:34:08PM +0200, Marek Vasut wrote:

On 4/17/23 22:29, Ralph Siemsen wrote:
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


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

2023-04-17 Thread Marek Vasut

On 4/17/23 22:29, Ralph Siemsen wrote:

On Mon, Apr 17, 2023 at 07:28:05PM +0200, Marek Vasut wrote:

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


+    - 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.



+    tools/mkimage -n board/schneider/rzn1-snarc/spkgimage.cfg \
+    -T spkgimage -a 0x2004 -e 0x2004 \
+    -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 ?


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

2023-04-17 Thread Ralph Siemsen

On Mon, Apr 17, 2023 at 07:28:05PM +0200, Marek Vasut wrote:

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


+- 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.



+tools/mkimage -n board/schneider/rzn1-snarc/spkgimage.cfg \
+-T spkgimage -a 0x2004 -e 0x2004 \
+-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).



+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 
+
+This will produce `u-boot.bin.spkg` in the specified  directory.


Ralph


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

2023-04-17 Thread Marek Vasut

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

Collect the list of currerently


Typo, curr... .


supported Renesas boards.

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


[...]


+Renesas boards
+--
+
+Renesas is a SoC solutions provider for industrial applications.


Automotive too.


+U-boot supports several Renesas SoC families:


U-Boot .


+* rcar gen1/gen2 (32-bit)


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


+- Blanche board
+- Gose board
+- Koelsch board
+- Lager board
+- Silk board
+- Porter board
+- Stout board
+* rcar gen3 (64-bit)


R-Car Gen3


+- 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)



+- Salvator-x board


Salvator-X and Salvator-XS boards


+- Ulcb board


ULCB (that's an abbreviation) .


+- Beacon-rzg2 board
+- Hihope-rzg2 board
+- ek874 board


Those three are RZ/G


+* rza1 (32-bit)


RZ/A1


+- GR-PEACH board
+* rzn1 (32-bit)


RZ/N1


+- 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 ?


+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
+^^
+
+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 0x2004 -e 0x2004 \
+-d u-boot.bin u-boot.bin.spkg


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


+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 
+
+This will produce `u-boot.bin.spkg` in the specified  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.