Skip to contentSkip to conversation

USB Device Controller support for BCM281xx

PATCH Superseded Matt Porter 3 participants 15 messages Dec 17, 2013 – Dec 19, 2013

Subsystems (6)

v7 of 9 Superseded Latest is v9 →

lore
Share & tools
lore
#0 lore raw

v7 cover USB Device Controller support for BCM281xx

Changes since v6:
- Drop dependency on the Exynos generic phy conversion series
- Bring back original patch that converts s3c-hsotg to use the generic phy layer with a fall back to the old usb style phy support.

Changes since v5:
- tweak s3c-hsotg Kconfig help message to be more generic

Changes since v4:
- phy_set/get_bus_width now use an int for bus_width

Changes since v3:
- Rebased on 3.13-rc3
- Move struct phy bus_width attribute back into struct phy_attrs
- Fix build issue on !GENERIC_PHY
- Update dwc2 binding to reflect optional phy properties
- Rename bcm-kona-phy.txt binding to bcm-phy.txt
- Reorder bcm kona phy includes and use bitops
- phy-names changed to "usb2-phy" to match updated s3c-hsotg generic phy-ification series

Changes since v2:
- Rebased on 3.13-rc1
- Fix braces in phy_get_bus_width()/phy_set_bus_width()
- Drop generic phy conversion to use the same support from the Exynos generic phy conversion series
- Modify dts support to match the "device" phy name required in the v3 Exynos generic phy conversion
- Add s3c-hsotg phy_init/phy_exit support
- Fix typo on reg property in kona phy binding
- Replace phy driver reg struct with offset defines
- Move phy soft reset to phy driver init
- Fix dts node names to match ePAPR conventions

Changes since v1:
- Convert USB phy driver to generic phy subsystem
- Add phy bus width apis
- Drop dwc2 phy bus width DT property in favor of querying the phy provider for bus width
- Add generic phy/clock properties to dwc2 DT binding
- Add generic phy subsystem support to s3c-hsotg with the existing usb phy and pdata phy methods as a fallback
- Split bindings out to separate patches to match the latest DT binding review guidelines

This series adds USB Device Controller support for the Broadcom BCM281xx family of parts. BCM281xx contains a DWC2 OTG block and s3c-hsotg is used to support UDC operation.

Part 1 adds phy bus width support to the generic phy subsystem

Parts 2-6 allows s3c-hsotg to build on non-Samsung platforms, supports the dwc2 binding, adds generic phy layer support, and supports fetching phy bus width using the generic phy layer.

Parts 7-8 add a generic phy binding and driver for the BCM Kona USB PHY.

Part 9 adds the DT nodes to enable UDC support on both BCM281xx boards in the kernel.

This series depends on:
- "Update Kona drivers to use clocks" v4 series
https://lkml.org/lkml/2013/12/5/508
(relevant portion now queued for 3.14)

Matt Porter (9):
phy: add phy_get_bus_width()/phy_set_bus_width() calls
staging: dwc2: update DT binding to add generic clock/phy properties
usb: gadget: s3c-hsotg: enable build for other platforms
usb: gadget: s3c-hsotg: add snps,dwc2 compatible string
usb: gadget: s3c-hsotg: enable generic phy support
usb: gadget: s3c-hsotg: get phy bus width from phy subsystem
phy: add Broadcom Kona USB2 PHY DT binding
phy: add Broadcom Kona USB2 PHY driver
ARM: dts: add usb udc support to bcm281xx

 Documentation/devicetree/bindings/phy/bcm-phy.txt  |  15 ++
 Documentation/devicetree/bindings/staging/dwc2.txt |  12 ++
 arch/arm/boot/dts/bcm11351-brt.dts                 |   6 +
 arch/arm/boot/dts/bcm11351.dtsi                    |  18 +++
 arch/arm/boot/dts/bcm28155-ap.dts                  |   8 ++
 drivers/phy/Kconfig                                |   6 +
 drivers/phy/Makefile                               |   1 +
 drivers/phy/phy-bcm-kona-usb2.c                    | 158 +++++++++++++++++++++
 drivers/usb/gadget/Kconfig                         |   7 +-
 drivers/usb/gadget/s3c-hsotg.c                     |  72 +++++++---
 drivers/usb/gadget/s3c-hsotg.h                     |   1 +
 include/linux/phy/phy.h                            |  28 ++++
 12 files changed, 309 insertions(+), 23 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/phy/bcm-phy.txt
 create mode 100644 drivers/phy/phy-bcm-kona-usb2.c
