From nobody Thu Apr 9 17:58:36 2026 Received: from mail.cjdns.fr (mail.cjdns.fr [5.135.140.105]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F27F0382F12; Tue, 3 Mar 2026 19:10:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=5.135.140.105 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772565025; cv=none; b=MVWl1cljSsJwcE3P3exKDskZ1p/W/U25s5srXwVlR/KXVgiIs772PoMS4xue7iTgA0Vj76ACga0GGBJEwp2MgWJ1s0RXpFKQGOur5aMPRyTIzmyruxoSZw8aB3o9XC9pp8DvhWG6jiANL6oisIPfdXlX1h8v/95NTpujDOUnVGE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772565025; c=relaxed/simple; bh=n91FalRZ1EC02YLJrRvyn2sLuZTyyP4MPd/eqNnP1Kk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=rm7O9J+Q+JCUykb7GRJvNroBmtmqYA8VqoGKgx2f0eZMTuECtQATHO+TXzAWS2BCckvw7whLlIVn1ojKaxc0R8gHlSC8q/R0/T3ZcYTJDlXRHuQRkv0RNPlfA4mLTDVVVxq/4wVZ0BM7Tzo8Ppc/eXwsQ4CRQgZoN0+SdB7sLlY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cjdns.fr; spf=pass smtp.mailfrom=cjdns.fr; dkim=pass (2048-bit key) header.d=cjdns.fr header.i=@cjdns.fr header.b=ksl3EWxV; arc=none smtp.client-ip=5.135.140.105 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cjdns.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cjdns.fr Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cjdns.fr header.i=@cjdns.fr header.b="ksl3EWxV" Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 5FC0420CBF0; Tue, 3 Mar 2026 20:10:18 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cjdns.fr; s=dkim; t=1772565021; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=A82tQnKaCSOjoGsjoAObd55xvw1zvDTyvCELotse1aY=; b=ksl3EWxV8AvEJZydZKYVMHd5VL7PqR+R/Hz9AtHHhreh2w+gwnprRJJvKu9UmT77gJZz/F 8Hdv5j7NpYjcB8ga7uTIQj9B4ytT6G2aTg5i8eSgiTuI2CAOvEhSZFnCjTq6bRJxksVfmF ul9KJoIWT9iUTgw4PpbbbUXDxOIcwb7QjSTLl8jE8Xn2TR9+4c/QLKP5pV6DBSLf9U177c IeVyu11DuEkyf59/+OcxODzLcNRZyWJCfLSLlHWXLpoIbH60i2xrf74r5N7E8Hj8c6AG4+ K9VP3sG9lbIJYV/+1OhlhGyK+E1U/oMyNlYtS7zTebAsIUcSHWy/GGK6Lz6mdA== From: Caleb James DeLisle To: linux-mips@vger.kernel.org Cc: naseefkm@gmail.com, mturquette@baylibre.com, sboyd@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, cjd@cjdns.fr, tsbogend@alpha.franken.de, ryder.lee@mediatek.com, jianjun.wang@mediatek.com, lpieralisi@kernel.org, kwilczynski@kernel.org, mani@kernel.org, bhelgaas@google.com, vkoul@kernel.org, neil.armstrong@linaro.org, p.zabel@pengutronix.de, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, nbd@nbd.name, ansuelsmth@gmail.com, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/8] dt-bindings: clock, reset: Add econet EN751221 bindings Date: Tue, 3 Mar 2026 19:09:41 +0000 Message-Id: <20260303190948.694783-2-cjd@cjdns.fr> In-Reply-To: <20260303190948.694783-1-cjd@cjdns.fr> References: <20260303190948.694783-1-cjd@cjdns.fr> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Content-Type: text/plain; charset="utf-8" Add clock and reset bindings for EN751221 as well as a "chip-scu" which is an additional regmap that is used by the clock driver as well as others. This split of the SCU across two register areas is the same as the Airoha AN758x family. Signed-off-by: Caleb James DeLisle --- .../bindings/clock/airoha,en7523-scu.yaml | 19 ++++++- .../mips/econet,en751221-chip-scu.yaml | 41 ++++++++++++++++ MAINTAINERS | 3 ++ .../dt-bindings/clock/econet,en751221-scu.h | 15 ++++++ .../dt-bindings/reset/econet,en751221-scu.h | 49 +++++++++++++++++++ 5 files changed, 126 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/mips/econet,en751221-= chip-scu.yaml create mode 100644 include/dt-bindings/clock/econet,en751221-scu.h create mode 100644 include/dt-bindings/reset/econet,en751221-scu.h diff --git a/Documentation/devicetree/bindings/clock/airoha,en7523-scu.yaml= b/Documentation/devicetree/bindings/clock/airoha,en7523-scu.yaml index a8471367175b..e60e54273393 100644 --- a/Documentation/devicetree/bindings/clock/airoha,en7523-scu.yaml +++ b/Documentation/devicetree/bindings/clock/airoha,en7523-scu.yaml @@ -32,6 +32,7 @@ properties: - enum: - airoha,en7523-scu - airoha,en7581-scu + - econet,en751221-scu =20 reg: items: @@ -67,7 +68,10 @@ allOf: - if: properties: compatible: - const: airoha,en7581-scu + items: + - enum: + - airoha,en7581-scu + - econet,en751221-scu then: properties: reg: @@ -98,3 +102,16 @@ examples: #reset-cells =3D <1>; }; }; + + - | + soc { + #address-cells =3D <1>; + #size-cells =3D <1>; + + scuclk2: clock-controller@1fb00000 { + compatible =3D "econet,en751221-scu"; + reg =3D <0x1fb00000 0x970>; + #clock-cells =3D <1>; + #reset-cells =3D <1>; + }; + }; diff --git a/Documentation/devicetree/bindings/mips/econet,en751221-chip-sc= u.yaml b/Documentation/devicetree/bindings/mips/econet,en751221-chip-scu.ya= ml new file mode 100644 index 000000000000..7c7c8cf8d2a5 --- /dev/null +++ b/Documentation/devicetree/bindings/mips/econet,en751221-chip-scu.yaml @@ -0,0 +1,41 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mips/econet,en751221-chip-scu.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: EcoNet Chip SCU Controller for EN751221 SoC + +maintainers: + - Caleb James DeLisle + +description: + The EcoNet chip-scu block provides a configuration interface for clock, + io-muxing and other functionalities used by multiple controllers (e.g. c= lock, + pinctrl, ecc) on EN751221 SoC. + +properties: + compatible: + items: + - const: econet,en751221-chip-scu + - const: syscon + + reg: + maxItems: 1 + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + soc { + #address-cells =3D <1>; + #size-cells =3D <1>; + syscon@1fa20000 { + compatible =3D "econet,en751221-chip-scu", "syscon"; + reg =3D <0x1fa20000 0x388>; + }; + }; diff --git a/MAINTAINERS b/MAINTAINERS index 14899f1de77e..56cf73ce91b8 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -9113,12 +9113,15 @@ M: Caleb James DeLisle L: linux-mips@vger.kernel.org S: Maintained F: Documentation/devicetree/bindings/interrupt-controller/econet,en751221-= intc.yaml +F: Documentation/devicetree/bindings/mips/econet,en751221-chip-scu.yaml F: Documentation/devicetree/bindings/mips/econet.yaml F: Documentation/devicetree/bindings/timer/econet,en751221-timer.yaml F: arch/mips/boot/dts/econet/ F: arch/mips/econet/ F: drivers/clocksource/timer-econet-en751221.c F: drivers/irqchip/irq-econet-en751221.c +F: include/dt-bindings/clock/econet,en751221-scu.h +F: include/dt-bindings/reset/econet,en751221-scu.h =20 ECRYPT FILE SYSTEM M: Tyler Hicks diff --git a/include/dt-bindings/clock/econet,en751221-scu.h b/include/dt-b= indings/clock/econet,en751221-scu.h new file mode 100644 index 000000000000..34179b8fe2f9 --- /dev/null +++ b/include/dt-bindings/clock/econet,en751221-scu.h @@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */ + +#ifndef _DT_BINDINGS_CLOCK_ECONET_EN751221_SCU_H_ +#define _DT_BINDINGS_CLOCK_ECONET_EN751221_SCU_H_ + +#define EN751221_CLK_PCIE 0 +#define EN751221_CLK_SPI 1 +#define EN751221_CLK_BUS 2 +#define EN751221_CLK_CPU 3 +#define EN751221_CLK_HPT 4 +#define EN751221_CLK_GSW 5 + +#define EN751221_MAX_CLKS 6 + +#endif /* _DT_BINDINGS_CLOCK_ECONET_EN751221_SCU_H_ */ diff --git a/include/dt-bindings/reset/econet,en751221-scu.h b/include/dt-b= indings/reset/econet,en751221-scu.h new file mode 100644 index 000000000000..bad499d4d50a --- /dev/null +++ b/include/dt-bindings/reset/econet,en751221-scu.h @@ -0,0 +1,49 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */ + +#ifndef __DT_BINDINGS_RESET_CONTROLLER_ECONET_EN751221_H_ +#define __DT_BINDINGS_RESET_CONTROLLER_ECONET_EN751221_H_ + +#define EN751221_XPON_PHY_RST 0 +#define EN751221_PCM1_ZSI_ISI_RST 1 +#define EN751221_FE_QDMA1_RST 2 +#define EN751221_FE_QDMA2_RST 3 +#define EN751221_FE_UNZIP_RST 4 +#define EN751221_PCM2_RST 5 +#define EN751221_PTM_MAC_RST 6 +#define EN751221_CRYPTO_RST 7 +#define EN751221_SAR_RST 8 +#define EN751221_TIMER_RST 9 +#define EN751221_INTC_RST 10 +#define EN751221_BONDING_RST 11 +#define EN751221_PCM1_RST 12 +#define EN751221_UART_RST 13 +#define EN751221_GPIO_RST 14 +#define EN751221_GDMA_RST 15 +#define EN751221_I2C_MASTER_RST 16 +#define EN751221_PCM2_ZSI_ISI_RST 17 +#define EN751221_SFC_RST 18 +#define EN751221_UART2_RST 19 +#define EN751221_GDMP_RST 20 +#define EN751221_FE_RST 21 +#define EN751221_USB_HOST_P0_RST 22 +#define EN751221_GSW_RST 23 +#define EN751221_SFC2_PCM_RST 24 +#define EN751221_PCIE0_RST 25 +#define EN751221_PCIE1_RST 26 +#define EN751221_CPU_TIMER_RST 27 +#define EN751221_PCIE_HB_RST 28 +#define EN751221_SIMIF_RST 29 +#define EN751221_XPON_MAC_RST 30 +#define EN751221_GFAST_RST 31 +#define EN751221_CPU_TIMER2_RST 32 +#define EN751221_UART3_RST 33 +#define EN751221_UART4_RST 34 +#define EN751221_UART5_RST 35 +#define EN751221_I2C2_RST 36 +#define EN751221_XSI_MAC_RST 37 +#define EN751221_XSI_PHY_RST 38 +#define EN751221_DMT_RST 39 +#define EN751221_USB_PHY_P0_RST 40 +#define EN751221_USB_PHY_P1_RST 41 + +#endif /* __DT_BINDINGS_RESET_CONTROLLER_ECONET_EN751221_H_ */ --=20 2.39.5 From nobody Thu Apr 9 17:58:36 2026 Received: from mail.cjdns.fr (mail.cjdns.fr [5.135.140.105]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B6F684301D6; Tue, 3 Mar 2026 19:10:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=5.135.140.105 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772565031; cv=none; b=ooDXijqwpXL4qni1nS65hurx8zYt79xqb9KdSIlDDP3HfpOxehMxbeKgJSVu2YSA1zYo+GoM8ArhoXtAv+jAFDzZ2dbtggdLHzJCahNsGyKGmpEspiEmGxEzvOpArX3HnVfPZX/UaNvUWzgsDfowDTIJ05Qz1dPltWWnQX1Kl2U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772565031; c=relaxed/simple; bh=OvntRFQQo39Yee1CjHtDO2eXn5V3xkLUobtvw5tEAaA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=lhlFVXi97j9SAwRnyhAHvYHvKgMj4TZKGCrAhCu2RtWqCSmrhWNC/D2WRhSANZ3Tuj8RqziwKdbv49NAe0UDO5+nj02afr4MV9cPuWiaSCka8Q0xkfNvEZ4jaDAw2XahLb8rz0+vfPSoWFUfKeuKHd6wq5zsVFc5hdXEHz2zr+g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cjdns.fr; spf=none smtp.mailfrom=cjdns.fr; dkim=pass (2048-bit key) header.d=cjdns.fr header.i=@cjdns.fr header.b=U1A+MQ3x; arc=none smtp.client-ip=5.135.140.105 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cjdns.fr Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=cjdns.fr Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cjdns.fr header.i=@cjdns.fr header.b="U1A+MQ3x" Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id A9A6120BBC1; Tue, 3 Mar 2026 20:10:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cjdns.fr; s=dkim; t=1772565027; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=jqsFTmrAn4reeYegNeY+JXGZXrLXmau1zMZPmhu+RF8=; b=U1A+MQ3x0UscWVMDm+Z5hdKSHK1p6ea12ut565au6npiHo8Eiiz642XNnDO++TNCQrGtbd XWoumiOd3z7Q7yK2Pom4FtIYicYsncjYjCFslQGpcahdzk+9p0vSvSg/+GQp0cRoIDkeCk vnZ7PU0iZYHDIItnwaeDu4Dvqo9RJb+9kzcJWD7dt8NndDtFbLIX5U2ZszX7Ew89scKbQP wsrPygEVXlLiNhoa8YAx1hh2zS2BmFZQj5TKVFl/3b8xveNRp17soFCIwQzvroc7zWbZgQ En5RyThQ+i/+scU1V6xMy3f6RjOhGllqjK//bvhmHDs7v/uuGfpgHwvbAFYxKw== From: Caleb James DeLisle To: linux-mips@vger.kernel.org Cc: naseefkm@gmail.com, mturquette@baylibre.com, sboyd@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, cjd@cjdns.fr, tsbogend@alpha.franken.de, ryder.lee@mediatek.com, jianjun.wang@mediatek.com, lpieralisi@kernel.org, kwilczynski@kernel.org, mani@kernel.org, bhelgaas@google.com, vkoul@kernel.org, neil.armstrong@linaro.org, p.zabel@pengutronix.de, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, nbd@nbd.name, ansuelsmth@gmail.com, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 2/8] clk: airoha: Add econet EN751221 clock/reset support to en7523-scu Date: Tue, 3 Mar 2026 19:09:42 +0000 Message-Id: <20260303190948.694783-3-cjd@cjdns.fr> In-Reply-To: <20260303190948.694783-1-cjd@cjdns.fr> References: <20260303190948.694783-1-cjd@cjdns.fr> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Content-Type: text/plain; charset="utf-8" EcoNet EN751221 clock/reset driver is significantly similar to the EN7523 / EN7581, however the EN751221 does not have a neat batch of clock divider registers so there are fewer known clocks, and the frequency of each clock is derived differently. This clock driver will probably work correctly on EN751627, EN7528, and EN7580. Signed-off-by: Caleb James DeLisle --- drivers/clk/Kconfig | 6 +- drivers/clk/clk-en7523.c | 236 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 234 insertions(+), 8 deletions(-) diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig index 3d803b4cf5c1..47df6073a72b 100644 --- a/drivers/clk/Kconfig +++ b/drivers/clk/Kconfig @@ -218,13 +218,13 @@ config COMMON_CLK_CS2000_CP If you say yes here you get support for the CS2000 clock multiplier. =20 config COMMON_CLK_EN7523 - bool "Clock driver for Airoha EN7523 SoC system clocks" + bool "Clock driver for Airoha/EcoNet SoC system clocks" depends on OF - depends on ARCH_AIROHA || COMPILE_TEST + depends on ARCH_AIROHA || ECONET || COMPILE_TEST default ARCH_AIROHA help This driver provides the fixed clocks and gates present on Airoha - ARM silicon. + and EcoNet silicon. =20 config COMMON_CLK_EP93XX tristate "Clock driver for Cirrus Logic ep93xx SoC" diff --git a/drivers/clk/clk-en7523.c b/drivers/clk/clk-en7523.c index 08cc8e5acf43..b31e6d3c91a2 100644 --- a/drivers/clk/clk-en7523.c +++ b/drivers/clk/clk-en7523.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only =20 +#include #include #include #include @@ -11,6 +12,8 @@ #include #include #include +#include +#include =20 #define RST_NR_PER_BANK 32 =20 @@ -33,15 +36,47 @@ #define REG_RESET_CONTROL_PCIEHB BIT(29) #define REG_RESET_CONTROL_PCIE1 BIT(27) #define REG_RESET_CONTROL_PCIE2 BIT(26) +#define REG_HIR 0x064 +#define REG_HIR_MASK GENMASK(31, 16) /* EN7581 */ #define REG_NP_SCU_PCIC 0x88 #define REG_NP_SCU_SSTR 0x9c #define REG_PCIE_XSI0_SEL_MASK GENMASK(14, 13) #define REG_PCIE_XSI1_SEL_MASK GENMASK(12, 11) #define REG_CRYPTO_CLKSRC2 0x20c +/* EN751221 */ +#define EN751221_REG_SPI_DIV 0x0cc +#define EN751221_REG_SPI_DIV_MASK GENMASK(31, 8) +#define EN751221_SPI_BASE 500000000 +#define EN751221_SPI_BASE_EN7526C 400000000 +#define EN751221_REG_BUS 0x284 +#define EN751221_REG_BUS_MASK GENMASK(21, 12) +#define EN751221_REG_SSR3 0x094 +#define EN751221_REG_SSR3_GSW_MASK GENMASK(9, 8) =20 #define REG_RST_CTRL2 0x830 #define REG_RST_CTRL1 0x834 +#define EN751221_REG_RST_DMT 0x84 +#define EN751221_REG_RST_USB 0xec + +enum en_hir { + HIR_UNKNOWN =3D -1, + HIR_TC3169 =3D 0, + HIR_TC3182 =3D 1, + HIR_RT65168 =3D 2, + HIR_RT63165 =3D 3, + HIR_RT63365 =3D 4, + HIR_MT751020 =3D 5, + HIR_MT7505 =3D 6, + HIR_EN751221 =3D 7, + HIR_EN7526C =3D 8, + HIR_EN751627 =3D 9, + HIR_EN7580 =3D 10, + HIR_EN7528 =3D 11, + HIR_EN7523 =3D 12, + HIR_EN7581 =3D 13, + HIR_MAX =3D 14, +}; =20 struct en_clk_desc { int id; @@ -93,6 +128,8 @@ static const u32 bus7581_base[] =3D { 600000000, 5400000= 00 }; static const u32 npu7581_base[] =3D { 800000000, 750000000, 720000000, 600= 000000 }; static const u32 crypto_base[] =3D { 540000000, 480000000 }; static const u32 emmc7581_base[] =3D { 200000000, 150000000 }; +/* EN751221 */ +static const u32 gsw751221_base[] =3D { 500000000, 250000000, 400000000, 2= 00000000 }; =20 static const struct en_clk_desc en7523_base_clks[] =3D { { @@ -300,6 +337,13 @@ static const u16 en7581_rst_ofs[] =3D { REG_RST_CTRL1, }; =20 +static const u16 en751221_rst_ofs[] =3D { + REG_RST_CTRL2, + REG_RST_CTRL1, + EN751221_REG_RST_DMT, + EN751221_REG_RST_USB, +}; + static const u16 en7523_rst_map[] =3D { /* RST_CTRL2 */ [EN7523_XPON_PHY_RST] =3D 0, @@ -405,8 +449,61 @@ static const u16 en7581_rst_map[] =3D { [EN7581_XPON_MAC_RST] =3D RST_NR_PER_BANK + 31, }; =20 +static const u16 en751221_rst_map[] =3D { + /* RST_CTRL2 */ + [EN751221_XPON_PHY_RST] =3D 0, + [EN751221_GFAST_RST] =3D 1, + [EN751221_CPU_TIMER2_RST] =3D 2, + [EN751221_UART3_RST] =3D 3, + [EN751221_UART4_RST] =3D 4, + [EN751221_UART5_RST] =3D 5, + [EN751221_I2C2_RST] =3D 6, + [EN751221_XSI_MAC_RST] =3D 7, + [EN751221_XSI_PHY_RST] =3D 8, + + /* RST_CTRL1 */ + [EN751221_PCM1_ZSI_ISI_RST] =3D RST_NR_PER_BANK + 0, + [EN751221_FE_QDMA1_RST] =3D RST_NR_PER_BANK + 1, + [EN751221_FE_QDMA2_RST] =3D RST_NR_PER_BANK + 2, + [EN751221_FE_UNZIP_RST] =3D RST_NR_PER_BANK + 3, + [EN751221_PCM2_RST] =3D RST_NR_PER_BANK + 4, + [EN751221_PTM_MAC_RST] =3D RST_NR_PER_BANK + 5, + [EN751221_CRYPTO_RST] =3D RST_NR_PER_BANK + 6, + [EN751221_SAR_RST] =3D RST_NR_PER_BANK + 7, + [EN751221_TIMER_RST] =3D RST_NR_PER_BANK + 8, + [EN751221_INTC_RST] =3D RST_NR_PER_BANK + 9, + [EN751221_BONDING_RST] =3D RST_NR_PER_BANK + 10, + [EN751221_PCM1_RST] =3D RST_NR_PER_BANK + 11, + [EN751221_UART_RST] =3D RST_NR_PER_BANK + 12, + [EN751221_GPIO_RST] =3D RST_NR_PER_BANK + 13, + [EN751221_GDMA_RST] =3D RST_NR_PER_BANK + 14, + [EN751221_I2C_MASTER_RST] =3D RST_NR_PER_BANK + 16, + [EN751221_PCM2_ZSI_ISI_RST] =3D RST_NR_PER_BANK + 17, + [EN751221_SFC_RST] =3D RST_NR_PER_BANK + 18, + [EN751221_UART2_RST] =3D RST_NR_PER_BANK + 19, + [EN751221_GDMP_RST] =3D RST_NR_PER_BANK + 20, + [EN751221_FE_RST] =3D RST_NR_PER_BANK + 21, + [EN751221_USB_HOST_P0_RST] =3D RST_NR_PER_BANK + 22, + [EN751221_GSW_RST] =3D RST_NR_PER_BANK + 23, + [EN751221_SFC2_PCM_RST] =3D RST_NR_PER_BANK + 25, + [EN751221_PCIE0_RST] =3D RST_NR_PER_BANK + 26, + [EN751221_PCIE1_RST] =3D RST_NR_PER_BANK + 27, + [EN751221_CPU_TIMER_RST] =3D RST_NR_PER_BANK + 28, + [EN751221_PCIE_HB_RST] =3D RST_NR_PER_BANK + 29, + [EN751221_SIMIF_RST] =3D RST_NR_PER_BANK + 30, + [EN751221_XPON_MAC_RST] =3D RST_NR_PER_BANK + 31, + + /* RST_DMT */ + [EN751221_DMT_RST] =3D 2 * RST_NR_PER_BANK + 0, + + /* RST_USB */ + [EN751221_USB_PHY_P0_RST] =3D 3 * RST_NR_PER_BANK + 6, + [EN751221_USB_PHY_P1_RST] =3D 3 * RST_NR_PER_BANK + 7, +}; + static int en7581_reset_register(struct device *dev, void __iomem *base, - const u16 *rst_map, int nr_resets); + const u16 *rst_map, int nr_resets, + const u16 *rst_reg_ofs); =20 static u32 en7523_get_base_rate(const struct en_clk_desc *desc, u32 val) { @@ -604,7 +701,8 @@ static int en7523_clk_hw_init(struct platform_device *p= dev, en7523_register_clocks(&pdev->dev, clk_data, base, np_base); =20 return en7581_reset_register(&pdev->dev, np_base, en7523_rst_map, - ARRAY_SIZE(en7523_rst_map)); + ARRAY_SIZE(en7523_rst_map), + en7581_rst_ofs); } =20 static void en7581_register_clocks(struct device *dev, struct clk_hw_onece= ll_data *clk_data, @@ -705,7 +803,8 @@ static const struct reset_control_ops en7581_reset_ops = =3D { }; =20 static int en7581_reset_register(struct device *dev, void __iomem *base, - const u16 *rst_map, int nr_resets) + const u16 *rst_map, int nr_resets, + const u16 *rst_reg_ofs) { struct en_rst_data *rst_data; =20 @@ -713,7 +812,7 @@ static int en7581_reset_register(struct device *dev, vo= id __iomem *base, if (!rst_data) return -ENOMEM; =20 - rst_data->bank_ofs =3D en7581_rst_ofs; + rst_data->bank_ofs =3D rst_reg_ofs; rst_data->idx_map =3D rst_map; rst_data->base =3D base; =20 @@ -752,7 +851,123 @@ static int en7581_clk_hw_init(struct platform_device = *pdev, writel(val | 3, base + REG_NP_SCU_PCIC); =20 return en7581_reset_register(&pdev->dev, base, en7581_rst_map, - ARRAY_SIZE(en7581_rst_map)); + ARRAY_SIZE(en7581_rst_map), + en7581_rst_ofs); +} + +static enum en_hir get_hw_id(void __iomem *np_base) +{ + u32 val =3D FIELD_GET(REG_HIR_MASK, readl(np_base + REG_HIR)); + + if (val < HIR_MAX) + return (enum en_hir) val; + + return HIR_UNKNOWN; +} + +static void en751221_try_register_clk(struct device *dev, int key, + struct clk_hw_onecell_data *clk_data, + const char *name, u32 rate) +{ + struct clk_hw *hw; + + hw =3D clk_hw_register_fixed_rate(dev, name, NULL, 0, rate); + if (IS_ERR(hw)) + pr_err("Failed to register clk %s: %pe\n", name, hw); + else + clk_data->hws[key] =3D hw; +} + +static void en751221_register_clocks(struct device *dev, + struct clk_hw_onecell_data *clk_data, + struct regmap *map, void __iomem *np_base) +{ + enum en_hir hid =3D get_hw_id(np_base); + struct clk_hw *hw; + u32 rate; + u32 div; + int err; + + /* PCI */ + hw =3D en7523_register_pcie_clk(dev, np_base); + clk_data->hws[EN751221_CLK_PCIE] =3D hw; + + /* SPI */ + rate =3D EN751221_SPI_BASE; + if (hid =3D=3D HIR_EN7526C) + rate =3D EN751221_SPI_BASE_EN7526C; + + err =3D regmap_read(map, EN751221_REG_SPI_DIV, &div); + if (err) { + pr_err("Failed reading fixed clk div %s: %d\n", + "spi", err); + } else { + div =3D FIELD_GET(EN751221_REG_SPI_DIV_MASK, div) * 2; + if (!div) + div =3D 40; + + en751221_try_register_clk(dev, EN751221_CLK_SPI, clk_data, + "spi", rate / div); + } + + /* BUS */ + rate =3D FIELD_GET(EN751221_REG_BUS_MASK, + readl(np_base + EN751221_REG_BUS)); + rate *=3D 1000000; + en751221_try_register_clk(dev, EN751221_CLK_BUS, clk_data, "bus", + rate); + + /* CPU */ + en751221_try_register_clk(dev, EN751221_CLK_CPU, clk_data, "cpu", + rate * 4); + + /* HPT */ + switch (hid) { + case HIR_EN751221: + case HIR_EN751627: + case HIR_EN7526C: + case HIR_EN7580: + case HIR_EN7528: + rate =3D 200000000; + break; + case HIR_MT7505: + rate =3D 100000000; + break; + case HIR_MT751020: + rate =3D 800000000 / 3; + break; + default: + rate =3D 250000000; + } + en751221_try_register_clk(dev, EN751221_CLK_HPT, clk_data, "hpt", + rate); + + /* GSW */ + rate =3D FIELD_GET(EN751221_REG_SSR3_GSW_MASK, + readl(np_base + EN751221_REG_SSR3)); + en751221_try_register_clk(dev, EN751221_CLK_GSW, clk_data, "gsw", + gsw751221_base[rate]); +} + +static int en751221_clk_hw_init(struct platform_device *pdev, + struct clk_hw_onecell_data *clk_data) +{ + struct regmap *map; + void __iomem *base; + + map =3D syscon_regmap_lookup_by_compatible("econet,en751221-chip-scu"); + if (IS_ERR(map)) + return PTR_ERR(map); + + base =3D devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(base)) + return PTR_ERR(base); + + en751221_register_clocks(&pdev->dev, clk_data, map, base); + + return en7581_reset_register(&pdev->dev, base, en751221_rst_map, + ARRAY_SIZE(en751221_rst_map), + en751221_rst_ofs); } =20 static int en7523_clk_probe(struct platform_device *pdev) @@ -799,9 +1014,20 @@ static const struct en_clk_soc_data en7581_data =3D { .hw_init =3D en7581_clk_hw_init, }; =20 +static const struct en_clk_soc_data en751221_data =3D { + .num_clocks =3D EN751221_MAX_CLKS, + .pcie_ops =3D { + .is_enabled =3D en7523_pci_is_enabled, + .prepare =3D en7523_pci_prepare, + .unprepare =3D en7523_pci_unprepare, + }, + .hw_init =3D en751221_clk_hw_init, +}; + static const struct of_device_id of_match_clk_en7523[] =3D { { .compatible =3D "airoha,en7523-scu", .data =3D &en7523_data }, { .compatible =3D "airoha,en7581-scu", .data =3D &en7581_data }, + { .compatible =3D "econet,en751221-scu", .data =3D &en751221_data }, { /* sentinel */ } }; =20 --=20 2.39.5 From nobody Thu Apr 9 17:58:36 2026 Received: from mail.cjdns.fr (mail.cjdns.fr [5.135.140.105]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F1CBF47DF89; Tue, 3 Mar 2026 19:10:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=5.135.140.105 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772565036; cv=none; b=M6u+TWMeb4kQXusNGiaPN3wiEl4uHyM367eUTsYv3QzY7yCxwRXS9IejHA/IYOJ7FpmdfxhxMmw+zWw6EC3unzS+a8kFqYjLgkMKZ/nvmbIjEiDIYZMWcXOQBg03spQ53F5htNZqWNrOeJ/zFyxzGsXP0uwJ8VD5R8eEvMGsi1k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772565036; c=relaxed/simple; bh=+lpd82yBu94qD0lQL25zmQu+4yzWjVsYve7GCBkR+Hc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=QNHZL2fHfIsu/wP1cMV7lC+PhK0KMzoCfj4UY3xgFPYxuKJfQLRd9GuWDQ606tzBWZ8WmIcjmFYyqV9vKLlJVO6RToTULn9D+iLZZqhWorppy5ZbRRo/07CGg1M7/1GTxKcoVipdkaoOb+1EoUzYbyWREhzvstGGJo6sZsFudL4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cjdns.fr; spf=none smtp.mailfrom=cjdns.fr; dkim=pass (2048-bit key) header.d=cjdns.fr header.i=@cjdns.fr header.b=GHJGkMtv; arc=none smtp.client-ip=5.135.140.105 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cjdns.fr Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=cjdns.fr Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cjdns.fr header.i=@cjdns.fr header.b="GHJGkMtv" Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 9DAD320CD2C; Tue, 3 Mar 2026 20:10:29 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cjdns.fr; s=dkim; t=1772565032; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=LgrYHxVXH/xqbEM9i5EqdtYKP15yv6x7HKPpgK2Wkrw=; b=GHJGkMtvnNl2cmtaoQ1Z/zMMaO1HyObR1QEJaMV9RDVDwbXL3oTGV9EINSP+D31Lu9biDi ISBBmgpVc1f0JPiazHno/zORqpJXmk/WI9hiUJNJw/LjA5kM4RWvnTGppTOsYoxcYLkdR+ J0vk1g1Y0K/O4J6QaLkKZCD29DRS9O2z3FSgOn1/sDf/yFmjhp4x8EOpCJeO4d2ngwYFDm esfm1Jmo91OSB/n7unBYCjq5aaFifzof6rLrYlFXeTxwpihIFw2eO5TrCxLF6nlJV+92yH fo82CsPT6owY0q+NpvzSR6Jzh+JnoSiV8aNjqP1QkUK8F6TTCC2eikcpCmHmJA== From: Caleb James DeLisle To: linux-mips@vger.kernel.org Cc: naseefkm@gmail.com, mturquette@baylibre.com, sboyd@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, cjd@cjdns.fr, tsbogend@alpha.franken.de, ryder.lee@mediatek.com, jianjun.wang@mediatek.com, lpieralisi@kernel.org, kwilczynski@kernel.org, mani@kernel.org, bhelgaas@google.com, vkoul@kernel.org, neil.armstrong@linaro.org, p.zabel@pengutronix.de, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, nbd@nbd.name, ansuelsmth@gmail.com, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 3/8] dt-bindings: phy: Document PCIe PHY in EcoNet EN751221 and EN7528 Date: Tue, 3 Mar 2026 19:09:43 +0000 Message-Id: <20260303190948.694783-4-cjd@cjdns.fr> In-Reply-To: <20260303190948.694783-1-cjd@cjdns.fr> References: <20260303190948.694783-1-cjd@cjdns.fr> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Content-Type: text/plain; charset="utf-8" EN751221 and EN7528 SoCs have two PCIe slots, and each one has a PHY which behaves slightly differently because one slot is Gen1/Gen2 while the other is Gen1 only. Signed-off-by: Caleb James DeLisle --- .../phy/econet,en751221-pcie-phy.yaml | 57 +++++++++++++++++++ MAINTAINERS | 6 ++ 2 files changed, 63 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/econet,en751221-p= cie-phy.yaml diff --git a/Documentation/devicetree/bindings/phy/econet,en751221-pcie-phy= .yaml b/Documentation/devicetree/bindings/phy/econet,en751221-pcie-phy.yaml new file mode 100644 index 000000000000..8e1d3c791c6e --- /dev/null +++ b/Documentation/devicetree/bindings/phy/econet,en751221-pcie-phy.yaml @@ -0,0 +1,57 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/phy/econet,en751221-pcie-phy.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: EcoNet PCI-Express PHY for EcoNet EN751221 and EN7528 + +maintainers: + - Caleb James DeLisle + +description: + The PCIe PHY supports physical layer functionality for PCIe Gen1 and + Gen1/Gen2 ports. On these SoCs, port 0 is a Gen1-only port while + port 1 is Gen1/Gen2 capable. + +properties: + compatible: + enum: + - econet,en751221-pcie-phy0 + - econet,en751221-pcie-phy1 + - econet,en7528-pcie-phy0 + - econet,en7528-pcie-phy1 + + reg: + maxItems: 1 + + "#phy-cells": + const: 0 + +required: + - compatible + - reg + - '#phy-cells' + +additionalProperties: false + +examples: + - | + #include + soc { + #address-cells =3D <1>; + #size-cells =3D <1>; + + pcie_phy0: pcie-phy@1faf2000 { + compatible =3D "econet,en7528-pcie-phy0"; + reg =3D <0x1faf2000 0x1000>; + #phy-cells =3D <0>; + }; + + pcie_phy1: pcie-phy@1fac0000 { + compatible =3D "econet,en7528-pcie-phy1"; + reg =3D <0x1fac0000 0x1000>; + #phy-cells =3D <0>; + }; + }; +... diff --git a/MAINTAINERS b/MAINTAINERS index 56cf73ce91b8..ae053b1f174f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -9123,6 +9123,12 @@ F: drivers/irqchip/irq-econet-en751221.c F: include/dt-bindings/clock/econet,en751221-scu.h F: include/dt-bindings/reset/econet,en751221-scu.h =20 +ECONET PCIE PHY DRIVER +M: Caleb James DeLisle +L: linux-mips@vger.kernel.org +S: Maintained +F: Documentation/devicetree/bindings/phy/econet,en751221-pcie-phy.yaml + ECRYPT FILE SYSTEM M: Tyler Hicks L: ecryptfs@vger.kernel.org --=20 2.39.5 From nobody Thu Apr 9 17:58:36 2026 Received: from mail.cjdns.fr (mail.cjdns.fr [5.135.140.105]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EF85030EF92; Tue, 3 Mar 2026 19:10:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=5.135.140.105 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772565043; cv=none; b=XpLDxsGtsnsXslQGnVco7ZB0BKHHTvsM0bPRwlDE0a/QxQWPKdD+1eXAtPwwcxUJGXBrueBu9x8UJCsA7ubJuIdnHPEzQFFOLzlN/6/6/YYZkl86KTAcmj5nkDiZEXAfDO2iBjGsqWxqLmLLQWj3SWL7Qx+ZqV+bXZJMP8IS7CY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772565043; c=relaxed/simple; bh=FrKhKH8u6PYA+AIVV2zodeRPna/4G+MWYdfsznb+nOU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=hTTvBRj43/0Ny3l2mkOzrMm5NYj5CHH8iMskpbtsOFJ28B37U8KHsbg4J7EwVHXJ58oPLtZkNZqO6507itQY21ncTuNyKG0hRCV7MOdQLW1xdErRF41KYv9iAfEJvPZi4VKMbP+BVtWeCQ+05bngaCythQDPuyn2ADiCHPUcdvU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cjdns.fr; spf=none smtp.mailfrom=cjdns.fr; dkim=pass (2048-bit key) header.d=cjdns.fr header.i=@cjdns.fr header.b=oaJHT7LM; arc=none smtp.client-ip=5.135.140.105 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cjdns.fr Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=cjdns.fr Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cjdns.fr header.i=@cjdns.fr header.b="oaJHT7LM" Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id B452020CDA2; Tue, 3 Mar 2026 20:10:34 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cjdns.fr; s=dkim; t=1772565039; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=W+99vBF6+noQZFKfqEyxi1GoYX1wO7PB5DYOpXOMID0=; b=oaJHT7LM++Tg5TrOr4NzzfntKBvw+DcjZV+6UerjhwD9eSAooNp7LI1vDK9Z/TP6f5PB6Y Ed3mh6JR8dgT0fo4PFQDrzY8CZiOii3y6Z6wH1fdZk/TeqsIco7/3TbifrQyBNkGtssPnA +Vem5nbk51HFBaJ6g6jcRVkWQwLl9dNtt1sSUnQDgKGZXAg1NVxsiEgNcwCQpaOBv9XWfC qcD+u6FFg//aYqjtablpWLfF+NJ0vcc2QSOzqPekv5FK1IWZwgX0wvjvMtJWFLvqwoe95/ xjgK+tQEEtf93AiFE5bUk9eGdhZWEh5AfFC+DUGD3fmHPSIxBMZKYFD0o+1V7A== From: Caleb James DeLisle To: linux-mips@vger.kernel.org Cc: naseefkm@gmail.com, mturquette@baylibre.com, sboyd@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, cjd@cjdns.fr, tsbogend@alpha.franken.de, ryder.lee@mediatek.com, jianjun.wang@mediatek.com, lpieralisi@kernel.org, kwilczynski@kernel.org, mani@kernel.org, bhelgaas@google.com, vkoul@kernel.org, neil.armstrong@linaro.org, p.zabel@pengutronix.de, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, nbd@nbd.name, ansuelsmth@gmail.com, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 4/8] phy: econet: Add PCIe PHY driver for EcoNet EN751221 and EN7528 SoCs. Date: Tue, 3 Mar 2026 19:09:44 +0000 Message-Id: <20260303190948.694783-5-cjd@cjdns.fr> In-Reply-To: <20260303190948.694783-1-cjd@cjdns.fr> References: <20260303190948.694783-1-cjd@cjdns.fr> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Content-Type: text/plain; charset="utf-8" Introduce support for EcoNet PCIe PHY controllers found in EN751221 and EN7528 SoCs, these SoCs are not identical but are similar, each having one Gen1 port, and one Gen1/Gen2 port. Co-developed-by: Ahmed Naseef Signed-off-by: Ahmed Naseef [cjd@cjdns.fr: add EN751221 support and refactor for clarity] Co-developed-by: Caleb James DeLisle Signed-off-by: Caleb James DeLisle --- MAINTAINERS | 1 + drivers/phy/Kconfig | 12 +++ drivers/phy/Makefile | 1 + drivers/phy/phy-econet-pcie.c | 180 ++++++++++++++++++++++++++++++++++ 4 files changed, 194 insertions(+) create mode 100644 drivers/phy/phy-econet-pcie.c diff --git a/MAINTAINERS b/MAINTAINERS index ae053b1f174f..5d4544590069 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -9128,6 +9128,7 @@ M: Caleb James DeLisle L: linux-mips@vger.kernel.org S: Maintained F: Documentation/devicetree/bindings/phy/econet,en751221-pcie-phy.yaml +F: drivers/phy/phy-econet-pcie.c =20 ECRYPT FILE SYSTEM M: Tyler Hicks diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index 02467dfd4fb0..60efc37f6eb0 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig @@ -123,6 +123,18 @@ config PHY_AIROHA_PCIE This driver create the basic PHY instance and provides initialize callback for PCIe GEN3 port. =20 +config PHY_ECONET_PCIE + tristate "EcoNet PCIe-PHY Driver" + depends on ECONET || COMPILE_TEST + depends on OF + select GENERIC_PHY + select REGMAP_MMIO + help + Say Y here to add support for EcoNet PCIe PHY driver. + This driver create the basic PHY instance and provides initialize + callback for PCIe GEN1 and GEN2 ports. This PHY is found on + EcoNet SoCs including EN751221 and EN7528. + config PHY_NXP_PTN3222 tristate "NXP PTN3222 1-port eUSB2 to USB2 redriver" depends on I2C diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile index a648c2e02a83..a77f182ee8f3 100644 --- a/drivers/phy/Makefile +++ b/drivers/phy/Makefile @@ -15,6 +15,7 @@ obj-$(CONFIG_PHY_PISTACHIO_USB) +=3D phy-pistachio-usb.o obj-$(CONFIG_PHY_SNPS_EUSB2) +=3D phy-snps-eusb2.o obj-$(CONFIG_USB_LGM_PHY) +=3D phy-lgm-usb.o obj-$(CONFIG_PHY_AIROHA_PCIE) +=3D phy-airoha-pcie.o +obj-$(CONFIG_PHY_ECONET_PCIE) +=3D phy-econet-pcie.o obj-$(CONFIG_PHY_NXP_PTN3222) +=3D phy-nxp-ptn3222.o obj-$(CONFIG_PHY_SPACEMIT_K1_PCIE) +=3D phy-spacemit-k1-pcie.o obj-$(CONFIG_GENERIC_PHY) +=3D allwinner/ \ diff --git a/drivers/phy/phy-econet-pcie.c b/drivers/phy/phy-econet-pcie.c new file mode 100644 index 000000000000..f9d6d061f54a --- /dev/null +++ b/drivers/phy/phy-econet-pcie.c @@ -0,0 +1,180 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Author: Caleb James DeLisle + * Ahmed Naseef + */ + +#include +#include +#include +#include +#include +#include + +/* Rx detection timing for EN751221: 16*8 clock cycles */ +#define EN751221_RXDET_VAL 16 + +/* Rx detection timing when in power mode 3 */ +#define EN75_RXDET_P3_REG 0xa28 +#define EN75_RXDET_P3_MASK GENMASK(17, 9) + +/* Rx detection timing when in power mode 2 */ +#define EN75_RXDET_P2_REG 0xa2c +#define EN75_RXDET_P2_MASK GENMASK(8, 0) + +/* Rx impedance */ +#define EN75_RX_IMPEDANCE_REG 0xb2c +#define EN75_RX_IMPEDANCE_MASK GENMASK(13, 12) +enum en75_rx_impedance { + EN75_RX_IMPEDANCE_100_OHM =3D 0, + EN75_RX_IMPEDANCE_95_OHM =3D 1, + EN75_RX_IMPEDANCE_90_OHM =3D 2, +}; + +/* PLL Invert clock */ +#define EN75_PLL_PH_INV_REG 0x4a0 +#define EN75_PLL_PH_INV_MASK BIT(5) + +struct en75_phy_op { + u32 reg; + u32 mask; + u32 val; +}; + +struct en7528_pcie_phy { + struct regmap *regmap; + const struct en75_phy_op *data; +}; + +/* Port 0 PHY: set LCDDS_CLK_PH_INV for PLL operation */ +static const struct en75_phy_op en7528_phy_port0[] =3D { + { + .reg =3D EN75_PLL_PH_INV_REG, + .mask =3D EN75_PLL_PH_INV_MASK, + .val =3D 1, + }, + { /* sentinel */ } +}; + +/* EN7528 Port 1 PHY: Rx impedance tuning, target R -5 Ohm */ +static const struct en75_phy_op en7528_phy_port1[] =3D { + { + .reg =3D EN75_RX_IMPEDANCE_REG, + .mask =3D EN75_RX_IMPEDANCE_MASK, + .val =3D EN75_RX_IMPEDANCE_95_OHM, + }, + { /* sentinel */ } +}; + +/* EN751221 Port 1 PHY, set RX detect to 16*8 clock cycles */ +static const struct en75_phy_op en751221_phy_port1[] =3D { + { + .reg =3D EN75_RXDET_P3_REG, + .mask =3D EN75_RXDET_P3_MASK, + .val =3D EN751221_RXDET_VAL, + }, + { + .reg =3D EN75_RXDET_P2_REG, + .mask =3D EN75_RXDET_P2_MASK, + .val =3D EN751221_RXDET_VAL, + }, + { /* sentinel */ } +}; + +static int en75_pcie_phy_init(struct phy *phy) +{ + struct en7528_pcie_phy *ephy =3D phy_get_drvdata(phy); + const struct en75_phy_op *data =3D ephy->data; + int i, ret; + u32 val; + + for (i =3D 0; data[i].mask || data[i].val; i++) { + if (i) + usleep_range(1000, 2000); + + val =3D field_prep(data[i].mask, data[i].val); + + ret =3D regmap_update_bits(ephy->regmap, data[i].reg, + data[i].mask, val); + if (ret) + return ret; + } + + return 0; +} + +static const struct phy_ops en75_pcie_phy_ops =3D { + .init =3D en75_pcie_phy_init, + .owner =3D THIS_MODULE, +}; + +static int en75_pcie_phy_probe(struct platform_device *pdev) +{ + struct regmap_config regmap_config =3D { + .reg_bits =3D 32, + .val_bits =3D 32, + .reg_stride =3D 4, + }; + struct device *dev =3D &pdev->dev; + const struct en75_phy_op *data; + struct phy_provider *provider; + struct en7528_pcie_phy *ephy; + void __iomem *base; + struct phy *phy; + int i; + + data =3D of_device_get_match_data(dev); + if (!data) + return -EINVAL; + + ephy =3D devm_kzalloc(dev, sizeof(*ephy), GFP_KERNEL); + if (!ephy) + return -ENOMEM; + + ephy->data =3D data; + + base =3D devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(base)) + return PTR_ERR(base); + + /* Set max_register to highest used register */ + for (i =3D 0; data[i].mask || data[i].val; i++) + if (data[i].reg > regmap_config.max_register) + regmap_config.max_register =3D data[i].reg; + + ephy->regmap =3D devm_regmap_init_mmio(dev, base, ®map_config); + if (IS_ERR(ephy->regmap)) + return PTR_ERR(ephy->regmap); + + phy =3D devm_phy_create(dev, dev->of_node, &en75_pcie_phy_ops); + if (IS_ERR(phy)) + return PTR_ERR(phy); + + phy_set_drvdata(phy, ephy); + + provider =3D devm_of_phy_provider_register(dev, of_phy_simple_xlate); + + return PTR_ERR_OR_ZERO(provider); +} + +static const struct of_device_id en75_pcie_phy_ids[] =3D { + { .compatible =3D "econet,en7528-pcie-phy0", .data =3D en7528_phy_port0 }, + { .compatible =3D "econet,en7528-pcie-phy1", .data =3D en7528_phy_port1 }, + { .compatible =3D "econet,en751221-pcie-phy0", .data =3D en7528_phy_port0= }, + { .compatible =3D "econet,en751221-pcie-phy1", .data =3D en751221_phy_por= t1 }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, en75_pcie_phy_ids); + +static struct platform_driver en75_pcie_phy_driver =3D { + .probe =3D en75_pcie_phy_probe, + .driver =3D { + .name =3D "econet-pcie-phy", + .of_match_table =3D en75_pcie_phy_ids, + }, +}; +module_platform_driver(en75_pcie_phy_driver); + +MODULE_AUTHOR("Caleb James DeLisle "); +MODULE_DESCRIPTION("EcoNet PCIe PHY driver"); +MODULE_LICENSE("GPL"); --=20 2.39.5 From nobody Thu Apr 9 17:58:36 2026 Received: from mail.cjdns.fr (mail.cjdns.fr [5.135.140.105]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D22964301D6; Tue, 3 Mar 2026 19:10:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=5.135.140.105 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772565050; cv=none; b=DW/+ns+2ihBecwd0a2F2BDusd4KasxhFo6ghzOaKf3Pz1ruKaVyWMmIbMAtBu1FjnERXDrhJupkc3u7+fV4zjE3uaeRXRb87ecf5tm3S2V7TSMhBpgfXk8r6R7gR0oiw+i/FjPnPMbvTrMvtXgHjnGNEsxmYtPWjBCm0xuoXoN0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772565050; c=relaxed/simple; bh=zbaVHZx10SvzVHWpOjcojCo/vRJYD1sbkwZElhT8aA8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=L9wuq+yxXMrKnikSpsqdnz4HVjsrjchsZoc79/iTUOStKxXU5ssRG13SDBo6+x27nLFyiHt4nxX4GyIF6olNtDD1RwHeTwEvB2gYZ/sETHmBXwdBrpbwIs9y+k2FzQlFWiyCW/BgXVod19Gz05xFet3jBB85AzPmTA8eFlhHva4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cjdns.fr; spf=pass smtp.mailfrom=cjdns.fr; dkim=pass (2048-bit key) header.d=cjdns.fr header.i=@cjdns.fr header.b=UZRjYCA6; arc=none smtp.client-ip=5.135.140.105 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cjdns.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cjdns.fr Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cjdns.fr header.i=@cjdns.fr header.b="UZRjYCA6" Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 6EED120C23C; Tue, 3 Mar 2026 20:10:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cjdns.fr; s=dkim; t=1772565045; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=OiRQgm2fH3aML6cl3pDo1ClODmIrMf+JKaRfp7jk63k=; b=UZRjYCA6JCSWqVaPzJrFxgQ92u0oB7FtmqD0iF7qAiHtOwujN5kprCN22Qr4kCJkwtfccZ zCNauX+2Drt3h1qnIlxqB/WeLWTMF47FFbif2WOTKTFdTzyeZh5jVGsmPeNeTuvat9PUAy z7Af4Nca0CkOfmTi7PeacDgCSGQmW6towhQFrvYKz1qMV2YNZp2rvvMq6JqIqukAKKGgVF s2w7Mlg6hPt2Q0fIhdUgjSedWthhhFLArV8I5t+jFvLlBDpZ+TUASpx47WTny2HpElnOy9 ARA97AS1aKvlXeavj8vBTy69G4F/XGZTcFxXS4m9p2/AgNyfx4NBYTe6WEM0cw== From: Caleb James DeLisle To: linux-mips@vger.kernel.org Cc: naseefkm@gmail.com, mturquette@baylibre.com, sboyd@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, cjd@cjdns.fr, tsbogend@alpha.franken.de, ryder.lee@mediatek.com, jianjun.wang@mediatek.com, lpieralisi@kernel.org, kwilczynski@kernel.org, mani@kernel.org, bhelgaas@google.com, vkoul@kernel.org, neil.armstrong@linaro.org, p.zabel@pengutronix.de, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, nbd@nbd.name, ansuelsmth@gmail.com, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 5/8] dt-bindings: PCI: mediatek: Add support for EcoNet EN7528 Date: Tue, 3 Mar 2026 19:09:45 +0000 Message-Id: <20260303190948.694783-6-cjd@cjdns.fr> In-Reply-To: <20260303190948.694783-1-cjd@cjdns.fr> References: <20260303190948.694783-1-cjd@cjdns.fr> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Content-Type: text/plain; charset="utf-8" Introduce EcoNet EN7528 SoC compatible in MediaTek PCIe controller binding. EcoNet PCIe controller has the same configuration model as Mediatek v2 but is initiallized more similarly to an MT7621 PCIe. Signed-off-by: Caleb James DeLisle --- Documentation/devicetree/bindings/pci/mediatek-pcie.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/pci/mediatek-pcie.yaml b/Doc= umentation/devicetree/bindings/pci/mediatek-pcie.yaml index 0b8c78ec4f91..57cbfbff7a31 100644 --- a/Documentation/devicetree/bindings/pci/mediatek-pcie.yaml +++ b/Documentation/devicetree/bindings/pci/mediatek-pcie.yaml @@ -14,6 +14,7 @@ properties: oneOf: - enum: - airoha,an7583-pcie + - econet,en7528-pcie - mediatek,mt2712-pcie - mediatek,mt7622-pcie - mediatek,mt7629-pcie --=20 2.39.5 From nobody Thu Apr 9 17:58:36 2026 Received: from mail.cjdns.fr (mail.cjdns.fr [5.135.140.105]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 220E142F561; Tue, 3 Mar 2026 19:10:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=5.135.140.105 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772565055; cv=none; b=aDscVr50d1bNjXIWlYkRxewnwj61PeOM+M/uvAz+PpyYj02UkOiB6Om4wfh/nEQCNWGkebGz+x58xJ7/hq+oImO81xUYrLzMivO3LXX75SD+t2NbRxvJ9eLBUNohNiDDwVnf/nadRvTw+k++C3Dpn7B0lPau73S1Ho6tCnq/94c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772565055; c=relaxed/simple; bh=N21WoA4WnoV7sNWxL6LzeCVx4yyhCzot6nCyWBk11PM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ZHzpEZ+WUv/FVt1XWqHc6CLozgRpCEIoql0uNt+IHEl+GQwpYDWF1cDXd89CNtx5RZ3I7dDtIfzDpRQYdUbsqwmy5m3FGWYrkI/mc9wjMH7uJjeGH5/6ZdtjfkPXwcbjTI3ftkphkR4M8L1ajiVlqlc2SDv1nHO9JWoyb/Jj1HU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cjdns.fr; spf=none smtp.mailfrom=cjdns.fr; dkim=pass (2048-bit key) header.d=cjdns.fr header.i=@cjdns.fr header.b=teD0j/Uq; arc=none smtp.client-ip=5.135.140.105 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cjdns.fr Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=cjdns.fr Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cjdns.fr header.i=@cjdns.fr header.b="teD0j/Uq" Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id EA22320D656; Tue, 3 Mar 2026 20:10:47 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cjdns.fr; s=dkim; t=1772565051; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=zEmtdeq4xEYtlpRMytANqMxIEkC5Du/Uguc6zbJcHRQ=; b=teD0j/Uqpg+mWLF/Da7WawPn5xFKfjlmKqr0uetcIzYxT7qZIyNimFStz2l2Y3C/hLXs0p 8FLVwZFLwxUphSxs8xim/RT19lAtjhu34wz25RJ2rA3r+bOgcuTnGy3kiwlF6xljNOZOe7 zAUwdawyAaRUXC4JtiJJ7Xb5y+fz1KZp97I0c+s86tHlr6Kh3I2wpp0ZgnzYPd6D39rWDS 1JrOxvSP31J//wfPKh+X5jnkKxgXrQRdkHUpJ3CYuAkvr8VyLmmZfkb/+zmscBVa58WCVb ATS9fISoWI2fvgaDGINz7ytLRcy2pU1oiVbBl+HsQFYJ/Y8AZjuz7mLwgXMYwQ== From: Caleb James DeLisle To: linux-mips@vger.kernel.org Cc: naseefkm@gmail.com, mturquette@baylibre.com, sboyd@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, cjd@cjdns.fr, tsbogend@alpha.franken.de, ryder.lee@mediatek.com, jianjun.wang@mediatek.com, lpieralisi@kernel.org, kwilczynski@kernel.org, mani@kernel.org, bhelgaas@google.com, vkoul@kernel.org, neil.armstrong@linaro.org, p.zabel@pengutronix.de, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, nbd@nbd.name, ansuelsmth@gmail.com, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 6/8] PCI: mediatek: Add support for EcoNet EN7528 SoC Date: Tue, 3 Mar 2026 19:09:46 +0000 Message-Id: <20260303190948.694783-7-cjd@cjdns.fr> In-Reply-To: <20260303190948.694783-1-cjd@cjdns.fr> References: <20260303190948.694783-1-cjd@cjdns.fr> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Content-Type: text/plain; charset="utf-8" Add support for the PCIe present on the EcoNet EN7528 (and EN751221) SoCs. These SoCs have a mix of Gen1 and Gen2 capable ports, but the Gen2 ports require re-training after startup. Signed-off-by: Ahmed Naseef [cjd@cjdns.fr: Trivial change, reorder of_device_id alphabetical] Signed-off-by: Caleb James DeLisle --- drivers/pci/controller/Kconfig | 2 +- drivers/pci/controller/pcie-mediatek.c | 107 +++++++++++++++++++++++++ 2 files changed, 108 insertions(+), 1 deletion(-) diff --git a/drivers/pci/controller/Kconfig b/drivers/pci/controller/Kconfig index 5aaed8ac6e44..f6a5fcacb38d 100644 --- a/drivers/pci/controller/Kconfig +++ b/drivers/pci/controller/Kconfig @@ -209,7 +209,7 @@ config PCI_MVEBU =20 config PCIE_MEDIATEK tristate "MediaTek PCIe controller" - depends on ARCH_AIROHA || ARCH_MEDIATEK || COMPILE_TEST + depends on ARCH_AIROHA || ARCH_MEDIATEK || ECONET || COMPILE_TEST depends on OF depends on PCI_MSI select IRQ_MSI_LIB diff --git a/drivers/pci/controller/pcie-mediatek.c b/drivers/pci/controlle= r/pcie-mediatek.c index 5defa5cc4c2b..742edd05ee2b 100644 --- a/drivers/pci/controller/pcie-mediatek.c +++ b/drivers/pci/controller/pcie-mediatek.c @@ -77,6 +77,7 @@ =20 #define PCIE_CONF_VEND_ID 0x100 #define PCIE_CONF_DEVICE_ID 0x102 +#define PCIE_CONF_REV_CLASS 0x104 #define PCIE_CONF_CLASS_ID 0x106 =20 #define PCIE_INT_MASK 0x420 @@ -89,6 +90,11 @@ #define MSI_MASK BIT(23) #define MTK_MSI_IRQS_NUM 32 =20 +#define EN7528_HOST_MODE 0x00804201 +#define EN7528_LINKUP_REG 0x50 +#define EN7528_RC0_LINKUP BIT(1) +#define EN7528_RC1_LINKUP BIT(2) + #define PCIE_AHB_TRANS_BASE0_L 0x438 #define PCIE_AHB_TRANS_BASE0_H 0x43c #define AHB2PCIE_SIZE(x) ((x) & GENMASK(4, 0)) @@ -753,6 +759,86 @@ static int mtk_pcie_startup_port_v2(struct mtk_pcie_po= rt *port) return 0; } =20 +static int mtk_pcie_startup_port_en7528(struct mtk_pcie_port *port) +{ + struct mtk_pcie *pcie =3D port->pcie; + struct pci_host_bridge *host =3D pci_host_bridge_from_priv(pcie); + struct resource *mem =3D NULL; + struct resource_entry *entry; + u32 val, link_mask; + int err; + + entry =3D resource_list_first_type(&host->windows, IORESOURCE_MEM); + if (entry) + mem =3D entry->res; + if (!mem) + return -EINVAL; + + if (!pcie->cfg) { + dev_err(pcie->dev, "EN7528: pciecfg syscon not available\n"); + return -EINVAL; + } + + /* Assert all reset signals */ + writel(0, port->base + PCIE_RST_CTRL); + + /* + * Enable PCIe link down reset, if link status changed from link up to + * link down, this will reset MAC control registers and configuration + * space. + */ + writel(PCIE_LINKDOWN_RST_EN, port->base + PCIE_RST_CTRL); + + /* + * Described in PCIe CEM specification sections 2.2 (PERST# Signal) and + * 2.2.1 (Initial Power-Up (G3 to S0)). The deassertion of PERST# + * should be delayed 100ms (TPVPERL) for the power and clock to become + * stable. + */ + msleep(100); + + /* De-assert PHY, PE, PIPE, MAC and configuration reset */ + val =3D readl(port->base + PCIE_RST_CTRL); + val |=3D PCIE_PHY_RSTB | PCIE_PERSTB | PCIE_PIPE_SRSTB | + PCIE_MAC_SRSTB | PCIE_CRSTB; + writel(val, port->base + PCIE_RST_CTRL); + + writel(PCIE_CLASS_CODE | PCIE_REVISION_ID, + port->base + PCIE_CONF_REV_CLASS); + writel(EN7528_HOST_MODE, port->base); + + link_mask =3D (port->slot =3D=3D 0) ? EN7528_RC0_LINKUP : EN7528_RC1_LINK= UP; + + /* 100ms timeout value should be enough for Gen1/2 training */ + err =3D regmap_read_poll_timeout(pcie->cfg, EN7528_LINKUP_REG, val, + !!(val & link_mask), 20, + 100 * USEC_PER_MSEC); + if (err) { + dev_err(pcie->dev, "EN7528: port%d link timeout\n", port->slot); + return -ETIMEDOUT; + } + + /* Set INTx mask */ + val =3D readl(port->base + PCIE_INT_MASK); + val &=3D ~INTX_MASK; + writel(val, port->base + PCIE_INT_MASK); + + if (IS_ENABLED(CONFIG_PCI_MSI)) + mtk_pcie_enable_msi(port); + + /* Set AHB to PCIe translation windows */ + val =3D lower_32_bits(mem->start) | + AHB2PCIE_SIZE(fls(resource_size(mem))); + writel(val, port->base + PCIE_AHB_TRANS_BASE0_L); + + val =3D upper_32_bits(mem->start); + writel(val, port->base + PCIE_AHB_TRANS_BASE0_H); + + writel(WIN_ENABLE, port->base + PCIE_AXI_WINDOW0); + + return 0; +} + static void __iomem *mtk_pcie_map_bus(struct pci_bus *bus, unsigned int devfn, int where) { @@ -1149,6 +1235,20 @@ static int mtk_pcie_probe(struct platform_device *pd= ev) if (err) goto put_resources; =20 + /* Retrain Gen1 links to reach Gen2 where supported */ + if (pcie->soc->startup =3D=3D mtk_pcie_startup_port_en7528) { + struct pci_bus *bus =3D host->bus; + struct pci_dev *rc =3D NULL; + + while ((rc =3D pci_get_class(PCI_CLASS_BRIDGE_PCI << 8, rc))) { + if (rc->bus !=3D bus) + continue; + if (!pcie_retrain_link(rc, true)) + dev_info(dev, "port%d link retrained\n", + PCI_SLOT(rc->devfn)); + } + } + return 0; =20 put_resources: @@ -1264,8 +1364,15 @@ static const struct mtk_pcie_soc mtk_pcie_soc_mt7629= =3D { .quirks =3D MTK_PCIE_FIX_CLASS_ID | MTK_PCIE_FIX_DEVICE_ID, }; =20 +static const struct mtk_pcie_soc mtk_pcie_soc_en7528 =3D { + .ops =3D &mtk_pcie_ops_v2, + .startup =3D mtk_pcie_startup_port_en7528, + .setup_irq =3D mtk_pcie_setup_irq, +}; + static const struct of_device_id mtk_pcie_ids[] =3D { { .compatible =3D "airoha,an7583-pcie", .data =3D &mtk_pcie_soc_an7583 }, + { .compatible =3D "econet,en7528-pcie", .data =3D &mtk_pcie_soc_en7528 }, { .compatible =3D "mediatek,mt2701-pcie", .data =3D &mtk_pcie_soc_v1 }, { .compatible =3D "mediatek,mt7623-pcie", .data =3D &mtk_pcie_soc_v1 }, { .compatible =3D "mediatek,mt2712-pcie", .data =3D &mtk_pcie_soc_mt2712 = }, --=20 2.39.5 From nobody Thu Apr 9 17:58:36 2026 Received: from mail.cjdns.fr (mail.cjdns.fr [5.135.140.105]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7D0C6382F12; Tue, 3 Mar 2026 19:11:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=5.135.140.105 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772565063; cv=none; b=Wq9H8H0p6L1eCtYj8Qv0xmnN0cKZaa63wO9e1bNl2BIbY2eY2gLCUUottak88R9XFr10lU6Cwmn+Uybrvn0HhYdBidEYFPW8O1s16chL9UF5kF7XlY8qCVxuW6MT7BDbJW37bZaeQIUKHAHg/2+bPy08SbAMYFxmq0yFubdU+6A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772565063; c=relaxed/simple; bh=2PGhMj57dGEEnmOANxIdlxwcYZLmDMBqSl2hvks6d58=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ePfXmkumldN60NUlFyVnksrRRJDUdL/5LZ+Md325jpFl1PnUJJIGroCJAnStHl8eVUxZqVNrbHb4RBkMnUJwfG1xCM22YaRAimfswYbUIonHu2SZW1NG62lvBViWRiqB2bZuo/KPUh3UT4rBnqK9kDloA4RYM7I/uWUSkhv443U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cjdns.fr; spf=none smtp.mailfrom=cjdns.fr; dkim=pass (2048-bit key) header.d=cjdns.fr header.i=@cjdns.fr header.b=jlAk8tuO; arc=none smtp.client-ip=5.135.140.105 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cjdns.fr Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=cjdns.fr Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cjdns.fr header.i=@cjdns.fr header.b="jlAk8tuO" Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 3DFE720DF03; Tue, 3 Mar 2026 20:10:54 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cjdns.fr; s=dkim; t=1772565060; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=sAjJy21W8Agl7xSVLMb1bYPAsur47qRis49LdPPUGDE=; b=jlAk8tuOwAMhUY7Z41ziDfc0b593+d4+uTFvd9os9WUVwg9yOqTmu74N8h8QDkLzqohVqa JrvcgRl1WjOtLnmjkuA4IzW+Qvjys/XflU+VorZ5PvItFL/pFxmNQvByu7sofhq9FiSlSk AHqEwE2ZwEhCt5iAgSJf85eyuzyT3U6kzvE8XtggOqLeQn25Pw7NavGI5COzFG/r/giKTF xNxcSGgRaH40XMdfc7lfsmDYyjSfZ7wgnQBxrZgM2Yu5hjyjY02lmQpt+vYgY6JThmT5rH gPYPurVcGGRgO3xRe3V0TsucEPUOmWdDNUkQdYCpR5q0K9C+oSRsp9WeIIgkZA== From: Caleb James DeLisle To: linux-mips@vger.kernel.org Cc: naseefkm@gmail.com, mturquette@baylibre.com, sboyd@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, cjd@cjdns.fr, tsbogend@alpha.franken.de, ryder.lee@mediatek.com, jianjun.wang@mediatek.com, lpieralisi@kernel.org, kwilczynski@kernel.org, mani@kernel.org, bhelgaas@google.com, vkoul@kernel.org, neil.armstrong@linaro.org, p.zabel@pengutronix.de, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, nbd@nbd.name, ansuelsmth@gmail.com, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Bjorn Helgaas Subject: [PATCH 7/8] PCI: Skip bridge window reads when window is not supported Date: Tue, 3 Mar 2026 19:09:47 +0000 Message-Id: <20260303190948.694783-8-cjd@cjdns.fr> In-Reply-To: <20260303190948.694783-1-cjd@cjdns.fr> References: <20260303190948.694783-1-cjd@cjdns.fr> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Content-Type: text/plain; charset="utf-8" pci_read_bridge_io() and pci_read_bridge_mmio_pref() read bridge window registers unconditionally. If the registers are hardwired to zero (not implemented), both base and limit will be 0. Since (0 <=3D 0) is true, a bogus window [mem 0x00000000-0x000fffff] or [io 0x0000-0x0fff] gets created. pci_read_bridge_windows() already detects unsupported windows by testing register writability and sets io_window/pref_window flags accordingly. Check these flags at the start of pci_read_bridge_io() and pci_read_bridge_mmio_pref() to skip reading registers when the window is not supported. Suggested-by: Bjorn Helgaas Signed-off-by: Ahmed Naseef Signed-off-by: Caleb James DeLisle Acked-by: Bjorn Helgaas --- drivers/pci/probe.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index bccc7a4bdd79..4eacb741b4ec 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -395,6 +395,9 @@ static void pci_read_bridge_io(struct pci_dev *dev, str= uct resource *res, unsigned long io_mask, io_granularity, base, limit; struct pci_bus_region region; =20 + if (!dev->io_window) + return; + io_mask =3D PCI_IO_RANGE_MASK; io_granularity =3D 0x1000; if (dev->io_window_1k) { @@ -465,6 +468,9 @@ static void pci_read_bridge_mmio_pref(struct pci_dev *d= ev, struct resource *res, pci_bus_addr_t base, limit; struct pci_bus_region region; =20 + if (!dev->pref_window) + return; + pci_read_config_word(dev, PCI_PREF_MEMORY_BASE, &mem_base_lo); pci_read_config_word(dev, PCI_PREF_MEMORY_LIMIT, &mem_limit_lo); base64 =3D (mem_base_lo & PCI_PREF_RANGE_MASK) << 16; --=20 2.39.5 From nobody Thu Apr 9 17:58:36 2026 Received: from mail.cjdns.fr (mail.cjdns.fr [5.135.140.105]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ADC2230EF92; Tue, 3 Mar 2026 19:11:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=5.135.140.105 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772565069; cv=none; b=p4ljKp+c4T0opJG8oJmnRhFXen7WH9b13op0L/wOx7R+sZYn60BRnc1QHRuetVRzEziWmZTsIL+gkkKtM5zfvEeAjdRqAr2gPHL6+VxnVCgktKmVcruGY1mM5pRp1jYw7rK8DrP3+Nm5klQgneNObTW4PsE6dz7unHiFS9QRvfg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772565069; c=relaxed/simple; bh=YYdCNmICXyoE9G4Y7GKLEAq2DFORBQxJvXK7jOn4rz4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ke9kMvo7p5qY98j3ibVeeq19jeqgNZkjccSZe/0Z5R12gEHbRaS0PK9juWYbdgq9USQ6Mz60gLxbNLiHLvyzO+yIxdjM3FKbvvtdOt+GSYzU4/m7N9/JNsbhfizmD10kYBzdDw0DAK24I4LTwDcmR1wnfNZh64wHnK8wf0fcdpY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cjdns.fr; spf=none smtp.mailfrom=cjdns.fr; dkim=pass (2048-bit key) header.d=cjdns.fr header.i=@cjdns.fr header.b=bRsYtwyu; arc=none smtp.client-ip=5.135.140.105 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cjdns.fr Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=cjdns.fr Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cjdns.fr header.i=@cjdns.fr header.b="bRsYtwyu" Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 23B5F20DC57; Tue, 3 Mar 2026 20:11:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cjdns.fr; s=dkim; t=1772565064; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=K0no2injFDHLVnfrCxmhoW8zcILT+gNWAee+yl4dH+g=; b=bRsYtwyu5VOOa4UQxgN/usRqhBSbS3J6drtmNGBxPTeANU5YzXDljSFJJ8rLS8OpMbDtNK oS76OoD2SqpVQWjBcgnyRqarWGk7adiHEP16ZsNH2XKgDXJ/P4A+O3ldqKi1TM/9FA7+Sh SdpLD45P/mk9GBRl0Wvf6bNGIMi8hlfI+nzl6iJPkcgX8Y90/0mdvwdJNmSxH/5+cljoR6 gw9Nf7DGaOxctHbNWfHHavjgmD92r4dLX96wCwvC6u+A95NjzAKY71BsFaGoZhCf8cwJSS xDgvGZVK8eYH+D1ZbQ63Q4cTarjv9cMBKy5Q/0CiKRGuIqtiHFnCXD8CFG12IA== From: Caleb James DeLisle To: linux-mips@vger.kernel.org Cc: naseefkm@gmail.com, mturquette@baylibre.com, sboyd@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, cjd@cjdns.fr, tsbogend@alpha.franken.de, ryder.lee@mediatek.com, jianjun.wang@mediatek.com, lpieralisi@kernel.org, kwilczynski@kernel.org, mani@kernel.org, bhelgaas@google.com, vkoul@kernel.org, neil.armstrong@linaro.org, p.zabel@pengutronix.de, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, nbd@nbd.name, ansuelsmth@gmail.com, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 8/8] mips: dts: Add PCIe to EcoNet EN751221 Date: Tue, 3 Mar 2026 19:09:48 +0000 Message-Id: <20260303190948.694783-9-cjd@cjdns.fr> In-Reply-To: <20260303190948.694783-1-cjd@cjdns.fr> References: <20260303190948.694783-1-cjd@cjdns.fr> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Content-Type: text/plain; charset="utf-8" Add PCIe based on EN7528 PCIe driver, also add two MT76 wifi devices to SmartFiber XP8421-B. Signed-off-by: Caleb James DeLisle --- arch/mips/boot/dts/econet/en751221.dtsi | 114 ++++++++++++++++++ .../econet/en751221_smartfiber_xp8421-b.dts | 21 ++++ arch/mips/econet/Kconfig | 2 + 3 files changed, 137 insertions(+) diff --git a/arch/mips/boot/dts/econet/en751221.dtsi b/arch/mips/boot/dts/e= conet/en751221.dtsi index 2abeef5b744a..5568486ad8b5 100644 --- a/arch/mips/boot/dts/econet/en751221.dtsi +++ b/arch/mips/boot/dts/econet/en751221.dtsi @@ -1,6 +1,8 @@ // SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) /dts-v1/; =20 +#include + / { compatible =3D "econet,en751221"; #address-cells =3D <1>; @@ -30,6 +32,30 @@ cpuintc: interrupt-controller { #interrupt-cells =3D <1>; }; =20 + chip_scu: syscon@1fa20000 { + compatible =3D "econet,en751221-chip-scu", "syscon"; + reg =3D <0x1fa20000 0x388>; + }; + + pcie_phy1: pcie-phy@1fac0000 { + compatible =3D "econet,en751221-pcie-phy1"; + reg =3D <0x1fac0000 0x1000>; + #phy-cells =3D <0>; + }; + + pcie_phy0: pcie-phy@1faf2000 { + compatible =3D "econet,en751221-pcie-phy0"; + reg =3D <0x1faf2000 0x1000>; + #phy-cells =3D <0>; + }; + + scuclk: clock-controller@1fb00000 { + compatible =3D "econet,en751221-scu", "syscon"; + reg =3D <0x1fb00000 0x970>; + #clock-cells =3D <1>; + #reset-cells =3D <1>; + }; + intc: interrupt-controller@1fb40000 { compatible =3D "econet,en751221-intc"; reg =3D <0x1fb40000 0x100>; @@ -41,6 +67,94 @@ intc: interrupt-controller@1fb40000 { econet,shadow-interrupts =3D <7 2>, <8 3>, <13 12>, <30 29>; }; =20 + pciecfg: pciecfg@1fb80000 { + compatible =3D "mediatek,generic-pciecfg", "syscon"; + reg =3D <0x1fb80000 0x1000>; + }; + + pcie0: pcie@1fb81000 { + compatible =3D "econet,en7528-pcie"; + device_type =3D "pci"; + reg =3D <0x1fb81000 0x1000>; + reg-names =3D "port0"; + linux,pci-domain =3D <0>; + #address-cells =3D <3>; + #size-cells =3D <2>; + interrupt-parent =3D <&intc>; + interrupts =3D <23>; + interrupt-names =3D "pcie_irq"; + clocks =3D <&scuclk EN751221_CLK_PCIE>; + clock-names =3D "sys_ck0"; + phys =3D <&pcie_phy0>; + phy-names =3D "pcie-phy0"; + bus-range =3D <0x00 0xff>; + ranges =3D <0x01000000 0 0x00000000 0x1f600000 0 0x00008000>, + <0x82000000 0 0x20000000 0x20000000 0 0x08000000>; + status =3D "disabled"; + + #interrupt-cells =3D <1>; + interrupt-map-mask =3D <0 0 0 7>; + interrupt-map =3D <0 0 0 1 &pcie_intc0 0>, + <0 0 0 2 &pcie_intc0 1>, + <0 0 0 3 &pcie_intc0 2>, + <0 0 0 4 &pcie_intc0 3>; + + pcie_intc0: interrupt-controller { + interrupt-controller; + #address-cells =3D <0>; + #interrupt-cells =3D <1>; + }; + + slot0: pcie@0,0 { + reg =3D <0x0000 0 0 0 0>; + device_type =3D "pci"; + #address-cells =3D <3>; + #size-cells =3D <2>; + ranges; + }; + }; + + pcie1: pcie@1fb83000 { + compatible =3D "econet,en7528-pcie"; + device_type =3D "pci"; + reg =3D <0x1fb83000 0x1000>; + reg-names =3D "port1"; + linux,pci-domain =3D <1>; + #address-cells =3D <3>; + #size-cells =3D <2>; + interrupt-parent =3D <&intc>; + interrupts =3D <24>; + interrupt-names =3D "pcie_irq"; + clocks =3D <&scuclk EN751221_CLK_PCIE>; + clock-names =3D "sys_ck1"; + phys =3D <&pcie_phy1>; + phy-names =3D "pcie-phy1"; + bus-range =3D <0x00 0xff>; + ranges =3D <0x81000000 0 0x00000000 0x1f608000 0 0x00008000>, + <0x82000000 0 0x28000000 0x28000000 0 0x08000000>; + status =3D "disabled"; + + #interrupt-cells =3D <1>; + interrupt-map-mask =3D <0 0 0 7>; + interrupt-map =3D <0 0 0 1 &pcie_intc1 0>, + <0 0 0 2 &pcie_intc1 1>, + <0 0 0 3 &pcie_intc1 2>, + <0 0 0 4 &pcie_intc1 3>; + + pcie_intc1: interrupt-controller { + interrupt-controller; + #address-cells =3D <0>; + #interrupt-cells =3D <1>; + }; + + slot1: pcie@1,0 { + reg =3D <0x0800 0 0 0 0>; + #address-cells =3D <3>; + #size-cells =3D <2>; + ranges; + }; + }; + uart: serial@1fbf0000 { compatible =3D "ns16550"; reg =3D <0x1fbf0000 0x30>; diff --git a/arch/mips/boot/dts/econet/en751221_smartfiber_xp8421-b.dts b/a= rch/mips/boot/dts/econet/en751221_smartfiber_xp8421-b.dts index 8223c5bce67f..c633bf73add6 100644 --- a/arch/mips/boot/dts/econet/en751221_smartfiber_xp8421-b.dts +++ b/arch/mips/boot/dts/econet/en751221_smartfiber_xp8421-b.dts @@ -17,3 +17,24 @@ chosen { linux,usable-memory-range =3D <0x00020000 0x1bfe0000>; }; }; + +&pcie0 { + status =3D "okay"; +}; +&slot0 { + wifi@0,0 { + /* MT7612E */ + compatible =3D "mediatek,mt76"; + reg =3D <0x0000 0 0 0 0>; + }; +}; +&pcie1 { + status =3D "okay"; +}; +&slot1 { + wifi@0,0 { + /* MT7592 */ + compatible =3D "mediatek,mt76"; + reg =3D <0x0000 0 0 0 0>; + }; +}; diff --git a/arch/mips/econet/Kconfig b/arch/mips/econet/Kconfig index fd69884cc9a8..b37b9d25d5a4 100644 --- a/arch/mips/econet/Kconfig +++ b/arch/mips/econet/Kconfig @@ -13,7 +13,9 @@ choice bool "EN751221 family" select COMMON_CLK select ECONET_EN751221_INTC + select HAVE_PCI select IRQ_MIPS_CPU + select PCI_DRIVERS_GENERIC select SMP select SMP_UP select SYS_SUPPORTS_SMP --=20 2.39.5