Difference between revisions of "RZ-G/Boards/HiHope"

From eLinux.org
Jump to: navigation, search
(added Device Tree Rev2 Files)
(add u-boot Configuration Files)
 
(One intermediate revision by the same user not shown)
Line 27: Line 27:
  
  
= Enable I2C-0 on header =
+
= Enable I2C-0 on CN1801 Header =
 +
You need to add 2 new nodes in the Device Tree: One in the ‘pfc’ section to configure pin muxing, and another node at the global level to enable to I2C peripheral interface.
 +
<br>
 +
Edit the file:
 +
build/tmp/work-shared/hihope-rzg2m/kernel-source/arch/arm64/boot/dts/renesas/r8a774a1-hihope-rzg2m-ex.dts
 +
and at the end of the file, add the following:
 +
<br>
 +
<pre>
 +
/*
 +
* Enable I2C0 on CN1801
 +
* GP3_14 = scl0
 +
* GP3_15 = sda0
 +
*/
 +
&pfc {
 +
i2c0_pins: i2c0 {
 +
groups = "i2c0";
 +
function = "i2c0";
 +
};
 +
};
 +
&i2c0 { 
 +
    pinctrl-0 = <&i2c0_pins>;
 +
    pinctrl-names = "default";
 +
    status = "okay";
 +
    clock-frequency = <100000>;
 +
};
 +
</pre>
  
Directions on adding I2C-0
+
You can change the clock-frequency to 400000 if you like.
  
You need two nodes in the device tree – one in the ‘pfc’ section to configure pin muxing, and another node at the global level to enable to interface.  
+
'''To rebuild the Device Tree:''' <br>
This is what was added under the ‘pfc’ section –
+
1. Run this bitbake command:
  i2c0_pins: i2c0 {
+
bitbake -c devshell linux-renesas 
    groups = "i2c0";  
+
2. This will open a new window. In the new window, run:
    function = "i2c2";
+
  make dtbs
  };
+
  exit
 +
3. Now to repackage and copy the files into the 'deploy' directory, run this bitbake command:
 +
  bitbake linux-renesas -f -c deploy
  
And this is at the global level –
+
4. Copy your new .dtb file to your SD card and boot. Then you should see the device '''/dev/i2c-0'''
&i2c0 { 
 
    pinctrl-0 = <&i2c0_pins>;
 
    pinctrl-names = "default";
 
    status = "okay";
 
    clock-frequency = <400000>;
 
};
 
You can change the clock frequency to 100000 if you like.
 
I haven’t found a good method for building the device tree using just Yocto commands. So, this is the method that I use –
 
  
1. Run this bitbake command -  
+
5. If you have i2c-tools installed, you can use i2cdetect to confirm your device is accessible. For example:
bitbake -c devshell linux-renesas  
+
<pre>
2. This will open a new window. In the new window, run –  
+
root$ i2cdetect -y -r 0
  make dtbs
+
    0  1 2 3  4  5  6  7  8  9  b  c d e f
  exit  
+
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
 +
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
 +
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
 +
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
 +
40: -- -- -- -- -- -- -- -- -- -- 4a -- -- -- -- --
 +
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
 +
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
 +
70: -- -- -- -- -- -- -- --
 +
</pre>
  
The generated device tree binaries are in this folder –
 
build/tmp/work/hihope_rzg2m-poky-linux/linux-renesas/4.19.56-cip5+gitAUTOINC+5b7dee96a2-r1/linux-hihope_rzg2m-standard-build/arch/arm64/boot/dts/renesas
 
 
Note that this is in a different folder tree (build/tmp/work) from the device tree source files (buid/tmp/work-shared).
 
Also, the filenames are a little different, e.g. ‘r8a774a1-hihope-rzg2m-ex.dtb’. So, you need to rename that to ‘Image-r8a774a1-hihope-rzg2m-ex.dtb’ before transferring it to the board.
 
  
 
= "No Boot" Message  =
 
= "No Boot" Message  =
Line 74: Line 96:
 
Since MD5=0 is prohibited, it must be changed to MD5=1.<br>
 
Since MD5=0 is prohibited, it must be changed to MD5=1.<br>
 
For eMMC Boot operation, it is necessary to change to MD1=1.
 
For eMMC Boot operation, it is necessary to change to MD1=1.
 +
 +
= u-boot Configuration Files =
 +
The u-boot for the RZ/G2 configures the HW (peripherals and drivers) in multiple locations.
 +
 +
{| class="wikitable"
 +
|-
 +
|'''Board'''
 +
|'''Device Tree '''
 +
|'''Header '''
 +
|'''Code '''
 +
|-
 +
|RZ/G2M HiHope
 +
|arch/arm/dts/r8a774a1.dtsi <br> arch/arm/dts/hihope-common.dtsi <br> arch/arm/dts/r8a774a1-hihope-rzg2m.dts <br> arch/arm/dts/r8a774a1-hihope-rzg2m-u-boot.dts
 +
|include/configs/hihope-rzg2m.h
 +
|board/renesas/hihope-rzg2m/hihope-rzg2m.c
 +
|-
 +
|RZ/G2N HiHope
 +
|arch/arm/dts/r8a774b1.dtsi <br> arch/arm/dts/hihope-common.dtsi <br> arch/arm/dts/r8a774b1-hihope-rzg2n.dts <br> arch/arm/dts/r8a774b1-hihope-rzg2n-u-boot.dts
 +
|include/configs/hihope-rzg2n.h
 +
|board/renesas/hihope-rzg2n/hihope-rzg2n.c
 +
|-
 +
|RZ/G2N HiHope
 +
|arch/arm/dts/r8a774e1.dtsi <br> arch/arm/dts/hihope-common.dtsi <br> arch/arm/dts/r8a774e1-hihope-rzg2h.dts <br> arch/arm/dts/r8a774e1-hihope-rzg2h-u-boot.dts
 +
|include/configs/hihope-rzg2h.h
 +
|board/renesas/hihope-rzg2n/hihope-rzg2h.c
 +
|}