Signature · 1 line
1.8.4
#1 lore raw

PATCH v7 1/9 phy: add phy_get_bus_width()/phy_set_bus_width() calls

This adds a pair of APIs that allows the generic PHY subsystem to provide information on the PHY bus width. The PHY provider driver may use phy_set_bus_width() to set the bus width that the PHY supports. The controller driver may then use phy_get_bus_width() to fetch the PHY bus width in order to properly configure the controller.

---
 include/linux/phy/phy.h | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
include/linux/phy/phy.h +28 -0
index 6d72269..e273e5a 100644
@@ -38,6 +38,14 @@ struct phy_ops {
 };
 
 /**
+ * struct phy_attrs - represents phy attributes
+ * @bus_width: Data path width implemented by PHY
+ */
+struct phy_attrs {
+	u32			bus_width;
+};
+
+/**
  * struct phy - represents the phy device
  * @dev: phy device
  * @id: id of the phy device
@@ -46,6 +54,7 @@ struct phy_ops {
  * @mutex: mutex to protect phy_ops
  * @init_count: used to protect when the PHY is used by multiple consumers
  * @power_count: used to protect when the PHY is used by multiple consumers
+ * @phy_attrs: used to specify PHY specific attributes
  */
 struct phy {
 	struct device		dev;
@@ -55,6 +64,7 @@ struct phy {
 	struct mutex		mutex;
 	int			init_count;
 	int			power_count;
+	struct phy_attrs	attrs;
 };
 
 /**
@@ -127,6 +137,14 @@ int phy_init(struct phy *phy);
 int phy_exit(struct phy *phy);
 int phy_power_on(struct phy *phy);
 int phy_power_off(struct phy *phy);
+static inline int phy_get_bus_width(struct phy *phy)
+{
+	return phy->attrs.bus_width;
+}
+static inline void phy_set_bus_width(struct phy *phy, int bus_width)
+{
+	phy->attrs.bus_width = bus_width;
+}
 struct phy *phy_get(struct device *dev, const char *string);
 struct phy *devm_phy_get(struct device *dev, const char *string);
 void phy_put(struct phy *phy);
@@ -199,6 +217,16 @@ static inline int phy_power_off(struct phy *phy)
 	return -ENOSYS;
 }
 
+static inline int phy_get_bus_width(struct phy *phy)
+{
+	return -ENOSYS;
+}
+
+static inline void phy_set_bus_width(struct phy *phy, int bus_width)
+{
+	return;
+}
+
 static inline struct phy *phy_get(struct device *dev, const char *string)
 {
 	return ERR_PTR(-ENOSYS);
Signature · 1 line
1.8.4
#2 lore raw

PATCH v7 2/9 staging: dwc2: update DT binding to add generic clock/phy properties

In reply to Matt Porter

dwc2/s3c-hsotg require a single clock to be specified and optionally a generic phy. On the s3c-hsotg driver old style USB phy support is present as a fallback so the generic phy properties are optional.

---
 Documentation/devicetree/bindings/staging/dwc2.txt | 12 ++++++++++++
 1 file changed, 12 insertions(+)
Documentation/devicetree/bindings/staging/dwc2.txt +12 -0
index 1a1b7cf..a1753ed 100644
@@ -5,6 +5,14 @@ Required properties:
 - compatible : "snps,dwc2"
 - reg : Should contain 1 register range (address and length)
 - interrupts : Should contain 1 interrupt
+- clocks: clock provider specifier
+- clock-names: shall be "otg"
+Refer to clk/clock-bindings.txt for generic clock consumer properties
+
+Optional properties:
+- phys: phy provider specifier
+- phy-names: shall be "device"
+Refer to phy/phy-bindings.txt for generic phy consumer properties
 
 Example:
 
@@ -12,4 +20,8 @@ Example:
                 compatible = "ralink,rt3050-usb, snps,dwc2";
                 reg = <0x101c0000 40000>;
                 interrupts = <18>;
+		clocks = <&usb_otg_ahb_clk>;
+		clock-names = "otg";
+		phys = <&usbphy>;
+		phy-names = "usb2-phy";
         };
Signature · 1 line
1.8.4
#3 lore raw

PATCH v7 3/9 usb: gadget: s3c-hsotg: enable build for other platforms

In reply to Matt Porter

Remove unused Samsung-specific machine include and Kconfig dependency on S3C.

---
 drivers/usb/gadget/Kconfig     | 7 +++----
 drivers/usb/gadget/s3c-hsotg.c | 2 --
 2 files changed, 3 insertions(+), 6 deletions(-)
drivers/usb/gadget/Kconfig +3 -4
index a91e642..181e760 100644
@@ -294,11 +294,10 @@ config USB_PXA27X
 	   gadget drivers to also be dynamically linked.
 
 config USB_S3C_HSOTG
-	tristate "S3C HS/OtG USB Device controller"
-	depends on S3C_DEV_USB_HSOTG
+	tristate "Designware/S3C HS/OtG USB Device controller"
 	help
-	  The Samsung S3C64XX USB2.0 high-speed gadget controller
-	  integrated into the S3C64XX series SoC.
+	  The Designware USB2.0 high-speed gadget controller
+	  integrated into many SoCs.
 
 config USB_S3C2410
 	tristate "S3C2410 USB Device Controller"
drivers/usb/gadget/s3c-hsotg.c +0 -2
index 9875d9c..db797f2 100644
@@ -36,8 +36,6 @@
 #include <linux/usb/phy.h>
 #include <linux/platform_data/s3c-hsotg.h>
 
-#include <mach/map.h>
-
 #include "s3c-hsotg.h"
 
 static const char * const s3c_hsotg_supply_names[] = {
Signature · 1 line
1.8.4
#4 lore raw

PATCH v7 4/9 usb: gadget: s3c-hsotg: add snps,dwc2 compatible string

In reply to Matt Porter

Enable support for the dwc2 binding.

---
 drivers/usb/gadget/s3c-hsotg.c | 1 +
 1 file changed, 1 insertion(+)
drivers/usb/gadget/s3c-hsotg.c +1 -0
index db797f2..cbfbf41 100644
@@ -3726,6 +3726,7 @@ static int s3c_hsotg_remove(struct platform_device *pdev)
 #ifdef CONFIG_OF
 static const struct of_device_id s3c_hsotg_of_ids[] = {
 	{ .compatible = "samsung,s3c6400-hsotg", },
+	{ .compatible = "snps,dwc2", },
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, s3c_hsotg_of_ids);
Signature · 1 line
1.8.4
#5 lore raw

PATCH v7 5/9 usb: gadget: s3c-hsotg: enable generic phy support

In reply to Matt Porter

Adds support for the generic PHY subsystem. Generic PHY support is probed and then the driver falls back to checking for an old style USB PHY and pdata if not found.

---
 drivers/usb/gadget/s3c-hsotg.c | 55 ++++++++++++++++++++++++++++++------------
 1 file changed, 39 insertions(+), 16 deletions(-)
drivers/usb/gadget/s3c-hsotg.c +39 -16
index cbfbf41..8f9bcdb 100644
@@ -30,6 +30,8 @@
 #include <linux/clk.h>
 #include <linux/regulator/consumer.h>
 #include <linux/of_platform.h>
+#include <linux/phy/phy.h>
+#include <linux/usb/phy.h>
 
 #include <linux/usb/ch9.h>
 #include <linux/usb/gadget.h>
@@ -138,6 +140,7 @@ struct s3c_hsotg_ep {
  * @dev: The parent device supplied to the probe function
  * @driver: USB gadget driver
  * @phy: The otg phy transceiver structure for phy control.
+ * @uphy: The otg phy transceiver structure for old USB phy control.
  * @plat: The platform specific configuration data. This can be removed once
  * all SoCs support usb transceiver.
  * @regs: The memory area mapped for accessing registers.
@@ -159,7 +162,8 @@ struct s3c_hsotg_ep {
 struct s3c_hsotg {
 	struct device		 *dev;
 	struct usb_gadget_driver *driver;
-	struct usb_phy		*phy;
+	struct phy		 *phy;
+	struct usb_phy		 *uphy;
 	struct s3c_hsotg_plat	 *plat;
 
 	spinlock_t              lock;
@@ -2901,8 +2905,11 @@ static void s3c_hsotg_phy_enable(struct s3c_hsotg *hsotg)
 
 	dev_dbg(hsotg->dev, "pdev 0x%p\n", pdev);
 
-	if (hsotg->phy)
-		usb_phy_init(hsotg->phy);
+	if (hsotg->phy) {
+		phy_init(hsotg->phy);
+		phy_power_on(hsotg->phy);
+	} else if (hsotg->uphy)
+		usb_phy_init(hsotg->uphy);
 	else if (hsotg->plat->phy_init)
 		hsotg->plat->phy_init(pdev, hsotg->plat->phy_type);
 }
@@ -2918,8 +2925,11 @@ static void s3c_hsotg_phy_disable(struct s3c_hsotg *hsotg)
 {
 	struct platform_device *pdev = to_platform_device(hsotg->dev);
 
-	if (hsotg->phy)
-		usb_phy_shutdown(hsotg->phy);
+	if (hsotg->phy) {
+		phy_power_off(hsotg->phy);
+		phy_exit(hsotg->phy);
+	} else if (hsotg->uphy)
+		usb_phy_shutdown(hsotg->uphy);
 	else if (hsotg->plat->phy_exit)
 		hsotg->plat->phy_exit(pdev, hsotg->plat->phy_type);
 }
@@ -3526,7 +3536,8 @@ static void s3c_hsotg_delete_debug(struct s3c_hsotg *hsotg)
 static int s3c_hsotg_probe(struct platform_device *pdev)
 {
 	struct s3c_hsotg_plat *plat = dev_get_platdata(&pdev->dev);
-	struct usb_phy *phy;
+	struct phy *phy;
+	struct usb_phy *uphy;
 	struct device *dev = &pdev->dev;
 	struct s3c_hsotg_ep *eps;
 	struct s3c_hsotg *hsotg;
@@ -3541,19 +3552,26 @@ static int s3c_hsotg_probe(struct platform_device *pdev)
 		return -ENOMEM;
 	}
 
-	phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2);
+	/*
+	 * Attempt to find a generic PHY, then look for an old style
+	 * USB PHY, finally fall back to pdata
+	 */
+	phy = devm_phy_get(&pdev->dev, "usb2-phy");
 	if (IS_ERR(phy)) {
-		/* Fallback for pdata */
-		plat = dev_get_platdata(&pdev->dev);
-		if (!plat) {
-			dev_err(&pdev->dev, "no platform data or transceiver defined\n");
-			return -EPROBE_DEFER;
-		} else {
+		uphy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2);
+		if (IS_ERR(uphy)) {
+			/* Fallback for pdata */
+			plat = dev_get_platdata(&pdev->dev);
+			if (!plat) {
+				dev_err(&pdev->dev,
+				"no platform data or transceiver defined\n");
+				return -EPROBE_DEFER;
+			}
 			hsotg->plat = plat;
-		}
-	} else {
+		} else
+			hsotg->uphy = uphy;
+	} else
 		hsotg->phy = phy;
