Skip to contentSkip to conversation

Add Broadcom USB PHY driver for Broadcom STB SoCs

PATCH RESEND Superseded Al Cooper 1 participant 3 messages Jun 8, 2016

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Al Cooper

author
#0 lore raw

v2 cover Add Broadcom USB PHY driver for Broadcom STB SoCs

Add Broadcom USB PHY driver for Broadcom STB SoCs. This driver in combination with the generic ohci, ehci and xhci platform drivers will enable USB1.1, USB2.0 and USB3.0 support.

NOTE: An unrelated patch is in the pipline to move the file drivers/soc/brcmstb/common.c to drivers/soc/bcm/brcmstb/common.c

V2 - Change compatible name from "brcm,usb-phy" to
"brcm,brcmstb-usb-phy"

Al Cooper (2):
soc: brcmstb: Add Product ID and Family ID helper functions
usb: phy: phy-brcm-usb: Add Broadcom STB USB Phy driver

 .../bindings/phy/brcm,brcmstb-usb-phy.txt          |  39 +
 MAINTAINERS                                        |   7 +
 drivers/phy/Kconfig                                |  10 +
 drivers/phy/Makefile                               |   2 +
 drivers/phy/phy-brcm-usb-init.c                    | 792 +++++++++++++++++++++
 drivers/phy/phy-brcm-usb-init.h                    |  49 ++
 drivers/phy/phy-brcm-usb.c                         | 206 ++++++
 drivers/soc/brcmstb/common.c                       |  12 +
 include/linux/soc/brcmstb/brcmstb.h                |  10 +
 9 files changed, 1127 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/brcm,brcmstb-usb-phy.txt
 create mode 100644 drivers/phy/phy-brcm-usb-init.c
 create mode 100644 drivers/phy/phy-brcm-usb-init.h
 create mode 100644 drivers/phy/phy-brcm-usb.c
Signature · 1 line
1.9.0.138.g2de3478
author
#2 lore raw

PATCH RESEND v2 2/2 usb: phy: phy-brcm-usb: Add Broadcom STB USB phy driver

Add a new USB Phy driver for Broadcom STB SoCs. This driver supports all Broadcom STB ARM SoCs. This driver in combination with the generic ohci, ehci and xhci platform drivers will enable USB1.1, USB2.0 and USB3.0 support. This Phy driver also supports the Broadcom UDC gadget driver.

---
 .../bindings/phy/brcm,brcmstb-usb-phy.txt          |  39 +
 MAINTAINERS                                        |   7 +
 drivers/phy/Kconfig                                |  10 +
 drivers/phy/Makefile                               |   2 +
 drivers/phy/phy-brcm-usb-init.c                    | 792 +++++++++++++++++++++
 drivers/phy/phy-brcm-usb-init.h                    |  49 ++
 drivers/phy/phy-brcm-usb.c                         | 206 ++++++
 7 files changed, 1105 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/brcm,brcmstb-usb-phy.txt
 create mode 100644 drivers/phy/phy-brcm-usb-init.c
 create mode 100644 drivers/phy/phy-brcm-usb-init.h
 create mode 100644 drivers/phy/phy-brcm-usb.c
Documentation/devicetree/bindings/phy/brcm,brcmstb-usb-phy.txt new file +39 -0
new file mode 100644
index 0000000..34fa9dd
@@ -0,0 +1,39 @@
+Broadcom STB USB PHY
+
+Required properties:
+ - compatible: brcm,brcmstb-usb-phy
+ - reg: two offset and length pairs. The second pair specifies the
+        USB 3.0 related registers and is only required for PHYs
+        that support USB 3.0
+ - #phy-cells: Shall be 1 as it expects one argument for setting
+	       the type of the PHY. Possible values are 0 (1.1 and 2.0),
+	       1 (3.0)
+
+
+Optional Properties:
+- clocks : phandle + clock specifier for the phy clocks
+- clock-names: string, clock name
+- ipp: Invert Port Power
+- ioc: Invert Over Current detection
+- has_xhci: Contains an optional 3.0 PHY
+- device: PHY Device mode. Possible values are: 0 (Host), 1 (Device)
+          or 2 (DRD)
+
+
+
+Example:
+
+usbphy_0: usb-phy@f0470200 {
+	reg = <0xf0470200 0xb8>,
+		<0xf0471940 0x6c0>;
+	#address-cells = <1>;
+	#size-cells = <1>;
+	compatible = "brcm,brcmstb-usb-phy";
+	ioc = <1>;
+	ipp = <1>;
+	#phy-cells = <1>;
+	ranges;
+	has_xhci;
+	clocks = <&sw_usb20>;
+	clock-names = "sw_usb";
+};
MAINTAINERS +7 -0
index ed1229e..4d529e7 100644
@@ -2631,6 +2631,13 @@ S:	Maintained
 F:	drivers/bcma/
 F:	include/linux/bcma/
 
