convert mtd-mac-address to nvmem implementation

Adrian Schmutzler mail at adrianschmutzler.de
Tue Jul 20 12:05:59 PDT 2021


Hi,

> -----Original Message-----
> From: openwrt-devel [mailto:openwrt-devel-bounces at lists.openwrt.org]
> On Behalf Of e9hack
> Sent: Montag, 19. Juli 2021 18:42
> To: Ansuel Smith; ynezz
> Cc: openwrt-devel
> Subject: Re: convert mtd-mac-address to nvmem implementation
> 
> Am 19.07.2021 um 16:41 schrieb Ansuel Smith:
> > The dts has been migrated with a script and we decided to remove the
> > dtsi that caused some compilation problem.
> > We still need to take a decision for the device that have dtsi that
> > declare mtd-mac-address using partition tag declared in user dts (dtsi
> > use partition declared in the dts)
> 
> For testing, I shifted the uboot partition definition from user dts file to the
> main dtsi file. Uboot partition definition is in all user dts files the same. MAC
> address's and partition layout looks fine.

I'd say it's desirable not to distribute the partitioning across too many files.
But this case here is an exception anyway, as many/most examples will depend on art partitions that are not on the beginning and might have different offsets anyway.

Best

Adrian

> 
> Regards,
> Hartmut
> 
> diff --git a/target/linux/ath79/dts/qca9558_tplink_archer-c.dtsi
> b/target/linux/ath79/dts/qca9558_tplink_archer-c.dtsi
> index 3f965f5b95..1c72047a3a 100644
> --- a/target/linux/ath79/dts/qca9558_tplink_archer-c.dtsi
> +++ b/target/linux/ath79/dts/qca9558_tplink_archer-c.dtsi
> @@ -146,10 +147,19 @@
>   	};
>   };
> 
> +&mtdparts {
> +	uboot: partition at 0 {
> +		label = "u-boot";
> +		reg = <0x000000 0x020000>;
> +		read-only;
> +	};
> +};
> +
>   &eth0 {
>   	status = "okay";
> 
> -	mtd-mac-address = <&uboot 0x1fc00>;
> +	nvmem-cells = <&macaddr_uboot_1fc00>;
> +	nvmem-cell-names = "mac-address";
>   	mac-address-increment = <1>;
>   	phy-handle = <&phy0>;
>   	pll-data = <0x56000000 0x00000101 0x00001616>; @@ -163,7 +173,8
> @@
>   &eth1 {
>   	status = "okay";
> 
> -	mtd-mac-address = <&uboot 0x1fc00>;
> +	nvmem-cells = <&macaddr_uboot_1fc00>;
> +	nvmem-cell-names = "mac-address";
>   	pll-data = <0x03000101 0x00000101 0x00001616>;
> 
>   	fixed-link {
> @@ -176,5 +187,17 @@
>   	status = "okay";
> 
>   	mtd-cal-data = <&art 0x1000>;
> -	mtd-mac-address = <&uboot 0x1fc00>;
> +	nvmem-cells = <&macaddr_uboot_1fc00>;
> +	nvmem-cell-names = "mac-address";
>   };
> +
> +&uboot {
> +	compatible = "nvmem-cells";
> +	#address-cells = <1>;
> +	#size-cells = <1>;
> +
> +	macaddr_uboot_1fc00: macaddr at 1fc00 {
> +		reg = <0x1fc00 0x6>;
> +	};
> +};
> +
> diff --git a/target/linux/ath79/dts/qca9558_tplink_archer-c7-v2.dts
> b/target/linux/ath79/dts/qca9558_tplink_archer-c7-v2.dts
> index be99b8e3e4..785b4f8675 100644
> --- a/target/linux/ath79/dts/qca9558_tplink_archer-c7-v2.dts
> +++ b/target/linux/ath79/dts/qca9558_tplink_archer-c7-v2.dts
> @@ -25,12 +25,6 @@
>   };
> 
>   &mtdparts {
> -	uboot: partition at 0 {
> -		label = "u-boot";
> -		reg = <0x000000 0x020000>;
> -		read-only;
> -	};
> -
>   	partition at 20000 {
>   		label = "firmware";
>   		reg = <0x020000 0xfd0000>;
> 
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openpgp-digital-signature.asc
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20210720/def966e8/attachment.sig>


More information about the openwrt-devel mailing list