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@denx.de>
#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,
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,
#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;
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);
return !!(readl(®->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) {}
/***********************************************************/
/*
* 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);
/*
* udc_reinit - initialize software state
*/
-static void udc_reinit(struct s3c_udc *dev)
+static void udc_reinit(struct dwc2_udc *dev)
{
unsigned int i;
/* 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);
*/
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;
*/
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)
}
}
-static void stop_activity(struct s3c_udc *dev,
+static void stop_activity(struct dwc2_udc *dev,
struct usb_gadget_driver *driver)
{
int i;
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;
writel(GAHBCFG_INIT, ®->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;
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);
/* 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,
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);
#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 =
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 =
#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;
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;
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;
}
}
-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;
}
-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;
}
}
-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;
*/
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;
{
struct s3c_request *req;
struct s3c_ep *ep;
- struct s3c_udc *dev;
+ struct dwc2_udc *dev;
unsigned long flags = 0;
u32 ep_num, gintsts;
* 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(®->dcfg);
writel(DEVICE_ADDRESS(address) | ctrl, ®->dcfg);
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;
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];
/*
* 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];
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;
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;
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;
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;
/*
* 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;
/*
* 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,
}
}
-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));
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;
struct list_head queue;
};
-struct s3c_udc {
+struct dwc2_udc {
struct usb_gadget gadget;
struct usb_gadget_driver *driver;
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);