devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm: dts: vexpress-v2p-ca15_a7: disable NOR flash node by default
@ 2019-05-30  9:11 Sudeep Holla
  2019-05-30 10:50 ` Linus Walleij
  0 siblings, 1 reply; 3+ messages in thread
From: Sudeep Holla @ 2019-05-30  9:11 UTC (permalink / raw)
  To: linux-arm-kernel, devicetree
  Cc: Linus Walleij, Lorenzo Pieralisi, Liviu Dudau, Sudeep Holla

Accessing the NOR flash memory from the kernel will disrupt CPU sleep/
idles states and CPU hotplugging. We need to disable this DT node by
default. Setups that want to access the flash can modify this entry to
enable the flash again but also ensuring to disable CPU idle states and
CPU hotplug.

The platform firmware assumes the flash is always in read mode while
Linux kernel driver leaves NOR flash in "read id" mode after
initialization. If it gets used actively, it can be in some other state.

So far we had not seen this issue as the NOR flash drivers in kernel
were not enabled by default. However it was enable in multi_v7 config by
Commit 5f068190cc10 ("ARM: multi_v7_defconfig: Enable support for CFI NOR FLASH")

So, let's mark the NOR flash disabled so that the platform can boot
again. This based on:
Commit 980bbff018f6 ("ARM64: juno: disable NOR flash node by default")

Cc: Liviu Dudau <liviu.dudau@arm.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
---
 arch/arm/boot/dts/vexpress-v2m-rs1.dtsi    | 2 +-
 arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts | 9 +++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/vexpress-v2m-rs1.dtsi b/arch/arm/boot/dts/vexpress-v2m-rs1.dtsi
index d3963e9eaf48..1b5bc536c547 100644
--- a/arch/arm/boot/dts/vexpress-v2m-rs1.dtsi
+++ b/arch/arm/boot/dts/vexpress-v2m-rs1.dtsi
@@ -30,7 +30,7 @@
 			#interrupt-cells = <1>;
 			ranges;
 
-			flash@0,00000000 {
+			nor_flash: flash@0,00000000 {
 				compatible = "arm,vexpress-flash", "cfi-flash";
 				reg = <0 0x00000000 0x04000000>,
 				      <4 0x00000000 0x04000000>;
diff --git a/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts b/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts
index 164c904c9992..1de0a658adf1 100644
--- a/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts
+++ b/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts
@@ -680,3 +680,12 @@
 				<0 3 &gic 0 39 4>;
 	};
 };
+
+&nor_flash {
+	/*
+	 * Unfortunately, accessing the flash disturbs the CPU idle states
+	 * (suspend) and CPU hotplug of this platform. For this reason, flash
+	 * hardware access is disabled by default on this platform alone.
+	 */
+	status = "disabled";
+};
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] arm: dts: vexpress-v2p-ca15_a7: disable NOR flash node by default
  2019-05-30  9:11 [PATCH] arm: dts: vexpress-v2p-ca15_a7: disable NOR flash node by default Sudeep Holla
@ 2019-05-30 10:50 ` Linus Walleij
  2019-05-30 11:01   ` Sudeep Holla
  0 siblings, 1 reply; 3+ messages in thread
From: Linus Walleij @ 2019-05-30 10:50 UTC (permalink / raw)
  To: Sudeep Holla
  Cc: open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Lorenzo Pieralisi, Liviu Dudau, Linux ARM

On Thu, May 30, 2019 at 11:11 AM Sudeep Holla <sudeep.holla@arm.com> wrote:

> Accessing the NOR flash memory from the kernel will disrupt CPU sleep/
> idles states and CPU hotplugging. We need to disable this DT node by
> default. Setups that want to access the flash can modify this entry to
> enable the flash again but also ensuring to disable CPU idle states and
> CPU hotplug.
>
> The platform firmware assumes the flash is always in read mode while
> Linux kernel driver leaves NOR flash in "read id" mode after
> initialization. If it gets used actively, it can be in some other state.
>
> So far we had not seen this issue as the NOR flash drivers in kernel
> were not enabled by default. However it was enable in multi_v7 config by
> Commit 5f068190cc10 ("ARM: multi_v7_defconfig: Enable support for CFI NOR FLASH")
>
> So, let's mark the NOR flash disabled so that the platform can boot
> again. This based on:
> Commit 980bbff018f6 ("ARM64: juno: disable NOR flash node by default")
>
> Cc: Liviu Dudau <liviu.dudau@arm.com>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

It's a bit sad that this cannot be easily fixed (I don't know if it can even
be fixed with firmware updates?), it's kind of useful to be able to
update the flash from within Linux, as that mimics what pretty much
every IoT device (such as routers) is doing and would be nince for
an OpenWrt port.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] arm: dts: vexpress-v2p-ca15_a7: disable NOR flash node by default
  2019-05-30 10:50 ` Linus Walleij
@ 2019-05-30 11:01   ` Sudeep Holla
  0 siblings, 0 replies; 3+ messages in thread
From: Sudeep Holla @ 2019-05-30 11:01 UTC (permalink / raw)
  To: Linus Walleij
  Cc: open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Lorenzo Pieralisi, Liviu Dudau, Linux ARM, Sudeep Holla

On Thu, May 30, 2019 at 12:50:12PM +0200, Linus Walleij wrote:
> On Thu, May 30, 2019 at 11:11 AM Sudeep Holla <sudeep.holla@arm.com> wrote:
> 
> > Accessing the NOR flash memory from the kernel will disrupt CPU sleep/
> > idles states and CPU hotplugging. We need to disable this DT node by
> > default. Setups that want to access the flash can modify this entry to
> > enable the flash again but also ensuring to disable CPU idle states and
> > CPU hotplug.
> >
> > The platform firmware assumes the flash is always in read mode while
> > Linux kernel driver leaves NOR flash in "read id" mode after
> > initialization. If it gets used actively, it can be in some other state.
> >
> > So far we had not seen this issue as the NOR flash drivers in kernel
> > were not enabled by default. However it was enable in multi_v7 config by
> > Commit 5f068190cc10 ("ARM: multi_v7_defconfig: Enable support for CFI NOR FLASH")
> >
> > So, let's mark the NOR flash disabled so that the platform can boot
> > again. This based on:
> > Commit 980bbff018f6 ("ARM64: juno: disable NOR flash node by default")
> >
> > Cc: Liviu Dudau <liviu.dudau@arm.com>
> > Cc: Linus Walleij <linus.walleij@linaro.org>
> > Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> > Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
>
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
>

Thanks.

> It's a bit sad that this cannot be easily fixed (I don't know if it can even
> be fixed with firmware updates?), it's kind of useful to be able to
> update the flash from within Linux, as that mimics what pretty much
> every IoT device (such as routers) is doing and would be nince for
> an OpenWrt port.
>

IMO, it issue with partitioning of the system. Basically these traditional
NOR flash don't support partitions at hardware level so that one accessed
by firmware/secure side is protected from another accessed from non-secure.

I like the eMMC boot partitions in that ways as these are hardware
partitions and the device state is separate for these.

Also, ideally firmware/secure side should just restrict themselves to
Secure ROM, but as a record we consistently ensure firmware on SROM is
busted and use non-secure ROM/NOR Flash as bypass :) which then makes
it tricky to deal with such scenarios in Linux. Hope we fill have some
system with everything working *one day* :D

--
Regards,
Sudeep

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-05-30 11:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-30  9:11 [PATCH] arm: dts: vexpress-v2p-ca15_a7: disable NOR flash node by default Sudeep Holla
2019-05-30 10:50 ` Linus Walleij
2019-05-30 11:01   ` Sudeep Holla

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).