Commit 941fcce4 authored by Dinh Nguyen's avatar Dinh Nguyen Committed by Felipe Balbi

usb: dwc2: Update the gadget driver to use common dwc2_hsotg structure

Adds the gadget data structure and appropriate data structure pointers
to the common dwc2_hsotg data structure. To keep the driver data
dereference code looking clean, the gadget variable declares are only available
for peripheral and dual-role mode. This is needed so that the dwc2_hsotg data
structure can be used by the hcd and gadget drivers.

Updates gadget.c to use the dwc2_hsotg data structure and gadget pointers
that have been moved into the common dwc2_hsotg structure.
Signed-off-by: default avatarDinh Nguyen <dinguyen@opensource.altera.com>
Signed-off-by: default avatarPaul Zimmerman <paulz@synopsys.com>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 0cf884e8
...@@ -84,7 +84,7 @@ static const char * const s3c_hsotg_supply_names[] = { ...@@ -84,7 +84,7 @@ static const char * const s3c_hsotg_supply_names[] = {
*/ */
#define EP0_MPS_LIMIT 64 #define EP0_MPS_LIMIT 64
struct s3c_hsotg; struct dwc2_hsotg;
struct s3c_hsotg_req; struct s3c_hsotg_req;
/** /**
...@@ -130,7 +130,7 @@ struct s3c_hsotg_req; ...@@ -130,7 +130,7 @@ struct s3c_hsotg_req;
struct s3c_hsotg_ep { struct s3c_hsotg_ep {
struct usb_ep ep; struct usb_ep ep;
struct list_head queue; struct list_head queue;
struct s3c_hsotg *parent; struct dwc2_hsotg *parent;
struct s3c_hsotg_req *req; struct s3c_hsotg_req *req;
struct dentry *debugfs; struct dentry *debugfs;
...@@ -154,67 +154,6 @@ struct s3c_hsotg_ep { ...@@ -154,67 +154,6 @@ struct s3c_hsotg_ep {
char name[10]; char name[10];
}; };
/**
* struct s3c_hsotg - driver state.
* @dev: The parent device supplied to the probe function
* @driver: USB gadget driver
* @phy: The otg phy transceiver structure for phy control.
* @uphy: The otg phy transceiver structure for old USB phy control.
* @plat: The platform specific configuration data. This can be removed once
* all SoCs support usb transceiver.
* @regs: The memory area mapped for accessing registers.
* @irq: The IRQ number we are using
* @supplies: Definition of USB power supplies
* @phyif: PHY interface width
* @dedicated_fifos: Set if the hardware has dedicated IN-EP fifos.
* @num_of_eps: Number of available EPs (excluding EP0)
* @debug_root: root directrory for debugfs.
* @debug_file: main status file for debugfs.
* @debug_fifo: FIFO status file for debugfs.
* @ep0_reply: Request used for ep0 reply.
* @ep0_buff: Buffer for EP0 reply data, if needed.
* @ctrl_buff: Buffer for EP0 control requests.
* @ctrl_req: Request for EP0 control packets.
* @setup: NAK management for EP0 SETUP
* @last_rst: Time of last reset
* @eps: The endpoints being supplied to the gadget framework
*/
struct s3c_hsotg {
struct device *dev;
struct usb_gadget_driver *driver;
struct phy *phy;
struct usb_phy *uphy;
struct s3c_hsotg_plat *plat;
spinlock_t lock;
void __iomem *regs;
int irq;
struct clk *clk;
struct regulator_bulk_data supplies[ARRAY_SIZE(s3c_hsotg_supply_names)];
u32 phyif;
int fifo_mem;
unsigned int dedicated_fifos:1;
unsigned char num_of_eps;
u32 fifo_map;
struct dentry *debug_root;
struct dentry *debug_file;
struct dentry *debug_fifo;
struct usb_request *ep0_reply;
struct usb_request *ctrl_req;
u8 ep0_buff[8];
u8 ctrl_buff[8];
struct usb_gadget gadget;
unsigned int setup;
unsigned long last_rst;
struct s3c_hsotg_ep *eps;
};
/** /**
* struct s3c_hsotg_req - data transfer request * struct s3c_hsotg_req - data transfer request
* @req: The USB gadget request * @req: The USB gadget request
...@@ -229,6 +168,7 @@ struct s3c_hsotg_req { ...@@ -229,6 +168,7 @@ struct s3c_hsotg_req {
unsigned char mapped; unsigned char mapped;
}; };
#if IS_ENABLED(CONFIG_USB_DWC2_PERIPHERAL) || IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE)
#define call_gadget(_hs, _entry) \ #define call_gadget(_hs, _entry) \
do { \ do { \
if ((_hs)->gadget.speed != USB_SPEED_UNKNOWN && \ if ((_hs)->gadget.speed != USB_SPEED_UNKNOWN && \
...@@ -238,6 +178,9 @@ do { \ ...@@ -238,6 +178,9 @@ do { \
spin_lock(&_hs->lock); \ spin_lock(&_hs->lock); \
} \ } \
} while (0) } while (0)
#else
#define call_gadget(_hs, _entry) do {} while (0)
#endif
struct dwc2_hsotg; struct dwc2_hsotg;
struct dwc2_host_chan; struct dwc2_host_chan;
...@@ -495,11 +438,13 @@ struct dwc2_hw_params { ...@@ -495,11 +438,13 @@ struct dwc2_hw_params {
* struct dwc2_hsotg - Holds the state of the driver, including the non-periodic * struct dwc2_hsotg - Holds the state of the driver, including the non-periodic
* and periodic schedules * and periodic schedules
* *
* These are common for both host and peripheral modes:
*
* @dev: The struct device pointer * @dev: The struct device pointer
* @regs: Pointer to controller regs * @regs: Pointer to controller regs
* @core_params: Parameters that define how the core should be configured
* @hw_params: Parameters that were autodetected from the * @hw_params: Parameters that were autodetected from the
* hardware registers * hardware registers
* @core_params: Parameters that define how the core should be configured
* @op_state: The operational State, during transitions (a_host=> * @op_state: The operational State, during transitions (a_host=>
* a_peripheral and b_device=>b_host) this may not match * a_peripheral and b_device=>b_host) this may not match
* the core, but allows the software to determine * the core, but allows the software to determine
...@@ -508,6 +453,8 @@ struct dwc2_hw_params { ...@@ -508,6 +453,8 @@ struct dwc2_hw_params {
* - USB_DR_MODE_PERIPHERAL * - USB_DR_MODE_PERIPHERAL
* - USB_DR_MODE_HOST * - USB_DR_MODE_HOST
* - USB_DR_MODE_OTG * - USB_DR_MODE_OTG
* @lock: Spinlock that protects all the driver data structures
* @priv: Stores a pointer to the struct usb_hcd
* @queuing_high_bandwidth: True if multiple packets of a high-bandwidth * @queuing_high_bandwidth: True if multiple packets of a high-bandwidth
* transfer are in process of being queued * transfer are in process of being queued
* @srp_success: Stores status of SRP request in the case of a FS PHY * @srp_success: Stores status of SRP request in the case of a FS PHY
...@@ -517,6 +464,9 @@ struct dwc2_hw_params { ...@@ -517,6 +464,9 @@ struct dwc2_hw_params {
* interrupt * interrupt
* @wkp_timer: Timer object for handling Wakeup Detected interrupt * @wkp_timer: Timer object for handling Wakeup Detected interrupt
* @lx_state: Lx state of connected device * @lx_state: Lx state of connected device
*
* These are for host mode:
*
* @flags: Flags for handling root port state changes * @flags: Flags for handling root port state changes
* @non_periodic_sched_inactive: Inactive QHs in the non-periodic schedule. * @non_periodic_sched_inactive: Inactive QHs in the non-periodic schedule.
* Transfers associated with these QHs are not currently * Transfers associated with these QHs are not currently
...@@ -585,11 +535,31 @@ struct dwc2_hw_params { ...@@ -585,11 +535,31 @@ struct dwc2_hw_params {
* @status_buf_dma: DMA address for status_buf * @status_buf_dma: DMA address for status_buf
* @start_work: Delayed work for handling host A-cable connection * @start_work: Delayed work for handling host A-cable connection
* @reset_work: Delayed work for handling a port reset * @reset_work: Delayed work for handling a port reset
* @lock: Spinlock that protects all the driver data structures
* @priv: Stores a pointer to the struct usb_hcd
* @otg_port: OTG port number * @otg_port: OTG port number
* @frame_list: Frame list * @frame_list: Frame list
* @frame_list_dma: Frame list DMA address * @frame_list_dma: Frame list DMA address
*
* These are for peripheral mode:
*
* @driver: USB gadget driver
* @phy: The otg phy transceiver structure for phy control.
* @uphy: The otg phy transceiver structure for old USB phy control.
* @plat: The platform specific configuration data. This can be removed once
* all SoCs support usb transceiver.
* @supplies: Definition of USB power supplies
* @phyif: PHY interface width
* @dedicated_fifos: Set if the hardware has dedicated IN-EP fifos.
* @num_of_eps: Number of available EPs (excluding EP0)
* @debug_root: Root directrory for debugfs.
* @debug_file: Main status file for debugfs.
* @debug_fifo: FIFO status file for debugfs.
* @ep0_reply: Request used for ep0 reply.
* @ep0_buff: Buffer for EP0 reply data, if needed.
* @ctrl_buff: Buffer for EP0 control requests.
* @ctrl_req: Request for EP0 control packets.
* @setup: NAK management for EP0 SETUP
* @last_rst: Time of last reset
* @eps: The endpoints being supplied to the gadget framework
*/ */
struct dwc2_hsotg { struct dwc2_hsotg {
struct device *dev; struct device *dev;
...@@ -601,6 +571,15 @@ struct dwc2_hsotg { ...@@ -601,6 +571,15 @@ struct dwc2_hsotg {
enum usb_otg_state op_state; enum usb_otg_state op_state;
enum usb_dr_mode dr_mode; enum usb_dr_mode dr_mode;
struct phy *phy;
struct usb_phy *uphy;
struct regulator_bulk_data supplies[ARRAY_SIZE(s3c_hsotg_supply_names)];
spinlock_t lock;
void *priv;
int irq;
struct clk *clk;
unsigned int queuing_high_bandwidth:1; unsigned int queuing_high_bandwidth:1;
unsigned int srp_success:1; unsigned int srp_success:1;
...@@ -609,6 +588,18 @@ struct dwc2_hsotg { ...@@ -609,6 +588,18 @@ struct dwc2_hsotg {
struct timer_list wkp_timer; struct timer_list wkp_timer;
enum dwc2_lx_state lx_state; enum dwc2_lx_state lx_state;
struct dentry *debug_root;
struct dentry *debug_file;
struct dentry *debug_fifo;
/* DWC OTG HW Release versions */
#define DWC2_CORE_REV_2_71a 0x4f54271a
#define DWC2_CORE_REV_2_90a 0x4f54290a
#define DWC2_CORE_REV_2_92a 0x4f54292a
#define DWC2_CORE_REV_2_94a 0x4f54294a
#define DWC2_CORE_REV_3_00a 0x4f54300a
#if IS_ENABLED(CONFIG_USB_DWC2_HOST) || IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE)
union dwc2_hcd_internal_flags { union dwc2_hcd_internal_flags {
u32 d32; u32 d32;
struct { struct {
...@@ -655,19 +646,10 @@ struct dwc2_hsotg { ...@@ -655,19 +646,10 @@ struct dwc2_hsotg {
struct delayed_work start_work; struct delayed_work start_work;
struct delayed_work reset_work; struct delayed_work reset_work;
spinlock_t lock;
void *priv;
u8 otg_port; u8 otg_port;
u32 *frame_list; u32 *frame_list;
dma_addr_t frame_list_dma; dma_addr_t frame_list_dma;
/* DWC OTG HW Release versions */
#define DWC2_CORE_REV_2_71a 0x4f54271a
#define DWC2_CORE_REV_2_90a 0x4f54290a
#define DWC2_CORE_REV_2_92a 0x4f54292a
#define DWC2_CORE_REV_2_94a 0x4f54294a
#define DWC2_CORE_REV_3_00a 0x4f54300a
#ifdef DEBUG #ifdef DEBUG
u32 frrem_samples; u32 frrem_samples;
u64 frrem_accum; u64 frrem_accum;
...@@ -686,6 +668,29 @@ struct dwc2_hsotg { ...@@ -686,6 +668,29 @@ struct dwc2_hsotg {
u32 hfnum_other_samples_b; u32 hfnum_other_samples_b;
u64 hfnum_other_frrem_accum_b; u64 hfnum_other_frrem_accum_b;
#endif #endif
#endif /* CONFIG_USB_DWC2_HOST || CONFIG_USB_DWC2_DUAL_ROLE */
#if IS_ENABLED(CONFIG_USB_DWC2_PERIPHERAL) || IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE)
/* Gadget structures */
struct usb_gadget_driver *driver;
struct s3c_hsotg_plat *plat;
u32 phyif;
int fifo_mem;
unsigned int dedicated_fifos:1;
unsigned char num_of_eps;
u32 fifo_map;
struct usb_request *ep0_reply;
struct usb_request *ctrl_req;
u8 ep0_buff[8];
u8 ctrl_buff[8];
struct usb_gadget gadget;
unsigned int setup;
unsigned long last_rst;
struct s3c_hsotg_ep *eps;
#endif /* CONFIG_USB_DWC2_PERIPHERAL || CONFIG_USB_DWC2_DUAL_ROLE */
}; };
/* Reasons for halting a host channel */ /* Reasons for halting a host channel */
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include <linux/platform_data/s3c-hsotg.h> #include <linux/platform_data/s3c-hsotg.h>
#include "core.h" #include "core.h"
#include "hw.h"
/* conversion functions */ /* conversion functions */
static inline struct s3c_hsotg_req *our_req(struct usb_request *req) static inline struct s3c_hsotg_req *our_req(struct usb_request *req)
...@@ -48,9 +49,9 @@ static inline struct s3c_hsotg_ep *our_ep(struct usb_ep *ep) ...@@ -48,9 +49,9 @@ static inline struct s3c_hsotg_ep *our_ep(struct usb_ep *ep)
return container_of(ep, struct s3c_hsotg_ep, ep); return container_of(ep, struct s3c_hsotg_ep, ep);
} }
static inline struct s3c_hsotg *to_hsotg(struct usb_gadget *gadget) static inline struct dwc2_hsotg *to_hsotg(struct usb_gadget *gadget)
{ {
return container_of(gadget, struct s3c_hsotg, gadget); return container_of(gadget, struct dwc2_hsotg, gadget);
} }
static inline void __orr32(void __iomem *ptr, u32 val) static inline void __orr32(void __iomem *ptr, u32 val)
...@@ -64,7 +65,7 @@ static inline void __bic32(void __iomem *ptr, u32 val) ...@@ -64,7 +65,7 @@ static inline void __bic32(void __iomem *ptr, u32 val)
} }
/* forward decleration of functions */ /* forward decleration of functions */
static void s3c_hsotg_dump(struct s3c_hsotg *hsotg); static void s3c_hsotg_dump(struct dwc2_hsotg *hsotg);
/** /**
* using_dma - return the DMA status of the driver. * using_dma - return the DMA status of the driver.
...@@ -85,7 +86,7 @@ static void s3c_hsotg_dump(struct s3c_hsotg *hsotg); ...@@ -85,7 +86,7 @@ static void s3c_hsotg_dump(struct s3c_hsotg *hsotg);
* *
* Until this issue is sorted out, we always return 'false'. * 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 dwc2_hsotg *hsotg)
{ {
return false; /* support is not complete */ return false; /* support is not complete */
} }
...@@ -95,7 +96,7 @@ static inline bool using_dma(struct s3c_hsotg *hsotg) ...@@ -95,7 +96,7 @@ static inline bool using_dma(struct s3c_hsotg *hsotg)
* @hsotg: The device state * @hsotg: The device state
* @ints: A bitmask of the interrupts to enable * @ints: A bitmask of the interrupts to enable
*/ */
static void s3c_hsotg_en_gsint(struct s3c_hsotg *hsotg, u32 ints) static void s3c_hsotg_en_gsint(struct dwc2_hsotg *hsotg, u32 ints)
{ {
u32 gsintmsk = readl(hsotg->regs + GINTMSK); u32 gsintmsk = readl(hsotg->regs + GINTMSK);
u32 new_gsintmsk; u32 new_gsintmsk;
...@@ -113,7 +114,7 @@ static void s3c_hsotg_en_gsint(struct s3c_hsotg *hsotg, u32 ints) ...@@ -113,7 +114,7 @@ static void s3c_hsotg_en_gsint(struct s3c_hsotg *hsotg, u32 ints)
* @hsotg: The device state * @hsotg: The device state
* @ints: A bitmask of the interrupts to enable * @ints: A bitmask of the interrupts to enable
*/ */
static void s3c_hsotg_disable_gsint(struct s3c_hsotg *hsotg, u32 ints) static void s3c_hsotg_disable_gsint(struct dwc2_hsotg *hsotg, u32 ints)
{ {
u32 gsintmsk = readl(hsotg->regs + GINTMSK); u32 gsintmsk = readl(hsotg->regs + GINTMSK);
u32 new_gsintmsk; u32 new_gsintmsk;
...@@ -134,7 +135,7 @@ static void s3c_hsotg_disable_gsint(struct s3c_hsotg *hsotg, u32 ints) ...@@ -134,7 +135,7 @@ static void s3c_hsotg_disable_gsint(struct s3c_hsotg *hsotg, u32 ints)
* Set or clear the mask for an individual endpoint's interrupt * Set or clear the mask for an individual endpoint's interrupt
* request. * request.
*/ */
static void s3c_hsotg_ctrl_epint(struct s3c_hsotg *hsotg, static void s3c_hsotg_ctrl_epint(struct dwc2_hsotg *hsotg,
unsigned int ep, unsigned int dir_in, unsigned int ep, unsigned int dir_in,
unsigned int en) unsigned int en)
{ {
...@@ -159,7 +160,7 @@ static void s3c_hsotg_ctrl_epint(struct s3c_hsotg *hsotg, ...@@ -159,7 +160,7 @@ static void s3c_hsotg_ctrl_epint(struct s3c_hsotg *hsotg,
* s3c_hsotg_init_fifo - initialise non-periodic FIFOs * s3c_hsotg_init_fifo - initialise non-periodic FIFOs
* @hsotg: The device instance. * @hsotg: The device instance.
*/ */
static void s3c_hsotg_init_fifo(struct s3c_hsotg *hsotg) static void s3c_hsotg_init_fifo(struct dwc2_hsotg *hsotg)
{ {
unsigned int ep; unsigned int ep;
unsigned int addr; unsigned int addr;
...@@ -283,7 +284,7 @@ static inline int is_ep_periodic(struct s3c_hsotg_ep *hs_ep) ...@@ -283,7 +284,7 @@ static inline int is_ep_periodic(struct s3c_hsotg_ep *hs_ep)
* This is the reverse of s3c_hsotg_map_dma(), called for the completion * This is the reverse of s3c_hsotg_map_dma(), called for the completion
* of a request to ensure the buffer is ready for access by the caller. * of a request to ensure the buffer is ready for access by the caller.
*/ */
static void s3c_hsotg_unmap_dma(struct s3c_hsotg *hsotg, static void s3c_hsotg_unmap_dma(struct dwc2_hsotg *hsotg,
struct s3c_hsotg_ep *hs_ep, struct s3c_hsotg_ep *hs_ep,
struct s3c_hsotg_req *hs_req) struct s3c_hsotg_req *hs_req)
{ {
...@@ -312,7 +313,7 @@ static void s3c_hsotg_unmap_dma(struct s3c_hsotg *hsotg, ...@@ -312,7 +313,7 @@ static void s3c_hsotg_unmap_dma(struct s3c_hsotg *hsotg,
* *
* This routine is only needed for PIO * This routine is only needed for PIO
*/ */
static int s3c_hsotg_write_fifo(struct s3c_hsotg *hsotg, static int s3c_hsotg_write_fifo(struct dwc2_hsotg *hsotg,
struct s3c_hsotg_ep *hs_ep, struct s3c_hsotg_ep *hs_ep,
struct s3c_hsotg_req *hs_req) struct s3c_hsotg_req *hs_req)
{ {
...@@ -517,7 +518,7 @@ static unsigned get_ep_limit(struct s3c_hsotg_ep *hs_ep) ...@@ -517,7 +518,7 @@ static unsigned get_ep_limit(struct s3c_hsotg_ep *hs_ep)
* Start the given request running by setting the endpoint registers * Start the given request running by setting the endpoint registers
* appropriately, and writing any data to the FIFOs. * appropriately, and writing any data to the FIFOs.
*/ */
static void s3c_hsotg_start_req(struct s3c_hsotg *hsotg, static void s3c_hsotg_start_req(struct dwc2_hsotg *hsotg,
struct s3c_hsotg_ep *hs_ep, struct s3c_hsotg_ep *hs_ep,
struct s3c_hsotg_req *hs_req, struct s3c_hsotg_req *hs_req,
bool continuing) bool continuing)
...@@ -707,7 +708,7 @@ static void s3c_hsotg_start_req(struct s3c_hsotg *hsotg, ...@@ -707,7 +708,7 @@ 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 * DMA memory, then we map the memory and mark our request to allow us to
* cleanup on completion. * cleanup on completion.
*/ */
static int s3c_hsotg_map_dma(struct s3c_hsotg *hsotg, static int s3c_hsotg_map_dma(struct dwc2_hsotg *hsotg,
struct s3c_hsotg_ep *hs_ep, struct s3c_hsotg_ep *hs_ep,
struct usb_request *req) struct usb_request *req)
{ {
...@@ -736,7 +737,7 @@ static int s3c_hsotg_ep_queue(struct usb_ep *ep, struct usb_request *req, ...@@ -736,7 +737,7 @@ static int s3c_hsotg_ep_queue(struct usb_ep *ep, struct usb_request *req,
{ {
struct s3c_hsotg_req *hs_req = our_req(req); struct s3c_hsotg_req *hs_req = our_req(req);
struct s3c_hsotg_ep *hs_ep = our_ep(ep); struct s3c_hsotg_ep *hs_ep = our_ep(ep);
struct s3c_hsotg *hs = hs_ep->parent; struct dwc2_hsotg *hs = hs_ep->parent;
bool first; bool first;
dev_dbg(hs->dev, "%s: req %p: %d@%p, noi=%d, zero=%d, snok=%d\n", dev_dbg(hs->dev, "%s: req %p: %d@%p, noi=%d, zero=%d, snok=%d\n",
...@@ -768,7 +769,7 @@ static int s3c_hsotg_ep_queue_lock(struct usb_ep *ep, struct usb_request *req, ...@@ -768,7 +769,7 @@ static int s3c_hsotg_ep_queue_lock(struct usb_ep *ep, struct usb_request *req,
gfp_t gfp_flags) gfp_t gfp_flags)
{ {
struct s3c_hsotg_ep *hs_ep = our_ep(ep); struct s3c_hsotg_ep *hs_ep = our_ep(ep);
struct s3c_hsotg *hs = hs_ep->parent; struct dwc2_hsotg *hs = hs_ep->parent;
unsigned long flags = 0; unsigned long flags = 0;
int ret = 0; int ret = 0;
...@@ -799,7 +800,7 @@ static void s3c_hsotg_complete_oursetup(struct usb_ep *ep, ...@@ -799,7 +800,7 @@ static void s3c_hsotg_complete_oursetup(struct usb_ep *ep,
struct usb_request *req) struct usb_request *req)
{ {
struct s3c_hsotg_ep *hs_ep = our_ep(ep); struct s3c_hsotg_ep *hs_ep = our_ep(ep);
struct s3c_hsotg *hsotg = hs_ep->parent; struct dwc2_hsotg *hsotg = hs_ep->parent;
dev_dbg(hsotg->dev, "%s: ep %p, req %p\n", __func__, ep, req); dev_dbg(hsotg->dev, "%s: ep %p, req %p\n", __func__, ep, req);
...@@ -814,7 +815,7 @@ static void s3c_hsotg_complete_oursetup(struct usb_ep *ep, ...@@ -814,7 +815,7 @@ static void s3c_hsotg_complete_oursetup(struct usb_ep *ep,
* Convert the given wIndex into a pointer to an driver endpoint * Convert the given wIndex into a pointer to an driver endpoint
* structure, or return NULL if it is not a valid 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 s3c_hsotg_ep *ep_from_windex(struct dwc2_hsotg *hsotg,
u32 windex) u32 windex)
{ {
struct s3c_hsotg_ep *ep = &hsotg->eps[windex & 0x7F]; struct s3c_hsotg_ep *ep = &hsotg->eps[windex & 0x7F];
...@@ -843,7 +844,7 @@ static struct s3c_hsotg_ep *ep_from_windex(struct s3c_hsotg *hsotg, ...@@ -843,7 +844,7 @@ 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 * 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. * an internal method of sending replies to certain control requests, etc.
*/ */
static int s3c_hsotg_send_reply(struct s3c_hsotg *hsotg, static int s3c_hsotg_send_reply(struct dwc2_hsotg *hsotg,
struct s3c_hsotg_ep *ep, struct s3c_hsotg_ep *ep,
void *buff, void *buff,
int length) int length)
...@@ -884,7 +885,7 @@ static int s3c_hsotg_send_reply(struct s3c_hsotg *hsotg, ...@@ -884,7 +885,7 @@ static int s3c_hsotg_send_reply(struct s3c_hsotg *hsotg,
* @hsotg: The device state * @hsotg: The device state
* @ctrl: USB control request * @ctrl: USB control request
*/ */
static int s3c_hsotg_process_req_status(struct s3c_hsotg *hsotg, static int s3c_hsotg_process_req_status(struct dwc2_hsotg *hsotg,
struct usb_ctrlrequest *ctrl) struct usb_ctrlrequest *ctrl)
{ {
struct s3c_hsotg_ep *ep0 = &hsotg->eps[0]; struct s3c_hsotg_ep *ep0 = &hsotg->eps[0];
...@@ -955,7 +956,7 @@ static struct s3c_hsotg_req *get_ep_head(struct s3c_hsotg_ep *hs_ep) ...@@ -955,7 +956,7 @@ static struct s3c_hsotg_req *get_ep_head(struct s3c_hsotg_ep *hs_ep)
* @hsotg: The device state * @hsotg: The device state
* @ctrl: USB control request * @ctrl: USB control request
*/ */
static int s3c_hsotg_process_req_feature(struct s3c_hsotg *hsotg, static int s3c_hsotg_process_req_feature(struct dwc2_hsotg *hsotg,
struct usb_ctrlrequest *ctrl) struct usb_ctrlrequest *ctrl)
{ {
struct s3c_hsotg_ep *ep0 = &hsotg->eps[0]; struct s3c_hsotg_ep *ep0 = &hsotg->eps[0];
...@@ -1028,8 +1029,8 @@ static int s3c_hsotg_process_req_feature(struct s3c_hsotg *hsotg, ...@@ -1028,8 +1029,8 @@ static int s3c_hsotg_process_req_feature(struct s3c_hsotg *hsotg,
return 1; return 1;
} }
static void s3c_hsotg_enqueue_setup(struct s3c_hsotg *hsotg); static void s3c_hsotg_enqueue_setup(struct dwc2_hsotg *hsotg);
static void s3c_hsotg_disconnect(struct s3c_hsotg *hsotg); static void s3c_hsotg_disconnect(struct dwc2_hsotg *hsotg);
/** /**
* s3c_hsotg_stall_ep0 - stall ep0 * s3c_hsotg_stall_ep0 - stall ep0
...@@ -1037,7 +1038,7 @@ static void s3c_hsotg_disconnect(struct s3c_hsotg *hsotg); ...@@ -1037,7 +1038,7 @@ static void s3c_hsotg_disconnect(struct s3c_hsotg *hsotg);
* *
* Set stall for ep0 as response for setup request. * Set stall for ep0 as response for setup request.
*/ */
static void s3c_hsotg_stall_ep0(struct s3c_hsotg *hsotg) static void s3c_hsotg_stall_ep0(struct dwc2_hsotg *hsotg)
{ {
struct s3c_hsotg_ep *ep0 = &hsotg->eps[0]; struct s3c_hsotg_ep *ep0 = &hsotg->eps[0];
u32 reg; u32 reg;
...@@ -1076,7 +1077,7 @@ static void s3c_hsotg_stall_ep0(struct s3c_hsotg *hsotg) ...@@ -1076,7 +1077,7 @@ static void s3c_hsotg_stall_ep0(struct s3c_hsotg *hsotg)
* needs to work out what to do next (and whether to pass it on to the * needs to work out what to do next (and whether to pass it on to the
* gadget driver). * gadget driver).
*/ */
static void s3c_hsotg_process_control(struct s3c_hsotg *hsotg, static void s3c_hsotg_process_control(struct dwc2_hsotg *hsotg,
struct usb_ctrlrequest *ctrl) struct usb_ctrlrequest *ctrl)
{ {
struct s3c_hsotg_ep *ep0 = &hsotg->eps[0]; struct s3c_hsotg_ep *ep0 = &hsotg->eps[0];
...@@ -1161,7 +1162,7 @@ static void s3c_hsotg_complete_setup(struct usb_ep *ep, ...@@ -1161,7 +1162,7 @@ static void s3c_hsotg_complete_setup(struct usb_ep *ep,
struct usb_request *req) struct usb_request *req)
{ {
struct s3c_hsotg_ep *hs_ep = our_ep(ep); struct s3c_hsotg_ep *hs_ep = our_ep(ep);
struct s3c_hsotg *hsotg = hs_ep->parent; struct dwc2_hsotg *hsotg = hs_ep->parent;
if (req->status < 0) { if (req->status < 0) {
dev_dbg(hsotg->dev, "%s: failed %d\n", __func__, req->status); dev_dbg(hsotg->dev, "%s: failed %d\n", __func__, req->status);
...@@ -1183,7 +1184,7 @@ static void s3c_hsotg_complete_setup(struct usb_ep *ep, ...@@ -1183,7 +1184,7 @@ static void s3c_hsotg_complete_setup(struct usb_ep *ep,
* Enqueue a request on EP0 if necessary to received any SETUP packets * Enqueue a request on EP0 if necessary to received any SETUP packets
* received from the host. * received from the host.
*/ */
static void s3c_hsotg_enqueue_setup(struct s3c_hsotg *hsotg) static void s3c_hsotg_enqueue_setup(struct dwc2_hsotg *hsotg)
{ {
struct usb_request *req = hsotg->ctrl_req; struct usb_request *req = hsotg->ctrl_req;
struct s3c_hsotg_req *hs_req = our_req(req); struct s3c_hsotg_req *hs_req = our_req(req);
...@@ -1226,7 +1227,7 @@ static void s3c_hsotg_enqueue_setup(struct s3c_hsotg *hsotg) ...@@ -1226,7 +1227,7 @@ static void s3c_hsotg_enqueue_setup(struct s3c_hsotg *hsotg)
* *
* Note, expects the ep to already be locked as appropriate. * Note, expects the ep to already be locked as appropriate.
*/ */
static void s3c_hsotg_complete_request(struct s3c_hsotg *hsotg, static void s3c_hsotg_complete_request(struct dwc2_hsotg *hsotg,
struct s3c_hsotg_ep *hs_ep, struct s3c_hsotg_ep *hs_ep,
struct s3c_hsotg_req *hs_req, struct s3c_hsotg_req *hs_req,
int result) int result)
...@@ -1291,7 +1292,7 @@ static void s3c_hsotg_complete_request(struct s3c_hsotg *hsotg, ...@@ -1291,7 +1292,7 @@ static void s3c_hsotg_complete_request(struct s3c_hsotg *hsotg,
* endpoint, so sort out whether we need to read the data into a request * endpoint, so sort out whether we need to read the data into a request
* that has been made for that endpoint. * that has been made for that endpoint.
*/ */
static void s3c_hsotg_rx_data(struct s3c_hsotg *hsotg, int ep_idx, int size) static void s3c_hsotg_rx_data(struct dwc2_hsotg *hsotg, int ep_idx, int size)
{ {
struct s3c_hsotg_ep *hs_ep = &hsotg->eps[ep_idx]; struct s3c_hsotg_ep *hs_ep = &hsotg->eps[ep_idx];
struct s3c_hsotg_req *hs_req = hs_ep->req; struct s3c_hsotg_req *hs_req = hs_ep->req;
...@@ -1356,7 +1357,7 @@ static void s3c_hsotg_rx_data(struct s3c_hsotg *hsotg, int ep_idx, int size) ...@@ -1356,7 +1357,7 @@ 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 * currently believed that we do not need to wait for any space in
* the TxFIFO. * the TxFIFO.
*/ */
static void s3c_hsotg_send_zlp(struct s3c_hsotg *hsotg, static void s3c_hsotg_send_zlp(struct dwc2_hsotg *hsotg,
struct s3c_hsotg_req *req) struct s3c_hsotg_req *req)
{ {
u32 ctrl; u32 ctrl;
...@@ -1398,7 +1399,7 @@ static void s3c_hsotg_send_zlp(struct s3c_hsotg *hsotg, ...@@ -1398,7 +1399,7 @@ static void s3c_hsotg_send_zlp(struct s3c_hsotg *hsotg,
* transfer for an OUT endpoint has been completed, either by a short * transfer for an OUT endpoint has been completed, either by a short
* packet or by the finish of a transfer. * packet or by the finish of a transfer.
*/ */
static void s3c_hsotg_handle_outdone(struct s3c_hsotg *hsotg, static void s3c_hsotg_handle_outdone(struct dwc2_hsotg *hsotg,
int epnum, bool was_setup) int epnum, bool was_setup)
{ {
u32 epsize = readl(hsotg->regs + DOEPTSIZ(epnum)); u32 epsize = readl(hsotg->regs + DOEPTSIZ(epnum));
...@@ -1471,7 +1472,7 @@ static void s3c_hsotg_handle_outdone(struct s3c_hsotg *hsotg, ...@@ -1471,7 +1472,7 @@ static void s3c_hsotg_handle_outdone(struct s3c_hsotg *hsotg,
* *
* Return the current frame number * Return the current frame number
*/ */
static u32 s3c_hsotg_read_frameno(struct s3c_hsotg *hsotg) static u32 s3c_hsotg_read_frameno(struct dwc2_hsotg *hsotg)
{ {
u32 dsts; u32 dsts;
...@@ -1498,7 +1499,7 @@ static u32 s3c_hsotg_read_frameno(struct s3c_hsotg *hsotg) ...@@ -1498,7 +1499,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 * as the actual data should be sent to the memory directly and we turn
* on the completion interrupts to get notifications of transfer completion. * on the completion interrupts to get notifications of transfer completion.
*/ */
static void s3c_hsotg_handle_rx(struct s3c_hsotg *hsotg) static void s3c_hsotg_handle_rx(struct dwc2_hsotg *hsotg)
{ {
u32 grxstsr = readl(hsotg->regs + GRXSTSP); u32 grxstsr = readl(hsotg->regs + GRXSTSP);
u32 epnum, status, size; u32 epnum, status, size;
...@@ -1590,7 +1591,7 @@ static u32 s3c_hsotg_ep0_mps(unsigned int mps) ...@@ -1590,7 +1591,7 @@ static u32 s3c_hsotg_ep0_mps(unsigned int mps)
* Configure the maximum packet size for the given endpoint, updating * Configure the maximum packet size for the given endpoint, updating
* the hardware control registers to reflect this. * the hardware control registers to reflect this.
*/ */
static void s3c_hsotg_set_ep_maxpacket(struct s3c_hsotg *hsotg, static void s3c_hsotg_set_ep_maxpacket(struct dwc2_hsotg *hsotg,
unsigned int ep, unsigned int mps) unsigned int ep, unsigned int mps)
{ {
struct s3c_hsotg_ep *hs_ep = &hsotg->eps[ep]; struct s3c_hsotg_ep *hs_ep = &hsotg->eps[ep];
...@@ -1645,7 +1646,7 @@ static void s3c_hsotg_set_ep_maxpacket(struct s3c_hsotg *hsotg, ...@@ -1645,7 +1646,7 @@ static void s3c_hsotg_set_ep_maxpacket(struct s3c_hsotg *hsotg,
* @hsotg: The driver state * @hsotg: The driver state
* @idx: The index for the endpoint (0..15) * @idx: The index for the endpoint (0..15)
*/ */
static void s3c_hsotg_txfifo_flush(struct s3c_hsotg *hsotg, unsigned int idx) static void s3c_hsotg_txfifo_flush(struct dwc2_hsotg *hsotg, unsigned int idx)
{ {
int timeout; int timeout;
int val; int val;
...@@ -1681,7 +1682,7 @@ static void s3c_hsotg_txfifo_flush(struct s3c_hsotg *hsotg, unsigned int idx) ...@@ -1681,7 +1682,7 @@ static void s3c_hsotg_txfifo_flush(struct s3c_hsotg *hsotg, unsigned int idx)
* Check to see if there is a request that has data to send, and if so * 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. * make an attempt to write data into the FIFO.
*/ */
static int s3c_hsotg_trytx(struct s3c_hsotg *hsotg, static int s3c_hsotg_trytx(struct dwc2_hsotg *hsotg,
struct s3c_hsotg_ep *hs_ep) struct s3c_hsotg_ep *hs_ep)
{ {
struct s3c_hsotg_req *hs_req = hs_ep->req; struct s3c_hsotg_req *hs_req = hs_ep->req;
...@@ -1714,7 +1715,7 @@ static int s3c_hsotg_trytx(struct s3c_hsotg *hsotg, ...@@ -1714,7 +1715,7 @@ static int s3c_hsotg_trytx(struct s3c_hsotg *hsotg,
* An IN transfer has been completed, update the transfer's state and then * An IN transfer has been completed, update the transfer's state and then
* call the relevant completion routines. * call the relevant completion routines.
*/ */
static void s3c_hsotg_complete_in(struct s3c_hsotg *hsotg, static void s3c_hsotg_complete_in(struct dwc2_hsotg *hsotg,
struct s3c_hsotg_ep *hs_ep) struct s3c_hsotg_ep *hs_ep)
{ {
struct s3c_hsotg_req *hs_req = hs_ep->req; struct s3c_hsotg_req *hs_req = hs_ep->req;
...@@ -1791,7 +1792,7 @@ static void s3c_hsotg_complete_in(struct s3c_hsotg *hsotg, ...@@ -1791,7 +1792,7 @@ static void s3c_hsotg_complete_in(struct s3c_hsotg *hsotg,
* *
* Process and clear any interrupt pending for an individual 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 s3c_hsotg_epint(struct dwc2_hsotg *hsotg, unsigned int idx,
int dir_in) int dir_in)
{ {
struct s3c_hsotg_ep *hs_ep = &hsotg->eps[idx]; struct s3c_hsotg_ep *hs_ep = &hsotg->eps[idx];
...@@ -1916,7 +1917,7 @@ static void s3c_hsotg_epint(struct s3c_hsotg *hsotg, unsigned int idx, ...@@ -1916,7 +1917,7 @@ static void s3c_hsotg_epint(struct s3c_hsotg *hsotg, unsigned int idx,
* Handle updating the device settings after the enumeration phase has * Handle updating the device settings after the enumeration phase has
* been completed. * been completed.
*/ */
static void s3c_hsotg_irq_enumdone(struct s3c_hsotg *hsotg) static void s3c_hsotg_irq_enumdone(struct dwc2_hsotg *hsotg)
{ {
u32 dsts = readl(hsotg->regs + DSTS); u32 dsts = readl(hsotg->regs + DSTS);
int ep0_mps = 0, ep_mps = 8; int ep0_mps = 0, ep_mps = 8;
...@@ -1993,7 +1994,7 @@ static void s3c_hsotg_irq_enumdone(struct s3c_hsotg *hsotg) ...@@ -1993,7 +1994,7 @@ static void s3c_hsotg_irq_enumdone(struct s3c_hsotg *hsotg)
* Go through the requests on the given endpoint and mark them * Go through the requests on the given endpoint and mark them
* completed with the given result code. * completed with the given result code.
*/ */
static void kill_all_requests(struct s3c_hsotg *hsotg, static void kill_all_requests(struct dwc2_hsotg *hsotg,
struct s3c_hsotg_ep *ep, struct s3c_hsotg_ep *ep,
int result, bool force) int result, bool force)
{ {
...@@ -2027,7 +2028,7 @@ static void kill_all_requests(struct s3c_hsotg *hsotg, ...@@ -2027,7 +2028,7 @@ static void kill_all_requests(struct s3c_hsotg *hsotg,
* transactions and signal the gadget driver that this * transactions and signal the gadget driver that this
* has happened. * has happened.
*/ */
static void s3c_hsotg_disconnect(struct s3c_hsotg *hsotg) static void s3c_hsotg_disconnect(struct dwc2_hsotg *hsotg)
{ {
unsigned ep; unsigned ep;
...@@ -2042,7 +2043,7 @@ static void s3c_hsotg_disconnect(struct s3c_hsotg *hsotg) ...@@ -2042,7 +2043,7 @@ static void s3c_hsotg_disconnect(struct s3c_hsotg *hsotg)
* @hsotg: The device state: * @hsotg: The device state:
* @periodic: True if this is a periodic FIFO interrupt * @periodic: True if this is a periodic FIFO interrupt
*/ */
static void s3c_hsotg_irq_fifoempty(struct s3c_hsotg *hsotg, bool periodic) static void s3c_hsotg_irq_fifoempty(struct dwc2_hsotg *hsotg, bool periodic)
{ {
struct s3c_hsotg_ep *ep; struct s3c_hsotg_ep *ep;
int epno, ret; int epno, ret;
...@@ -2076,7 +2077,7 @@ static void s3c_hsotg_irq_fifoempty(struct s3c_hsotg *hsotg, bool periodic) ...@@ -2076,7 +2077,7 @@ static void s3c_hsotg_irq_fifoempty(struct s3c_hsotg *hsotg, bool periodic)
* *
* Issue a soft reset to the core, and await the core finishing it. * Issue a soft reset to the core, and await the core finishing it.
*/ */
static int s3c_hsotg_corereset(struct s3c_hsotg *hsotg) static int s3c_hsotg_corereset(struct dwc2_hsotg *hsotg)
{ {
int timeout; int timeout;
u32 grstctl; u32 grstctl;
...@@ -2124,7 +2125,7 @@ static int s3c_hsotg_corereset(struct s3c_hsotg *hsotg) ...@@ -2124,7 +2125,7 @@ static int s3c_hsotg_corereset(struct s3c_hsotg *hsotg)
* *
* Issue a soft reset to the core, and await the core finishing it. * Issue a soft reset to the core, and await the core finishing it.
*/ */
static void s3c_hsotg_core_init_disconnected(struct s3c_hsotg *hsotg) static void s3c_hsotg_core_init_disconnected(struct dwc2_hsotg *hsotg)
{ {
s3c_hsotg_corereset(hsotg); s3c_hsotg_corereset(hsotg);
...@@ -2250,13 +2251,13 @@ static void s3c_hsotg_core_init_disconnected(struct s3c_hsotg *hsotg) ...@@ -2250,13 +2251,13 @@ static void s3c_hsotg_core_init_disconnected(struct s3c_hsotg *hsotg)
hsotg->last_rst = jiffies; hsotg->last_rst = jiffies;
} }
static void s3c_hsotg_core_disconnect(struct s3c_hsotg *hsotg) static void s3c_hsotg_core_disconnect(struct dwc2_hsotg *hsotg)
{ {
/* set the soft-disconnect bit */ /* set the soft-disconnect bit */
__orr32(hsotg->regs + DCTL, DCTL_SFTDISCON); __orr32(hsotg->regs + DCTL, DCTL_SFTDISCON);
} }
static void s3c_hsotg_core_connect(struct s3c_hsotg *hsotg) static void s3c_hsotg_core_connect(struct dwc2_hsotg *hsotg)
{ {
/* remove the soft-disconnect and let's go */ /* remove the soft-disconnect and let's go */
__bic32(hsotg->regs + DCTL, DCTL_SFTDISCON); __bic32(hsotg->regs + DCTL, DCTL_SFTDISCON);
...@@ -2269,7 +2270,7 @@ static void s3c_hsotg_core_connect(struct s3c_hsotg *hsotg) ...@@ -2269,7 +2270,7 @@ static void s3c_hsotg_core_connect(struct s3c_hsotg *hsotg)
*/ */
static irqreturn_t s3c_hsotg_irq(int irq, void *pw) static irqreturn_t s3c_hsotg_irq(int irq, void *pw)
{ {
struct s3c_hsotg *hsotg = pw; struct dwc2_hsotg *hsotg = pw;
int retry_count = 8; int retry_count = 8;
u32 gintsts; u32 gintsts;
u32 gintmsk; u32 gintmsk;
...@@ -2461,7 +2462,7 @@ static int s3c_hsotg_ep_enable(struct usb_ep *ep, ...@@ -2461,7 +2462,7 @@ static int s3c_hsotg_ep_enable(struct usb_ep *ep,
const struct usb_endpoint_descriptor *desc) const struct usb_endpoint_descriptor *desc)
{ {
struct s3c_hsotg_ep *hs_ep = our_ep(ep); struct s3c_hsotg_ep *hs_ep = our_ep(ep);
struct s3c_hsotg *hsotg = hs_ep->parent; struct dwc2_hsotg *hsotg = hs_ep->parent;
unsigned long flags; unsigned long flags;
int index = hs_ep->index; int index = hs_ep->index;
u32 epctrl_reg; u32 epctrl_reg;
...@@ -2604,7 +2605,7 @@ static int s3c_hsotg_ep_enable(struct usb_ep *ep, ...@@ -2604,7 +2605,7 @@ static int s3c_hsotg_ep_enable(struct usb_ep *ep,
static int s3c_hsotg_ep_disable(struct usb_ep *ep) static int s3c_hsotg_ep_disable(struct usb_ep *ep)
{ {
struct s3c_hsotg_ep *hs_ep = our_ep(ep); struct s3c_hsotg_ep *hs_ep = our_ep(ep);
struct s3c_hsotg *hsotg = hs_ep->parent; struct dwc2_hsotg *hsotg = hs_ep->parent;
int dir_in = hs_ep->dir_in; int dir_in = hs_ep->dir_in;
int index = hs_ep->index; int index = hs_ep->index;
unsigned long flags; unsigned long flags;
...@@ -2669,7 +2670,7 @@ static int s3c_hsotg_ep_dequeue(struct usb_ep *ep, struct usb_request *req) ...@@ -2669,7 +2670,7 @@ static int s3c_hsotg_ep_dequeue(struct usb_ep *ep, struct usb_request *req)
{ {
struct s3c_hsotg_req *hs_req = our_req(req); struct s3c_hsotg_req *hs_req = our_req(req);
struct s3c_hsotg_ep *hs_ep = our_ep(ep); struct s3c_hsotg_ep *hs_ep = our_ep(ep);
struct s3c_hsotg *hs = hs_ep->parent; struct dwc2_hsotg *hs = hs_ep->parent;
unsigned long flags; unsigned long flags;
dev_dbg(hs->dev, "ep_dequeue(%p,%p)\n", ep, req); dev_dbg(hs->dev, "ep_dequeue(%p,%p)\n", ep, req);
...@@ -2695,7 +2696,7 @@ static int s3c_hsotg_ep_dequeue(struct usb_ep *ep, struct usb_request *req) ...@@ -2695,7 +2696,7 @@ static int s3c_hsotg_ep_dequeue(struct usb_ep *ep, struct usb_request *req)
static int s3c_hsotg_ep_sethalt(struct usb_ep *ep, int value) static int s3c_hsotg_ep_sethalt(struct usb_ep *ep, int value)
{ {
struct s3c_hsotg_ep *hs_ep = our_ep(ep); struct s3c_hsotg_ep *hs_ep = our_ep(ep);
struct s3c_hsotg *hs = hs_ep->parent; struct dwc2_hsotg *hs = hs_ep->parent;
int index = hs_ep->index; int index = hs_ep->index;
u32 epreg; u32 epreg;
u32 epctl; u32 epctl;
...@@ -2759,7 +2760,7 @@ static int s3c_hsotg_ep_sethalt(struct usb_ep *ep, int value) ...@@ -2759,7 +2760,7 @@ static int s3c_hsotg_ep_sethalt(struct usb_ep *ep, int value)
static int s3c_hsotg_ep_sethalt_lock(struct usb_ep *ep, int value) static int s3c_hsotg_ep_sethalt_lock(struct usb_ep *ep, int value)
{ {
struct s3c_hsotg_ep *hs_ep = our_ep(ep); struct s3c_hsotg_ep *hs_ep = our_ep(ep);
struct s3c_hsotg *hs = hs_ep->parent; struct dwc2_hsotg *hs = hs_ep->parent;
unsigned long flags = 0; unsigned long flags = 0;
int ret = 0; int ret = 0;
...@@ -2788,7 +2789,7 @@ static struct usb_ep_ops s3c_hsotg_ep_ops = { ...@@ -2788,7 +2789,7 @@ static struct usb_ep_ops s3c_hsotg_ep_ops = {
* A wrapper for platform code responsible for controlling * A wrapper for platform code responsible for controlling
* low-level USB code * low-level USB code
*/ */
static void s3c_hsotg_phy_enable(struct s3c_hsotg *hsotg) static void s3c_hsotg_phy_enable(struct dwc2_hsotg *hsotg)
{ {
struct platform_device *pdev = to_platform_device(hsotg->dev); struct platform_device *pdev = to_platform_device(hsotg->dev);
...@@ -2811,7 +2812,7 @@ static void s3c_hsotg_phy_enable(struct s3c_hsotg *hsotg) ...@@ -2811,7 +2812,7 @@ static void s3c_hsotg_phy_enable(struct s3c_hsotg *hsotg)
* A wrapper for platform code responsible for controlling * A wrapper for platform code responsible for controlling
* low-level USB code * low-level USB code
*/ */
static void s3c_hsotg_phy_disable(struct s3c_hsotg *hsotg) static void s3c_hsotg_phy_disable(struct dwc2_hsotg *hsotg)
{ {
struct platform_device *pdev = to_platform_device(hsotg->dev); struct platform_device *pdev = to_platform_device(hsotg->dev);
...@@ -2829,7 +2830,7 @@ static void s3c_hsotg_phy_disable(struct s3c_hsotg *hsotg) ...@@ -2829,7 +2830,7 @@ static void s3c_hsotg_phy_disable(struct s3c_hsotg *hsotg)
* s3c_hsotg_init - initalize the usb core * s3c_hsotg_init - initalize the usb core
* @hsotg: The driver state * @hsotg: The driver state
*/ */
static void s3c_hsotg_init(struct s3c_hsotg *hsotg) static void s3c_hsotg_init(struct dwc2_hsotg *hsotg)
{ {
/* unmask subset of endpoint interrupts */ /* unmask subset of endpoint interrupts */
...@@ -2879,7 +2880,7 @@ static void s3c_hsotg_init(struct s3c_hsotg *hsotg) ...@@ -2879,7 +2880,7 @@ static void s3c_hsotg_init(struct s3c_hsotg *hsotg)
static int s3c_hsotg_udc_start(struct usb_gadget *gadget, static int s3c_hsotg_udc_start(struct usb_gadget *gadget,
struct usb_gadget_driver *driver) struct usb_gadget_driver *driver)
{ {
struct s3c_hsotg *hsotg = to_hsotg(gadget); struct dwc2_hsotg *hsotg = to_hsotg(gadget);
unsigned long flags; unsigned long flags;
int ret; int ret;
...@@ -2942,7 +2943,7 @@ static int s3c_hsotg_udc_start(struct usb_gadget *gadget, ...@@ -2942,7 +2943,7 @@ static int s3c_hsotg_udc_start(struct usb_gadget *gadget,
*/ */
static int s3c_hsotg_udc_stop(struct usb_gadget *gadget) static int s3c_hsotg_udc_stop(struct usb_gadget *gadget)
{ {
struct s3c_hsotg *hsotg = to_hsotg(gadget); struct dwc2_hsotg *hsotg = to_hsotg(gadget);
unsigned long flags = 0; unsigned long flags = 0;
int ep; int ep;
...@@ -2989,7 +2990,7 @@ static int s3c_hsotg_gadget_getframe(struct usb_gadget *gadget) ...@@ -2989,7 +2990,7 @@ static int s3c_hsotg_gadget_getframe(struct usb_gadget *gadget)
*/ */
static int s3c_hsotg_pullup(struct usb_gadget *gadget, int is_on) static int s3c_hsotg_pullup(struct usb_gadget *gadget, int is_on)
{ {
struct s3c_hsotg *hsotg = to_hsotg(gadget); struct dwc2_hsotg *hsotg = to_hsotg(gadget);
unsigned long flags = 0; unsigned long flags = 0;
dev_dbg(hsotg->dev, "%s: is_on: %d\n", __func__, is_on); dev_dbg(hsotg->dev, "%s: is_on: %d\n", __func__, is_on);
...@@ -3026,7 +3027,7 @@ static const struct usb_gadget_ops s3c_hsotg_gadget_ops = { ...@@ -3026,7 +3027,7 @@ static const struct usb_gadget_ops s3c_hsotg_gadget_ops = {
* creation) to give to the gadget driver. Setup the endpoint name, any * creation) to give to the gadget driver. Setup the endpoint name, any
* direction information and other state that may be required. * direction information and other state that may be required.
*/ */
static void s3c_hsotg_initep(struct s3c_hsotg *hsotg, static void s3c_hsotg_initep(struct dwc2_hsotg *hsotg,
struct s3c_hsotg_ep *hs_ep, struct s3c_hsotg_ep *hs_ep,
int epnum) int epnum)
{ {
...@@ -3075,7 +3076,7 @@ static void s3c_hsotg_initep(struct s3c_hsotg *hsotg, ...@@ -3075,7 +3076,7 @@ static void s3c_hsotg_initep(struct s3c_hsotg *hsotg,
* *
* Read the USB core HW configuration registers * Read the USB core HW configuration registers
*/ */
static void s3c_hsotg_hw_cfg(struct s3c_hsotg *hsotg) static void s3c_hsotg_hw_cfg(struct dwc2_hsotg *hsotg)
{ {
u32 cfg2, cfg3, cfg4; u32 cfg2, cfg3, cfg4;
/* check hardware configuration */ /* check hardware configuration */
...@@ -3099,7 +3100,7 @@ static void s3c_hsotg_hw_cfg(struct s3c_hsotg *hsotg) ...@@ -3099,7 +3100,7 @@ static void s3c_hsotg_hw_cfg(struct s3c_hsotg *hsotg)
* s3c_hsotg_dump - dump state of the udc * s3c_hsotg_dump - dump state of the udc
* @param: The device state * @param: The device state
*/ */
static void s3c_hsotg_dump(struct s3c_hsotg *hsotg) static void s3c_hsotg_dump(struct dwc2_hsotg *hsotg)
{ {
#ifdef DEBUG #ifdef DEBUG
struct device *dev = hsotg->dev; struct device *dev = hsotg->dev;
...@@ -3158,7 +3159,7 @@ static void s3c_hsotg_dump(struct s3c_hsotg *hsotg) ...@@ -3158,7 +3159,7 @@ static void s3c_hsotg_dump(struct s3c_hsotg *hsotg)
*/ */
static int state_show(struct seq_file *seq, void *v) static int state_show(struct seq_file *seq, void *v)
{ {
struct s3c_hsotg *hsotg = seq->private; struct dwc2_hsotg *hsotg = seq->private;
void __iomem *regs = hsotg->regs; void __iomem *regs = hsotg->regs;
int idx; int idx;
...@@ -3228,7 +3229,7 @@ static const struct file_operations state_fops = { ...@@ -3228,7 +3229,7 @@ static const struct file_operations state_fops = {
*/ */
static int fifo_show(struct seq_file *seq, void *v) static int fifo_show(struct seq_file *seq, void *v)
{ {
struct s3c_hsotg *hsotg = seq->private; struct dwc2_hsotg *hsotg = seq->private;
void __iomem *regs = hsotg->regs; void __iomem *regs = hsotg->regs;
u32 val; u32 val;
int idx; int idx;
...@@ -3284,7 +3285,7 @@ static const char *decode_direction(int is_in) ...@@ -3284,7 +3285,7 @@ static const char *decode_direction(int is_in)
static int ep_show(struct seq_file *seq, void *v) static int ep_show(struct seq_file *seq, void *v)
{ {
struct s3c_hsotg_ep *ep = seq->private; struct s3c_hsotg_ep *ep = seq->private;
struct s3c_hsotg *hsotg = ep->parent; struct dwc2_hsotg *hsotg = ep->parent;
struct s3c_hsotg_req *req; struct s3c_hsotg_req *req;
void __iomem *regs = hsotg->regs; void __iomem *regs = hsotg->regs;
int index = ep->index; int index = ep->index;
...@@ -3361,7 +3362,7 @@ static const struct file_operations ep_fops = { ...@@ -3361,7 +3362,7 @@ static const struct file_operations ep_fops = {
* with the same name as the device itself, in case we end up * with the same name as the device itself, in case we end up
* with multiple blocks in future systems. * with multiple blocks in future systems.
*/ */
static void s3c_hsotg_create_debug(struct s3c_hsotg *hsotg) static void s3c_hsotg_create_debug(struct dwc2_hsotg *hsotg)
{ {
struct dentry *root; struct dentry *root;
unsigned epidx; unsigned epidx;
...@@ -3407,7 +3408,7 @@ static void s3c_hsotg_create_debug(struct s3c_hsotg *hsotg) ...@@ -3407,7 +3408,7 @@ static void s3c_hsotg_create_debug(struct s3c_hsotg *hsotg)
* *
* Cleanup (remove) the debugfs files for use on module exit. * Cleanup (remove) the debugfs files for use on module exit.
*/ */
static void s3c_hsotg_delete_debug(struct s3c_hsotg *hsotg) static void s3c_hsotg_delete_debug(struct dwc2_hsotg *hsotg)
{ {
unsigned epidx; unsigned epidx;
...@@ -3425,7 +3426,6 @@ static void s3c_hsotg_delete_debug(struct s3c_hsotg *hsotg) ...@@ -3425,7 +3426,6 @@ static void s3c_hsotg_delete_debug(struct s3c_hsotg *hsotg)
* s3c_hsotg_probe - probe function for hsotg driver * s3c_hsotg_probe - probe function for hsotg driver
* @pdev: The platform information for the driver * @pdev: The platform information for the driver
*/ */
static int s3c_hsotg_probe(struct platform_device *pdev) static int s3c_hsotg_probe(struct platform_device *pdev)
{ {
struct s3c_hsotg_plat *plat = dev_get_platdata(&pdev->dev); struct s3c_hsotg_plat *plat = dev_get_platdata(&pdev->dev);
...@@ -3433,13 +3433,13 @@ static int s3c_hsotg_probe(struct platform_device *pdev) ...@@ -3433,13 +3433,13 @@ static int s3c_hsotg_probe(struct platform_device *pdev)
struct usb_phy *uphy; struct usb_phy *uphy;
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct s3c_hsotg_ep *eps; struct s3c_hsotg_ep *eps;
struct s3c_hsotg *hsotg; struct dwc2_hsotg *hsotg;
struct resource *res; struct resource *res;
int epnum; int epnum;
int ret; int ret;
int i; int i;
hsotg = devm_kzalloc(&pdev->dev, sizeof(struct s3c_hsotg), GFP_KERNEL); hsotg = devm_kzalloc(&pdev->dev, sizeof(struct dwc2_hsotg), GFP_KERNEL);
if (!hsotg) if (!hsotg)
return -ENOMEM; return -ENOMEM;
...@@ -3520,7 +3520,7 @@ static int s3c_hsotg_probe(struct platform_device *pdev) ...@@ -3520,7 +3520,7 @@ static int s3c_hsotg_probe(struct platform_device *pdev)
ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(hsotg->supplies), ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(hsotg->supplies),
hsotg->supplies); hsotg->supplies);
if (ret) { if (ret) {
dev_err(dev, "failed to request supplies: %d\n", ret); dev_err(hsotg->dev, "failed to request supplies: %d\n", ret);
goto err_clk; goto err_clk;
} }
...@@ -3528,7 +3528,7 @@ static int s3c_hsotg_probe(struct platform_device *pdev) ...@@ -3528,7 +3528,7 @@ static int s3c_hsotg_probe(struct platform_device *pdev)
hsotg->supplies); hsotg->supplies);
if (ret) { if (ret) {
dev_err(hsotg->dev, "failed to enable supplies: %d\n", ret); dev_err(dev, "failed to enable supplies: %d\n", ret);
goto err_supplies; goto err_supplies;
} }
...@@ -3592,7 +3592,7 @@ static int s3c_hsotg_probe(struct platform_device *pdev) ...@@ -3592,7 +3592,7 @@ static int s3c_hsotg_probe(struct platform_device *pdev)
ret = regulator_bulk_disable(ARRAY_SIZE(hsotg->supplies), ret = regulator_bulk_disable(ARRAY_SIZE(hsotg->supplies),
hsotg->supplies); hsotg->supplies);
if (ret) { if (ret) {
dev_err(hsotg->dev, "failed to disable supplies: %d\n", ret); dev_err(&pdev->dev, "failed to disable supplies: %d\n", ret);
goto err_ep_mem; goto err_ep_mem;
} }
...@@ -3622,7 +3622,7 @@ static int s3c_hsotg_probe(struct platform_device *pdev) ...@@ -3622,7 +3622,7 @@ static int s3c_hsotg_probe(struct platform_device *pdev)
*/ */
static int s3c_hsotg_remove(struct platform_device *pdev) static int s3c_hsotg_remove(struct platform_device *pdev)
{ {
struct s3c_hsotg *hsotg = platform_get_drvdata(pdev); struct dwc2_hsotg *hsotg = platform_get_drvdata(pdev);
usb_del_gadget_udc(&hsotg->gadget); usb_del_gadget_udc(&hsotg->gadget);
s3c_hsotg_delete_debug(hsotg); s3c_hsotg_delete_debug(hsotg);
...@@ -3633,7 +3633,7 @@ static int s3c_hsotg_remove(struct platform_device *pdev) ...@@ -3633,7 +3633,7 @@ static int s3c_hsotg_remove(struct platform_device *pdev)
static int s3c_hsotg_suspend(struct platform_device *pdev, pm_message_t state) static int s3c_hsotg_suspend(struct platform_device *pdev, pm_message_t state)
{ {
struct s3c_hsotg *hsotg = platform_get_drvdata(pdev); struct dwc2_hsotg *hsotg = platform_get_drvdata(pdev);
unsigned long flags; unsigned long flags;
int ret = 0; int ret = 0;
...@@ -3664,7 +3664,7 @@ static int s3c_hsotg_suspend(struct platform_device *pdev, pm_message_t state) ...@@ -3664,7 +3664,7 @@ static int s3c_hsotg_suspend(struct platform_device *pdev, pm_message_t state)
static int s3c_hsotg_resume(struct platform_device *pdev) static int s3c_hsotg_resume(struct platform_device *pdev)
{ {
struct s3c_hsotg *hsotg = platform_get_drvdata(pdev); struct dwc2_hsotg *hsotg = platform_get_drvdata(pdev);
unsigned long flags; unsigned long flags;
int ret = 0; int ret = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment