public inbox for linux-mediatek@lists.infradead.org
 help / color / mirror / Atom feed
From: Sjoerd Simons <sjoerd@collabora.com>
To: "Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Matthias Brugger" <matthias.bgg@gmail.com>,
	"AngeloGioacchino Del Regno"
	<angelogioacchino.delregno@collabora.com>,
	"Ryder Lee" <ryder.lee@mediatek.com>,
	"Jianjun Wang" <jianjun.wang@mediatek.com>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
	"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
	"Manivannan Sadhasivam" <mani@kernel.org>,
	"Chunfeng Yun" <chunfeng.yun@mediatek.com>,
	"Vinod Koul" <vkoul@kernel.org>,
	"Kishon Vijay Abraham I" <kishon@kernel.org>,
	"Lee Jones" <lee@kernel.org>,
	"Andrew Lunn" <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Lorenzo Bianconi" <lorenzo@kernel.org>,
	"Felix Fietkau" <nbd@nbd.name>
Cc: kernel@collabora.com, devicetree@vger.kernel.org,
	 linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	 linux-mediatek@lists.infradead.org, linux-pci@vger.kernel.org,
	 linux-phy@lists.infradead.org, netdev@vger.kernel.org,
	 Daniel Golle <daniel@makrotopia.org>,
	Bryan Hinton <bryan@bryanhinton.com>,
	 Sjoerd Simons <sjoerd@collabora.com>
Subject: [PATCH v2 10/15] arm64: dts: mediatek: mt7981b-openwrt-one: Enable SPI NOR
Date: Sat, 01 Nov 2025 14:32:55 +0100	[thread overview]
Message-ID: <20251101-openwrt-one-network-v2-10-2a162b9eea91@collabora.com> (raw)
In-Reply-To: <20251101-openwrt-one-network-v2-0-2a162b9eea91@collabora.com>

The openwrt one has a SPI NOR flash which from factory is used for:
* Recovery system
* WiFi eeprom data
* ethernet Mac addresses

Describe this following the same partitions as the openwrt configuration
uses.

Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>
---
V1 -> V2:
  - Use numeric drive-strength values rather then defines
  - Make nvmem cell labers more meaningfull
  - Only define nvmem cells used in later patches by devicetree
---
 .../boot/dts/mediatek/mt7981b-openwrt-one.dts      | 77 ++++++++++++++++++++++
 arch/arm64/boot/dts/mediatek/mt7981b.dtsi          |  2 +-
 2 files changed, 78 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/mediatek/mt7981b-openwrt-one.dts b/arch/arm64/boot/dts/mediatek/mt7981b-openwrt-one.dts
index 5834273839c17..183e48d985ed7 100644
--- a/arch/arm64/boot/dts/mediatek/mt7981b-openwrt-one.dts
+++ b/arch/arm64/boot/dts/mediatek/mt7981b-openwrt-one.dts
@@ -3,6 +3,7 @@
 /dts-v1/;
 
 #include "mt7981b.dtsi"
+#include "dt-bindings/pinctrl/mt65xx.h"
 
 / {
 	compatible = "openwrt,one", "mediatek,mt7981b";
@@ -53,6 +54,82 @@ mux {
 			groups = "pcie_pereset";
 		};
 	};
