Skip to contentSkip to conversation

ARM: dts: sun8i: h2+: Enable optional SPI flash on Orange Pi Zero board

PATCH In review Michal Suchanek 2 participants 8 messages Sep 29, 2020 – Oct 19, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: dts: sun8i: h2+: Enable optional SPI flash on Orange Pi Zero board

The flash is present on all new boards and users went out of their way to add it on the old ones.

Enabling it makes a more reasonable default.

---
 arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts +2 -2
index f19ed981da9d..061d295bbba7 100644
@@ -163,8 +163,8 @@ &ohci1 {
 };
 
 &spi0 {
-	/* Disable SPI NOR by default: it optional on Orange Pi Zero boards */
-	status = "disabled";
+	/* Enable optional SPI NOR by default */
+	status = "okay";
 
 	flash@0 {
 		#address-cells = <1>;
Signature · 1 line
2.28.0
#1 lore raw

Hi,

Quoted 15 lines · Michal Suchanek

The flash is present on all new boards and users went out of their way to add it on the old ones.

Enabling it makes a more reasonable default.

---
 arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts +0 -0
index f19ed981da9d..061d295bbba7 100644

arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts &ohci1 { · line 170

Quoted 10 lines
arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts +2 -2
@@ -163,8 +163,8 @@ &ohci1 {
 };
 
 &spi0 {
-	/* Disable SPI NOR by default: it optional on Orange Pi Zero boards */
-	status = "disabled";
+	/* Enable optional SPI NOR by default */
+	status = "okay";
 
 	flash@0 {
 		#address-cells = <1>;

Unfortunately, it's optional, so there's really no reason to enable it all the time. If it's troublesome to users, then the distros or vendors should make the changes necessary to the hardware, bootloader or their documentation to make it easier for those users.

Maxime

#2 lore raw
Quoted 26 lines · Maxime Ripard

Hi,

Quoted 23 lines · Michal Suchanek

The flash is present on all new boards and users went out of their way to add it on the old ones.

Enabling it makes a more reasonable default.

---
 arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts +2 -2
index f19ed981da9d..061d295bbba7 100644
@@ -163,8 +163,8 @@ &ohci1 {
 };
 
 &spi0 {
-	/* Disable SPI NOR by default: it optional on Orange Pi Zero boards */
-	status = "disabled";
+	/* Enable optional SPI NOR by default */
+	status = "okay";
 
Quoted 7 lines

arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts &ohci1 { · line 170

Quoted 2 lines
arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts +0 -0
 	flash@0 {
 		#address-cells = <1>;

Unfortunately, it's optional, so there's really no reason to enable it all the time. If it's troublesome to users, then the distros or vendors should make the changes necessary to the hardware, bootloader or their documentation to make it easier for those users.

I don't understand the reasoning. Why must it be disabled when optional?

By the same reasoning there is no reason to disable it all the time. Also the boards that do not have the flsh are either broken or obsolete. So most of the time enabling the flash chip is the right thing.

Or do we need two DTBs like sun8i-h2-plus-orangepi-zero.dts and sun8i-h2-plus-orangepi-zero-no-spi-nor.dts

There is no way to change the setting on a runnig system, the pins are routed to the flash pads anyway so are not usable for anything else. The only thing that happens on boards that do not have the flash is kernel probing it and complaining that the ID 00 00 00 is not valid SPI NOR flash memory ID.

Thanks

Michal

Thanks

Michal

#3 lore raw
Quoted 35 lines · Michal Suchánek
Quoted 26 lines · Maxime Ripard

Hi,

Quoted 23 lines · Michal Suchanek

The flash is present on all new boards and users went out of their way to add it on the old ones.

Enabling it makes a more reasonable default.

---
 arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts +2 -2
index f19ed981da9d..061d295bbba7 100644
@@ -163,8 +163,8 @@ &ohci1 {
 };
 
 &spi0 {
-	/* Disable SPI NOR by default: it optional on Orange Pi Zero boards */
-	status = "disabled";
+	/* Enable optional SPI NOR by default */
+	status = "okay";
 
Quoted 7 lines

arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts &ohci1 { · line 170

Quoted 2 lines
arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts +0 -0
 	flash@0 {
 		#address-cells = <1>;

Unfortunately, it's optional, so there's really no reason to enable it all the time. If it's troublesome to users, then the distros or vendors should make the changes necessary to the hardware, bootloader or their documentation to make it easier for those users.

Quoted 1 line

I don't understand the reasoning. Why must it be disabled when optional?

Think about it the other way around. If we enable everything that is optional, we're going to have a multitude of conflicts everywhere, and without a clear decision as to who is "best" and thus how we should resolve it.

On a separate platform, recently I've been using a VGA bridge for the RaspberryPi that takes the UART pins as well. It's definitely optional, should I enable it by default? At the same time, enabling by default the UART is just as arbitrary and will result in people using the VGA bridge to complain about their regression (rightfully so).

So, really, if it's optional, it means that it not always there. If it's not always there, it's meant to be supported by an overlay.

Quoted 1 line

By the same reasoning there is no reason to disable it all the time.

I'm not sure I follow you here. The least common denominator is that it's not there, so it's not enabled.

Quoted 2 lines

Also the boards that do not have the flsh are either broken or obsolete.

Making general statements without arguments doesn't really make it true though. Plenty of boards to have flash and are neither broken nor obsolete.

Quoted 4 lines

So most of the time enabling the flash chip is the right thing.

Or do we need two DTBs like sun8i-h2-plus-orangepi-zero.dts and sun8i-h2-plus-orangepi-zero-no-spi-nor.dts

No, you need sun8i-h2-plus-orangepi-zero plus an overlay for the SPI-NOR.

Quoted 5 lines

There is no way to change the setting on a runnig system, the pins are routed to the flash pads anyway so are not usable for anything else. The only thing that happens on boards that do not have the flash is kernel probing it and complaining that the ID 00 00 00 is not valid SPI NOR flash memory ID.

We have people reporting bugs about completely innocuous error messages without any side effects already. An error about a missing or broken storage device will surely raise some eyebrows.

Maxime

#4 lore raw
Quoted 36 lines · Maxime Ripard
Quoted 35 lines · Michal Suchánek
Quoted 33 lines · Maxime Ripard

Hi,

Quoted 15 lines · Michal Suchanek

The flash is present on all new boards and users went out of their way to add it on the old ones.

Enabling it makes a more reasonable default.

---
 arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts +0 -0
index f19ed981da9d..061d295bbba7 100644

arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts &ohci1 { · line 170

Quoted 10 lines
arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts +2 -2
@@ -163,8 +163,8 @@ &ohci1 {
 };
 
 &spi0 {
-	/* Disable SPI NOR by default: it optional on Orange Pi Zero boards */
-	status = "disabled";
+	/* Enable optional SPI NOR by default */
+	status = "okay";
 
 	flash@0 {
 		#address-cells = <1>;

Unfortunately, it's optional, so there's really no reason to enable it all the time. If it's troublesome to users, then the distros or vendors should make the changes necessary to the hardware, bootloader or their documentation to make it easier for those users.

Quoted 6 lines
Quoted 1 line

I don't understand the reasoning. Why must it be disabled when optional?

Think about it the other way around. If we enable everything that is optional, we're going to have a multitude of conflicts everywhere, and without a clear decision as to who is "best" and thus how we should resolve it.

Conflicts with what?

The SPI0 bus is routed the the flash memory pads. Either there is the flash mounted or there are free pads. Nothing else on the board uses these pins. You could possily solder something else there but that's definitely not part of the board.

Quoted 6 lines

On a separate platform, recently I've been using a VGA bridge for the RaspberryPi that takes the UART pins as well. It's definitely optional, should I enable it by default? At the same time, enabling by default the UART is just as arbitrary and will result in people using the VGA bridge to complain about their regression (rightfully so).

That's completely different situation. That bridge is probably not even part of the board.

Quoted 8 lines

So, really, if it's optional, it means that it not always there. If it's not always there, it's meant to be supported by an overlay.

Quoted 1 line

By the same reasoning there is no reason to disable it all the time.

I'm not sure I follow you here. The least common denominator is that it's not there, so it's not enabled.

You have two options - have a flash mounted or not. You ask why enable flash when it is not always present. By the same logic I can ask why disable it when it is not always absent. Enabling is the more useful option because it degrades gracefully in the case it is not present. It does not work the other way around.

Quoted 7 lines
Quoted 3 lines

Also the boards that do not have the flsh are either broken or obsolete.

Making general statements without arguments doesn't really make it true though. Plenty of boards to have flash and are neither broken nor obsolete.

Cannot parse this.

Quoted 8 lines
Quoted 5 lines

So most of the time enabling the flash chip is the right thing.

Or do we need two DTBs like sun8i-h2-plus-orangepi-zero.dts and sun8i-h2-plus-orangepi-zero-no-spi-nor.dts

No, you need sun8i-h2-plus-orangepi-zero plus an overlay for the SPI-NOR.

The flash is part of the board. There is no need for an overlay. And overlays don't exist.

Quoted 10 lines
Quoted 6 lines

There is no way to change the setting on a runnig system, the pins are routed to the flash pads anyway so are not usable for anything else. The only thing that happens on boards that do not have the flash is kernel probing it and complaining that the ID 00 00 00 is not valid SPI NOR flash memory ID.

We have people reporting bugs about completely innocuous error messages without any side effects already. An error about a missing or broken storage device will surely raise some eyebrows.

I am sure poeple who have an old Orange Pi Zero know that it is missing the flash memory.

Thanks

Michal

#5 lore raw
Quoted 75 lines · Michal Suchánek
Quoted 36 lines · Maxime Ripard
Quoted 35 lines · Michal Suchánek
Quoted 33 lines · Maxime Ripard

Hi,

Quoted 15 lines · Michal Suchanek

The flash is present on all new boards and users went out of their way to add it on the old ones.

Enabling it makes a more reasonable default.

---
 arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts +0 -0
index f19ed981da9d..061d295bbba7 100644

arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts &ohci1 { · line 170

Quoted 10 lines
arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts +2 -2
@@ -163,8 +163,8 @@ &ohci1 {
 };
 
 &spi0 {
-	/* Disable SPI NOR by default: it optional on Orange Pi Zero boards */
-	status = "disabled";
+	/* Enable optional SPI NOR by default */
+	status = "okay";
 
 	flash@0 {
 		#address-cells = <1>;

Unfortunately, it's optional, so there's really no reason to enable it all the time. If it's troublesome to users, then the distros or vendors should make the changes necessary to the hardware, bootloader or their documentation to make it easier for those users.

Quoted 6 lines
Quoted 1 line

I don't understand the reasoning. Why must it be disabled when optional?

Think about it the other way around. If we enable everything that is optional, we're going to have a multitude of conflicts everywhere, and without a clear decision as to who is "best" and thus how we should resolve it.

Conflicts with what?

The SPI0 bus is routed the the flash memory pads. Either there is the flash mounted or there are free pads. Nothing else on the board uses these pins. You could possily solder something else there but that's definitely not part of the board.

Quoted 6 lines

On a separate platform, recently I've been using a VGA bridge for the RaspberryPi that takes the UART pins as well. It's definitely optional, should I enable it by default? At the same time, enabling by default the UART is just as arbitrary and will result in people using the VGA bridge to complain about their regression (rightfully so).

That's completely different situation. That bridge is probably not even part of the board.

Quoted 8 lines

So, really, if it's optional, it means that it not always there. If it's not always there, it's meant to be supported by an overlay.

Quoted 1 line

By the same reasoning there is no reason to disable it all the time.

I'm not sure I follow you here. The least common denominator is that it's not there, so it's not enabled.

You have two options - have a flash mounted or not. You ask why enable flash when it is not always present. By the same logic I can ask why disable it when it is not always absent. Enabling is the more useful option because it degrades gracefully in the case it is not present. It does not work the other way around.

Quoted 1 line
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

Also the boards that do not have the flsh are either broken or obsolete.

Making general statements without arguments doesn't really make it true though. Plenty of boards to have flash and are neither broken nor obsolete.

Cannot parse this.

"Plenty of boards do not have flash and are neither broken nor obsolete"

Quoted 10 lines
Quoted 8 lines
Quoted 5 lines

So most of the time enabling the flash chip is the right thing.

Or do we need two DTBs like sun8i-h2-plus-orangepi-zero.dts and sun8i-h2-plus-orangepi-zero-no-spi-nor.dts

No, you need sun8i-h2-plus-orangepi-zero plus an overlay for the SPI-NOR.

The flash is part of the board.

Not always though.

Quoted 1 line

There is no need for an overlay.

Overlays are here to deal with the "not always though" situation...

Quoted 1 line

And overlays don't exist.

If you want to believe that, please go ahead.

But there's support for it in libfdt, and you can either apply them directly through the U-Boot command line, or bundle them in a FIT image.

Plenty of support for something that doesn't exist.

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines

There is no way to change the setting on a runnig system, the pins are routed to the flash pads anyway so are not usable for anything else. The only thing that happens on boards that do not have the flash is kernel probing it and complaining that the ID 00 00 00 is not valid SPI NOR flash memory ID.

Quoted 6 lines
Quoted 3 lines

We have people reporting bugs about completely innocuous error messages without any side effects already. An error about a missing or broken storage device will surely raise some eyebrows.

I am sure poeple who have an old Orange Pi Zero know that it is missing the flash memory.

Do you really expect every single user on an Orange Pi Zero to know exactly the revision it has and whether or not it's been bundled with a SPI flash if it's the older ones (with the proper definition of older ones)?

Maxime

#6 lore raw
Quoted 79 lines · Maxime Ripard
Quoted 78 lines · Michal Suchánek
Quoted 36 lines · Maxime Ripard
Quoted 35 lines · Michal Suchánek
Quoted 33 lines · Maxime Ripard

Hi,

Quoted 15 lines · Michal Suchanek

The flash is present on all new boards and users went out of their way to add it on the old ones.

Enabling it makes a more reasonable default.

---
 arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts +0 -0
index f19ed981da9d..061d295bbba7 100644

arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts &ohci1 { · line 170

Quoted 10 lines
arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts +2 -2
@@ -163,8 +163,8 @@ &ohci1 {
 };
 
 &spi0 {
-	/* Disable SPI NOR by default: it optional on Orange Pi Zero boards */
-	status = "disabled";
+	/* Enable optional SPI NOR by default */
+	status = "okay";
 
 	flash@0 {
 		#address-cells = <1>;

Unfortunately, it's optional, so there's really no reason to enable it all the time. If it's troublesome to users, then the distros or vendors should make the changes necessary to the hardware, bootloader or their documentation to make it easier for those users.

Quoted 6 lines
Quoted 1 line

I don't understand the reasoning. Why must it be disabled when optional?

Think about it the other way around. If we enable everything that is optional, we're going to have a multitude of conflicts everywhere, and without a clear decision as to who is "best" and thus how we should resolve it.

Conflicts with what?

The SPI0 bus is routed the the flash memory pads. Either there is the flash mounted or there are free pads. Nothing else on the board uses these pins. You could possily solder something else there but that's definitely not part of the board.

Quoted 6 lines

On a separate platform, recently I've been using a VGA bridge for the RaspberryPi that takes the UART pins as well. It's definitely optional, should I enable it by default? At the same time, enabling by default the UART is just as arbitrary and will result in people using the VGA bridge to complain about their regression (rightfully so).

That's completely different situation. That bridge is probably not even part of the board.

Quoted 8 lines

So, really, if it's optional, it means that it not always there. If it's not always there, it's meant to be supported by an overlay.

Quoted 1 line

By the same reasoning there is no reason to disable it all the time.

I'm not sure I follow you here. The least common denominator is that it's not there, so it's not enabled.

You have two options - have a flash mounted or not. You ask why enable flash when it is not always present. By the same logic I can ask why disable it when it is not always absent. Enabling is the more useful option because it degrades gracefully in the case it is not present. It does not work the other way around.

Quoted 4 lines
Quoted 3 lines

Also the boards that do not have the flsh are either broken or obsolete.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

Making general statements without arguments doesn't really make it true though. Plenty of boards to have flash and are neither broken nor obsolete.

Cannot parse this.

"Plenty of boards do not have flash and are neither broken nor obsolete"

The product description of Orange Pi Zero clearly states there is a flash memory: http://www.orangepi.org/orangepizero/

When you order an Orange Pi Zero it comes with a flash memory. That is not what the device tree describes. The device tree is supposed to descrbe the hardware. If it does not it is broken.

If you have a board without a flash memory I do not know what it is but it is clearly not an Orange Pi Zero because it comes with one.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines

So most of the time enabling the flash chip is the right thing.

Or do we need two DTBs like sun8i-h2-plus-orangepi-zero.dts and sun8i-h2-plus-orangepi-zero-no-spi-nor.dts

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

No, you need sun8i-h2-plus-orangepi-zero plus an overlay for the SPI-NOR.

The flash is part of the board.

Not always though.

No, it always comes with one. You must be speaking of a different board then.

Quoted 4 lines
Quoted 2 lines

There is no need for an overlay.

Overlays are here to deal with the "not always though" situation...

There are no overlays in the kernel. Please show me tho code in the kernel for handling overlays.

Quoted 7 lines
Quoted 2 lines

And overlays don't exist.

If you want to believe that, please go ahead.

But there's support for it in libfdt, and you can either apply them directly through the U-Boot command line, or bundle them in a FIT image.

And as you state the user ususally does not know which version of the Pi they have. How are they supposed to know that they should apply an overlay through u-boot commandline (if they even get to see one) or bundle them in a FIT image (if they are even using a FIT image).

I am doing neither. I boot a standard distribution kernel from EFI grub.

I understand that it would be nice to support two almost identical boards with a single device tree. However, if an error about missing flash memory is not acceptable, and the kernel does not support enabling the flash memory dynamically we need two device trees then.

Quoted 14 lines

Plenty of support for something that doesn't exist.

Quoted 11 lines
Quoted 10 lines
Quoted 6 lines

There is no way to change the setting on a runnig system, the pins are routed to the flash pads anyway so are not usable for anything else. The only thing that happens on boards that do not have the flash is kernel probing it and complaining that the ID 00 00 00 is not valid SPI NOR flash memory ID.

We have people reporting bugs about completely innocuous error messages without any side effects already. An error about a missing or broken storage device will surely raise some eyebrows.

Quoted 7 lines
Quoted 2 lines

I am sure poeple who have an old Orange Pi Zero know that it is missing the flash memory.

Do you really expect every single user on an Orange Pi Zero to know exactly the revision it has and whether or not it's been bundled with a SPI flash if it's the older ones (with the proper definition of older ones)?

And how is the user supposed to tell when the flash is disabled and thre is no way to enable it?

Thanks

Michal

#7 lore raw
Quoted 14 lines · Michal Suchánek
Quoted 11 lines
Quoted 9 lines
Quoted 7 lines
Quoted 3 lines

Also the boards that do not have the flsh are either broken or obsolete.

Making general statements without arguments doesn't really make it true though. Plenty of boards to have flash and are neither broken nor obsolete.

Cannot parse this.

"Plenty of boards do not have flash and are neither broken nor obsolete"

The product description of Orange Pi Zero clearly states there is a flash memory: http://www.orangepi.org/orangepizero/

Quoted 6 lines

When you order an Orange Pi Zero it comes with a flash memory. That is not what the device tree describes. The device tree is supposed to descrbe the hardware. If it does not it is broken.

If you have a board without a flash memory I do not know what it is but it is clearly not an Orange Pi Zero because it comes with one.

If you're buying it today, yes. If you take a random Orange Pi Zero that has been sold at any point in time, you cannot make that statement.

Quoted 15 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

So most of the time enabling the flash chip is the right thing.

Or do we need two DTBs like sun8i-h2-plus-orangepi-zero.dts and sun8i-h2-plus-orangepi-zero-no-spi-nor.dts

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

No, you need sun8i-h2-plus-orangepi-zero plus an overlay for the SPI-NOR.

The flash is part of the board.

Not always though.

No, it always comes with one. You must be speaking of a different board then.

Quoted 1 line
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

There is no need for an overlay.

Overlays are here to deal with the "not always though" situation...

There are no overlays in the kernel. Please show me tho code in the kernel for handling overlays.

You're the one that mentioned the kernel here, but here you are:
https://elixir.bootlin.com/linux/v5.9.1/source/include/linux/of.h#L1455

And a driver using it:
https://elixir.bootlin.com/linux/v5.9.1/source/drivers/gpu/drm/rcar-du/rcar_du_of.c#L44

Quoted 10 lines
Quoted 6 lines
Quoted 1 line

And overlays don't exist.

If you want to believe that, please go ahead.

But there's support for it in libfdt, and you can either apply them directly through the U-Boot command line, or bundle them in a FIT image.

And as you state the user ususally does not know which version of the Pi they have. How are they supposed to know that they should apply an overlay through u-boot commandline (if they even get to see one)

Documentation?

Quoted 1 line

bundle them in a FIT image (if they are even using a FIT image).

That would be the distro's job, not the user's.

Quoted 7 lines

I am doing neither. I boot a standard distribution kernel from EFI grub.

I understand that it would be nice to support two almost identical boards with a single device tree. However, if an error about missing flash memory is not acceptable, and the kernel does not support enabling the flash memory dynamically we need two device trees then.

You keep moving the goalposts, but U-boot is perfectly able to apply an overlay automatically at boot without the user's intervention. We're already making it select various DTs for the pine64 and pine64+ to have a single image for both, or for the pinephone variants.

Maxime