linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/4] USB support for Broadcom NSP SoC
@ 2017-01-17 16:14 Yendapally Reddy Dhananjaya Reddy
  2017-01-17 16:14 ` [PATCH v2 1/4] dt-bindings: phy: Add documentation for NSP USB3 PHY Yendapally Reddy Dhananjaya Reddy
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: Yendapally Reddy Dhananjaya Reddy @ 2017-01-17 16:14 UTC (permalink / raw)
  To: Rob Herring, Mark Rutland, Russell King, Ray Jui, Scott Branden,
	Jon Mason, Florian Fainelli, Kishon Vijay Abraham I
  Cc: bcm-kernel-feedback-list, devicetree, linux-kernel,
	linux-arm-kernel, netdev, Yendapally Reddy Dhananjaya Reddy

This patch set contains the usb support for Broadcom NSP SoC. The
usb3 phy is internal to the SoC and is accessed through mdio interface.
The mdio interface can be used to access either internal usb3 phy or
external ethernet phy using a multiplexer.

The first patch provides the documentation details for usb3 phy. The
second patch provides the changes to the mdio bus driver. The third
patch provides the phy driver and fourth patch provides the enable
method for usb.

This patch series has been tested on NSP bcm958625HR board.
This patch series is based on v4.10.0-rc3 and is available from
github-repo: https://github.com/Broadcom/cygnus-linux.git
branch:nsp-usb-v2

Changes in v2:
* Remove separate nsp mux driver as suggested by Andrew Lunn
* Addressed comments from Scott and Rob

Yendapally Reddy Dhananjaya Reddy (4):
  dt-bindings: phy: Add documentation for NSP USB3 PHY
  net: phy: Initialize mdio clock at probe function
  phy: Add USB3 PHY support for Broadcom NSP SoC
  arm: dts: nsp: Add USB nodes to device tree

 .../devicetree/bindings/phy/brcm,nsp-usb3-phy.txt  |  39 +++++
 arch/arm/boot/dts/bcm-nsp.dtsi                     |  56 +++++++
 arch/arm/boot/dts/bcm958625k.dts                   |  16 ++
 drivers/net/phy/mdio-bcm-iproc.c                   |   6 +-
 drivers/phy/Kconfig                                |   8 +
 drivers/phy/Makefile                               |   1 +
 drivers/phy/phy-bcm-nsp-usb3.c                     | 176 +++++++++++++++++++++
 7 files changed, 298 insertions(+), 4 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/phy/brcm,nsp-usb3-phy.txt
 create mode 100644 drivers/phy/phy-bcm-nsp-usb3.c

-- 
2.1.0

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v2 1/4] dt-bindings: phy: Add documentation for NSP USB3 PHY
  2017-01-17 16:14 [PATCH v2 0/4] USB support for Broadcom NSP SoC Yendapally Reddy Dhananjaya Reddy
@ 2017-01-17 16:14 ` Yendapally Reddy Dhananjaya Reddy
  2017-01-19 19:26   ` Rob Herring
  2017-01-17 16:14 ` [PATCH v2 2/4] net: phy: Initialize mdio clock at probe function Yendapally Reddy Dhananjaya Reddy
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 13+ messages in thread
From: Yendapally Reddy Dhananjaya Reddy @ 2017-01-17 16:14 UTC (permalink / raw)
  To: Rob Herring, Mark Rutland, Russell King, Ray Jui, Scott Branden,
	Jon Mason, Florian Fainelli, Kishon Vijay Abraham I
  Cc: bcm-kernel-feedback-list, devicetree, linux-kernel,
	linux-arm-kernel, netdev, Yendapally Reddy Dhananjaya Reddy

Add documentation for USB3 PHY available in Northstar plus SoC

Signed-off-by: Yendapally Reddy Dhananjaya Reddy <yendapally.reddy@broadcom.com>
---
 .../devicetree/bindings/phy/brcm,nsp-usb3-phy.txt  | 39 ++++++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/brcm,nsp-usb3-phy.txt

diff --git a/Documentation/devicetree/bindings/phy/brcm,nsp-usb3-phy.txt b/Documentation/devicetree/bindings/phy/brcm,nsp-usb3-phy.txt
new file mode 100644
index 0000000..e68ae5d
--- /dev/null
+++ b/Documentation/devicetree/bindings/phy/brcm,nsp-usb3-phy.txt
@@ -0,0 +1,39 @@
+Broadcom USB3 phy binding for northstar plus SoC
+The USB3 phy is internal to the SoC and is accessed using mdio interface.
+
+Required mdio bus properties:
+- reg: Should be 0x0 for SoC internal USB3 phy
+- #address-cells: must be 1
+- #size-cells: must be 0
+
+Required USB3 PHY properties:
+- compatible: should be "brcm,nsp-usb3-phy"
+- reg: USB3 Phy address on SoC internal MDIO bus and it should be 0x10.
+- usb3-ctrl-syscon: handler of syscon node defining physical address
+  of usb3 control register.
+- #phy-cells: must be 0
+
+Required usb3 control properties:
+- compatible: should be "brcm,nsp-usb3-ctrl"
+- reg: offset and length of the control registers
+
+Example:
+
+	mdio@0 {
+		reg = <0x0>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		usb3_phy: usb-phy@10 {
+			compatible = "brcm,nsp-usb3-phy";
+			reg = <0x10>;
+			usb3-ctrl-syscon = <&usb3_ctrl>;
+			#phy-cells = <0>;
+			status = "disabled";
+		};
+	};
+
+	usb3_ctrl: syscon@104408 {
+		compatible = "brcm,nsp-usb3-ctrl", "syscon";
+		reg = <0x104408 0x3fc>;
+	};
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 2/4] net: phy: Initialize mdio clock at probe function
  2017-01-17 16:14 [PATCH v2 0/4] USB support for Broadcom NSP SoC Yendapally Reddy Dhananjaya Reddy
  2017-01-17 16:14 ` [PATCH v2 1/4] dt-bindings: phy: Add documentation for NSP USB3 PHY Yendapally Reddy Dhananjaya Reddy
@ 2017-01-17 16:14 ` Yendapally Reddy Dhananjaya Reddy
  2017-01-19 19:26   ` Florian Fainelli
  2017-02-01 22:08   ` Florian Fainelli
  2017-01-17 16:14 ` [PATCH v2 3/4] phy: Add USB3 PHY support for Broadcom NSP SoC Yendapally Reddy Dhananjaya Reddy
                   ` (2 subsequent siblings)
  4 siblings, 2 replies; 13+ messages in thread
