diff mbox series

[1/2] arm64: dts: marvell: mcbin: Adding SPI-NOR Flash Config

Message ID 20190211171401.434-1-alex@asyring.de (mailing list archive)
State New, archived
Headers show
Series [1/2] arm64: dts: marvell: mcbin: Adding SPI-NOR Flash Config | expand

Commit Message

Alexander Syring Feb. 11, 2019, 5:14 p.m. UTC
According to U-Boot dts file enabling the SPI-NOR flash for use in
Linux

Signed-off-by: Alexander Syring <alex@asyring.de>
---
 .../boot/dts/marvell/armada-8040-mcbin.dtsi   | 23 +++++++++++++++----
 1 file changed, 18 insertions(+), 5 deletions(-)

Comments

Russell King (Oracle) Feb. 11, 2019, 5:19 p.m. UTC | #1
On Mon, Feb 11, 2019 at 06:14:01PM +0100, Alexander Syring wrote:
> According to U-Boot dts file enabling the SPI-NOR flash for use in
> Linux

Some of us already use u-boot on Macchiatobin, and have u-boot in SPI
NOR flash.  The u-boot environment is stored at 0x3f0000 currently.

Merging this will break existing setups, especially when we use
u-boot-tools to access the environment from within Linux.
Marc Zyngier Feb. 11, 2019, 5:27 p.m. UTC | #2
On 11/02/2019 17:14, Alexander Syring wrote:
> According to U-Boot dts file enabling the SPI-NOR flash for use in
> Linux
> 
> Signed-off-by: Alexander Syring <alex@asyring.de>
> ---
>  .../boot/dts/marvell/armada-8040-mcbin.dtsi   | 23 +++++++++++++++----
>  1 file changed, 18 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/arm64/boot/dts/marvell/armada-8040-mcbin.dtsi b/arch/arm64/boot/dts/marvell/armada-8040-mcbin.dtsi
> index 329f8ceeebea..83994ff46e2d 100644
> --- a/arch/arm64/boot/dts/marvell/armada-8040-mcbin.dtsi
> +++ b/arch/arm64/boot/dts/marvell/armada-8040-mcbin.dtsi
> @@ -333,11 +333,24 @@
>  	status = "okay";
>  
>  	spi-flash@0 {
> -		compatible = "st,w25q32";
> -		spi-max-frequency = <50000000>;
> -		reg = <0>;
> -	};
> -};
> +		compatible = "st,w25q32", "jedec,spi-nor";
> +		reg = <0>;
> +		spi-max-frequency = <50000000>;
> +
> +		partitions {
> +			compatible = "fixed-partitions";
> +
> +			partition@0 {
> +				label = "U-Boot";
> +				reg = <0 0x200000>;
> +			};
> +			partition@400000 {
> +				label = "U-Boot Env";
> +				reg = <0x200000 0xce0000>;
> +			};
> +		};
> +	};
> +};
>  
>  &cp1_usb3_0 {
>  	/* CPS Lane 2 - CON7 */
> 

Really?

My mcbin SPI flash doesn't have this partitioning, and doesn't have
u-boot at all. This should be provided by the bootloader itself, and not
baked into the reference DT.

Thanks,

	M.
Russell King (Oracle) Feb. 11, 2019, 5:31 p.m. UTC | #3
On Mon, Feb 11, 2019 at 05:27:37PM +0000, Marc Zyngier wrote:
> On 11/02/2019 17:14, Alexander Syring wrote:
> > According to U-Boot dts file enabling the SPI-NOR flash for use in
> > Linux
> > 
> > Signed-off-by: Alexander Syring <alex@asyring.de>
> > ---
> >  .../boot/dts/marvell/armada-8040-mcbin.dtsi   | 23 +++++++++++++++----
> >  1 file changed, 18 insertions(+), 5 deletions(-)
> > 
> > diff --git a/arch/arm64/boot/dts/marvell/armada-8040-mcbin.dtsi b/arch/arm64/boot/dts/marvell/armada-8040-mcbin.dtsi
> > index 329f8ceeebea..83994ff46e2d 100644
> > --- a/arch/arm64/boot/dts/marvell/armada-8040-mcbin.dtsi
> > +++ b/arch/arm64/boot/dts/marvell/armada-8040-mcbin.dtsi
> > @@ -333,11 +333,24 @@
> >  	status = "okay";
> >  
> >  	spi-flash@0 {
> > -		compatible = "st,w25q32";
> > -		spi-max-frequency = <50000000>;
> > -		reg = <0>;
> > -	};
> > -};
> > +		compatible = "st,w25q32", "jedec,spi-nor";
> > +		reg = <0>;
> > +		spi-max-frequency = <50000000>;
> > +
> > +		partitions {
> > +			compatible = "fixed-partitions";
> > +
> > +			partition@0 {
> > +				label = "U-Boot";
> > +				reg = <0 0x200000>;
> > +			};
> > +			partition@400000 {
> > +				label = "U-Boot Env";
> > +				reg = <0x200000 0xce0000>;
> > +			};
> > +		};
> > +	};
> > +};
> >  
> >  &cp1_usb3_0 {
> >  	/* CPS Lane 2 - CON7 */
> > 
> 
> Really?
> 
> My mcbin SPI flash doesn't have this partitioning, and doesn't have
> u-boot at all. This should be provided by the bootloader itself, and not
> baked into the reference DT.

Exactly.

Simple solution for the above.  Instead of the above, create
/etc/fw_env.config with:

/dev/mtdblock0 0x200000 0x10000

Then its possible to read and write the u-boot environment using
fw_printenv and fw_setenv.  No partitions are required, and IMHO
are pointless for such a scenario.

That will allow those of us with a different SPI flash layout and
already have this in /etc/fw_env.config:

/dev/mtdblock0 0x3f0000 0x10000

to not experience any breakage.
diff mbox series

Patch

diff --git a/arch/arm64/boot/dts/marvell/armada-8040-mcbin.dtsi b/arch/arm64/boot/dts/marvell/armada-8040-mcbin.dtsi
index 329f8ceeebea..83994ff46e2d 100644
--- a/arch/arm64/boot/dts/marvell/armada-8040-mcbin.dtsi
+++ b/arch/arm64/boot/dts/marvell/armada-8040-mcbin.dtsi
@@ -333,11 +333,24 @@ 
 	status = "okay";
 
 	spi-flash@0 {
-		compatible = "st,w25q32";
-		spi-max-frequency = <50000000>;
-		reg = <0>;
-	};
-};
+		compatible = "st,w25q32", "jedec,spi-nor";
+		reg = <0>;
+		spi-max-frequency = <50000000>;
+
+		partitions {
+			compatible = "fixed-partitions";
+
+			partition@0 {
+				label = "U-Boot";
+				reg = <0 0x200000>;
+			};
+			partition@400000 {
+				label = "U-Boot Env";
+				reg = <0x200000 0xce0000>;
+			};
+		};
+	};
+};
 
 &cp1_usb3_0 {
 	/* CPS Lane 2 - CON7 */