Add MDIO bus multiplexer support for iProc SoCs
Subsystems (6)
v3 cover Add MDIO bus multiplexer support for iProc SoCs
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 mulitplexer 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-v3-resend
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 mutiplexer 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 | 246 +++++++++++++++++++++ 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, 536 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
Signature · 1 line
1.9.1
PATCH RESEND v3 1/7 mdio:mux: Enhanced MDIO mux framework for integrated multiplexers
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.
--- 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(-)
drivers/net/phy/mdio-mux-gpio.c +1 -1
@@ -55,7 +55,7 @@ static int mdio_mux_gpio_probe(struct platform_device *pdev)return PTR_ERR (s->gpios); r =mdio_mux_init (&pdev->dev, - mdio_mux_gpio_switch_fn, &s->mux_handle, s); + mdio_mux_gpio_switch_fn, &s->mux_handle, s,NULL );if (r !=0 ) {gpiod_put_array (s->gpios);
drivers/net/phy/mdio-mux-mmioreg.c +1 -1
@@ -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);
drivers/net/phy/mdio-mux.c +18 -10
@@ -89,7 +89,8 @@ static int parent_count;int mdio_mux_init (struct device *dev,int (*switch_fn)(int cur,int desired,void *data),void **mux_handle, -void *data) +void *data, +struct mii_bus *mux_bus) {struct device_node *parent_bus_node;struct device_node *child_bus_node;
@@ -101,10 +102,21 @@ int mdio_mux_init(struct device *dev,if (!dev->of_node)return -ENODEV ; - parent_bus_node =of_parse_phandle (dev->of_node,"mdio-parent-bus" ,0 ); +if (!mux_bus) { + parent_bus_node =of_parse_phandle (dev->of_node, +"mdio-parent-bus" ,0 ); -if (!parent_bus_node) -return -ENODEV ; +if (!parent_bus_node) +return -ENODEV ; + + parent_bus =of_mdio_find_bus (parent_bus_node); +if (!parent_bus) { + ret_val = -EPROBE_DEFER ; + goto err_parent_bus; + } + }else { + parent_bus = mux_bus; + } pb =devm_kzalloc (dev,sizeof (*pb),GFP_KERNEL );if (pb ==NULL ) {
@@ -112,11 +124,6 @@ int mdio_mux_init(struct device *dev, goto err_parent_bus; } - parent_bus =of_mdio_find_bus (parent_bus_node); -if (parent_bus ==NULL ) { - ret_val = -EPROBE_DEFER ; - goto err_parent_bus; - } pb->switch_data = data; pb->switch_fn = switch_fn;
@@ -177,7 +184,8 @@ int mdio_mux_init(struct device *dev,put_device (&pb->mii_bus->dev); err_parent_bus: -of_node_put (parent_bus_node); +if (!mux_bus) +of_node_put (parent_bus_node);return ret_val; }EXPORT_SYMBOL_GPL (mdio_mux_init);
include/linux/mdio-mux.h +3 -1
@@ -10,11 +10,13 @@#ifndef __LINUX_MDIO_MUX_H#define __LINUX_MDIO_MUX_H#include <linux/device.h> +#include <linux/phy.h> int mdio_mux_init (struct device *dev,int (*switch_fn) (int cur,int desired,void *data),void **mux_handle, -void *data); +void *data, +struct mii_bus *mux_bus);void mdio_mux_uninit (void *mux_handle);
Signature · 1 line
1.9.1
PATCH RESEND v3 2/7 binding: Make "mdio-parent-bus" property from mandatory to optional
In reply to Pramod KumarChange "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.
--- Documentation/devicetree/bindings/net/mdio-mux.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/net/mdio-mux.txt +2 -1
@@ -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:
Signature · 1 line
1.9.1
PATCH RESEND v3 3/7 binding: mdio-mux: Add DT binding doc for Broadcom MDIO bus mutiplexer
In reply to Pramod KumarAdd DT binding doc for Broadcom MDIO bus mutiplexer driver.
--- .../bindings/net/brcm,mdio-mux-iproc.txt | 59 ++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/brcm,mdio-mux-iproc.txt
Documentation/devicetree/bindings/net/brcm,mdio-mux-iproc.txt new file +59 -0
@@ -0,0 +1,59 @@ +Properties for an MDIO bus mutiplexer 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 trascation 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>; + }; + }; + };
Signature · 1 line
1.9.1
PATCH RESEND v3 4/7 dt:mdio-mux: Add mdio multiplexer driver node
In reply to Pramod KumarAdd integrated MDIO multiplexer driver node which contains two mux PCIe bus and one ethernet bus along with phys lying on these bus.
--- arch/arm64/boot/dts/broadcom/ns2-svk.dts | 12 ++++++++++++ arch/arm64/boot/dts/broadcom/ns2.dtsi | 31 +++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+)
arch/arm64/boot/dts/broadcom/ns2-svk.dts +12 -0
@@ -132,3 +132,15 @@ #size-cells = <1>; }; }; + +&mdio_mux_iproc { + mdio at 10 { + reg = <0x10>; + #address-cells = <1>; + #size-cells = <0>; + + gphy0: eth-phy at 10 { + reg = <0x10>; + }; + }; +};
arch/arm64/boot/dts/broadcom/ns2.dtsi +31 -0
@@ -263,6 +263,37 @@ IRQ_TYPE_LEVEL_HIGH)>; }; + 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>; + }; + }; + }; + timer0: timer at 66030000 { compatible = "arm,sp804", "arm,primecell"; reg = <0x66030000 0x1000>;
Signature · 1 line
1.9.1
PATCH RESEND v3 5/7 net:mdio-mux: Add MDIO mux driver for iProc SoCs
In reply to Pramod KumariProc based SoCs supports the integrated mdio multiplexer which has the bus selection as well as mdio transaction generation logic inside.
This mutiplexer 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.
--- drivers/net/phy/Kconfig | 11 ++ drivers/net/phy/Makefile | 1 + drivers/net/phy/mdio-mux-bcm-iproc.c | 246 +++++++++++++++++++++++++++++++++++ 3 files changed, 258 insertions(+) create mode 100644 drivers/net/phy/mdio-mux-bcm-iproc.c
drivers/net/phy/Kconfig +11 -0
@@ -254,6 +254,17 @@ config MDIO_BUS_MUX_MMIOREG Currently, only 8-bit registers are supported. +config MDIO_BUS_MUX_BCM_IPROC + tristate "Support for iProc based MDIO bus multiplexers" + depends on OF && OF_MDIO && (ARCH_BCM_IPROC || COMPILE_TEST) + select MDIO_BUS_MUX + default ARCH_BCM_IPROC + help + This module provides a driver for MDIO bus multiplexers found in + iProc based Broadcom SoCs. This mulitplexer connects one of several + child MDIO bus to a parent bus. Buses could be interal as well as + external and selection logic lies inside the same multiplexer. + config MDIO_BCM_UNIMAC tristate "Broadcom UniMAC MDIO bus controller" depends on HAS_IOMEM
drivers/net/phy/Makefile +1 -0
@@ -39,6 +39,7 @@ obj-$(CONFIG_AMD_PHY) += amd.o obj-$(CONFIG_MDIO_BUS_MUX) += mdio-mux.o obj-$(CONFIG_MDIO_BUS_MUX_GPIO) += mdio-mux-gpio.o obj-$(CONFIG_MDIO_BUS_MUX_MMIOREG) += mdio-mux-mmioreg.o +obj-$(CONFIG_MDIO_BUS_MUX_BCM_IPROC) += mdio-mux-bcm-iproc.o obj-$(CONFIG_MDIO_SUN4I) += mdio-sun4i.o obj-$(CONFIG_MDIO_MOXART) += mdio-moxart.o obj-$(CONFIG_MDIO_BCM_UNIMAC) += mdio-bcm-unimac.o
drivers/net/phy/mdio-mux-bcm-iproc.c new file +246 -0
246 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH RESEND v3 6/7 Binding:PHY: Binding doc for NS2 PCIe PHYs.
In reply to Pramod KumarBinding doc for NS2 PCIe PHYs.
--- .../bindings/phy/brcm,mdio-mux-bus-pci.txt | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/brcm,mdio-mux-bus-pci.txt
Documentation/devicetree/bindings/phy/brcm,mdio-mux-bus-pci.txt new file +27 -0
@@ -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>; + }; +};
Signature · 1 line
1.9.1
PATCH RESEND v3 7/7 phy: Add Northstar2 PCI Phy support
In reply to Pramod KumarAdd PCI Phy support for Broadcom Northstar2 SoCs. This driver uses the interface from the iproc mdio mux driver to enable the devices respective phys.
--- 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
drivers/phy/Kconfig +8 -0
@@ -434,4 +434,12 @@ config PHY_CYGNUS_PCIE source "drivers/phy/tegra/Kconfig" +config PHY_NS2_PCIE + tristate "Broadcom Northstar2 PCIe PHY driver" + depends on OF && MDIO_BUS_MUX_BCM_IPROC + select GENERIC_PHY + default ARCH_BCM_IPROC + help + Enable this to support the Broadcom Northstar2 PCIe PHY. + If unsure, say N. endmenu
drivers/phy/Makefile +1 -1
@@ -53,5 +53,5 @@ obj-$(CONFIG_PHY_TUSB1210) += phy-tusb1210.o obj-$(CONFIG_PHY_BRCM_SATA) += phy-brcm-sata.o obj-$(CONFIG_PHY_PISTACHIO_USB) += phy-pistachio-usb.o obj-$(CONFIG_PHY_CYGNUS_PCIE) += phy-bcm-cygnus-pcie.o - obj-$(CONFIG_ARCH_TEGRA) += tegra/ +obj-$(CONFIG_PHY_NS2_PCIE) += phy-bcm-ns2-pcie.o
drivers/phy/phy-bcm-ns2-pcie.c new file +115 -0
115 lines not on this page · raw message
Signature · 1 line
1.9.1
Andrew Lunn
maintainerQuoted 2 lines
Reason for resend:
-Rebased on v4.7-rc1
How do you see this getting merged? Via netdev? If so, you should be based on net-next/master, not v4.7-rc1.
Andrew
David Miller
maintainerFrom: Andrew Lunn <[email protected]>
Date: Fri, 3 Jun 2016 18:32:47 +0200
Quoted 5 lines
Quoted 2 lines
Reason for resend:
-Rebased on v4.7-rc1How do you see this getting merged? Via netdev? If so, you should be based on net-next/master, not v4.7-rc1.
Indeed, please respin.
Also, in your Subject lines, always have a space after the ":" characters.