aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorDinh Nguyen <dinguyen@opensource.altera.com>2014-11-11 12:13:33 -0500
committerFelipe Balbi <balbi@ti.com>2014-11-14 15:59:01 -0500
commit941fcce4ff6701c5a7d673d0abb063a7de1234bf (patch)
tree5eda08665331fef6c629bac0f07293b58b41ff04 /drivers/usb
parent0cf884e819e05437287a668b9bfcc198bab6329c (diff)
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: Dinh Nguyen <dinguyen@opensource.altera.com> Signed-off-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/dwc2/core.h155
-rw-r--r--drivers/usb/dwc2/gadget.c146
2 files changed, 153 insertions, 148 deletions
diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h
index 55c90c53f2d6..7bcdc10e4b01 100644
--- a/drivers/usb/dwc2/core.h
+++ b/drivers/usb/dwc2/core.h
@@ -84,7 +84,7 @@ static const char * const s3c_hsotg_supply_names[] = {
84 */ 84 */
85#define EP0_MPS_LIMIT 64 85#define EP0_MPS_LIMIT 64
86 86
87struct s3c_hsotg; 87struct dwc2_hsotg;
88struct s3c_hsotg_req; 88struct s3c_hsotg_req;
89 89
90/** 90/**
@@ -130,7 +130,7 @@ struct s3c_hsotg_req;
130struct s3c_hsotg_ep { 130struct s3c_hsotg_ep {
131 struct usb_ep ep; 131 struct usb_ep ep;
132 struct list_head queue; 132 struct list_head queue;
133 struct s3c_hsotg *parent; 133 struct dwc2_hsotg *parent;
134 struct s3c_hsotg_req *req; 134 struct s3c_hsotg_req *req;
135 struct dentry *debugfs; 135 struct dentry *debugfs;
136 136
@@ -155,67 +155,6 @@ struct s3c_hsotg_ep {
155}; 155};
156 156
157/** 157/**
158 * struct s3c_hsotg - driver state.
159 * @dev: The parent device supplied to the probe function
160 * @driver: USB gadget driver
161 * @phy: The otg phy transceiver structure for phy control.
162 * @uphy: The otg phy transceiver structure for old USB phy control.
163 * @plat: The platform specific configuration data. This can be removed once
164 * all SoCs support usb transceiver.
165 * @regs: The memory area mapped for accessing registers.
166 * @irq: The IRQ number we are using
167 * @supplies: Definition of USB power supplies
168 * @phyif: PHY interface width
169 * @dedicated_fifos: Set if the hardware has dedicated IN-EP fifos.
170 * @num_of_eps: Number of available EPs (excluding EP0)
171 * @debug_root: root directrory for debugfs.
172 * @debug_file: main status file for debugfs.
173 * @debug_fifo: FIFO status file for debugfs.
174 * @ep0_reply: Request used for ep0 reply.
175 * @ep0_buff: Buffer for EP0 reply data, if needed.
176 * @ctrl_buff: Buffer for EP0 control requests.
177 * @ctrl_req: Request for EP0 control packets.
178 * @setup: NAK management for EP0 SETUP
179 * @last_rst: Time of last reset
180 * @eps: The endpoints being supplied to the gadget framework
181 */
182struct s3c_hsotg {
183 struct device *dev;
184 struct usb_gadget_driver *driver;
185 struct phy *phy;
186 struct usb_phy *uphy;
187 struct s3c_hsotg_plat *plat;
188
189 spinlock_t lock;
190
191 void __iomem *regs;
192 int irq;
193 struct clk *clk;
194
195 struct regulator_bulk_data supplies[ARRAY_SIZE(s3c_hsotg_supply_names)];
196
197 u32 phyif;
198 int fifo_mem;
199 unsigned int dedicated_fifos:1;
200 unsigned char num_of_eps;
201 u32 fifo_map;
202
203 struct dentry *debug_root;
204 struct dentry *debug_file;
205 struct dentry *debug_fifo;
206
207 struct usb_request *ep0_reply;
208 struct usb_request *ctrl_req;
209 u8 ep0_buff[8];
210 u8 ctrl_buff[8];
211
212 struct usb_gadget gadget;
213 unsigned int setup;
214 unsigned long last_rst;
215 struct s3c_hsotg_ep *eps;
216};
217
218/**
219 * struct s3c_hsotg_req - data transfer request 158 * struct s3c_hsotg_req - data transfer request
220 * @req: The USB gadget request 159 * @req: The USB gadget request
221 * @queue: The list of requests for the endpoint this is queued for. 160 * @queue: The list of requests for the endpoint this is queued for.
@@ -229,6 +168,7 @@ struct s3c_hsotg_req {
229 unsigned char mapped; 168 unsigned char mapped;
230}; 169};
231 170
171#if IS_ENABLED(CONFIG_USB_DWC2_PERIPHERAL) || IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE)
232#define call_gadget(_hs, _entry) \ 172#define call_gadget(_hs, _entry) \
233do { \ 173do { \
234 if ((_hs)->gadget.speed != USB_SPEED_UNKNOWN && \ 174 if ((_hs)->gadget.speed != USB_SPEED_UNKNOWN && \
@@ -238,6 +178,9 @@ do { \
238 spin_lock(&_hs->lock); \ 178 spin_lock(&_hs->lock); \
239 } \ 179 } \
240} while (0) 180} while (0)
181#else
182#define call_gadget(_hs, _entry) do {} while (0)
183#endif
241 184
242struct dwc2_hsotg; 185struct dwc2_hsotg;
243struct dwc2_host_chan; 186struct dwc2_host_chan;
@@ -495,11 +438,13 @@ struct dwc2_hw_params {
495 * struct dwc2_hsotg - Holds the state of the driver, including the non-periodic 438 * struct dwc2_hsotg - Holds the state of the driver, including the non-periodic
496 * and periodic schedules 439 * and periodic schedules
497 * 440 *
441 * These are common for both host and peripheral modes:
442 *
498 * @dev: The struct device pointer 443 * @dev: The struct device pointer
499 * @regs: Pointer to controller regs 444 * @regs: Pointer to controller regs
500 * @core_params: Parameters that define how the core should be configured
501 * @hw_params: Parameters that were autodetected from the 445 * @hw_params: Parameters that were autodetected from the
502 * hardware registers 446 * hardware registers
447 * @core_params: Parameters that define how the core should be configured
503 * @op_state: The operational State, during transitions (a_host=> 448 * @op_state: The operational State, during transitions (a_host=>
504 * a_peripheral and b_device=>b_host) this may not match 449 * a_peripheral and b_device=>b_host) this may not match
505 * the core, but allows the software to determine 450 * the core, but allows the software to determine
@@ -508,6 +453,8 @@ struct dwc2_hw_params {
508 * - USB_DR_MODE_PERIPHERAL 453 * - USB_DR_MODE_PERIPHERAL
509 * - USB_DR_MODE_HOST 454 * - USB_DR_MODE_HOST
510 * - USB_DR_MODE_OTG 455 * - USB_DR_MODE_OTG
456 * @lock: Spinlock that protects all the driver data structures
457 * @priv: Stores a pointer to the struct usb_hcd
511 * @queuing_high_bandwidth: True if multiple packets of a high-bandwidth 458 * @queuing_high_bandwidth: True if multiple packets of a high-bandwidth
512 * transfer are in process of being queued 459 * transfer are in process of being queued
513 * @srp_success: Stores status of SRP request in the case of a FS PHY 460 * @srp_success: Stores status of SRP request in the case of a FS PHY
@@ -517,6 +464,9 @@ struct dwc2_hw_params {
517 * interrupt 464 * interrupt
518 * @wkp_timer: Timer object for handling Wakeup Detected interrupt 465 * @wkp_timer: Timer object for handling Wakeup Detected interrupt
519 * @lx_state: Lx state of connected device 466 * @lx_state: Lx state of connected device
467 *
468 * These are for host mode:
469 *
520 * @flags: Flags for handling root port state changes 470 * @flags: Flags for handling root port state changes
521 * @non_periodic_sched_inactive: Inactive QHs in the non-periodic schedule. 471 * @non_periodic_sched_inactive: Inactive QHs in the non-periodic schedule.
522 * Transfers associated with these QHs are not currently 472 * Transfers associated with these QHs are not currently
@@ -585,11 +535,31 @@ struct dwc2_hw_params {
585 * @status_buf_dma: DMA address for status_buf 535 * @status_buf_dma: DMA address for status_buf
586 * @start_work: Delayed work for handling host A-cable connection 536 * @start_work: Delayed work for handling host A-cable connection
587 * @reset_work: Delayed work for handling a port reset 537 * @reset_work: Delayed work for handling a port reset
588 * @lock: Spinlock that protects all the driver data structures
589 * @priv: Stores a pointer to the struct usb_hcd
590 * @otg_port: OTG port number 538 * @otg_port: OTG port number
591 * @frame_list: Frame list 539 * @frame_list: Frame list
592 * @frame_list_dma: Frame list DMA address 540 * @frame_list_dma: Frame list DMA address
541 *
542 * These are for peripheral mode:
543 *
544 * @driver: USB gadget driver
545 * @phy: The otg phy transceiver structure for phy control.
546 * @uphy: The otg phy transceiver structure for old USB phy control.
547 * @plat: The platform specific configuration data. This can be removed once
548 * all SoCs support usb transceiver.
549 * @supplies: Definition of USB power supplies
550 * @phyif: PHY interface width
551 * @dedicated_fifos: Set if the hardware has dedicated IN-EP fifos.
552 * @num_of_eps: Number of available EPs (excluding EP0)
553 * @debug_root: Root directrory for debugfs.
554 * @debug_file: Main status file for debugfs.
555 * @debug_fifo: FIFO status file for debugfs.
556 * @ep0_reply: Request used for ep0 reply.
557 * @ep0_buff: Buffer for EP0 reply data, if needed.
558 * @ctrl_buff: Buffer for EP0 control requests.
559 * @ctrl_req: Request for EP0 control packets.
560 * @setup: NAK management for EP0 SETUP
561 * @last_rst: Time of last reset
562 * @eps: The endpoints being supplied to the gadget framework
593 */ 563 */
594struct dwc2_hsotg { 564struct dwc2_hsotg {
595 struct device *dev; 565 struct device *dev;
@@ -601,6 +571,15 @@ struct dwc2_hsotg {
601 enum usb_otg_state op_state; 571 enum usb_otg_state op_state;
602 enum usb_dr_mode dr_mode; 572 enum usb_dr_mode dr_mode;
603 573
574 struct phy *phy;
575 struct usb_phy *uphy;
576 struct regulator_bulk_data supplies[ARRAY_SIZE(s3c_hsotg_supply_names)];
577
578 spinlock_t lock;
579 void *priv;
580 int irq;
581 struct clk *clk;
582
604 unsigned int queuing_high_bandwidth:1; 583 unsigned int queuing_high_bandwidth:1;
605 unsigned int srp_success:1; 584 unsigned int srp_success:1;
606 585
@@ -609,6 +588,18 @@ struct dwc2_hsotg {
609 struct timer_list wkp_timer; 588 struct timer_list wkp_timer;
610 enum dwc2_lx_state lx_state; 589 enum dwc2_lx_state lx_state;
611 590
591 struct dentry *debug_root;
592 struct dentry *debug_file;
593 struct dentry *debug_fifo;
594
595 /* DWC OTG HW Release versions */
596#define DWC2_CORE_REV_2_71a 0x4f54271a
597#define DWC2_CORE_REV_2_90a 0x4f54290a
598#define DWC2_CORE_REV_2_92a 0x4f54292a
599#define DWC2_CORE_REV_2_94a 0x4f54294a
600#define DWC2_CORE_REV_3_00a 0x4f54300a
601
602#if IS_ENABLED(CONFIG_USB_DWC2_HOST) || IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE)
612 union dwc2_hcd_internal_flags { 603 union dwc2_hcd_internal_flags {
613 u32 d32; 604 u32 d32;
614 struct { 605 struct {
@@ -655,19 +646,10 @@ struct dwc2_hsotg {
655 646
656 struct delayed_work start_work; 647 struct delayed_work start_work;
657 struct delayed_work reset_work; 648 struct delayed_work reset_work;
658 spinlock_t lock;
659 void *priv;
660 u8 otg_port; 649 u8 otg_port;
661 u32 *frame_list; 650 u32 *frame_list;
662 dma_addr_t frame_list_dma; 651 dma_addr_t frame_list_dma;
663 652
664 /* DWC OTG HW Release versions */
665#define DWC2_CORE_REV_2_71a 0x4f54271a
666#define DWC2_CORE_REV_2_90a 0x4f54290a
667#define DWC2_CORE_REV_2_92a 0x4f54292a
668#define DWC2_CORE_REV_2_94a 0x4f54294a
669#define DWC2_CORE_REV_3_00a 0x4f54300a
670
671#ifdef DEBUG 653#ifdef DEBUG
672 u32 frrem_samples; 654 u32 frrem_samples;
673 u64 frrem_accum; 655 u64 frrem_accum;
@@ -686,6 +668,29 @@ struct dwc2_hsotg {
686 u32 hfnum_other_samples_b; 668 u32 hfnum_other_samples_b;
687 u64 hfnum_other_frrem_accum_b; 669 u64 hfnum_other_frrem_accum_b;
688#endif 670#endif
671#endif /* CONFIG_USB_DWC2_HOST || CONFIG_USB_DWC2_DUAL_ROLE */
672
673#if IS_ENABLED(CONFIG_USB_DWC2_PERIPHERAL) || IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE)
674 /* Gadget structures */
675 struct usb_gadget_driver *driver;
676 struct s3c_hsotg_plat *plat;
677
678 u32 phyif;
679 int fifo_mem;
680 unsigned int dedicated_fifos:1;
681 unsigned char num_of_eps;
682 u32 fifo_map;
683
684 struct usb_request *ep0_reply;
685 struct usb_request *ctrl_req;
686 u8 ep0_buff[8];
687 u8 ctrl_buff[8];
688
689 struct usb_gadget gadget;
690 unsigned int setup;
691 unsigned long last_rst;
692 struct s3c_hsotg_ep *eps;
693#endif /* CONFIG_USB_DWC2_PERIPHERAL || CONFIG_USB_DWC2_DUAL_ROLE */
689}; 694};
690 695
691/* Reasons for halting a host channel */ 696/* Reasons for halting a host channel */
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index fcd2bb55ccca..5a24e95ae1b0 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -36,6 +36,7 @@
36#include <linux/platform_data/s3c-hsotg.h> 36#include <linux/platform_data/s3c-hsotg.h>
37 37
38#include "core.h" 38#include "core.h"
39#include "hw.h"
39 40
40/* conversion functions */ 41/* conversion functions */
41static inline struct s3c_hsotg_req *our_req(struct usb_request *req) 42static 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 return container_of(ep, struct s3c_hsotg_ep, ep); 49 return container_of(ep, struct s3c_hsotg_ep, ep);
49} 50}
50 51
51static inline struct s3c_hsotg *to_hsotg(struct usb_gadget *gadget) 52static inline struct dwc2_hsotg *to_hsotg(struct usb_gadget *gadget)
52{ 53{
53 return container_of(gadget, struct s3c_hsotg, gadget); 54 return container_of(gadget, struct dwc2_hsotg, gadget);
54} 55}
55 56
56static inline void __orr32(void __iomem *ptr, u32 val) 57static inline void __orr32(void __iomem *ptr, u32 val)
@@ -64,7 +65,7 @@ static inline void __bic32(void __iomem *ptr, u32 val)
64} 65}
65 66
66/* forward decleration of functions */ 67/* forward decleration of functions */
67static void s3c_hsotg_dump(struct s3c_hsotg *hsotg); 68static void s3c_hsotg_dump(struct dwc2_hsotg *hsotg);
68 69
69/** 70/**
70 * using_dma - return the DMA status of the driver. 71 * using_dma - return the DMA status of the driver.
@@ -85,7 +86,7 @@ static void s3c_hsotg_dump(struct s3c_hsotg *hsotg);
85 * 86 *
86 * Until this issue is sorted out, we always return 'false'. 87 * Until this issue is sorted out, we always return 'false'.
87 */ 88 */
88static inline bool using_dma(struct s3c_hsotg *hsotg) 89static inline bool using_dma(struct dwc2_hsotg *hsotg)
89{ 90{
90 return false; /* support is not complete */ 91 return false; /* support is not complete */
91} 92}
@@ -95,7 +96,7 @@ static inline bool using_dma(struct s3c_hsotg *hsotg)
95 * @hsotg: The device state 96 * @hsotg: The device state
96 * @ints: A bitmask of the interrupts to enable 97 * @ints: A bitmask of the interrupts to enable
97 */ 98 */
98static void s3c_hsotg_en_gsint(struct s3c_hsotg *hsotg, u32 ints) 99static void s3c_hsotg_en_gsint(struct dwc2_hsotg *hsotg, u32 ints)
99{ 100{
100 u32 gsintmsk = readl(hsotg->regs + GINTMSK); 101 u32 gsintmsk = readl(hsotg->regs + GINTMSK);
101 u32 new_gsintmsk; 102 u32 new_gsintmsk;
@@ -113,7 +114,7 @@ static void s3c_hsotg_en_gsint(struct s3c_hsotg *hsotg, u32 ints)
113 * @hsotg: The device state 114 * @hsotg: The device state
114 * @ints: A bitmask of the interrupts to enable 115 * @ints: A bitmask of the interrupts to enable
115 */ 116 */
116static void s3c_hsotg_disable_gsint(struct s3c_hsotg *hsotg, u32 ints) 117static void s3c_hsotg_disable_gsint(struct dwc2_hsotg *hsotg, u32 ints)
117{ 118{
118 u32 gsintmsk = readl(hsotg->regs + GINTMSK); 119 u32 gsintmsk = readl(hsotg->regs + GINTMSK);
119 u32 new_gsintmsk; 120 u32 new_gsintmsk;
@@ -134,7 +135,7 @@ static void s3c_hsotg_disable_gsint(struct s3c_hsotg *hsotg, u32 ints)
134 * Set or clear the mask for an individual endpoint's interrupt 135 * Set or clear the mask for an individual endpoint's interrupt
135 * request. 136 * request.
136 */ 137 */
137static void s3c_hsotg_ctrl_epint(struct s3c_hsotg *hsotg, 138static void s3c_hsotg_ctrl_epint(struct dwc2_hsotg *hsotg,
138 unsigned int ep, unsigned int dir_in, 139 unsigned int ep, unsigned int dir_in,
139 unsigned int en) 140 unsigned int en)
140{ 141{
@@ -159,7 +160,7 @@ static void s3c_hsotg_ctrl_epint(struct s3c_hsotg *hsotg,
159 * s3c_hsotg_init_fifo - initialise non-periodic FIFOs 160 * s3c_hsotg_init_fifo - initialise non-periodic FIFOs
160 * @hsotg: The device instance. 161 * @hsotg: The device instance.
161 */ 162 */
162static void s3c_hsotg_init_fifo(struct s3c_hsotg *hsotg) 163static void s3c_hsotg_init_fifo(struct dwc2_hsotg *hsotg)
163{ 164{
164 unsigned int ep; 165 unsigned int ep;
165 unsigned int addr; 166 unsigned int addr;
@@ -283,7 +284,7 @@ static inline int is_ep_periodic(struct s3c_hsotg_ep *hs_ep)
283 * This is the reverse of s3c_hsotg_map_dma(), called for the completion 284 * This is the reverse of s3c_hsotg_map_dma(), called for the completion
284 * of a request to ensure the buffer is ready for access by the caller. 285 * of a request to ensure the buffer is ready for access by the caller.
285 */ 286 */
286static void s3c_hsotg_unmap_dma(struct s3c_hsotg *hsotg, 287static void s3c_hsotg_unmap_dma(struct dwc2_hsotg *hsotg,
287 struct s3c_hsotg_ep *hs_ep, 288 struct s3c_hsotg_ep *hs_ep,
288 struct s3c_hsotg_req *hs_req) 289 struct s3c_hsotg_req *hs_req)
289{ 290{
@@ -312,7 +313,7 @@ static void s3c_hsotg_unmap_dma(struct s3c_hsotg *hsotg,
312 * 313 *
313 * This routine is only needed for PIO 314 * This routine is only needed for PIO
314 */ 315 */
315static int s3c_hsotg_write_fifo(struct s3c_hsotg *hsotg, 316static int s3c_hsotg_write_fifo(struct dwc2_hsotg *hsotg,
316 struct s3c_hsotg_ep *hs_ep, 317 struct s3c_hsotg_ep *hs_ep,
317 struct s3c_hsotg_req *hs_req) 318 struct s3c_hsotg_req *hs_req)
318{ 319{
@@ -517,7 +518,7 @@ static unsigned get_ep_limit(struct s3c_hsotg_ep *hs_ep)
517 * Start the given request running by setting the endpoint registers 518 * Start the given request running by setting the endpoint registers
518 * appropriately, and writing any data to the FIFOs. 519 * appropriately, and writing any data to the FIFOs.
519 */ 520 */
520static void s3c_hsotg_start_req(struct s3c_hsotg *hsotg, 521static void s3c_hsotg_start_req(struct dwc2_hsotg *hsotg,
521 struct s3c_hsotg_ep *hs_ep, 522 struct s3c_hsotg_ep *hs_ep,
522 struct s3c_hsotg_req *hs_req, 523 struct s3c_hsotg_req *hs_req,
523 bool continuing) 524 bool continuing)
@@ -707,7 +708,7 @@ static void s3c_hsotg_start_req(struct s3c_hsotg *hsotg,
707 * DMA memory, then we map the memory and mark our request to allow us to 708 * DMA memory, then we map the memory and mark our request to allow us to
708 * cleanup on completion. 709 * cleanup on completion.
709 */ 710 */
710static int s3c_hsotg_map_dma(struct s3c_hsotg *hsotg, 711static int s3c_hsotg_map_dma(struct dwc2_hsotg *hsotg,
711 struct s3c_hsotg_ep *hs_ep, 712 struct s3c_hsotg_ep *hs_ep,
712 struct usb_request *req) 713 struct usb_request *req)
713{ 714{
@@ -736,7 +737,7 @@ static int s3c_hsotg_ep_queue(struct usb_ep *ep, struct usb_request *req,
736{ 737{
737 struct s3c_hsotg_req *hs_req = our_req(req); 738 struct s3c_hsotg_req *hs_req = our_req(req);
738 struct s3c_hsotg_ep *hs_ep = our_ep(ep); 739 struct s3c_hsotg_ep *hs_ep = our_ep(ep);
739 struct s3c_hsotg *hs = hs_ep->parent; 740 struct dwc2_hsotg *hs = hs_ep->parent;
740 bool first; 741 bool first;
741 742
742 dev_dbg(hs->dev, "%s: req %p: %d@%p, noi=%d, zero=%d, snok=%d\n", 743 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 gfp_t gfp_flags) 769 gfp_t gfp_flags)
769{ 770{
770 struct s3c_hsotg_ep *hs_ep = our_ep(ep); 771 struct s3c_hsotg_ep *hs_ep = our_ep(ep);
771 struct s3c_hsotg *hs = hs_ep->parent; 772 struct dwc2_hsotg *hs = hs_ep->parent;
772 unsigned long flags = 0; 773 unsigned long flags = 0;
773 int ret = 0; 774 int ret = 0;
774 775
@@ -799,7 +800,7 @@ static void s3c_hsotg_complete_oursetup(struct usb_ep *ep,
799 struct usb_request *req) 800 struct usb_request *req)
800{ 801{
801 struct s3c_hsotg_ep *hs_ep = our_ep(ep); 802 struct s3c_hsotg_ep *hs_ep = our_ep(ep);
802 struct s3c_hsotg *hsotg = hs_ep->parent; 803 struct dwc2_hsotg *hsotg = hs_ep->parent;
803 804
804 dev_dbg(hsotg->dev, "%s: ep %p, req %p\n", __func__, ep, req); 805 dev_dbg(hsotg->dev, "%s: ep %p, req %p\n", __func__, ep, req);
805 806
@@ -814,7 +815,7 @@ static void s3c_hsotg_complete_oursetup(struct usb_ep *ep,
814 * Convert the given wIndex into a pointer to an driver endpoint 815 * Convert the given wIndex into a pointer to an driver endpoint
815 * structure, or return NULL if it is not a valid endpoint. 816 * structure, or return NULL if it is not a valid endpoint.
816 */ 817 */
817static struct s3c_hsotg_ep *ep_from_windex(struct s3c_hsotg *hsotg, 818static struct s3c_hsotg_ep *ep_from_windex(struct dwc2_hsotg *hsotg,
818 u32 windex) 819 u32 windex)
819{ 820{
820 struct s3c_hsotg_ep *ep = &hsotg->eps[windex & 0x7F]; 821 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 * Create a request and queue it on the given endpoint. This is useful as 844 * Create a request and queue it on the given endpoint. This is useful as
844 * an internal method of sending replies to certain control requests, etc. 845 * an internal method of sending replies to certain control requests, etc.
845 */ 846 */
846static int s3c_hsotg_send_reply(struct s3c_hsotg *hsotg, 847static int s3c_hsotg_send_reply(struct dwc2_hsotg *hsotg,
847 struct s3c_hsotg_ep *ep, 848 struct s3c_hsotg_ep *ep,
848 void *buff, 849 void *buff,
849 int length) 850 int length)
@@ -884,7 +885,7 @@ static int s3c_hsotg_send_reply(struct s3c_hsotg *hsotg,
884 * @hsotg: The device state 885 * @hsotg: The device state
885 * @ctrl: USB control request 886 * @ctrl: USB control request
886 */ 887 */
887static int s3c_hsotg_process_req_status(struct s3c_hsotg *hsotg, 888static int s3c_hsotg_process_req_status(struct dwc2_hsotg *hsotg,
888 struct usb_ctrlrequest *ctrl) 889 struct usb_ctrlrequest *ctrl)
889{ 890{
890 struct s3c_hsotg_ep *ep0 = &hsotg->eps[0]; 891 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 * @hsotg: The device state 956 * @hsotg: The device state
956 * @ctrl: USB control request 957 * @ctrl: USB control request
957 */ 958 */
958static int s3c_hsotg_process_req_feature(struct s3c_hsotg *hsotg, 959static int s3c_hsotg_process_req_feature(struct dwc2_hsotg *hsotg,
959 struct usb_ctrlrequest *ctrl) 960 struct usb_ctrlrequest *ctrl)
960{ 961{
961 struct s3c_hsotg_ep *ep0 = &hsotg->eps[0]; 962 struct s3c_hsotg_ep *ep0 = &hsotg->eps[0];
@@ -1028,8 +1029,8 @@ static int s3c_hsotg_process_req_feature(struct s3c_hsotg *hsotg,
1028 return 1; 1029 return 1;
1029} 1030}
1030 1031
1031static void s3c_hsotg_enqueue_setup(struct s3c_hsotg *hsotg); 1032static void s3c_hsotg_enqueue_setup(struct dwc2_hsotg *hsotg);
1032static void s3c_hsotg_disconnect(struct s3c_hsotg *hsotg); 1033static void s3c_hsotg_disconnect(struct dwc2_hsotg *hsotg);
1033 1034
1034/** 1035/**
1035 * s3c_hsotg_stall_ep0 - stall ep0 1036 * s3c_hsotg_stall_ep0 - stall ep0
@@ -1037,7 +1038,7 @@ static void s3c_hsotg_disconnect(struct s3c_hsotg *hsotg);
1037 * 1038 *
1038 * Set stall for ep0 as response for setup request. 1039 * Set stall for ep0 as response for setup request.
1039 */ 1040 */
1040static void s3c_hsotg_stall_ep0(struct s3c_hsotg *hsotg) 1041static void s3c_hsotg_stall_ep0(struct dwc2_hsotg *hsotg)
1041{ 1042{
1042 struct s3c_hsotg_ep *ep0 = &hsotg->eps[0]; 1043 struct s3c_hsotg_ep *ep0 = &hsotg->eps[0];
1043 u32 reg; 1044 u32 reg;
@@ -1076,7 +1077,7 @@ static void s3c_hsotg_stall_ep0(struct s3c_hsotg *hsotg)
1076 * needs to work out what to do next (and whether to pass it on to the 1077 * needs to work out what to do next (and whether to pass it on to the
1077 * gadget driver). 1078 * gadget driver).
1078 */ 1079 */
1079static void s3c_hsotg_process_control(struct s3c_hsotg *hsotg, 1080static void s3c_hsotg_process_control(struct dwc2_hsotg *hsotg,
1080 struct usb_ctrlrequest *ctrl) 1081 struct usb_ctrlrequest *ctrl)
1081{ 1082{
1082 struct s3c_hsotg_ep *ep0 = &hsotg->eps[0]; 1083 struct s3c_hsotg_ep *ep0 = &hsotg->eps[0];
@@ -1161,7 +1162,7 @@ static void s3c_hsotg_complete_setup(struct usb_ep *ep,
1161 struct usb_request *req) 1162 struct usb_request *req)
1162{ 1163{
1163 struct s3c_hsotg_ep *hs_ep = our_ep(ep); 1164 struct s3c_hsotg_ep *hs_ep = our_ep(ep);
1164 struct s3c_hsotg *hsotg = hs_ep->parent; 1165 struct dwc2_hsotg *hsotg = hs_ep->parent;
1165 1166
1166 if (req->status < 0) { 1167 if (req->status < 0) {
1167 dev_dbg(hsotg->dev, "%s: failed %d\n", __func__, req->status); 1168 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 * Enqueue a request on EP0 if necessary to received any SETUP packets 1184 * Enqueue a request on EP0 if necessary to received any SETUP packets
1184 * received from the host. 1185 * received from the host.
1185 */ 1186 */
1186static void s3c_hsotg_enqueue_setup(struct s3c_hsotg *hsotg) 1187static void s3c_hsotg_enqueue_setup(struct dwc2_hsotg *hsotg)
1187{ 1188{
1188 struct usb_request *req = hsotg->ctrl_req; 1189 struct usb_request *req = hsotg->ctrl_req;
1189 struct s3c_hsotg_req *hs_req = our_req(req); 1190 struct s3c_hsotg_req *hs_req = our_req(req);
@@ -1226,7 +1227,7 @@ static void s3c_hsotg_enqueue_setup(struct s3c_hsotg *hsotg)
1226 * 1227 *
1227 * Note, expects the ep to already be locked as appropriate. 1228 * Note, expects the ep to already be locked as appropriate.
1228 */ 1229 */
1229static void s3c_hsotg_complete_request(struct s3c_hsotg *hsotg, 1230static void s3c_hsotg_complete_request(struct dwc2_hsotg *hsotg,
1230 struct s3c_hsotg_ep *hs_ep, 1231 struct s3c_hsotg_ep *hs_ep,
1231 struct s3c_hsotg_req *hs_req, 1232 struct s3c_hsotg_req *hs_req,
1232 int result) 1233 int result)
@@ -1291,7 +1292,7 @@ static void s3c_hsotg_complete_request(struct s3c_hsotg *hsotg,
1291 * endpoint, so sort out whether we need to read the data into a request 1292 * endpoint, so sort out whether we need to read the data into a request
1292 * that has been made for that endpoint. 1293 * that has been made for that endpoint.
1293 */ 1294 */
1294static void s3c_hsotg_rx_data(struct s3c_hsotg *hsotg, int ep_idx, int size) 1295static void s3c_hsotg_rx_data(struct dwc2_hsotg *hsotg, int ep_idx, int size)
1295{ 1296{
1296 struct s3c_hsotg_ep *hs_ep = &hsotg->eps[ep_idx]; 1297 struct s3c_hsotg_ep *hs_ep = &hsotg->eps[ep_idx];
1297 struct s3c_hsotg_req *hs_req = hs_ep->req; 1298 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 * currently believed that we do not need to wait for any space in 1357 * currently believed that we do not need to wait for any space in
1357 * the TxFIFO. 1358 * the TxFIFO.
1358 */ 1359 */
1359static void s3c_hsotg_send_zlp(struct s3c_hsotg *hsotg, 1360static void s3c_hsotg_send_zlp(struct dwc2_hsotg *hsotg,
1360 struct s3c_hsotg_req *req) 1361 struct s3c_hsotg_req *req)
1361{ 1362{
1362 u32 ctrl; 1363 u32 ctrl;
@@ -1398,7 +1399,7 @@ static void s3c_hsotg_send_zlp(struct s3c_hsotg *hsotg,
1398 * transfer for an OUT endpoint has been completed, either by a short 1399 * transfer for an OUT endpoint has been completed, either by a short
1399 * packet or by the finish of a transfer. 1400 * packet or by the finish of a transfer.
1400 */ 1401 */
1401static void s3c_hsotg_handle_outdone(struct s3c_hsotg *hsotg, 1402static void s3c_hsotg_handle_outdone(struct dwc2_hsotg *hsotg,
1402 int epnum, bool was_setup) 1403 int epnum, bool was_setup)
1403{ 1404{
1404 u32 epsize = readl(hsotg->regs + DOEPTSIZ(epnum)); 1405 u32 epsize = readl(hsotg->regs + DOEPTSIZ(epnum));
@@ -1471,7 +1472,7 @@ static void s3c_hsotg_handle_outdone(struct s3c_hsotg *hsotg,
1471 * 1472 *
1472 * Return the current frame number 1473 * Return the current frame number
1473 */ 1474 */
1474static u32 s3c_hsotg_read_frameno(struct s3c_hsotg *hsotg) 1475static u32 s3c_hsotg_read_frameno(struct dwc2_hsotg *hsotg)
1475{ 1476{
1476 u32 dsts; 1477 u32 dsts;
1477 1478
@@ -1498,7 +1499,7 @@ static u32 s3c_hsotg_read_frameno(struct s3c_hsotg *hsotg)
1498 * as the actual data should be sent to the memory directly and we turn 1499 * as the actual data should be sent to the memory directly and we turn
1499 * on the completion interrupts to get notifications of transfer completion. 1500 * on the completion interrupts to get notifications of transfer completion.
1500 */ 1501 */
1501static void s3c_hsotg_handle_rx(struct s3c_hsotg *hsotg) 1502static void s3c_hsotg_handle_rx(struct dwc2_hsotg *hsotg)
1502{ 1503{
1503 u32 grxstsr = readl(hsotg->regs + GRXSTSP); 1504 u32 grxstsr = readl(hsotg->regs + GRXSTSP);
1504 u32 epnum, status, size; 1505 u32 epnum, status, size;
@@ -1590,7 +1591,7 @@ static u32 s3c_hsotg_ep0_mps(unsigned int mps)
1590 * Configure the maximum packet size for the given endpoint, updating 1591 * Configure the maximum packet size for the given endpoint, updating
1591 * the hardware control registers to reflect this. 1592 * the hardware control registers to reflect this.
1592 */ 1593 */
1593static void s3c_hsotg_set_ep_maxpacket(struct s3c_hsotg *hsotg, 1594static void s3c_hsotg_set_ep_maxpacket(struct dwc2_hsotg *hsotg,
1594 unsigned int ep, unsigned int mps) 1595 unsigned int ep, unsigned int mps)
1595{ 1596{
1596 struct s3c_hsotg_ep *hs_ep = &hsotg->eps[ep]; 1597 struct s3c_hsotg_ep *hs_ep = &hsotg->eps[ep];
@@ -1645,7 +1646,7 @@ bad_mps:
1645 * @hsotg: The driver state 1646 * @hsotg: The driver state
1646 * @idx: The index for the endpoint (0..15) 1647 * @idx: The index for the endpoint (0..15)
1647 */ 1648 */
1648static void s3c_hsotg_txfifo_flush(struct s3c_hsotg *hsotg, unsigned int idx) 1649static void s3c_hsotg_txfifo_flush(struct dwc2_hsotg *hsotg, unsigned int idx)
1649{ 1650{
1650 int timeout; 1651 int timeout;
1651 int val; 1652 int val;
@@ -1681,7 +1682,7 @@ static void s3c_hsotg_txfifo_flush(struct s3c_hsotg *hsotg, unsigned int idx)
1681 * Check to see if there is a request that has data to send, and if so 1682 * Check to see if there is a request that has data to send, and if so
1682 * make an attempt to write data into the FIFO. 1683 * make an attempt to write data into the FIFO.
1683 */ 1684 */
1684static int s3c_hsotg_trytx(struct s3c_hsotg *hsotg, 1685static int s3c_hsotg_trytx(struct dwc2_hsotg *hsotg,
1685 struct s3c_hsotg_ep *hs_ep) 1686 struct s3c_hsotg_ep *hs_ep)
1686{ 1687{
1687 struct s3c_hsotg_req *hs_req = hs_ep->req; 1688 struct s3c_hsotg_req *hs_req = hs_ep->req;
@@ -1714,7 +1715,7 @@ static int s3c_hsotg_trytx(struct s3c_hsotg *hsotg,
1714 * An IN transfer has been completed, update the transfer's state and then 1715 * An IN transfer has been completed, update the transfer's state and then
1715 * call the relevant completion routines. 1716 * call the relevant completion routines.
1716 */ 1717 */
1717static void s3c_hsotg_complete_in(struct s3c_hsotg *hsotg, 1718static void s3c_hsotg_complete_in(struct dwc2_hsotg *hsotg,
1718 struct s3c_hsotg_ep *hs_ep) 1719 struct s3c_hsotg_ep *hs_ep)
1719{ 1720{
1720 struct s3c_hsotg_req *hs_req = hs_ep->req; 1721 struct s3c_hsotg_req *hs_req = hs_ep->req;
@@ -1791,7 +1792,7 @@ static void s3c_hsotg_complete_in(struct s3c_hsotg *hsotg,
1791 * 1792 *
1792 * Process and clear any interrupt pending for an individual endpoint 1793 * Process and clear any interrupt pending for an individual endpoint
1793 */ 1794 */
1794static void s3c_hsotg_epint(struct s3c_hsotg *hsotg, unsigned int idx, 1795static void s3c_hsotg_epint(struct dwc2_hsotg *hsotg, unsigned int idx,
1795 int dir_in) 1796 int dir_in)
1796{ 1797{
1797 struct s3c_hsotg_ep *hs_ep = &hsotg->eps[idx]; 1798 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 * Handle updating the device settings after the enumeration phase has 1917 * Handle updating the device settings after the enumeration phase has
1917 * been completed. 1918 * been completed.
1918 */ 1919 */
1919static void s3c_hsotg_irq_enumdone(struct s3c_hsotg *hsotg) 1920static void s3c_hsotg_irq_enumdone(struct dwc2_hsotg *hsotg)
1920{ 1921{
1921 u32 dsts = readl(hsotg->regs + DSTS); 1922 u32 dsts = readl(hsotg->regs + DSTS);
1922 int ep0_mps = 0, ep_mps = 8; 1923 int ep0_mps = 0, ep_mps = 8;
@@ -1993,7 +1994,7 @@ static void s3c_hsotg_irq_enumdone(struct s3c_hsotg *hsotg)
1993 * Go through the requests on the given endpoint and mark them 1994 * Go through the requests on the given endpoint and mark them
1994 * completed with the given result code. 1995 * completed with the given result code.
1995 */ 1996 */
1996static void kill_all_requests(struct s3c_hsotg *hsotg, 1997static void kill_all_requests(struct dwc2_hsotg *hsotg,
1997 struct s3c_hsotg_ep *ep, 1998 struct s3c_hsotg_ep *ep,
1998 int result, bool force) 1999 int result, bool force)
1999{ 2000{
@@ -2027,7 +2028,7 @@ static void kill_all_requests(struct s3c_hsotg *hsotg,
2027 * transactions and signal the gadget driver that this 2028 * transactions and signal the gadget driver that this
2028 * has happened. 2029 * has happened.
2029 */ 2030 */
2030static void s3c_hsotg_disconnect(struct s3c_hsotg *hsotg) 2031static void s3c_hsotg_disconnect(struct dwc2_hsotg *hsotg)
2031{ 2032{
2032 unsigned ep; 2033 unsigned ep;
2033 2034
@@ -2042,7 +2043,7 @@ static void s3c_hsotg_disconnect(struct s3c_hsotg *hsotg)
2042 * @hsotg: The device state: 2043 * @hsotg: The device state:
2043 * @periodic: True if this is a periodic FIFO interrupt 2044 * @periodic: True if this is a periodic FIFO interrupt
2044 */ 2045 */
2045static void s3c_hsotg_irq_fifoempty(struct s3c_hsotg *hsotg, bool periodic) 2046static void s3c_hsotg_irq_fifoempty(struct dwc2_hsotg *hsotg, bool periodic)
2046{ 2047{
2047 struct s3c_hsotg_ep *ep; 2048 struct s3c_hsotg_ep *ep;
2048 int epno, ret; 2049 int epno, ret;
@@ -2076,7 +2077,7 @@ static void s3c_hsotg_irq_fifoempty(struct s3c_hsotg *hsotg, bool periodic)
2076 * 2077 *
2077 * Issue a soft reset to the core, and await the core finishing it. 2078 * Issue a soft reset to the core, and await the core finishing it.
2078 */ 2079 */
2079static int s3c_hsotg_corereset(struct s3c_hsotg *hsotg) 2080static int s3c_hsotg_corereset(struct dwc2_hsotg *hsotg)
2080{ 2081{
2081 int timeout; 2082 int timeout;
2082 u32 grstctl; 2083 u32 grstctl;
@@ -2124,7 +2125,7 @@ static int s3c_hsotg_corereset(struct s3c_hsotg *hsotg)
2124 * 2125 *
2125 * Issue a soft reset to the core, and await the core finishing it. 2126 * Issue a soft reset to the core, and await the core finishing it.
2126 */ 2127 */
2127static void s3c_hsotg_core_init_disconnected(struct s3c_hsotg *hsotg) 2128static void s3c_hsotg_core_init_disconnected(struct dwc2_hsotg *hsotg)
2128{ 2129{
2129 s3c_hsotg_corereset(hsotg); 2130 s3c_hsotg_corereset(hsotg);
2130 2131
@@ -2250,13 +2251,13 @@ static void s3c_hsotg_core_init_disconnected(struct s3c_hsotg *hsotg)
2250 hsotg->last_rst = jiffies; 2251 hsotg->last_rst = jiffies;
2251} 2252}
2252 2253
2253static void s3c_hsotg_core_disconnect(struct s3c_hsotg *hsotg) 2254static void s3c_hsotg_core_disconnect(struct dwc2_hsotg *hsotg)
2254{ 2255{
2255 /* set the soft-disconnect bit */ 2256 /* set the soft-disconnect bit */
2256 __orr32(hsotg->regs + DCTL, DCTL_SFTDISCON); 2257 __orr32(hsotg->regs + DCTL, DCTL_SFTDISCON);
2257} 2258}
2258 2259
2259static void s3c_hsotg_core_connect(struct s3c_hsotg *hsotg) 2260static void s3c_hsotg_core_connect(struct dwc2_hsotg *hsotg)
2260{ 2261{
2261 /* remove the soft-disconnect and let's go */ 2262 /* remove the soft-disconnect and let's go */
2262 __bic32(hsotg->regs + DCTL, DCTL_SFTDISCON); 2263 __bic32(hsotg->regs + DCTL, DCTL_SFTDISCON);
@@ -2269,7 +2270,7 @@ static void s3c_hsotg_core_connect(struct s3c_hsotg *hsotg)
2269 */ 2270 */
2270static irqreturn_t s3c_hsotg_irq(int irq, void *pw) 2271static irqreturn_t s3c_hsotg_irq(int irq, void *pw)
2271{ 2272{
2272 struct s3c_hsotg *hsotg = pw; 2273 struct dwc2_hsotg *hsotg = pw;
2273 int retry_count = 8; 2274 int retry_count = 8;
2274 u32 gintsts; 2275 u32 gintsts;
2275 u32 gintmsk; 2276 u32 gintmsk;
@@ -2461,7 +2462,7 @@ static int s3c_hsotg_ep_enable(struct usb_ep *ep,
2461 const struct usb_endpoint_descriptor *desc) 2462 const struct usb_endpoint_descriptor *desc)
2462{ 2463{
2463 struct s3c_hsotg_ep *hs_ep = our_ep(ep); 2464 struct s3c_hsotg_ep *hs_ep = our_ep(ep);
2464 struct s3c_hsotg *hsotg = hs_ep->parent; 2465 struct dwc2_hsotg *hsotg = hs_ep->parent;
2465 unsigned long flags; 2466 unsigned long flags;
2466 int index = hs_ep->index; 2467 int index = hs_ep->index;
2467 u32 epctrl_reg; 2468 u32 epctrl_reg;
@@ -2604,7 +2605,7 @@ error:
2604static int s3c_hsotg_ep_disable(struct usb_ep *ep) 2605static int s3c_hsotg_ep_disable(struct usb_ep *ep)
2605{ 2606{
2606 struct s3c_hsotg_ep *hs_ep = our_ep(ep); 2607 struct s3c_hsotg_ep *hs_ep = our_ep(ep);
2607 struct s3c_hsotg *hsotg = hs_ep->parent; 2608 struct dwc2_hsotg *hsotg = hs_ep->parent;
2608 int dir_in = hs_ep->dir_in; 2609 int dir_in = hs_ep->dir_in;
2609 int index = hs_ep->index; 2610 int index = hs_ep->index;
2610 unsigned long flags; 2611 unsigned long flags;
@@ -2669,7 +2670,7 @@ static int s3c_hsotg_ep_dequeue(struct usb_ep *ep, struct usb_request *req)
2669{ 2670{
2670 struct s3c_hsotg_req *hs_req = our_req(req); 2671 struct s3c_hsotg_req *hs_req = our_req(req);
2671 struct s3c_hsotg_ep *hs_ep = our_ep(ep); 2672 struct s3c_hsotg_ep *hs_ep = our_ep(ep);
2672 struct s3c_hsotg *hs = hs_ep->parent; 2673 struct dwc2_hsotg *hs = hs_ep->parent;
2673 unsigned long flags; 2674 unsigned long flags;
2674 2675
2675 dev_dbg(hs->dev, "ep_dequeue(%p,%p)\n", ep, req); 2676 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)
2695static int s3c_hsotg_ep_sethalt(struct usb_ep *ep, int value) 2696static int s3c_hsotg_ep_sethalt(struct usb_ep *ep, int value)
2696{ 2697{
2697 struct s3c_hsotg_ep *hs_ep = our_ep(ep); 2698 struct s3c_hsotg_ep *hs_ep = our_ep(ep);
2698 struct s3c_hsotg *hs = hs_ep->parent; 2699 struct dwc2_hsotg *hs = hs_ep->parent;
2699 int index = hs_ep->index; 2700 int index = hs_ep->index;
2700 u32 epreg; 2701 u32 epreg;
2701 u32 epctl; 2702 u32 epctl;
@@ -2759,7 +2760,7 @@ static int s3c_hsotg_ep_sethalt(struct usb_ep *ep, int value)
2759static int s3c_hsotg_ep_sethalt_lock(struct usb_ep *ep, int value) 2760static int s3c_hsotg_ep_sethalt_lock(struct usb_ep *ep, int value)
2760{ 2761{
2761 struct s3c_hsotg_ep *hs_ep = our_ep(ep); 2762 struct s3c_hsotg_ep *hs_ep = our_ep(ep);
2762 struct s3c_hsotg *hs = hs_ep->parent; 2763 struct dwc2_hsotg *hs = hs_ep->parent;
2763 unsigned long flags = 0; 2764 unsigned long flags = 0;
2764 int ret = 0; 2765 int ret = 0;
2765 2766
@@ -2788,7 +2789,7 @@ static struct usb_ep_ops s3c_hsotg_ep_ops = {
2788 * A wrapper for platform code responsible for controlling 2789 * A wrapper for platform code responsible for controlling
2789 * low-level USB code 2790 * low-level USB code
2790 */ 2791 */
2791static void s3c_hsotg_phy_enable(struct s3c_hsotg *hsotg) 2792static void s3c_hsotg_phy_enable(struct dwc2_hsotg *hsotg)
2792{ 2793{
2793 struct platform_device *pdev = to_platform_device(hsotg->dev); 2794 struct platform_device *pdev = to_platform_device(hsotg->dev);
2794 2795
@@ -2811,7 +2812,7 @@ static void s3c_hsotg_phy_enable(struct s3c_hsotg *hsotg)
2811 * A wrapper for platform code responsible for controlling 2812 * A wrapper for platform code responsible for controlling
2812 * low-level USB code 2813 * low-level USB code
2813 */ 2814 */
2814static void s3c_hsotg_phy_disable(struct s3c_hsotg *hsotg) 2815static void s3c_hsotg_phy_disable(struct dwc2_hsotg *hsotg)
2815{ 2816{
2816 struct platform_device *pdev = to_platform_device(hsotg->dev); 2817 struct platform_device *pdev = to_platform_device(hsotg->dev);
2817 2818
@@ -2829,7 +2830,7 @@ static void s3c_hsotg_phy_disable(struct s3c_hsotg *hsotg)
2829 * s3c_hsotg_init - initalize the usb core 2830 * s3c_hsotg_init - initalize the usb core
2830 * @hsotg: The driver state 2831 * @hsotg: The driver state
2831 */ 2832 */
2832static void s3c_hsotg_init(struct s3c_hsotg *hsotg) 2833static void s3c_hsotg_init(struct dwc2_hsotg *hsotg)
2833{ 2834{
2834 /* unmask subset of endpoint interrupts */ 2835 /* unmask subset of endpoint interrupts */
2835 2836
@@ -2879,7 +2880,7 @@ static void s3c_hsotg_init(struct s3c_hsotg *hsotg)
2879static int s3c_hsotg_udc_start(struct usb_gadget *gadget, 2880static int s3c_hsotg_udc_start(struct usb_gadget *gadget,
2880 struct usb_gadget_driver *driver) 2881 struct usb_gadget_driver *driver)
2881{ 2882{
2882 struct s3c_hsotg *hsotg = to_hsotg(gadget); 2883 struct dwc2_hsotg *hsotg = to_hsotg(gadget);
2883 unsigned long flags; 2884 unsigned long flags;
2884 int ret; 2885 int ret;
2885 2886
@@ -2942,7 +2943,7 @@ err:
2942 */ 2943 */
2943static int s3c_hsotg_udc_stop(struct usb_gadget *gadget) 2944static int s3c_hsotg_udc_stop(struct usb_gadget *gadget)
2944{ 2945{
2945 struct s3c_hsotg *hsotg = to_hsotg(gadget); 2946 struct dwc2_hsotg *hsotg = to_hsotg(gadget);
2946 unsigned long flags = 0; 2947 unsigned long flags = 0;
2947 int ep; 2948 int ep;
2948 2949
@@ -2989,7 +2990,7 @@ static int s3c_hsotg_gadget_getframe(struct usb_gadget *gadget)
2989 */ 2990 */
2990static int s3c_hsotg_pullup(struct usb_gadget *gadget, int is_on) 2991static int s3c_hsotg_pullup(struct usb_gadget *gadget, int is_on)
2991{ 2992{
2992 struct s3c_hsotg *hsotg = to_hsotg(gadget); 2993 struct dwc2_hsotg *hsotg = to_hsotg(gadget);
2993 unsigned long flags = 0; 2994 unsigned long flags = 0;
2994 2995
2995 dev_dbg(hsotg->dev, "%s: is_on: %d\n", __func__, is_on); 2996 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 * creation) to give to the gadget driver. Setup the endpoint name, any 3027 * creation) to give to the gadget driver. Setup the endpoint name, any
3027 * direction information and other state that may be required. 3028 * direction information and other state that may be required.
3028 */ 3029 */
3029static void s3c_hsotg_initep(struct s3c_hsotg *hsotg, 3030static void s3c_hsotg_initep(struct dwc2_hsotg *hsotg,
3030 struct s3c_hsotg_ep *hs_ep, 3031 struct s3c_hsotg_ep *hs_ep,
3031 int epnum) 3032 int epnum)
3032{ 3033{
@@ -3075,7 +3076,7 @@ static void s3c_hsotg_initep(struct s3c_hsotg *hsotg,
3075 * 3076 *
3076 * Read the USB core HW configuration registers 3077 * Read the USB core HW configuration registers
3077 */ 3078 */
3078static void s3c_hsotg_hw_cfg(struct s3c_hsotg *hsotg) 3079static void s3c_hsotg_hw_cfg(struct dwc2_hsotg *hsotg)
3079{ 3080{
3080 u32 cfg2, cfg3, cfg4; 3081 u32 cfg2, cfg3, cfg4;
3081 /* check hardware configuration */ 3082 /* check hardware configuration */
@@ -3099,7 +3100,7 @@ static void s3c_hsotg_hw_cfg(struct s3c_hsotg *hsotg)
3099 * s3c_hsotg_dump - dump state of the udc 3100 * s3c_hsotg_dump - dump state of the udc
3100 * @param: The device state 3101 * @param: The device state
3101 */ 3102 */
3102static void s3c_hsotg_dump(struct s3c_hsotg *hsotg) 3103static void s3c_hsotg_dump(struct dwc2_hsotg *hsotg)
3103{ 3104{
3104#ifdef DEBUG 3105#ifdef DEBUG
3105 struct device *dev = hsotg->dev; 3106 struct device *dev = hsotg->dev;
@@ -3158,7 +3159,7 @@ static void s3c_hsotg_dump(struct s3c_hsotg *hsotg)
3158 */ 3159 */
3159static int state_show(struct seq_file *seq, void *v) 3160static int state_show(struct seq_file *seq, void *v)
3160{ 3161{
3161 struct s3c_hsotg *hsotg = seq->private; 3162 struct dwc2_hsotg *hsotg = seq->private;
3162 void __iomem *regs = hsotg->regs; 3163 void __iomem *regs = hsotg->regs;
3163 int idx; 3164 int idx;
3164 3165
@@ -3228,7 +3229,7 @@ static const struct file_operations state_fops = {
3228 */ 3229 */
3229static int fifo_show(struct seq_file *seq, void *v) 3230static int fifo_show(struct seq_file *seq, void *v)
3230{ 3231{
3231 struct s3c_hsotg *hsotg = seq->private; 3232 struct dwc2_hsotg *hsotg = seq->private;
3232 void __iomem *regs = hsotg->regs; 3233 void __iomem *regs = hsotg->regs;
3233 u32 val; 3234 u32 val;
3234 int idx; 3235 int idx;
@@ -3284,7 +3285,7 @@ static const char *decode_direction(int is_in)
3284static int ep_show(struct seq_file *seq, void *v) 3285static int ep_show(struct seq_file *seq, void *v)
3285{ 3286{
3286 struct s3c_hsotg_ep *ep = seq->private; 3287 struct s3c_hsotg_ep *ep = seq->private;
3287 struct s3c_hsotg *hsotg = ep->parent; 3288 struct dwc2_hsotg *hsotg = ep->parent;
3288 struct s3c_hsotg_req *req; 3289 struct s3c_hsotg_req *req;
3289 void __iomem *regs = hsotg->regs; 3290 void __iomem *regs = hsotg->regs;
3290 int index = ep->index; 3291 int index = ep->index;
@@ -3361,7 +3362,7 @@ static const struct file_operations ep_fops = {
3361 * with the same name as the device itself, in case we end up 3362 * with the same name as the device itself, in case we end up
3362 * with multiple blocks in future systems. 3363 * with multiple blocks in future systems.
3363 */ 3364 */
3364static void s3c_hsotg_create_debug(struct s3c_hsotg *hsotg) 3365static void s3c_hsotg_create_debug(struct dwc2_hsotg *hsotg)
3365{ 3366{
3366 struct dentry *root; 3367 struct dentry *root;
3367 unsigned epidx; 3368 unsigned epidx;
@@ -3407,7 +3408,7 @@ static void s3c_hsotg_create_debug(struct s3c_hsotg *hsotg)
3407 * 3408 *
3408 * Cleanup (remove) the debugfs files for use on module exit. 3409 * Cleanup (remove) the debugfs files for use on module exit.
3409 */ 3410 */
3410static void s3c_hsotg_delete_debug(struct s3c_hsotg *hsotg) 3411static void s3c_hsotg_delete_debug(struct dwc2_hsotg *hsotg)
3411{ 3412{
3412 unsigned epidx; 3413 unsigned epidx;
3413 3414
@@ -3425,7 +3426,6 @@ static void s3c_hsotg_delete_debug(struct s3c_hsotg *hsotg)
3425 * s3c_hsotg_probe - probe function for hsotg driver 3426 * s3c_hsotg_probe - probe function for hsotg driver
3426 * @pdev: The platform information for the driver 3427 * @pdev: The platform information for the driver
3427 */ 3428 */
3428
3429static int s3c_hsotg_probe(struct platform_device *pdev) 3429static int s3c_hsotg_probe(struct platform_device *pdev)
3430{ 3430{
3431 struct s3c_hsotg_plat *plat = dev_get_platdata(&pdev->dev); 3431 struct s3c_hsotg_plat *plat = dev_get_platdata(&pdev->dev);
@@ -3433,13 +3433,13 @@ static int s3c_hsotg_probe(struct platform_device *pdev)
3433 struct usb_phy *uphy; 3433 struct usb_phy *uphy;
3434 struct device *dev = &pdev->dev; 3434 struct device *dev = &pdev->dev;
3435 struct s3c_hsotg_ep *eps; 3435 struct s3c_hsotg_ep *eps;
3436 struct s3c_hsotg *hsotg; 3436 struct dwc2_hsotg *hsotg;
3437 struct resource *res; 3437 struct resource *res;
3438 int epnum; 3438 int epnum;
3439 int ret; 3439 int ret;
3440 int i; 3440 int i;
3441 3441
3442 hsotg = devm_kzalloc(&pdev->dev, sizeof(struct s3c_hsotg), GFP_KERNEL); 3442 hsotg = devm_kzalloc(&pdev->dev, sizeof(struct dwc2_hsotg), GFP_KERNEL);
3443 if (!hsotg) 3443 if (!hsotg)
3444 return -ENOMEM; 3444 return -ENOMEM;
3445 3445
@@ -3520,7 +3520,7 @@ static int s3c_hsotg_probe(struct platform_device *pdev)
3520 ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(hsotg->supplies), 3520 ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(hsotg->supplies),
3521 hsotg->supplies); 3521 hsotg->supplies);
3522 if (ret) { 3522 if (ret) {
3523 dev_err(dev, "failed to request supplies: %d\n", ret); 3523 dev_err(hsotg->dev, "failed to request supplies: %d\n", ret);
3524 goto err_clk; 3524 goto err_clk;
3525 } 3525 }
3526 3526
@@ -3528,7 +3528,7 @@ static int s3c_hsotg_probe(struct platform_device *pdev)
3528 hsotg->supplies); 3528 hsotg->supplies);
3529 3529
3530 if (ret) { 3530 if (ret) {
3531 dev_err(hsotg->dev, "failed to enable supplies: %d\n", ret); 3531 dev_err(dev, "failed to enable supplies: %d\n", ret);
3532 goto err_supplies; 3532 goto err_supplies;
3533 } 3533 }
3534 3534
@@ -3592,7 +3592,7 @@ static int s3c_hsotg_probe(struct platform_device *pdev)
3592 ret = regulator_bulk_disable(ARRAY_SIZE(hsotg->supplies), 3592 ret = regulator_bulk_disable(ARRAY_SIZE(hsotg->supplies),
3593 hsotg->supplies); 3593 hsotg->supplies);
3594 if (ret) { 3594 if (ret) {
3595 dev_err(hsotg->dev, "failed to disable supplies: %d\n", ret); 3595 dev_err(&pdev->dev, "failed to disable supplies: %d\n", ret);
3596 goto err_ep_mem; 3596 goto err_ep_mem;
3597 } 3597 }
3598 3598
@@ -3622,7 +3622,7 @@ err_clk:
3622 */ 3622 */
3623static int s3c_hsotg_remove(struct platform_device *pdev) 3623static int s3c_hsotg_remove(struct platform_device *pdev)
3624{ 3624{
3625 struct s3c_hsotg *hsotg = platform_get_drvdata(pdev); 3625 struct dwc2_hsotg *hsotg = platform_get_drvdata(pdev);
3626 3626
3627 usb_del_gadget_udc(&hsotg->gadget); 3627 usb_del_gadget_udc(&hsotg->gadget);
3628 s3c_hsotg_delete_debug(hsotg); 3628 s3c_hsotg_delete_debug(hsotg);
@@ -3633,7 +3633,7 @@ static int s3c_hsotg_remove(struct platform_device *pdev)
3633 3633
3634static int s3c_hsotg_suspend(struct platform_device *pdev, pm_message_t state) 3634static int s3c_hsotg_suspend(struct platform_device *pdev, pm_message_t state)
3635{ 3635{
3636 struct s3c_hsotg *hsotg = platform_get_drvdata(pdev); 3636 struct dwc2_hsotg *hsotg = platform_get_drvdata(pdev);
3637 unsigned long flags; 3637 unsigned long flags;
3638 int ret = 0; 3638 int ret = 0;
3639 3639
@@ -3664,7 +3664,7 @@ static int s3c_hsotg_suspend(struct platform_device *pdev, pm_message_t state)
3664 3664
3665static int s3c_hsotg_resume(struct platform_device *pdev) 3665static int s3c_hsotg_resume(struct platform_device *pdev)
3666{ 3666{
3667 struct s3c_hsotg *hsotg = platform_get_drvdata(pdev); 3667 struct dwc2_hsotg *hsotg = platform_get_drvdata(pdev);
3668 unsigned long flags; 3668 unsigned long flags;
3669 int ret = 0; 3669 int ret = 0;
3670 3670