[U-Boot] [PATCH 02/24] usb: s3c-otg: Rename struct s3c_udc to dwc2_udc

Marek Vasut marex at denx.de
Fri Dec 4 03:38:00 CET 2015


The driver is actually for the Designware DWC2 controller.
This patch renames struct s3c_udc to struct dwc2_udc to make
things more obvious and clear.

Signed-off-by: Marek Vasut <marex at denx.de>
---
 drivers/usb/gadget/bcm_udc_otg_phy.c      |  4 +--
 drivers/usb/gadget/s3c_udc_otg.c          | 46 +++++++++++++++----------------
 drivers/usb/gadget/s3c_udc_otg_phy.c      |  4 +--
 drivers/usb/gadget/s3c_udc_otg_xfer_dma.c | 38 ++++++++++++-------------
 include/usb/s3c_udc.h                     | 10 +++----
 5 files changed, 51 insertions(+), 51 deletions(-)

diff --git a/drivers/usb/gadget/bcm_udc_otg_phy.c b/drivers/usb/gadget/bcm_udc_otg_phy.c
index f8690b0..936247e 100644
--- a/drivers/usb/gadget/bcm_udc_otg_phy.c
+++ b/drivers/usb/gadget/bcm_udc_otg_phy.c
@@ -12,7 +12,7 @@
 #include <usb/s3c_udc.h>
 #include "bcm_udc_otg.h"
 
-void otg_phy_init(struct s3c_udc *dev)
+void otg_phy_init(struct dwc2_udc *dev)
 {
 	/* set Phy to driving mode */
 	wfld_clear(HSOTG_CTRL_BASE_ADDR + HSOTG_CTRL_PHY_P1CTL_OFFSET,
@@ -37,7 +37,7 @@ void otg_phy_init(struct s3c_udc *dev)
 		 HSOTG_CTRL_PHY_P1CTL_SOFT_RESET_MASK);
 }
 