From: Yendapally Reddy Dhananjaya Reddy @ 2017-01-17 16:14 UTC (permalink / raw)
  To: Rob Herring, Mark Rutland, Russell King, Ray Jui, Scott Branden,
	Jon Mason, Florian Fainelli, Kishon Vijay Abraham I
  Cc: bcm-kernel-feedback-list, devicetree, linux-kernel,
	linux-arm-kernel, netdev, Yendapally Reddy Dhananjaya Reddy

Initialize mdio clock divisor in probe function. The ext bus
bit available in the same register will be used by mdio mux
to enable external mdio.

Signed-off-by: Yendapally Reddy Dhananjaya Reddy <yendapally.reddy@broadcom.com>
---
 drivers/net/phy/mdio-bcm-iproc.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/phy/mdio-bcm-iproc.c b/drivers/net/phy/mdio-bcm-iproc.c
index c0b4e65..46fe1ae 100644
--- a/drivers/net/phy/mdio-bcm-iproc.c
+++ b/drivers/net/phy/mdio-bcm-iproc.c
@@ -81,8 +81,6 @@ static int iproc_mdio_read(struct mii_bus *bus, int phy_id, int reg)
 	if (rc)
 		return rc;
 
-	iproc_mdio_config_clk(priv->base);
-
 	/* Prepare the read operation */
 	cmd = (MII_DATA_TA_VAL << MII_DATA_TA_SHIFT) |
 		(reg << MII_DATA_RA_SHIFT) |
