RE: DWC2 and/or S3C-HSOTG for STA2X11 board

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> From: Federico Vaga [mailto:federico.vaga@xxxxxxxxx]
> Sent: Monday, July 22, 2013 4:00 PM
> 
> > As part of the merge, we will need to develop a PCI wrapper for
> > s3c-hsotg anyway, so I think it would not be wasted effort.
> > Actually, as a POC I already did this as a quick hack, just to
> > make sure that the driver will work on our PCIe prototyping
> > platform (it does).
> >
> > As Felipe says, currently s3c-hsotg does have too much knowledge
> > of Samsung platform. But it should be fairly easy to move that
> > knowledge from the core code to a platform-device wrapper,
> > similar to platform.c in the dwc2 driver. So if you would like
> > to work on that (creating a PCI wrapper and a platform wrapper)
> > I think it would be useful.
> >
> > If you want, I can send you my hacked-up code for the PCI
> > version of the driver, to use as a starting point.
> 
> Yes, it will be really useful, thanks.
> 
> I will try to do both wrapper (PCI, platform), but I do not know how much
> time does it takes because I am really busy at the moment
> 
> You know the hardware better than me, so: have you other suggestion
> to point me on the right way?

Hi Federico,

Here is the patch. In it, I added a #define DWC_HSOTG_PCI, which if true
will compile the PCI code, otherwise the original S3C platform code will
be compiled. Of course, the final solution should not have any #ifdef's.

I renamed the core data structures and functions from s3c_* to
dwc_hsotg_*. The idea is, that code would be split out to a common file,
the S3C-specific code would remain in s3c-hsotg.c and keep the s3c_
prefix, and the PCI-specific code would be moved to a new file.

If you look towards the end of the patch, you will see a big #if/#else
block, where if DWC_HSOTG_PCI is true, dwc_hsotg_probe/dwc_hsotg_remove
functions are instantiated, otherwise s3c_hsotg_probe/s3c_hsotg_remove
functions. That is most of the code that would be split out into the PCI
and S3C wrappers, in addition to the #include's at the beginning. Then
most of the #ifdef DWC_HSOTG_PCI conditional code would be eliminated.

There is some more #ifdef DWC_HSOTG_PCI conditional code in the middle
of the patch, like the power supply, regulator, and phy stuff, as well
as some code that uses ARM-specific functions to read/write from the
FIFOs. That code still needs some thinking about how it can be moved
from the core code to the wrappers.

The patch is 7 or 8 months old, so I'm not sure exactly which kernel
version it applies to. I don't think the s3c-hsotg driver has changed
much recently, so that shouldn't cause too much of a problem.

-- 
Paul


diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
index a53be32..1b3ad55 100644
--- a/drivers/usb/gadget/Kconfig
+++ b/drivers/usb/gadget/Kconfig
@@ -273,7 +273,7 @@ config USB_PXA27X
 
 config USB_S3C_HSOTG
 	tristate "S3C HS/OtG USB Device controller"
-	depends on S3C_DEV_USB_HSOTG
+#	depends on S3C_DEV_USB_HSOTG
 	help
 	  The Samsung S3C64XX USB2.0 high-speed gadget controller
 	  integrated into the S3C64XX series SoC.
diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c
index 6f696ee..2f827f5 100644
--- a/drivers/usb/gadget/s3c-hsotg.c
+++ b/drivers/usb/gadget/s3c-hsotg.c
@@ -16,11 +16,19 @@
  * published by the Free Software Foundation.
  */
 
+#define DWC_HSOTG_PCI	1
+
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/spinlock.h>
 #include <linux/interrupt.h>
+
+#ifdef DWC_HSOTG_PCI
+#include <linux/pci.h>
+#else
 #include <linux/platform_device.h>
+#endif
+
 #include <linux/dma-mapping.h>
 #include <linux/debugfs.h>
 #include <linux/seq_file.h>
@@ -32,18 +40,30 @@
 
 #include <linux/usb/ch9.h>
 #include <linux/usb/gadget.h>
+
+#ifdef DWC_HSOTG_PCI
+#include <asm/io.h>
+#else
 #include <linux/platform_data/s3c-hsotg.h>
 
 #include <mach/map.h>
+#endif
 
 #include "s3c-hsotg.h"
 
+#ifdef DWC_HSOTG_PCI
+#define PCI_VENDOR_ID_SYNOPSYS		0x16c3
+#define PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3	0xabc0
+#endif
+
 #define DMA_ADDR_INVALID (~((dma_addr_t)0))
 
+#ifndef DWC_HSOTG_PCI
 static const char * const s3c_hsotg_supply_names[] = {
 	"vusb_d",		/* digital USB supply, 1.2V */
 	"vusb_a",		/* analog USB supply, 1.1V */
 };
+#endif
 
 /*
  * EP0_MPS_LIMIT
@@ -65,11 +85,11 @@ static const char * const s3c_hsotg_supply_names[] = {
  */
 #define EP0_MPS_LIMIT	64
 
-struct s3c_hsotg;
-struct s3c_hsotg_req;
+struct dwc_hsotg;
+struct dwc_hsotg_req;
 
 /**
- * struct s3c_hsotg_ep - driver endpoint definition.
+ * struct dwc_hsotg_ep - driver endpoint definition.
  * @ep: The gadget layer representation of the endpoint.
  * @name: The driver generated name for the endpoint.
  * @queue: Queue of requests for this endpoint.
@@ -105,11 +125,11 @@ struct s3c_hsotg_req;
  * as in shared-fifo mode periodic in acts like a single-frame packet
  * buffer than a fifo)
  */