-	}
 
 	hsotg->dev = dev;
 
@@ -3620,6 +3638,9 @@ static int s3c_hsotg_probe(struct platform_device *pdev)
 		goto err_supplies;
 	}
 
+	if (hsotg->phy)
+		phy_init(hsotg->phy);
+
 	/* usb phy enable */
 	s3c_hsotg_phy_enable(hsotg);
 
@@ -3713,6 +3734,8 @@ static int s3c_hsotg_remove(struct platform_device *pdev)
 	}
 
 	s3c_hsotg_phy_disable(hsotg);
+	if (hsotg->phy)
+		phy_exit(hsotg->phy);
 	clk_disable_unprepare(hsotg->clk);
 
 	return 0;
Signature · 1 line
1.8.4
#6 lore raw

PATCH v7 6/9 usb: gadget: s3c-hsotg: get phy bus width from phy subsystem

In reply to Matt Porter

Adds support for querying the phy bus width from the generic phy subsystem. Configure UTMI bus width in GUSBCFG based on this value.

---
 drivers/usb/gadget/s3c-hsotg.c | 14 +++++++++++++-
 drivers/usb/gadget/s3c-hsotg.h |  1 +
 2 files changed, 14 insertions(+), 1 deletion(-)
drivers/usb/gadget/s3c-hsotg.c +13 -1
index 8f9bcdb..93ba8b6 100644
@@ -146,6 +146,7 @@ struct s3c_hsotg_ep {
  * @regs: The memory area mapped for accessing registers.
  * @irq: The IRQ number we are using
  * @supplies: Definition of USB power supplies
+ * @phyif: PHY interface width
  * @dedicated_fifos: Set if the hardware has dedicated IN-EP fifos.
  * @num_of_eps: Number of available EPs (excluding EP0)
  * @debug_root: root directrory for debugfs.
@@ -174,6 +175,7 @@ struct s3c_hsotg {
 
 	struct regulator_bulk_data supplies[ARRAY_SIZE(s3c_hsotg_supply_names)];
 
+	u32			phyif;
 	unsigned int		dedicated_fifos:1;
 	unsigned char           num_of_eps;
 
@@ -2279,7 +2281,7 @@ static void s3c_hsotg_core_init(struct s3c_hsotg *hsotg)
 	 */
 
 	/* set the PLL on, remove the HNP/SRP and set the PHY */
-	writel(GUSBCFG_PHYIf16 | GUSBCFG_TOutCal(7) |
+	writel(hsotg->phyif | GUSBCFG_TOutCal(7) |
 	       (0x5 << 10), hsotg->regs + GUSBCFG);
 
 	s3c_hsotg_init_fifo(hsotg);
@@ -3638,6 +3640,16 @@ static int s3c_hsotg_probe(struct platform_device *pdev)
 		goto err_supplies;
 	}
 
+	/* Set default UTMI width */
+	hsotg->phyif = GUSBCFG_PHYIf16;
+
+	/*
+	 * If using the generic PHY framework, check if the PHY bus
+	 * width is 8-bit and set the phyif appropriately.
+	 */
+	if (hsotg->phy && (phy_get_bus_width(phy) == 8))
+		hsotg->phyif = GUSBCFG_PHYIf8;
+
 	if (hsotg->phy)
 		phy_init(hsotg->phy);
 
drivers/usb/gadget/s3c-hsotg.h +1 -0
index d650b12..85f549f 100644
@@ -55,6 +55,7 @@
 #define GUSBCFG_HNPCap				(1 << 9)
 #define GUSBCFG_SRPCap				(1 << 8)
 #define GUSBCFG_PHYIf16			(1 << 3)
+#define GUSBCFG_PHYIf8				(0 << 3)
 #define GUSBCFG_TOutCal_MASK			(0x7 << 0)
 #define GUSBCFG_TOutCal_SHIFT			(0)
 #define GUSBCFG_TOutCal_LIMIT			(0x7)
Signature · 1 line
1.8.4
#7 lore raw

PATCH v7 7/9 phy: add Broadcom Kona USB2 PHY DT binding

In reply to Matt Porter

Add a binding that describes the Broadcom Kona USB2 PHY found on the BCM281xx family of SoCs.

---
 Documentation/devicetree/bindings/phy/bcm-phy.txt | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/bcm-phy.txt
Documentation/devicetree/bindings/phy/bcm-phy.txt new file +15 -0
new file mode 100644
index 0000000..3dc8b3d
@@ -0,0 +1,15 @@
+BROADCOM KONA USB2 PHY
+
+Required properties:
+ - compatible: brcm,kona-usb2-phy
+ - reg: offset and length of the PHY registers
+ - #phy-cells: must be 0
+Refer to phy/phy-bindings.txt for the generic PHY binding properties
+
+Example:
+
+	usbphy: usb-phy at 3f130000 {
+		compatible = "brcm,kona-usb2-phy";
+		reg = <0x3f130000 0x28>;
+		#phy-cells = <0>;
+	};
Signature · 1 line
1.8.4
#8 lore raw

PATCH v7 8/9 phy: add Broadcom Kona USB2 PHY driver

In reply to Matt Porter

Add a driver for the internal Broadcom Kona USB 2.0 PHY found on the BCM281xx family of SoCs.

---
 drivers/phy/Kconfig             |   6 ++
 drivers/phy/Makefile            |   1 +
 drivers/phy/phy-bcm-kona-usb2.c | 158 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 165 insertions(+)
 create mode 100644 drivers/phy/phy-bcm-kona-usb2.c
drivers/phy/Kconfig +6 -0
index a344f3d..2e87fa8 100644
@@ -51,4 +51,10 @@ config PHY_EXYNOS_DP_VIDEO
 	help
 	  Support for Display Port PHY found on Samsung EXYNOS SoCs.
 
+config BCM_KONA_USB2_PHY
+	tristate "Broadcom Kona USB2 PHY Driver"
+	depends on GENERIC_PHY
+	help
+	  Enable this to support the Broadcom Kona USB 2.0 PHY.
+
 endmenu
drivers/phy/Makefile +1 -0
index d0caae9..c447f1a 100644
@@ -3,6 +3,7 @@
 #
 
 obj-$(CONFIG_GENERIC_PHY)		+= phy-core.o
+obj-$(CONFIG_BCM_KONA_USB2_PHY)		+= phy-bcm-kona-usb2.o
 obj-$(CONFIG_PHY_EXYNOS_DP_VIDEO)	+= phy-exynos-dp-video.o
 obj-$(CONFIG_PHY_EXYNOS_MIPI_VIDEO)	+= phy-exynos-mipi-video.o
 obj-$(CONFIG_OMAP_USB2)			+= phy-omap-usb2.o
drivers/phy/phy-bcm-kona-usb2.c new file +158 -0

158 lines not on this page · raw message

Signature · 1 line
1.8.4
#14 lore raw

PATCH v7 9/9 ARM: dts: add usb udc support to bcm281xx

In reply to Matt Porter

Adds USB OTG/PHY and clock support to BCM281xx and enables UDC support on the bcm11351-brt and bcm28155-ap boards.

---
 arch/arm/boot/dts/bcm11351-brt.dts |  6 ++++++
 arch/arm/boot/dts/bcm11351.dtsi    | 18 ++++++++++++++++++
 arch/arm/boot/dts/bcm28155-ap.dts  |  8 ++++++++
 3 files changed, 32 insertions(+)
arch/arm/boot/dts/bcm11351-brt.dts +6 -0
index 23cd16d..396b704 100644
@@ -44,5 +44,11 @@
 		status = "okay";
 	};
 
+	usbotg: usb at 3f120000 {
+		status = "okay";
+	};
 
+	usbphy: usb-phy at 3f130000 {
+		status = "okay";
+	};
 };
