Re: [PATCH v2 04/14] rockchip: rk3308: Generate ethaddr based on cpu id

2024-04-22 Thread Kever Yang



On 2024/4/9 02:14, Jonas Karlman wrote:

Like other Rockchip SoCs the RK3308 has cpu id programmed into OTP
memory. The rockchip_otp driver already support the RK3308 variant.
However, the device tree is missing a node to enable use of OTP.

Add the missing otp node to soc u-boot.dtsi, enable the rockchip_otp
driver and enable use of misc_init_r() to set ethaddr based on cpu id.

Signed-off-by: Jonas Karlman 

Reviewed-by: Kever Yang 

Thanks,
- Kever

---
v2: Add clocks and resets props
---
  arch/arm/dts/rk3308-u-boot.dtsi | 16 
  arch/arm/mach-rockchip/Kconfig  |  3 +++
  2 files changed, 19 insertions(+)

diff --git a/arch/arm/dts/rk3308-u-boot.dtsi b/arch/arm/dts/rk3308-u-boot.dtsi
index db2c20a7055e..436f66d1b87d 100644
--- a/arch/arm/dts/rk3308-u-boot.dtsi
+++ b/arch/arm/dts/rk3308-u-boot.dtsi
@@ -10,6 +10,22 @@
mmc0 = 
mmc1 = 
};
+
+   otp: nvmem@ff21 {
+   compatible = "rockchip,rk3308-otp";
+   reg = <0x0 0xff21 0x0 0x4000>;
+   clocks = < SCLK_OTP_USR>, < PCLK_OTP_NS>,
+< PCLK_OTP_PHY>;
+   clock-names = "otp", "apb_pclk", "phy";
+   resets = < SRST_OTP_PHY>;
+   reset-names = "phy";
+   #address-cells = <1>;
+   #size-cells = <1>;
+
+   cpu_id: id@7 {
+   reg = <0x07 0x10>;
+   };
+   };
  };
  
   {

diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index 71c5945b5742..6e07a70bf4ae 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -163,7 +163,10 @@ config ROCKCHIP_RK3308
imply ARMV8_CRYPTO
imply ARMV8_SET_SMPEN
imply LEGACY_IMAGE_FORMAT
+   imply MISC
+   imply MISC_INIT_R
imply ROCKCHIP_COMMON_BOARD
+   imply ROCKCHIP_OTP
imply SPL_CLK
imply SPL_FIT_SIGNATURE
imply SPL_RAM


Re: [PATCH v2 04/14] rockchip: rk3308: Generate ethaddr based on cpu id

2024-04-09 Thread Jonas Karlman
Hi Quentin,

On 2024-04-09 17:41, Quentin Schulz wrote:
> Hi Jonas,
> 
> On 4/8/24 20:14, Jonas Karlman wrote:
>> Like other Rockchip SoCs the RK3308 has cpu id programmed into OTP
>> memory. The rockchip_otp driver already support the RK3308 variant.
>> However, the device tree is missing a node to enable use of OTP.
>>
>> Add the missing otp node to soc u-boot.dtsi, enable the rockchip_otp
>> driver and enable use of misc_init_r() to set ethaddr based on cpu id.
>>
>> Signed-off-by: Jonas Karlman 
>> ---
>> v2: Add clocks and resets props
>> ---
>>   arch/arm/dts/rk3308-u-boot.dtsi | 16 
>>   arch/arm/mach-rockchip/Kconfig  |  3 +++
>>   2 files changed, 19 insertions(+)
>>
>> diff --git a/arch/arm/dts/rk3308-u-boot.dtsi 
>> b/arch/arm/dts/rk3308-u-boot.dtsi
>> index db2c20a7055e..436f66d1b87d 100644
>> --- a/arch/arm/dts/rk3308-u-boot.dtsi
>> +++ b/arch/arm/dts/rk3308-u-boot.dtsi
>> @@ -10,6 +10,22 @@
>>  mmc0 = 
>>  mmc1 = 
>>  };
>> +
>> +otp: nvmem@ff21 {
>> +compatible = "rockchip,rk3308-otp";
>> +reg = <0x0 0xff21 0x0 0x4000>;
>> +clocks = < SCLK_OTP_USR>, < PCLK_OTP_NS>,
>> + < PCLK_OTP_PHY>;
>> +clock-names = "otp", "apb_pclk", "phy";
>> +resets = < SRST_OTP_PHY>;
>> +reset-names = "phy";
>> +#address-cells = <1>;
>> +#size-cells = <1>;
>> +
>> +cpu_id: id@7 {
>> +reg = <0x07 0x10>;
>> +};
>> +};
> 
> Any plan upstreaming this to the Linux kernel so we can avoid 
> maintaining it in U-Boot?

