[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7d7595a0a33b4e56828beea86f6037bd9ecc8f8d.camel@collabora.com>
Date: Thu, 30 Oct 2025 22:26:00 +0100
From: Sjoerd Simons <sjoerd@...labora.com>
To: AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>,
Rob Herring <robh@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>, Matthias Brugger
<matthias.bgg@...il.com>, Ryder Lee <ryder.lee@...iatek.com>, Jianjun Wang
<jianjun.wang@...iatek.com>, Bjorn Helgaas <bhelgaas@...gle.com>, Lorenzo
Pieralisi <lpieralisi@...nel.org>, Krzysztof Wilczyński
<kwilczynski@...nel.org>, Manivannan Sadhasivam <mani@...nel.org>,
Chunfeng Yun <chunfeng.yun@...iatek.com>, Vinod Koul <vkoul@...nel.org>,
Kishon Vijay Abraham I <kishon@...nel.org>, Lee Jones <lee@...nel.org>,
Andrew Lunn <andrew+netdev@...n.ch>, "David S. Miller"
<davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski
<kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, Lorenzo Bianconi
<lorenzo@...nel.org>, Felix Fietkau <nbd@....name>
Cc: kernel@...labora.com, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org, linux-pci@...r.kernel.org,
linux-phy@...ts.infradead.org, netdev@...r.kernel.org, Daniel Golle
<daniel@...rotopia.org>, Bryan Hinton <bryan@...anhinton.com>
Subject: Re: [PATCH 11/15] arm64: dts: mediatek: mt7981b-openwrt-one: Enable
SPI NOR
On Thu, 2025-10-16 at 13:28 +0200, AngeloGioacchino Del Regno wrote:
> Il 16/10/25 12:08, Sjoerd Simons ha scritto:
> > 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@...labora.com>
> > ---
> > .../boot/dts/mediatek/mt7981b-openwrt-one.dts | 83 ++++++++++++++++++++++
> > 1 file changed, 83 insertions(+)
> >
> > diff --git a/arch/arm64/boot/dts/mediatek/mt7981b-openwrt-one.dts
> > b/arch/arm64/boot/dts/mediatek/mt7981b-openwrt-one.dts
> > index b6ca628ee72fd..9878009385cc6 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";
> > @@ -54,6 +55,25 @@ mux {
> > };
> > };
> >
> > + spi2_flash_pins: spi2-pins {
> > + mux {
> > + function = "spi";
> > + groups = "spi2";
> > + };
> > +
> > + conf-pu {
> > + bias-pull-up = <MTK_PUPD_SET_R1R0_11>;
> > + drive-strength = <MTK_DRIVE_8mA>;
>
> drive-strength = <8>;
>
> > + pins = "SPI2_CS", "SPI2_WP";
> > + };
> > +
> > + conf-pd {
> > + bias-pull-down = <MTK_PUPD_SET_R1R0_11>;
> > + drive-strength = <MTK_DRIVE_8mA>;
>
> ditto
>
> > + pins = "SPI2_CLK", "SPI2_MOSI", "SPI2_MISO";
> > + };
> > + };
> > +
> > uart0_pins: uart0-pins {
> > mux {
> > function = "uart";
> > @@ -62,6 +82,69 @@ mux {
> > };
> > };
> >
> > +&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@...00 {
> > + reg = <0x40000 0xc0000>;
> > + label = "factory";
> > + read-only;
> > +
> > + nvmem-layout {
> > + compatible = "fixed-layout";
> > + #address-cells = <1>;
> > + #size-cells = <1>;
> > +
> > + eeprom_factory_0: eeprom@0 {
>
> wifi_calibration:
>
> > + reg = <0x0 0x1000>;
> > + };
> > +
> > + macaddr_factory_4: macaddr@4 {
>
> macaddr_factory_gmac1?
>
> You're not using this in the later commit where you enable ethernet nodes,
> did you miss adding that to gmac1 or what is this used for?
gmac1 gets its mac from u-boot, passed in through device-tree; Haven't checked where u-boot gets it
from yet. I did spot it at offset 0x2a in this factory data, so that seems likely candidate.
However this particular mac is used by the wifi phy. I discovered after sending this patch the kernel
driver loads it directly from the "eeprom" area, so we could potentially drop this node.
As mentioned in the commit message, I kept the same layouts as openwrt uses. Though i'd be fine to
minimize the nvmem cells just to what's referenced in the dtb.
> > + reg = <0x4 0x6>;
> > + compatible = "mac-base";
> > + #nvmem-cell-cells = <1>;
> > + };
> > +
> > + macaddr_factory_24: macaddr@24 {
>
> macaddr_factory_gmac0 ?
That seems nicer, will add that in V2 (same for the previous naming suggestion)
--
Sjoerd Simons
Collabora Ltd.
Powered by blists - more mailing lists