+
+	spi2_flash_pins: spi2-pins {
+		mux {
+			function = "spi";
+			groups = "spi2";
+		};
+
+		conf-pu {
+			bias-pull-up = <MTK_PUPD_SET_R1R0_11>;
+			drive-strength = <8>;
+			pins = "SPI2_CS", "SPI2_WP";
+		};
+
+		conf-pd {
+			bias-pull-down = <MTK_PUPD_SET_R1R0_11>;
+			drive-strength = <8>;
+			pins = "SPI2_CLK", "SPI2_MOSI", "SPI2_MISO";
+		};
+	};
+};
+
+&spi2 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&spi2_flash_pins>;
+	status = "okay";
+
+	flash@0 {
+		compatible = "jedec,spi-nor";
+		reg = <0>;
+		spi-max-frequency = <40000000>;
+		#address-cells = <1>;
+		#size-cells = <1>;
+
+		partitions {
+			compatible = "fixed-partitions";
+			#address-cells = <1>;
+			#size-cells = <1>;
+
+			partition@0 {
+				reg = <0x00000 0x40000>;
+				label = "bl2-nor";
+			};
+
+			partition@40000 {
+				reg = <0x40000 0xc0000>;
+				label = "factory";
+				read-only;
+
+				nvmem-layout {
+					compatible = "fixed-layout";
+					#address-cells = <1>;
+					#size-cells = <1>;
+
+					wifi_factory_calibration: eeprom@0 {
+						reg = <0x0 0x1000>;
+					};
+
+					wan_factory_mac: macaddr@24 {
+						reg = <0x24 0x6>;
+						compatible = "mac-base";
+						#nvmem-cell-cells = <1>;
+					};
+				};
+			};
+
+			partition@100000 {
+				reg = <0x100000 0x80000>;
+				label = "fip-nor";
+			};
+
+			partition@180000 {
+				reg = <0x180000 0xc80000>;
+				label = "recovery";
+			};
+		};
+	};
 };
 
 &uart0 {
diff --git a/arch/arm64/boot/dts/mediatek/mt7981b.dtsi b/arch/arm64/boot/dts/mediatek/mt7981b.dtsi
index 3510a26cb5112..2c9819f28fdc2 100644
--- a/arch/arm64/boot/dts/mediatek/mt7981b.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt7981b.dtsi
@@ -195,7 +195,7 @@ i2c@11007000 {
 			status = "disabled";
 		};
 
-		spi@11009000 {
+		spi2: spi@11009000 {
 			compatible = "mediatek,mt7981-spi-ipm", "mediatek,spi-ipm";
 			reg = <0 0x11009000 0 0x1000>;
 			interrupts = <GIC_SPI 142 IRQ_TYPE_LEVEL_HIGH>;

-- 
2.51.0



  parent reply	other threads:[~2025-11-01 13:33 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-01 13:32 [PATCH v2 00/15] arm64: dts: mediatek: Add Openwrt One AP functionality Sjoerd Simons
2025-11-01 13:32 ` [PATCH v2 01/15] arm64: dts: mediatek: mt7981b: Configure UART0 pinmux Sjoerd Simons
2025-11-01 13:32 ` [PATCH v2 02/15] arm64: dts: mediatek: mt7981b: Add reserved memory for TF-A Sjoerd Simons
2025-11-01 13:32 ` [PATCH v2 03/15] dt-bindings: mfd: syscon: Add mt7981-topmisc Sjoerd Simons
2025-11-01 13:32 ` [PATCH v2 04/15] dt-bindings: PCI: mediatek-gen3: Add MT7981 PCIe compatible Sjoerd Simons
2025-11-01 13:32 ` [PATCH v2 05/15] dt-bindings: phy: mediatek,tphy: Add support for MT7981 Sjoerd Simons
2025-11-01 13:32 ` [PATCH v2 06/15] arm64: dts: mediatek: mt7981b: Add PCIe and USB support Sjoerd Simons
2025-11-01 13:32 ` [PATCH v2 07/15] arm64: dts: mediatek: mt7981b-openwrt-one: Enable PCIe and USB Sjoerd Simons
2025-11-01 13:32 ` [PATCH v2 08/15] dt-bindings: net: mediatek,net: Correct bindings for MT7981 Sjoerd Simons
2025-11-02 16:34   ` Krzysztof Kozlowski
2025-11-03  8:43   ` AngeloGioacchino Del Regno
2025-11-01 13:32 ` [PATCH v2 09/15] arm64: dts: mediatek: mt7981b: Add Ethernet and WiFi offload support Sjoerd Simons
2025-11-01 13:32 ` Sjoerd Simons [this message]
2025-11-01 13:32 ` [PATCH v2 11/15] arm64: dts: mediatek: mt7981b-openwrt-one: Enable Ethernet Sjoerd Simons
2025-11-01 13:32 ` [PATCH v2 12/15] arm64: dts: mediatek: mt7981b: Disable wifi by default Sjoerd Simons
2025-11-01 13:32 ` [PATCH v2 13/15] arm64: dts: mediatek: mt7981b: Add wifi memory region Sjoerd Simons
2025-11-01 13:32 ` [PATCH v2 14/15] arm64: dts: mediatek: mt7981b-openwrt-one: Enable wifi Sjoerd Simons
2025-11-03  8:44   ` AngeloGioacchino Del Regno
2025-11-01 13:33 ` [PATCH v2 15/15] arm64: dts: mediatek: mt7981b-openwrt-one: Enable software leds Sjoerd Simons
2025-11-03  8:56 ` [PATCH v2 00/15] arm64: dts: mediatek: Add Openwrt One AP functionality AngeloGioacchino Del Regno
2025-11-05  9:02 ` (subset) " AngeloGioacchino Del Regno

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251101-openwrt-one-network-v2-10-2a162b9eea91@collabora.com \
    --to=sjoerd@collabora.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=bhelgaas@google.com \
    --cc=bryan@bryanhinton.com \
    --cc=chunfeng.yun@mediatek.com \
    --cc=conor+dt@kernel.org \
    --cc=daniel@makrotopia.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@google.com \
    --cc=jianjun.wang@mediatek.com \
    --cc=kernel@collabora.com \
    --cc=kishon@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=kuba@kernel.org \
    --cc=kwilczynski@kernel.org \
    --cc=lee@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=lorenzo@kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=mani@kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=nbd@nbd.name \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=robh@kernel.org \
    --cc=ryder.lee@mediatek.com \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox