Skip to contentSkip to conversation

Add MDIO bus multiplexer support for iProc SoCs

PATCH Superseded Pramod Kumar 4 participants 19 messages May 31, 2016 – Jun 3, 2016

Subsystems (7)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v2 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.

2. Defined one new boolean property named "mdio-integrated-mux". Integrated bus Multiplexer node defines this so when parent bus is registered by calling "of_mdiobus_register", this api will not scan for child nodes. Child node of integrated multiplexer will be muxed nodes not PHYs one hence should not be scanned.

This patch set includes MDIO bus multiplexer driver along with above framework changes. 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.6.0-rc1 and is available from github-
repo: https://github.com/Broadcom/arm64-linux.git
branch:mdio-mux-v2

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
DT: phy.txt: Add mdio-integrated-mux property
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           |  60 +++++
 Documentation/devicetree/bindings/net/mdio-mux.txt |   9 +-
 .../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              |  32 +++
 drivers/net/phy/Kconfig                            |  11 +
 drivers/net/phy/Makefile                           |   1 +
 drivers/net/phy/mdio-mux-bcm-iproc.c               | 243 +++++++++++++++++++++
 drivers/net/phy/mdio-mux-gpio.c                    |   2 +-
 drivers/net/phy/mdio-mux-mmioreg.c                 |   2 +-
 drivers/net/phy/mdio-mux.c                         |  28 ++-
 drivers/of/of_mdio.c                               |   3 +
 drivers/phy/Kconfig                                |   8 +
 drivers/phy/Makefile                               |   1 +
 drivers/phy/phy-bcm-ns2-pcie.c                     | 115 ++++++++++
 include/linux/mdio-mux.h                           |   4 +-
 16 files changed, 544 insertions(+), 14 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
#1 lore raw

PATCH v2 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.

Below changes are required to make this happen-

1. When mdio-mux parent bus is registered, mdio framework should not parse for child as it will be muxed bus node not PHYs.

-created a new property "mdio-mux-bus-parent". if this property is present, of_mdiobus_register will not scan for phys.

2. Passed down parent bus to mdio mux 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 ++++++++++++++++++----------
 drivers/of/of_mdio.c               |  3 +++
 include/linux/mdio-mux.h           |  4 +++-
 5 files changed, 26 insertions(+), 13 deletions(-)
drivers/net/phy/mdio-mux-gpio.c +1 -1
index 7ddb1ab..9199499 100644
@@ -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
index 7fde454..d0bed52 100644
@@ -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
index 308ade0..521ab90 100644
@@ -95,7 +95,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;
@@ -107,10 +108,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) {
@@ -118,11 +130,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;
@@ -183,7 +190,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);
drivers/of/of_mdio.c +3 -0
index 8453f08..cf40e7a 100644
@@ -225,6 +225,9 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np)
 	if (rc)
 		return rc;
 
+	if (of_property_read_bool(np, "mdio-integrated-mux"))
+		return 0;
+
 	/* Loop over the child nodes and register a phy_device for each phy */
 	for_each_available_child_of_node(np, child) {
 		addr = of_mdio_parse_addr(&mdio->dev, child);
include/linux/mdio-mux.h +3 -1
index a243dbb..61f5b21 100644
@@ -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
#4 lore raw

PATCH v2 2/7 DT: phy.txt: Add mdio-integrated-mux property

In reply to Pramod Kumar

This property is used by integrated MDIO multiplexer which has bus selection and mdio transaction generation logic, integrated inside.

---
 Documentation/devicetree/bindings/net/mdio-mux.txt | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/net/mdio-mux.txt +8 -1
index 491f5bd..b5ad83e 100644
@@ -5,13 +5,20 @@ 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. Should be used
+		if parent mdio bus is not part of multiplexer.
+- mdio-integrated-mux: boolean property indicateing that the hardware
+		is an integrated multiplex supporting muxed bus selection
+		and MDIO transaction logic generation.
 - Other properties specific to the multiplexer/switch hardware.
 
+Note: one of mdio-parent-bus and mdio-integrated-mux is mandatory to
+get parent bus regsitered.
+
 Required properties for child nodes:
 - #address-cells = <1>;
 - #size-cells = <0>;
Signature · 1 line
1.9.1
#7 lore raw

PATCH v2 3/7 binding: mdio-mux: Add DT binding doc for Broadcom MDIO bus mutiplexer

In reply to Pramod Kumar

Add DT binding doc for Broadcom MDIO bus mutiplexer driver.

---
 .../bindings/net/brcm,mdio-mux-iproc.txt           | 60 ++++++++++++++++++++++
 1 file changed, 60 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/brcm,mdio-mux-iproc.txt
Documentation/devicetree/bindings/net/brcm,mdio-mux-iproc.txt new file +60 -0
new file mode 100644
index 0000000..f270b41
@@ -0,0 +1,60 @@
+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 need 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:
+- complatible: 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 could be found
+at- Documentation/devicetree/bindings/net/mdio-mux.txt
+
+
+for example:
+		mdio_mux_iproc: mdio_mux_iproc@6602023c {
+			compatible = "brcm,mdio-mux-iproc";
+			reg = <0x6602023c 0x14>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+			mdio-integrated-mux;
+
+			mdio@0 {
+				reg = <0x0>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				pci_phy0: pci-phy@0 {
+					compatible = "brcm,ns2-pcie-phy";
+					reg = <0x0>;
+					#phy-cells = <0>;
+				};
+			};
+
+			mdio@7 {
+				reg = <0x7>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				pci_phy1: pci-phy@0 {
+					compatible = "brcm,ns2-pcie-phy";
+					reg = <0x0>;
+					#phy-cells = <0>;
+				};
+			};
+			mdio@10 {
+				reg = <0x10>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				gphy0: eth-phy@10 {
+					reg = <0x10>;
+				};
+			};
+		};
Signature · 1 line
1.9.1
#10 lore raw

PATCH v2 4/7 DT:mdio-mux: Add mdio multiplexer driver node

In reply to Pramod Kumar

Add 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    | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+)
arch/arm64/boot/dts/broadcom/ns2-svk.dts +12 -0
index ce0ab84..8f6a6cc 100644
@@ -87,3 +87,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 +32 -0
index 6f81c9d..efc320a 100644
@@ -330,6 +330,38 @@
 			      <0x65260000 0x1000>;
 		};
 
+		mdio_mux_iproc: mdio_mux_iproc at 6602023c {
+			compatible = "brcm,mdio-mux-iproc";
+			reg = <0x6602023c 0x14>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+			mdio-integrated-mux;
+
+			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
#11 lore raw

PATCH v2 5/7 net:mdio-mux: Add MDIO mux driver for iProc SoCs

In reply to Pramod Kumar

iProc 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 | 243 +++++++++++++++++++++++++++++++++++
 3 files changed, 255 insertions(+)
 create mode 100644 drivers/net/phy/mdio-mux-bcm-iproc.c
drivers/net/phy/Kconfig +11 -0
index 6dad9a9..38faecf 100644
@@ -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
index fcdbb92..f5951d5a 100644
@@ -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 +243 -0

243 lines not on this page · raw message

Signature · 1 line
1.9.1
#14 lore raw

PATCH v2 6/7 Binding:PHY: Binding doc for NS2 PCIe PHYs.

In reply to Pramod Kumar

Binding 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
new file mode 100644
index 0000000..5b51007
@@ -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
#16 lore raw

PATCH v2 7/7 phy: Add Northstar2 PCI Phy support

In reply to Pramod Kumar

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.

---
 drivers/phy/Kconfig            |   8 +++
 drivers/phy/Makefile           |   1 +
 drivers/phy/phy-bcm-ns2-pcie.c | 115 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 124 insertions(+)
 create mode 100644 drivers/phy/phy-bcm-ns2-pcie.c
drivers/phy/Kconfig +8 -0
index 26566db..5ff60b2 100644
@@ -421,4 +421,12 @@ config PHY_CYGNUS_PCIE
 	  Enable this to support the Broadcom Cygnus PCIe PHY.
 	  If unsure, say N.
 
+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 -0
index 24596a9..77d51ff 100644
@@ -52,3 +52,4 @@ obj-$(CONFIG_PHY_TUSB1210)		+= phy-tusb1210.o
 obj-$(CONFIG_PHY_BRCMSTB_SATA)		+= phy-brcmstb-sata.o
 obj-$(CONFIG_PHY_PISTACHIO_USB)		+= phy-pistachio-usb.o
 obj-$(CONFIG_PHY_CYGNUS_PCIE)		+= phy-bcm-cygnus-pcie.o
+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
maintainer
#2 lore raw

Re: [PATCH v2 1/7] mdio:mux: Enhanced MDIO mux framework for integrated multiplexers

In reply to Pramod Kumar

drivers/of/of_mdio.c int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np) · line 230

