Broadcom iProc based SoCs use a MDIO bus multiplexer where child buses
could be internal as well external to SoCs. These buses could supports
MDIO transaction compatible to C-22/C-45.
Broadcom MDIO bus multiplexer is an integrated multiplexer where child bus
selection and mdio transaction logic lies inside multiplexer itself.
To accommodate this multiplexer in existing mux framework below changes
were required-
1. Passed MDIO parent bus via mdio_mux_init to MDIO mux framework.
This patch set includes MDIO bus multiplexer driver along with above
framework change. It includes one external bus node having Ethernet PHY
attached and two internal bus node holding PCIe PHYs.
This patch series is based on v4.7-rc1 and is available from github-
repo: https://github.com/Broadcom/arm64-linux.git
branch:mdio-mux-v4
-Changes from v3:
- Unregister and free the parent MDIO bus.
- rebased on net-next/master branch.
Reason for resend:
-Rebased on v4.7-rc1
Changes from v2:
-Addressed Rob's comments in this patch regarding typo/grammers.
-Addressed David's comments regarding local variables order.
-Removed property "mdio-integrated-mux" and used mdiobus_register()
in place of of_mdiobus_regsiter().
-removed usage of IS_ERR_OR_NULL to IS_ERR in PCIe PHY driver.
Changes from v1:
- stop using "brcm,is_c45" from bus node as suggested by Andrew. MDIO
PHY driver will logically OR MII_ADDR_C45 into the address when issues
any C45 MDIO read/write transaction.
Pramod Kumar (7):
mdio: mux: Enhanced MDIO mux framework for integrated multiplexers
binding: Make "mdio-parent-bus" property from mandatory to optional
binding: mdio-mux: Add DT binding doc for Broadcom MDIO bus
multiplexer
dt: mdio-mux: Add mdio multiplexer driver node
net: mdio-mux: Add MDIO mux driver for iProc SoCs
binding: PHY: Binding doc for NS2 PCIe PHYs.
phy: Add Northstar2 PCI Phy support
.../bindings/net/brcm,mdio-mux-iproc.txt | 59 +++++
Documentation/devicetree/bindings/net/mdio-mux.txt | 3 +-
.../bindings/phy/brcm,mdio-mux-bus-pci.txt | 27 +++
arch/arm64/boot/dts/broadcom/ns2-svk.dts | 12 +
arch/arm64/boot/dts/broadcom/ns2.dtsi | 31 +++
drivers/net/phy/Kconfig | 11 +
drivers/net/phy/Makefile | 1 +
drivers/net/phy/mdio-mux-bcm-iproc.c | 248 +++++++++++++++++++++
drivers/net/phy/mdio-mux-gpio.c | 2 +-
drivers/net/phy/mdio-mux-mmioreg.c | 2 +-
drivers/net/phy/mdio-mux.c | 28 ++-
drivers/phy/Kconfig | 8 +
drivers/phy/Makefile | 2 +-
drivers/phy/phy-bcm-ns2-pcie.c | 115 ++++++++++
include/linux/mdio-mux.h | 4 +-
15 files changed, 538 insertions(+), 15 deletions(-)
create mode 100644 Documentation/devicetree/bindings/net/brcm,mdio-mux-iproc.txt
create mode 100644 Documentation/devicetree/bindings/phy/brcm,mdio-mux-bus-pci.txt
create mode 100644 drivers/net/phy/mdio-mux-bcm-iproc.c
create mode 100644 drivers/phy/phy-bcm-ns2-pcie.c
--
1.9.1
An integrated multiplexer uses same address space for
"muxed bus selection" and "generation of mdio transaction"
hence its good to register parent bus from mux driver.
Hence added a mechanism where mux driver could register a
parent bus and pass it down to framework via mdio_mux_init api.
Signed-off-by: Pramod Kumar <redacted>
---
drivers/net/phy/mdio-mux-gpio.c | 2 +-
drivers/net/phy/mdio-mux-mmioreg.c | 2 +-
drivers/net/phy/mdio-mux.c | 28 ++++++++++++++++++----------
include/linux/mdio-mux.h | 4 +++-
4 files changed, 23 insertions(+), 13 deletions(-)
@@ -126,7 +126,7 @@ static int mdio_mux_mmioreg_probe(struct platform_device *pdev)}ret=mdio_mux_init(&pdev->dev,mdio_mux_mmioreg_switch_fn,-&s->mux_handle,s);+&s->mux_handle,s,NULL);if(ret){dev_err(&pdev->dev,"failed to register mdio-mux bus %s\n",np->full_name);
Change "mdio-parent-bus" from mandatory section to optional
as it won't be required by integrated MDIO multiplexer
which has bus selection and mdio transaction generation logic,
integrated inside.
Signed-off-by: Pramod Kumar <redacted>
---
Documentation/devicetree/bindings/net/mdio-mux.txt | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
@@ -5,11 +5,12 @@ numbered uniquely in a device dependent manner. The nodes for an MDIO bus multiplexer/switch will have one child node for each child bus. Required properties:-- mdio-parent-bus : phandle to the parent MDIO bus. - #address-cells = <1>; - #size-cells = <0>; Optional properties:+- mdio-parent-bus : phandle to the parent MDIO bus.+ - Other properties specific to the multiplexer/switch hardware. Required properties for child nodes:
@@ -0,0 +1,59 @@+Properties for an MDIO bus multiplexer found in Broadcom iProc based SoCs.++This MDIO bus multiplexer defines buses that could be internal as well as+external to SoCs and could accept MDIO transaction compatible to C-22 or+C-45 Clause. When child bus is selected, one needs to select these two+properties as well to generate desired MDIO transaction on appropriate bus.++Required properties in addition to the generic multiplexer properties:++MDIO multiplexer node:+- compatible: brcm,mdio-mux-iproc.++Every non-ethernet PHY requires a compatible so that it could be probed based+on this compatible string.++Additional information regarding generic multiplexer properties can be found+at- Documentation/devicetree/bindings/net/mdio-mux.txt+++for example:+ mdio_mux_iproc: mdio-mux at 6602023c {+ compatible = "brcm,mdio-mux-iproc";+ reg = <0x6602023c 0x14>;+ #address-cells = <1>;+ #size-cells = <0>;++ mdio at 0 {+ reg = <0x0>;+ #address-cells = <1>;+ #size-cells = <0>;++ pci_phy0: pci-phy at 0 {+ compatible = "brcm,ns2-pcie-phy";+ reg = <0x0>;+ #phy-cells = <0>;+ };+ };++ mdio at 7 {+ reg = <0x7>;+ #address-cells = <1>;+ #size-cells = <0>;++ pci_phy1: pci-phy at 0 {+ compatible = "brcm,ns2-pcie-phy";+ reg = <0x0>;+ #phy-cells = <0>;+ };+ };+ mdio at 10 {+ reg = <0x10>;+ #address-cells = <1>;+ #size-cells = <0>;++ gphy0: eth-phy at 10 {+ reg = <0x10>;+ };+ };+ };
iProc based SoCs supports the integrated mdio multiplexer which
has the bus selection as well as mdio transaction generation logic
inside.
This multiplexer has child buses for PCIe, SATA, USB and ETH. These
buses could be internal or external to SOC where PHYs are attached.
These buses could use C-45 or C-22 mdio transaction.
Signed-off-by: Pramod Kumar <redacted>
---
drivers/net/phy/Kconfig | 11 ++
drivers/net/phy/Makefile | 1 +
drivers/net/phy/mdio-mux-bcm-iproc.c | 248 +++++++++++++++++++++++++++++++++++
3 files changed, 260 insertions(+)
create mode 100644 drivers/net/phy/mdio-mux-bcm-iproc.c
@@ -254,6 +254,17 @@ config MDIO_BUS_MUX_MMIOREGCurrently,only8-bitregistersaresupported.+configMDIO_BUS_MUX_BCM_IPROC+tristate"Support for iProc based MDIO bus multiplexers"+depends onOF&&OF_MDIO&&(ARCH_BCM_IPROC||COMPILE_TEST)+selectMDIO_BUS_MUX+defaultARCH_BCM_IPROC+help+ThismoduleprovidesadriverforMDIObusmultiplexersfoundin+iProcbasedBroadcomSoCs.Thismultiplexerconnectsoneofseveral+childMDIObustoaparentbus.Busescouldbeinternalaswellas+externalandselectionlogicliesinsidethesamemultiplexer.+configMDIO_BCM_UNIMACtristate"Broadcom UniMAC MDIO bus controller"depends onHAS_IOMEM
@@ -0,0 +1,27 @@+* Broadcom NS2 PCIe PHY binding document++Required bus properties:+- reg: MDIO Bus number for the MDIO interface+- #address-cells: must be 1+- #size-cells: must be 0++Required PHY properties:+- compatible: should be "brcm,ns2-pcie-phy"+- reg: MDIO Phy ID for the MDIO interface+- #phy-cells: must be 0++This is a child bus node of "brcm,mdio-mux-iproc" node.++Example:++mdio at 0 {+ reg = <0x0>;+ #address-cells = <1>;+ #size-cells = <0>;++ pci_phy0: pci-phy at 0 {+ compatible = "brcm,ns2-pcie-phy";+ reg = <0x0>;+ #phy-cells = <0>;+ };+};
Add integrated MDIO multiplexer driver node which contains
two mux PCIe bus and one ethernet bus along with phys
lying on these bus.
Signed-off-by: Pramod Kumar <redacted>
---
arch/arm64/boot/dts/broadcom/ns2-svk.dts | 12 ++++++++++++
arch/arm64/boot/dts/broadcom/ns2.dtsi | 31 +++++++++++++++++++++++++++++++
2 files changed, 43 insertions(+)
From: Andrew Lunn <andrew@lunn.ch> Date: 2016-06-06 14:15:40
On Mon, Jun 06, 2016 at 06:11:38PM +0530, Pramod Kumar wrote:
iProc based SoCs supports the integrated mdio multiplexer which
has the bus selection as well as mdio transaction generation logic
inside.
This multiplexer has child buses for PCIe, SATA, USB and ETH. These
buses could be internal or external to SOC where PHYs are attached.
These buses could use C-45 or C-22 mdio transaction.
Signed-off-by: Pramod Kumar <redacted>
From: Andrew Lunn <andrew@lunn.ch> Date: 2016-06-06 14:17:42
On Mon, Jun 06, 2016 at 06:11:34PM +0530, Pramod Kumar wrote:
An integrated multiplexer uses same address space for
"muxed bus selection" and "generation of mdio transaction"
hence its good to register parent bus from mux driver.
Hence added a mechanism where mux driver could register a
parent bus and pass it down to framework via mdio_mux_init api.
Signed-off-by: Pramod Kumar <redacted>
From: Andrew Lunn <andrew@lunn.ch> Date: 2016-06-06 14:18:07
On Mon, Jun 06, 2016 at 06:11:35PM +0530, Pramod Kumar wrote:
Change "mdio-parent-bus" from mandatory section to optional
as it won't be required by integrated MDIO multiplexer
which has bus selection and mdio transaction generation logic,
integrated inside.
Signed-off-by: Pramod Kumar <redacted>
An integrated multiplexer uses same address space for
"muxed bus selection" and "generation of mdio transaction"
hence its good to register parent bus from mux driver.
Hence added a mechanism where mux driver could register a
parent bus and pass it down to framework via mdio_mux_init api.
Signed-off-by: Pramod Kumar <redacted>
You could have added just a forward declaration, this is a pointer to
the structure so you don't need the compiler to have full knowledge of
the storage type. Not a biggie.
--
Florian
Add integrated MDIO multiplexer driver node which contains
two mux PCIe bus and one ethernet bus along with phys
lying on these bus.
Signed-off-by: Pramod Kumar <redacted>
---
+ mdio_mux_iproc: mdio-mux at 6602023c {
+ compatible = "brcm,mdio-mux-iproc";
+ reg = <0x6602023c 0x14>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ mdio at 0 {
+ reg = <0x0>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ pci_phy0: pci-phy at 0 {
+ compatible = "brcm,ns2-pcie-phy";
+ reg = <0x0>;
+ #phy-cells = <0>;
+ };
+ };
+
+ mdio at 7 {
+ reg = <0x7>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ pci_phy1: pci-phy at 0 {
+ compatible = "brcm,ns2-pcie-phy";
+ reg = <0x0>;
+ #phy-cells = <0>;
+ };
Are these two PHYs always available in the NS2 SoC, or does that depend
on interfaces exposed at the board level? Should not they be flagged
with a disabled status property by default and enabled in their
respective board files?
--
Florian
iProc based SoCs supports the integrated mdio multiplexer which
has the bus selection as well as mdio transaction generation logic
inside.
This multiplexer has child buses for PCIe, SATA, USB and ETH. These
buses could be internal or external to SOC where PHYs are attached.
These buses could use C-45 or C-22 mdio transaction.
Signed-off-by: Pramod Kumar <redacted>
-----Original Message-----
From: Florian Fainelli [mailto:f.fainelli at gmail.com]
Sent: 07 June 2016 00:06
To: Pramod Kumar; Rob Herring; Pawel Moll; Mark Rutland; Ian Campbell;
Kumar Gala; Catalin Marinas; Will Deacon; Kishon Vijay Abraham I; David S.
Miller
Cc: devicetree at vger.kernel.org; netdev at vger.kernel.org; linux-
kernel at vger.kernel.org; bcm-kernel-feedback-list at broadcom.com; linux-arm-
kernel at lists.infradead.org
Subject: Re: [PATCH v4 3/7] binding: mdio-mux: Add DT binding doc for
Broadcom MDIO bus multiplexer
On 06/06/2016 05:41 AM, Pramod Kumar wrote:
quoted
Add DT binding doc for Broadcom MDIO bus multiplexer driver.
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Pramod Kumar <redacted>
-----Original Message-----
From: Florian Fainelli [mailto:f.fainelli at gmail.com]
Sent: 07 June 2016 00:12
To: Pramod Kumar; Rob Herring; Pawel Moll; Mark Rutland; Ian Campbell;
Kumar Gala; Catalin Marinas; Will Deacon; Kishon Vijay Abraham I; David S.
Miller
Cc: devicetree at vger.kernel.org; linux-arm-kernel at lists.infradead.org; bcm-
kernel-feedback-list at broadcom.com; linux-kernel at vger.kernel.org;
netdev at vger.kernel.org; Jon Mason
Subject: Re: [PATCH v4 7/7] phy: Add Northstar2 PCI Phy support
On 06/06/2016 05:41 AM, Pramod Kumar wrote:
quoted
Add PCI Phy support for Broadcom Northstar2 SoCs. This driver uses
the interface from the iproc mdio mux driver to enable the devices
respective phys.
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Jon Mason <redacted>
Signed-off-by: Pramod Kumar <redacted>
---
drivers/phy/Kconfig | 8 +++
drivers/phy/Makefile | 2 +-
drivers/phy/phy-bcm-ns2-pcie.c | 115
+++++++++++++++++++++++++++++++++++++++++
3 files changed, 124 insertions(+), 1 deletion(-) create mode 100644
drivers/phy/phy-bcm-ns2-pcie.c
diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index
From: Rob Herring <robh@kernel.org> Date: 2016-06-08 19:39:33
On Mon, Jun 06, 2016 at 06:11:35PM +0530, Pramod Kumar wrote:
Change "mdio-parent-bus" from mandatory section to optional
as it won't be required by integrated MDIO multiplexer
which has bus selection and mdio transaction generation logic,
integrated inside.
Signed-off-by: Pramod Kumar <redacted>
---
Documentation/devicetree/bindings/net/mdio-mux.txt | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
From: Rob Herring <robh@kernel.org> Date: 2016-06-08 19:40:48
On Tue, Jun 07, 2016 at 05:27:29PM +0530, Pramod Kumar wrote:
Hi Florian,
quoted
-----Original Message-----
From: Florian Fainelli [mailto:f.fainelli at gmail.com]
Sent: 07 June 2016 00:06
To: Pramod Kumar; Rob Herring; Pawel Moll; Mark Rutland; Ian Campbell;
Kumar Gala; Catalin Marinas; Will Deacon; Kishon Vijay Abraham I; David S.
Miller
Cc: devicetree at vger.kernel.org; netdev at vger.kernel.org; linux-
kernel at vger.kernel.org; bcm-kernel-feedback-list at broadcom.com; linux-arm-
kernel at lists.infradead.org
Subject: Re: [PATCH v4 3/7] binding: mdio-mux: Add DT binding doc for
Broadcom MDIO bus multiplexer
On 06/06/2016 05:41 AM, Pramod Kumar wrote:
quoted
Add DT binding doc for Broadcom MDIO bus multiplexer driver.
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Pramod Kumar <redacted>
-----Original Message-----
From: Florian Fainelli [mailto:f.fainelli at gmail.com]
Sent: 07 June 2016 00:08
To: Pramod Kumar; Rob Herring; Pawel Moll; Mark Rutland; Ian Campbell;
Kumar Gala; Catalin Marinas; Will Deacon; Kishon Vijay Abraham I; David S.
Miller
Cc: devicetree at vger.kernel.org; netdev at vger.kernel.org; linux-
kernel at vger.kernel.org; bcm-kernel-feedback-list at broadcom.com; linux-arm-
kernel at lists.infradead.org
Subject: Re: [PATCH v4 4/7] dt: mdio-mux: Add mdio multiplexer driver node
On 06/06/2016 05:41 AM, Pramod Kumar wrote:
quoted
Add integrated MDIO multiplexer driver node which contains two mux
PCIe bus and one ethernet bus along with phys lying on these bus.
Signed-off-by: Pramod Kumar <redacted>
---
+ mdio_mux_iproc: mdio-mux at 6602023c {
+ compatible = "brcm,mdio-mux-iproc";
+ reg = <0x6602023c 0x14>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ mdio at 0 {
+ reg = <0x0>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ pci_phy0: pci-phy at 0 {
+ compatible = "brcm,ns2-pcie-phy";
+ reg = <0x0>;
+ #phy-cells = <0>;
+ };
+ };
+
+ mdio at 7 {
+ reg = <0x7>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ pci_phy1: pci-phy at 0 {
+ compatible = "brcm,ns2-pcie-phy";
+ reg = <0x0>;
+ #phy-cells = <0>;
+ };
Are these two PHYs always available in the NS2 SoC, or does that depend on
interfaces exposed at the board level? Should not they be flagged with a
disabled status property by default and enabled in their respective board
files?
--
It depends on the interfaces exposed at board level. We will disable it in
dtsi and enable it dts file. I'll address this through next patch set.