@@ -112,8 +110,6 @@ static int iproc_mdio_write(struct mii_bus *bus, int phy_id,
 	if (rc)
 		return rc;
 
-	iproc_mdio_config_clk(priv->base);
-
 	/* Prepare the write operation */
 	cmd = (MII_DATA_TA_VAL << MII_DATA_TA_SHIFT) |
 		(reg << MII_DATA_RA_SHIFT) |
@@ -163,6 +159,8 @@ static int iproc_mdio_probe(struct platform_device *pdev)
 	bus->read = iproc_mdio_read;
 	bus->write = iproc_mdio_write;
 
+	iproc_mdio_config_clk(priv->base);
+
 	rc = of_mdiobus_register(bus, pdev->dev.of_node);
 	if (rc) {
 		dev_err(&pdev->dev, "MDIO bus registration failed\n");
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 3/4] phy: Add USB3 PHY support for Broadcom NSP SoC
  2017-01-17 16:14 [PATCH v2 0/4] USB support for Broadcom NSP SoC Yendapally Reddy Dhananjaya Reddy
  2017-01-17 16:14 ` [PATCH v2 1/4] dt-bindings: phy: Add documentation for NSP USB3 PHY Yendapally Reddy Dhananjaya Reddy
  2017-01-17 16:14 ` [PATCH v2 2/4] net: phy: Initialize mdio clock at probe function Yendapally Reddy Dhananjaya Reddy
@ 2017-01-17 16:14 ` Yendapally Reddy Dhananjaya Reddy
  2017-02-02  6:48   ` Rafał Miłecki
  2017-01-17 16:14 ` [PATCH v2 4/4] arm: dts: nsp: Add USB nodes to device tree Yendapally Reddy Dhananjaya Reddy
  2017-01-26 15:34 ` [PATCH v2 0/4] USB support for Broadcom NSP SoC Kishon Vijay Abraham I
  4 siblings, 1 reply; 13+ messages in thread
From: Yendapally Reddy Dhananjaya Reddy @ 2017-01-17 16:14 UTC (permalink / raw)
  To: Rob Herring, Mark Rutland, Russell King, Ray Jui, Scott Branden,
	Jon Mason, Florian Fainelli, Kishon Vijay Abraham I
  Cc: bcm-kernel-feedback-list, devicetree, linux-kernel,
	linux-arm-kernel, netdev, Yendapally Reddy Dhananjaya Reddy

This patch adds support for Broadcom NSP USB3 PHY

Signed-off-by: Yendapally Reddy Dhananjaya Reddy <yendapally.reddy@broadcom.com>
---
 drivers/phy/Kconfig            |   8 ++
 drivers/phy/Makefile           |   1 +
 drivers/phy/phy-bcm-nsp-usb3.c | 176 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 185 insertions(+)
 create mode 100644 drivers/phy/phy-bcm-nsp-usb3.c

diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
index e8eb7f2..f95aa0d 100644
--- a/drivers/phy/Kconfig
+++ b/drivers/phy/Kconfig
@@ -486,4 +486,12 @@ config PHY_MESON8B_USB2
 	  and GXBB SoCs.
 	  If unsure, say N.
 
+config PHY_NSP_USB3
+	tristate "Broadcom NorthStar plus USB3 PHY driver"
+	depends on OF && (ARCH_BCM_NSP || COMPILE_TEST)
+	select GENERIC_PHY
+	default ARCH_BCM_NSP
+	help
+	  Enable this to support the Broadcom Northstar plus USB3 PHY.
+	  If unsure, say N.
 endmenu
diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile
index 65eb2f4..a96acd8 100644
--- a/drivers/phy/Makefile
+++ b/drivers/phy/Makefile
@@ -59,3 +59,4 @@ 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
 obj-$(CONFIG_PHY_MESON8B_USB2)		+= phy-meson8b-usb2.o
+obj-$(CONFIG_PHY_NSP_USB3)		+= phy-bcm-nsp-usb3.o
diff --git a/drivers/phy/phy-bcm-nsp-usb3.c b/drivers/phy/phy-bcm-nsp-usb3.c
new file mode 100644
index 0000000..0033382
--- /dev/null
+++ b/drivers/phy/phy-bcm-nsp-usb3.c
@@ -0,0 +1,176 @@
+/*
+ * Copyright (C) 2016 Broadcom
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation version 2.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ * kind, whether express or implied; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/delay.h>
+#include <linux/io.h>
+#include <linux/kernel.h>
+#include <linux/mfd/syscon.h>
+#include <linux/mdio.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/phy/phy.h>
+#include <linux/regmap.h>
+
+#define NSP_USB3_RST_CTRL_OFFSET	0x3f8
+
+/* mdio reg access */
+#define NSP_USB3_PHY_BASE_ADDR_REG	0x1f
+
+#define NSP_USB3_PHY_PLL30_BLOCK	0x8000
+#define NSP_USB3_PLL_CONTROL		0x01
+#define NSP_USB3_PLLA_CONTROL0		0x0a
+#define NSP_USB3_PLLA_CONTROL1		0x0b
+
+#define NSP_USB3_PHY_TX_PMD_BLOCK	0x8040
+#define NSP_USB3_TX_PMD_CONTROL1	0x01
+
+#define NSP_USB3_PHY_PIPE_BLOCK		0x8060
+#define NSP_USB3_LFPS_CMP		0x02
+#define NSP_USB3_LFPS_DEGLITCH		0x03
+
+struct nsp_usb3_phy {
+	struct regmap *usb3_ctrl;
+	struct phy *phy;
+	struct mdio_device *mdiodev;
+};
+
+static int nsp_usb3_phy_init(struct phy *phy)
+{
+	struct nsp_usb3_phy *iphy = phy_get_drvdata(phy);
+	struct mii_bus *bus = iphy->mdiodev->bus;
+	int addr = iphy->mdiodev->addr;
+	u32 data;
+	int rc;
+
+	rc = regmap_read(iphy->usb3_ctrl, 0, &data);
+	if (rc)
+		return rc;
+	data |= 1;
+	rc = regmap_write(iphy->usb3_ctrl, 0, data);
+	if (rc)
+		return rc;
+
+	rc = regmap_write(iphy->usb3_ctrl, NSP_USB3_RST_CTRL_OFFSET, 1);
+	if (rc)
+		return rc;
+
+	rc = mdiobus_write(bus, addr, NSP_USB3_PHY_BASE_ADDR_REG,
+			   NSP_USB3_PHY_PLL30_BLOCK);
+	if (rc)
+		return rc;
+
+	rc = mdiobus_write(bus, addr, NSP_USB3_PLL_CONTROL, 0x1000);
+	if (rc)
+		return rc;
+
+	rc = mdiobus_write(bus, addr, NSP_USB3_PLLA_CONTROL0, 0x6400);
+	if (rc)
+		return rc;
+
+	rc = mdiobus_write(bus, addr, NSP_USB3_PLLA_CONTROL1, 0xc000);
+	if (rc)
+		return rc;
+
+	rc = mdiobus_write(bus, addr, NSP_USB3_PLLA_CONTROL1, 0x8000);
+	if (rc)
+		return rc;
+
+	rc = regmap_write(iphy->usb3_ctrl, NSP_USB3_RST_CTRL_OFFSET, 0);
+	if (rc)
+		return rc;
+
+	rc = mdiobus_write(bus, addr, NSP_USB3_PLL_CONTROL, 0x9000);
+	if (rc)
+		return rc;
+
+	rc = mdiobus_write(bus, addr, NSP_USB3_PHY_BASE_ADDR_REG,
+			   NSP_USB3_PHY_PIPE_BLOCK);
+	if (rc)
+		return rc;
+
+	rc = mdiobus_write(bus, addr, NSP_USB3_LFPS_CMP, 0xf30d);
+	if (rc)
+		return rc;
+
+	rc = mdiobus_write(bus, addr, NSP_USB3_LFPS_DEGLITCH, 0x6302);
+	if (rc)
+		return rc;
+
+	rc = mdiobus_write(bus, addr, NSP_USB3_PHY_BASE_ADDR_REG,
+			   NSP_USB3_PHY_TX_PMD_BLOCK);
+	if (rc)
+		return rc;
+
+	rc = mdiobus_write(bus, addr, NSP_USB3_TX_PMD_CONTROL1, 0x1003);
+
+	return rc;
+}
+
+static struct phy_ops nsp_usb3_phy_ops = {
+	.init = nsp_usb3_phy_init,
+};
+
+static int nsp_usb3_phy_probe(struct mdio_device *mdiodev)
+{
+	struct device *dev = &mdiodev->dev;
+	struct phy_provider *provider;
+	struct nsp_usb3_phy *iphy;
+
+	iphy = devm_kzalloc(dev, sizeof(*iphy), GFP_KERNEL);
+	if (!iphy)
+		return -ENOMEM;
+	iphy->mdiodev = mdiodev;
+
+	iphy->usb3_ctrl = syscon_regmap_lookup_by_phandle(dev->of_node,
+						 "usb3-ctrl-syscon");
+	if (IS_ERR(iphy->usb3_ctrl))
+		return PTR_ERR(iphy->usb3_ctrl);
+
+	iphy->phy = devm_phy_create(dev, dev->of_node, &nsp_usb3_phy_ops);
+	if (IS_ERR(iphy->phy)) {
+		dev_err(dev, "failed to create PHY\n");
+		return PTR_ERR(iphy->phy);
+	}
+
+	phy_set_drvdata(iphy->phy, iphy);
+
+	provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
+	if (IS_ERR(provider)) {
+		dev_err(dev, "could not register PHY provider\n");
+		return PTR_ERR(provider);
+	}
+
+	return 0;
+}
+
+static const struct of_device_id nsp_usb3_phy_of_match[] = {
+	{.compatible = "brcm,nsp-usb3-phy",},
+	{ /* sentinel */ }
+};
+
+static struct mdio_driver nsp_usb3_phy_driver = {
+	.mdiodrv = {
+		.driver = {
+			.name = "nsp-usb3-phy",
+			.of_match_table = nsp_usb3_phy_of_match,
+		},
+	},
+	.probe = nsp_usb3_phy_probe,
+};
+
+mdio_module_driver(nsp_usb3_phy_driver);
+
+MODULE_DESCRIPTION("Broadcom NSP USB3 PHY driver");
+MODULE_LICENSE("GPL v2");
+MODULE_AUTHOR("Yendapally Reddy Dhananjaya Reddy <yendapally.reddy@broadcom.com");
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 4/4] arm: dts: nsp: Add USB nodes to device tree
  2017-01-17 16:14 [PATCH v2 0/4] USB support for Broadcom NSP SoC Yendapally Reddy Dhananjaya Reddy
                   ` (2 preceding siblings ...)
  2017-01-17 16:14 ` [PATCH v2 3/4] phy: Add USB3 PHY support for Broadcom NSP SoC Yendapally Reddy Dhananjaya Reddy