Latest revision as of 13:42, 22 October 2020

HiHope RZ/G2M,N,H board

NOTE: The same PCB board is used for RZ/G2M, RZ/G2N and RZ/G2H

Device Tree Rev2 Files

HiHope Device Tree files are located in Yocto under:

build/tmp/work-shared/hihope-rzg2m/kernel-source/arch/arm64/boot/dts/renesas/

NOTE: The file names below are for RZ/G2M (r8a774a1-hihope-rzg2m.dts), but the same applies for RZ/G2N and RZ/G2H Device Tree files.

If you have a sub-board attached (with the Ethernet connector), then you should use the "-ex" versions of the Device Tree.

Starting with VLP64 v1.0.4, the default Device Tree file will be for HiHope boards HIHOPE_RZ/G2_V3 boards or later.
You can find the version of your board printed on both the main board and sub-board.
Boards V3 or later

  • hihope-common.dtsi
  • r8a774a1-hihope-rzg2m.dts
  • r8a774a1-hihope-rzg2m-ex.dts


If you are using an older V2 board, then you will need to use the "-rev2" Device Tree Files.
Board V2 only

  • hihope-common-rev2.dtsi
  • r8a774a1-hihope-rzg2m-rev2.dts
  • r8a774a1-hihope-rzg2m-rev2-ex.dts


Enable I2C-0 on CN1801 Header

You need to add 2 new nodes in the Device Tree: One in the ‘pfc’ section to configure pin muxing, and another node at the global level to enable to I2C peripheral interface.
Edit the file:

build/tmp/work-shared/hihope-rzg2m/kernel-source/arch/arm64/boot/dts/renesas/r8a774a1-hihope-rzg2m-ex.dts

and at the end of the file, add the following:

/*
 * Enable I2C0 on CN1801
 * GP3_14 = scl0
 * GP3_15 = sda0
 */
&pfc {
	i2c0_pins: i2c0 {
		groups = "i2c0";
		function = "i2c0";
	};
};
&i2c0 {  
    pinctrl-0 = <&i2c0_pins>;
    pinctrl-names = "default";
    status = "okay";
    clock-frequency = <100000>;
};

You can change the clock-frequency to 400000 if you like.

To rebuild the Device Tree:
1. Run this bitbake command:

bitbake -c devshell linux-renesas  

2. This will open a new window. In the new window, run:

make dtbs
exit

3. Now to repackage and copy the files into the 'deploy' directory, run this bitbake command:

bitbake linux-renesas -f -c deploy

4. Copy your new .dtb file to your SD card and boot. Then you should see the device /dev/i2c-0

5. If you have i2c-tools installed, you can use i2cdetect to confirm your device is accessible. For example:

root$ i2cdetect -y -r 0
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- 4a -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --


"No Boot" Message

When you get the message:

No Boot
0x00000010 0x60018118 0x00000008 

If the prohibition setting is made in the Boot Mode setting, it will be in No Boot state.
On the HiHope-RZG2M board, the same error occurs when the following DIP SW settings are made. 0x60018118 indicates the value of MODEMR.

MD8 MD7 MD6 MD5 MD4 MD3 MD2 MD1 MD0
 1   0   0   0   1   1   0   0   0

Since MD5=0 is prohibited, it must be changed to MD5=1.
For eMMC Boot operation, it is necessary to change to MD1=1.

u-boot Configuration Files

The u-boot for the RZ/G2 configures the HW (peripherals and drivers) in multiple locations.

Board Device Tree Header Code
RZ/G2M HiHope arch/arm/dts/r8a774a1.dtsi
arch/arm/dts/hihope-common.dtsi
arch/arm/dts/r8a774a1-hihope-rzg2m.dts
arch/arm/dts/r8a774a1-hihope-rzg2m-u-boot.dts
include/configs/hihope-rzg2m.h board/renesas/hihope-rzg2m/hihope-rzg2m.c
RZ/G2N HiHope arch/arm/dts/r8a774b1.dtsi
arch/arm/dts/hihope-common.dtsi
arch/arm/dts/r8a774b1-hihope-rzg2n.dts
arch/arm/dts/r8a774b1-hihope-rzg2n-u-boot.dts
include/configs/hihope-rzg2n.h board/renesas/hihope-rzg2n/hihope-rzg2n.c
RZ/G2N HiHope arch/arm/dts/r8a774e1.dtsi
arch/arm/dts/hihope-common.dtsi
arch/arm/dts/r8a774e1-hihope-rzg2h.dts
arch/arm/dts/r8a774e1-hihope-rzg2h-u-boot.dts
include/configs/hihope-rzg2h.h board/renesas/hihope-rzg2n/hihope-rzg2h.c