-void otg_phy_off(struct s3c_udc *dev)
+void otg_phy_off(struct dwc2_udc *dev)
 {
 	/* Soft Disconnect */
 	wfld_set(HSOTG_BASE_ADDR + HSOTG_DCTL_OFFSET,
diff --git a/drivers/usb/gadget/s3c_udc_otg.c b/drivers/usb/gadget/s3c_udc_otg.c
index 184ff4e..eb7f77e 100644
--- a/drivers/usb/gadget/s3c_udc_otg.c
+++ b/drivers/usb/gadget/s3c_udc_otg.c
@@ -65,7 +65,7 @@ static char *state_names[] = {
 #define DRIVER_DESC "S3C HS USB OTG Device Driver, (c) Samsung Electronics"
 #define DRIVER_VERSION "15 March 2009"
 
-struct s3c_udc	*the_controller;
+struct dwc2_udc	*the_controller;
 
 static const char driver_name[] = "s3c-udc";
 static const char driver_desc[] = DRIVER_DESC;
@@ -94,18 +94,18 @@ static int s3c_queue(struct usb_ep *ep, struct usb_request *, gfp_t gfp_flags);
 static int s3c_dequeue(struct usb_ep *ep, struct usb_request *);
 static int s3c_fifo_status(struct usb_ep *ep);
 static void s3c_fifo_flush(struct usb_ep *ep);
-static void s3c_ep0_read(struct s3c_udc *dev);
-static void s3c_ep0_kick(struct s3c_udc *dev, struct s3c_ep *ep);
-static void s3c_handle_ep0(struct s3c_udc *dev);
-static int s3c_ep0_write(struct s3c_udc *dev);
+static void s3c_ep0_read(struct dwc2_udc *dev);
+static void s3c_ep0_kick(struct dwc2_udc *dev, struct s3c_ep *ep);
+static void s3c_handle_ep0(struct dwc2_udc *dev);
+static int s3c_ep0_write(struct dwc2_udc *dev);
 static int write_fifo_ep0(struct s3c_ep *ep, struct s3c_request *req);
 static void done(struct s3c_ep *ep, struct s3c_request *req, int status);
-static void stop_activity(struct s3c_udc *dev,
+static void stop_activity(struct dwc2_udc *dev,
 			  struct usb_gadget_driver *driver);
-static int udc_enable(struct s3c_udc *dev);
-static void udc_set_address(struct s3c_udc *dev, unsigned char address);
-static void reconfig_usbd(struct s3c_udc *dev);
-static void set_max_pktsize(struct s3c_udc *dev, enum usb_device_speed speed);
+static int udc_enable(struct dwc2_udc *dev);
+static void udc_set_address(struct dwc2_udc *dev, unsigned char address);
+static void reconfig_usbd(struct dwc2_udc *dev);
+static void set_max_pktsize(struct dwc2_udc *dev, enum usb_device_speed speed);
 static void nuke(struct s3c_ep *ep, int status);
 static int s3c_udc_set_halt(struct usb_ep *_ep, int value);
 static void s3c_udc_set_nak(struct s3c_ep *ep);
@@ -151,8 +151,8 @@ bool dfu_usb_get_reset(void)
 	return !!(readl(&reg->gintsts) & INT_RESET);
 }
 
-__weak void otg_phy_init(struct s3c_udc *dev) {}
-__weak void otg_phy_off(struct s3c_udc *dev) {}
+__weak void otg_phy_init(struct dwc2_udc *dev) {}
+__weak void otg_phy_off(struct dwc2_udc *dev) {}
 
 /***********************************************************/
 
@@ -161,7 +161,7 @@ __weak void otg_phy_off(struct s3c_udc *dev) {}
 /*
  *	udc_disable - disable USB device controller
  */
-static void udc_disable(struct s3c_udc *dev)
+static void udc_disable(struct dwc2_udc *dev)
 {
 	debug_cond(DEBUG_SETUP != 0, "%s: %p\n", __func__, dev);
 
@@ -177,7 +177,7 @@ static void udc_disable(struct s3c_udc *dev)
 /*
  *	udc_reinit - initialize software state
  */
-static void udc_reinit(struct s3c_udc *dev)
+static void udc_reinit(struct dwc2_udc *dev)
 {
 	unsigned int i;
 
@@ -210,7 +210,7 @@ static void udc_reinit(struct s3c_udc *dev)
 /* until it's enabled, this UDC should be completely invisible
  * to any USB host.
  */
-static int udc_enable(struct s3c_udc *dev)
+static int udc_enable(struct dwc2_udc *dev)
 {
 	debug_cond(DEBUG_SETUP != 0, "%s: %p\n", __func__, dev);
 
@@ -231,7 +231,7 @@ static int udc_enable(struct s3c_udc *dev)
 */
 int usb_gadget_register_driver(struct usb_gadget_driver *driver)
 {
-	struct s3c_udc *dev = the_controller;
+	struct dwc2_udc *dev = the_controller;
 	int retval = 0;
 	unsigned long flags = 0;
 
@@ -280,7 +280,7 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
  */
 int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
 {
-	struct s3c_udc *dev = the_controller;
+	struct dwc2_udc *dev = the_controller;
 	unsigned long flags = 0;
 
 	if (!dev)
@@ -368,7 +368,7 @@ static void nuke(struct s3c_ep *ep, int status)
 	}
 }
 
-static void stop_activity(struct s3c_udc *dev,
+static void stop_activity(struct dwc2_udc *dev,
 			  struct usb_gadget_driver *driver)
 {
 	int i;
@@ -396,7 +396,7 @@ static void stop_activity(struct s3c_udc *dev,
 	udc_reinit(dev);
 }
 
-static void reconfig_usbd(struct s3c_udc *dev)
+static void reconfig_usbd(struct dwc2_udc *dev)
 {
 	/* 2. Soft-reset OTG Core and then unreset again. */
 	int i;
@@ -496,7 +496,7 @@ static void reconfig_usbd(struct s3c_udc *dev)
 	writel(GAHBCFG_INIT, &reg->gahbcfg);
 }
 
-static void set_max_pktsize(struct s3c_udc *dev, enum usb_device_speed speed)
+static void set_max_pktsize(struct dwc2_udc *dev, enum usb_device_speed speed)
 {
 	unsigned int ep_ctrl;
 	int i;
@@ -530,7 +530,7 @@ static int s3c_ep_enable(struct usb_ep *_ep,
 			 const struct usb_endpoint_descriptor *desc)
 {
 	struct s3c_ep *ep;
-	struct s3c_udc *dev;
+	struct dwc2_udc *dev;
 	unsigned long flags = 0;
 
 	debug("%s: %p\n", __func__, _ep);
@@ -722,7 +722,7 @@ static const struct usb_gadget_ops s3c_udc_ops = {
 	/* current versions must always be self-powered */
 };
 
-static struct s3c_udc memory = {
+static struct dwc2_udc memory = {
 	.usb_address = 0,
 	.gadget = {
 		.ops = &s3c_udc_ops,
@@ -798,7 +798,7 @@ static struct s3c_udc memory = {
 
 int s3c_udc_probe(struct s3c_plat_otg_data *pdata)
 {
-	struct s3c_udc *dev = &memory;
+	struct dwc2_udc *dev = &memory;
 	int retval = 0;
 
 	debug("%s: %p\n", __func__, pdata);
diff --git a/drivers/usb/gadget/s3c_udc_otg_phy.c b/drivers/usb/gadget/s3c_udc_otg_phy.c
index 963b617..ffc930c 100644
--- a/drivers/usb/gadget/s3c_udc_otg_phy.c
+++ b/drivers/usb/gadget/s3c_udc_otg_phy.c
@@ -37,7 +37,7 @@
 
 #include <usb/s3c_udc.h>
 
-void otg_phy_init(struct s3c_udc *dev)
+void otg_phy_init(struct dwc2_udc *dev)
 {
 	unsigned int usb_phy_ctrl = dev->pdata->usb_phy_ctrl;
 	struct s3c_usbotg_phy *phy =
@@ -75,7 +75,7 @@ void otg_phy_init(struct s3c_udc *dev)
 	udelay(10);
 }
 
-void otg_phy_off(struct s3c_udc *dev)
+void otg_phy_off(struct dwc2_udc *dev)
 {
 	unsigned int usb_phy_ctrl = dev->pdata->usb_phy_ctrl;
 	struct s3c_usbotg_phy *phy =
diff --git a/drivers/usb/gadget/s3c_udc_otg_xfer_dma.c b/drivers/usb/gadget/s3c_udc_otg_xfer_dma.c
index 7e7a2c2..6695444 100644
--- a/drivers/usb/gadget/s3c_udc_otg_xfer_dma.c
+++ b/drivers/usb/gadget/s3c_udc_otg_xfer_dma.c
@@ -25,7 +25,7 @@ int clear_feature_flag;
 #define GET_MAX_LUN_REQUEST	0xFE
 #define BOT_RESET_REQUEST	0xFF
 
-static inline void s3c_udc_ep0_zlp(struct s3c_udc *dev)
+static inline void s3c_udc_ep0_zlp(struct dwc2_udc *dev)
 {
 	u32 ep_ctrl;
 
@@ -186,7 +186,7 @@ int setdma_tx(struct s3c_ep *ep, struct s3c_request *req)
 	return length;
 }
 
-static void complete_rx(struct s3c_udc *dev, u8 ep_num)
+static void complete_rx(struct dwc2_udc *dev, u8 ep_num)
 {
 	struct s3c_ep *ep = &dev->ep[ep_num];
 	struct s3c_request *req = NULL;
@@ -259,7 +259,7 @@ static void complete_rx(struct s3c_udc *dev, u8 ep_num)
 		setdma_rx(ep, req);
 }
 
-static void complete_tx(struct s3c_udc *dev, u8 ep_num)
+static void complete_tx(struct dwc2_udc *dev, u8 ep_num)
 {
 	struct s3c_ep *ep = &dev->ep[ep_num];
 	struct s3c_request *req;
@@ -335,7 +335,7 @@ static void complete_tx(struct s3c_udc *dev, u8 ep_num)
 	}
 }
 
-static inline void s3c_udc_check_tx_queue(struct s3c_udc *dev, u8 ep_num)
+static inline void s3c_udc_check_tx_queue(struct dwc2_udc *dev, u8 ep_num)
 {
 	struct s3c_ep *ep = &dev->ep[ep_num];
 	struct s3c_request *req;
@@ -362,7 +362,7 @@ static inline void s3c_udc_check_tx_queue(struct s3c_udc *dev, u8 ep_num)
 
 }
 
-static void process_ep_in_intr(struct s3c_udc *dev)
+static void process_ep_in_intr(struct dwc2_udc *dev)
 {
 	u32 ep_intr, ep_intr_status;
 	u8 ep_num = 0;
@@ -409,7 +409,7 @@ static void process_ep_in_intr(struct s3c_udc *dev)
 	}
 }
 
-static void process_ep_out_intr(struct s3c_udc *dev)
+static void process_ep_out_intr(struct dwc2_udc *dev)
 {
 	u32 ep_intr, ep_intr_status;
 	u8 ep_num = 0;
@@ -463,7 +463,7 @@ static void process_ep_out_intr(struct s3c_udc *dev)
  */
 static int s3c_udc_irq(int irq, void *_dev)
 {
-	struct s3c_udc *dev = _dev;
+	struct dwc2_udc *dev = _dev;
 	u32 intr_status;
 	u32 usb_status, gintmsk;
 	unsigned long flags = 0;
@@ -584,7 +584,7 @@ static int s3c_queue(struct usb_ep *_ep, struct usb_request *_req,
 {
 	struct s3c_request *req;
 	struct s3c_ep *ep;
-	struct s3c_udc *dev;
+	struct dwc2_udc *dev;
 	unsigned long flags = 0;
 	u32 ep_num, gintsts;
 
@@ -737,7 +737,7 @@ int s3c_fifo_read(struct s3c_ep *ep, u32 *cp, int max)
  * Called from control endpoint function
  * after it decodes a set address setup packet.
  */
-static void udc_set_address(struct s3c_udc *dev, unsigned char address)
+static void udc_set_address(struct dwc2_udc *dev, unsigned char address)
 {
 	u32 ctrl = readl(&reg->dcfg);
 	writel(DEVICE_ADDRESS(address) | ctrl, &reg->dcfg);
@@ -753,7 +753,7 @@ static void udc_set_address(struct s3c_udc *dev, unsigned char address)
 
 static inline void s3c_udc_ep0_set_stall(struct s3c_ep *ep)
 {
-	struct s3c_udc *dev;
+	struct dwc2_udc *dev;
 	u32		ep_ctrl = 0;
 
 	dev = ep->dev;
@@ -779,7 +779,7 @@ static inline void s3c_udc_ep0_set_stall(struct s3c_ep *ep)
 	s3c_udc_pre_setup();
 }
 
-static void s3c_ep0_read(struct s3c_udc *dev)
+static void s3c_ep0_read(struct dwc2_udc *dev)
 {
 	struct s3c_request *req;
 	struct s3c_ep *ep = &dev->ep[0];
@@ -816,7 +816,7 @@ static void s3c_ep0_read(struct s3c_udc *dev)
 /*
  * DATA_STATE_XMIT
  */
-static int s3c_ep0_write(struct s3c_udc *dev)
+static int s3c_ep0_write(struct dwc2_udc *dev)
 {
 	struct s3c_request *req;
 	struct s3c_ep *ep = &dev->ep[0];
@@ -859,7 +859,7 @@ static int s3c_ep0_write(struct s3c_udc *dev)
 	return 1;
 }
 
-int s3c_udc_get_status(struct s3c_udc *dev,
+int s3c_udc_get_status(struct dwc2_udc *dev,
 		struct usb_ctrlrequest *crq)
 {
 	u8 ep_num = crq->wIndex & 0x7F;
@@ -1032,7 +1032,7 @@ void s3c_udc_ep_clear_stall(struct s3c_ep *ep)
 static int s3c_udc_set_halt(struct usb_ep *_ep, int value)
 {
 	struct s3c_ep	*ep;
-	struct s3c_udc	*dev;
+	struct dwc2_udc	*dev;
 	unsigned long	flags = 0;
 	u8		ep_num;
 
@@ -1125,7 +1125,7 @@ void s3c_udc_ep_activate(struct s3c_ep *ep)
 
 static int s3c_udc_clear_feature(struct usb_ep *_ep)
 {
-	struct s3c_udc	*dev;
+	struct dwc2_udc	*dev;
 	struct s3c_ep	*ep;
 	u8		ep_num;
 
@@ -1189,7 +1189,7 @@ static int s3c_udc_clear_feature(struct usb_ep *_ep)
 
 static int s3c_udc_set_feature(struct usb_ep *_ep)
 {
-	struct s3c_udc	*dev;
+	struct dwc2_udc	*dev;
 	struct s3c_ep	*ep;
 	u8		ep_num;
 
@@ -1262,7 +1262,7 @@ static int s3c_udc_set_feature(struct usb_ep *_ep)
 /*
  * WAIT_FOR_SETUP (OUT_PKT_RDY)
  */
-void s3c_ep0_setup(struct s3c_udc *dev)
+void s3c_ep0_setup(struct dwc2_udc *dev)
 {
 	struct s3c_ep *ep = &dev->ep[0];
 	int i;
@@ -1451,7 +1451,7 @@ void s3c_ep0_setup(struct s3c_udc *dev)
 /*
  * handle ep0 interrupt
  */
-static void s3c_handle_ep0(struct s3c_udc *dev)
+static void s3c_handle_ep0(struct dwc2_udc *dev)
 {
 	if (dev->ep0state == WAIT_FOR_SETUP) {
 		debug_cond(DEBUG_OUT_EP != 0,
@@ -1465,7 +1465,7 @@ static void s3c_handle_ep0(struct s3c_udc *dev)
 	}
 }
 
-static void s3c_ep0_kick(struct s3c_udc *dev, struct s3c_ep *ep)
+static void s3c_ep0_kick(struct dwc2_udc *dev, struct s3c_ep *ep)
 {
 	debug_cond(DEBUG_EP0 != 0,
 		   "%s: ep_is_in = %d\n", __func__, ep_is_in(ep));
diff --git a/include/usb/s3c_udc.h b/include/usb/s3c_udc.h
index 7f49a4e..f6c3a86 100644
--- a/include/usb/s3c_udc.h
+++ b/include/usb/s3c_udc.h
@@ -55,7 +55,7 @@ enum ep_type {
 
 struct s3c_ep {
 	struct usb_ep ep;
-	struct s3c_udc *dev;
+	struct dwc2_udc *dev;
 
 	const struct usb_endpoint_descriptor *desc;
 	struct list_head queue;
@@ -76,7 +76,7 @@ struct s3c_request {
 	struct list_head queue;
 };
 
-struct s3c_udc {
+struct dwc2_udc {
 	struct usb_gadget gadget;
 	struct usb_gadget_driver *driver;
 
@@ -90,14 +90,14 @@ struct s3c_udc {
 	unsigned req_pending:1, req_std:1;
 };
 
-extern struct s3c_udc *the_controller;
+extern struct dwc2_udc *the_controller;
 
 #define ep_is_in(EP) (((EP)->bEndpointAddress&USB_DIR_IN) == USB_DIR_IN)
 #define ep_index(EP) ((EP)->bEndpointAddress&0xF)
 #define ep_maxpacket(EP) ((EP)->ep.maxpacket)
 
-extern void otg_phy_init(struct s3c_udc *dev);
-extern void otg_phy_off(struct s3c_udc *dev);
+extern void otg_phy_init(struct dwc2_udc *dev);
+extern void otg_phy_off(struct dwc2_udc *dev);
 
 extern void s3c_udc_ep_set_stall(struct s3c_ep *ep);
 extern int s3c_udc_probe(struct s3c_plat_otg_data *pdata);
-- 
2.1.4



More information about the U-Boot mailing list