@ 2017-01-17 16:14 ` Yendapally Reddy Dhananjaya Reddy
  2017-01-26 15:34 ` [PATCH v2 0/4] USB support for Broadcom NSP SoC Kishon Vijay Abraham I
  4 siblings, 0 replies; 13+ messages in thread
From: Yendapally Reddy Dhananjaya Reddy @ 2017-01-17 16:14 UTC (permalink / raw)
  To: Rob Herring, Mark Rutland, Russell King, Ray Jui, Scott Branden,
	Jon Mason, Florian Fainelli, Kishon Vijay Abraham I
  Cc: bcm-kernel-feedback-list, devicetree, linux-kernel,
	linux-arm-kernel, netdev, Yendapally Reddy Dhananjaya Reddy

Add USB nodes to the Northstar plus device tree file

Signed-off-by: Yendapally Reddy Dhananjaya Reddy <yendapally.reddy@broadcom.com>
---
 arch/arm/boot/dts/bcm-nsp.dtsi   | 56 ++++++++++++++++++++++++++++++++++++++++
 arch/arm/boot/dts/bcm958625k.dts | 16 ++++++++++++
 2 files changed, 72 insertions(+)

diff --git a/arch/arm/boot/dts/bcm-nsp.dtsi b/arch/arm/boot/dts/bcm-nsp.dtsi
index b6142bd..94b3231 100644
--- a/arch/arm/boot/dts/bcm-nsp.dtsi
+++ b/arch/arm/boot/dts/bcm-nsp.dtsi
@@ -259,6 +259,34 @@
 			status = "disabled";
 		};
 
+		xhci: usb@29000 {
+			compatible = "generic-xhci";
+			reg = <0x29000 0x1000>;
+			interrupts = <GIC_SPI 80 IRQ_TYPE_LEVEL_HIGH>;
+			phys = <&usb3_phy>;
+			phy-names = "usb";
+			status = "disabled";
+		};
+
+		ehci0: usb@2a000 {
+			compatible = "generic-ehci";
+			reg = <0x2a000 0x100>;
+			interrupts = <GIC_SPI 79 IRQ_TYPE_LEVEL_HIGH>;
+			status = "disabled";
+		};
+
+		ohci0: usb@2b000 {
+			compatible = "generic-ohci";
+			reg = <0x2b000 0x100>;
+			interrupts = <GIC_SPI 79 IRQ_TYPE_LEVEL_HIGH>;
+			status = "disabled";
+		};
+
+		mdio: mdio@32000 {
+			compatible = "brcm,iproc-mdio";
+			reg = <0x32000 0x8>;
+		};
+
 		rng: rng@33000 {
 			compatible = "brcm,bcm-nsp-rng";
 			reg = <0x33000 0x14>;
@@ -358,6 +386,29 @@
 					     "sata2";
 		};
 