-struct s3c_hsotg_ep {
+struct dwc_hsotg_ep {
 	struct usb_ep		ep;
 	struct list_head	queue;
-	struct s3c_hsotg	*parent;
-	struct s3c_hsotg_req	*req;
+	struct dwc_hsotg	*parent;
+	struct dwc_hsotg_req	*req;
 	struct dentry		*debugfs;
 
 
@@ -130,7 +150,7 @@ struct s3c_hsotg_ep {
 };
 
 /**
- * struct s3c_hsotg - driver state.
+ * struct dwc_hsotg - driver state.
  * @dev: The parent device supplied to the probe function
  * @driver: USB gadget driver
  * @plat: The platform specific configuration data.
@@ -150,21 +170,23 @@ struct s3c_hsotg_ep {
  * @last_rst: Time of last reset
  * @eps: The endpoints being supplied to the gadget framework
  */
-struct s3c_hsotg {
+struct dwc_hsotg {
 	struct device		 *dev;
 	struct usb_gadget_driver *driver;
-	struct s3c_hsotg_plat	 *plat;
+	struct dwc_hsotg_plat	 *plat;
 
-	spinlock_t              lock;
+	spinlock_t		lock;
 
 	void __iomem		*regs;
 	int			irq;
 	struct clk		*clk;
 
+#ifndef DWC_HSOTG_PCI
 	struct regulator_bulk_data supplies[ARRAY_SIZE(s3c_hsotg_supply_names)];
+#endif
 
 	unsigned int		dedicated_fifos:1;
-	unsigned char           num_of_eps;
+	unsigned char		num_of_eps;
 
 	struct dentry		*debug_root;
 	struct dentry		*debug_file;
@@ -177,18 +199,18 @@ struct s3c_hsotg {
 
 	struct usb_gadget	gadget;
 	unsigned int		setup;
-	unsigned long           last_rst;
-	struct s3c_hsotg_ep	*eps;
+	unsigned long		last_rst;
+	struct dwc_hsotg_ep	*eps;
 };
 
 /**
- * struct s3c_hsotg_req - data transfer request
+ * struct dwc_hsotg_req - data transfer request
  * @req: The USB gadget request
  * @queue: The list of requests for the endpoint this is queued for.
  * @in_progress: Has already had size/packets written to core
  * @mapped: DMA buffer for this request has been mapped via dma_map_single().
  */
-struct s3c_hsotg_req {
+struct dwc_hsotg_req {
 	struct usb_request	req;
 	struct list_head	queue;
 	unsigned char		in_progress;
@@ -196,19 +218,19 @@ struct s3c_hsotg_req {
 };
 
 /* conversion functions */
-static inline struct s3c_hsotg_req *our_req(struct usb_request *req)
+static inline struct dwc_hsotg_req *our_req(struct usb_request *req)
 {
-	return container_of(req, struct s3c_hsotg_req, req);
+	return container_of(req, struct dwc_hsotg_req, req);
 }
 
-static inline struct s3c_hsotg_ep *our_ep(struct usb_ep *ep)
+static inline struct dwc_hsotg_ep *our_ep(struct usb_ep *ep)
 {
-	return container_of(ep, struct s3c_hsotg_ep, ep);
+	return container_of(ep, struct dwc_hsotg_ep, ep);
 }
 
-static inline struct s3c_hsotg *to_hsotg(struct usb_gadget *gadget)
+static inline struct dwc_hsotg *to_hsotg(struct usb_gadget *gadget)
 {
-	return container_of(gadget, struct s3c_hsotg, gadget);
+	return container_of(gadget, struct dwc_hsotg, gadget);
 }
 
 static inline void __orr32(void __iomem *ptr, u32 val)
@@ -222,7 +244,7 @@ static inline void __bic32(void __iomem *ptr, u32 val)
 }
 
 /* forward decleration of functions */
-static void s3c_hsotg_dump(struct s3c_hsotg *hsotg);
+static void dwc_hsotg_dump(struct dwc_hsotg *hsotg);
 
 /**
  * using_dma - return the DMA status of the driver.
@@ -243,17 +265,21 @@ static void s3c_hsotg_dump(struct s3c_hsotg *hsotg);
  *
  * Until this issue is sorted out, we always return 'false'.
  */
-static inline bool using_dma(struct s3c_hsotg *hsotg)
+static inline bool using_dma(struct dwc_hsotg *hsotg)
 {
+#ifdef DWC_HSOTG_PCI
+	return true;
+#else
 	return false;	/* support is not complete */
+#endif
 }
 
 /**
- * s3c_hsotg_en_gsint - enable one or more of the general interrupt
+ * dwc_hsotg_en_gsint - enable one or more of the general interrupt
  * @hsotg: The device state
  * @ints: A bitmask of the interrupts to enable
  */
-static void s3c_hsotg_en_gsint(struct s3c_hsotg *hsotg, u32 ints)
+static void dwc_hsotg_en_gsint(struct dwc_hsotg *hsotg, u32 ints)
 {
 	u32 gsintmsk = readl(hsotg->regs + GINTMSK);
 	u32 new_gsintmsk;
@@ -267,11 +293,11 @@ static void s3c_hsotg_en_gsint(struct s3c_hsotg *hsotg, u32 ints)
 }
 
 /**
- * s3c_hsotg_disable_gsint - disable one or more of the general interrupt
+ * dwc_hsotg_disable_gsint - disable one or more of the general interrupt
  * @hsotg: The device state
  * @ints: A bitmask of the interrupts to enable
  */
-static void s3c_hsotg_disable_gsint(struct s3c_hsotg *hsotg, u32 ints)
+static void dwc_hsotg_disable_gsint(struct dwc_hsotg *hsotg, u32 ints)
 {
 	u32 gsintmsk = readl(hsotg->regs + GINTMSK);
 	u32 new_gsintmsk;
@@ -283,7 +309,7 @@ static void s3c_hsotg_disable_gsint(struct s3c_hsotg *hsotg, u32 ints)
 }
 
 /**
- * s3c_hsotg_ctrl_epint - enable/disable an endpoint irq
+ * dwc_hsotg_ctrl_epint - enable/disable an endpoint irq
  * @hsotg: The device state
  * @ep: The endpoint index
  * @dir_in: True if direction is in.
@@ -292,7 +318,7 @@ static void s3c_hsotg_disable_gsint(struct s3c_hsotg *hsotg, u32 ints)
  * Set or clear the mask for an individual endpoint's interrupt
  * request.
  */
-static void s3c_hsotg_ctrl_epint(struct s3c_hsotg *hsotg,
+static void dwc_hsotg_ctrl_epint(struct dwc_hsotg *hsotg,
 				 unsigned int ep, unsigned int dir_in,
 				 unsigned int en)
 {
@@ -314,10 +340,10 @@ static void s3c_hsotg_ctrl_epint(struct s3c_hsotg *hsotg,
 }
 
 /**
- * s3c_hsotg_init_fifo - initialise non-periodic FIFOs
+ * dwc_hsotg_init_fifo - initialise non-periodic FIFOs
  * @hsotg: The device instance.
  */
-static void s3c_hsotg_init_fifo(struct s3c_hsotg *hsotg)
+static void dwc_hsotg_init_fifo(struct dwc_hsotg *hsotg)
 {
 	unsigned int ep;
 	unsigned int addr;
@@ -376,6 +402,7 @@ static void s3c_hsotg_init_fifo(struct s3c_hsotg *hsotg)
 			dev_err(hsotg->dev,
 				"%s: timeout flushing fifos (GRSTCTL=%08x)\n",
 				__func__, val);
+			break;
 		}
 
 		udelay(1);
@@ -390,12 +417,12 @@ static void s3c_hsotg_init_fifo(struct s3c_hsotg *hsotg)
  *
  * Allocate a new USB request structure appropriate for the specified endpoint
  */
-static struct usb_request *s3c_hsotg_ep_alloc_request(struct usb_ep *ep,
+static struct usb_request *dwc_hsotg_ep_alloc_request(struct usb_ep *ep,
 						      gfp_t flags)
 {
-	struct s3c_hsotg_req *req;
+	struct dwc_hsotg_req *req;
 
-	req = kzalloc(sizeof(struct s3c_hsotg_req), flags);
+	req = kzalloc(sizeof(struct dwc_hsotg_req), flags);
 	if (!req)
 		return NULL;
 
@@ -412,23 +439,23 @@ static struct usb_request *s3c_hsotg_ep_alloc_request(struct usb_ep *ep,
  * Returns true if the endpoint is in periodic mode, meaning it is being
  * used for an Interrupt or ISO transfer.
  */
-static inline int is_ep_periodic(struct s3c_hsotg_ep *hs_ep)
+static inline int is_ep_periodic(struct dwc_hsotg_ep *hs_ep)
 {
 	return hs_ep->periodic;
 }
 
 /**
- * s3c_hsotg_unmap_dma - unmap the DMA memory being used for the request
+ * dwc_hsotg_unmap_dma - unmap the DMA memory being used for the request
  * @hsotg: The device state.
  * @hs_ep: The endpoint for the request
  * @hs_req: The request being processed.
  *
- * This is the reverse of s3c_hsotg_map_dma(), called for the completion
+ * This is the reverse of dwc_hsotg_map_dma(), called for the completion
  * of a request to ensure the buffer is ready for access by the caller.
  */
-static void s3c_hsotg_unmap_dma(struct s3c_hsotg *hsotg,
-				struct s3c_hsotg_ep *hs_ep,
-				struct s3c_hsotg_req *hs_req)
+static void dwc_hsotg_unmap_dma(struct dwc_hsotg *hsotg,
+				struct dwc_hsotg_ep *hs_ep,
+				struct dwc_hsotg_req *hs_req)
 {
 	struct usb_request *req = &hs_req->req;
 	enum dma_data_direction dir;
@@ -452,7 +479,7 @@ static void s3c_hsotg_unmap_dma(struct s3c_hsotg *hsotg,
 }
 
 /**
- * s3c_hsotg_write_fifo - write packet Data to the TxFIFO
+ * dwc_hsotg_write_fifo - write packet Data to the TxFIFO
  * @hsotg: The controller state.
  * @hs_ep: The endpoint we're going to write for.
  * @hs_req: The request to write data for.
@@ -467,9 +494,9 @@ static void s3c_hsotg_unmap_dma(struct s3c_hsotg *hsotg,
  *
  * This routine is only needed for PIO
  */
-static int s3c_hsotg_write_fifo(struct s3c_hsotg *hsotg,
-				struct s3c_hsotg_ep *hs_ep,
-				struct s3c_hsotg_req *hs_req)
+static int dwc_hsotg_write_fifo(struct dwc_hsotg *hsotg,
+				struct dwc_hsotg_ep *hs_ep,
+				struct dwc_hsotg_req *hs_req)
 {
 	bool periodic = is_ep_periodic(hs_ep);
 	u32 gnptxsts = readl(hsotg->regs + GNPTXSTS);
@@ -502,7 +529,7 @@ static int s3c_hsotg_write_fifo(struct s3c_hsotg *hsotg,
 		 * previous data has been completely sent.
 		 */
 		if (hs_ep->fifo_load != 0) {
-			s3c_hsotg_en_gsint(hsotg, GINTSTS_PTxFEmp);
+			dwc_hsotg_en_gsint(hsotg, GINTSTS_PTxFEmp);
 			return -ENOSPC;
 		}
 
@@ -523,7 +550,7 @@ static int s3c_hsotg_write_fifo(struct s3c_hsotg *hsotg,
 			__func__, can_write);
 
 		if (can_write <= 0) {
-			s3c_hsotg_en_gsint(hsotg, GINTSTS_PTxFEmp);
+			dwc_hsotg_en_gsint(hsotg, GINTSTS_PTxFEmp);
 			return -ENOSPC;
 		}
 	} else if (hsotg->dedicated_fifos && hs_ep->index != 0) {
@@ -537,7 +564,7 @@ static int s3c_hsotg_write_fifo(struct s3c_hsotg *hsotg,
 				"%s: no queue slots available (0x%08x)\n",
 				__func__, gnptxsts);
 
-			s3c_hsotg_en_gsint(hsotg, GINTSTS_NPTxFEmp);
+			dwc_hsotg_en_gsint(hsotg, GINTSTS_NPTxFEmp);
 			return -ENOSPC;
 		}
 
@@ -564,7 +591,7 @@ static int s3c_hsotg_write_fifo(struct s3c_hsotg *hsotg,
 	if (to_write > hs_ep->ep.maxpacket) {
 		to_write = hs_ep->ep.maxpacket;
 
-		s3c_hsotg_en_gsint(hsotg,
+		dwc_hsotg_en_gsint(hsotg,
 				   periodic ? GINTSTS_PTxFEmp :
 				   GINTSTS_NPTxFEmp);
 	}
@@ -591,7 +618,7 @@ static int s3c_hsotg_write_fifo(struct s3c_hsotg *hsotg,
 		 * is more room left.
 		 */
 
-		s3c_hsotg_en_gsint(hsotg,
+		dwc_hsotg_en_gsint(hsotg,
 				   periodic ? GINTSTS_PTxFEmp :
 				   GINTSTS_NPTxFEmp);
 	}
@@ -611,7 +638,18 @@ static int s3c_hsotg_write_fifo(struct s3c_hsotg *hsotg,
 	to_write = DIV_ROUND_UP(to_write, 4);
 	data = hs_req->req.buf + buf_pos;
 
+#ifdef DWC_HSOTG_PCI
+	{
+		u32 __iomem *_fifo = hsotg->regs + EPFIFO(hs_ep->index);
+		u32 *_data = data;
+		int i;
+
+		for (i = 0; i < to_write; i++)
+			writel(_data[i], &_fifo[i]);
+	}
+#else
 	writesl(hsotg->regs + EPFIFO(hs_ep->index), data, to_write);
+#endif
 
 	return (to_write >= can_write) ? -ENOSPC : 0;
 }
@@ -623,7 +661,7 @@ static int s3c_hsotg_write_fifo(struct s3c_hsotg *hsotg,
  * Return the maximum data that can be queued in one go on a given endpoint
  * so that transfers that are too long can be split.
  */
-static unsigned get_ep_limit(struct s3c_hsotg_ep *hs_ep)
+static unsigned get_ep_limit(struct dwc_hsotg_ep *hs_ep)
 {
 	int index = hs_ep->index;
 	unsigned maxsize;
@@ -656,7 +694,7 @@ static unsigned get_ep_limit(struct s3c_hsotg_ep *hs_ep)
 }
 
 /**
- * s3c_hsotg_start_req - start a USB request from an endpoint's queue
+ * dwc_hsotg_start_req - start a USB request from an endpoint's queue
  * @hsotg: The controller state.
  * @hs_ep: The endpoint to process a request for
  * @hs_req: The request to start.
@@ -665,9 +703,9 @@ static unsigned get_ep_limit(struct s3c_hsotg_ep *hs_ep)
  * Start the given request running by setting the endpoint registers
  * appropriately, and writing any data to the FIFOs.
  */
-static void s3c_hsotg_start_req(struct s3c_hsotg *hsotg,
-				struct s3c_hsotg_ep *hs_ep,
-				struct s3c_hsotg_req *hs_req,
+static void dwc_hsotg_start_req(struct dwc_hsotg *hsotg,
+				struct dwc_hsotg_ep *hs_ep,
+				struct dwc_hsotg_req *hs_req,
 				bool continuing)
 {
 	struct usb_request *ureq = &hs_req->req;
@@ -714,8 +752,8 @@ static void s3c_hsotg_start_req(struct s3c_hsotg *hsotg,
 		ureq->length, ureq->actual);
 	if (0)
 		dev_dbg(hsotg->dev,
-			"REQ buf %p len %d dma 0x%08x noi=%d zp=%d snok=%d\n",
-			ureq->buf, length, ureq->dma,
+			"REQ buf %p len %d dma 0x%08llx noi=%d zp=%d snok=%d\n",
+			ureq->buf, length, (unsigned long long)ureq->dma,
 			ureq->no_interrupt, ureq->zero, ureq->short_not_ok);
 
 	maxreq = get_ep_limit(hs_ep);
@@ -769,14 +807,14 @@ static void s3c_hsotg_start_req(struct s3c_hsotg *hsotg,
 
 		/*
 		 * write DMA address to control register, buffer already
-		 * synced by s3c_hsotg_ep_queue().
+		 * synced by dwc_hsotg_ep_queue().
 		 */
 
 		dma_reg = dir_in ? DIEPDMA(index) : DOEPDMA(index);
 		writel(ureq->dma, hsotg->regs + dma_reg);
 
-		dev_dbg(hsotg->dev, "%s: 0x%08x => 0x%08x\n",
-			__func__, ureq->dma, dma_reg);
+		dev_dbg(hsotg->dev, "%s: 0x%08llx => 0x%08x\n",
+			__func__, (unsigned long long)ureq->dma, dma_reg);
 	}
 
 	ctrl |= DxEPCTL_EPEna;	/* ensure ep enabled */
@@ -806,7 +844,7 @@ static void s3c_hsotg_start_req(struct s3c_hsotg *hsotg,
 		/* set these anyway, we may need them for non-periodic in */
 		hs_ep->fifo_load = 0;
 
-		s3c_hsotg_write_fifo(hsotg, hs_ep, hs_req);
+		dwc_hsotg_write_fifo(hsotg, hs_ep, hs_req);
 	}
 
 	/*
@@ -833,7 +871,7 @@ static void s3c_hsotg_start_req(struct s3c_hsotg *hsotg,
 }
 
 /**
- * s3c_hsotg_map_dma - map the DMA memory being used for the request
+ * dwc_hsotg_map_dma - map the DMA memory being used for the request
  * @hsotg: The device state.
  * @hs_ep: The endpoint the request is on.
  * @req: The request being processed.
@@ -844,12 +882,12 @@ static void s3c_hsotg_start_req(struct s3c_hsotg *hsotg,
  * DMA memory, then we map the memory and mark our request to allow us to
  * cleanup on completion.
  */
-static int s3c_hsotg_map_dma(struct s3c_hsotg *hsotg,
-			     struct s3c_hsotg_ep *hs_ep,
+static int dwc_hsotg_map_dma(struct dwc_hsotg *hsotg,
+			     struct dwc_hsotg_ep *hs_ep,
 			     struct usb_request *req)
 {
 	enum dma_data_direction dir;
-	struct s3c_hsotg_req *hs_req = our_req(req);
+	struct dwc_hsotg_req *hs_req = our_req(req);
 
 	dir = hs_ep->dir_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE;
 
@@ -889,12 +927,12 @@ dma_error:
 	return -EIO;
 }
 
-static int s3c_hsotg_ep_queue(struct usb_ep *ep, struct usb_request *req,
+static int dwc_hsotg_ep_queue(struct usb_ep *ep, struct usb_request *req,
 			      gfp_t gfp_flags)
 {
-	struct s3c_hsotg_req *hs_req = our_req(req);
-	struct s3c_hsotg_ep *hs_ep = our_ep(ep);
-	struct s3c_hsotg *hs = hs_ep->parent;
+	struct dwc_hsotg_req *hs_req = our_req(req);
+	struct dwc_hsotg_ep *hs_ep = our_ep(ep);
+	struct dwc_hsotg *hs = hs_ep->parent;
 	bool first;
 
 	dev_dbg(hs->dev, "%s: req %p: %d@%p, noi=%d, zero=%d, snok=%d\n",
@@ -908,7 +946,7 @@ static int s3c_hsotg_ep_queue(struct usb_ep *ep, struct usb_request *req,
 
 	/* if we're using DMA, sync the buffers as necessary */
 	if (using_dma(hs)) {
-		int ret = s3c_hsotg_map_dma(hs, hs_ep, req);
+		int ret = dwc_hsotg_map_dma(hs, hs_ep, req);
 		if (ret)
 			return ret;
 	}
@@ -917,51 +955,51 @@ static int s3c_hsotg_ep_queue(struct usb_ep *ep, struct usb_request *req,
 	list_add_tail(&hs_req->queue, &hs_ep->queue);
 
 	if (first)
-		s3c_hsotg_start_req(hs, hs_ep, hs_req, false);
+		dwc_hsotg_start_req(hs, hs_ep, hs_req, false);
 
 	return 0;
 }
 
-static int s3c_hsotg_ep_queue_lock(struct usb_ep *ep, struct usb_request *req,
+static int dwc_hsotg_ep_queue_lock(struct usb_ep *ep, struct usb_request *req,
 			      gfp_t gfp_flags)
 {
-	struct s3c_hsotg_ep *hs_ep = our_ep(ep);
-	struct s3c_hsotg *hs = hs_ep->parent;
+	struct dwc_hsotg_ep *hs_ep = our_ep(ep);
+	struct dwc_hsotg *hs = hs_ep->parent;
 	unsigned long flags = 0;
 	int ret = 0;
 
 	spin_lock_irqsave(&hs->lock, flags);
-	ret = s3c_hsotg_ep_queue(ep, req, gfp_flags);
+	ret = dwc_hsotg_ep_queue(ep, req, gfp_flags);
 	spin_unlock_irqrestore(&hs->lock, flags);
 
 	return ret;
 }
 
-static void s3c_hsotg_ep_free_request(struct usb_ep *ep,
+static void dwc_hsotg_ep_free_request(struct usb_ep *ep,
 				      struct usb_request *req)
 {
-	struct s3c_hsotg_req *hs_req = our_req(req);
+	struct dwc_hsotg_req *hs_req = our_req(req);
 
 	kfree(hs_req);
 }
 
 /**
- * s3c_hsotg_complete_oursetup - setup completion callback
+ * dwc_hsotg_complete_oursetup - setup completion callback
  * @ep: The endpoint the request was on.
  * @req: The request completed.
  *
  * Called on completion of any requests the driver itself
  * submitted that need cleaning up.
  */
-static void s3c_hsotg_complete_oursetup(struct usb_ep *ep,
+static void dwc_hsotg_complete_oursetup(struct usb_ep *ep,
 					struct usb_request *req)
 {
-	struct s3c_hsotg_ep *hs_ep = our_ep(ep);
-	struct s3c_hsotg *hsotg = hs_ep->parent;
+	struct dwc_hsotg_ep *hs_ep = our_ep(ep);
+	struct dwc_hsotg *hsotg = hs_ep->parent;
 
 	dev_dbg(hsotg->dev, "%s: ep %p, req %p\n", __func__, ep, req);
 
-	s3c_hsotg_ep_free_request(ep, req);
+	dwc_hsotg_ep_free_request(ep, req);
 }
 
 /**
@@ -972,10 +1010,10 @@ static void s3c_hsotg_complete_oursetup(struct usb_ep *ep,
  * Convert the given wIndex into a pointer to an driver endpoint
  * structure, or return NULL if it is not a valid endpoint.
  */
-static struct s3c_hsotg_ep *ep_from_windex(struct s3c_hsotg *hsotg,
+static struct dwc_hsotg_ep *ep_from_windex(struct dwc_hsotg *hsotg,
 					   u32 windex)
 {
-	struct s3c_hsotg_ep *ep = &hsotg->eps[windex & 0x7F];
+	struct dwc_hsotg_ep *ep = &hsotg->eps[windex & 0x7F];
 	int dir = (windex & USB_DIR_IN) ? 1 : 0;
 	int idx = windex & 0x7F;
 
@@ -992,7 +1030,7 @@ static struct s3c_hsotg_ep *ep_from_windex(struct s3c_hsotg *hsotg,
 }
 
 /**
- * s3c_hsotg_send_reply - send reply to control request
+ * dwc_hsotg_send_reply - send reply to control request
  * @hsotg: The device state
  * @ep: Endpoint 0
  * @buff: Buffer for request
@@ -1001,8 +1039,8 @@ static struct s3c_hsotg_ep *ep_from_windex(struct s3c_hsotg *hsotg,
  * Create a request and queue it on the given endpoint. This is useful as
  * an internal method of sending replies to certain control requests, etc.
  */
-static int s3c_hsotg_send_reply(struct s3c_hsotg *hsotg,
-				struct s3c_hsotg_ep *ep,
+static int dwc_hsotg_send_reply(struct dwc_hsotg *hsotg,
+				struct dwc_hsotg_ep *ep,
 				void *buff,
 				int length)
 {
@@ -1011,7 +1049,7 @@ static int s3c_hsotg_send_reply(struct s3c_hsotg *hsotg,
 
 	dev_dbg(hsotg->dev, "%s: buff %p, len %d\n", __func__, buff, length);
 
-	req = s3c_hsotg_ep_alloc_request(&ep->ep, GFP_ATOMIC);
+	req = dwc_hsotg_ep_alloc_request(&ep->ep, GFP_ATOMIC);
 	hsotg->ep0_reply = req;
 	if (!req) {
 		dev_warn(hsotg->dev, "%s: cannot alloc req\n", __func__);
@@ -1021,14 +1059,14 @@ static int s3c_hsotg_send_reply(struct s3c_hsotg *hsotg,
 	req->buf = hsotg->ep0_buff;
 	req->length = length;
 	req->zero = 1; /* always do zero-length final transfer */
-	req->complete = s3c_hsotg_complete_oursetup;
+	req->complete = dwc_hsotg_complete_oursetup;
 
 	if (length)
 		memcpy(req->buf, buff, length);
 	else
 		ep->sent_zlp = 1;
 
-	ret = s3c_hsotg_ep_queue(&ep->ep, req, GFP_ATOMIC);
+	ret = dwc_hsotg_ep_queue(&ep->ep, req, GFP_ATOMIC);
 	if (ret) {
 		dev_warn(hsotg->dev, "%s: cannot queue req\n", __func__);
 		return ret;
@@ -1038,15 +1076,15 @@ static int s3c_hsotg_send_reply(struct s3c_hsotg *hsotg,
 }
 
 /**
- * s3c_hsotg_process_req_status - process request GET_STATUS
+ * dwc_hsotg_process_req_status - process request GET_STATUS
  * @hsotg: The device state
  * @ctrl: USB control request
  */
-static int s3c_hsotg_process_req_status(struct s3c_hsotg *hsotg,
+static int dwc_hsotg_process_req_status(struct dwc_hsotg *hsotg,
 					struct usb_ctrlrequest *ctrl)
 {
-	struct s3c_hsotg_ep *ep0 = &hsotg->eps[0];
-	struct s3c_hsotg_ep *ep;
+	struct dwc_hsotg_ep *ep0 = &hsotg->eps[0];
+	struct dwc_hsotg_ep *ep;
 	__le16 reply;
 	int ret;
 
@@ -1083,7 +1121,7 @@ static int s3c_hsotg_process_req_status(struct s3c_hsotg *hsotg,
 	if (le16_to_cpu(ctrl->wLength) != 2)
 		return -EINVAL;
 
-	ret = s3c_hsotg_send_reply(hsotg, ep0, &reply, 2);
+	ret = dwc_hsotg_send_reply(hsotg, ep0, &reply, 2);
 	if (ret) {
 		dev_err(hsotg->dev, "%s: failed to send reply\n", __func__);
 		return ret;
@@ -1092,7 +1130,7 @@ static int s3c_hsotg_process_req_status(struct s3c_hsotg *hsotg,
 	return 1;
 }
 
-static int s3c_hsotg_ep_sethalt(struct usb_ep *ep, int value);
+static int dwc_hsotg_ep_sethalt(struct usb_ep *ep, int value);
 
 /**
  * get_ep_head - return the first request on the endpoint
@@ -1100,27 +1138,27 @@ static int s3c_hsotg_ep_sethalt(struct usb_ep *ep, int value);
  *
  * Get the first request on the endpoint.
  */
-static struct s3c_hsotg_req *get_ep_head(struct s3c_hsotg_ep *hs_ep)
+static struct dwc_hsotg_req *get_ep_head(struct dwc_hsotg_ep *hs_ep)
 {
 	if (list_empty(&hs_ep->queue))
 		return NULL;
 
-	return list_first_entry(&hs_ep->queue, struct s3c_hsotg_req, queue);
+	return list_first_entry(&hs_ep->queue, struct dwc_hsotg_req, queue);
 }
 
 /**
- * s3c_hsotg_process_req_featire - process request {SET,CLEAR}_FEATURE
+ * dwc_hsotg_process_req_featire - process request {SET,CLEAR}_FEATURE
  * @hsotg: The device state
  * @ctrl: USB control request
  */
-static int s3c_hsotg_process_req_feature(struct s3c_hsotg *hsotg,
+static int dwc_hsotg_process_req_feature(struct dwc_hsotg *hsotg,
 					 struct usb_ctrlrequest *ctrl)
 {
-	struct s3c_hsotg_ep *ep0 = &hsotg->eps[0];
-	struct s3c_hsotg_req *hs_req;
+	struct dwc_hsotg_ep *ep0 = &hsotg->eps[0];
+	struct dwc_hsotg_req *hs_req;
 	bool restart;
 	bool set = (ctrl->bRequest == USB_REQ_SET_FEATURE);
-	struct s3c_hsotg_ep *ep;
+	struct dwc_hsotg_ep *ep;
 	int ret;
 
 	dev_dbg(hsotg->dev, "%s: %s_FEATURE\n",
@@ -1136,9 +1174,9 @@ static int s3c_hsotg_process_req_feature(struct s3c_hsotg *hsotg,
 
 		switch (le16_to_cpu(ctrl->wValue)) {
 		case USB_ENDPOINT_HALT:
-			s3c_hsotg_ep_sethalt(&ep->ep, set);
+			dwc_hsotg_ep_sethalt(&ep->ep, set);
 
-			ret = s3c_hsotg_send_reply(hsotg, ep0, NULL, 0);
+			ret = dwc_hsotg_send_reply(hsotg, ep0, NULL, 0);
 			if (ret) {
 				dev_err(hsotg->dev,
 					"%s: failed to send reply\n", __func__);
@@ -1162,7 +1200,7 @@ static int s3c_hsotg_process_req_feature(struct s3c_hsotg *hsotg,
 				restart = !list_empty(&ep->queue);
 				if (restart) {
 					hs_req = get_ep_head(ep);
-					s3c_hsotg_start_req(hsotg, ep,
+					dwc_hsotg_start_req(hsotg, ep,
 							    hs_req, false);
 				}
 			}
@@ -1179,7 +1217,7 @@ static int s3c_hsotg_process_req_feature(struct s3c_hsotg *hsotg,
 }
 
 /**
- * s3c_hsotg_process_control - process a control request
+ * dwc_hsotg_process_control - process a control request
  * @hsotg: The device state
  * @ctrl: The control request received
  *
@@ -1187,10 +1225,10 @@ static int s3c_hsotg_process_req_feature(struct s3c_hsotg *hsotg,
  * needs to work out what to do next (and whether to pass it on to the
  * gadget driver).
  */
-static void s3c_hsotg_process_control(struct s3c_hsotg *hsotg,
+static void dwc_hsotg_process_control(struct dwc_hsotg *hsotg,
 				      struct usb_ctrlrequest *ctrl)
 {
-	struct s3c_hsotg_ep *ep0 = &hsotg->eps[0];
+	struct dwc_hsotg_ep *ep0 = &hsotg->eps[0];
 	int ret = 0;
 	u32 dcfg;
 
@@ -1225,16 +1263,16 @@ static void s3c_hsotg_process_control(struct s3c_hsotg *hsotg,
 
 			dev_info(hsotg->dev, "new address %d\n", ctrl->wValue);
 
-			ret = s3c_hsotg_send_reply(hsotg, ep0, NULL, 0);
+			ret = dwc_hsotg_send_reply(hsotg, ep0, NULL, 0);
 			return;
 
 		case USB_REQ_GET_STATUS:
-			ret = s3c_hsotg_process_req_status(hsotg, ctrl);
+			ret = dwc_hsotg_process_req_status(hsotg, ctrl);
 			break;
 
 		case USB_REQ_CLEAR_FEATURE:
 		case USB_REQ_SET_FEATURE:
-			ret = s3c_hsotg_process_req_feature(hsotg, ctrl);
+			ret = dwc_hsotg_process_req_feature(hsotg, ctrl);
 			break;
 		}
 	}
@@ -1280,21 +1318,21 @@ static void s3c_hsotg_process_control(struct s3c_hsotg *hsotg,
 	}
 }
 
-static void s3c_hsotg_enqueue_setup(struct s3c_hsotg *hsotg);
+static void dwc_hsotg_enqueue_setup(struct dwc_hsotg *hsotg);
 
 /**
- * s3c_hsotg_complete_setup - completion of a setup transfer
+ * dwc_hsotg_complete_setup - completion of a setup transfer
  * @ep: The endpoint the request was on.
  * @req: The request completed.
  *
  * Called on completion of any requests the driver itself submitted for
  * EP0 setup packets
  */
-static void s3c_hsotg_complete_setup(struct usb_ep *ep,
+static void dwc_hsotg_complete_setup(struct usb_ep *ep,
 				     struct usb_request *req)
 {
-	struct s3c_hsotg_ep *hs_ep = our_ep(ep);
-	struct s3c_hsotg *hsotg = hs_ep->parent;
+	struct dwc_hsotg_ep *hs_ep = our_ep(ep);
+	struct dwc_hsotg *hsotg = hs_ep->parent;
 
 	if (req->status < 0) {
 		dev_dbg(hsotg->dev, "%s: failed %d\n", __func__, req->status);
@@ -1302,22 +1340,22 @@ static void s3c_hsotg_complete_setup(struct usb_ep *ep,
 	}
 
 	if (req->actual == 0)
-		s3c_hsotg_enqueue_setup(hsotg);
+		dwc_hsotg_enqueue_setup(hsotg);
 	else
-		s3c_hsotg_process_control(hsotg, req->buf);
+		dwc_hsotg_process_control(hsotg, req->buf);
 }
 
 /**
- * s3c_hsotg_enqueue_setup - start a request for EP0 packets
+ * dwc_hsotg_enqueue_setup - start a request for EP0 packets
  * @hsotg: The device state.
  *
  * Enqueue a request on EP0 if necessary to received any SETUP packets
  * received from the host.
  */
-static void s3c_hsotg_enqueue_setup(struct s3c_hsotg *hsotg)
+static void dwc_hsotg_enqueue_setup(struct dwc_hsotg *hsotg)
 {
 	struct usb_request *req = hsotg->ctrl_req;
-	struct s3c_hsotg_req *hs_req = our_req(req);
+	struct dwc_hsotg_req *hs_req = our_req(req);
 	int ret;
 
 	dev_dbg(hsotg->dev, "%s: queueing setup request\n", __func__);
@@ -1325,7 +1363,7 @@ static void s3c_hsotg_enqueue_setup(struct s3c_hsotg *hsotg)
 	req->zero = 0;
 	req->length = 8;
 	req->buf = hsotg->ctrl_buff;
-	req->complete = s3c_hsotg_complete_setup;
+	req->complete = dwc_hsotg_complete_setup;
 
 	if (!list_empty(&hs_req->queue)) {
 		dev_dbg(hsotg->dev, "%s already queued???\n", __func__);
@@ -1334,7 +1372,7 @@ static void s3c_hsotg_enqueue_setup(struct s3c_hsotg *hsotg)
 
 	hsotg->eps[0].dir_in = 0;
 
-	ret = s3c_hsotg_ep_queue(&hsotg->eps[0].ep, req, GFP_ATOMIC);
+	ret = dwc_hsotg_ep_queue(&hsotg->eps[0].ep, req, GFP_ATOMIC);
 	if (ret < 0) {
 		dev_err(hsotg->dev, "%s: failed queue (%d)\n", __func__, ret);
 		/*
@@ -1345,7 +1383,7 @@ static void s3c_hsotg_enqueue_setup(struct s3c_hsotg *hsotg)
 }
 
 /**
- * s3c_hsotg_complete_request - complete a request given to us
+ * dwc_hsotg_complete_request - complete a request given to us
  * @hsotg: The device state.
  * @hs_ep: The endpoint the request was on.
  * @hs_req: The request to complete.
@@ -1357,9 +1395,9 @@ static void s3c_hsotg_enqueue_setup(struct s3c_hsotg *hsotg)
  *
  * Note, expects the ep to already be locked as appropriate.
  */
-static void s3c_hsotg_complete_request(struct s3c_hsotg *hsotg,
-				       struct s3c_hsotg_ep *hs_ep,
-				       struct s3c_hsotg_req *hs_req,
+static void dwc_hsotg_complete_request(struct dwc_hsotg *hsotg,
+				       struct dwc_hsotg_ep *hs_ep,
+				       struct dwc_hsotg_req *hs_req,
 				       int result)
 {
 	bool restart;
@@ -1384,7 +1422,7 @@ static void s3c_hsotg_complete_request(struct s3c_hsotg *hsotg,
 	list_del_init(&hs_req->queue);
 
 	if (using_dma(hsotg))
-		s3c_hsotg_unmap_dma(hsotg, hs_ep, hs_req);
+		dwc_hsotg_unmap_dma(hsotg, hs_ep, hs_req);
 
 	/*
 	 * call the complete request with the locks off, just in case the
@@ -1407,13 +1445,13 @@ static void s3c_hsotg_complete_request(struct s3c_hsotg *hsotg,
 		restart = !list_empty(&hs_ep->queue);
 		if (restart) {
 			hs_req = get_ep_head(hs_ep);
-			s3c_hsotg_start_req(hsotg, hs_ep, hs_req, false);
+			dwc_hsotg_start_req(hsotg, hs_ep, hs_req, false);
 		}
 	}
 }
 
 /**
- * s3c_hsotg_rx_data - receive data from the FIFO for an endpoint
+ * dwc_hsotg_rx_data - receive data from the FIFO for an endpoint
  * @hsotg: The device state.
  * @ep_idx: The endpoint index for the data
  * @size: The size of data in the fifo, in bytes
@@ -1422,10 +1460,10 @@ static void s3c_hsotg_complete_request(struct s3c_hsotg *hsotg,
  * endpoint, so sort out whether we need to read the data into a request
  * that has been made for that endpoint.
  */
-static void s3c_hsotg_rx_data(struct s3c_hsotg *hsotg, int ep_idx, int size)
+static void dwc_hsotg_rx_data(struct dwc_hsotg *hsotg, int ep_idx, int size)
 {
-	struct s3c_hsotg_ep *hs_ep = &hsotg->eps[ep_idx];
-	struct s3c_hsotg_req *hs_req = hs_ep->req;
+	struct dwc_hsotg_ep *hs_ep = &hsotg->eps[ep_idx];
+	struct dwc_hsotg_req *hs_req = hs_ep->req;
 	void __iomem *fifo = hsotg->regs + EPFIFO(ep_idx);
 	int to_read;
 	int max_req;
@@ -1472,11 +1510,22 @@ static void s3c_hsotg_rx_data(struct s3c_hsotg *hsotg, int ep_idx, int size)
 	 * note, we might over-write the buffer end by 3 bytes depending on
 	 * alignment of the data.
 	 */
+#ifdef DWC_HSOTG_PCI
+	{
+		u32 __iomem *_fifo = fifo;
+		u32 *_data = hs_req->req.buf + read_ptr;
+		int i;
+
+		for (i = 0; i < to_read; i++)
+			_data[i] = readl(&_fifo[i]);
+	}
+#else
 	readsl(fifo, hs_req->req.buf + read_ptr, to_read);
+#endif
 }
 
 /**
- * s3c_hsotg_send_zlp - send zero-length packet on control endpoint
+ * dwc_hsotg_send_zlp - send zero-length packet on control endpoint
  * @hsotg: The device instance
  * @req: The request currently on this endpoint
  *
@@ -1487,8 +1536,8 @@ static void s3c_hsotg_rx_data(struct s3c_hsotg *hsotg, int ep_idx, int size)
  * currently believed that we do not need to wait for any space in
  * the TxFIFO.
  */
-static void s3c_hsotg_send_zlp(struct s3c_hsotg *hsotg,
-			       struct s3c_hsotg_req *req)
+static void dwc_hsotg_send_zlp(struct dwc_hsotg *hsotg,
+			       struct dwc_hsotg_req *req)
 {
 	u32 ctrl;
 
@@ -1499,7 +1548,7 @@ static void s3c_hsotg_send_zlp(struct s3c_hsotg *hsotg,
 
 	if (req->req.length == 0) {
 		hsotg->eps[0].sent_zlp = 1;
-		s3c_hsotg_enqueue_setup(hsotg);
+		dwc_hsotg_enqueue_setup(hsotg);
 		return;
 	}
 
@@ -1520,7 +1569,7 @@ static void s3c_hsotg_send_zlp(struct s3c_hsotg *hsotg,
 }
 
 /**
- * s3c_hsotg_handle_outdone - handle receiving OutDone/SetupDone from RXFIFO
+ * dwc_hsotg_handle_outdone - handle receiving OutDone/SetupDone from RXFIFO
  * @hsotg: The device instance
  * @epnum: The endpoint received from
  * @was_setup: Set if processing a SetupDone event.
@@ -1529,12 +1578,12 @@ static void s3c_hsotg_send_zlp(struct s3c_hsotg *hsotg,
  * transfer for an OUT endpoint has been completed, either by a short
  * packet or by the finish of a transfer.
  */
-static void s3c_hsotg_handle_outdone(struct s3c_hsotg *hsotg,
+static void dwc_hsotg_handle_outdone(struct dwc_hsotg *hsotg,
 				     int epnum, bool was_setup)
 {
 	u32 epsize = readl(hsotg->regs + DOEPTSIZ(epnum));
-	struct s3c_hsotg_ep *hs_ep = &hsotg->eps[epnum];
-	struct s3c_hsotg_req *hs_req = hs_ep->req;
+	struct dwc_hsotg_ep *hs_ep = &hsotg->eps[epnum];
+	struct dwc_hsotg_req *hs_req = hs_ep->req;
 	struct usb_request *req = &hs_req->req;
 	unsigned size_left = DxEPTSIZ_XferSize_GET(epsize);
 	int result = 0;
@@ -1564,7 +1613,7 @@ static void s3c_hsotg_handle_outdone(struct s3c_hsotg *hsotg,
 
 	/* if there is more request to do, schedule new transfer */
 	if (req->actual < req->length && size_left == 0) {
-		s3c_hsotg_start_req(hsotg, hs_ep, hs_req, true);
+		dwc_hsotg_start_req(hsotg, hs_ep, hs_req, true);
 		return;
 	} else if (epnum == 0) {
 		/*
@@ -1586,23 +1635,23 @@ static void s3c_hsotg_handle_outdone(struct s3c_hsotg *hsotg,
 
 	if (epnum == 0) {
 		/*
-		 * Condition req->complete != s3c_hsotg_complete_setup says:
+		 * Condition req->complete != dwc_hsotg_complete_setup says:
 		 * send ZLP when we have an asynchronous request from gadget
 		 */
-		if (!was_setup && req->complete != s3c_hsotg_complete_setup)
-			s3c_hsotg_send_zlp(hsotg, hs_req);
+		if (!was_setup && req->complete != dwc_hsotg_complete_setup)
+			dwc_hsotg_send_zlp(hsotg, hs_req);
 	}
 
-	s3c_hsotg_complete_request(hsotg, hs_ep, hs_req, result);
+	dwc_hsotg_complete_request(hsotg, hs_ep, hs_req, result);
 }
 
 /**
- * s3c_hsotg_read_frameno - read current frame number
+ * dwc_hsotg_read_frameno - read current frame number
  * @hsotg: The device instance
  *
  * Return the current frame number
  */
-static u32 s3c_hsotg_read_frameno(struct s3c_hsotg *hsotg)
+static u32 dwc_hsotg_read_frameno(struct dwc_hsotg *hsotg)
 {
 	u32 dsts;
 
@@ -1614,7 +1663,7 @@ static u32 s3c_hsotg_read_frameno(struct s3c_hsotg *hsotg)
 }
 
 /**
- * s3c_hsotg_handle_rx - RX FIFO has data
+ * dwc_hsotg_handle_rx - RX FIFO has data
  * @hsotg: The device instance
  *
  * The IRQ handler has detected that the RX FIFO has some data in it
@@ -1629,7 +1678,7 @@ static u32 s3c_hsotg_read_frameno(struct s3c_hsotg *hsotg)
  * as the actual data should be sent to the memory directly and we turn
  * on the completion interrupts to get notifications of transfer completion.
  */
-static void s3c_hsotg_handle_rx(struct s3c_hsotg *hsotg)
+static void dwc_hsotg_handle_rx(struct dwc_hsotg *hsotg)
 {
 	u32 grxstsr = readl(hsotg->regs + GRXSTSP);
 	u32 epnum, status, size;
@@ -1655,48 +1704,48 @@ static void s3c_hsotg_handle_rx(struct s3c_hsotg *hsotg)
 
 	case __status(GRXSTS_PktSts_OutDone):
 		dev_dbg(hsotg->dev, "OutDone (Frame=0x%08x)\n",
-			s3c_hsotg_read_frameno(hsotg));
+			dwc_hsotg_read_frameno(hsotg));
 
 		if (!using_dma(hsotg))
-			s3c_hsotg_handle_outdone(hsotg, epnum, false);
+			dwc_hsotg_handle_outdone(hsotg, epnum, false);
 		break;
 
 	case __status(GRXSTS_PktSts_SetupDone):
 		dev_dbg(hsotg->dev,
 			"SetupDone (Frame=0x%08x, DOPEPCTL=0x%08x)\n",
-			s3c_hsotg_read_frameno(hsotg),
+			dwc_hsotg_read_frameno(hsotg),
 			readl(hsotg->regs + DOEPCTL(0)));
 
-		s3c_hsotg_handle_outdone(hsotg, epnum, true);
+		dwc_hsotg_handle_outdone(hsotg, epnum, true);
 		break;
 
 	case __status(GRXSTS_PktSts_OutRX):
-		s3c_hsotg_rx_data(hsotg, epnum, size);
+		dwc_hsotg_rx_data(hsotg, epnum, size);
 		break;
 
 	case __status(GRXSTS_PktSts_SetupRX):
 		dev_dbg(hsotg->dev,
 			"SetupRX (Frame=0x%08x, DOPEPCTL=0x%08x)\n",
-			s3c_hsotg_read_frameno(hsotg),
+			dwc_hsotg_read_frameno(hsotg),
 			readl(hsotg->regs + DOEPCTL(0)));
 
-		s3c_hsotg_rx_data(hsotg, epnum, size);
+		dwc_hsotg_rx_data(hsotg, epnum, size);
 		break;
 
 	default:
 		dev_warn(hsotg->dev, "%s: unknown status %08x\n",
 			 __func__, grxstsr);
 
-		s3c_hsotg_dump(hsotg);
+		dwc_hsotg_dump(hsotg);
 		break;
 	}
 }
 
 /**
- * s3c_hsotg_ep0_mps - turn max packet size into register setting
+ * dwc_hsotg_ep0_mps - turn max packet size into register setting
  * @mps: The maximum packet size in bytes.
  */
-static u32 s3c_hsotg_ep0_mps(unsigned int mps)
+static u32 dwc_hsotg_ep0_mps(unsigned int mps)
 {
 	switch (mps) {
 	case 64:
@@ -1715,7 +1764,7 @@ static u32 s3c_hsotg_ep0_mps(unsigned int mps)
 }
 
 /**
- * s3c_hsotg_set_ep_maxpacket - set endpoint's max-packet field
+ * dwc_hsotg_set_ep_maxpacket - set endpoint's max-packet field
  * @hsotg: The driver state.
  * @ep: The index number of the endpoint
  * @mps: The maximum packet size in bytes
@@ -1723,17 +1772,17 @@ static u32 s3c_hsotg_ep0_mps(unsigned int mps)
  * Configure the maximum packet size for the given endpoint, updating
  * the hardware control registers to reflect this.
  */
-static void s3c_hsotg_set_ep_maxpacket(struct s3c_hsotg *hsotg,
+static void dwc_hsotg_set_ep_maxpacket(struct dwc_hsotg *hsotg,
 				       unsigned int ep, unsigned int mps)
 {
-	struct s3c_hsotg_ep *hs_ep = &hsotg->eps[ep];
+	struct dwc_hsotg_ep *hs_ep = &hsotg->eps[ep];
 	void __iomem *regs = hsotg->regs;
 	u32 mpsval;
 	u32 reg;
 
 	if (ep == 0) {
 		/* EP0 is a special case */
-		mpsval = s3c_hsotg_ep0_mps(mps);
+		mpsval = dwc_hsotg_ep0_mps(mps);
 		if (mpsval > 3)
 			goto bad_mps;
 	} else {
@@ -1769,11 +1818,11 @@ bad_mps:
 }
 
 /**
- * s3c_hsotg_txfifo_flush - flush Tx FIFO
+ * dwc_hsotg_txfifo_flush - flush Tx FIFO
  * @hsotg: The driver state
  * @idx: The index for the endpoint (0..15)
  */
-static void s3c_hsotg_txfifo_flush(struct s3c_hsotg *hsotg, unsigned int idx)
+static void dwc_hsotg_txfifo_flush(struct dwc_hsotg *hsotg, unsigned int idx)
 {
 	int timeout;
 	int val;
@@ -1801,17 +1850,17 @@ static void s3c_hsotg_txfifo_flush(struct s3c_hsotg *hsotg, unsigned int idx)
 }
 
 /**
- * s3c_hsotg_trytx - check to see if anything needs transmitting
+ * dwc_hsotg_trytx - check to see if anything needs transmitting
  * @hsotg: The driver state
  * @hs_ep: The driver endpoint to check.
  *
  * Check to see if there is a request that has data to send, and if so
  * make an attempt to write data into the FIFO.
  */
-static int s3c_hsotg_trytx(struct s3c_hsotg *hsotg,
-			   struct s3c_hsotg_ep *hs_ep)
+static int dwc_hsotg_trytx(struct dwc_hsotg *hsotg,
+			   struct dwc_hsotg_ep *hs_ep)
 {
-	struct s3c_hsotg_req *hs_req = hs_ep->req;
+	struct dwc_hsotg_req *hs_req = hs_ep->req;
 
 	if (!hs_ep->dir_in || !hs_req)
 		return 0;
@@ -1819,24 +1868,24 @@ static int s3c_hsotg_trytx(struct s3c_hsotg *hsotg,
 	if (hs_req->req.actual < hs_req->req.length) {
 		dev_dbg(hsotg->dev, "trying to write more for ep%d\n",
 			hs_ep->index);
-		return s3c_hsotg_write_fifo(hsotg, hs_ep, hs_req);
+		return dwc_hsotg_write_fifo(hsotg, hs_ep, hs_req);
 	}
 
 	return 0;
 }
 
 /**
- * s3c_hsotg_complete_in - complete IN transfer
+ * dwc_hsotg_complete_in - complete IN transfer
  * @hsotg: The device state.
  * @hs_ep: The endpoint that has just completed.
  *
  * An IN transfer has been completed, update the transfer's state and then
  * call the relevant completion routines.
  */
-static void s3c_hsotg_complete_in(struct s3c_hsotg *hsotg,
-				  struct s3c_hsotg_ep *hs_ep)
+static void dwc_hsotg_complete_in(struct dwc_hsotg *hsotg,
+				  struct dwc_hsotg_ep *hs_ep)
 {
-	struct s3c_hsotg_req *hs_req = hs_ep->req;
+	struct dwc_hsotg_req *hs_req = hs_ep->req;
 	u32 epsize = readl(hsotg->regs + DIEPTSIZ(hs_ep->index));
 	int size_left, size_done;
 
@@ -1848,7 +1897,7 @@ static void s3c_hsotg_complete_in(struct s3c_hsotg *hsotg,
 	/* Finish ZLP handling for IN EP0 transactions */
 	if (hsotg->eps[0].sent_zlp) {
 		dev_dbg(hsotg->dev, "zlp packet received\n");
-		s3c_hsotg_complete_request(hsotg, hs_ep, hs_req, 0);
+		dwc_hsotg_complete_request(hsotg, hs_ep, hs_req, 0);
 		return;
 	}
 
@@ -1890,30 +1939,30 @@ static void s3c_hsotg_complete_in(struct s3c_hsotg *hsotg,
 	    !(hs_req->req.length % hs_ep->ep.maxpacket)) {
 
 		dev_dbg(hsotg->dev, "ep0 zlp IN packet sent\n");
-		s3c_hsotg_send_zlp(hsotg, hs_req);
+		dwc_hsotg_send_zlp(hsotg, hs_req);
 
 		return;
 	}
 
 	if (!size_left && hs_req->req.actual < hs_req->req.length) {
 		dev_dbg(hsotg->dev, "%s trying more for req...\n", __func__);
-		s3c_hsotg_start_req(hsotg, hs_ep, hs_req, true);
+		dwc_hsotg_start_req(hsotg, hs_ep, hs_req, true);
 	} else
-		s3c_hsotg_complete_request(hsotg, hs_ep, hs_req, 0);
+		dwc_hsotg_complete_request(hsotg, hs_ep, hs_req, 0);
 }
 
 /**
- * s3c_hsotg_epint - handle an in/out endpoint interrupt
+ * dwc_hsotg_epint - handle an in/out endpoint interrupt
  * @hsotg: The driver state
  * @idx: The index for the endpoint (0..15)
  * @dir_in: Set if this is an IN endpoint
  *
  * Process and clear any interrupt pending for an individual endpoint
  */
-static void s3c_hsotg_epint(struct s3c_hsotg *hsotg, unsigned int idx,
+static void dwc_hsotg_epint(struct dwc_hsotg *hsotg, unsigned int idx,
 			    int dir_in)
 {
-	struct s3c_hsotg_ep *hs_ep = &hsotg->eps[idx];
+	struct dwc_hsotg_ep *hs_ep = &hsotg->eps[idx];
 	u32 epint_reg = dir_in ? DIEPINT(idx) : DOEPINT(idx);
 	u32 epctl_reg = dir_in ? DIEPCTL(idx) : DOEPCTL(idx);
 	u32 epsiz_reg = dir_in ? DIEPTSIZ(idx) : DOEPTSIZ(idx);
@@ -1938,17 +1987,17 @@ static void s3c_hsotg_epint(struct s3c_hsotg *hsotg, unsigned int idx,
 		 * at completing IN requests here
 		 */
 		if (dir_in) {
-			s3c_hsotg_complete_in(hsotg, hs_ep);
+			dwc_hsotg_complete_in(hsotg, hs_ep);
 
 			if (idx == 0 && !hs_ep->req)
-				s3c_hsotg_enqueue_setup(hsotg);
+				dwc_hsotg_enqueue_setup(hsotg);
 		} else if (using_dma(hsotg)) {
 			/*
 			 * We're using DMA, we need to fire an OutDone here
 			 * as we ignore the RXFIFO.
 			 */
 
-			s3c_hsotg_handle_outdone(hsotg, idx, false);
+			dwc_hsotg_handle_outdone(hsotg, idx, false);
 		}
 	}
 
@@ -1958,7 +2007,7 @@ static void s3c_hsotg_epint(struct s3c_hsotg *hsotg, unsigned int idx,
 		if (dir_in) {
 			int epctl = readl(hsotg->regs + epctl_reg);
 
-			s3c_hsotg_txfifo_flush(hsotg, idx);
+			dwc_hsotg_txfifo_flush(hsotg, idx);
 
 			if ((epctl & DxEPCTL_Stall) &&
 				(epctl & DxEPCTL_EPType_Bulk)) {
@@ -1987,7 +2036,7 @@ static void s3c_hsotg_epint(struct s3c_hsotg *hsotg, unsigned int idx,
 			if (dir_in)
 				WARN_ON_ONCE(1);
 			else
-				s3c_hsotg_handle_outdone(hsotg, 0, true);
+				dwc_hsotg_handle_outdone(hsotg, 0, true);
 		}
 	}
 
@@ -2013,19 +2062,19 @@ static void s3c_hsotg_epint(struct s3c_hsotg *hsotg, unsigned int idx,
 			dev_dbg(hsotg->dev, "%s: ep%d: TxFIFOEmpty\n",
 				__func__, idx);
 			if (!using_dma(hsotg))
-				s3c_hsotg_trytx(hsotg, hs_ep);
+				dwc_hsotg_trytx(hsotg, hs_ep);
 		}
 	}
 }
 
 /**
- * s3c_hsotg_irq_enumdone - Handle EnumDone interrupt (enumeration done)
+ * dwc_hsotg_irq_enumdone - Handle EnumDone interrupt (enumeration done)
  * @hsotg: The device state.
  *
  * Handle updating the device settings after the enumeration phase has
  * been completed.
  */
-static void s3c_hsotg_irq_enumdone(struct s3c_hsotg *hsotg)
+static void dwc_hsotg_irq_enumdone(struct dwc_hsotg *hsotg)
 {
 	u32 dsts = readl(hsotg->regs + DSTS);
 	int ep0_mps = 0, ep_mps;
@@ -2078,14 +2127,14 @@ static void s3c_hsotg_irq_enumdone(struct s3c_hsotg *hsotg)
 
 	if (ep0_mps) {
 		int i;
-		s3c_hsotg_set_ep_maxpacket(hsotg, 0, ep0_mps);
+		dwc_hsotg_set_ep_maxpacket(hsotg, 0, ep0_mps);
 		for (i = 1; i < hsotg->num_of_eps; i++)
-			s3c_hsotg_set_ep_maxpacket(hsotg, i, ep_mps);
+			dwc_hsotg_set_ep_maxpacket(hsotg, i, ep_mps);
 	}
 
 	/* ensure after enumeration our EP0 is active */
 
-	s3c_hsotg_enqueue_setup(hsotg);
+	dwc_hsotg_enqueue_setup(hsotg);
 
 	dev_dbg(hsotg->dev, "EP0: DIEPCTL0=0x%08x, DOEPCTL0=0x%08x\n",
 		readl(hsotg->regs + DIEPCTL0),
@@ -2102,11 +2151,11 @@ static void s3c_hsotg_irq_enumdone(struct s3c_hsotg *hsotg)
  * Go through the requests on the given endpoint and mark them
  * completed with the given result code.
  */
-static void kill_all_requests(struct s3c_hsotg *hsotg,
-			      struct s3c_hsotg_ep *ep,
+static void kill_all_requests(struct dwc_hsotg *hsotg,
+			      struct dwc_hsotg_ep *ep,
 			      int result, bool force)
 {
-	struct s3c_hsotg_req *req, *treq;
+	struct dwc_hsotg_req *req, *treq;
 
 	list_for_each_entry_safe(req, treq, &ep->queue, queue) {
 		/*
@@ -2117,7 +2166,7 @@ static void kill_all_requests(struct s3c_hsotg *hsotg,
 		if (ep->req == req && ep->dir_in && !force)
 			continue;
 
-		s3c_hsotg_complete_request(hsotg, ep, req,
+		dwc_hsotg_complete_request(hsotg, ep, req,
 					   result);
 	}
 }
@@ -2131,14 +2180,14 @@ static void kill_all_requests(struct s3c_hsotg *hsotg,
 		}
 
 /**
- * s3c_hsotg_disconnect - disconnect service
+ * dwc_hsotg_disconnect - disconnect service
  * @hsotg: The device state.
  *
  * The device has been disconnected. Remove all current
  * transactions and signal the gadget driver that this
  * has happened.
  */
-static void s3c_hsotg_disconnect(struct s3c_hsotg *hsotg)
+static void dwc_hsotg_disconnect(struct dwc_hsotg *hsotg)
 {
 	unsigned ep;
 
@@ -2149,13 +2198,13 @@ static void s3c_hsotg_disconnect(struct s3c_hsotg *hsotg)
 }
 
 /**
- * s3c_hsotg_irq_fifoempty - TX FIFO empty interrupt handler
+ * dwc_hsotg_irq_fifoempty - TX FIFO empty interrupt handler
  * @hsotg: The device state:
  * @periodic: True if this is a periodic FIFO interrupt
  */
-static void s3c_hsotg_irq_fifoempty(struct s3c_hsotg *hsotg, bool periodic)
+static void dwc_hsotg_irq_fifoempty(struct dwc_hsotg *hsotg, bool periodic)
 {
-	struct s3c_hsotg_ep *ep;
+	struct dwc_hsotg_ep *ep;
 	int epno, ret;
 
 	/* look through for any more data to transmit */
@@ -2170,7 +2219,7 @@ static void s3c_hsotg_irq_fifoempty(struct s3c_hsotg *hsotg, bool periodic)
 		    (!periodic && ep->periodic))
 			continue;
 
-		ret = s3c_hsotg_trytx(hsotg, ep);
+		ret = dwc_hsotg_trytx(hsotg, ep);
 		if (ret < 0)
 			break;
 	}
@@ -2182,12 +2231,12 @@ static void s3c_hsotg_irq_fifoempty(struct s3c_hsotg *hsotg, bool periodic)
 			GINTSTS_RxFLvl)
 
 /**
- * s3c_hsotg_corereset - issue softreset to the core
+ * dwc_hsotg_corereset - issue softreset to the core
  * @hsotg: The device state
  *
  * Issue a soft reset to the core, and await the core finishing it.
  */
-static int s3c_hsotg_corereset(struct s3c_hsotg *hsotg)
+static int dwc_hsotg_corereset(struct dwc_hsotg *hsotg)
 {
 	int timeout;
 	u32 grstctl;
@@ -2230,14 +2279,14 @@ static int s3c_hsotg_corereset(struct s3c_hsotg *hsotg)
 }
 
 /**
- * s3c_hsotg_core_init - issue softreset to the core
+ * dwc_hsotg_core_init - issue softreset to the core
  * @hsotg: The device state
  *
  * Issue a soft reset to the core, and await the core finishing it.
  */
-static void s3c_hsotg_core_init(struct s3c_hsotg *hsotg)
+static void dwc_hsotg_core_init(struct dwc_hsotg *hsotg)
 {
-	s3c_hsotg_corereset(hsotg);
+	dwc_hsotg_corereset(hsotg);
 
 	/*
 	 * we must now enable ep0 ready for host detection and then
@@ -2248,7 +2297,7 @@ static void s3c_hsotg_core_init(struct s3c_hsotg *hsotg)
 	writel(GUSBCFG_PHYIf16 | GUSBCFG_TOutCal(7) |
 	       (0x5 << 10), hsotg->regs + GUSBCFG);
 
-	s3c_hsotg_init_fifo(hsotg);
+	dwc_hsotg_init_fifo(hsotg);
 
 	__orr32(hsotg->regs + DCTL, DCTL_SftDiscon);
 
@@ -2303,7 +2352,7 @@ static void s3c_hsotg_core_init(struct s3c_hsotg *hsotg)
 		readl(hsotg->regs + DOEPCTL0));
 
 	/* enable in and out endpoint interrupts */
-	s3c_hsotg_en_gsint(hsotg, GINTSTS_OEPInt | GINTSTS_IEPInt);
+	dwc_hsotg_en_gsint(hsotg, GINTSTS_OEPInt | GINTSTS_IEPInt);
 
 	/*
 	 * Enable the RXFIFO when in slave mode, as this is how we collect
@@ -2311,11 +2360,11 @@ static void s3c_hsotg_core_init(struct s3c_hsotg *hsotg)
 	 * things we cannot process, so do not use it.
 	 */
 	if (!using_dma(hsotg))
-		s3c_hsotg_en_gsint(hsotg, GINTSTS_RxFLvl);
+		dwc_hsotg_en_gsint(hsotg, GINTSTS_RxFLvl);
 
 	/* Enable interrupts for EP0 in and out */
-	s3c_hsotg_ctrl_epint(hsotg, 0, 0, 1);
-	s3c_hsotg_ctrl_epint(hsotg, 0, 1, 1);
+	dwc_hsotg_ctrl_epint(hsotg, 0, 0, 1);
+	dwc_hsotg_ctrl_epint(hsotg, 0, 1, 1);
 
 	__orr32(hsotg->regs + DCTL, DCTL_PWROnPrgDone);
 	udelay(10);  /* see openiboot */
@@ -2332,16 +2381,16 @@ static void s3c_hsotg_core_init(struct s3c_hsotg *hsotg)
 	writel(DxEPTSIZ_MC(1) | DxEPTSIZ_PktCnt(1) |
 	       DxEPTSIZ_XferSize(8), hsotg->regs + DOEPTSIZ0);
 
-	writel(s3c_hsotg_ep0_mps(hsotg->eps[0].ep.maxpacket) |
+	writel(dwc_hsotg_ep0_mps(hsotg->eps[0].ep.maxpacket) |
 	       DxEPCTL_CNAK | DxEPCTL_EPEna |
 	       DxEPCTL_USBActEp,
 	       hsotg->regs + DOEPCTL0);
 
 	/* enable, but don't activate EP0in */
-	writel(s3c_hsotg_ep0_mps(hsotg->eps[0].ep.maxpacket) |
+	writel(dwc_hsotg_ep0_mps(hsotg->eps[0].ep.maxpacket) |
 	       DxEPCTL_USBActEp, hsotg->regs + DIEPCTL0);
 
-	s3c_hsotg_enqueue_setup(hsotg);
+	dwc_hsotg_enqueue_setup(hsotg);
 
 	dev_dbg(hsotg->dev, "EP0: DIEPCTL0=0x%08x, DOEPCTL0=0x%08x\n",
 		readl(hsotg->regs + DIEPCTL0),
@@ -2359,13 +2408,13 @@ static void s3c_hsotg_core_init(struct s3c_hsotg *hsotg)
 }
 
 /**
- * s3c_hsotg_irq - handle device interrupt
+ * dwc_hsotg_irq - handle device interrupt
  * @irq: The IRQ number triggered
  * @pw: The pw value when registered the handler.
  */
-static irqreturn_t s3c_hsotg_irq(int irq, void *pw)
+static irqreturn_t dwc_hsotg_irq(int irq, void *pw)
 {
-	struct s3c_hsotg *hsotg = pw;
+	struct dwc_hsotg *hsotg = pw;
 	int retry_count = 8;
 	u32 gintsts;
 	u32 gintmsk;
@@ -2396,7 +2445,7 @@ irq_retry:
 	if (gintsts & GINTSTS_EnumDone) {
 		writel(GINTSTS_EnumDone, hsotg->regs + GINTSTS);
 
-		s3c_hsotg_irq_enumdone(hsotg);
+		dwc_hsotg_irq_enumdone(hsotg);
 	}
 
 	if (gintsts & GINTSTS_ConIDStsChng) {
@@ -2417,12 +2466,12 @@ irq_retry:
 
 		for (ep = 0; ep < 15 && daint_out; ep++, daint_out >>= 1) {
 			if (daint_out & 1)
-				s3c_hsotg_epint(hsotg, ep, 0);
+				dwc_hsotg_epint(hsotg, ep, 0);
 		}
 
 		for (ep = 0; ep < 15 && daint_in; ep++, daint_in >>= 1) {
 			if (daint_in & 1)
-				s3c_hsotg_epint(hsotg, ep, 1);
+				dwc_hsotg_epint(hsotg, ep, 1);
 		}
 	}
 
@@ -2443,7 +2492,7 @@ irq_retry:
 				kill_all_requests(hsotg, &hsotg->eps[0],
 							  -ECONNRESET, true);
 
-				s3c_hsotg_core_init(hsotg);
+				dwc_hsotg_core_init(hsotg);
 				hsotg->last_rst = jiffies;
 			}
 		}
@@ -2460,8 +2509,8 @@ irq_retry:
 		 * it needs re-enabling
 		 */
 
-		s3c_hsotg_disable_gsint(hsotg, GINTSTS_NPTxFEmp);
-		s3c_hsotg_irq_fifoempty(hsotg, false);
+		dwc_hsotg_disable_gsint(hsotg, GINTSTS_NPTxFEmp);
+		dwc_hsotg_irq_fifoempty(hsotg, false);
 	}
 
 	if (gintsts & GINTSTS_PTxFEmp) {
@@ -2469,18 +2518,18 @@ irq_retry:
 
 		/* See note in GINTSTS_NPTxFEmp */
 
-		s3c_hsotg_disable_gsint(hsotg, GINTSTS_PTxFEmp);
-		s3c_hsotg_irq_fifoempty(hsotg, true);
+		dwc_hsotg_disable_gsint(hsotg, GINTSTS_PTxFEmp);
+		dwc_hsotg_irq_fifoempty(hsotg, true);
 	}
 
 	if (gintsts & GINTSTS_RxFLvl) {
 		/*
 		 * note, since GINTSTS_RxFLvl doubles as FIFO-not-empty,
-		 * we need to retry s3c_hsotg_handle_rx if this is still
+		 * we need to retry dwc_hsotg_handle_rx if this is still
 		 * set.
 		 */
 
-		s3c_hsotg_handle_rx(hsotg);
+		dwc_hsotg_handle_rx(hsotg);
 	}
 
 	if (gintsts & GINTSTS_ModeMis) {
@@ -2493,7 +2542,7 @@ irq_retry:
 		writel(GINTSTS_USBSusp, hsotg->regs + GINTSTS);
 
 		call_gadget(hsotg, suspend);
-		s3c_hsotg_disconnect(hsotg);
+		dwc_hsotg_disconnect(hsotg);
 	}
 
 	if (gintsts & GINTSTS_WkUpInt) {
@@ -2507,7 +2556,7 @@ irq_retry:
 		dev_dbg(hsotg->dev, "GINTSTS_ErlySusp\n");
 		writel(GINTSTS_ErlySusp, hsotg->regs + GINTSTS);
 
-		s3c_hsotg_disconnect(hsotg);
+		dwc_hsotg_disconnect(hsotg);
 	}
 
 	/*
@@ -2521,7 +2570,7 @@ irq_retry:
 
 		writel(DCTL_CGOUTNak, hsotg->regs + DCTL);
 
-		s3c_hsotg_dump(hsotg);
+		dwc_hsotg_dump(hsotg);
 	}
 
 	if (gintsts & GINTSTS_GINNakEff) {
@@ -2529,7 +2578,7 @@ irq_retry:
 
 		writel(DCTL_CGNPInNAK, hsotg->regs + DCTL);
 
-		s3c_hsotg_dump(hsotg);
+		dwc_hsotg_dump(hsotg);
 	}
 
 	/*
@@ -2546,17 +2595,17 @@ irq_retry:
 }
 
 /**
- * s3c_hsotg_ep_enable - enable the given endpoint
+ * dwc_hsotg_ep_enable - enable the given endpoint
  * @ep: The USB endpint to configure
  * @desc: The USB endpoint descriptor to configure with.
  *
  * This is called from the USB gadget code's usb_ep_enable().
  */
-static int s3c_hsotg_ep_enable(struct usb_ep *ep,
+static int dwc_hsotg_ep_enable(struct usb_ep *ep,
 			       const struct usb_endpoint_descriptor *desc)
 {
-	struct s3c_hsotg_ep *hs_ep = our_ep(ep);
-	struct s3c_hsotg *hsotg = hs_ep->parent;
+	struct dwc_hsotg_ep *hs_ep = our_ep(ep);
+	struct dwc_hsotg *hsotg = hs_ep->parent;
 	unsigned long flags;
 	int index = hs_ep->index;
 	u32 epctrl_reg;
@@ -2581,7 +2630,7 @@ static int s3c_hsotg_ep_enable(struct usb_ep *ep,
 
 	mps = usb_endpoint_maxp(desc);
 
-	/* note, we handle this here instead of s3c_hsotg_set_ep_maxpacket */
+	/* note, we handle this here instead of dwc_hsotg_set_ep_maxpacket */
 
 	epctrl_reg = dir_in ? DIEPCTL(index) : DOEPCTL(index);
 	epctrl = readl(hsotg->regs + epctrl_reg);
@@ -2665,7 +2714,7 @@ static int s3c_hsotg_ep_enable(struct usb_ep *ep,
 		__func__, readl(hsotg->regs + epctrl_reg));
 
 	/* enable the endpoint interrupt */
-	s3c_hsotg_ctrl_epint(hsotg, index, dir_in, 1);
+	dwc_hsotg_ctrl_epint(hsotg, index, dir_in, 1);
 
 out:
 	spin_unlock_irqrestore(&hsotg->lock, flags);
@@ -2673,13 +2722,13 @@ out:
 }
 
 /**
- * s3c_hsotg_ep_disable - disable given endpoint
+ * dwc_hsotg_ep_disable - disable given endpoint
  * @ep: The endpoint to disable.
  */
-static int s3c_hsotg_ep_disable(struct usb_ep *ep)
+static int dwc_hsotg_ep_disable(struct usb_ep *ep)
 {
-	struct s3c_hsotg_ep *hs_ep = our_ep(ep);
-	struct s3c_hsotg *hsotg = hs_ep->parent;
+	struct dwc_hsotg_ep *hs_ep = our_ep(ep);
+	struct dwc_hsotg *hsotg = hs_ep->parent;
 	int dir_in = hs_ep->dir_in;
 	int index = hs_ep->index;
 	unsigned long flags;
@@ -2709,7 +2758,7 @@ static int s3c_hsotg_ep_disable(struct usb_ep *ep)
 	writel(ctrl, hsotg->regs + epctrl_reg);
 
 	/* disable endpoint interrupts */
-	s3c_hsotg_ctrl_epint(hsotg, hs_ep->index, hs_ep->dir_in, 0);
+	dwc_hsotg_ctrl_epint(hsotg, hs_ep->index, hs_ep->dir_in, 0);
 
 	spin_unlock_irqrestore(&hsotg->lock, flags);
 	return 0;
@@ -2720,9 +2769,9 @@ static int s3c_hsotg_ep_disable(struct usb_ep *ep)
  * @ep: The endpoint to check.
  * @test: The request to test if it is on the endpoint.
  */
-static bool on_list(struct s3c_hsotg_ep *ep, struct s3c_hsotg_req *test)
+static bool on_list(struct dwc_hsotg_ep *ep, struct dwc_hsotg_req *test)
 {
-	struct s3c_hsotg_req *req, *treq;
+	struct dwc_hsotg_req *req, *treq;
 
 	list_for_each_entry_safe(req, treq, &ep->queue, queue) {
 		if (req == test)
@@ -2733,15 +2782,15 @@ static bool on_list(struct s3c_hsotg_ep *ep, struct s3c_hsotg_req *test)
 }
 
 /**
- * s3c_hsotg_ep_dequeue - dequeue given endpoint
+ * dwc_hsotg_ep_dequeue - dequeue given endpoint
  * @ep: The endpoint to dequeue.
  * @req: The request to be removed from a queue.
  */
-static int s3c_hsotg_ep_dequeue(struct usb_ep *ep, struct usb_request *req)
+static int dwc_hsotg_ep_dequeue(struct usb_ep *ep, struct usb_request *req)
 {
-	struct s3c_hsotg_req *hs_req = our_req(req);
-	struct s3c_hsotg_ep *hs_ep = our_ep(ep);
-	struct s3c_hsotg *hs = hs_ep->parent;
+	struct dwc_hsotg_req *hs_req = our_req(req);
+	struct dwc_hsotg_ep *hs_ep = our_ep(ep);
+	struct dwc_hsotg *hs = hs_ep->parent;
 	unsigned long flags;
 
 	dev_info(hs->dev, "ep_dequeue(%p,%p)\n", ep, req);
@@ -2753,21 +2802,21 @@ static int s3c_hsotg_ep_dequeue(struct usb_ep *ep, struct usb_request *req)
 		return -EINVAL;
 	}
 
-	s3c_hsotg_complete_request(hs, hs_ep, hs_req, -ECONNRESET);
+	dwc_hsotg_complete_request(hs, hs_ep, hs_req, -ECONNRESET);
 	spin_unlock_irqrestore(&hs->lock, flags);
 
 	return 0;
 }
 
 /**
- * s3c_hsotg_ep_sethalt - set halt on a given endpoint
+ * dwc_hsotg_ep_sethalt - set halt on a given endpoint
  * @ep: The endpoint to set halt.
  * @value: Set or unset the halt.
  */
-static int s3c_hsotg_ep_sethalt(struct usb_ep *ep, int value)
+static int dwc_hsotg_ep_sethalt(struct usb_ep *ep, int value)
 {
-	struct s3c_hsotg_ep *hs_ep = our_ep(ep);
-	struct s3c_hsotg *hs = hs_ep->parent;
+	struct dwc_hsotg_ep *hs_ep = our_ep(ep);
+	struct dwc_hsotg *hs = hs_ep->parent;
 	int index = hs_ep->index;
 	u32 epreg;
 	u32 epctl;
@@ -2813,71 +2862,75 @@ static int s3c_hsotg_ep_sethalt(struct usb_ep *ep, int value)
 }
 
 /**
- * s3c_hsotg_ep_sethalt_lock - set halt on a given endpoint with lock held
+ * dwc_hsotg_ep_sethalt_lock - set halt on a given endpoint with lock held
  * @ep: The endpoint to set halt.
  * @value: Set or unset the halt.
  */
-static int s3c_hsotg_ep_sethalt_lock(struct usb_ep *ep, int value)
+static int dwc_hsotg_ep_sethalt_lock(struct usb_ep *ep, int value)
 {
-	struct s3c_hsotg_ep *hs_ep = our_ep(ep);
-	struct s3c_hsotg *hs = hs_ep->parent;
+	struct dwc_hsotg_ep *hs_ep = our_ep(ep);
+	struct dwc_hsotg *hs = hs_ep->parent;
 	unsigned long flags = 0;
 	int ret = 0;
 
 	spin_lock_irqsave(&hs->lock, flags);
-	ret = s3c_hsotg_ep_sethalt(ep, value);
+	ret = dwc_hsotg_ep_sethalt(ep, value);
 	spin_unlock_irqrestore(&hs->lock, flags);
 
 	return ret;
 }
 
-static struct usb_ep_ops s3c_hsotg_ep_ops = {
-	.enable		= s3c_hsotg_ep_enable,
-	.disable	= s3c_hsotg_ep_disable,
-	.alloc_request	= s3c_hsotg_ep_alloc_request,
-	.free_request	= s3c_hsotg_ep_free_request,
-	.queue		= s3c_hsotg_ep_queue_lock,
-	.dequeue	= s3c_hsotg_ep_dequeue,
-	.set_halt	= s3c_hsotg_ep_sethalt_lock,
+static struct usb_ep_ops dwc_hsotg_ep_ops = {
+	.enable		= dwc_hsotg_ep_enable,
+	.disable	= dwc_hsotg_ep_disable,
+	.alloc_request	= dwc_hsotg_ep_alloc_request,
+	.free_request	= dwc_hsotg_ep_free_request,
+	.queue		= dwc_hsotg_ep_queue_lock,
+	.dequeue	= dwc_hsotg_ep_dequeue,
+	.set_halt	= dwc_hsotg_ep_sethalt_lock,
 	/* note, don't believe we have any call for the fifo routines */
 };
 
 /**
- * s3c_hsotg_phy_enable - enable platform phy dev
+ * dwc_hsotg_phy_enable - enable platform phy dev
  * @hsotg: The driver state
  *
  * A wrapper for platform code responsible for controlling
  * low-level USB code
  */
-static void s3c_hsotg_phy_enable(struct s3c_hsotg *hsotg)
+static void dwc_hsotg_phy_enable(struct dwc_hsotg *hsotg)
 {
+#ifndef DWC_HSOTG_PCI
 	struct platform_device *pdev = to_platform_device(hsotg->dev);
 
 	dev_dbg(hsotg->dev, "pdev 0x%p\n", pdev);
 	if (hsotg->plat->phy_init)
 		hsotg->plat->phy_init(pdev, hsotg->plat->phy_type);
+#endif
 }
 
 /**
- * s3c_hsotg_phy_disable - disable platform phy dev
+ * dwc_hsotg_phy_disable - disable platform phy dev
  * @hsotg: The driver state
  *
  * A wrapper for platform code responsible for controlling
  * low-level USB code
  */
-static void s3c_hsotg_phy_disable(struct s3c_hsotg *hsotg)
+static void dwc_hsotg_phy_disable(struct dwc_hsotg *hsotg)
 {
+#ifndef DWC_HSOTG_PCI
 	struct platform_device *pdev = to_platform_device(hsotg->dev);
 
 	if (hsotg->plat->phy_exit)
 		hsotg->plat->phy_exit(pdev, hsotg->plat->phy_type);
+#endif
 }
 
 /**
- * s3c_hsotg_init - initalize the usb core
+ * dwc_hsotg_init - initalize the usb core
  * @hsotg: The driver state
  */
-static void s3c_hsotg_init(struct s3c_hsotg *hsotg)
+static void dwc_hsotg_init(struct dwc_hsotg *hsotg)
 {
 	/* unmask subset of endpoint interrupts */
 
@@ -2906,7 +2959,7 @@ static void s3c_hsotg_init(struct s3c_hsotg *hsotg)
 		readl(hsotg->regs + GRXFSIZ),
 		readl(hsotg->regs + GNPTXFSIZ));
 
-	s3c_hsotg_init_fifo(hsotg);
+	dwc_hsotg_init_fifo(hsotg);
 
 	/* set the PLL on, remove the HNP/SRP and set the PHY */
 	writel(GUSBCFG_PHYIf16 | GUSBCFG_TOutCal(7) | (0x5 << 10),
@@ -2917,18 +2970,20 @@ static void s3c_hsotg_init(struct s3c_hsotg *hsotg)
 }
 
 /**
- * s3c_hsotg_udc_start - prepare the udc for work
+ * dwc_hsotg_udc_start - prepare the udc for work
  * @gadget: The usb gadget state
  * @driver: The usb gadget driver
  *
  * Perform initialization to prepare udc device and driver
  * to work.
  */
-static int s3c_hsotg_udc_start(struct usb_gadget *gadget,
+static int dwc_hsotg_udc_start(struct usb_gadget *gadget,
 			   struct usb_gadget_driver *driver)
 {
-	struct s3c_hsotg *hsotg = to_hsotg(gadget);
+	struct dwc_hsotg *hsotg = to_hsotg(gadget);
+#ifndef DWC_HSOTG_PCI
 	int ret;
+#endif
 
 	if (!hsotg) {
 		printk(KERN_ERR "%s: called with no device\n", __func__);
@@ -2957,34 +3012,38 @@ static int s3c_hsotg_udc_start(struct usb_gadget *gadget,
 	hsotg->gadget.dev.dma_mask = hsotg->dev->dma_mask;
 	hsotg->gadget.speed = USB_SPEED_UNKNOWN;
 
+#ifndef DWC_HSOTG_PCI
 	ret = regulator_bulk_enable(ARRAY_SIZE(hsotg->supplies),
 				    hsotg->supplies);
 	if (ret) {
 		dev_err(hsotg->dev, "failed to enable supplies: %d\n", ret);
 		goto err;
 	}
+#endif
 
 	hsotg->last_rst = jiffies;
 	dev_info(hsotg->dev, "bound driver %s\n", driver->driver.name);
 	return 0;
 
+#ifndef DWC_HSOTG_PCI
 err:
 	hsotg->driver = NULL;
 	hsotg->gadget.dev.driver = NULL;
 	return ret;
+#endif
 }
 
 /**
- * s3c_hsotg_udc_stop - stop the udc
+ * dwc_hsotg_udc_stop - stop the udc
  * @gadget: The usb gadget state
  * @driver: The usb gadget driver
  *
- * Stop udc hw block and stay tunned for future transmissions
+ * Stop udc hw block and stay tuned for future transmissions
  */
-static int s3c_hsotg_udc_stop(struct usb_gadget *gadget,
+static int dwc_hsotg_udc_stop(struct usb_gadget *gadget,
 			  struct usb_gadget_driver *driver)
 {
-	struct s3c_hsotg *hsotg = to_hsotg(gadget);
+	struct dwc_hsotg *hsotg = to_hsotg(gadget);
 	unsigned long flags = 0;
 	int ep;
 
@@ -2996,12 +3055,15 @@ static int s3c_hsotg_udc_stop(struct usb_gadget *gadget,
 
 	/* all endpoints should be shutdown */
 	for (ep = 0; ep < hsotg->num_of_eps; ep++)
-		s3c_hsotg_ep_disable(&hsotg->eps[ep].ep);
+		dwc_hsotg_ep_disable(&hsotg->eps[ep].ep);
 
 	spin_lock_irqsave(&hsotg->lock, flags);
 
-	s3c_hsotg_phy_disable(hsotg);
+	dwc_hsotg_phy_disable(hsotg);
+
+#ifndef DWC_HSOTG_PCI
 	regulator_bulk_disable(ARRAY_SIZE(hsotg->supplies), hsotg->supplies);
+#endif
 
 	hsotg->driver = NULL;
 	hsotg->gadget.speed = USB_SPEED_UNKNOWN;
@@ -3016,37 +3078,37 @@ static int s3c_hsotg_udc_stop(struct usb_gadget *gadget,
 }
 
 /**
- * s3c_hsotg_gadget_getframe - read the frame number
+ * dwc_hsotg_gadget_getframe - read the frame number
  * @gadget: The usb gadget state
  *
  * Read the {micro} frame number
  */
-static int s3c_hsotg_gadget_getframe(struct usb_gadget *gadget)
+static int dwc_hsotg_gadget_getframe(struct usb_gadget *gadget)
 {
-	return s3c_hsotg_read_frameno(to_hsotg(gadget));
+	return dwc_hsotg_read_frameno(to_hsotg(gadget));
 }
 
 /**
- * s3c_hsotg_pullup - connect/disconnect the USB PHY
+ * dwc_hsotg_pullup - connect/disconnect the USB PHY
  * @gadget: The usb gadget state
  * @is_on: Current state of the USB PHY
  *
  * Connect/Disconnect the USB PHY pullup
  */
-static int s3c_hsotg_pullup(struct usb_gadget *gadget, int is_on)
+static int dwc_hsotg_pullup(struct usb_gadget *gadget, int is_on)
 {
-	struct s3c_hsotg *hsotg = to_hsotg(gadget);
+	struct dwc_hsotg *hsotg = to_hsotg(gadget);
 	unsigned long flags = 0;
 
 	dev_dbg(hsotg->dev, "%s: is_in: %d\n", __func__, is_on);
 
 	spin_lock_irqsave(&hsotg->lock, flags);
 	if (is_on) {
-		s3c_hsotg_phy_enable(hsotg);
-		s3c_hsotg_core_init(hsotg);
+		dwc_hsotg_phy_enable(hsotg);
+		dwc_hsotg_core_init(hsotg);
 	} else {
-		s3c_hsotg_disconnect(hsotg);
-		s3c_hsotg_phy_disable(hsotg);
+		dwc_hsotg_disconnect(hsotg);
+		dwc_hsotg_phy_disable(hsotg);
 	}
 
 	hsotg->gadget.speed = USB_SPEED_UNKNOWN;
@@ -3055,15 +3117,15 @@ static int s3c_hsotg_pullup(struct usb_gadget *gadget, int is_on)
 	return 0;
 }
 
-static struct usb_gadget_ops s3c_hsotg_gadget_ops = {
-	.get_frame	= s3c_hsotg_gadget_getframe,
-	.udc_start		= s3c_hsotg_udc_start,
-	.udc_stop		= s3c_hsotg_udc_stop,
-	.pullup                 = s3c_hsotg_pullup,
+static struct usb_gadget_ops dwc_hsotg_gadget_ops = {
+	.get_frame	= dwc_hsotg_gadget_getframe,
+	.udc_start	= dwc_hsotg_udc_start,
+	.udc_stop	= dwc_hsotg_udc_stop,
+	.pullup		= dwc_hsotg_pullup,
 };
 
 /**
- * s3c_hsotg_initep - initialise a single endpoint
+ * dwc_hsotg_initep - initialise a single endpoint
  * @hsotg: The device state.
  * @hs_ep: The endpoint to be initialised.
  * @epnum: The endpoint number
@@ -3072,8 +3134,8 @@ static struct usb_gadget_ops s3c_hsotg_gadget_ops = {
  * creation) to give to the gadget driver. Setup the endpoint name, any
  * direction information and other state that may be required.
  */
-static void __devinit s3c_hsotg_initep(struct s3c_hsotg *hsotg,
-				       struct s3c_hsotg_ep *hs_ep,
+static void __devinit dwc_hsotg_initep(struct dwc_hsotg *hsotg,
+				       struct dwc_hsotg_ep *hs_ep,
 				       int epnum)
 {
 	u32 ptxfifo;
@@ -3102,7 +3164,7 @@ static void __devinit s3c_hsotg_initep(struct s3c_hsotg *hsotg,
 	hs_ep->parent = hsotg;
 	hs_ep->ep.name = hs_ep->name;
 	hs_ep->ep.maxpacket = epnum ? 512 : EP0_MPS_LIMIT;
-	hs_ep->ep.ops = &s3c_hsotg_ep_ops;
+	hs_ep->ep.ops = &dwc_hsotg_ep_ops;
 
 	/*
 	 * Read the FIFO size for the Periodic TX FIFO, even if we're
@@ -3126,12 +3188,12 @@ static void __devinit s3c_hsotg_initep(struct s3c_hsotg *hsotg,
 }
 
 /**
- * s3c_hsotg_hw_cfg - read HW configuration registers
+ * dwc_hsotg_hw_cfg - read HW configuration registers
  * @param: The device state
  *
  * Read the USB core HW configuration registers
  */
-static void s3c_hsotg_hw_cfg(struct s3c_hsotg *hsotg)
+static void dwc_hsotg_hw_cfg(struct dwc_hsotg *hsotg)
 {
 	u32 cfg2, cfg4;
 	/* check hardware configuration */
@@ -3149,16 +3211,18 @@ static void s3c_hsotg_hw_cfg(struct s3c_hsotg *hsotg)
 }
 
 /**
- * s3c_hsotg_dump - dump state of the udc
+ * dwc_hsotg_dump - dump state of the udc
  * @param: The device state
  */
-static void s3c_hsotg_dump(struct s3c_hsotg *hsotg)
+static void dwc_hsotg_dump(struct dwc_hsotg *hsotg)
 {
 #ifdef DEBUG
 	struct device *dev = hsotg->dev;
 	void __iomem *regs = hsotg->regs;
+#if 0
 	u32 val;
 	int idx;
+#endif
 
 	dev_info(dev, "DCFG=0x%08x, DCTL=0x%08x, DIEPMSK=%08x\n",
 		 readl(regs + DCFG), readl(regs + DCTL),
@@ -3170,6 +3234,7 @@ static void s3c_hsotg_dump(struct s3c_hsotg *hsotg)
 	dev_info(dev, "GRXFSIZ=0x%08x, GNPTXFSIZ=0x%08x\n",
 		 readl(regs + GRXFSIZ), readl(regs + GNPTXFSIZ));
 
+#if 0
 	/* show periodic fifo settings */
 
 	for (idx = 1; idx <= 15; idx++) {
@@ -3194,6 +3259,7 @@ static void s3c_hsotg_dump(struct s3c_hsotg *hsotg)
 			 readl(regs + DOEPDMA(idx)));
 
 	}
+#endif
 
 	dev_info(dev, "DVBUSDIS=0x%08x, DVBUSPULSE=%08x\n",
 		 readl(regs + DVBUSDIS), readl(regs + DVBUSPULSE));
@@ -3211,7 +3277,7 @@ static void s3c_hsotg_dump(struct s3c_hsotg *hsotg)
  */
 static int state_show(struct seq_file *seq, void *v)
 {
-	struct s3c_hsotg *hsotg = seq->private;
+	struct dwc_hsotg *hsotg = seq->private;
 	void __iomem *regs = hsotg->regs;
 	int idx;
 
@@ -3281,7 +3347,7 @@ static const struct file_operations state_fops = {
  */
 static int fifo_show(struct seq_file *seq, void *v)
 {
-	struct s3c_hsotg *hsotg = seq->private;
+	struct dwc_hsotg *hsotg = seq->private;
 	void __iomem *regs = hsotg->regs;
 	u32 val;
 	int idx;
@@ -3336,9 +3402,9 @@ static const char *decode_direction(int is_in)
  */
 static int ep_show(struct seq_file *seq, void *v)
 {
-	struct s3c_hsotg_ep *ep = seq->private;
-	struct s3c_hsotg *hsotg = ep->parent;
-	struct s3c_hsotg_req *req;
+	struct dwc_hsotg_ep *ep = seq->private;
+	struct dwc_hsotg *hsotg = ep->parent;
+	struct dwc_hsotg_req *req;
 	void __iomem *regs = hsotg->regs;
 	int index = ep->index;
 	int show_limit = 15;
@@ -3406,7 +3472,7 @@ static const struct file_operations ep_fops = {
 };
 
 /**
- * s3c_hsotg_create_debug - create debugfs directory and files
+ * dwc_hsotg_create_debug - create debugfs directory and files
  * @hsotg: The driver state
  *
  * Create the debugfs files to allow the user to get information
@@ -3414,7 +3480,7 @@ static const struct file_operations ep_fops = {
  * with the same name as the device itself, in case we end up
  * with multiple blocks in future systems.
  */
-static void __devinit s3c_hsotg_create_debug(struct s3c_hsotg *hsotg)
+static void __devinit dwc_hsotg_create_debug(struct dwc_hsotg *hsotg)
 {
 	struct dentry *root;
 	unsigned epidx;
@@ -3443,7 +3509,7 @@ static void __devinit s3c_hsotg_create_debug(struct s3c_hsotg *hsotg)
 	/* create one file for each endpoint */
 
 	for (epidx = 0; epidx < hsotg->num_of_eps; epidx++) {
-		struct s3c_hsotg_ep *ep = &hsotg->eps[epidx];
+		struct dwc_hsotg_ep *ep = &hsotg->eps[epidx];
 
 		ep->debugfs = debugfs_create_file(ep->name, 0444,
 						  root, ep, &ep_fops);
@@ -3455,17 +3521,17 @@ static void __devinit s3c_hsotg_create_debug(struct s3c_hsotg *hsotg)
 }
 
 /**
- * s3c_hsotg_delete_debug - cleanup debugfs entries
+ * dwc_hsotg_delete_debug - cleanup debugfs entries
  * @hsotg: The driver state
  *
  * Cleanup (remove) the debugfs files for use on module exit.
  */
-static void __devexit s3c_hsotg_delete_debug(struct s3c_hsotg *hsotg)
+static void __devexit dwc_hsotg_delete_debug(struct dwc_hsotg *hsotg)
 {
 	unsigned epidx;
 
 	for (epidx = 0; epidx < hsotg->num_of_eps; epidx++) {
-		struct s3c_hsotg_ep *ep = &hsotg->eps[epidx];
+		struct dwc_hsotg_ep *ep = &hsotg->eps[epidx];
 		debugfs_remove(ep->debugfs);
 	}
 
@@ -3475,16 +3541,190 @@ static void __devexit s3c_hsotg_delete_debug(struct s3c_hsotg *hsotg)
 }
 
 /**
- * s3c_hsotg_release - release callback for hsotg device
+ * dwc_hsotg_release - release callback for hsotg device
  * @dev: Device to for which release is called
  */
-static void s3c_hsotg_release(struct device *dev)
+static void dwc_hsotg_release(struct device *dev)
 {
-	struct s3c_hsotg *hsotg = dev_get_drvdata(dev);
+	struct dwc_hsotg *hsotg = dev_get_drvdata(dev);
 
 	kfree(hsotg);
 }
 
+#ifdef DWC_HSOTG_PCI
+
+static int __devinit dwc_hsotg_probe(struct pci_dev *pci,
+		const struct pci_device_id *id)
+{
+	struct resource		res;
+	struct dwc_hsotg	*hsotg;
+	struct dwc_hsotg_ep	*eps;
+	int			epnum;
+	int			ret;
+
+	ret = pci_enable_device(pci);
+	if (ret) {
+		dev_err(&pci->dev, "failed to enable pci device\n");
+		return -ENODEV;
+	}
+
+	pci_set_power_state(pci, PCI_D0);
+	pci_set_master(pci);
+
+	hsotg = devm_kzalloc(&pci->dev, sizeof(struct dwc_hsotg), GFP_KERNEL);
+	if (!hsotg) {
+		dev_err(&pci->dev, "cannot get memory\n");
+		ret = -ENOMEM;
+		goto err1;
+	}
+
+	hsotg->dev = &pci->dev;
+
+	res.start	= pci_resource_start(pci, 0);
+	res.end		= pci_resource_end(pci, 0);
+	res.name	= dev_name(&pci->dev);
+	res.flags	= IORESOURCE_MEM;
+
+	hsotg->regs = devm_request_and_ioremap(&pci->dev, &res);
+	if (!hsotg->regs) {
+		dev_err(&pci->dev, "cannot map registers\n");
+		ret = -ENXIO;
+		goto err1;
+	}
+
+	if (!pci->irq) {
+		dev_err(&pci->dev, "no IRQ for PCI device\n");
+		ret = -ENODEV;
+		goto err1;
+	}
+
+	hsotg->irq = pci->irq;
+	spin_lock_init(&hsotg->lock);
+
+	dev_info(&pci->dev, "regs %p, irq %d\n", hsotg->regs, hsotg->irq);
+
+	device_initialize(&hsotg->gadget.dev);
+
+	dev_set_name(&hsotg->gadget.dev, "gadget");
+
+	hsotg->gadget.max_speed = USB_SPEED_HIGH;
+	hsotg->gadget.ops = &dwc_hsotg_gadget_ops;
+	hsotg->gadget.name = dev_name(&pci->dev);
+
+	hsotg->gadget.dev.parent = &pci->dev;
+	hsotg->gadget.dev.dma_mask = pci->dev.dma_mask;
+	hsotg->gadget.dev.release = dwc_hsotg_release;
+
+	pci_set_drvdata(pci, hsotg);
+
+	/* usb phy enable */
+	dwc_hsotg_phy_enable(hsotg);
+
+	dwc_hsotg_corereset(hsotg);
+	dwc_hsotg_init(hsotg);
+	dwc_hsotg_hw_cfg(hsotg);
+
+	/* hsotg->num_of_eps holds number of EPs other than ep0 */
+
+	if (hsotg->num_of_eps == 0) {
+		dev_err(&pci->dev, "wrong number of EPs (zero)\n");
+		ret = -EINVAL;
+		goto err2;
+	}
+
+	eps = kcalloc(hsotg->num_of_eps + 1, sizeof(struct dwc_hsotg_ep),
+		      GFP_KERNEL);
+	if (!eps) {
+		dev_err(&pci->dev, "cannot get memory\n");
+		ret = -ENOMEM;
+		goto err2;
+	}
+
+	hsotg->eps = eps;
+
+	/* setup endpoint information */
+
+	INIT_LIST_HEAD(&hsotg->gadget.ep_list);
+	hsotg->gadget.ep0 = &hsotg->eps[0].ep;
+
+	/* allocate EP0 request */
+
+	hsotg->ctrl_req = dwc_hsotg_ep_alloc_request(&hsotg->eps[0].ep,
+						     GFP_KERNEL);
+	if (!hsotg->ctrl_req) {
+		dev_err(&pci->dev, "failed to allocate ctrl req\n");
+		ret = -ENOMEM;
+		goto err3;
+	}
+
+	/* initialise the endpoints now the core has been initialised */
+	for (epnum = 0; epnum < hsotg->num_of_eps; epnum++)
+		dwc_hsotg_initep(hsotg, &hsotg->eps[epnum], epnum);
+
+	dwc_hsotg_phy_disable(hsotg);
+
+	ret = devm_request_irq(&pci->dev, hsotg->irq, dwc_hsotg_irq, IRQF_SHARED,
+				dev_name(&pci->dev), hsotg);
+	if (ret < 0) {
+		dev_err(&pci->dev, "cannot claim IRQ\n");
+		goto err4;
+	}
+
+	ret = device_add(&hsotg->gadget.dev);
+	if (ret) {
+		put_device(&hsotg->gadget.dev);
+		goto err4;
+	}
+
+	ret = usb_add_gadget_udc(&pci->dev, &hsotg->gadget);
+	if (ret)
+		goto err5;
+
+	dwc_hsotg_create_debug(hsotg);
+
+	dwc_hsotg_dump(hsotg);
+
+	return 0;
+
+err5:
+	device_unregister(&hsotg->gadget.dev);
+err4:
+err3:
+	kfree(eps);
+err2:
+	dwc_hsotg_phy_disable(hsotg);
+	pci_set_drvdata(pci, NULL);
+err1:
+//	pci_disable_device(pci);
+	return ret;
+}
+
+static void __devexit dwc_hsotg_remove(struct pci_dev *pci)
+{
+	struct dwc_hsotg *hsotg = pci_get_drvdata(pci);
+
+	dwc_hsotg_delete_debug(hsotg);
+	usb_del_gadget_udc(&hsotg->gadget);
+
+	if (hsotg->driver) {
+		/* should have been done already by driver model core */
+		usb_gadget_unregister_driver(hsotg->driver);
+	}
+
+	device_unregister(&hsotg->gadget.dev);
+	kfree(hsotg->eps);
+	dwc_hsotg_phy_disable(hsotg);
+	pci_set_drvdata(pci, NULL);
+//	pci_disable_device(pci);
+}
+
+#if 1
+#define dwc_hsotg_suspend NULL
+#define dwc_hsotg_resume NULL
+#endif
+
+#else
+
 /**
  * s3c_hsotg_probe - probe function for hsotg driver
  * @pdev: The platform information for the driver
@@ -3492,10 +3732,10 @@ static void s3c_hsotg_release(struct device *dev)
 
 static int __devinit s3c_hsotg_probe(struct platform_device *pdev)
 {
-	struct s3c_hsotg_plat *plat = pdev->dev.platform_data;
+	struct dwc_hsotg_plat *plat = pdev->dev.platform_data;
 	struct device *dev = &pdev->dev;
-	struct s3c_hsotg_ep *eps;
-	struct s3c_hsotg *hsotg;
+	struct dwc_hsotg_ep *eps;
+	struct dwc_hsotg *hsotg;
 	struct resource *res;
 	int epnum;
 	int ret;
@@ -3507,7 +3747,7 @@ static int __devinit s3c_hsotg_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 
-	hsotg = devm_kzalloc(&pdev->dev, sizeof(struct s3c_hsotg), GFP_KERNEL);
+	hsotg = devm_kzalloc(&pdev->dev, sizeof(struct dwc_hsotg), GFP_KERNEL);
 	if (!hsotg) {
 		dev_err(dev, "cannot get memory\n");
 		return -ENOMEM;
@@ -3543,7 +3783,7 @@ static int __devinit s3c_hsotg_probe(struct platform_device *pdev)
 
 	hsotg->irq = ret;
 
-	ret = devm_request_irq(&pdev->dev, hsotg->irq, s3c_hsotg_irq, 0,
+	ret = devm_request_irq(&pdev->dev, hsotg->irq, dwc_hsotg_irq, 0,
 				dev_name(dev), hsotg);
 	if (ret < 0) {
 		dev_err(dev, "cannot claim IRQ\n");
@@ -3557,12 +3797,12 @@ static int __devinit s3c_hsotg_probe(struct platform_device *pdev)
 	dev_set_name(&hsotg->gadget.dev, "gadget");
 
 	hsotg->gadget.max_speed = USB_SPEED_HIGH;
-	hsotg->gadget.ops = &s3c_hsotg_gadget_ops;
+	hsotg->gadget.ops = &dwc_hsotg_gadget_ops;
 	hsotg->gadget.name = dev_name(dev);
 
 	hsotg->gadget.dev.parent = dev;
 	hsotg->gadget.dev.dma_mask = dev->dma_mask;
-	hsotg->gadget.dev.release = s3c_hsotg_release;
+	hsotg->gadget.dev.release = dwc_hsotg_release;
 
 	/* reset the system */
 
@@ -3589,11 +3829,11 @@ static int __devinit s3c_hsotg_probe(struct platform_device *pdev)
 	}
 
 	/* usb phy enable */
-	s3c_hsotg_phy_enable(hsotg);
+	dwc_hsotg_phy_enable(hsotg);
 
-	s3c_hsotg_corereset(hsotg);
-	s3c_hsotg_init(hsotg);
-	s3c_hsotg_hw_cfg(hsotg);
+	dwc_hsotg_corereset(hsotg);
+	dwc_hsotg_init(hsotg);
+	dwc_hsotg_hw_cfg(hsotg);
 
 	/* hsotg->num_of_eps holds number of EPs other than ep0 */
 
@@ -3603,7 +3843,7 @@ static int __devinit s3c_hsotg_probe(struct platform_device *pdev)
 		goto err_supplies;
 	}
 
-	eps = kcalloc(hsotg->num_of_eps + 1, sizeof(struct s3c_hsotg_ep),
+	eps = kcalloc(hsotg->num_of_eps + 1, sizeof(struct dwc_hsotg_ep),
 		      GFP_KERNEL);
 	if (!eps) {
 		dev_err(dev, "cannot get memory\n");
@@ -3620,7 +3860,7 @@ static int __devinit s3c_hsotg_probe(struct platform_device *pdev)
 
 	/* allocate EP0 request */
 
-	hsotg->ctrl_req = s3c_hsotg_ep_alloc_request(&hsotg->eps[0].ep,
+	hsotg->ctrl_req = dwc_hsotg_ep_alloc_request(&hsotg->eps[0].ep,
 						     GFP_KERNEL);
 	if (!hsotg->ctrl_req) {
 		dev_err(dev, "failed to allocate ctrl req\n");
@@ -3630,7 +3870,7 @@ static int __devinit s3c_hsotg_probe(struct platform_device *pdev)
 
 	/* initialise the endpoints now the core has been initialised */
 	for (epnum = 0; epnum < hsotg->num_of_eps; epnum++)
-		s3c_hsotg_initep(hsotg, &hsotg->eps[epnum], epnum);
+		dwc_hsotg_initep(hsotg, &hsotg->eps[epnum], epnum);
 
 	/* disable power and clock */
 
@@ -3641,7 +3881,7 @@ static int __devinit s3c_hsotg_probe(struct platform_device *pdev)
 		goto err_ep_mem;
 	}
 
-	s3c_hsotg_phy_disable(hsotg);
+	dwc_hsotg_phy_disable(hsotg);
 
 	ret = device_add(&hsotg->gadget.dev);
 	if (ret) {
@@ -3653,16 +3893,16 @@ static int __devinit s3c_hsotg_probe(struct platform_device *pdev)
 	if (ret)
 		goto err_ep_mem;
 
-	s3c_hsotg_create_debug(hsotg);
+	dwc_hsotg_create_debug(hsotg);
 
-	s3c_hsotg_dump(hsotg);
+	dwc_hsotg_dump(hsotg);
 
 	return 0;
 
 err_ep_mem:
 	kfree(eps);
 err_supplies:
-	s3c_hsotg_phy_disable(hsotg);
+	dwc_hsotg_phy_disable(hsotg);
 	regulator_bulk_free(ARRAY_SIZE(hsotg->supplies), hsotg->supplies);
 
 err_clk:
@@ -3677,18 +3917,18 @@ err_clk:
  */
 static int __devexit s3c_hsotg_remove(struct platform_device *pdev)
 {
-	struct s3c_hsotg *hsotg = platform_get_drvdata(pdev);
+	struct dwc_hsotg *hsotg = platform_get_drvdata(pdev);
 
 	usb_del_gadget_udc(&hsotg->gadget);
 
-	s3c_hsotg_delete_debug(hsotg);
+	dwc_hsotg_delete_debug(hsotg);
 
 	if (hsotg->driver) {
 		/* should have been done already by driver model core */
 		usb_gadget_unregister_driver(hsotg->driver);
 	}
 
-	s3c_hsotg_phy_disable(hsotg);
+	dwc_hsotg_phy_disable(hsotg);
 	regulator_bulk_free(ARRAY_SIZE(hsotg->supplies), hsotg->supplies);
 
 	clk_disable_unprepare(hsotg->clk);
@@ -3702,6 +3942,33 @@ static int __devexit s3c_hsotg_remove(struct platform_device *pdev)
 #define s3c_hsotg_resume NULL
 #endif
 
+#endif
+
+#ifdef DWC_HSOTG_PCI
+
+static DEFINE_PCI_DEVICE_TABLE(dwc_hsotg_pci_id_table) = {
+	{
+		PCI_DEVICE(PCI_VENDOR_ID_SYNOPSYS,
+				PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3),
+	},
+	{  }	/* Terminating Entry */
+};
+MODULE_DEVICE_TABLE(pci, dwc_hsotg_pci_id_table);
+
+static struct pci_driver dwc_hsotg_driver = {
+	.name		= "dwc-hsotg",
+	.id_table	= dwc_hsotg_pci_id_table,
+	.probe		= dwc_hsotg_probe,
+	.remove		= __devexit_p(dwc_hsotg_remove),
+	.suspend	= dwc_hsotg_suspend,
+	.resume		= dwc_hsotg_resume,
+};
+
+module_pci_driver(dwc_hsotg_driver);
+MODULE_ALIAS("pci:dwc-hsotg");
+
+#else
+
 static struct platform_driver s3c_hsotg_driver = {
 	.driver		= {
 		.name	= "s3c-hsotg",
@@ -3714,8 +3981,10 @@ static struct platform_driver s3c_hsotg_driver = {
 };
 
 module_platform_driver(s3c_hsotg_driver);
+MODULE_ALIAS("platform:s3c-hsotg");
+
+#endif
 
 MODULE_DESCRIPTION("Samsung S3C USB High-speed/OtG device");
 MODULE_AUTHOR("Ben Dooks <ben@xxxxxxxxxxxx>");
 MODULE_LICENSE("GPL");
-MODULE_ALIAS("platform:s3c-hsotg");


��.n��������+%������w��{.n�����{���)��jg��������ݢj����G�������j:+v���w�m������w�������h�����٥





[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux