[PATCH v4] arm64: dts: rockchip: add EEPROM node for NanoPi R4S

Tianling Shen posted 1 patch 3 years, 6 months ago
arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts | 11 +++++++++++
1 file changed, 11 insertions(+)
[PATCH v4] arm64: dts: rockchip: add EEPROM node for NanoPi R4S
Posted by Tianling Shen 3 years, 6 months ago
NanoPi R4S has a EEPROM attached to the 2nd I2C bus (U92), which
stores the MAC address.

FriendlyElec ship two versions of the R4S [1]: The standard as well
as the enterprise edition with only the enterprise edition including
the EEPROM chip that stores the unique MAC address.

1. https://wiki.friendlyelec.com/wiki/index.php/NanoPi_R4S#Differences_Between_R4S_Standard_Version_.26_R4S_Enterprise_Version

Changes in v4:
- Removed `mac-address` cell as it breaks the standard edition

Changes in v3:
- Added address-cells and size-cells

Changes in v2:
- Added the size of EEPROM
- Added `mac-address` cell to pass the MAC address to kernel
- Removed `read-only` property in EEPROM node

Signed-off-by: Tianling Shen <cnsztl@gmail.com>
---
 arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts b/arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts
index fe5b52610010..42c99573ab27 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts
@@ -68,6 +68,17 @@ &emmc_phy {
 	status = "disabled";
 };
 
+&i2c2 {
+	eeprom@51 {
+		compatible = "microchip,24c02", "atmel,24c02";
+		reg = <0x51>;
+		pagesize = <16>;
+		size = <256>;
+		#address-cells = <1>;
+		#size-cells = <1>;
+	};
+};
+
 &i2c4 {
 	status = "disabled";
 };
-- 
2.25.1
Re: [PATCH v4] arm64: dts: rockchip: add EEPROM node for NanoPi R4S
Posted by Heiko Stuebner 3 years, 6 months ago
Hi,

Am Sonntag, 11. September 2022, 06:06:28 CEST schrieb Tianling Shen:
> NanoPi R4S has a EEPROM attached to the 2nd I2C bus (U92), which
> stores the MAC address.
> 
> FriendlyElec ship two versions of the R4S [1]: The standard as well
> as the enterprise edition with only the enterprise edition including
> the EEPROM chip that stores the unique MAC address.

This needs to go differently.

If the eeprom is only preset on the enterprise-version, you need
a separate devicetree for it, that provides the eeprom node.

Declaring the eeprom "in error" on a device that doesn't have it,
isn't the way to go.

Look for example at rockchip/rk3399-nanopi-m4b.dts for reference
on how to do it - and also remember to add the new binding
for that board. And can also again declare the correct mac-address
cell.


Heiko

> 
> 1. https://wiki.friendlyelec.com/wiki/index.php/NanoPi_R4S#Differences_Between_R4S_Standard_Version_.26_R4S_Enterprise_Version
> 
> Changes in v4:
> - Removed `mac-address` cell as it breaks the standard edition
> 
> Changes in v3:
> - Added address-cells and size-cells
> 
> Changes in v2:
> - Added the size of EEPROM
> - Added `mac-address` cell to pass the MAC address to kernel
> - Removed `read-only` property in EEPROM node
> 
> Signed-off-by: Tianling Shen <cnsztl@gmail.com>
> ---
>  arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts b/arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts
> index fe5b52610010..42c99573ab27 100644
> --- a/arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts
> +++ b/arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts
> @@ -68,6 +68,17 @@ &emmc_phy {
>  	status = "disabled";
>  };
>  
> +&i2c2 {
> +	eeprom@51 {
> +		compatible = "microchip,24c02", "atmel,24c02";
> +		reg = <0x51>;
> +		pagesize = <16>;
> +		size = <256>;
> +		#address-cells = <1>;
> +		#size-cells = <1>;
> +	};
> +};
> +
>  &i2c4 {
>  	status = "disabled";
>  };
>
Re: [PATCH v4] arm64: dts: rockchip: add EEPROM node for NanoPi R4S
Posted by Tianling Shen 3 years, 6 months ago
Hi Heiko,

On Tue, Sep 13, 2022 at 6:22 PM Heiko Stuebner <heiko@sntech.de> wrote:
>
> Hi,
>
> Am Sonntag, 11. September 2022, 06:06:28 CEST schrieb Tianling Shen:
> > NanoPi R4S has a EEPROM attached to the 2nd I2C bus (U92), which
> > stores the MAC address.
> >
> > FriendlyElec ship two versions of the R4S [1]: The standard as well
> > as the enterprise edition with only the enterprise edition including
> > the EEPROM chip that stores the unique MAC address.
>
> This needs to go differently.
>
> If the eeprom is only preset on the enterprise-version, you need
> a separate devicetree for it, that provides the eeprom node.
>
> Declaring the eeprom "in error" on a device that doesn't have it,
> isn't the way to go.
>
> Look for example at rockchip/rk3399-nanopi-m4b.dts for reference
> on how to do it - and also remember to add the new binding
> for that board. And can also again declare the correct mac-address
> cell.
>

Got it, thank you! I will do it these days.

Regards,
Tianling.

>
> Heiko
>
> >
> > 1. https://wiki.friendlyelec.com/wiki/index.php/NanoPi_R4S#Differences_Between_R4S_Standard_Version_.26_R4S_Enterprise_Version
> >
> > Changes in v4:
> > - Removed `mac-address` cell as it breaks the standard edition
> >
> > Changes in v3:
> > - Added address-cells and size-cells
> >
> > Changes in v2:
> > - Added the size of EEPROM
> > - Added `mac-address` cell to pass the MAC address to kernel
> > - Removed `read-only` property in EEPROM node
> >
> > Signed-off-by: Tianling Shen <cnsztl@gmail.com>
> > ---
> >  arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts | 11 +++++++++++
> >  1 file changed, 11 insertions(+)
> >
> > diff --git a/arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts b/arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts
> > index fe5b52610010..42c99573ab27 100644
> > --- a/arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts
> > +++ b/arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts
> > @@ -68,6 +68,17 @@ &emmc_phy {
> >       status = "disabled";
> >  };
> >
> > +&i2c2 {
> > +     eeprom@51 {
> > +             compatible = "microchip,24c02", "atmel,24c02";
> > +             reg = <0x51>;
> > +             pagesize = <16>;
> > +             size = <256>;
> > +             #address-cells = <1>;
> > +             #size-cells = <1>;
> > +     };
> > +};
> > +
> >  &i2c4 {
> >       status = "disabled";
> >  };
> >
>
>
>
>
[PATCH 1/2] dt-bindings: Add doc for FriendlyARM NanoPi R4S Enterprise Edition
Posted by Tianling Shen 3 years, 6 months ago
Add devicetree binding documentation for the FriendlyARM NanoPi R4S
Enterprise Edition.

Signed-off-by: Tianling Shen <cnsztl@gmail.com>
---
 Documentation/devicetree/bindings/arm/rockchip.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/arm/rockchip.yaml b/Documentation/devicetree/bindings/arm/rockchip.yaml
index 7811ba64149c..309f76b803a5 100644
--- a/Documentation/devicetree/bindings/arm/rockchip.yaml
+++ b/Documentation/devicetree/bindings/arm/rockchip.yaml
@@ -151,6 +151,7 @@ properties:
               - friendlyarm,nanopi-m4b
               - friendlyarm,nanopi-neo4
               - friendlyarm,nanopi-r4s
+              - friendlyarm,nanopi-r4s-enterprise
           - const: rockchip,rk3399
 
       - description: GeekBuying GeekBox