+		mdio-mux {
+			compatible = "mdio-mux-mmioreg";
+			mdio-parent-bus = <&mdio>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+			reg = <0x32000 0x4>;
+			mux-mask = <0x200>;
+
+			mdio@0 {
+				reg = <0x00>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				usb3_phy: usb-phy@10 {
+					compatible = "brcm,nsp-usb3-phy";
+					reg = <0x10>;
+					usb3-ctrl-syscon = <&usb3_ctrl>;
+					#phy-cells = <0>;
+					status = "disabled";
+				};
+			};
+		};
+
 		pinctrl: pinctrl@3f1c0 {
 			compatible = "brcm,nsp-pinmux";
 			reg = <0x3f1c0 0x04>,
@@ -406,6 +457,11 @@
 				phy-names = "sata-phy";
 			};
 		};
+
+		usb3_ctrl: syscon@104408 {
+			compatible = "brcm,nsp-usb3-ctrl", "syscon";
+			reg = <0x104408 0x3fc>;
+		};
 	};
 
 	pcie0: pcie@18012000 {
diff --git a/arch/arm/boot/dts/bcm958625k.dts b/arch/arm/boot/dts/bcm958625k.dts
index 59d96fb..1da22dc 100644
--- a/arch/arm/boot/dts/bcm958625k.dts
+++ b/arch/arm/boot/dts/bcm958625k.dts
@@ -53,6 +53,22 @@
 	};
 };
 
+&ehci0 {
+	status = "okay";
+};
+
+&ohci0 {
+	status = "okay";
+};
+
+&usb3_phy {
+	status = "okay";
+};
+
+&xhci {
+	status = "okay";
+};
+
 &uart0 {
 	status = "okay";
 };
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 1/4] dt-bindings: phy: Add documentation for NSP USB3 PHY
  2017-01-17 16:14 ` [PATCH v2 1/4] dt-bindings: phy: Add documentation for NSP USB3 PHY Yendapally Reddy Dhananjaya Reddy
@ 2017-01-19 19:26   ` Rob Herring
  0 siblings, 0 replies; 13+ messages in thread
From: Rob Herring @ 2017-01-19 19:26 UTC (permalink / raw)
  To: Yendapally Reddy Dhananjaya Reddy
  Cc: Mark Rutland, Russell King, Ray Jui, Scott Branden, Jon Mason,
	Florian Fainelli, Kishon Vijay Abraham I,
	bcm-kernel-feedback-list, devicetree, linux-kernel,
	linux-arm-kernel, netdev

On Tue, Jan 17, 2017 at 11:14:27AM -0500, Yendapally Reddy Dhananjaya Reddy wrote:
> Add documentation for USB3 PHY available in Northstar plus SoC
> 
> Signed-off-by: Yendapally Reddy Dhananjaya Reddy <yendapally.reddy@broadcom.com>
> ---
>  .../devicetree/bindings/phy/brcm,nsp-usb3-phy.txt  | 39 ++++++++++++++++++++++
>  1 file changed, 39 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/phy/brcm,nsp-usb3-phy.txt

Acked-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 2/4] net: phy: Initialize mdio clock at probe function
  2017-01-17 16:14 ` [PATCH v2 2/4] net: phy: Initialize mdio clock at probe function Yendapally Reddy Dhananjaya Reddy
@ 2017-01-19 19:26   ` Florian Fainelli
  2017-02-01 22:08   ` Florian Fainelli
  1 sibling, 0 replies; 13+ messages in thread
From: Florian Fainelli @ 2017-01-19 19:26 UTC (permalink / raw)
  To: Yendapally Reddy Dhananjaya Reddy, Rob Herring, Mark Rutland,
	Russell King, Ray Jui, Scott Branden, Jon Mason,
	Florian Fainelli, Kishon Vijay Abraham I
  Cc: bcm-kernel-feedback-list, devicetree, linux-kernel,
	linux-arm-kernel, netdev

On 01/17/2017 08:14 AM, Yendapally Reddy Dhananjaya Reddy wrote:
> Initialize mdio clock divisor in probe function. The ext bus
> bit available in the same register will be used by mdio mux
> to enable external mdio.
> 
> Signed-off-by: Yendapally Reddy Dhananjaya Reddy <yendapally.reddy@broadcom.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 0/4] USB support for Broadcom NSP SoC
  2017-01-17 16:14 [PATCH v2 0/4] USB support for Broadcom NSP SoC Yendapally Reddy Dhananjaya Reddy
                   ` (3 preceding siblings ...)
  2017-01-17 16:14 ` [PATCH v2 4/4] arm: dts: nsp: Add USB nodes to device tree Yendapally Reddy Dhananjaya Reddy
@ 2017-01-26 15:34 ` Kishon Vijay Abraham I
  2017-01-26 17:27   ` Florian Fainelli
  4 siblings, 1 reply; 13+ messages in thread
From: Kishon Vijay Abraham I @ 2017-01-26 15:34 UTC (permalink / raw)
  To: Yendapally Reddy Dhananjaya Reddy, Rob Herring, Mark Rutland,
	Russell King, Ray Jui, Scott Branden, Jon Mason,
	Florian Fainelli
  Cc: bcm-kernel-feedback-list, devicetree, linux-kernel,
	linux-arm-kernel, netdev



On Tuesday 17 January 2017 09:44 PM, Yendapally Reddy Dhananjaya Reddy wrote:
> This patch set contains the usb support for Broadcom NSP SoC. The
> usb3 phy is internal to the SoC and is accessed through mdio interface.
> The mdio interface can be used to access either internal usb3 phy or
> external ethernet phy using a multiplexer.
> 
> The first patch provides the documentation details for usb3 phy. The
> second patch provides the changes to the mdio bus driver. The third
> patch provides the phy driver and fourth patch provides the enable
> method for usb.

merged the 1st and 4th patch to linux-phy.

Thanks
Kishon

> 
> This patch series has been tested on NSP bcm958625HR board.
> This patch series is based on v4.10.0-rc3 and is available from
> github-repo: https://github.com/Broadcom/cygnus-linux.git
> branch:nsp-usb-v2
> 
> Changes in v2:
> * Remove separate nsp mux driver as suggested by Andrew Lunn
> * Addressed comments from Scott and Rob
> 
> Yendapally Reddy Dhananjaya Reddy (4):
>   dt-bindings: phy: Add documentation for NSP USB3 PHY
>   net: phy: Initialize mdio clock at probe function
>   phy: Add USB3 PHY support for Broadcom NSP SoC
>   arm: dts: nsp: Add USB nodes to device tree
> 
>  .../devicetree/bindings/phy/brcm,nsp-usb3-phy.txt  |  39 +++++
>  arch/arm/boot/dts/bcm-nsp.dtsi                     |  56 +++++++
>  arch/arm/boot/dts/bcm958625k.dts                   |  16 ++
>  drivers/net/phy/mdio-bcm-iproc.c                   |   6 +-
>  drivers/phy/Kconfig                                |   8 +
>  drivers/phy/Makefile                               |   1 +
>  drivers/phy/phy-bcm-nsp-usb3.c                     | 176 +++++++++++++++++++++
>  7 files changed, 298 insertions(+), 4 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/phy/brcm,nsp-usb3-phy.txt
>  create mode 100644 drivers/phy/phy-bcm-nsp-usb3.c
> 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 0/4] USB support for Broadcom NSP SoC
  2017-01-26 15:34 ` [PATCH v2 0/4] USB support for Broadcom NSP SoC Kishon Vijay Abraham I
