Skip to contentSkip to conversation

USB: Add driver for NXP ISP1301 USB transceiver

PATCH Superseded Roland Stigge 1 participant 3 messages Apr 25, 2012

Subsystems (4)

v6 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

PATCH v6 1/3 USB: Add driver for NXP ISP1301 USB transceiver

This very-lowlevel driver registers the NXP ISP1301 chip via the I2C subsystem. The chip is the USB transceiver shared by ohci-nxp, lpc32xx_udc (gadget) and isp1301_omap.

Following patches let the respective USB host and gadget drivers use this driver, instead of duplicating ISP1301 handling.

---

Applies to v3.4-rc3

Changes since v5:
* Removed DRV_VERSION
* Use EXPORT_SYMBOL_GPL()
* Removed FSF address

Thanks to GregKH for reviewing v5!

 Documentation/devicetree/bindings/usb/isp1301.txt |   25 ++++++
 drivers/usb/Kconfig                               |    2 
 drivers/usb/Makefile                              |    1 
 drivers/usb/phy/Kconfig                           |   17 ++++
 drivers/usb/phy/Makefile                          |    7 +
 drivers/usb/phy/isp1301.c                         |   77 +++++++++++++++++++++
 include/linux/usb/isp1301.h                       |   80 ++++++++++++++++++++++
 7 files changed, 209 insertions(+)
Documentation/devicetree/bindings/usb/isp1301.txt new file +25 -0
@@ -0,0 +1,25 @@
+* NXP ISP1301 USB transceiver
+
+Required properties:
+- compatible: must be "nxp,isp1301"
+- reg: I2C address of the ISP1301 device
+
+Optional properties of devices using ISP1301:
+- transceiver: phandle of isp1301 - this helps the ISP1301 driver to find the
+               ISP1301 instance associated with the respective USB driver
+
+Example:
+
+	isp1301: usb-transceiver at 2c {
+		compatible = "nxp,isp1301";
+		reg = <0x2c>;
+	};
+
+	usbd at 31020000 {
+		compatible = "nxp,lpc3220-udc";
+		reg = <0x31020000 0x300>;
+		interrupt-parent = <&mic>;
+		interrupts = <0x3d 0>, <0x3e 0>, <0x3c 0>, <0x3a 0>;
+		transceiver = <&isp1301>;
+		status = "okay";
+	};
drivers/usb/Kconfig +2 -0
@@ -177,6 +177,8 @@ source "drivers/usb/serial/Kconfig"
 
 source "drivers/usb/misc/Kconfig"
 
+source "drivers/usb/phy/Kconfig"
+
 source "drivers/usb/atm/Kconfig"
 
 source "drivers/usb/gadget/Kconfig"
drivers/usb/Makefile +1 -0
@@ -46,6 +46,7 @@ obj-$(CONFIG_USB_MICROTEK)	+= image/
 obj-$(CONFIG_USB_SERIAL)	+= serial/
 
 obj-$(CONFIG_USB)		+= misc/
+obj-$(CONFIG_USB)		+= phy/
 obj-$(CONFIG_EARLY_PRINTK_DBGP)	+= early/
 
 obj-$(CONFIG_USB_ATM)		+= atm/
drivers/usb/phy/Kconfig new file +17 -0
@@ -0,0 +1,17 @@
+#
+# Physical Layer USB driver configuration
+#
+comment "USB Physical Layer drivers"
+	depends on USB
+
+config USB_ISP1301
+	tristate "NXP ISP1301 USB transceiver support"
+	depends on USB
+	depends on I2C
+	help
+	  Say Y here to add support for the NXP ISP1301 USB transceiver driver.
+	  This chip is typically used as USB transceiver for USB host, gadget
+	  and OTG drivers (to be selected separately).
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called isp1301.
drivers/usb/phy/Makefile new file +7 -0
@@ -0,0 +1,7 @@
+#
+# Makefile for physical layer USB drivers
+#
+
+ccflags-$(CONFIG_USB_DEBUG) := -DDEBUG
+
+obj-$(CONFIG_USB_ISP1301)		+= isp1301.o
drivers/usb/phy/isp1301.c new file +77 -0

77 lines not on this page · raw message

include/linux/usb/isp1301.h new file +80 -0

80 lines not on this page · raw message

#1 lore raw

PATCH v6 2/3 USB: gadget driver for LPC32xx

This patch adds a USB gadget driver for the LPC32xx ARM SoC.

---

Changes since v5:
* None

Applies to v3.4-rc3

 Documentation/devicetree/bindings/usb/lpc32xx-udc.txt |   28 
 drivers/usb/gadget/Kconfig                            |   11 
 drivers/usb/gadget/Makefile                           |    1 
 drivers/usb/gadget/gadget_chips.h                     |    3 
 drivers/usb/gadget/lpc32xx_udc.c                      | 3538 ++++++++++++++++++
 5 files changed, 3581 insertions(+)
