RZ-G/RZG2 uboot

From eLinux.org
< RZ-G
Revision as of 14:08, 28 October 2020 by Cbrandt (talk | contribs) (Add Enabling QSPI FLASH support for RZ/G2M-N-H)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Starting Watchdog Timer

Preparation:
Remember to (" setenv wdt_timeout <seconds> ") before testing if you want board to reboot sooner. Otherwise, it will reboot after 1min due to the setting in the Device Tree.

Testing Phase:
Case 1: (which user replaces the wrong kernel Image or wrong dtb) In this case, we are going to use 1 random kernel Image, and 1 device tree ( .dtb ) for our board. For example: R-car M3 kernel Image + r8a774e1-hihope-rzg2h-ex.dtb.

Expected result: Board will stop at (" Starting kernel ..... ") due to the wrong kernel Image file. Board will reboot after the specified time which is set by user.

Case 2: (when loading a driver, kernel panic occurs because of loading driver fail and board stops booting) In this case, we will add a panic() function into one function of a driver such as probe() to create kernel panic, but make sure that you have included kernel.h to use this function.

For example: In the GPIO driver

#include <linux/kernel.h> 
static int gpio_rcar_probe(struct platform_device *pdev) 
{ 
    struct gpio_rcar_priv *p; 
    struct resource *io, *irq; 
    struct gpio_chip *gpio_chip; 
    ....... 
    panic("GPIO driver, Kernel panic\n"); 
    ....... 
}

Expected result: When loading GPIO driver, kernel panic occurs and board stops booting. Board will reboot after the specified time which is set by user.

Enabling QSPI FLASH support for RZ/G2M-N-H

The QSPI flash support is enabled by default for the RZ/G2E board (EK874), instead it is not enabled for the Hihope boards. In the procedure below RZ/G2M is used as an example, but it applies to RZ/G2N and RZ/G2H as well.

1) Build U-boot as per Chris' script instructions

2) Once built with default configuration, open another terminal and change dir to ./out_hihope-rzg2m. This is necessary because to build U-boot you probably had to source the environment variable script of the SDK, that prevents you from running the following command (old toolchain):

make menuconfig 

3) Enable the following configurations (search by typing /):

CMD_SF 
CMD_SPI 
DM_SPI_FLASH 
SPI_FLASH 
SPI_FLASH_BAR 
SPI_FLASH_USE_4K_SECTORS 
SPI 
DM_SPI 

4) Modify the device tree:

gedit ./arch/arm/dts/r8a774a1-hihope-rzg2m.dts 

and add the following lines:

    aliases { 
        spi0 = &rpc; 
    }; 

This one above should go just after the board model.

&rpc {

   num-cs = <1>; 
   status = "okay"; 
   spi-max-frequency = <40000000>; 
   #address-cells = <1>; 
   #size-cells = <0>; 
 
   flash0: spi-flash@0 { 
       #address-cells = <1>; 
       #size-cells = <1>; 
       compatible = "w25m512jv", "spi-flash", "jedec,spi-nor"; 
       spi-max-frequency = <40000000>; 
       spi-tx-bus-width = <1>; 
       spi-rx-bus-width = <1>; 
       reg = <0>; 
       status = "okay"; 
   }; 

};

5) Rebuild using the first terminal you used to build the first time.

The u-boot.bin file can be now programmed using another Chris' script, just make sure it gets copied in the directory where the script searches for it. Once programmed, you can test it by stopping the normal kernel boot:

U-Boot 2018.09-g03c7e33415-dirty (Oct 07 2020 - 15:55:06 +0200) 
  
CPU: Renesas Electronics R8A774A1 rev 1.3 
Model: Hoperun Technology HiHope RZ/G2M platform (hihope-rzg2m) 
DRAM:  3.9 GiB 
Bank #0: 0x048000000 - 0x0bfffffff, 1.9 GiB 
Bank #1: 0x600000000 - 0x67fffffff, 2 GiB 
  
Watchdog: Not found by seq! 
WDT:   watchdog@e6020000 
Watchdog: Started! 
MMC:   sd@ee100000: 0, sd@ee160000: 1 
Loading Environment from MMC... OK 
In:    serial@e6e88000 
Out:   serial@e6e88000 
Err:   serial@e6e88000 
Net: 
Error: ethernet@e6800000 address not set. 
eth-1: ethernet@e6800000 
Hit any key to stop autoboot:  0 
=> sf probe 
SF: Detected w25m512jw with page size 256 Bytes, erase size 4 KiB, total 32 MiB 
=>