@ 2017-01-26 17:27   ` Florian Fainelli
  2017-01-27  7:39     ` Kishon Vijay Abraham I
  0 siblings, 1 reply; 13+ messages in thread
From: Florian Fainelli @ 2017-01-26 17:27 UTC (permalink / raw)
  To: Kishon Vijay Abraham I, Yendapally Reddy Dhananjaya Reddy,
	Rob Herring, Mark Rutland, Russell King, Ray Jui, Scott Branden,
	Jon Mason, Florian Fainelli
  Cc: bcm-kernel-feedback-list, devicetree, linux-kernel,
	linux-arm-kernel, netdev

On 01/26/2017 07:34 AM, Kishon Vijay Abraham I wrote:
> 
> 
> On Tuesday 17 January 2017 09:44 PM, Yendapally Reddy Dhananjaya Reddy wrote:
>> This patch set contains the usb support for Broadcom NSP SoC. The
>> usb3 phy is internal to the SoC and is accessed through mdio interface.
>> The mdio interface can be used to access either internal usb3 phy or
>> external ethernet phy using a multiplexer.
>>
>> The first patch provides the documentation details for usb3 phy. The
>> second patch provides the changes to the mdio bus driver. The third
>> patch provides the phy driver and fourth patch provides the enable
>> method for usb.
> 
> merged the 1st and 4th patch to linux-phy.

You mean 1st and 3rd here, right? 4th is a Device Tree change that I
should take, and Patch 2 should be merged by David.

What branch in your tree should we be looking at?

> 
> Thanks
> Kishon
> 
>>
>> This patch series has been tested on NSP bcm958625HR board.
>> This patch series is based on v4.10.0-rc3 and is available from
>> github-repo: https://github.com/Broadcom/cygnus-linux.git
>> branch:nsp-usb-v2
>>
>> Changes in v2:
>> * Remove separate nsp mux driver as suggested by Andrew Lunn
>> * Addressed comments from Scott and Rob
>>
>> Yendapally Reddy Dhananjaya Reddy (4):
>>   dt-bindings: phy: Add documentation for NSP USB3 PHY
>>   net: phy: Initialize mdio clock at probe function
>>   phy: Add USB3 PHY support for Broadcom NSP SoC
>>   arm: dts: nsp: Add USB nodes to device tree
>>
>>  .../devicetree/bindings/phy/brcm,nsp-usb3-phy.txt  |  39 +++++
>>  arch/arm/boot/dts/bcm-nsp.dtsi                     |  56 +++++++
>>  arch/arm/boot/dts/bcm958625k.dts                   |  16 ++
>>  drivers/net/phy/mdio-bcm-iproc.c                   |   6 +-
>>  drivers/phy/Kconfig                                |   8 +
>>  drivers/phy/Makefile                               |   1 +
>>  drivers/phy/phy-bcm-nsp-usb3.c                     | 176 +++++++++++++++++++++
>>  7 files changed, 298 insertions(+), 4 deletions(-)
>>  create mode 100644 Documentation/devicetree/bindings/phy/brcm,nsp-usb3-phy.txt
>>  create mode 100644 drivers/phy/phy-bcm-nsp-usb3.c
>>