arch/arm/boot/dts/bcm11351.dtsi +18 -0
index 1246885..0fbb455 100644
@@ -243,4 +243,22 @@
 			#clock-cells = <0>;
 		};
 	};
+
+	usbotg: usb at 3f120000 {
+		compatible = "snps,dwc2";
+		reg = <0x3f120000 0x10000>;
+		interrupts = <GIC_SPI 47 IRQ_TYPE_LEVEL_HIGH>;
+		clocks = <&usb_otg_ahb_clk>;
+		clock-names = "otg";
+		phys = <&usbphy>;
+		phy-names = "usb2-phy";
+		status = "disabled";
+	};
+
+	usbphy: usb-phy at 3f130000 {
+		compatible = "brcm,kona-usb2-phy";
+		reg = <0x3f130000 0x28>;
+		#phy-cells = <0>;
+		status = "disabled";
+	};
 };
arch/arm/boot/dts/bcm28155-ap.dts +8 -0
index 08e47c2..a3bc436 100644
@@ -43,4 +43,12 @@
 		cd-gpios = <&gpio 14 0>;
 		status = "okay";
 	};
+
+	usbotg: usb at 3f120000 {
+		status = "okay";
+	};
+
+	usbphy: usb-phy at 3f130000 {
+		status = "okay";
+	};
 };