Yes, I want to get this and some other fixes sent upstream. Will
probably not happen until I have finished up v2 of my other U-Boot
rk3xxx series.

Regards,
Jonas

> 
> It seems supported (the compatible is matched by a driver and there's a 
> DT binding already).
> 
> Reviewed-by: Quentin Schulz 
> 
> Cheers,
> Quentin



Re: [PATCH v2 04/14] rockchip: rk3308: Generate ethaddr based on cpu id

2024-04-09 Thread Quentin Schulz

Hi Jonas,

On 4/8/24 20:14, Jonas Karlman wrote:

Like other Rockchip SoCs the RK3308 has cpu id programmed into OTP
memory. The rockchip_otp driver already support the RK3308 variant.
However, the device tree is missing a node to enable use of OTP.

Add the missing otp node to soc u-boot.dtsi, enable the rockchip_otp
driver and enable use of misc_init_r() to set ethaddr based on cpu id.

Signed-off-by: Jonas Karlman 
---
v2: Add clocks and resets props
---
  arch/arm/dts/rk3308-u-boot.dtsi | 16 
  arch/arm/mach-rockchip/Kconfig  |  3 +++
  2 files changed, 19 insertions(+)

diff --git a/arch/arm/dts/rk3308-u-boot.dtsi b/arch/arm/dts/rk3308-u-boot.dtsi
index db2c20a7055e..436f66d1b87d 100644
--- a/arch/arm/dts/rk3308-u-boot.dtsi
+++ b/arch/arm/dts/rk3308-u-boot.dtsi
@@ -10,6 +10,22 @@
mmc0 = 
mmc1 = 
};
+
+   otp: nvmem@ff21 {
+   compatible = "rockchip,rk3308-otp";
+   reg = <0x0 0xff21 0x0 0x4000>;
+   clocks = < SCLK_OTP_USR>, < PCLK_OTP_NS>,
+< PCLK_OTP_PHY>;
+   clock-names = "otp", "apb_pclk", "phy";
+   resets = < SRST_OTP_PHY>;
+   reset-names = "phy";
+   #address-cells = <1>;
+   #size-cells = <1>;
+
+   cpu_id: id@7 {
+   reg = <0x07 0x10>;
+   };
+   };


Any plan upstreaming this to the Linux kernel so we can avoid 
maintaining it in U-Boot?


It seems supported (the compatible is matched by a driver and there's a 
DT binding already).


Reviewed-by: Quentin Schulz 

Cheers,
Quentin


[PATCH v2 04/14] rockchip: rk3308: Generate ethaddr based on cpu id

2024-04-08 Thread Jonas Karlman
Like other Rockchip SoCs the RK3308 has cpu id programmed into OTP
memory. The rockchip_otp driver already support the RK3308 variant.
However, the device tree is missing a node to enable use of OTP.

Add the missing otp node to soc u-boot.dtsi, enable the rockchip_otp
driver and enable use of misc_init_r() to set ethaddr based on cpu id.

Signed-off-by: Jonas Karlman 
---
v2: Add clocks and resets props
---
 arch/arm/dts/rk3308-u-boot.dtsi | 16 
 arch/arm/mach-rockchip/Kconfig  |  3 +++
 2 files changed, 19 insertions(+)

diff --git a/arch/arm/dts/rk3308-u-boot.dtsi b/arch/arm/dts/rk3308-u-boot.dtsi
index db2c20a7055e..436f66d1b87d 100644
--- a/arch/arm/dts/rk3308-u-boot.dtsi
+++ b/arch/arm/dts/rk3308-u-boot.dtsi
@@ -10,6 +10,22 @@
mmc0 = 
mmc1 = 
};
+
+   otp: nvmem@ff21 {
+   compatible = "rockchip,rk3308-otp";
+   reg = <0x0 0xff21 0x0 0x4000>;
+   clocks = < SCLK_OTP_USR>, < PCLK_OTP_NS>,
+< PCLK_OTP_PHY>;
+   clock-names = "otp", "apb_pclk", "phy";
+   resets = < SRST_OTP_PHY>;
+   reset-names = "phy";
+   #address-cells = <1>;
+   #size-cells = <1>;
+
+   cpu_id: id@7 {
+   reg = <0x07 0x10>;
+   };
+   };
 };
 
  {
diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index 71c5945b5742..6e07a70bf4ae 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -163,7 +163,10 @@ config ROCKCHIP_RK3308
imply ARMV8_CRYPTO
imply ARMV8_SET_SMPEN
imply LEGACY_IMAGE_FORMAT
+   imply MISC
+   imply MISC_INIT_R
imply ROCKCHIP_COMMON_BOARD
+   imply ROCKCHIP_OTP
imply SPL_CLK
imply SPL_FIT_SIGNATURE
imply SPL_RAM
-- 
2.43.2