-- 
Florian

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 0/4] USB support for Broadcom NSP SoC
  2017-01-26 17:27   ` Florian Fainelli
@ 2017-01-27  7:39     ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 13+ messages in thread
From: Kishon Vijay Abraham I @ 2017-01-27  7:39 UTC (permalink / raw)
  To: Florian Fainelli, Yendapally Reddy Dhananjaya Reddy, Rob Herring,
	Mark Rutland, Russell King, Ray Jui, Scott Branden, Jon Mason
  Cc: bcm-kernel-feedback-list, devicetree, linux-kernel,
	linux-arm-kernel, netdev

Hi,

On Thursday 26 January 2017 10:57 PM, Florian Fainelli wrote:
> On 01/26/2017 07:34 AM, Kishon Vijay Abraham I wrote:
>>
>>
>> On Tuesday 17 January 2017 09:44 PM, Yendapally Reddy Dhananjaya Reddy wrote:
>>> This patch set contains the usb support for Broadcom NSP SoC. The
>>> usb3 phy is internal to the SoC and is accessed through mdio interface.
>>> The mdio interface can be used to access either internal usb3 phy or
>>> external ethernet phy using a multiplexer.
>>>
>>> The first patch provides the documentation details for usb3 phy. The
>>> second patch provides the changes to the mdio bus driver. The third
>>> patch provides the phy driver and fourth patch provides the enable
>>> method for usb.
>>
>> merged the 1st and 4th patch to linux-phy.
> 
> You mean 1st and 3rd here, right? 4th is a Device Tree change that I
> should take, and Patch 2 should be merged by David.

yeah, sorry!
> 
> What branch in your tree should we be looking at?

git://git.kernel.org/pub/scm/linux/kernel/git/kishon/linux-phy.git next

Thanks
Kishon

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 2/4] net: phy: Initialize mdio clock at probe function
  2017-01-17 16:14 ` [PATCH v2 2/4] net: phy: Initialize mdio clock at probe function Yendapally Reddy Dhananjaya Reddy
  2017-01-19 19:26   ` Florian Fainelli
@ 2017-02-01 22:08   ` Florian Fainelli
  1 sibling, 0 replies; 13+ messages in thread
From: Florian Fainelli @ 2017-02-01 22:08 UTC (permalink / raw)
  To: Yendapally Reddy Dhananjaya Reddy, Rob Herring, Mark Rutland,
	Russell King, Ray Jui, Scott Branden, Jon Mason,
	Florian Fainelli, Kishon Vijay Abraham I
  Cc: bcm-kernel-feedback-list, devicetree, linux-kernel,
	linux-arm-kernel, netdev, David Miller

On 01/17/2017 08:14 AM, Yendapally Reddy Dhananjaya Reddy wrote:
> Initialize mdio clock divisor in probe function. The ext bus
> bit available in the same register will be used by mdio mux
> to enable external mdio.
> 
> Signed-off-by: Yendapally Reddy Dhananjaya Reddy <yendapally.reddy@broadcom.com>

David, this patch should go through your tree (but we forgot to CC you),
patch in patchwork is here:

http://patchwork.ozlabs.org/patch/716281/

Thanks!