Signature · 1 line
1.8.4
#9 lore raw

Re: [PATCH v7 8/9] phy: add Broadcom Kona USB2 PHY driver

In reply to Matt Porter
Quoted 4 lines · Matt Porter

Add a driver for the internal Broadcom Kona USB 2.0 PHY found on the BCM281xx family of SoCs.

Kishon, are you ok with this driver ?

Quoted 22 lines
drivers/phy/phy-bcm-kona-usb2.c new file +22 -0
+static int bcm_kona_usb2_probe(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	struct bcm_kona_usb *phy;
+	struct resource *res;
+	struct phy *gphy;
+	struct phy_provider *phy_provider;
+
+	phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL);
+	if (!phy)
+		return -ENOMEM;
+
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	phy->regs = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(phy->regs))
+		return PTR_ERR(phy->regs);
+
+	platform_set_drvdata(pdev, phy);
+
+	phy_provider = devm_of_phy_provider_register(dev,
+			of_phy_simple_xlate);
+	if (IS_ERR(phy_provider))

drivers/phy/phy-bcm-kona-usb2.c line 132

Quoted 10 lines
drivers/phy/phy-bcm-kona-usb2.c new file +10 -0
+		return PTR_ERR(phy_provider);
+
+	gphy = devm_phy_create(dev, &ops, NULL);
+	if (IS_ERR(gphy))
+		return PTR_ERR(gphy);
+
+	/* The Kona PHY supports an 8-bit wide UTMI interface */
+	phy_set_bus_width(gphy, 8);
+
+	phy_set_drvdata(gphy, phy);