Documentation/devicetree/bindings/usb/lpc32xx-udc.txt new file +28 -0
@@ -0,0 +1,28 @@
+* NXP LPC32xx SoC USB Device Controller (UDC)
+
+Required properties:
+- compatible: Must be "nxp,lpc3220-udc"
+- reg: Physical base address of the controller and length of memory mapped
+  region.
+- interrupts: The USB interrupts:
+              * USB Device Low Priority Interrupt
+              * USB Device High Priority Interrupt
+              * USB Device DMA Interrupt
+              * External USB Transceiver Interrupt (OTG ATX)
+- transceiver: phandle of the associated ISP1301 device - this is necessary for
+               the UDC controller for connecting to the USB physical layer
+
+Example:
+
+	isp1301: usb-transceiver at 2c {
+		compatible = "nxp,isp1301";
+		reg = <0x2c>;
+	};
+
+	usbd at 31020000 {
+		compatible = "nxp,lpc3220-udc";
+		reg = <0x31020000 0x300>;
+		interrupt-parent = <&mic>;
+		interrupts = <0x3d 0>, <0x3e 0>, <0x3c 0>, <0x3a 0>;
+		transceiver = <&isp1301>;
+	};
drivers/usb/gadget/Kconfig +11 -0
@@ -147,6 +147,17 @@ config USB_AT91
 	   dynamically linked module called "at91_udc" and force all
 	   gadget drivers to also be dynamically linked.
 
+config USB_LPC32XX
+	tristate "LPC32XX USB Peripheral Controller"
+	depends on ARCH_LPC32XX
+	select USB_ISP1301
+	help
+	   This option selects the USB device controller in the LPC32xx SoC.
+
+	   Say "y" to link the driver statically, or "m" to build a
+	   dynamically linked module called "lpc32xx_udc" and force all
+	   gadget drivers to also be dynamically linked.
+
 config USB_ATMEL_USBA
 	tristate "Atmel USBA"
 	select USB_GADGET_DUALSPEED
drivers/usb/gadget/Makefile +1 -0
@@ -26,6 +26,7 @@ obj-$(CONFIG_USB_CI13XXX_PCI)	+= ci13xxx
 obj-$(CONFIG_USB_S3C_HSOTG)	+= s3c-hsotg.o
 obj-$(CONFIG_USB_S3C_HSUDC)	+= s3c-hsudc.o
 obj-$(CONFIG_USB_LANGWELL)	+= langwell_udc.o
+obj-$(CONFIG_USB_LPC32XX)	+= lpc32xx_udc.o
 obj-$(CONFIG_USB_EG20T)		+= pch_udc.o
 obj-$(CONFIG_USB_MV_UDC)	+= mv_udc.o
 mv_udc-y			:= mv_udc_core.o
drivers/usb/gadget/gadget_chips.h +3 -0
@@ -37,6 +37,7 @@
 #define gadget_is_goku(g)		(!strcmp("goku_udc", (g)->name))
 #define gadget_is_imx(g)		(!strcmp("imx_udc", (g)->name))
 #define gadget_is_langwell(g)		(!strcmp("langwell_udc", (g)->name))
+#define gadget_is_lpc32xx(g)		(!strcmp("lpc32xx_udc", (g)->name))
 #define gadget_is_m66592(g)		(!strcmp("m66592_udc", (g)->name))
 #define gadget_is_musbhdrc(g)		(!strcmp("musb-hdrc", (g)->name))
 #define gadget_is_net2272(g)		(!strcmp("net2272", (g)->name))
@@ -118,6 +119,8 @@ static inline int usb_gadget_controller_
 		return 0x31;
 	else if (gadget_is_dwc3(gadget))
 		return 0x32;
+	else if (gadget_is_lpc32xx(gadget))
+		return 0x33;
 
 	return -ENOENT;
 }
drivers/usb/gadget/lpc32xx_udc.c new file +3538 -0

2,933 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Part of the diff is not shown here. View the raw message.

#2 lore raw

PATCH v6 3/3 USB: ohci-nxp: Use isp1301 driver

In reply to Roland Stigge

ohci-nxp duplicates the isp1301 driver. This patch removes this code and makes ohci-nxp use the new separate isp1301 driver instead.

---

Applies to v3.4-rc3 + LPC32xx OHCI DT patches (i.e. the first two patches of the "second patch set for LPC32xx DT conversion" series)

Depends on the isp1301 driver, see PATCH 1/3

Changes since v5:
* None

 Documentation/devicetree/bindings/usb/ohci-nxp.txt |    8 +
 drivers/usb/host/Kconfig                           |    1 
 drivers/usb/host/ohci-nxp.c                        |  121 ++-------------------
 3 files changed, 24 insertions(+), 106 deletions(-)
Documentation/devicetree/bindings/usb/ohci-nxp.txt +8 -0
@@ -5,12 +5,20 @@ Required properties:
 - reg: physical base address of the controller and length of memory mapped
   region.
 - interrupts: The OHCI interrupt
+- transceiver: phandle of the associated ISP1301 device - this is necessary for
+               the UDC controller for connecting to the USB physical layer
 
 Example (LPC32xx):
 
+	isp1301: usb-transceiver at 2c {
+		compatible = "nxp,isp1301";
+		reg = <0x2c>;
+	};
+
 	ohci at 31020000 {
 		compatible = "nxp,ohci-nxp";
 		reg = <0x31020000 0x300>;
 		interrupt-parent = <&mic>;
 		interrupts = <0x3b 0>;
+		transceiver = <&isp1301>;
 	};
drivers/usb/host/Kconfig +1 -0
@@ -291,6 +291,7 @@ config USB_OHCI_HCD
 	depends on USB && USB_ARCH_HAS_OHCI
 	select ISP1301_OMAP if MACH_OMAP_H2 || MACH_OMAP_H3
 	select USB_OTG_UTILS if ARCH_OMAP
+	select USB_ISP1301 if ARCH_LPC32XX || ARCH_PNX4008
 	---help---
 	  The Open Host Controller Interface (OHCI) is a standard for accessing
 	  USB 1.1 host controller hardware.  It does more in hardware than Intel's
drivers/usb/host/ohci-nxp.c +15 -106

172 lines not on this page · raw message