+BROADCOM STB USB PHY DRIVER
+M:	Al Cooper <[email protected]>
+L:	[email protected]
+L:	[email protected]
+S:	Supported
+F:	drivers/phy/phy-brcm-usb*
+
 BROADCOM SYSTEMPORT ETHERNET DRIVER
 M:	Florian Fainelli <[email protected]>
 L:	[email protected]
drivers/phy/Kconfig +10 -0
index b869b98..61a0244 100644
@@ -432,6 +432,16 @@ config PHY_CYGNUS_PCIE
 	  Enable this to support the Broadcom Cygnus PCIe PHY.
 	  If unsure, say N.
 
+config BRCM_USB_PHY
+	tristate "Broadcom USB PHY driver"
+	depends on OF && USB && ARCH_BRCMSTB
+	select GENERIC_PHY
+	default y
+	help
+	  Enable this to support the Broadcom USB PHY on
+	  Broadcom STB SoCs.
+	  If unsure, say Y.
+
 source "drivers/phy/tegra/Kconfig"
 
 endmenu
drivers/phy/Makefile +2 -0
index 9c3e73c..babb0c7 100644
@@ -9,6 +9,8 @@ obj-$(CONFIG_PHY_BERLIN_SATA)		+= phy-berlin-sata.o
 obj-$(CONFIG_PHY_DM816X_USB)		+= phy-dm816x-usb.o
 obj-$(CONFIG_ARMADA375_USBCLUSTER_PHY)	+= phy-armada375-usb2.o
 obj-$(CONFIG_BCM_KONA_USB2_PHY)		+= phy-bcm-kona-usb2.o
+obj-$(CONFIG_BRCM_USB_PHY)		+= phy-brcm-usb.o
+obj-$(CONFIG_BRCM_USB_PHY)		+= phy-brcm-usb-init.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_PHY_LPC18XX_USB_OTG)	+= phy-lpc18xx-usb-otg.o
drivers/phy/phy-brcm-usb-init.c new file +792 -0

792 lines not on this page · raw message

drivers/phy/phy-brcm-usb-init.h new file +49 -0

49 lines not on this page · raw message

drivers/phy/phy-brcm-usb.c new file +206 -0

206 lines not on this page · raw message

Signature · 1 line
1.9.0.138.g2de3478
author
#1 lore raw

PATCH RESEND v2 1/2 soc: brcmstb: Add Product ID and Family ID helper functions

In reply to Al Cooper
---
 drivers/soc/brcmstb/common.c        | 12 ++++++++++++
 include/linux/soc/brcmstb/brcmstb.h | 10 ++++++++++
 2 files changed, 22 insertions(+)
drivers/soc/brcmstb/common.c +12 -0
index 94e7335..454f4c2 100644
@@ -40,6 +40,18 @@ bool soc_is_brcmstb(void)
 	return of_match_node(brcmstb_machine_match, root) != NULL;
 }
 
+u32 brcmstb_get_family_id(void)
+{
+	return family_id;
+}
+EXPORT_SYMBOL(brcmstb_get_family_id);
+
+u32 brcmstb_get_product_id(void)
+{
+	return product_id;
+}
+EXPORT_SYMBOL(brcmstb_get_product_id);
+
 static const struct of_device_id sun_top_ctrl_match[] = {
 	{ .compatible = "brcm,brcmstb-sun-top-ctrl", },
 	{ }
include/linux/soc/brcmstb/brcmstb.h +10 -0
index 337ce41..4bf5edd 100644
@@ -1,10 +1,20 @@
 #ifndef __BRCMSTB_SOC_H
 #define __BRCMSTB_SOC_H
 
+#define BRCM_ID(reg)	((u32)reg >> 28 ? (u32)reg >> 16 : (u32)reg >> 8)
+#define BRCM_REV(reg)	((u32)reg & 0xff)
+
 /*
  * Bus Interface Unit control register setup, must happen early during boot,
  * before SMP is brought up, called by machine entry point.
  */
 void brcmstb_biuctrl_init(void);
 
+/*
+* Helper functions for getting family or product id from the
+* SoC driver.
+*/
+u32 brcmstb_get_family_id(void);
+u32 brcmstb_get_product_id(void);
+
 #endif /* __BRCMSTB_SOC_H */
Signature · 1 line
1.9.0.138.g2de3478