I think this set_drvdata() should be done before registering the provider, no ?

Signature · 8 lines
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20131218/c2bfae5f/attachment.sig>
#10 lore raw

Re: [PATCH v7 8/9] phy: add Broadcom Kona USB2 PHY driver

Quoted 7 lines · Felipe Balbi
Quoted 4 lines · Matt Porter

Add a driver for the internal Broadcom Kona USB 2.0 PHY found on the BCM281xx family of SoCs.

Kishon, are you ok with this driver ?

Kishon did mention he was fine with this if I addressed a couple comments a couple versions ago, I neglected solicit his ack though.

Quoted 27 lines
Quoted 27 lines
drivers/phy/phy-bcm-kona-usb2.c new file +27 -0
+static int bcm_kona_usb2_probe(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	struct bcm_kona_usb *phy;
+	struct resource *res;
+	struct phy *gphy;
+	struct phy_provider *phy_provider;
+
+	phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL);
+	if (!phy)
+		return -ENOMEM;
+
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	phy->regs = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(phy->regs))
+		return PTR_ERR(phy->regs);
+
+	platform_set_drvdata(pdev, phy);
+
+	phy_provider = devm_of_phy_provider_register(dev,
+			of_phy_simple_xlate);
+	if (IS_ERR(phy_provider))
+		return PTR_ERR(phy_provider);
+
+	gphy = devm_phy_create(dev, &ops, NULL);
+	if (IS_ERR(gphy))
+		return PTR_ERR(gphy);
Quoted 8 lines