Quoted 11 lines
drivers/of/of_mdio.c +3 -0
index 8453f08..cf40e7a 100644
@@ -225,6 +225,9 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np)
 	if (rc)
 		return rc;
 
+	if (of_property_read_bool(np, "mdio-integrated-mux"))
+		return 0;
+

Hi

Rather than doing this, did you try setting bus->phy_mask = 0 and calling mdiobus_register(), rather than of_mdiobus_regsiter() for the parent bus?

Andrew

maintainer
#17 lore raw

Re: [PATCH v2 7/7] phy: Add Northstar2 PCI Phy support

In reply to Pramod Kumar

drivers/phy/phy-bcm-ns2-pcie.c line 70

Quoted 12 lines
drivers/phy/phy-bcm-ns2-pcie.c new file +12 -0
+static int ns2_pci_phy_probe(struct mdio_device *mdiodev)
+{
+	struct device *dev = &mdiodev->dev;
+	struct phy_provider *provider;
+	struct ns2_pci_phy *p;
+	struct phy *phy;
+
+	phy = devm_phy_create(dev, dev->of_node, &ns2_pci_phy_ops);
+	if (IS_ERR_OR_NULL(phy)) {
+		dev_err(dev, "failed to create Phy\n");
+		return PTR_ERR(phy);
+	}

https://www.mail-archive.com/linux-omap at vger.kernel.org/msg78030.html

Andrew

maintainer
#12 lore raw

Re: [PATCH v2 5/7] net:mdio-mux: Add MDIO mux driver for iProc SoCs

In reply to Pramod Kumar

From: Pramod Kumar <[email protected]>
Date: Tue, 31 May 2016 19:06:39 +0530

drivers/net/phy/mdio-mux-bcm-iproc.c line 57

Quoted 4 lines
drivers/net/phy/mdio-mux-bcm-iproc.c new file +4 -0
+static int iproc_mdio_wait_for_idle(void __iomem *base, bool result)
+{
+	u32 val;
+	unsigned int timeout = 1000; /* loop for 1s */

Please order your local variable declarations from longest to shortest line.

drivers/net/phy/mdio-mux-bcm-iproc.c line 86

Quoted 5 lines
drivers/net/phy/mdio-mux-bcm-iproc.c new file +5 -0
+static int start_miim_ops(void __iomem *base,
+			  u16 phyid, u32 reg, u16 val, u32 op)
+{
+	int ret;
+	u32 param;

Likewise.

drivers/net/phy/mdio-mux-bcm-iproc.c line 118

Quoted 4 lines
drivers/net/phy/mdio-mux-bcm-iproc.c new file +4 -0
+static int iproc_mdiomux_read(struct mii_bus *bus, int phyid, int reg)
+{
+	int ret;
+	struct iproc_mdiomux_desc *md = bus->priv;

Likewise.

maintainer
#5 lore raw

Re: [PATCH v2 2/7] DT: phy.txt: Add mdio-integrated-mux property

In reply to Pramod Kumar
Quoted 14 lines · Pramod Kumar

This property is used by integrated MDIO multiplexer which has bus selection and mdio transaction generation logic, integrated inside.

---
 Documentation/devicetree/bindings/net/mdio-mux.txt | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/net/mdio-mux.txt +0 -0
index 491f5bd..b5ad83e 100644

Documentation/devicetree/bindings/net/mdio-mux.txt numbered uniquely in a device dependent manner. The nodes for an MDIO · line 13

Quoted 10 lines
Documentation/devicetree/bindings/net/mdio-mux.txt +2 -1
@@ -5,13 +5,20 @@ 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. Should be used
+		if parent mdio bus is not part of multiplexer.

You don't appear to be using this. When would you?

Quoted 14 lines
Documentation/devicetree/bindings/net/mdio-mux.txt +6 -0
+- mdio-integrated-mux: boolean property indicateing that the hardware
+		is an integrated multiplex supporting muxed bus selection
+		and MDIO transaction logic generation.
 - Other properties specific to the multiplexer/switch hardware.
 
+Note: one of mdio-parent-bus and mdio-integrated-mux is mandatory to
+get parent bus regsitered.
+
 Required properties for child nodes:
 - #address-cells = <1>;
 - #size-cells = <0>;
Signature · 1 line
1.9.1
maintainer
#6 lore raw

Re: [PATCH v2 2/7] DT: phy.txt: Add mdio-integrated-mux property

Quoted 22 lines · Rob Herring
Quoted 21 lines · Pramod Kumar

This property is used by integrated MDIO multiplexer which has bus selection and mdio transaction generation logic, integrated inside.

---
 Documentation/devicetree/bindings/net/mdio-mux.txt | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/net/mdio-mux.txt +0 -1
index 491f5bd..b5ad83e 100644
@@ -5,13 +5,20 @@ 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>;
 
Quoted 5 lines

Documentation/devicetree/bindings/net/mdio-mux.txt numbered uniquely in a device dependent manner. The nodes for an MDIO · line 13

Quoted 3 lines
Documentation/devicetree/bindings/net/mdio-mux.txt +2 -0
 Optional properties:
+- mdio-parent-bus : phandle to the parent MDIO bus. Should be used
+		if parent mdio bus is not part of multiplexer.

You don't appear to be using this. When would you?

He is moving it to optional. The mdio-mux-mmio and mdio-mux-gpio do however use it, which follow this binding.

Andrew

maintainer
#8 lore raw

Re: [PATCH v2 3/7] binding: mdio-mux: Add DT binding doc for Broadcom MDIO bus mutiplexer

In reply to Pramod Kumar
Quoted 14 lines · Pramod Kumar

Add DT binding doc for Broadcom MDIO bus mutiplexer driver.

---
 .../bindings/net/brcm,mdio-mux-iproc.txt           | 60 ++++++++++++++++++++++
 1 file changed, 60 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/brcm,mdio-mux-iproc.txt
Documentation/devicetree/bindings/net/brcm,mdio-mux-iproc.txt new file +0 -0
new file mode 100644
index 0000000..f270b41

Documentation/devicetree/bindings/net/brcm,mdio-mux-iproc.txt line 5

Quoted 5 lines
Documentation/devicetree/bindings/net/brcm,mdio-mux-iproc.txt new file +5 -0
@@ -0,0 +1,60 @@
+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 need to select these two

s/Child/child/

s/need/needs/

Documentation/devicetree/bindings/net/brcm,mdio-mux-iproc.txt line 11

Quoted 6 lines
Documentation/devicetree/bindings/net/brcm,mdio-mux-iproc.txt new file +6 -0
+properties as well to generate desired MDIO trascation on appropriate bus.
+
+Required properties in addition to the generic multiplexer properties:
+
+MDIO multiplexer node:
+- complatible: brcm,mdio-mux-iproc.

typo

Documentation/devicetree/bindings/net/brcm,mdio-mux-iproc.txt line 16

Quoted 5 lines
Documentation/devicetree/bindings/net/brcm,mdio-mux-iproc.txt new file +5 -0
+
+Every non-ethernet PHY requires a compatible so that it could be probed based
+on this compatible string.
+
+Additional information regarding generic multiplexer properties could be found

s/could/can/

Documentation/devicetree/bindings/net/brcm,mdio-mux-iproc.txt

Quoted 5 lines
Documentation/devicetree/bindings/net/brcm,mdio-mux-iproc.txt new file +5 -0
+at- Documentation/devicetree/bindings/net/mdio-mux.txt
+
+
+for example:
+		mdio_mux_iproc: mdio_mux_iproc at 6602023c {

No '_' in node names.

mdio-mux at ...

Quoted 42 lines
Documentation/devicetree/bindings/net/brcm,mdio-mux-iproc.txt new file +39 -0
+			compatible = "brcm,mdio-mux-iproc";
+			reg = <0x6602023c 0x14>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+			mdio-integrated-mux;
+
+			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
maintainer Acked-by on v2 6/7
#15 lore raw

Re: [PATCH v2 6/7] Binding:PHY: Binding doc for NS2 PCIe PHYs.

In reply to Pramod Kumar
Quoted 8 lines · Pramod Kumar

Binding 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
#18 lore raw

RE: [PATCH v2 7/7] phy: Add Northstar2 PCI Phy support

In reply to Andrew Lunn

Hi Andrew,

Quoted 5 lines

-----Original Message-----
From: Andrew Lunn [mailto:andrew at lunn.ch]
Sent: 01 June 2016 18:42
To: Pramod Kumar
Cc: Rob Herring; Pawel Moll; Mark Rutland; Ian Campbell; Kumar Gala;

Catalin

Quoted 3 lines

Marinas; Will Deacon; Kishon Vijay Abraham I; David S. Miller; devicetree at vger.kernel.org; Jon Mason; netdev at vger.kernel.org; linux- kernel at vger.kernel.org; bcm-kernel-feedback-list at broadcom.com;

linux-arm-

Quoted 17 lines

kernel at lists.infradead.org
Subject: Re: [PATCH v2 7/7] phy: Add Northstar2 PCI Phy support

drivers/phy/phy-bcm-ns2-pcie.c line 70

Quoted 11 lines
drivers/phy/phy-bcm-ns2-pcie.c new file +11 -0
+static int ns2_pci_phy_probe(struct mdio_device *mdiodev) {
+	struct device *dev = &mdiodev->dev;
+	struct phy_provider *provider;
+	struct ns2_pci_phy *p;
+	struct phy *phy;
+
+	phy = devm_phy_create(dev, dev->of_node, &ns2_pci_phy_ops);
+	if (IS_ERR_OR_NULL(phy)) {
+		dev_err(dev, "failed to create Phy\n");
+		return PTR_ERR(phy);
+	}

https://www.mail-archive.com/linux-omap at vger.kernel.org/msg78030.html

I've explored inside this API and see it never returning NULL. I'll replace IS_ERR_OR_NULL to IS_ERR.
Thanks for pointing this out.

Quoted 1 line

Andrew

Regards,
Pramod

#3 lore raw

RE: [PATCH v2 1/7] mdio:mux: Enhanced MDIO mux framework for integrated multiplexers

In reply to Andrew Lunn

Hi Andrew,

Quoted 5 lines

-----Original Message-----
From: Andrew Lunn [mailto:andrew at lunn.ch]
Sent: 01 June 2016 18:32
To: Pramod Kumar
Cc: Rob Herring; Pawel Moll; Mark Rutland; Ian Campbell; Kumar Gala;

Catalin

Quoted 3 lines

Marinas; Will Deacon; Kishon Vijay Abraham I; David S. Miller; 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-

Quoted 9 lines

kernel at lists.infradead.org
Subject: Re: [PATCH v2 1/7] mdio:mux: Enhanced MDIO mux framework for integrated multiplexers

drivers/of/of_mdio.c int of_mdiobus_register(struct mii_bus *mdio,

Quoted 5 lines
drivers/of/of_mdio.c index renamed from drivers/of/of_mdio.c +0 -0

8453f08..cf40e7a 100644

drivers/of/of_mdio.c +0 -0
@@ -225,6 +225,9 @@ int of_mdiobus_register(struct mii_bus *mdio,

struct

Quoted 11 lines

device_node *np)

drivers/of/of_mdio.c int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np) · line 230

Quoted 6 lines
drivers/of/of_mdio.c +3 -0
 	if (rc)
 		return rc;
 
+	if (of_property_read_bool(np, "mdio-integrated-mux"))
+		return 0;
+

Hi

Rather than doing this, did you try setting bus->phy_mask = 0 and

calling

Quoted 1 line

mdiobus_register(), rather than of_mdiobus_regsiter() for the parent

bus?

Quoted 1 line

After setting bus->phy_mask = ~0 and using mdiobus_regsiter() I could get rid of newly added
Property. It works for me as I find same has been done inside of of_mdiobus_regsiter().

Thanks for pointing out this.

Quoted 1 line

Andrew

#13 lore raw

RE: [PATCH v2 5/7] net:mdio-mux: Add MDIO mux driver for iProc SoCs

In reply to David Miller

Hi David,

Quoted 8 lines

-----Original Message-----
From: David Miller [mailto:davem at davemloft.net]
Sent: 02 June 2016 04:48
To: pramod.kumar at broadcom.com
Cc: robh+dt at kernel.org; pawel.moll at arm.com; mark.rutland at arm.com; ijc+devicetree at hellion.org.uk; galak at codeaurora.org; catalin.marinas at arm.com; will.deacon at arm.com; kishon at ti.com; devicetree at vger.kernel.org; linux-arm-kernel at lists.infradead.org;

bcm-kernel-

Quoted 3 lines

feedback-list at broadcom.com; linux-kernel at vger.kernel.org; netdev at vger.kernel.org
Subject: Re: [PATCH v2 5/7] net:mdio-mux: Add MDIO mux driver for iProc

SoCs

Quoted 10 lines

From: Pramod Kumar <[email protected]>
Date: Tue, 31 May 2016 19:06:39 +0530

drivers/net/phy/mdio-mux-bcm-iproc.c line 57

Quoted 4 lines
drivers/net/phy/mdio-mux-bcm-iproc.c new file +4 -0
+static int iproc_mdio_wait_for_idle(void __iomem *base, bool result)
+{
+	u32 val;
+	unsigned int timeout = 1000; /* loop for 1s */

Please order your local variable declarations from longest to shortest

line.

Quoted 8 lines

drivers/net/phy/mdio-mux-bcm-iproc.c line 86

Quoted 5 lines
drivers/net/phy/mdio-mux-bcm-iproc.c new file +4 -0
+static int start_miim_ops(void __iomem *base,
+			  u16 phyid, u32 reg, u16 val, u32 op) {
+	int ret;
+	u32 param;

Likewise.

Sure. I'll take care of this in next patch for all places.

Quoted 6 lines

drivers/net/phy/mdio-mux-bcm-iproc.c line 118

Quoted 4 lines
drivers/net/phy/mdio-mux-bcm-iproc.c new file +4 -0
+static int iproc_mdiomux_read(struct mii_bus *bus, int phyid, int
+reg) {
+	int ret;
+	struct iproc_mdiomux_desc *md = bus->priv;

Likewise.

Sure. I'll take care of this in next patch for all places.

Regards,
Pramod

#9 lore raw

RE: [PATCH v2 3/7] binding: mdio-mux: Add DT binding doc for Broadcom MDIO bus mutiplexer

In reply to Rob Herring

Hi Rob,

Quoted 5 lines

-----Original Message-----
From: Rob Herring [mailto:robh at kernel.org]
Sent: 03 June 2016 07:13
To: Pramod Kumar
Cc: Pawel Moll; Mark Rutland; Ian Campbell; Kumar Gala; Catalin Marinas;

Will

Quoted 1 line

Deacon; Kishon Vijay Abraham I; David S. Miller;

devicetree at vger.kernel.org;

Quoted 16 lines

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
Subject: Re: [PATCH v2 3/7] binding: mdio-mux: Add DT binding doc for Broadcom MDIO bus mutiplexer

Quoted 5 lines · Pramod Kumar

Add DT binding doc for Broadcom MDIO bus mutiplexer driver.

---
 .../bindings/net/brcm,mdio-mux-iproc.txt           | 60

++++++++++++++++++++++

Quoted 4 lines
 1 file changed, 60 insertions(+)
 create mode 100644

Documentation/devicetree/bindings/net/brcm,mdio-mux-iproc.txt

Quoted 9 lines

Documentation/devicetree/bindings/net/brcm,mdio-mux-iproc.txt line 1

Quoted 9 lines

diff --git a/Documentation/devicetree/bindings/net/brcm,mdio-mux-iproc.txt b/Documentation/devicetree/bindings/net/brcm,mdio-mux-iproc.txt new file mode 100644
index 0000000..f270b41

Documentation/devicetree/bindings/net/brcm,mdio-mux-iproc.txt new file +1 -0
@@ -0,0 +1,60 @@
+Properties for an MDIO bus mutiplexer found in Broadcom iProc based

SoCs.

Quoted 7 lines

Documentation/devicetree/bindings/net/brcm,mdio-mux-iproc.txt line 6

Quoted 5 lines
Documentation/devicetree/bindings/net/brcm,mdio-mux-iproc.txt new file +5 -0
+
+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 need to select these two

s/Child/child/

Sure. Will ensure this.

Quoted 1 line

s/need/needs/

Sure. Will ensure this.

Quoted 1 line

Documentation/devicetree/bindings/net/brcm,mdio-mux-iproc.txt line 7

Quoted 1 line
Documentation/devicetree/bindings/net/brcm,mdio-mux-iproc.txt new file +1 -0
+properties as well to generate desired MDIO trascation on appropriate

bus.

Quoted 2 lines

Documentation/devicetree/bindings/net/brcm,mdio-mux-iproc.txt line 9

Quoted 2 lines
Documentation/devicetree/bindings/net/brcm,mdio-mux-iproc.txt new file +2 -0
+
+Required properties in addition to the generic multiplexer

properties:

Quoted 6 lines

Documentation/devicetree/bindings/net/brcm,mdio-mux-iproc.txt line 11

Quoted 3 lines
Documentation/devicetree/bindings/net/brcm,mdio-mux-iproc.txt new file +3 -0
+
+MDIO multiplexer node:
+- complatible: brcm,mdio-mux-iproc.

typo

Fixed.

Quoted 9 lines

Documentation/devicetree/bindings/net/brcm,mdio-mux-iproc.txt line 18

Quoted 6 lines
Documentation/devicetree/bindings/net/brcm,mdio-mux-iproc.txt new file +6 -0
+
+Every non-ethernet PHY requires a compatible so that it could be
+probed based on this compatible string.
+
+Additional information regarding generic multiplexer properties could
+be found

s/could/can/

Replaced.

Quoted 9 lines

Documentation/devicetree/bindings/net/brcm,mdio-mux-iproc.txt

Quoted 5 lines
Documentation/devicetree/bindings/net/brcm,mdio-mux-iproc.txt new file +5 -0
+at- Documentation/devicetree/bindings/net/mdio-mux.txt
+
+
+for example:
+		mdio_mux_iproc: mdio_mux_iproc at 6602023c {

No '_' in node names.

mdio-mux at ...

Yes. Will take care of this.

Quoted 35 lines
Quoted 35 lines
Documentation/devicetree/bindings/net/brcm,mdio-mux-iproc.txt new file +34 -0
+			compatible = "brcm,mdio-mux-iproc";
+			reg = <0x6602023c 0x14>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+			mdio-integrated-mux;
+
+			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>;
+
Quoted 8 lines
Quoted 8 lines
Documentation/devicetree/bindings/net/brcm,mdio-mux-iproc.txt new file +5 -1
+				gphy0: eth-phy at 10 {
+					reg = <0x10>;
+				};
+			};
+		};
--

1.9.1

Regards,
Pramod