-- 
2.25.1
Re: [PATCH 1/2] dt-bindings: Add doc for FriendlyARM NanoPi R4S Enterprise Edition
Posted by Krzysztof Kozlowski 3 years, 6 months ago
On 15/09/2022 03:25, Tianling Shen wrote:
> Add devicetree binding documentation for the FriendlyARM NanoPi R4S
> Enterprise Edition.
> 
> Signed-off-by: Tianling Shen <cnsztl@gmail.com>


Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>


Best regards,
Krzysztof
Re: [PATCH 1/2] dt-bindings: Add doc for FriendlyARM NanoPi R4S Enterprise Edition
Posted by Heiko Stuebner 3 years, 6 months ago
Am Donnerstag, 15. September 2022, 04:25:10 CEST schrieb Tianling Shen:
> Add devicetree binding documentation for the FriendlyARM NanoPi R4S
> Enterprise Edition.
> 
> Signed-off-by: Tianling Shen <cnsztl@gmail.com>

applied both series for 6.1

Thanks
Heiko

> ---
>  Documentation/devicetree/bindings/arm/rockchip.yaml | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/Documentation/devicetree/bindings/arm/rockchip.yaml b/Documentation/devicetree/bindings/arm/rockchip.yaml
> index 7811ba64149c..309f76b803a5 100644
> --- a/Documentation/devicetree/bindings/arm/rockchip.yaml
> +++ b/Documentation/devicetree/bindings/arm/rockchip.yaml
> @@ -151,6 +151,7 @@ properties:
>                - friendlyarm,nanopi-m4b
>                - friendlyarm,nanopi-neo4
>                - friendlyarm,nanopi-r4s
> +              - friendlyarm,nanopi-r4s-enterprise
>            - const: rockchip,rk3399
>  
>        - description: GeekBuying GeekBox
>
[PATCH 2/2] arm64: dts: rockchip: rk3399: Add NanoPi R4S Enterprise Edition
Posted by Tianling Shen 3 years, 6 months ago
The only diffrence against the standrard edition is that the enterprise
one has a built-in EEPROM chip which stores a globally unique MAC address.

Signed-off-by: Tianling Shen <cnsztl@gmail.com>
---
 arch/arm64/boot/dts/rockchip/Makefile         |  1 +
 .../rockchip/rk3399-nanopi-r4s-enterprise.dts | 29 +++++++++++++++++++
 2 files changed, 30 insertions(+)
 create mode 100644 arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s-enterprise.dts

diff --git a/arch/arm64/boot/dts/rockchip/Makefile b/arch/arm64/boot/dts/rockchip/Makefile
index ef79a672804a..04562f8b10ac 100644
--- a/arch/arm64/boot/dts/rockchip/Makefile
+++ b/arch/arm64/boot/dts/rockchip/Makefile
@@ -40,6 +40,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-nanopi-m4.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-nanopi-m4b.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-nanopi-neo4.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-nanopi-r4s.dtb
+dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-nanopi-r4s-enterprise.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-orangepi.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-pinebook-pro.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-puma-haikou.dtb
diff --git a/arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s-enterprise.dts b/arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s-enterprise.dts
new file mode 100644
index 000000000000..a23d11ca0eb6
--- /dev/null
+++ b/arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s-enterprise.dts
@@ -0,0 +1,29 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+
+/dts-v1/;
+#include "rk3399-nanopi-r4s.dts"
+
+/ {
+	model = "FriendlyElec NanoPi R4S Enterprise Edition";
+	compatible = "friendlyarm,nanopi-r4s-enterprise", "rockchip,rk3399";
+};
+
+&gmac {
+	nvmem-cells = <&mac_address>;
+	nvmem-cell-names = "mac-address";
+};
+
+&i2c2 {
+	eeprom@51 {
+		compatible = "microchip,24c02", "atmel,24c02";
+		reg = <0x51>;
+		pagesize = <16>;
+		size = <256>;
+		#address-cells = <1>;
+		#size-cells = <1>;
+
+		mac_address: mac-address@fa {
+			reg = <0xfa 0x06>;
+		};
+	};
+};
-- 
2.25.1