drivers/phy/phy-bcm-kona-usb2.c line 132

Quoted 5 lines
drivers/phy/phy-bcm-kona-usb2.c new file +5 -0
+
+	/* The Kona PHY supports an 8-bit wide UTMI interface */
+	phy_set_bus_width(gphy, 8);
+
+	phy_set_drvdata(gphy, phy);

I think this set_drvdata() should be done before registering the provider, no ?

It seems so, given that we wouldn't want the provider on on the provider list until the phy has been allocated and configured.

Interestingly, this also needs to be addressed in the four phy drivers already upstream...they all do the same thing before the generic phy is created.

-Matt

#11 lore raw

Re: [PATCH v7 8/9] phy: add Broadcom Kona USB2 PHY driver

In reply to Felipe Balbi

Hi Felipe,

Quoted 7 lines · Felipe Balbi
Quoted 4 lines · Matt Porter

Add a driver for the internal Broadcom Kona USB 2.0 PHY found on the BCM281xx family of SoCs.

Kishon, are you ok with this driver ?

yeah. Since this patch touches phy/Kconfig (and Makefile) and there is one more PHY driver to be merged that also modifies Kconfig there might be conflicts. So thought I should be taking this patch?

Quoted 28 lines
Quoted 28 lines
drivers/phy/phy-bcm-kona-usb2.c new file +27 -0
+static int bcm_kona_usb2_probe(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	struct bcm_kona_usb *phy;
+	struct resource *res;
+	struct phy *gphy;
+	struct phy_provider *phy_provider;
+
+	phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL);
+	if (!phy)
+		return -ENOMEM;
+
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	phy->regs = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(phy->regs))
+		return PTR_ERR(phy->regs);
+
+	platform_set_drvdata(pdev, phy);
+
+	phy_provider = devm_of_phy_provider_register(dev,
+			of_phy_simple_xlate);
+	if (IS_ERR(phy_provider))
+		return PTR_ERR(phy_provider);
+
+	gphy = devm_phy_create(dev, &ops, NULL);
+	if (IS_ERR(gphy))
+		return PTR_ERR(gphy);
Quoted 8 lines

