Skip to contentSkip to conversation

USB device driver of Topcliff PCH

PATCH Superseded Toshiharu Okada 2 participants 3 messages Nov 11, 2010 USB

v10 of 11 Superseded Latest is v11 →

lore
Share & tools
lore
#0 lore raw

PATCH v10 1/1 USB device driver of Topcliff PCH

This patch adds the USB device driver of EG20T(Topcliff) PCH.

EG20T PCH is the platform controller hub that is going to be used in Intel's upcoming general embedded platform. All IO peripherals in EG20T PCH are actually devices sitting on AMBA bus.
EG20T PCH has USB device I/F. Using this I/F, it is able to access system devices connected to USB device.

---
 drivers/usb/gadget/Kconfig        |   22 +
 drivers/usb/gadget/Makefile       |    2 +-
 drivers/usb/gadget/gadget_chips.h |    7 +
 drivers/usb/gadget/pch_udc.c      | 2940 +++++++++++++++++++++++++++++++++++++
 4 files changed, 2970 insertions(+), 1 deletions(-)
 create mode 100644 drivers/usb/gadget/pch_udc.c
drivers/usb/gadget/Kconfig +22 -0
index 591ae9f..05cf9a3 100644
@@ -505,6 +505,28 @@ config USB_LANGWELL
 	default USB_GADGET
 	select USB_GADGET_SELECTED
 
+config USB_GADGET_EG20T
+	boolean "Intel EG20T(Topcliff) USB Device controller"
+	depends on PCI
+	select USB_GADGET_DUALSPEED
+	help
+	  This is a USB device driver for EG20T PCH.
+	  EG20T PCH is the platform controller hub that is used in Intel's
+	  general embedded platform. EG20T PCH has USB device interface.
+	  Using this interface, it is able to access system devices connected
+	  to USB device.
+	  This driver enables USB device function.
+	  USB device is a USB peripheral controller which
+	  supports both full and high speed USB 2.0 data transfers.
+	  This driver supports both control transfer and bulk transfer modes.
+	  This driver dose not support interrupt transfer or isochronous
+	  transfer modes.
+
+config USB_EG20T
+	tristate
+	depends on USB_GADGET_EG20T
+	default USB_GADGET
+	select USB_GADGET_SELECTED
 
 #
 # LAST -- dummy/emulated controller
drivers/usb/gadget/Makefile +1 -1
index 9bcde11..1c69a8f 100644
@@ -28,6 +28,7 @@ obj-$(CONFIG_USB_FSL_QE)	+= fsl_qe_udc.o
 obj-$(CONFIG_USB_CI13XXX)	+= ci13xxx_udc.o
 obj-$(CONFIG_USB_S3C_HSOTG)	+= s3c-hsotg.o
 obj-$(CONFIG_USB_LANGWELL)	+= langwell_udc.o
+obj-$(CONFIG_USB_EG20T)		+= pch_udc.o
 
 #
 # USB gadget drivers
@@ -63,4 +64,3 @@ obj-$(CONFIG_USB_G_HID)		+= g_hid.o
 obj-$(CONFIG_USB_G_MULTI)	+= g_multi.o
 obj-$(CONFIG_USB_G_NOKIA)	+= g_nokia.o
 obj-$(CONFIG_USB_G_WEBCAM)	+= g_webcam.o
-
drivers/usb/gadget/gadget_chips.h +7 -0
index e511fec..d7b3bbe 100644
@@ -142,6 +142,11 @@
 #define gadget_is_s3c_hsotg(g)    0
 #endif
 
+#ifdef CONFIG_USB_GADGET_EG20T
+#define	gadget_is_pch(g)	(!strcmp("pch_udc", (g)->name))
+#else
+#define	gadget_is_pch(g)	0
+#endif
 
 /**
  * usb_gadget_controller_number - support bcdDevice id convention
@@ -200,6 +205,8 @@ static inline int usb_gadget_controller_number(struct usb_gadget *gadget)
 		return 0x25;
 	else if (gadget_is_s3c_hsotg(gadget))
 		return 0x26;
+	else if (gadget_is_pch(gadget))
+		return 0x27;
 	return -ENOENT;
 }
 
drivers/usb/gadget/pch_udc.c new file +2940 -0

2,940 lines not on this page · raw message

Signature · 1 line
1.6.2.5
#1 lore raw
Quoted 1 line · Toshiharu Okada

This patch adds the USB device driver of EG20T(Topcliff) PCH.

It seems several of the dev_<level> logging messages need to be terminated with a "\n"

[]

drivers/usb/gadget/pch_udc.c line 461

Quoted 11 lines
drivers/usb/gadget/pch_udc.c new file +11 -0
+static void pch_udc_csr_busy(struct pch_udc_dev *dev)
+{
+	unsigned int count = 200;
+
+	/* Wait till idle */
+	while ((pch_udc_readl(dev, UDC_CSR_BUSY_ADDR) & UDC_CSR_BUSY)
+		&& --count)
+		cpu_relax();
+	if (!count)
+		dev_err(&dev->pdev->dev, "%s: wait error", __func__);
+}

[]

Quoted 15 lines
drivers/usb/gadget/pch_udc.c new file +15 -0
+static void pch_udc_ep_clear_nak(struct pch_udc_ep *ep)
+{
+	unsigned int loopcnt = 0;
+	struct pch_udc_dev *dev = ep->dev;
+
+	if (!(pch_udc_ep_readl(ep, UDC_EPCTL_ADDR) & UDC_EPCTL_NAK))
+		return;
+	if (!ep->in) {
+		loopcnt = 10000;
+		while (!(pch_udc_read_ep_status(ep) & UDC_EPSTS_MRXFIFO_EMP) &&
+			--loopcnt)
+			udelay(5);
+		if (!loopcnt)
+			dev_err(&dev->pdev->dev, "%s: RxFIFO not Empty ",
+				__func__);

drivers/usb/gadget/pch_udc.c line 910

Quoted 10 lines
drivers/usb/gadget/pch_udc.c new file +10 -0
+	}
+	loopcnt = 10000;
+	while ((pch_udc_read_ep_control(ep) & UDC_EPCTL_NAK) && --loopcnt) {
+		pch_udc_ep_bit_set(ep, UDC_EPCTL_ADDR, UDC_EPCTL_CNAK);
+		udelay(5);
+	}
+	if (!loopcnt)
+		dev_err(&dev->pdev->dev, "%s: Clear NAK not set for ep%d%s",
+			__func__, ep->num, (ep->in ? "in" : "out"));
+}

etc and several more...

Can you check these and verify the need for newlines at the end of the formats and add them as appropriate?

#2 lore raw

Hi Joe

Thank you for your comment.

-----
Date: Wed, 10 Nov 2010 18:22:55 -0800
From: "Joe Perches" <[email protected]>

Quoted 6 lines

It seems several of the dev_<level> logging messages need to be terminated with a "\n"

[]

It was mistake.
I add "\n" to logging messages and resubmit.

Best regards
Toshiharu Okada (OKI SEMICONDUCTOR)