mips: econet: Add clk/reset and PCIe support
Subsystems (12)
Caleb James DeLisle
maintainerv2 cover mips: econet: Add clk/reset and PCIe support
Add clock/reset and PCIe support to EcoNet EN751221 and related SoCs. This builds on the Airoha EN7523 clock driver and the Mediatek PCIe driver.
Patch 6 is upstreaming of Ahmed Naseef's work on EcoNet PCIe, which was developed to support the EN7528, but which works equally on the EN751221.
There is also a workaround in patch 7 to gracefully handle PCI hardware which does not advertize a bridge window and instead always reads zero.
Changes in v2:
* clock/econet,en751221-scu.h drop EN751221_MAX_CLKS
* clk-en7523.c add EN751221_MAX_CLKS
* econet,en751221-chip-scu.yaml drop in favor of using mtd/syscon.yaml
* airoha,en7523-scu.yaml drop redundant example
* econet,en751221-pcie-phy.yaml Refer to PHYs as "gen1" and "gen2"
* pcie-mediatek.c Exclude pcie_retrain_link() when building as a module
* en751221.dtsi "econet,en751221-scu" is not a "syscon"
* Rebase to linux-next
* v1: https://lore.kernel.org/linux-mips/[email protected]/
Caleb James DeLisle (8):
dt-bindings: clock, reset: Add econet EN751221
clk: airoha: Add econet EN751221 clock/reset support to en7523-scu
dt-bindings: phy: Document PCIe PHY in EcoNet EN751221 and EN7528
phy: econet: Add PCIe PHY driver for EcoNet EN751221 and EN7528 SoCs.
dt-bindings: PCI: mediatek: Add support for EcoNet EN7528
PCI: mediatek: Add support for EcoNet EN7528 SoC
PCI: Skip bridge window reads when window is not supported
mips: dts: Add PCIe to EcoNet EN751221
.../bindings/clock/airoha,en7523-scu.yaml | 7 +- .../devicetree/bindings/mfd/syscon.yaml | 2 + .../bindings/pci/mediatek-pcie.yaml | 1 + .../phy/econet,en751221-pcie-phy.yaml | 50 ++++ MAINTAINERS | 9 + arch/mips/boot/dts/econet/en751221.dtsi | 114 +++++++++ .../econet/en751221_smartfiber_xp8421-b.dts | 21 ++ arch/mips/econet/Kconfig | 2 + drivers/clk/Kconfig | 6 +- drivers/clk/clk-en7523.c | 238 +++++++++++++++++- drivers/pci/controller/Kconfig | 2 +- drivers/pci/controller/pcie-mediatek.c | 118 +++++++++ drivers/pci/probe.c | 6 + drivers/phy/Kconfig | 12 + drivers/phy/Makefile | 1 + drivers/phy/phy-econet-pcie.c | 180 +++++++++++++ .../dt-bindings/clock/econet,en751221-scu.h | 13 + .../dt-bindings/reset/econet,en751221-scu.h | 49 ++++ 18 files changed, 821 insertions(+), 10 deletions(-) create mode 100644 Documentation/devicetree/bindings/phy/econet,en751221-pcie-phy.yaml create mode 100644 drivers/phy/phy-econet-pcie.c create mode 100644 include/dt-bindings/clock/econet,en751221-scu.h create mode 100644 include/dt-bindings/reset/econet,en751221-scu.h
base-commit: 3fa5e5702a82d259897bd7e209469bc06368bf31
Signature · 1 line
2.39.5
Caleb James DeLisle
maintainerPATCH v2 1/8 dt-bindings: clock, reset: Add econet EN751221
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.
--- .../bindings/clock/airoha,en7523-scu.yaml | 7 ++- .../devicetree/bindings/mfd/syscon.yaml | 2 + MAINTAINERS | 2 + .../dt-bindings/clock/econet,en751221-scu.h | 13 +++++ .../dt-bindings/reset/econet,en751221-scu.h | 49 +++++++++++++++++++ 5 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 include/dt-bindings/clock/econet,en751221-scu.h create mode 100644 include/dt-bindings/reset/econet,en751221-scu.h
Documentation/devicetree/bindings/clock/airoha,en7523-scu.yaml +6 -1
@@ -32,6 +32,7 @@ properties: - enum: - airoha,en7523-scu - airoha,en7581-scu + - econet,en751221-scu 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,4 @@ examples: #reset-cells = <1>; }; }; +
Documentation/devicetree/bindings/mfd/syscon.yaml +2 -0
@@ -61,6 +61,7 @@ select: - cirrus,ep7209-syscon2 - cirrus,ep7209-syscon3 - cnxt,cx92755-uc + - econet,en751221-chip-scu - freecom,fsg-cs2-system-controller - fsl,imx93-aonmix-ns-syscfg - fsl,imx93-wakeupmix-syscfg
@@ -173,6 +174,7 @@ properties: - cirrus,ep7209-syscon2 - cirrus,ep7209-syscon3 - cnxt,cx92755-uc + - econet,en751221-chip-scu - freecom,fsg-cs2-system-controller - fsl,imx93-aonmix-ns-syscfg - fsl,imx93-wakeupmix-syscfg
MAINTAINERS +2 -0
@@ -9119,6 +9119,8 @@ 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 ECRYPT FILE SYSTEM M: Tyler Hicks <[email protected]>
include/dt-bindings/clock/econet,en751221-scu.h new file +13 -0
@@ -0,0 +1,13 @@ +/* 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 + +#endif /* _DT_BINDINGS_CLOCK_ECONET_EN751221_SCU_H_ */
include/dt-bindings/reset/econet,en751221-scu.h new file +49 -0
49 lines not on this page · raw message
Signature · 1 line
2.39.5
Re: [PATCH v2 1/8] dt-bindings: clock, reset: Add econet EN751221
Quoted 21 lines · Caleb James DeLisle
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 <[email protected]>--- .../bindings/clock/airoha,en7523-scu.yaml | 7 ++- .../devicetree/bindings/mfd/syscon.yaml | 2 + MAINTAINERS | 2 + .../dt-bindings/clock/econet,en751221-scu.h | 13 +++++ .../dt-bindings/reset/econet,en751221-scu.h | 49 +++++++++++++++++++ 5 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 include/dt-bindings/clock/econet,en751221-scu.h create mode 100644 include/dt-bindings/reset/econet,en751221-scu.hDocumentation/devicetree/bindings/clock/airoha,en7523-scu.yaml +0
-0
Documentation/devicetree/bindings/clock/airoha,en7523-scu.yaml properties: · line 35
Quoted 4 lines
Documentation/devicetree/bindings/clock/airoha,en7523-scu.yaml +1
-0@@ -32,6 +32,7 @@ properties: - enum: - airoha,en7523-scu - airoha,en7581-scu + - econet,en751221-scu
751 < 752, keep alphanumeric order
Documentation/devicetree/bindings/clock/airoha,en7523-scu.yaml allOf: · line 71
Quoted 9 lines
Documentation/devicetree/bindings/clock/airoha,en7523-scu.yaml +1
-1reg: items:@@ -67,7 +68,10 @@ allOf: - if: properties: compatible: - const: airoha,en7581-scu + items:
<form letter>
This is a friendly reminder during the review process.
It seems my or other reviewer's previous comments were not fully addressed. Maybe the feedback got lost between the quotes, maybe you just forgot to apply it. Please go back to the previous discussion and either implement all requested changes or keep discussing them.
Thank you.
</form letter>
Best regards,
Krzysztof
Caleb James DeLisle
maintainerRe: [PATCH v2 1/8] dt-bindings: clock, reset: Add econet EN751221
Quoted 17 lines · Krzysztof Kozlowski
Quoted 16 lines · Caleb James DeLisle
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 <[email protected]>--- .../bindings/clock/airoha,en7523-scu.yaml | 7 ++- .../devicetree/bindings/mfd/syscon.yaml | 2 + MAINTAINERS | 2 + .../dt-bindings/clock/econet,en751221-scu.h | 13 +++++ .../dt-bindings/reset/econet,en751221-scu.h | 49 +++++++++++++++++++ 5 files changed, 72 insertions(+), 1 deletion(-)create mode 100644
include/dt-bindings/clock/econet,en751221-scu.hcreate mode 100644include/dt-bindings/reset/econet,en751221-scu.h
Quoted 10 lines
Documentation/devicetree/bindings/clock/airoha,en7523-scu.yaml properties: · line 35
Quoted 9 lines
Documentation/devicetree/bindings/clock/airoha,en7523-scu.yaml +1
-0@@ -32,6 +32,7 @@ properties: - enum: - airoha,en7523-scu - airoha,en7581-scu + - econet,en751221-scu751 < 752, keep alphanumeric order
"econet," after "airoha," because e > a, of course I can order by number if that's really what you want.
Quoted 12 lines
Documentation/devicetree/bindings/clock/airoha,en7523-scu.yaml allOf: · line 71
Quoted 10 lines
Documentation/devicetree/bindings/clock/airoha,en7523-scu.yaml +1
-1reg: items:@@ -67,7 +68,10 @@ allOf: - if: properties: compatible: - const: airoha,en7581-scu + items:<form letter>
This is a friendly reminder during the review process.
My apologies, I missed this one when I was collecting notes and updating. Will fix.
"Drop items, it's just enum"
Thanks,
Caleb
Quoted 12 lines
It seems my or other reviewer's previous comments were not fully addressed. Maybe the feedback got lost between the quotes, maybe you just forgot to apply it. Please go back to the previous discussion and either implement all requested changes or keep discussing them.
Thank you.
</form letter>Best regards,
Krzysztof
Re: [PATCH v2 1/8] dt-bindings: clock, reset: Add econet EN751221
Quoted 12 lines · Caleb James DeLisle
Quoted 10 lines
Documentation/devicetree/bindings/clock/airoha,en7523-scu.yaml properties: · line 35
Quoted 9 lines
Documentation/devicetree/bindings/clock/airoha,en7523-scu.yaml +1
-0@@ -32,6 +32,7 @@ properties: - enum: - airoha,en7523-scu - airoha,en7581-scu + - econet,en751221-scu751 < 752, keep alphanumeric order
Quoted 2 lines
"econet," after "airoha," because e > a, of course I can order by number if that's really what you want.
Ah, yes, code is correct.
Best regards,
Krzysztof
Caleb James DeLisle
maintainerPATCH v2 2/8 clk: airoha: Add econet EN751221 clock/reset support to en7523-scu
In reply to Caleb James DeLisleEcoNet 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.
--- drivers/clk/Kconfig | 6 +- drivers/clk/clk-en7523.c | 238 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 236 insertions(+), 8 deletions(-)
drivers/clk/Kconfig +3 -3
@@ -218,13 +218,13 @@ config COMMON_CLK_CS2000_CP If you say yes here you get support for the CS2000 clock multiplier. 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. config COMMON_CLK_EP93XX tristate "Clock driver for Cirrus Logic ep93xx SoC"
drivers/clk/clk-en7523.c +233 -5
316 lines not on this page · raw message
Signature · 1 line
2.39.5
Re: [PATCH v2 2/8] clk: airoha: Add econet EN751221 clock/reset support to en7523-scu
Hi Caleb,
Quoted 190 lines · Caleb James DeLisle
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 <[email protected]>--- drivers/clk/Kconfig | 6 +- drivers/clk/clk-en7523.c | 238 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 236 insertions(+), 8 deletions(-)drivers/clk/Kconfig +3
-3@@ -218,13 +218,13 @@ config COMMON_CLK_CS2000_CP If you say yes here you get support for the CS2000 clock multiplier. 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. config COMMON_CLK_EP93XX tristate "Clock driver for Cirrus Logic ep93xx SoC"drivers/clk/clk-en7523.c +100
-1@@ -1,5 +1,6 @@// SPDX-License-Identifier: GPL-2.0-only +#include <linux/bitfield.h> #include <linux/delay.h> #include <linux/clk-provider.h> #include <linux/io.h> @@ -11,6 +12,8 @@#include <dt-bindings/clock/en7523-clk.h> #include <dt-bindings/reset/airoha,en7523-reset.h> #include <dt-bindings/reset/airoha,en7581-reset.h> +#include <dt-bindings/clock/econet,en751221-scu.h> +#include <dt-bindings/reset/econet,en751221-scu.h> #define RST_NR_PER_BANK 32@@ -33,15 +36,49 @@#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)#define REG_RST_CTRL2 0x830#define REG_RST_CTRL1 0x834 +#define EN751221_REG_RST_DMT 0x84 +#define EN751221_REG_RST_USB 0xec + +#define EN751221_MAX_CLKS 6 + +enum en_hir { +HIR_UNKNOWN =-1 , +HIR_TC3169 =0 , +HIR_TC3182 =1 , +HIR_RT65168 =2 , +HIR_RT63165 =3 , +HIR_RT63365 =4 , +HIR_MT751020 =5 , +HIR_MT7505 =6 , +HIR_EN751221 =7 , +HIR_EN7526C =8 , +HIR_EN751627 =9 , +HIR_EN7580 =10 , +HIR_EN7528 =11 , +HIR_EN7523 =12 , +HIR_EN7581 =13 , +HIR_MAX =14 , +};struct en_clk_desc {int id;@@ -93,6 +130,8 @@ static const u32 bus7581_base[] = { 600000000, 540000000 };static const u32 npu7581_base[] = {800000000 ,750000000 ,720000000 ,600000000 };static const u32 crypto_base[] = {540000000 ,480000000 };static const u32 emmc7581_base[] = {200000000 ,150000000 }; +/* EN751221 */ +static const u32 gsw751221_base[] = {500000000 ,250000000 ,400000000 ,200000000 };static const struct en_clk_desc en7523_base_clks[] = { {@@ -300,6 +339,13 @@ static const u16 en7581_rst_ofs[] = { REG_RST_CTRL1, }; +static const u16 en751221_rst_ofs[] = { +REG_RST_CTRL2 , +REG_RST_CTRL1 , +EN751221_REG_RST_DMT , +EN751221_REG_RST_USB , +}; +static const u16 en7523_rst_map[] = {/* RST_CTRL2 */ [EN7523_XPON_PHY_RST ] =0 ,@@ -405,8 +451,61 @@ static const u16 en7581_rst_map[] = { [EN7581_XPON_MAC_RST] = RST_NR_PER_BANK + 31, }; +static const u16 en751221_rst_map[] = { +/* RST_CTRL2 */ + [EN751221_XPON_PHY_RST ] =0 , + [EN751221_GFAST_RST ] =1 , + [EN751221_CPU_TIMER2_RST ] =2 , + [EN751221_UART3_RST ] =3 , + [EN751221_UART4_RST ] =4 , + [EN751221_UART5_RST ] =5 , + [EN751221_I2C2_RST ] =6 , + [EN751221_XSI_MAC_RST ] =7 , + [EN751221_XSI_PHY_RST ] =8 , + +/* RST_CTRL1 */ + [EN751221_PCM1_ZSI_ISI_RST ] =RST_NR_PER_BANK +0 , + [EN751221_FE_QDMA1_RST ] =RST_NR_PER_BANK +1 , + [EN751221_FE_QDMA2_RST ] =RST_NR_PER_BANK +2 , + [EN751221_FE_UNZIP_RST ] =RST_NR_PER_BANK +3 , + [EN751221_PCM2_RST ] =RST_NR_PER_BANK +4 , + [EN751221_PTM_MAC_RST ] =RST_NR_PER_BANK +5 , + [EN751221_CRYPTO_RST ] =RST_NR_PER_BANK +6 , + [EN751221_SAR_RST ] =RST_NR_PER_BANK +7 , + [EN751221_TIMER_RST ] =RST_NR_PER_BANK +8 , + [EN751221_INTC_RST ] =RST_NR_PER_BANK +9 , + [EN751221_BONDING_RST ] =RST_NR_PER_BANK +10 , + [EN751221_PCM1_RST ] =RST_NR_PER_BANK +11 , + [EN751221_UART_RST ] =RST_NR_PER_BANK +12 , + [EN751221_GPIO_RST ] =RST_NR_PER_BANK +13 , + [EN751221_GDMA_RST ] =RST_NR_PER_BANK +14 , + [EN751221_I2C_MASTER_RST ] =RST_NR_PER_BANK +16 , + [EN751221_PCM2_ZSI_ISI_RST ] =RST_NR_PER_BANK +17 , + [EN751221_SFC_RST ] =RST_NR_PER_BANK +18 , + [EN751221_UART2_RST ] =RST_NR_PER_BANK +19 , + [EN751221_GDMP_RST ] =RST_NR_PER_BANK +20 , + [EN751221_FE_RST ] =RST_NR_PER_BANK +21 , + [EN751221_USB_HOST_P0_RST ] =RST_NR_PER_BANK +22 , + [EN751221_GSW_RST ] =RST_NR_PER_BANK +23 , + [EN751221_SFC2_PCM_RST ] =RST_NR_PER_BANK +25 , + [EN751221_PCIE0_RST ] =RST_NR_PER_BANK +26 , + [EN751221_PCIE1_RST ] =RST_NR_PER_BANK +27 , + [EN751221_CPU_TIMER_RST ] =RST_NR_PER_BANK +28 , + [EN751221_PCIE_HB_RST ] =RST_NR_PER_BANK +29 , + [EN751221_SIMIF_RST ] =RST_NR_PER_BANK +30 , + [EN751221_XPON_MAC_RST ] =RST_NR_PER_BANK +31 , + +/* RST_DMT */ + [EN751221_DMT_RST ] =2 *RST_NR_PER_BANK +0 , + +/* RST_USB */ + [EN751221_USB_PHY_P0_RST ] =3 *RST_NR_PER_BANK +6 , + [EN751221_USB_PHY_P1_RST ] =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);static u32 en7523_get_base_rate (const struct en_clk_desc *desc,u32 val) {
drivers/clk/clk-en7523.c static int en7523_clk_hw_init(struct platform_device *pdev, · line 707
Quoted 6 lines
drivers/clk/clk-en7523.c +2
-1@@ -604,7 +703,8 @@ static int en7523_clk_hw_init(struct platform_device *pdev,en7523_register_clocks (&pdev->dev, clk_data, base, np_base);return en7581_reset_register (&pdev->dev, np_base, en7523_rst_map, -ARRAY_SIZE (en7523_rst_map)); +ARRAY_SIZE (en7523_rst_map), + en7581_rst_ofs);
I assume the mix of en7523 and en7581 is ok here?
Quoted 27 lines
drivers/clk/clk-en7523.c +3
-3} static void en7581_register_clocks(struct device *dev, struct clk_hw_onecell_data *clk_data,@@ -705,7 +805,8 @@ static const struct reset_control_ops en7581_reset_ops = { };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;@@ -713,7 +814,7 @@ static int en7581_reset_register(struct device *dev, void __iomem *base,if (!rst_data)return -ENOMEM ; - rst_data->bank_ofs = en7581_rst_ofs; + rst_data->bank_ofs = rst_reg_ofs; rst_data->idx_map = rst_map; rst_data->base = base;@@ -752,7 +853,123 @@ static int en7581_clk_hw_init(struct platform_device *pdev,writel (val |3 , base +REG_NP_SCU_PCIC ); return en7581_reset_register(&pdev->dev, base, en7581_rst_map, -ARRAY_SIZE (en7581_rst_map));
drivers/clk/clk-en7523.c static int en7581_clk_hw_init(struct platform_device *pdev, · line 865
Quoted 10 lines
drivers/clk/clk-en7523.c +10
-0+ARRAY_SIZE (en7581_rst_map), + en7581_rst_ofs); +} + +static enum en_hir get_hw_id (void __iomem *np_base) +{ +u32 val =FIELD_GET (REG_HIR_MASK ,readl (np_base +REG_HIR )); + +if (val <HIR_MAX ) +return (enum en_hir ) val;
No space with the cast.
drivers/clk/clk-en7523.c static int en7581_clk_hw_init(struct platform_device *pdev, · line 878
Quoted 13 lines
drivers/clk/clk-en7523.c +13
-0+ +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 =clk_hw_register_fixed_rate (dev, name,NULL ,0 , rate); +if (IS_ERR (hw) || key >=EN751221_MAX_CLKS ) +pr_err ("Failed to register clk %s: %pe\n" , name, hw);
Is %pe correct in the case when key >= EN751221_MAX_CLKS?
drivers/clk/clk-en7523.c static int en7581_clk_hw_init(struct platform_device *pdev, · line 880
Quoted 2 lines
drivers/clk/clk-en7523.c +2
-0+else + clk_data->hws[key] = hw;
Should the error code be returned here? I know the function has try in it's name, however if this fails, then it still registers it.
Quoted 19 lines
drivers/clk/clk-en7523.c +19
-0+} + +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 =get_hw_id (np_base); +struct clk_hw *hw; +u32 rate; +u32 div; +int err; + +/* PCI */ + hw =en7523_register_pcie_clk (dev, np_base); + clk_data->hws[EN751221_CLK_PCIE ] = hw; + +/* SPI */ + rate =EN751221_SPI_BASE ; +if (hid ==HIR_EN7526C )
drivers/clk/clk-en7523.c static int en7581_clk_hw_init(struct platform_device *pdev, · line 909
Quoted 10 lines
drivers/clk/clk-en7523.c +10
-0+ rate =EN751221_SPI_BASE_EN7526C ; + + err =regmap_read (map,EN751221_REG_SPI_DIV , &div); +if (err) { +pr_err ("Failed reading fixed clk div %s: %d\n" , +"spi" , err); + }else { + div =FIELD_GET (EN751221_REG_SPI_DIV_MASK , div) *2 ; +if (!div) + div =40 ;
Should 40 be documented a little better with a #define?
Quoted 23 lines
drivers/clk/clk-en7523.c +23
-0+ +en751221_try_register_clk (dev,EN751221_CLK_SPI , clk_data, +"spi" , rate / div); + } + +/* BUS */ + rate =FIELD_GET (EN751221_REG_BUS_MASK , +readl (np_base +EN751221_REG_BUS )); + rate *=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 :
drivers/clk/clk-en7523.c static int en7581_clk_hw_init(struct platform_device *pdev, · line 942
Quoted 10 lines
drivers/clk/clk-en7523.c +10
-0+ rate =200000000 ; +break ; +case HIR_MT7505 : + rate =100000000 ; +break ; +case HIR_MT751020 : + rate =800000000 /3 ; +break ; +default : + rate =250000000 ;
Should a warning be logged here or in get_hw_id() above? hid can be set to HIR_UNKNOWN here.
Quoted 16 lines
drivers/clk/clk-en7523.c +16
-0+ } +en751221_try_register_clk (dev,EN751221_CLK_HPT , clk_data,"hpt" , + rate); + +/* GSW */ + rate =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;
drivers/clk/clk-en7523.c static int en7581_clk_hw_init(struct platform_device *pdev, · line 968
Quoted 10 lines
drivers/clk/clk-en7523.c +10
-0+ + map =syscon_regmap_lookup_by_compatible ("econet,en751221-chip-scu" ); +if (IS_ERR (map)) +return PTR_ERR (map); + + base =devm_platform_ioremap_resource (pdev,0 ); +if (IS_ERR (base)) +return PTR_ERR (base); + +en751221_register_clocks (&pdev->dev, clk_data, map, base);
Again, any reason why the error handling is missing here?
Brian
Quoted 31 lines
drivers/clk/clk-en7523.c +15
-0+ +return en7581_reset_register (&pdev->dev, base, en751221_rst_map, +ARRAY_SIZE (en751221_rst_map), + en751221_rst_ofs); }static int en7523_clk_probe (struct platform_device *pdev)@@ -799,9 +1016,20 @@ static const struct en_clk_soc_data en7581_data = { .hw_init = en7581_clk_hw_init, }; +static const struct en_clk_soc_data en751221_data = { + .num_clocks =EN751221_MAX_CLKS , + .pcie_ops = { + .is_enabled = en7523_pci_is_enabled, + .prepare = en7523_pci_prepare, + .unprepare = en7523_pci_unprepare, + }, + .hw_init = en751221_clk_hw_init, +}; +static const struct of_device_id of_match_clk_en7523[] = { { .compatible ="airoha,en7523-scu" , .data = &en7523_data }, { .compatible ="airoha,en7581-scu" , .data = &en7581_data }, + { .compatible ="econet,en751221-scu" , .data = &en751221_data }, {/* sentinel */ } };Signature · 1 line
2.39.5
Caleb James DeLisle
maintainerRe: [PATCH v2 2/8] clk: airoha: Add econet EN751221 clock/reset support to en7523-scu
Hello Brian,
Thank you for taking the time!
Quoted 195 lines · Brian Masney
Hi Caleb,
Quoted 192 lines · Caleb James DeLisle
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 <[email protected]>--- drivers/clk/Kconfig | 6 +- drivers/clk/clk-en7523.c | 238 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 236 insertions(+), 8 deletions(-)drivers/clk/Kconfig +3
-3@@ -218,13 +218,13 @@ config COMMON_CLK_CS2000_CP If you say yes here you get support for the CS2000 clock multiplier. 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. config COMMON_CLK_EP93XX tristate "Clock driver for Cirrus Logic ep93xx SoC"drivers/clk/clk-en7523.c +100
-1@@ -1,5 +1,6 @@// SPDX-License-Identifier: GPL-2.0-only +#include <linux/bitfield.h> #include <linux/delay.h> #include <linux/clk-provider.h> #include <linux/io.h> @@ -11,6 +12,8 @@#include <dt-bindings/clock/en7523-clk.h> #include <dt-bindings/reset/airoha,en7523-reset.h> #include <dt-bindings/reset/airoha,en7581-reset.h> +#include <dt-bindings/clock/econet,en751221-scu.h> +#include <dt-bindings/reset/econet,en751221-scu.h> #define RST_NR_PER_BANK 32@@ -33,15 +36,49 @@#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)#define REG_RST_CTRL2 0x830#define REG_RST_CTRL1 0x834 +#define EN751221_REG_RST_DMT 0x84 +#define EN751221_REG_RST_USB 0xec + +#define EN751221_MAX_CLKS 6 + +enum en_hir { +HIR_UNKNOWN =-1 , +HIR_TC3169 =0 , +HIR_TC3182 =1 , +HIR_RT65168 =2 , +HIR_RT63165 =3 , +HIR_RT63365 =4 , +HIR_MT751020 =5 , +HIR_MT7505 =6 , +HIR_EN751221 =7 , +HIR_EN7526C =8 , +HIR_EN751627 =9 , +HIR_EN7580 =10 , +HIR_EN7528 =11 , +HIR_EN7523 =12 , +HIR_EN7581 =13 , +HIR_MAX =14 , +};struct en_clk_desc {int id;@@ -93,6 +130,8 @@ static const u32 bus7581_base[] = { 600000000, 540000000 };static const u32 npu7581_base[] = {800000000 ,750000000 ,720000000 ,600000000 };static const u32 crypto_base[] = {540000000 ,480000000 };static const u32 emmc7581_base[] = {200000000 ,150000000 }; +/* EN751221 */ +static const u32 gsw751221_base[] = {500000000 ,250000000 ,400000000 ,200000000 };static const struct en_clk_desc en7523_base_clks[] = { {@@ -300,6 +339,13 @@ static const u16 en7581_rst_ofs[] = { REG_RST_CTRL1, }; +static const u16 en751221_rst_ofs[] = { +REG_RST_CTRL2 , +REG_RST_CTRL1 , +EN751221_REG_RST_DMT , +EN751221_REG_RST_USB , +}; +static const u16 en7523_rst_map[] = {/* RST_CTRL2 */ [EN7523_XPON_PHY_RST ] =0 ,@@ -405,8 +451,61 @@ static const u16 en7581_rst_map[] = { [EN7581_XPON_MAC_RST] = RST_NR_PER_BANK + 31, }; +static const u16 en751221_rst_map[] = { +/* RST_CTRL2 */ + [EN751221_XPON_PHY_RST ] =0 , + [EN751221_GFAST_RST ] =1 , + [EN751221_CPU_TIMER2_RST ] =2 , + [EN751221_UART3_RST ] =3 , + [EN751221_UART4_RST ] =4 , + [EN751221_UART5_RST ] =5 , + [EN751221_I2C2_RST ] =6 , + [EN751221_XSI_MAC_RST ] =7 , + [EN751221_XSI_PHY_RST ] =8 , + +/* RST_CTRL1 */ + [EN751221_PCM1_ZSI_ISI_RST ] =RST_NR_PER_BANK +0 , + [EN751221_FE_QDMA1_RST ] =RST_NR_PER_BANK +1 , + [EN751221_FE_QDMA2_RST ] =RST_NR_PER_BANK +2 , + [EN751221_FE_UNZIP_RST ] =RST_NR_PER_BANK +3 , + [EN751221_PCM2_RST ] =RST_NR_PER_BANK +4 , + [EN751221_PTM_MAC_RST ] =RST_NR_PER_BANK +5 , + [EN751221_CRYPTO_RST ] =RST_NR_PER_BANK +6 , + [EN751221_SAR_RST ] =RST_NR_PER_BANK +7 , + [EN751221_TIMER_RST ] =RST_NR_PER_BANK +8 , + [EN751221_INTC_RST ] =RST_NR_PER_BANK +9 , + [EN751221_BONDING_RST ] =RST_NR_PER_BANK +10 , + [EN751221_PCM1_RST ] =RST_NR_PER_BANK +11 , + [EN751221_UART_RST ] =RST_NR_PER_BANK +12 , + [EN751221_GPIO_RST ] =RST_NR_PER_BANK +13 , + [EN751221_GDMA_RST ] =RST_NR_PER_BANK +14 , + [EN751221_I2C_MASTER_RST ] =RST_NR_PER_BANK +16 , + [EN751221_PCM2_ZSI_ISI_RST ] =RST_NR_PER_BANK +17 , + [EN751221_SFC_RST ] =RST_NR_PER_BANK +18 , + [EN751221_UART2_RST ] =RST_NR_PER_BANK +19 , + [EN751221_GDMP_RST ] =RST_NR_PER_BANK +20 , + [EN751221_FE_RST ] =RST_NR_PER_BANK +21 , + [EN751221_USB_HOST_P0_RST ] =RST_NR_PER_BANK +22 , + [EN751221_GSW_RST ] =RST_NR_PER_BANK +23 , + [EN751221_SFC2_PCM_RST ] =RST_NR_PER_BANK +25 , + [EN751221_PCIE0_RST ] =RST_NR_PER_BANK +26 , + [EN751221_PCIE1_RST ] =RST_NR_PER_BANK +27 , + [EN751221_CPU_TIMER_RST ] =RST_NR_PER_BANK +28 , + [EN751221_PCIE_HB_RST ] =RST_NR_PER_BANK +29 , + [EN751221_SIMIF_RST ] =RST_NR_PER_BANK +30 , + [EN751221_XPON_MAC_RST ] =RST_NR_PER_BANK +31 , + +/* RST_DMT */ + [EN751221_DMT_RST ] =2 *RST_NR_PER_BANK +0 , + +/* RST_USB */ + [EN751221_USB_PHY_P0_RST ] =3 *RST_NR_PER_BANK +6 , + [EN751221_USB_PHY_P1_RST ] =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);static u32 en7523_get_base_rate (const struct en_clk_desc *desc,u32 val) {@@ -604,7 +703,8 @@ static int en7523_clk_hw_init(struct platform_device *pdev,en7523_register_clocks (&pdev->dev, clk_data, base, np_base);
Quoted 5 lines
drivers/clk/clk-en7523.c static int en7523_clk_hw_init(struct platform_device *pdev, · line 707
Quoted 4 lines
drivers/clk/clk-en7523.c +2
-1return en7581_reset_register (&pdev->dev, np_base, en7523_rst_map, -ARRAY_SIZE (en7523_rst_map)); +ARRAY_SIZE (en7523_rst_map), + en7581_rst_ofs);I assume the mix of en7523 and en7581 is ok here?
Correct, en7581 came first, then when en7523 was added they reused the function. I'm only changing the offsets to be passed in because en751221 has more reset registers so different offset table than the others.
Quoted 25 lines
Quoted 25 lines
drivers/clk/clk-en7523.c +3
-2} static void en7581_register_clocks(struct device *dev, struct clk_hw_onecell_data *clk_data,@@ -705,7 +805,8 @@ static const struct reset_control_ops en7581_reset_ops = { };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;@@ -713,7 +814,7 @@ static int en7581_reset_register(struct device *dev, void __iomem *base,if (!rst_data)return -ENOMEM ; - rst_data->bank_ofs = en7581_rst_ofs; + rst_data->bank_ofs = rst_reg_ofs; rst_data->idx_map = rst_map; rst_data->base = base;@@ -752,7 +853,123 @@ static int en7581_clk_hw_init(struct platform_device *pdev,writel (val |3 , base +REG_NP_SCU_PCIC );
Quoted 13 lines
drivers/clk/clk-en7523.c static int en7581_clk_hw_init(struct platform_device *pdev, · line 865
Quoted 12 lines
drivers/clk/clk-en7523.c +10
-1return 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 =FIELD_GET (REG_HIR_MASK ,readl (np_base +REG_HIR )); + +if (val <HIR_MAX ) +return (enum en_hir ) val;No space with the cast.
OK
Quoted 6 lines
Quoted 6 lines
drivers/clk/clk-en7523.c +6
-0+ +return HIR_UNKNOWN ; +} + +static void en751221_try_register_clk(struct device *dev, int key, + struct clk_hw_onecell_data *clk_data,
Quoted 8 lines
drivers/clk/clk-en7523.c static int en7581_clk_hw_init(struct platform_device *pdev, · line 878
Quoted 7 lines
drivers/clk/clk-en7523.c +7
-0+ const char *name, u32 rate) +{ +struct clk_hw *hw; + + hw =clk_hw_register_fixed_rate (dev, name,NULL ,0 , rate); +if (IS_ERR (hw) || key >=EN751221_MAX_CLKS ) +pr_err ("Failed to register clk %s: %pe\n" , name, hw);Is %pe correct in the case when key >=
EN751221_MAX_CLKS?
Hmm, it's gonna give a pointer address, indeed that's not so nice. I'll re-work this so it makes more sense.
Quoted 4 lines
drivers/clk/clk-en7523.c static int en7581_clk_hw_init(struct platform_device *pdev, · line 880
Quoted 2 lines
drivers/clk/clk-en7523.c +2
-0+else + clk_data->hws[key] = hw;Should the error code be returned here? I know the function has try in it's name, however if this fails, then it still registers it.
This function follows the general pattern of en7581_register_clocks(). If a clock can't be registered, leave clk_data->hws[key] as NULL, log, and continue. There's only two possible reasons for failing, if clk_hw_register_fixed_rate() fails then it's not registered because it failed. If key >= EN751221_MAX_CLKS, it does register but I'll fix this so it's checking that before clk_hw_register_fixed_rate().
Quoted 22 lines
Quoted 22 lines
drivers/clk/clk-en7523.c +22
-0+} + +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 =get_hw_id (np_base); +struct clk_hw *hw; +u32 rate; +u32 div; +int err; + +/* PCI */ + hw =en7523_register_pcie_clk (dev, np_base); + clk_data->hws[EN751221_CLK_PCIE ] = hw; + +/* SPI */ + rate =EN751221_SPI_BASE ; +if (hid ==HIR_EN7526C ) + rate =EN751221_SPI_BASE_EN7526C ; + + err =regmap_read (map,EN751221_REG_SPI_DIV , &div);
Quoted 8 lines
drivers/clk/clk-en7523.c static int en7581_clk_hw_init(struct platform_device *pdev, · line 909
Quoted 7 lines
drivers/clk/clk-en7523.c +7
-0+if (err) { +pr_err ("Failed reading fixed clk div %s: %d\n" , +"spi" , err); + }else { + div =FIELD_GET (EN751221_REG_SPI_DIV_MASK , div) *2 ; +if (!div) + div =40 ;Should 40 be documented a little better with a #define?
Ok yes, makes sense.
Quoted 27 lines
Quoted 27 lines
drivers/clk/clk-en7523.c +27
-0+ +en751221_try_register_clk (dev,EN751221_CLK_SPI , clk_data, +"spi" , rate / div); + } + +/* BUS */ + rate =FIELD_GET (EN751221_REG_BUS_MASK , +readl (np_base +EN751221_REG_BUS )); + rate *=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 =200000000 ; +break ; +case HIR_MT7505 : + rate =100000000 ;
Quoted 8 lines
drivers/clk/clk-en7523.c static int en7581_clk_hw_init(struct platform_device *pdev, · line 942
Quoted 6 lines
drivers/clk/clk-en7523.c +6
-0+break ; +case HIR_MT751020 : + rate =800000000 /3 ; +break ; +default : + rate =250000000 ;Should a warning be logged here or in
get_hw_id()above? hid can be set toHIR_UNKNOWNhere.
Now that I'm looking at this again, I'm starting to think it might be better to just remove it and use a fixed-clock in the DT. I wrote it aiming for completeness, but this particular clock has so much code supporting it, I'm feeling like it just doesn't make any sense.
Let me know if you have a feeling on this because I'm swaying in the direction of just re-sending with it removed.
Quoted 20 lines
Quoted 20 lines
drivers/clk/clk-en7523.c +19
-0+ } +en751221_try_register_clk (dev,EN751221_CLK_HPT , clk_data,"hpt" , + rate); + +/* GSW */ + rate =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 =syscon_regmap_lookup_by_compatible ("econet,en751221-chip-scu" ); +if (IS_ERR (map))
Quoted 8 lines
drivers/clk/clk-en7523.c static int en7581_clk_hw_init(struct platform_device *pdev, · line 968
Quoted 7 lines
drivers/clk/clk-en7523.c +7
-0+return PTR_ERR (map); + + base =devm_platform_ioremap_resource (pdev,0 ); +if (IS_ERR (base)) +return PTR_ERR (base); + +en751221_register_clocks (&pdev->dev, clk_data, map, base);Again, any reason why the error handling is missing here?
I followed the same logic that was used for the en7581 and en7523, but I think the logic is reasonable. If a clock fails to register, you either log and continue, or you blow up the whole probe(), which is just going to make it more frustrating to debug since then no clocks will register and anything downstream of them will be unhappy.
Thanks,
Caleb
Quoted 35 lines
Brian
Quoted 31 lines
drivers/clk/clk-en7523.c +15
-0+ +return en7581_reset_register (&pdev->dev, base, en751221_rst_map, +ARRAY_SIZE (en751221_rst_map), + en751221_rst_ofs); }static int en7523_clk_probe (struct platform_device *pdev)@@ -799,9 +1016,20 @@ static const struct en_clk_soc_data en7581_data = { .hw_init = en7581_clk_hw_init, }; +static const struct en_clk_soc_data en751221_data = { + .num_clocks =EN751221_MAX_CLKS , + .pcie_ops = { + .is_enabled = en7523_pci_is_enabled, + .prepare = en7523_pci_prepare, + .unprepare = en7523_pci_unprepare, + }, + .hw_init = en751221_clk_hw_init, +}; +static const struct of_device_id of_match_clk_en7523[] = { { .compatible ="airoha,en7523-scu" , .data = &en7523_data }, { .compatible ="airoha,en7581-scu" , .data = &en7581_data }, + { .compatible ="econet,en751221-scu" , .data = &en751221_data }, {/* sentinel */ } };Signature · 1 line
2.39.5
Re: [PATCH v2 2/8] clk: airoha: Add econet EN751221 clock/reset support to en7523-scu
Quoted 28 lines · Caleb James DeLisle
Hello Brian,
Thank you for taking the time!
Quoted 9 lines · Brian Masney
Hi Caleb,
Quoted 6 lines · Caleb James DeLisle
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.
Quoted 11 lines
drivers/clk/clk-en7523.c static int en7523_clk_hw_init(struct platform_device *pdev, · line 706
Quoted 10 lines
Signed-off-by Caleb James DeLisle <[email protected]>---
static u32en7523_get_base_rate(const struct en_clk_desc *desc, u32 val){drivers/clk/clk-en7523.c +2
-1@@ -604,7 +703,8 @@ static int en7523_clk_hw_init(struct platform_device *pdev,en7523_register_clocks (&pdev->dev, clk_data, base, np_base);return en7581_reset_register (&pdev->dev, np_base, en7523_rst_map, -ARRAY_SIZE (en7523_rst_map)); +ARRAY_SIZE (en7523_rst_map), + en7581_rst_ofs);I assume the mix of en7523 and en7581 is ok here?
Quoted 3 lines
Correct, en7581 came first, then when en7523 was added they reused the function. I'm only changing the offsets to be passed in because en751221 has more reset registers so different offset table than the others.
Sounds good. I just wanted to confirm.
Quoted 6 lines
Quoted 4 lines
drivers/clk/clk-en7523.c static int en7581_clk_hw_init(struct platform_device *pdev, · line 880
Quoted 2 lines
drivers/clk/clk-en7523.c +2
-0+else + clk_data->hws[key] = hw;Should the error code be returned here? I know the function has try in it's name, however if this fails, then it still registers it.
Quoted 6 lines
This function follows the general pattern of
en7581_register_clocks(). If a clock can't be registered, leave clk_data->hws[key] as NULL, log, and continue. There's only two possible reasons for failing, ifclk_hw_register_fixed_rate()fails then it's not registered because it failed. If key >=EN751221_MAX_CLKS, it does register but I'll fix this so it's checking that before clk_hw_register_fixed_rate().
I see that Stephen picked up this driver in 2022 with that behavior. I'm fine with it if he is.
Quoted 31 lines
Quoted 22 lines
Quoted 22 lines
drivers/clk/clk-en7523.c +22
-0+/* BUS */ + rate =FIELD_GET (EN751221_REG_BUS_MASK , +readl (np_base +EN751221_REG_BUS )); + rate *=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 =200000000 ; +break ; +case HIR_MT7505 : + rate =100000000 ;Quoted 8 lines
drivers/clk/clk-en7523.c static int en7581_clk_hw_init(struct platform_device *pdev, · line 942
Quoted 6 lines
drivers/clk/clk-en7523.c +6
-0+break ; +case HIR_MT751020 : + rate =800000000 /3 ; +break ; +default : + rate =250000000 ;Should a warning be logged here or in
get_hw_id()above? hid can be set toHIR_UNKNOWNhere.
Quoted 7 lines
Now that I'm looking at this again, I'm starting to think it might be better to just remove it and use a fixed-clock in the DT. I wrote it aiming for completeness, but this particular clock has so much code supporting it, I'm feeling like it just doesn't make any sense.
Let me know if you have a feeling on this because I'm swaying in the direction of just re-sending with it removed.
That makes sense to me.
Brian
Caleb James DeLisle
maintainerPATCH v2 3/8 dt-bindings: phy: Document PCIe PHY in EcoNet EN751221 and EN7528
In reply to Caleb James DeLisleEN751221 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.
--- .../phy/econet,en751221-pcie-phy.yaml | 50 +++++++++++++++++++ MAINTAINERS | 6 +++ 2 files changed, 56 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/econet,en751221-pcie-phy.yaml
Documentation/devicetree/bindings/phy/econet,en751221-pcie-phy.yaml new file +50 -0
@@ -0,0 +1,50 @@ +# 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 <[email protected]> + +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-gen1 + - econet,en751221-pcie-gen2 + - econet,en7528-pcie-gen1 + - econet,en7528-pcie-gen2 + + reg: + maxItems: 1 + + "#phy-cells": + const: 0 + +required: + - compatible + - reg + - "#phy-cells" + +additionalProperties: false + +examples: + - | + soc { + #address-cells = <1>; + #size-cells = <1>; + + pcie-phy@1faf2000 { + compatible = "econet,en7528-pcie-gen1"; + reg = <0x1faf2000 0x1000>; + #phy-cells = <0>; + }; + }; +...
MAINTAINERS +6 -0
@@ -9122,6 +9122,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 +ECONET PCIE PHY DRIVER +M: Caleb James DeLisle <[email protected]> +L: [email protected] +S: Maintained +F: Documentation/devicetree/bindings/phy/econet,en751221-pcie-phy.yaml + ECRYPT FILE SYSTEM M: Tyler Hicks <[email protected]> L: [email protected]
Signature · 1 line
2.39.5
Re: [PATCH v2 3/8] dt-bindings: phy: Document PCIe PHY in EcoNet EN751221 and EN7528
Quoted 5 lines · Caleb James DeLisle
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 <[email protected]>
Still, four separate subsystems unnecessarily merged into one patchset. Split independent parts of your work per subsystem. See also submitting patches.
Quoted 5 lines
--- .../phy/econet,en751221-pcie-phy.yaml | 50 +++++++++++++++++++ MAINTAINERS | 6 +++ 2 files changed, 56 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/econet,en751221-pcie-phy.yaml
Best regards,
Krzysztof
Caleb James DeLisle
maintainerRe: [PATCH v2 3/8] dt-bindings: phy: Document PCIe PHY in EcoNet EN751221 and EN7528
Quoted 9 lines · Krzysztof Kozlowski
Quoted 5 lines · Caleb James DeLisle
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 <[email protected]>Still, four separate subsystems unnecessarily merged into one patchset. Split independent parts of your work per subsystem. See also submitting patches.
I asked for clarification last time and didn't get a reply. I'm not against changing it but need to understand exactly what's expected b/c the way I'm imagining it seems way worse. submitting-patches.rst only says of patch sets "only post say 15 or so at a time", obviously not the case here.
If you're asking for one patchset for phy, one for clock, one for PCI, and then one to introduce them to the device, I can do that. I just want to be sure because introducing unused code, and patch sets that depend on other patch sets both seem like anti-patterns to me.
Thanks,
Caleb
Quoted 11 lines
Quoted 5 lines
--- .../phy/econet,en751221-pcie-phy.yaml | 50 +++++++++++++++++++ MAINTAINERS | 6 +++ 2 files changed, 56 insertions(+)create mode 100644
Documentation/devicetree/bindings/phy/econet,en751221-pcie-phy.yamlReviewed-by Krzysztof Kozlowski <[email protected]>Best regards,
Krzysztof
Re: [PATCH v2 3/8] dt-bindings: phy: Document PCIe PHY in EcoNet EN751221 and EN7528
Quoted 19 lines · Caleb James DeLisle
Quoted 9 lines · Krzysztof Kozlowski
Quoted 5 lines · Caleb James DeLisle
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 <[email protected]>Still, four separate subsystems unnecessarily merged into one patchset. Split independent parts of your work per subsystem. See also submitting patches.
I asked for clarification last time and didn't get a reply. I'm not against changing it but need to understand exactly what's expected b/c the way I'm imagining it seems way worse.
submitting-patches.rstonly says of patch sets "only post say 15 or so at a time", obviously not the case here.
Quoted 3 lines
If you're asking for one patchset for phy, one for clock, one for PCI, and then one to introduce them to the device, I can do that. I just want to be sure because introducing unused code, and patch sets that depend
What is "unused" code? Or how is it unused? Do you understand this will go via different subsystems and nothing will be "used" anyway?
Quoted 1 line
on other patch sets both seem like anti-patterns to me.
And asking four different maintainers to manually pick up individual bits with multiple commands, instead of just applying entire set targeting their subsystem, is pro-pattern here? No. Why adding more work to maintainers?
Think how this is seen by individual subsystem maintainers and how they should handle it.
Best regards,
Krzysztof
Re: [PATCH v2 3/8] dt-bindings: phy: Document PCIe PHY in EcoNet EN751221 and EN7528
Quoted 29 lines · Krzysztof Kozlowski
Quoted 19 lines · Caleb James DeLisle
Quoted 9 lines · Krzysztof Kozlowski
Quoted 5 lines · Caleb James DeLisle
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 <[email protected]>Still, four separate subsystems unnecessarily merged into one patchset. Split independent parts of your work per subsystem. See also submitting patches.
I asked for clarification last time and didn't get a reply. I'm not against changing it but need to understand exactly what's expected b/c the way I'm imagining it seems way worse.
submitting-patches.rstonly says of patch sets "only post say 15 or so at a time", obviously not the case here.Quoted 3 lines
If you're asking for one patchset for phy, one for clock, one for PCI, and then one to introduce them to the device, I can do that. I just want to be sure because introducing unused code, and patch sets that depend
What is "unused" code? Or how is it unused? Do you understand this will go via different subsystems and nothing will be "used" anyway?
Quoted 1 line
on other patch sets both seem like anti-patterns to me.
Quoted 8 lines
And asking four different maintainers to manually pick up individual bits with multiple commands, instead of just applying entire set targeting their subsystem, is pro-pattern here? No. Why adding more work to maintainers?
Think how this is seen by individual subsystem maintainers and how they should handle it.
Heh, and nothing of this is explained in cover letter - nothing about dependencies or merging order - so how anyone can figure out what can be applied here?
Best regards,
Krzysztof
Caleb James DeLisle
maintainerRe: [PATCH v2 3/8] dt-bindings: phy: Document PCIe PHY in EcoNet EN751221 and EN7528
In reply to Krzysztof KozlowskiQuoted 18 lines · Krzysztof Kozlowski
Quoted 17 lines · Caleb James DeLisle
Quoted 9 lines · Krzysztof Kozlowski
Quoted 5 lines · Caleb James DeLisle
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 <[email protected]>Still, four separate subsystems unnecessarily merged into one patchset. Split independent parts of your work per subsystem. See also submitting patches.
I asked for clarification last time and didn't get a reply. I'm not against changing it but need to understand exactly what's expected b/c the way I'm imagining it seems way worse.
submitting-patches.rstonly says of patch sets "only post say 15 or so at a time", obviously not the case here.
Quoted 5 lines
Quoted 3 lines
If you're asking for one patchset for phy, one for clock, one for PCI, and then one to introduce them to the device, I can do that. I just want to be sure because introducing unused code, and patch sets that depend
What is "unused" code? Or how is it unused? Do you understand this will go via different subsystems and nothing will be "used" anyway?
Unused in the sense that you can't exercise that code without additional code which is out of tree - at least until the subsequent patch set lands.
Quoted 8 lines
Quoted 1 line
on other patch sets both seem like anti-patterns to me.
And asking four different maintainers to manually pick up individual bits with multiple commands, instead of just applying entire set targeting their subsystem, is pro-pattern here? No. Why adding more work to maintainers?
Think how this is seen by individual subsystem maintainers and how they should handle it.
Okay I think I see the goal, thank you. And you know I'm not smart enough to have an actual opinion on this, I just needed to understand the "why" so that I can do what's expected w/o goofing it up.
Thanks,
Caleb
Quoted 6 lines
Best regards,
Krzysztof
Re: [PATCH v2 3/8] dt-bindings: phy: Document PCIe PHY in EcoNet EN751221 and EN7528
Quoted 23 lines · Caleb James DeLisle
Quoted 21 lines · Krzysztof Kozlowski
Quoted 20 lines · Caleb James DeLisle
Quoted 9 lines · Krzysztof Kozlowski
Quoted 5 lines · Caleb James DeLisle
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 <[email protected]>Still, four separate subsystems unnecessarily merged into one patchset. Split independent parts of your work per subsystem. See also submitting patches.
I asked for clarification last time and didn't get a reply. I'm not against changing it but need to understand exactly what's expected b/c the way I'm imagining it seems way worse.
submitting-patches.rstonly says of patch sets "only post say 15 or so at a time", obviously not the case here.If you're asking for one patchset for phy, one for clock, one for PCI, and then one to introduce them to the device, I can do that. I just want to be sure because introducing unused code, and patch sets that depend
Quoted 6 lines
Quoted 2 lines
What is "unused" code? Or how is it unused? Do you understand this will go via different subsystems and nothing will be "used" anyway?
Unused in the sense that you can't exercise that code without additional code which is out of tree - at least until the subsequent patch set lands.
Which is exactly the same as with your method of combining independent subsystems here. Do you know this goes via independent subsystems? Around four of them?
Best regards,
Krzysztof
Caleb James DeLisle
maintainerPATCH v2 4/8 phy: econet: Add PCIe PHY driver for EcoNet EN751221 and EN7528 SoCs.
In reply to Caleb James DeLisleIntroduce 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.
--- 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
MAINTAINERS +1 -0
@@ -9127,6 +9127,7 @@ M: Caleb James DeLisle <[email protected]> L: [email protected] S: Maintained F: Documentation/devicetree/bindings/phy/econet,en751221-pcie-phy.yaml +F: drivers/phy/phy-econet-pcie.c ECRYPT FILE SYSTEM M: Tyler Hicks <[email protected]>
drivers/phy/Kconfig +12 -0
@@ -123,6 +123,18 @@ config PHY_AIROHA_PCIE This driver create the basic PHY instance and provides initialize callback for PCIe GEN3 port. +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
drivers/phy/Makefile +1 -0
@@ -15,6 +15,7 @@ obj-$(CONFIG_PHY_PISTACHIO_USB) += phy-pistachio-usb.o obj-$(CONFIG_PHY_SNPS_EUSB2) += phy-snps-eusb2.o obj-$(CONFIG_USB_LGM_PHY) += phy-lgm-usb.o obj-$(CONFIG_PHY_AIROHA_PCIE) += phy-airoha-pcie.o +obj-$(CONFIG_PHY_ECONET_PCIE) += phy-econet-pcie.o obj-$(CONFIG_PHY_NXP_PTN3222) += phy-nxp-ptn3222.o obj-$(CONFIG_PHY_SPACEMIT_K1_PCIE) += phy-spacemit-k1-pcie.o obj-$(CONFIG_GENERIC_PHY) += allwinner/ \
drivers/phy/phy-econet-pcie.c new file +180 -0
180 lines not on this page · raw message
Signature · 1 line
2.39.5
Caleb James DeLisle
maintainerPATCH v2 5/8 dt-bindings: PCI: mediatek: Add support for EcoNet EN7528
In reply to Caleb James DeLisleIntroduce 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.
--- Documentation/devicetree/bindings/pci/mediatek-pcie.yaml | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/pci/mediatek-pcie.yaml +1 -0
@@ -14,6 +14,7 @@ properties: oneOf: - enum: - airoha,an7583-pcie + - econet,en7528-pcie - mediatek,mt2712-pcie - mediatek,mt7622-pcie - mediatek,mt7629-pcie
Signature · 1 line
2.39.5
Re: [PATCH v2 5/8] dt-bindings: PCI: mediatek: Add support for EcoNet EN7528
Quoted 17 lines · Caleb James DeLisle
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 <[email protected]>--- Documentation/devicetree/bindings/pci/mediatek-pcie.yaml | 1 + 1 file changed, 1 insertion(+)Documentation/devicetree/bindings/pci/mediatek-pcie.yaml +0
-0
Documentation/devicetree/bindings/pci/mediatek-pcie.yaml properties: · line 17
Quoted 4 lines
Documentation/devicetree/bindings/pci/mediatek-pcie.yaml +1
-0@@ -14,6 +14,7 @@ properties: oneOf: - enum: - airoha,an7583-pcie + - econet,en7528-pcie
Patch is heavily incomplete - why do you have variable number of clocks? 1, 2, 3 ... or 6 at the same time?
Look at the rest of this file to understand what you need to write.
Best regards,
Krzysztof
Caleb James DeLisle
maintainerRe: [PATCH v2 5/8] dt-bindings: PCI: mediatek: Add support for EcoNet EN7528
Quoted 25 lines · Krzysztof Kozlowski
Quoted 17 lines · Caleb James DeLisle
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 <[email protected]>--- Documentation/devicetree/bindings/pci/mediatek-pcie.yaml | 1 + 1 file changed, 1 insertion(+)Documentation/devicetree/bindings/pci/mediatek-pcie.yaml +0
-0Documentation/devicetree/bindings/pci/mediatek-pcie.yaml properties: · line 17
Quoted 4 lines
Documentation/devicetree/bindings/pci/mediatek-pcie.yaml +1
-0@@ -14,6 +14,7 @@ properties: oneOf: - enum: - airoha,an7583-pcie + - econet,en7528-pciePatch is heavily incomplete - why do you have variable number of clocks? 1, 2, 3 ... or 6 at the same time?
Quoted 1 line
Look at the rest of this file to understand what you need to write.
Thank you, sorry for missing that, will fix.
Caleb
Quoted 4 lines
Best regards,
Krzysztof
Caleb James DeLisle
maintainerPATCH v2 6/8 PCI: mediatek: Add support for EcoNet EN7528 SoC
In reply to Caleb James DeLisleAdd 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.
--- drivers/pci/controller/Kconfig | 2 +- drivers/pci/controller/pcie-mediatek.c | 118 +++++++++++++++++++++++++ 2 files changed, 119 insertions(+), 1 deletion(-)
drivers/pci/controller/Kconfig +1 -1
@@ -209,7 +209,7 @@ config PCI_MVEBU 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
drivers/pci/controller/pcie-mediatek.c +118 -0
156 lines not on this page · raw message
Signature · 1 line
2.39.5
Caleb James DeLisle
maintainerPATCH v2 7/8 PCI: Skip bridge window reads when window is not supported
In reply to Caleb James DeLislepci_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 <= 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.
--- drivers/pci/probe.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/pci/probe.c +6 -0
@@ -395,6 +395,9 @@ static void pci_read_bridge_io(struct pci_dev *dev, struct resource *res,unsigned long io_mask, io_granularity, base, limit;struct pci_bus_region region; +if (!dev->io_window) +return ; + io_mask =PCI_IO_RANGE_MASK ; io_granularity =0x1000 ;if (dev->io_window_1k) {
@@ -465,6 +468,9 @@ static void pci_read_bridge_mmio_pref(struct pci_dev *dev, struct resource *res,pci_bus_addr_t base, limit;struct pci_bus_region region; +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 = (mem_base_lo &PCI_PREF_RANGE_MASK ) <<16 ;
Signature · 1 line
2.39.5
Caleb James DeLisle
maintainerPATCH v2 8/8 mips: dts: Add PCIe to EcoNet EN751221
In reply to Caleb James DeLisleAdd PCIe based on EN7528 PCIe driver, also add two MT76 wifi devices to SmartFiber XP8421-B.
--- 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(+)
arch/mips/boot/dts/econet/en751221.dtsi +114 -0
@@ -1,6 +1,8 @@ // SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) /dts-v1/; +#include <dt-bindings/clock/econet,en751221-scu.h> + / { compatible = "econet,en751221"; #address-cells = <1>;
@@ -30,6 +32,30 @@ cpuintc: interrupt-controller { #interrupt-cells = <1>; }; + chip_scu: syscon@1fa20000 { + compatible = "econet,en751221-chip-scu", "syscon"; + reg = <0x1fa20000 0x388>; + }; + + pcie_phy1: pcie-phy@1fac0000 { + compatible = "econet,en751221-pcie-gen2"; + reg = <0x1fac0000 0x1000>; + #phy-cells = <0>; + }; + + pcie_phy0: pcie-phy@1faf2000 { + compatible = "econet,en751221-pcie-gen1"; + reg = <0x1faf2000 0x1000>; + #phy-cells = <0>; + }; + + scuclk: clock-controller@1fb00000 { + compatible = "econet,en751221-scu"; + reg = <0x1fb00000 0x970>; + #clock-cells = <1>; + #reset-cells = <1>; + }; + intc: interrupt-controller@1fb40000 { compatible = "econet,en751221-intc"; reg = <0x1fb40000 0x100>;
@@ -41,6 +67,94 @@ intc: interrupt-controller@1fb40000 { econet,shadow-interrupts = <7 2>, <8 3>, <13 12>, <30 29>; }; + pciecfg: pciecfg@1fb80000 { + compatible = "mediatek,generic-pciecfg", "syscon"; + reg = <0x1fb80000 0x1000>; + }; + + pcie0: pcie@1fb81000 { + compatible = "econet,en7528-pcie"; + device_type = "pci"; + reg = <0x1fb81000 0x1000>; + reg-names = "port0"; + linux,pci-domain = <0>; + #address-cells = <3>; + #size-cells = <2>; + interrupt-parent = <&intc>; + interrupts = <23>; + interrupt-names = "pcie_irq"; + clocks = <&scuclk EN751221_CLK_PCIE>; + clock-names = "sys_ck0"; + phys = <&pcie_phy0>; + phy-names = "pcie-phy0"; + bus-range = <0x00 0xff>; + ranges = <0x01000000 0 0x00000000 0x1f600000 0 0x00008000>, + <0x82000000 0 0x20000000 0x20000000 0 0x08000000>; + status = "disabled"; + + #interrupt-cells = <1>; + interrupt-map-mask = <0 0 0 7>; + interrupt-map = <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 = <0>; + #interrupt-cells = <1>; + }; + + slot0: pcie@0,0 { + reg = <0x0000 0 0 0 0>; + device_type = "pci"; + #address-cells = <3>; + #size-cells = <2>; + ranges; + }; + }; + + pcie1: pcie@1fb83000 { + compatible = "econet,en7528-pcie"; + device_type = "pci"; + reg = <0x1fb83000 0x1000>; + reg-names = "port1"; + linux,pci-domain = <1>; + #address-cells = <3>; + #size-cells = <2>; + interrupt-parent = <&intc>; + interrupts = <24>; + interrupt-names = "pcie_irq"; + clocks = <&scuclk EN751221_CLK_PCIE>; + clock-names = "sys_ck1"; + phys = <&pcie_phy1>; + phy-names = "pcie-phy1"; + bus-range = <0x00 0xff>; + ranges = <0x81000000 0 0x00000000 0x1f608000 0 0x00008000>, + <0x82000000 0 0x28000000 0x28000000 0 0x08000000>; + status = "disabled"; + + #interrupt-cells = <1>; + interrupt-map-mask = <0 0 0 7>; + interrupt-map = <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 = <0>; + #interrupt-cells = <1>; + }; + + slot1: pcie@1,0 { + reg = <0x0800 0 0 0 0>; + #address-cells = <3>; + #size-cells = <2>; + ranges; + }; + }; + uart: serial@1fbf0000 { compatible = "ns16550"; reg = <0x1fbf0000 0x30>;
arch/mips/boot/dts/econet/en751221_smartfiber_xp8421-b.dts +21 -0
@@ -17,3 +17,24 @@ chosen { linux,usable-memory-range = <0x00020000 0x1bfe0000>; }; }; + +&pcie0 { + status = "okay"; +}; +&slot0 { + wifi@0,0 { + /* MT7612E */ + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + }; +}; +&pcie1 { + status = "okay"; +}; +&slot1 { + wifi@0,0 { + /* MT7592 */ + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + }; +};
arch/mips/econet/Kconfig +2 -0
@@ -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
Signature · 1 line
2.39.5
Re: [PATCH v2 8/8] mips: dts: Add PCIe to EcoNet EN751221
Quoted 10 lines · Caleb James DeLisle
Add PCIe based on EN7528 PCIe driver, also add two MT76 wifi devices to SmartFiber XP8421-B.
Signed-off-by Caleb James DeLisle <[email protected]>--- 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(+)
applied to mips-next
Thomas.
Signature · 2 lines
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a good idea. [ RFC1925, 2.3 ]
Caleb James DeLisle
maintainerRe: [PATCH v2 8/8] mips: dts: Add PCIe to EcoNet EN751221
Quoted 4 lines · Thomas Bogendoerfer
Quoted 3 lines · Caleb James DeLisle
Add PCIe based on EN7528 PCIe driver, also add two MT76 wifi devices to SmartFiber XP8421-B.
Quoted 8 lines
Quoted 7 lines
Signed-off-by Caleb James DeLisle <[email protected]>--- 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(+)applied to mips-next
Thank you very much.
Caleb
Quoted 3 lines
Thomas.