drivers/phy/phy-bcm-kona-usb2.c line 132

Quoted 5 lines
drivers/phy/phy-bcm-kona-usb2.c new file +5 -0
+
+	/* The Kona PHY supports an 8-bit wide UTMI interface */
+	phy_set_bus_width(gphy, 8);
+
+	phy_set_drvdata(gphy, phy);

I think this set_drvdata() should be done before registering the provider, no ?

hmm, right.

Thanks
Kishon

#12 lore raw

Re: [PATCH v7 8/9] phy: add Broadcom Kona USB2 PHY driver

Quoted 51 lines · Kishon Vijay Abraham I

Hi Felipe,

Quoted 7 lines · Felipe Balbi
Quoted 4 lines · Matt Porter

Add a driver for the internal Broadcom Kona USB 2.0 PHY found on the BCM281xx family of SoCs.

Kishon, are you ok with this driver ?

yeah. Since this patch touches phy/Kconfig (and Makefile) and there is one more PHY driver to be merged that also modifies Kconfig there might be conflicts. So thought I should be taking this patch?

Quoted 28 lines
Quoted 28 lines
drivers/phy/phy-bcm-kona-usb2.c new file +27 -0
+static int bcm_kona_usb2_probe(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	struct bcm_kona_usb *phy;
+	struct resource *res;
+	struct phy *gphy;
+	struct phy_provider *phy_provider;
+
+	phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL);
+	if (!phy)
+		return -ENOMEM;
+
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	phy->regs = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(phy->regs))
+		return PTR_ERR(phy->regs);
+
+	platform_set_drvdata(pdev, phy);
+
+	phy_provider = devm_of_phy_provider_register(dev,
+			of_phy_simple_xlate);
+	if (IS_ERR(phy_provider))
+		return PTR_ERR(phy_provider);
+
+	gphy = devm_phy_create(dev, &ops, NULL);
+	if (IS_ERR(gphy))
+		return PTR_ERR(gphy);
Quoted 8 lines

drivers/phy/phy-bcm-kona-usb2.c line 132

Quoted 5 lines
drivers/phy/phy-bcm-kona-usb2.c new file +5 -0
+
+	/* The Kona PHY supports an 8-bit wide UTMI interface */
+	phy_set_bus_width(gphy, 8);
+
+	phy_set_drvdata(gphy, phy);

I think this set_drvdata() should be done before registering the provider, no ?

Quoted 1 line

hmm, right.

I sent a v8 series update that addresses this issue.

-Matt

#13 lore raw

Re: [PATCH v7 8/9] phy: add Broadcom Kona USB2 PHY driver

In reply to Kishon Vijay Abraham I

Hi,

Quoted 5 lines · Kishon Vijay Abraham I
Quoted 4 lines · Felipe Balbi
Quoted 3 lines · Matt Porter

Add a driver for the internal Broadcom Kona USB 2.0 PHY found on the BCM281xx family of SoCs.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Kishon, are you ok with this driver ?

yeah. Since this patch touches phy/Kconfig (and Makefile) and there is one more PHY driver to be merged that also modifies Kconfig there might be conflicts. So thought I should be taking this patch?

this PHY driver depends on the new ->get_bus_width()/->set_bus_width() methods which Matt just added. There's no easy way to make sure we avoid conflicts and/or build errors.

Signature · 8 lines
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20131219/44ca1c6e/attachment.sig>