> ---
>  drivers/net/phy/mdio-bcm-iproc.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/phy/mdio-bcm-iproc.c b/drivers/net/phy/mdio-bcm-iproc.c
> index c0b4e65..46fe1ae 100644
> --- a/drivers/net/phy/mdio-bcm-iproc.c
> +++ b/drivers/net/phy/mdio-bcm-iproc.c
> @@ -81,8 +81,6 @@ static int iproc_mdio_read(struct mii_bus *bus, int phy_id, int reg)
>  	if (rc)
>  		return rc;
>  
> -	iproc_mdio_config_clk(priv->base);
> -
>  	/* Prepare the read operation */
>  	cmd = (MII_DATA_TA_VAL << MII_DATA_TA_SHIFT) |
>  		(reg << MII_DATA_RA_SHIFT) |
> @@ -112,8 +110,6 @@ static int iproc_mdio_write(struct mii_bus *bus, int phy_id,
>  	if (rc)
>  		return rc;
>  
> -	iproc_mdio_config_clk(priv->base);
> -
>  	/* Prepare the write operation */
>  	cmd = (MII_DATA_TA_VAL << MII_DATA_TA_SHIFT) |
>  		(reg << MII_DATA_RA_SHIFT) |
> @@ -163,6 +159,8 @@ static int iproc_mdio_probe(struct platform_device *pdev)
>  	bus->read = iproc_mdio_read;
>  	bus->write = iproc_mdio_write;
>  
> +	iproc_mdio_config_clk(priv->base);
> +
>  	rc = of_mdiobus_register(bus, pdev->dev.of_node);
>  	if (rc) {
>  		dev_err(&pdev->dev, "MDIO bus registration failed\n");
> 


-- 
Florian

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 3/4] phy: Add USB3 PHY support for Broadcom NSP SoC
  2017-01-17 16:14 ` [PATCH v2 3/4] phy: Add USB3 PHY support for Broadcom NSP SoC Yendapally Reddy Dhananjaya Reddy
@ 2017-02-02  6:48   ` Rafał Miłecki
  2017-02-03 16:05     ` Jon Mason
  0 siblings, 1 reply; 13+ messages in thread
From: Rafał Miłecki @ 2017-02-02  6:48 UTC (permalink / raw)
  To: Yendapally Reddy Dhananjaya Reddy, Kishon Vijay Abraham I
  Cc: Rob Herring, Mark Rutland, Russell King, Ray Jui, Scott Branden,
	Jon Mason, Florian Fainelli, bcm-kernel-feedback-list,
	devicetree, netdev, linux-kernel, linux-arm-kernel

[Resending with fixed/complete Cc-s]

On Tue, 17 Jan 2017 11:14:29 -0500, Yendapally Reddy Dhananjaya Reddy <yendapally.reddy@broadcom.com> wrote:> This patch adds support for Broadcom NSP USB3 PHY
 >
 > Signed-off-by: Yendapally Reddy Dhananjaya Reddy <yendapally.reddy@broadcom.com>

Seriously?! I really dislike what you did there.

NACK.

You are aware this block is common for both: Northstar and Northstar Plus and
we already have phy-bcm-ns-usb3.c! In fact Jon told me to rewrite my initial
driver to make is possible to reuse it on NSP and I did that!

This is old comment from Jon:

In 30 March 2016 at 23:31, Jon Mason <jon.mason@broadcom.com> wrote:
 > On Mon, Mar 28, 2016 at 9:46 PM, Florian Fainelli <f.fainelli@gmail.com>
 > wrote:
 >>
 >> CC: bcm-kernel-feedback-list, Jon
 >
 >
 > This is a common IP block with NSP.  I believe with some minor changes it
 > can support both.  Please allow me 1-2 days to look at these in more detail
 > and see if I can get these patches working on NSP.

Please start using existing code instead of inventing everything from the
scratch internally at Broadcom. You did the same thing with (Q)SPI driver.


This driver duplicates phy-bcm-ns-usb3.c and should have not been accepted. I
strongly suggest *reverting* it and adjusting existing driver if needed.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 3/4] phy: Add USB3 PHY support for Broadcom NSP SoC
  2017-02-02  6:48   ` Rafał Miłecki
@ 2017-02-03 16:05     ` Jon Mason
  0 siblings, 0 replies; 13+ messages in thread
From: Jon Mason @ 2017-02-03 16:05 UTC (permalink / raw)
  To: Rafał Miłecki
  Cc: Yendapally Reddy Dhananjaya Reddy, Kishon Vijay Abraham I,
	Rob Herring, Mark Rutland, Russell King, Ray Jui, Scott Branden,
	Jon Mason, Florian Fainelli, BCM Kernel Feedback,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Network Development, open list, linux-arm-kernel

On Thu, Feb 2, 2017 at 1:48 AM, Rafał Miłecki <zajec5@gmail.com> wrote:
> [Resending with fixed/complete Cc-s]
>
> On Tue, 17 Jan 2017 11:14:29 -0500, Yendapally Reddy Dhananjaya Reddy
> <yendapally.reddy@broadcom.com> wrote:> This patch adds support for Broadcom
> NSP USB3 PHY
>>
>> Signed-off-by: Yendapally Reddy Dhananjaya Reddy
>> <yendapally.reddy@broadcom.com>
>
> Seriously?! I really dislike what you did there.
>
> NACK.
>
> You are aware this block is common for both: Northstar and Northstar Plus
> and
> we already have phy-bcm-ns-usb3.c! In fact Jon told me to rewrite my initial
> driver to make is possible to reuse it on NSP and I did that!
>
> This is old comment from Jon:
>
> In 30 March 2016 at 23:31, Jon Mason <jon.mason@broadcom.com> wrote:
>> On Mon, Mar 28, 2016 at 9:46 PM, Florian Fainelli <f.fainelli@gmail.com>
>> wrote:
>>>
>>> CC: bcm-kernel-feedback-list, Jon
>>
>>
>> This is a common IP block with NSP.  I believe with some minor changes it
>> can support both.  Please allow me 1-2 days to look at these in more
>> detail
>> and see if I can get these patches working on NSP.
>
> Please start using existing code instead of inventing everything from the
> scratch internally at Broadcom. You did the same thing with (Q)SPI driver.
>
>
> This driver duplicates phy-bcm-ns-usb3.c and should have not been accepted.
> I
> strongly suggest *reverting* it and adjusting existing driver if needed.

I agree that we need to be heading in the same direction with 4708/9
(Northstar) and Northstar+.  Duplication of work is a sin (and if not,
it should be).  So, I apologize for this and let's move forward
together.

Regarding the SPI duplication of drivers, the QSPI driver covers a
much broader array of SoCs across Broadcom, and was a joint effort
between multiple teams internally.  To resolve this, I believe the
best way forward is to add QSPI to the 4708/9 device trees, and remove
the BSPI driver from Linux.  I'll have someone work on this internally
and get it out ASAP.

Regarding the duplication of function for the USB PHYs, the MDIO bus
for our PHYs is the way we would like to support everything going
forward.  This MDIO bus supports more than just USB.  So, it will be
much more extensible in the future.  Since there is already a USB PHY
driver for NS, I would recommend that we modify that driver to have
MDIO support.  If we are in agreement, Kishon can drop the current
series in his tree and Dhananjay will abandon the unaccepted ones.

Thanks,
Jon

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2017-02-03 16:05 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-17 16:14 [PATCH v2 0/4] USB support for Broadcom NSP SoC Yendapally Reddy Dhananjaya Reddy
2017-01-17 16:14 ` [PATCH v2 1/4] dt-bindings: phy: Add documentation for NSP USB3 PHY Yendapally Reddy Dhananjaya Reddy
2017-01-19 19:26   ` Rob Herring
2017-01-17 16:14 ` [PATCH v2 2/4] net: phy: Initialize mdio clock at probe function Yendapally Reddy Dhananjaya Reddy
2017-01-19 19:26   ` Florian Fainelli
2017-02-01 22:08   ` Florian Fainelli
2017-01-17 16:14 ` [PATCH v2 3/4] phy: Add USB3 PHY support for Broadcom NSP SoC Yendapally Reddy Dhananjaya Reddy
2017-02-02  6:48   ` Rafał Miłecki
2017-02-03 16:05     ` Jon Mason
2017-01-17 16:14 ` [PATCH v2 4/4] arm: dts: nsp: Add USB nodes to device tree Yendapally Reddy Dhananjaya Reddy
2017-01-26 15:34 ` [PATCH v2 0/4] USB support for Broadcom NSP SoC Kishon Vijay Abraham I
2017-01-26 17:27   ` Florian Fainelli
2017-01-27  7:39     ` Kishon Vijay Abraham I

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).