aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/chipidea
diff options
context:
space:
mode:
authorAlexander Shishkin <alexander.shishkin@linux.intel.com>2013-06-24 07:46:36 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-06-24 19:16:55 -0400
commit8e22978c57087aac4d88693278db1cc3e94f1253 (patch)
tree37394ec786b6e51cdc2c71d4c37aabbf969fe011 /drivers/usb/chipidea
parent38dcdb3a7db757203b71faf0a49710685d897852 (diff)
usb: chipidea: drop "13xxx" infix
"ci13xxx" is bad for at least the following reasons: * people often mistype it * it doesn't add any informational value to the names it's used in * it needlessly attracts mail filters This patch replaces it with "ci_hdrc", "ci_udc" or "ci_hw", depending on the situation. Modules with ci13xxx prefix are also renamed accordingly and aliases are added for compatibility. Otherwise, no functional changes. Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/chipidea')
-rw-r--r--drivers/usb/chipidea/Makefile6
-rw-r--r--drivers/usb/chipidea/ci.h50
-rw-r--r--drivers/usb/chipidea/ci_hdrc_imx.c (renamed from drivers/usb/chipidea/ci13xxx_imx.c)46
-rw-r--r--drivers/usb/chipidea/ci_hdrc_imx.h (renamed from drivers/usb/chipidea/ci13xxx_imx.h)0
-rw-r--r--drivers/usb/chipidea/ci_hdrc_msm.c (renamed from drivers/usb/chipidea/ci13xxx_msm.c)49
-rw-r--r--drivers/usb/chipidea/ci_hdrc_pci.c (renamed from drivers/usb/chipidea/ci13xxx_pci.c)43
-rw-r--r--drivers/usb/chipidea/core.c36
-rw-r--r--drivers/usb/chipidea/debug.c34
-rw-r--r--drivers/usb/chipidea/debug.h8
-rw-r--r--drivers/usb/chipidea/host.c10
-rw-r--r--drivers/usb/chipidea/host.h4
-rw-r--r--drivers/usb/chipidea/udc.c217
-rw-r--r--drivers/usb/chipidea/udc.h16
-rw-r--r--drivers/usb/chipidea/usbmisc_imx.c2
14 files changed, 261 insertions, 260 deletions
diff --git a/drivers/usb/chipidea/Makefile b/drivers/usb/chipidea/Makefile
index 4ab83e98219b..3bbbcba03815 100644
--- a/drivers/usb/chipidea/Makefile
+++ b/drivers/usb/chipidea/Makefile
@@ -9,13 +9,13 @@ ci_hdrc-$(CONFIG_USB_CHIPIDEA_DEBUG) += debug.o
9 9
10# Glue/Bridge layers go here 10# Glue/Bridge layers go here
11 11
12obj-$(CONFIG_USB_CHIPIDEA) += ci13xxx_msm.o 12obj-$(CONFIG_USB_CHIPIDEA) += ci_hdrc_msm.o
13 13
14# PCI doesn't provide stubs, need to check 14# PCI doesn't provide stubs, need to check
15ifneq ($(CONFIG_PCI),) 15ifneq ($(CONFIG_PCI),)
16 obj-$(CONFIG_USB_CHIPIDEA) += ci13xxx_pci.o 16 obj-$(CONFIG_USB_CHIPIDEA) += ci_hdrc_pci.o
17endif 17endif
18 18
19ifneq ($(CONFIG_OF_DEVICE),) 19ifneq ($(CONFIG_OF_DEVICE),)
20 obj-$(CONFIG_USB_CHIPIDEA) += ci13xxx_imx.o usbmisc_imx.o 20 obj-$(CONFIG_USB_CHIPIDEA) += ci_hdrc_imx.o usbmisc_imx.o
21endif 21endif
diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h
index 9ef686086c24..33cb29f36e06 100644
--- a/drivers/usb/chipidea/ci.h
+++ b/drivers/usb/chipidea/ci.h
@@ -22,14 +22,14 @@
22 * DEFINE 22 * DEFINE
23 *****************************************************************************/ 23 *****************************************************************************/
24#define TD_PAGE_COUNT 5 24#define TD_PAGE_COUNT 5
25#define CI13XXX_PAGE_SIZE 4096ul /* page size for TD's */ 25#define CI_HDRC_PAGE_SIZE 4096ul /* page size for TD's */
26#define ENDPT_MAX 32 26#define ENDPT_MAX 32
27 27
28/****************************************************************************** 28/******************************************************************************
29 * STRUCTURES 29 * STRUCTURES
30 *****************************************************************************/ 30 *****************************************************************************/
31/** 31/**
32 * struct ci13xxx_ep - endpoint representation 32 * struct ci_hw_ep - endpoint representation
33 * @ep: endpoint structure for gadget drivers 33 * @ep: endpoint structure for gadget drivers
34 * @dir: endpoint direction (TX/RX) 34 * @dir: endpoint direction (TX/RX)
35 * @num: endpoint number 35 * @num: endpoint number
@@ -41,7 +41,7 @@
41 * @lock: pointer to controller's spinlock 41 * @lock: pointer to controller's spinlock
42 * @td_pool: pointer to controller's TD pool 42 * @td_pool: pointer to controller's TD pool
43 */ 43 */
44struct ci13xxx_ep { 44struct ci_hw_ep {
45 struct usb_ep ep; 45 struct usb_ep ep;
46 u8 dir; 46 u8 dir;
47 u8 num; 47 u8 num;
@@ -49,13 +49,13 @@ struct ci13xxx_ep {
49 char name[16]; 49 char name[16];
50 struct { 50 struct {
51 struct list_head queue; 51 struct list_head queue;
52 struct ci13xxx_qh *ptr; 52 struct ci_hw_qh *ptr;
53 dma_addr_t dma; 53 dma_addr_t dma;
54 } qh; 54 } qh;
55 int wedge; 55 int wedge;
56 56
57 /* global resources */ 57 /* global resources */
58 struct ci13xxx *ci; 58 struct ci_hdrc *ci;
59 spinlock_t *lock; 59 spinlock_t *lock;
60 struct dma_pool *td_pool; 60 struct dma_pool *td_pool;
61 struct td_node *pending_td; 61 struct td_node *pending_td;
@@ -75,9 +75,9 @@ enum ci_role {
75 * name: role name string (host/gadget) 75 * name: role name string (host/gadget)
76 */ 76 */
77struct ci_role_driver { 77struct ci_role_driver {
78 int (*start)(struct ci13xxx *); 78 int (*start)(struct ci_hdrc *);
79 void (*stop)(struct ci13xxx *); 79 void (*stop)(struct ci_hdrc *);
80 irqreturn_t (*irq)(struct ci13xxx *); 80 irqreturn_t (*irq)(struct ci_hdrc *);
81 const char *name; 81 const char *name;
82}; 82};
83 83
@@ -102,7 +102,7 @@ struct hw_bank {
102}; 102};
103 103
104/** 104/**
105 * struct ci13xxx - chipidea device representation 105 * struct ci_hdrc - chipidea device representation
106 * @dev: pointer to parent device 106 * @dev: pointer to parent device
107 * @lock: access synchronization 107 * @lock: access synchronization
108 * @hw_bank: hardware register mapping 108 * @hw_bank: hardware register mapping
@@ -117,7 +117,7 @@ struct hw_bank {
117 * @gadget: device side representation for peripheral controller 117 * @gadget: device side representation for peripheral controller
118 * @driver: gadget driver 118 * @driver: gadget driver
119 * @hw_ep_max: total number of endpoints supported by hardware 119 * @hw_ep_max: total number of endpoints supported by hardware
120 * @ci13xxx_ep: array of endpoints 120 * @ci_hw_ep: array of endpoints
121 * @ep0_dir: ep0 direction 121 * @ep0_dir: ep0 direction
122 * @ep0out: pointer to ep0 OUT endpoint 122 * @ep0out: pointer to ep0 OUT endpoint
123 * @ep0in: pointer to ep0 IN endpoint 123 * @ep0in: pointer to ep0 IN endpoint
@@ -133,7 +133,7 @@ struct hw_bank {
133 * @hcd: pointer to usb_hcd for ehci host driver 133 * @hcd: pointer to usb_hcd for ehci host driver
134 * @debugfs: root dentry for this controller in debugfs 134 * @debugfs: root dentry for this controller in debugfs
135 */ 135 */
136struct ci13xxx { 136struct ci_hdrc {
137 struct device *dev; 137 struct device *dev;
138 spinlock_t lock; 138 spinlock_t lock;
139 struct hw_bank hw_bank; 139 struct hw_bank hw_bank;
@@ -150,9 +150,9 @@ struct ci13xxx {
150 struct usb_gadget gadget; 150 struct usb_gadget gadget;
151 struct usb_gadget_driver *driver; 151 struct usb_gadget_driver *driver;
152 unsigned hw_ep_max; 152 unsigned hw_ep_max;
153 struct ci13xxx_ep ci13xxx_ep[ENDPT_MAX]; 153 struct ci_hw_ep ci_hw_ep[ENDPT_MAX];
154 u32 ep0_dir; 154 u32 ep0_dir;
155 struct ci13xxx_ep *ep0out, *ep0in; 155 struct ci_hw_ep *ep0out, *ep0in;
156 156
157 struct usb_request *status; 157 struct usb_request *status;
158 bool setaddr; 158 bool setaddr;
@@ -161,7 +161,7 @@ struct ci13xxx {
161 u8 suspended; 161 u8 suspended;
162 u8 test_mode; 162 u8 test_mode;
163 163
164 struct ci13xxx_platform_data *platdata; 164 struct ci_hdrc_platform_data *platdata;
165 int vbus_active; 165 int vbus_active;
166 /* FIXME: some day, we'll not use global phy */ 166 /* FIXME: some day, we'll not use global phy */
167 bool global_phy; 167 bool global_phy;
@@ -170,13 +170,13 @@ struct ci13xxx {
170 struct dentry *debugfs; 170 struct dentry *debugfs;
171}; 171};
172 172
173static inline struct ci_role_driver *ci_role(struct ci13xxx *ci) 173static inline struct ci_role_driver *ci_role(struct ci_hdrc *ci)
174{ 174{
175 BUG_ON(ci->role >= CI_ROLE_END || !ci->roles[ci->role]); 175 BUG_ON(ci->role >= CI_ROLE_END || !ci->roles[ci->role]);
176 return ci->roles[ci->role]; 176 return ci->roles[ci->role];
177} 177}
178 178
179static inline int ci_role_start(struct ci13xxx *ci, enum ci_role role) 179static inline int ci_role_start(struct ci_hdrc *ci, enum ci_role role)
180{ 180{
181 int ret; 181 int ret;
182 182
@@ -192,7 +192,7 @@ static inline int ci_role_start(struct ci13xxx *ci, enum ci_role role)
192 return ret; 192 return ret;
193} 193}
194 194
195static inline void ci_role_stop(struct ci13xxx *ci) 195static inline void ci_role_stop(struct ci_hdrc *ci)
196{ 196{
197 enum ci_role role = ci->role; 197 enum ci_role role = ci->role;
198 198
@@ -211,7 +211,7 @@ static inline void ci_role_stop(struct ci13xxx *ci)
211#define REG_BITS (32) 211#define REG_BITS (32)
212 212
213/* register indices */ 213/* register indices */
214enum ci13xxx_regs { 214enum ci_hw_regs {
215 CAP_CAPLENGTH, 215 CAP_CAPLENGTH,
216 CAP_HCCPARAMS, 216 CAP_HCCPARAMS,
217 CAP_DCCPARAMS, 217 CAP_DCCPARAMS,
@@ -243,7 +243,7 @@ enum ci13xxx_regs {
243 * 243 *
244 * This function returns register contents 244 * This function returns register contents
245 */ 245 */
246static inline u32 hw_read(struct ci13xxx *ci, enum ci13xxx_regs reg, u32 mask) 246static inline u32 hw_read(struct ci_hdrc *ci, enum ci_hw_regs reg, u32 mask)
247{ 247{
248 return ioread32(ci->hw_bank.regmap[reg]) & mask; 248 return ioread32(ci->hw_bank.regmap[reg]) & mask;
249} 249}
@@ -254,7 +254,7 @@ static inline u32 hw_read(struct ci13xxx *ci, enum ci13xxx_regs reg, u32 mask)
254 * @mask: bitfield mask 254 * @mask: bitfield mask
255 * @data: new value 255 * @data: new value
256 */ 256 */
257static inline void hw_write(struct ci13xxx *ci, enum ci13xxx_regs reg, 257static inline void hw_write(struct ci_hdrc *ci, enum ci_hw_regs reg,
258 u32 mask, u32 data) 258 u32 mask, u32 data)
259{ 259{
260 if (~mask) 260 if (~mask)
@@ -271,7 +271,7 @@ static inline void hw_write(struct ci13xxx *ci, enum ci13xxx_regs reg,
271 * 271 *
272 * This function returns register contents 272 * This function returns register contents
273 */ 273 */
274static inline u32 hw_test_and_clear(struct ci13xxx *ci, enum ci13xxx_regs reg, 274static inline u32 hw_test_and_clear(struct ci_hdrc *ci, enum ci_hw_regs reg,
275 u32 mask) 275 u32 mask)
276{ 276{
277 u32 val = ioread32(ci->hw_bank.regmap[reg]) & mask; 277 u32 val = ioread32(ci->hw_bank.regmap[reg]) & mask;
@@ -288,7 +288,7 @@ static inline u32 hw_test_and_clear(struct ci13xxx *ci, enum ci13xxx_regs reg,
288 * 288 *
289 * This function returns register contents 289 * This function returns register contents
290 */ 290 */
291static inline u32 hw_test_and_write(struct ci13xxx *ci, enum ci13xxx_regs reg, 291static inline u32 hw_test_and_write(struct ci_hdrc *ci, enum ci_hw_regs reg,
292 u32 mask, u32 data) 292 u32 mask, u32 data)
293{ 293{
294 u32 val = hw_read(ci, reg, ~0); 294 u32 val = hw_read(ci, reg, ~0);
@@ -297,10 +297,10 @@ static inline u32 hw_test_and_write(struct ci13xxx *ci, enum ci13xxx_regs reg,
297 return (val & mask) >> __ffs(mask); 297 return (val & mask) >> __ffs(mask);
298} 298}
299 299
300int hw_device_reset(struct ci13xxx *ci, u32 mode); 300int hw_device_reset(struct ci_hdrc *ci, u32 mode);
301 301
302int hw_port_test_set(struct ci13xxx *ci, u8 mode); 302int hw_port_test_set(struct ci_hdrc *ci, u8 mode);
303 303
304u8 hw_port_test_get(struct ci13xxx *ci); 304u8 hw_port_test_get(struct ci_hdrc *ci);
305 305
306#endif /* __DRIVERS_USB_CHIPIDEA_CI_H */ 306#endif /* __DRIVERS_USB_CHIPIDEA_CI_H */
diff --git a/drivers/usb/chipidea/ci13xxx_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c
index 7e6f0674bee3..37fdae5106ae 100644
--- a/drivers/usb/chipidea/ci13xxx_imx.c
+++ b/drivers/usb/chipidea/ci_hdrc_imx.c
@@ -22,12 +22,12 @@
22#include <linux/regulator/consumer.h> 22#include <linux/regulator/consumer.h>
23 23
24#include "ci.h" 24#include "ci.h"
25#include "ci13xxx_imx.h" 25#include "ci_hdrc_imx.h"
26 26
27#define pdev_to_phy(pdev) \ 27#define pdev_to_phy(pdev) \
28 ((struct usb_phy *)platform_get_drvdata(pdev)) 28 ((struct usb_phy *)platform_get_drvdata(pdev))
29 29
30struct ci13xxx_imx_data { 30struct ci_hdrc_imx_data {
31 struct usb_phy *phy; 31 struct usb_phy *phy;
32 struct platform_device *ci_pdev; 32 struct platform_device *ci_pdev;
33 struct clk *clk; 33 struct clk *clk;
@@ -86,15 +86,15 @@ EXPORT_SYMBOL_GPL(usbmisc_get_init_data);
86 86
87/* End of common functions shared by usbmisc drivers*/ 87/* End of common functions shared by usbmisc drivers*/
88 88
89static int ci13xxx_imx_probe(struct platform_device *pdev) 89static int ci_hdrc_imx_probe(struct platform_device *pdev)
90{ 90{
91 struct ci13xxx_imx_data *data; 91 struct ci_hdrc_imx_data *data;
92 struct ci13xxx_platform_data pdata = { 92 struct ci_hdrc_platform_data pdata = {
93 .name = "ci13xxx_imx", 93 .name = "ci_hdrc_imx",
94 .capoffset = DEF_CAPOFFSET, 94 .capoffset = DEF_CAPOFFSET,
95 .flags = CI13XXX_REQUIRE_TRANSCEIVER | 95 .flags = CI_HDRC_REQUIRE_TRANSCEIVER |
96 CI13XXX_PULLUP_ON_VBUS | 96 CI_HDRC_PULLUP_ON_VBUS |
97 CI13XXX_DISABLE_STREAMING, 97 CI_HDRC_DISABLE_STREAMING,
98 }; 98 };
99 struct resource *res; 99 struct resource *res;
100 int ret; 100 int ret;
@@ -106,7 +106,7 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)
106 106
107 data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); 107 data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
108 if (!data) { 108 if (!data) {
109 dev_err(&pdev->dev, "Failed to allocate CI13xxx-IMX data!\n"); 109 dev_err(&pdev->dev, "Failed to allocate ci_hdrc-imx data!\n");
110 return -ENOMEM; 110 return -ENOMEM;
111 } 111 }
112 112
@@ -172,7 +172,7 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)
172 } 172 }
173 } 173 }
174 174
175 data->ci_pdev = ci13xxx_add_device(&pdev->dev, 175 data->ci_pdev = ci_hdrc_add_device(&pdev->dev,
176 pdev->resource, pdev->num_resources, 176 pdev->resource, pdev->num_resources,
177 &pdata); 177 &pdata);
178 if (IS_ERR(data->ci_pdev)) { 178 if (IS_ERR(data->ci_pdev)) {
@@ -200,7 +200,7 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)
200 return 0; 200 return 0;
201 201
202disable_device: 202disable_device:
203 ci13xxx_remove_device(data->ci_pdev); 203 ci_hdrc_remove_device(data->ci_pdev);
204err: 204err:
205 if (data->reg_vbus) 205 if (data->reg_vbus)
206 regulator_disable(data->reg_vbus); 206 regulator_disable(data->reg_vbus);
@@ -209,12 +209,12 @@ err_clk:
209 return ret; 209 return ret;
210} 210}
211 211
212static int ci13xxx_imx_remove(struct platform_device *pdev) 212static int ci_hdrc_imx_remove(struct platform_device *pdev)
213{ 213{
214 struct ci13xxx_imx_data *data = platform_get_drvdata(pdev); 214 struct ci_hdrc_imx_data *data = platform_get_drvdata(pdev);
215 215
216 pm_runtime_disable(&pdev->dev); 216 pm_runtime_disable(&pdev->dev);
217 ci13xxx_remove_device(data->ci_pdev); 217 ci_hdrc_remove_device(data->ci_pdev);
218 218
219 if (data->reg_vbus) 219 if (data->reg_vbus)
220 regulator_disable(data->reg_vbus); 220 regulator_disable(data->reg_vbus);
@@ -229,26 +229,26 @@ static int ci13xxx_imx_remove(struct platform_device *pdev)
229 return 0; 229 return 0;
230} 230}
231 231
232static const struct of_device_id ci13xxx_imx_dt_ids[] = { 232static const struct of_device_id ci_hdrc_imx_dt_ids[] = {
233 { .compatible = "fsl,imx27-usb", }, 233 { .compatible = "fsl,imx27-usb", },
234 { /* sentinel */ } 234 { /* sentinel */ }
235}; 235};
236MODULE_DEVICE_TABLE(of, ci13xxx_imx_dt_ids); 236MODULE_DEVICE_TABLE(of, ci_hdrc_imx_dt_ids);
237 237
238static struct platform_driver ci13xxx_imx_driver = { 238static struct platform_driver ci_hdrc_imx_driver = {
239 .probe = ci13xxx_imx_probe, 239 .probe = ci_hdrc_imx_probe,
240 .remove = ci13xxx_imx_remove, 240 .remove = ci_hdrc_imx_remove,
241 .driver = { 241 .driver = {
242 .name = "imx_usb", 242 .name = "imx_usb",
243 .owner = THIS_MODULE, 243 .owner = THIS_MODULE,
244 .of_match_table = ci13xxx_imx_dt_ids, 244 .of_match_table = ci_hdrc_imx_dt_ids,
245 }, 245 },
246}; 246};
247 247
248module_platform_driver(ci13xxx_imx_driver); 248module_platform_driver(ci_hdrc_imx_driver);
249 249
250MODULE_ALIAS("platform:imx-usb"); 250MODULE_ALIAS("platform:imx-usb");
251MODULE_LICENSE("GPL v2"); 251MODULE_LICENSE("GPL v2");
252MODULE_DESCRIPTION("CI13xxx i.MX USB binding"); 252MODULE_DESCRIPTION("CI HDRC i.MX USB binding");
253MODULE_AUTHOR("Marek Vasut <marex@denx.de>"); 253MODULE_AUTHOR("Marek Vasut <marex@denx.de>");
254MODULE_AUTHOR("Richard Zhao <richard.zhao@freescale.com>"); 254MODULE_AUTHOR("Richard Zhao <richard.zhao@freescale.com>");
diff --git a/drivers/usb/chipidea/ci13xxx_imx.h b/drivers/usb/chipidea/ci_hdrc_imx.h
index 550bfa457620..550bfa457620 100644
--- a/drivers/usb/chipidea/ci13xxx_imx.h
+++ b/drivers/usb/chipidea/ci_hdrc_imx.h
diff --git a/drivers/usb/chipidea/ci13xxx_msm.c b/drivers/usb/chipidea/ci_hdrc_msm.c
index 7d16681fd3d2..fb657ef50a9c 100644
--- a/drivers/usb/chipidea/ci13xxx_msm.c
+++ b/drivers/usb/chipidea/ci_hdrc_msm.c
@@ -17,19 +17,19 @@
17 17
18#define MSM_USB_BASE (ci->hw_bank.abs) 18#define MSM_USB_BASE (ci->hw_bank.abs)
19 19
20static void ci13xxx_msm_notify_event(struct ci13xxx *ci, unsigned event) 20static void ci_hdrc_msm_notify_event(struct ci_hdrc *ci, unsigned event)
21{ 21{
22 struct device *dev = ci->gadget.dev.parent; 22 struct device *dev = ci->gadget.dev.parent;
23 int val; 23 int val;
24 24
25 switch (event) { 25 switch (event) {
26 case CI13XXX_CONTROLLER_RESET_EVENT: 26 case CI_HDRC_CONTROLLER_RESET_EVENT:
27 dev_dbg(dev, "CI13XXX_CONTROLLER_RESET_EVENT received\n"); 27 dev_dbg(dev, "CI_HDRC_CONTROLLER_RESET_EVENT received\n");
28 writel(0, USB_AHBBURST); 28 writel(0, USB_AHBBURST);
29 writel(0, USB_AHBMODE); 29 writel(0, USB_AHBMODE);
30 break; 30 break;
31 case CI13XXX_CONTROLLER_STOPPED_EVENT: 31 case CI_HDRC_CONTROLLER_STOPPED_EVENT:
32 dev_dbg(dev, "CI13XXX_CONTROLLER_STOPPED_EVENT received\n"); 32 dev_dbg(dev, "CI_HDRC_CONTROLLER_STOPPED_EVENT received\n");
33 /* 33 /*
34 * Put the transceiver in non-driving mode. Otherwise host 34 * Put the transceiver in non-driving mode. Otherwise host
35 * may not detect soft-disconnection. 35 * may not detect soft-disconnection.
@@ -40,32 +40,32 @@ static void ci13xxx_msm_notify_event(struct ci13xxx *ci, unsigned event)
40 usb_phy_io_write(ci->transceiver, val, ULPI_FUNC_CTRL); 40 usb_phy_io_write(ci->transceiver, val, ULPI_FUNC_CTRL);
41 break; 41 break;
42 default: 42 default:
43 dev_dbg(dev, "unknown ci13xxx event\n"); 43 dev_dbg(dev, "unknown ci_hdrc event\n");
44 break; 44 break;
45 } 45 }
46} 46}
47 47
48static struct ci13xxx_platform_data ci13xxx_msm_platdata = { 48static struct ci_hdrc_platform_data ci_hdrc_msm_platdata = {
49 .name = "ci13xxx_msm", 49 .name = "ci_hdrc_msm",
50 .flags = CI13XXX_REGS_SHARED | 50 .flags = CI_HDRC_REGS_SHARED |
51 CI13XXX_REQUIRE_TRANSCEIVER | 51 CI_HDRC_REQUIRE_TRANSCEIVER |
52 CI13XXX_PULLUP_ON_VBUS | 52 CI_HDRC_PULLUP_ON_VBUS |
53 CI13XXX_DISABLE_STREAMING, 53 CI_HDRC_DISABLE_STREAMING,
54 54
55 .notify_event = ci13xxx_msm_notify_event, 55 .notify_event = ci_hdrc_msm_notify_event,
56}; 56};
57 57
58static int ci13xxx_msm_probe(struct platform_device *pdev) 58static int ci_hdrc_msm_probe(struct platform_device *pdev)
59{ 59{
60 struct platform_device *plat_ci; 60 struct platform_device *plat_ci;
61 61
62 dev_dbg(&pdev->dev, "ci13xxx_msm_probe\n"); 62 dev_dbg(&pdev->dev, "ci_hdrc_msm_probe\n");
63 63
64 plat_ci = ci13xxx_add_device(&pdev->dev, 64 plat_ci = ci_hdrc_add_device(&pdev->dev,
65 pdev->resource, pdev->num_resources, 65 pdev->resource, pdev->num_resources,
66 &ci13xxx_msm_platdata); 66 &ci_hdrc_msm_platdata);
67 if (IS_ERR(plat_ci)) { 67 if (IS_ERR(plat_ci)) {
68 dev_err(&pdev->dev, "ci13xxx_add_device failed!\n"); 68 dev_err(&pdev->dev, "ci_hdrc_add_device failed!\n");
69 return PTR_ERR(plat_ci); 69 return PTR_ERR(plat_ci);
70 } 70 }
71 71
@@ -77,23 +77,24 @@ static int ci13xxx_msm_probe(struct platform_device *pdev)
77 return 0; 77 return 0;
78} 78}
79 79
80static int ci13xxx_msm_remove(struct platform_device *pdev) 80static int ci_hdrc_msm_remove(struct platform_device *pdev)
81{ 81{
82 struct platform_device *plat_ci = platform_get_drvdata(pdev); 82 struct platform_device *plat_ci = platform_get_drvdata(pdev);
83 83
84 pm_runtime_disable(&pdev->dev); 84 pm_runtime_disable(&pdev->dev);
85 ci13xxx_remove_device(plat_ci); 85 ci_hdrc_remove_device(plat_ci);
86 86
87 return 0; 87 return 0;
88} 88}
89 89
90static struct platform_driver ci13xxx_msm_driver = { 90static struct platform_driver ci_hdrc_msm_driver = {
91 .probe = ci13xxx_msm_probe, 91 .probe = ci_hdrc_msm_probe,
92 .remove = ci13xxx_msm_remove, 92 .remove = ci_hdrc_msm_remove,
93 .driver = { .name = "msm_hsusb", }, 93 .driver = { .name = "msm_hsusb", },
94}; 94};
95 95
96module_platform_driver(ci13xxx_msm_driver); 96module_platform_driver(ci_hdrc_msm_driver);
97 97
98MODULE_ALIAS("platform:msm_hsusb"); 98MODULE_ALIAS("platform:msm_hsusb");
99MODULE_ALIAS("platform:ci13xxx_msm");
99MODULE_LICENSE("GPL v2"); 100MODULE_LICENSE("GPL v2");
diff --git a/drivers/usb/chipidea/ci13xxx_pci.c b/drivers/usb/chipidea/ci_hdrc_pci.c
index 7cf549561b07..042320a6c6c7 100644
--- a/drivers/usb/chipidea/ci13xxx_pci.c
+++ b/drivers/usb/chipidea/ci_hdrc_pci.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * ci13xxx_pci.c - MIPS USB IP core family device controller 2 * ci_hdrc_pci.c - MIPS USB IP core family device controller
3 * 3 *
4 * Copyright (C) 2008 Chipidea - MIPS Technologies, Inc. All rights reserved. 4 * Copyright (C) 2008 Chipidea - MIPS Technologies, Inc. All rights reserved.
5 * 5 *
@@ -18,29 +18,29 @@
18#include <linux/usb/chipidea.h> 18#include <linux/usb/chipidea.h>
19 19
20/* driver name */ 20/* driver name */
21#define UDC_DRIVER_NAME "ci13xxx_pci" 21#define UDC_DRIVER_NAME "ci_hdrc_pci"
22 22
23/****************************************************************************** 23/******************************************************************************
24 * PCI block 24 * PCI block
25 *****************************************************************************/ 25 *****************************************************************************/
26static struct ci13xxx_platform_data pci_platdata = { 26static struct ci_hdrc_platform_data pci_platdata = {
27 .name = UDC_DRIVER_NAME, 27 .name = UDC_DRIVER_NAME,
28 .capoffset = DEF_CAPOFFSET, 28 .capoffset = DEF_CAPOFFSET,
29}; 29};
30 30
31static struct ci13xxx_platform_data langwell_pci_platdata = { 31static struct ci_hdrc_platform_data langwell_pci_platdata = {
32 .name = UDC_DRIVER_NAME, 32 .name = UDC_DRIVER_NAME,
33 .capoffset = 0, 33 .capoffset = 0,
34}; 34};
35 35
36static struct ci13xxx_platform_data penwell_pci_platdata = { 36static struct ci_hdrc_platform_data penwell_pci_platdata = {
37 .name = UDC_DRIVER_NAME, 37 .name = UDC_DRIVER_NAME,
38 .capoffset = 0, 38 .capoffset = 0,
39 .power_budget = 200, 39 .power_budget = 200,
40}; 40};
41 41
42/** 42/**
43 * ci13xxx_pci_probe: PCI probe 43 * ci_hdrc_pci_probe: PCI probe
44 * @pdev: USB device controller being probed 44 * @pdev: USB device controller being probed
45 * @id: PCI hotplug ID connecting controller to UDC framework 45 * @id: PCI hotplug ID connecting controller to UDC framework
46 * 46 *
@@ -48,10 +48,10 @@ static struct ci13xxx_platform_data penwell_pci_platdata = {
48 * Allocates basic PCI resources for this USB device controller, and then 48 * Allocates basic PCI resources for this USB device controller, and then
49 * invokes the udc_probe() method to start the UDC associated with it 49 * invokes the udc_probe() method to start the UDC associated with it
50 */ 50 */
51static int ci13xxx_pci_probe(struct pci_dev *pdev, 51static int ci_hdrc_pci_probe(struct pci_dev *pdev,
52 const struct pci_device_id *id) 52 const struct pci_device_id *id)
53{ 53{
54 struct ci13xxx_platform_data *platdata = (void *)id->driver_data; 54 struct ci_hdrc_platform_data *platdata = (void *)id->driver_data;
55 struct platform_device *plat_ci; 55 struct platform_device *plat_ci;
56 struct resource res[3]; 56 struct resource res[3];
57 int retval = 0, nres = 2; 57 int retval = 0, nres = 2;
@@ -80,9 +80,9 @@ static int ci13xxx_pci_probe(struct pci_dev *pdev,
80 res[1].start = pdev->irq; 80 res[1].start = pdev->irq;
81 res[1].flags = IORESOURCE_IRQ; 81 res[1].flags = IORESOURCE_IRQ;
82 82
83 plat_ci = ci13xxx_add_device(&pdev->dev, res, nres, platdata); 83 plat_ci = ci_hdrc_add_device(&pdev->dev, res, nres, platdata);
84 if (IS_ERR(plat_ci)) { 84 if (IS_ERR(plat_ci)) {
85 dev_err(&pdev->dev, "ci13xxx_add_device failed!\n"); 85 dev_err(&pdev->dev, "ci_hdrc_add_device failed!\n");
86 return PTR_ERR(plat_ci); 86 return PTR_ERR(plat_ci);
87 } 87 }
88 88
@@ -92,18 +92,18 @@ static int ci13xxx_pci_probe(struct pci_dev *pdev,
92} 92}
93 93
94/** 94/**
95 * ci13xxx_pci_remove: PCI remove 95 * ci_hdrc_pci_remove: PCI remove
96 * @pdev: USB Device Controller being removed 96 * @pdev: USB Device Controller being removed
97 * 97 *
98 * Reverses the effect of ci13xxx_pci_probe(), 98 * Reverses the effect of ci_hdrc_pci_probe(),
99 * first invoking the udc_remove() and then releases 99 * first invoking the udc_remove() and then releases
100 * all PCI resources allocated for this USB device controller 100 * all PCI resources allocated for this USB device controller
101 */ 101 */
102static void ci13xxx_pci_remove(struct pci_dev *pdev) 102static void ci_hdrc_pci_remove(struct pci_dev *pdev)
103{ 103{
104 struct platform_device *plat_ci = pci_get_drvdata(pdev); 104 struct platform_device *plat_ci = pci_get_drvdata(pdev);
105 105
106 ci13xxx_remove_device(plat_ci); 106 ci_hdrc_remove_device(plat_ci);
107} 107}
108 108
109/** 109/**
@@ -112,7 +112,7 @@ static void ci13xxx_pci_remove(struct pci_dev *pdev)
112 * 112 *
113 * Check "pci.h" for details 113 * Check "pci.h" for details
114 */ 114 */
115static DEFINE_PCI_DEVICE_TABLE(ci13xxx_pci_id_table) = { 115static DEFINE_PCI_DEVICE_TABLE(ci_hdrc_pci_id_table) = {
116 { 116 {
117 PCI_DEVICE(0x153F, 0x1004), 117 PCI_DEVICE(0x153F, 0x1004),
118 .driver_data = (kernel_ulong_t)&pci_platdata, 118 .driver_data = (kernel_ulong_t)&pci_platdata,
@@ -131,18 +131,19 @@ static DEFINE_PCI_DEVICE_TABLE(ci13xxx_pci_id_table) = {
131 }, 131 },
132 { 0, 0, 0, 0, 0, 0, 0 /* end: all zeroes */ } 132 { 0, 0, 0, 0, 0, 0, 0 /* end: all zeroes */ }
133}; 133};
134MODULE_DEVICE_TABLE(pci, ci13xxx_pci_id_table); 134MODULE_DEVICE_TABLE(pci, ci_hdrc_pci_id_table);
135 135
136static struct pci_driver ci13xxx_pci_driver = { 136static struct pci_driver ci_hdrc_pci_driver = {
137 .name = UDC_DRIVER_NAME, 137 .name = UDC_DRIVER_NAME,
138 .id_table = ci13xxx_pci_id_table, 138 .id_table = ci_hdrc_pci_id_table,
139 .probe = ci13xxx_pci_probe, 139 .probe = ci_hdrc_pci_probe,
140 .remove = ci13xxx_pci_remove, 140 .remove = ci_hdrc_pci_remove,
141}; 141};
142 142
143module_pci_driver(ci13xxx_pci_driver); 143module_pci_driver(ci_hdrc_pci_driver);
144 144
145MODULE_AUTHOR("MIPS - David Lopo <dlopo@chipidea.mips.com>"); 145MODULE_AUTHOR("MIPS - David Lopo <dlopo@chipidea.mips.com>");
146MODULE_DESCRIPTION("MIPS CI13XXX USB Peripheral Controller"); 146MODULE_DESCRIPTION("MIPS CI13XXX USB Peripheral Controller");
147MODULE_LICENSE("GPL"); 147MODULE_LICENSE("GPL");
148MODULE_VERSION("June 2008"); 148MODULE_VERSION("June 2008");
149MODULE_ALIAS("platform:ci13xxx_pci");
diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index 66c6c7157bb9..a5df24c578fc 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -117,7 +117,7 @@ static uintptr_t ci_regs_lpm[] = {
117 [OP_ENDPTCTRL] = 0x0ECUL, 117 [OP_ENDPTCTRL] = 0x0ECUL,
118}; 118};
119 119
120static int hw_alloc_regmap(struct ci13xxx *ci, bool is_lpm) 120static int hw_alloc_regmap(struct ci_hdrc *ci, bool is_lpm)
121{ 121{
122 int i; 122 int i;
123 123
@@ -149,7 +149,7 @@ static int hw_alloc_regmap(struct ci13xxx *ci, bool is_lpm)
149 * 149 *
150 * This function returns an error code 150 * This function returns an error code
151 */ 151 */
152int hw_port_test_set(struct ci13xxx *ci, u8 mode) 152int hw_port_test_set(struct ci_hdrc *ci, u8 mode)
153{ 153{
154 const u8 TEST_MODE_MAX = 7; 154 const u8 TEST_MODE_MAX = 7;
155 155
@@ -165,12 +165,12 @@ int hw_port_test_set(struct ci13xxx *ci, u8 mode)
165 * 165 *
166 * This function returns port test mode value 166 * This function returns port test mode value
167 */ 167 */
168u8 hw_port_test_get(struct ci13xxx *ci) 168u8 hw_port_test_get(struct ci_hdrc *ci)
169{ 169{
170 return hw_read(ci, OP_PORTSC, PORTSC_PTC) >> __ffs(PORTSC_PTC); 170 return hw_read(ci, OP_PORTSC, PORTSC_PTC) >> __ffs(PORTSC_PTC);
171} 171}
172 172
173static int hw_device_init(struct ci13xxx *ci, void __iomem *base) 173static int hw_device_init(struct ci_hdrc *ci, void __iomem *base)
174{ 174{
175 u32 reg; 175 u32 reg;
176 176
@@ -209,7 +209,7 @@ static int hw_device_init(struct ci13xxx *ci, void __iomem *base)
209 return 0; 209 return 0;
210} 210}
211 211
212static void hw_phymode_configure(struct ci13xxx *ci) 212static void hw_phymode_configure(struct ci_hdrc *ci)
213{ 213{
214 u32 portsc, lpm, sts; 214 u32 portsc, lpm, sts;
215 215
@@ -254,7 +254,7 @@ static void hw_phymode_configure(struct ci13xxx *ci)
254 * 254 *
255 * This function returns an error code 255 * This function returns an error code
256 */ 256 */
257int hw_device_reset(struct ci13xxx *ci, u32 mode) 257int hw_device_reset(struct ci_hdrc *ci, u32 mode)
258{ 258{
259 /* should flush & stop before reset */ 259 /* should flush & stop before reset */
260 hw_write(ci, OP_ENDPTFLUSH, ~0, ~0); 260 hw_write(ci, OP_ENDPTFLUSH, ~0, ~0);
@@ -268,9 +268,9 @@ int hw_device_reset(struct ci13xxx *ci, u32 mode)
268 268
269 if (ci->platdata->notify_event) 269 if (ci->platdata->notify_event)
270 ci->platdata->notify_event(ci, 270 ci->platdata->notify_event(ci,
271 CI13XXX_CONTROLLER_RESET_EVENT); 271 CI_HDRC_CONTROLLER_RESET_EVENT);
272 272
273 if (ci->platdata->flags & CI13XXX_DISABLE_STREAMING) 273 if (ci->platdata->flags & CI_HDRC_DISABLE_STREAMING)
274 hw_write(ci, OP_USBMODE, USBMODE_CI_SDIS, USBMODE_CI_SDIS); 274 hw_write(ci, OP_USBMODE, USBMODE_CI_SDIS, USBMODE_CI_SDIS);
275 275
276 /* USBMODE should be configured step by step */ 276 /* USBMODE should be configured step by step */
@@ -292,7 +292,7 @@ int hw_device_reset(struct ci13xxx *ci, u32 mode)
292 * ci_otg_role - pick role based on ID pin state 292 * ci_otg_role - pick role based on ID pin state
293 * @ci: the controller 293 * @ci: the controller
294 */ 294 */
295static enum ci_role ci_otg_role(struct ci13xxx *ci) 295static enum ci_role ci_otg_role(struct ci_hdrc *ci)
296{ 296{
297 u32 sts = hw_read(ci, OP_OTGSC, ~0); 297 u32 sts = hw_read(ci, OP_OTGSC, ~0);
298 enum ci_role role = sts & OTGSC_ID 298 enum ci_role role = sts & OTGSC_ID
@@ -308,7 +308,7 @@ static enum ci_role ci_otg_role(struct ci13xxx *ci)
308 */ 308 */
309static void ci_role_work(struct work_struct *work) 309static void ci_role_work(struct work_struct *work)
310{ 310{
311 struct ci13xxx *ci = container_of(work, struct ci13xxx, work); 311 struct ci_hdrc *ci = container_of(work, struct ci_hdrc, work);
312 enum ci_role role = ci_otg_role(ci); 312 enum ci_role role = ci_otg_role(ci);
313 313
314 if (role != ci->role) { 314 if (role != ci->role) {
@@ -324,7 +324,7 @@ static void ci_role_work(struct work_struct *work)
324 324
325static irqreturn_t ci_irq(int irq, void *data) 325static irqreturn_t ci_irq(int irq, void *data)
326{ 326{
327 struct ci13xxx *ci = data; 327 struct ci_hdrc *ci = data;
328 irqreturn_t ret = IRQ_NONE; 328 irqreturn_t ret = IRQ_NONE;
329 u32 otgsc = 0; 329 u32 otgsc = 0;
330 330
@@ -346,9 +346,9 @@ static irqreturn_t ci_irq(int irq, void *data)
346 346
347static DEFINE_IDA(ci_ida); 347static DEFINE_IDA(ci_ida);
348 348
349struct platform_device *ci13xxx_add_device(struct device *dev, 349struct platform_device *ci_hdrc_add_device(struct device *dev,
350 struct resource *res, int nres, 350 struct resource *res, int nres,
351 struct ci13xxx_platform_data *platdata) 351 struct ci_hdrc_platform_data *platdata)
352{ 352{
353 struct platform_device *pdev; 353 struct platform_device *pdev;
354 int id, ret; 354 int id, ret;
@@ -388,20 +388,20 @@ put_id:
388 ida_simple_remove(&ci_ida, id); 388 ida_simple_remove(&ci_ida, id);
389 return ERR_PTR(ret); 389 return ERR_PTR(ret);
390} 390}
391EXPORT_SYMBOL_GPL(ci13xxx_add_device); 391EXPORT_SYMBOL_GPL(ci_hdrc_add_device);
392 392
393void ci13xxx_remove_device(struct platform_device *pdev) 393void ci_hdrc_remove_device(struct platform_device *pdev)
394{ 394{
395 int id = pdev->id; 395 int id = pdev->id;
396 platform_device_unregister(pdev); 396 platform_device_unregister(pdev);
397 ida_simple_remove(&ci_ida, id); 397 ida_simple_remove(&ci_ida, id);
398} 398}
399EXPORT_SYMBOL_GPL(ci13xxx_remove_device); 399EXPORT_SYMBOL_GPL(ci_hdrc_remove_device);
400 400
401static int ci_hdrc_probe(struct platform_device *pdev) 401static int ci_hdrc_probe(struct platform_device *pdev)
402{ 402{
403 struct device *dev = &pdev->dev; 403 struct device *dev = &pdev->dev;
404 struct ci13xxx *ci; 404 struct ci_hdrc *ci;
405 struct resource *res; 405 struct resource *res;
406 void __iomem *base; 406 void __iomem *base;
407 int ret; 407 int ret;
@@ -526,7 +526,7 @@ rm_wq:
526 526
527static int ci_hdrc_remove(struct platform_device *pdev) 527static int ci_hdrc_remove(struct platform_device *pdev)
528{ 528{
529 struct ci13xxx *ci = platform_get_drvdata(pdev); 529 struct ci_hdrc *ci = platform_get_drvdata(pdev);
530 530
531 dbg_remove_files(ci); 531 dbg_remove_files(ci);
532 flush_workqueue(ci->wq); 532 flush_workqueue(ci->wq);
diff --git a/drivers/usb/chipidea/debug.c b/drivers/usb/chipidea/debug.c
index 33566219f3bd..96d899aee473 100644
--- a/drivers/usb/chipidea/debug.c
+++ b/drivers/usb/chipidea/debug.c
@@ -18,7 +18,7 @@
18 */ 18 */
19static int ci_device_show(struct seq_file *s, void *data) 19static int ci_device_show(struct seq_file *s, void *data)
20{ 20{
21 struct ci13xxx *ci = s->private; 21 struct ci_hdrc *ci = s->private;
22 struct usb_gadget *gadget = &ci->gadget; 22 struct usb_gadget *gadget = &ci->gadget;
23 23
24 seq_printf(s, "speed = %d\n", gadget->speed); 24 seq_printf(s, "speed = %d\n", gadget->speed);
@@ -58,7 +58,7 @@ static const struct file_operations ci_device_fops = {
58 */ 58 */
59static int ci_port_test_show(struct seq_file *s, void *data) 59static int ci_port_test_show(struct seq_file *s, void *data)
60{ 60{
61 struct ci13xxx *ci = s->private; 61 struct ci_hdrc *ci = s->private;
62 unsigned long flags; 62 unsigned long flags;
63 unsigned mode; 63 unsigned mode;
64 64
@@ -78,7 +78,7 @@ static ssize_t ci_port_test_write(struct file *file, const char __user *ubuf,
78 size_t count, loff_t *ppos) 78 size_t count, loff_t *ppos)
79{ 79{
80 struct seq_file *s = file->private_data; 80 struct seq_file *s = file->private_data;
81 struct ci13xxx *ci = s->private; 81 struct ci_hdrc *ci = s->private;
82 unsigned long flags; 82 unsigned long flags;
83 unsigned mode; 83 unsigned mode;
84 char buf[32]; 84 char buf[32];
@@ -115,7 +115,7 @@ static const struct file_operations ci_port_test_fops = {
115 */ 115 */
116static int ci_qheads_show(struct seq_file *s, void *data) 116static int ci_qheads_show(struct seq_file *s, void *data)
117{ 117{
118 struct ci13xxx *ci = s->private; 118 struct ci_hdrc *ci = s->private;
119 unsigned long flags; 119 unsigned long flags;
120 unsigned i, j; 120 unsigned i, j;
121 121
@@ -126,12 +126,12 @@ static int ci_qheads_show(struct seq_file *s, void *data)
126 126
127 spin_lock_irqsave(&ci->lock, flags); 127 spin_lock_irqsave(&ci->lock, flags);
128 for (i = 0; i < ci->hw_ep_max/2; i++) { 128 for (i = 0; i < ci->hw_ep_max/2; i++) {
129 struct ci13xxx_ep *hweprx = &ci->ci13xxx_ep[i]; 129 struct ci_hw_ep *hweprx = &ci->ci_hw_ep[i];
130 struct ci13xxx_ep *hweptx = 130 struct ci_hw_ep *hweptx =
131 &ci->ci13xxx_ep[i + ci->hw_ep_max/2]; 131 &ci->ci_hw_ep[i + ci->hw_ep_max/2];
132 seq_printf(s, "EP=%02i: RX=%08X TX=%08X\n", 132 seq_printf(s, "EP=%02i: RX=%08X TX=%08X\n",
133 i, (u32)hweprx->qh.dma, (u32)hweptx->qh.dma); 133 i, (u32)hweprx->qh.dma, (u32)hweptx->qh.dma);
134 for (j = 0; j < (sizeof(struct ci13xxx_qh)/sizeof(u32)); j++) 134 for (j = 0; j < (sizeof(struct ci_hw_qh)/sizeof(u32)); j++)
135 seq_printf(s, " %04X: %08X %08X\n", j, 135 seq_printf(s, " %04X: %08X %08X\n", j,
136 *((u32 *)hweprx->qh.ptr + j), 136 *((u32 *)hweprx->qh.ptr + j),
137 *((u32 *)hweptx->qh.ptr + j)); 137 *((u32 *)hweptx->qh.ptr + j));
@@ -158,12 +158,12 @@ static const struct file_operations ci_qheads_fops = {
158 */ 158 */
159static int ci_requests_show(struct seq_file *s, void *data) 159static int ci_requests_show(struct seq_file *s, void *data)
160{ 160{
161 struct ci13xxx *ci = s->private; 161 struct ci_hdrc *ci = s->private;
162 unsigned long flags; 162 unsigned long flags;
163 struct list_head *ptr = NULL; 163 struct list_head *ptr = NULL;
164 struct ci13xxx_req *req = NULL; 164 struct ci_hw_req *req = NULL;
165 struct td_node *node, *tmpnode; 165 struct td_node *node, *tmpnode;
166 unsigned i, j, qsize = sizeof(struct ci13xxx_td)/sizeof(u32); 166 unsigned i, j, qsize = sizeof(struct ci_hw_td)/sizeof(u32);
167 167
168 if (ci->role != CI_ROLE_GADGET) { 168 if (ci->role != CI_ROLE_GADGET) {
169 seq_printf(s, "not in gadget mode\n"); 169 seq_printf(s, "not in gadget mode\n");
@@ -172,8 +172,8 @@ static int ci_requests_show(struct seq_file *s, void *data)
172 172
173 spin_lock_irqsave(&ci->lock, flags); 173 spin_lock_irqsave(&ci->lock, flags);
174 for (i = 0; i < ci->hw_ep_max; i++) 174 for (i = 0; i < ci->hw_ep_max; i++)
175 list_for_each(ptr, &ci->ci13xxx_ep[i].qh.queue) { 175 list_for_each(ptr, &ci->ci_hw_ep[i].qh.queue) {
176 req = list_entry(ptr, struct ci13xxx_req, queue); 176 req = list_entry(ptr, struct ci_hw_req, queue);
177 177
178 list_for_each_entry_safe(node, tmpnode, &req->tds, td) { 178 list_for_each_entry_safe(node, tmpnode, &req->tds, td) {
179 seq_printf(s, "EP=%02i: TD=%08X %s\n", 179 seq_printf(s, "EP=%02i: TD=%08X %s\n",
@@ -206,7 +206,7 @@ static const struct file_operations ci_requests_fops = {
206 206
207static int ci_role_show(struct seq_file *s, void *data) 207static int ci_role_show(struct seq_file *s, void *data)
208{ 208{
209 struct ci13xxx *ci = s->private; 209 struct ci_hdrc *ci = s->private;
210 210
211 seq_printf(s, "%s\n", ci_role(ci)->name); 211 seq_printf(s, "%s\n", ci_role(ci)->name);
212 212
@@ -217,7 +217,7 @@ static ssize_t ci_role_write(struct file *file, const char __user *ubuf,
217 size_t count, loff_t *ppos) 217 size_t count, loff_t *ppos)
218{ 218{
219 struct seq_file *s = file->private_data; 219 struct seq_file *s = file->private_data;
220 struct ci13xxx *ci = s->private; 220 struct ci_hdrc *ci = s->private;
221 enum ci_role role; 221 enum ci_role role;
222 char buf[8]; 222 char buf[8];
223 int ret; 223 int ret;
@@ -259,7 +259,7 @@ static const struct file_operations ci_role_fops = {
259 * 259 *
260 * This function returns an error code 260 * This function returns an error code
261 */ 261 */
262int dbg_create_files(struct ci13xxx *ci) 262int dbg_create_files(struct ci_hdrc *ci)
263{ 263{
264 struct dentry *dent; 264 struct dentry *dent;
265 265
@@ -300,7 +300,7 @@ err:
300 * dbg_remove_files: destroys the attribute interface 300 * dbg_remove_files: destroys the attribute interface
301 * @ci: device 301 * @ci: device
302 */ 302 */
303void dbg_remove_files(struct ci13xxx *ci) 303void dbg_remove_files(struct ci_hdrc *ci)
304{ 304{
305 debugfs_remove_recursive(ci->debugfs); 305 debugfs_remove_recursive(ci->debugfs);
306} 306}
diff --git a/drivers/usb/chipidea/debug.h b/drivers/usb/chipidea/debug.h
index 7ca6ca0a24a5..e16478c4a943 100644
--- a/drivers/usb/chipidea/debug.h
+++ b/drivers/usb/chipidea/debug.h
@@ -14,15 +14,15 @@
14#define __DRIVERS_USB_CHIPIDEA_DEBUG_H 14#define __DRIVERS_USB_CHIPIDEA_DEBUG_H
15 15
16#ifdef CONFIG_USB_CHIPIDEA_DEBUG 16#ifdef CONFIG_USB_CHIPIDEA_DEBUG
17int dbg_create_files(struct ci13xxx *ci); 17int dbg_create_files(struct ci_hdrc *ci);
18void dbg_remove_files(struct ci13xxx *ci); 18void dbg_remove_files(struct ci_hdrc *ci);
19#else 19#else
20static inline int dbg_create_files(struct ci13xxx *ci) 20static inline int dbg_create_files(struct ci_hdrc *ci)
21{ 21{
22 return 0; 22 return 0;
23} 23}
24 24
25static inline void dbg_remove_files(struct ci13xxx *ci) 25static inline void dbg_remove_files(struct ci_hdrc *ci)
26{ 26{
27} 27}
28#endif 28#endif
diff --git a/drivers/usb/chipidea/host.c b/drivers/usb/chipidea/host.c
index 8e9d31277c43..40d0fda4f66c 100644
--- a/drivers/usb/chipidea/host.c
+++ b/drivers/usb/chipidea/host.c
@@ -33,12 +33,12 @@
33 33
34static struct hc_driver __read_mostly ci_ehci_hc_driver; 34static struct hc_driver __read_mostly ci_ehci_hc_driver;
35 35
36static irqreturn_t host_irq(struct ci13xxx *ci) 36static irqreturn_t host_irq(struct ci_hdrc *ci)
37{ 37{
38 return usb_hcd_irq(ci->irq, ci->hcd); 38 return usb_hcd_irq(ci->irq, ci->hcd);
39} 39}
40 40
41static int host_start(struct ci13xxx *ci) 41static int host_start(struct ci_hdrc *ci)
42{ 42{
43 struct usb_hcd *hcd; 43 struct usb_hcd *hcd;
44 struct ehci_hcd *ehci; 44 struct ehci_hcd *ehci;
@@ -70,13 +70,13 @@ static int host_start(struct ci13xxx *ci)
70 else 70 else
71 ci->hcd = hcd; 71 ci->hcd = hcd;
72 72
73 if (ci->platdata->flags & CI13XXX_DISABLE_STREAMING) 73 if (ci->platdata->flags & CI_HDRC_DISABLE_STREAMING)
74 hw_write(ci, OP_USBMODE, USBMODE_CI_SDIS, USBMODE_CI_SDIS); 74 hw_write(ci, OP_USBMODE, USBMODE_CI_SDIS, USBMODE_CI_SDIS);
75 75
76 return ret; 76 return ret;
77} 77}
78 78
79static void host_stop(struct ci13xxx *ci) 79static void host_stop(struct ci_hdrc *ci)
80{ 80{
81 struct usb_hcd *hcd = ci->hcd; 81 struct usb_hcd *hcd = ci->hcd;
82 82
@@ -84,7 +84,7 @@ static void host_stop(struct ci13xxx *ci)
84 usb_put_hcd(hcd); 84 usb_put_hcd(hcd);
85} 85}
86 86
87int ci_hdrc_host_init(struct ci13xxx *ci) 87int ci_hdrc_host_init(struct ci_hdrc *ci)
88{ 88{
89 struct ci_role_driver *rdrv; 89 struct ci_role_driver *rdrv;
90 90
diff --git a/drivers/usb/chipidea/host.h b/drivers/usb/chipidea/host.h
index 761fb1fd6d99..058875c15333 100644
--- a/drivers/usb/chipidea/host.h
+++ b/drivers/usb/chipidea/host.h
@@ -3,11 +3,11 @@
3 3
4#ifdef CONFIG_USB_CHIPIDEA_HOST 4#ifdef CONFIG_USB_CHIPIDEA_HOST
5 5
6int ci_hdrc_host_init(struct ci13xxx *ci); 6int ci_hdrc_host_init(struct ci_hdrc *ci);
7 7
8#else 8#else
9 9
10static inline int ci_hdrc_host_init(struct ci13xxx *ci) 10static inline int ci_hdrc_host_init(struct ci_hdrc *ci)
11{ 11{
12 return -ENXIO; 12 return -ENXIO;
13} 13}
diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
index 0a9dcc9a82aa..e475fcda1d68 100644
--- a/drivers/usb/chipidea/udc.c
+++ b/drivers/usb/chipidea/udc.c
@@ -61,7 +61,7 @@ static inline int hw_ep_bit(int num, int dir)
61 return num + (dir ? 16 : 0); 61 return num + (dir ? 16 : 0);
62} 62}
63 63
64static inline int ep_to_bit(struct ci13xxx *ci, int n) 64static inline int ep_to_bit(struct ci_hdrc *ci, int n)
65{ 65{
66 int fill = 16 - ci->hw_ep_max / 2; 66 int fill = 16 - ci->hw_ep_max / 2;
67 67
@@ -77,7 +77,7 @@ static inline int ep_to_bit(struct ci13xxx *ci, int n)
77 * 77 *
78 * This function returns an error code 78 * This function returns an error code
79 */ 79 */
80static int hw_device_state(struct ci13xxx *ci, u32 dma) 80static int hw_device_state(struct ci_hdrc *ci, u32 dma)
81{ 81{
82 if (dma) { 82 if (dma) {
83 hw_write(ci, OP_ENDPTLISTADDR, ~0, dma); 83 hw_write(ci, OP_ENDPTLISTADDR, ~0, dma);
@@ -97,7 +97,7 @@ static int hw_device_state(struct ci13xxx *ci, u32 dma)
97 * 97 *
98 * This function returns an error code 98 * This function returns an error code
99 */ 99 */
100static int hw_ep_flush(struct ci13xxx *ci, int num, int dir) 100static int hw_ep_flush(struct ci_hdrc *ci, int num, int dir)
101{ 101{
102 int n = hw_ep_bit(num, dir); 102 int n = hw_ep_bit(num, dir);
103 103
@@ -118,7 +118,7 @@ static int hw_ep_flush(struct ci13xxx *ci, int num, int dir)
118 * 118 *
119 * This function returns an error code 119 * This function returns an error code
120 */ 120 */
121static int hw_ep_disable(struct ci13xxx *ci, int num, int dir) 121static int hw_ep_disable(struct ci_hdrc *ci, int num, int dir)
122{ 122{
123 hw_ep_flush(ci, num, dir); 123 hw_ep_flush(ci, num, dir);
124 hw_write(ci, OP_ENDPTCTRL + num, 124 hw_write(ci, OP_ENDPTCTRL + num,
@@ -134,7 +134,7 @@ static int hw_ep_disable(struct ci13xxx *ci, int num, int dir)
134 * 134 *
135 * This function returns an error code 135 * This function returns an error code
136 */ 136 */
137static int hw_ep_enable(struct ci13xxx *ci, int num, int dir, int type) 137static int hw_ep_enable(struct ci_hdrc *ci, int num, int dir, int type)
138{ 138{
139 u32 mask, data; 139 u32 mask, data;
140 140
@@ -168,7 +168,7 @@ static int hw_ep_enable(struct ci13xxx *ci, int num, int dir, int type)
168 * 168 *
169 * This function returns 1 if endpoint halted 169 * This function returns 1 if endpoint halted
170 */ 170 */
171static int hw_ep_get_halt(struct ci13xxx *ci, int num, int dir) 171static int hw_ep_get_halt(struct ci_hdrc *ci, int num, int dir)
172{ 172{
173 u32 mask = dir ? ENDPTCTRL_TXS : ENDPTCTRL_RXS; 173 u32 mask = dir ? ENDPTCTRL_TXS : ENDPTCTRL_RXS;
174 174
@@ -182,7 +182,7 @@ static int hw_ep_get_halt(struct ci13xxx *ci, int num, int dir)
182 * 182 *
183 * This function returns setup status 183 * This function returns setup status
184 */ 184 */
185static int hw_test_and_clear_setup_status(struct ci13xxx *ci, int n) 185static int hw_test_and_clear_setup_status(struct ci_hdrc *ci, int n)
186{ 186{
187 n = ep_to_bit(ci, n); 187 n = ep_to_bit(ci, n);
188 return hw_test_and_clear(ci, OP_ENDPTSETUPSTAT, BIT(n)); 188 return hw_test_and_clear(ci, OP_ENDPTSETUPSTAT, BIT(n));
@@ -196,7 +196,7 @@ static int hw_test_and_clear_setup_status(struct ci13xxx *ci, int n)
196 * 196 *
197 * This function returns an error code 197 * This function returns an error code
198 */ 198 */
199static int hw_ep_prime(struct ci13xxx *ci, int num, int dir, int is_ctrl) 199static int hw_ep_prime(struct ci_hdrc *ci, int num, int dir, int is_ctrl)
200{ 200{
201 int n = hw_ep_bit(num, dir); 201 int n = hw_ep_bit(num, dir);
202 202
@@ -223,13 +223,13 @@ static int hw_ep_prime(struct ci13xxx *ci, int num, int dir, int is_ctrl)
223 * 223 *
224 * This function returns an error code 224 * This function returns an error code
225 */ 225 */
226static int hw_ep_set_halt(struct ci13xxx *ci, int num, int dir, int value) 226static int hw_ep_set_halt(struct ci_hdrc *ci, int num, int dir, int value)
227{ 227{
228 if (value != 0 && value != 1) 228 if (value != 0 && value != 1)
229 return -EINVAL; 229 return -EINVAL;
230 230
231 do { 231 do {
232 enum ci13xxx_regs reg = OP_ENDPTCTRL + num; 232 enum ci_hw_regs reg = OP_ENDPTCTRL + num;
233 u32 mask_xs = dir ? ENDPTCTRL_TXS : ENDPTCTRL_RXS; 233 u32 mask_xs = dir ? ENDPTCTRL_TXS : ENDPTCTRL_RXS;
234 u32 mask_xr = dir ? ENDPTCTRL_TXR : ENDPTCTRL_RXR; 234 u32 mask_xr = dir ? ENDPTCTRL_TXR : ENDPTCTRL_RXR;
235 235
@@ -246,7 +246,7 @@ static int hw_ep_set_halt(struct ci13xxx *ci, int num, int dir, int value)
246 * 246 *
247 * This function returns true if high speed port 247 * This function returns true if high speed port
248 */ 248 */
249static int hw_port_is_high_speed(struct ci13xxx *ci) 249static int hw_port_is_high_speed(struct ci_hdrc *ci)
250{ 250{
251 return ci->hw_bank.lpm ? hw_read(ci, OP_DEVLC, DEVLC_PSPD) : 251 return ci->hw_bank.lpm ? hw_read(ci, OP_DEVLC, DEVLC_PSPD) :
252 hw_read(ci, OP_PORTSC, PORTSC_HSP); 252 hw_read(ci, OP_PORTSC, PORTSC_HSP);
@@ -257,7 +257,7 @@ static int hw_port_is_high_speed(struct ci13xxx *ci)
257 * 257 *
258 * This function returns register data 258 * This function returns register data
259 */ 259 */
260static u32 hw_read_intr_enable(struct ci13xxx *ci) 260static u32 hw_read_intr_enable(struct ci_hdrc *ci)
261{ 261{
262 return hw_read(ci, OP_USBINTR, ~0); 262 return hw_read(ci, OP_USBINTR, ~0);
263} 263}
@@ -267,7 +267,7 @@ static u32 hw_read_intr_enable(struct ci13xxx *ci)
267 * 267 *
268 * This function returns register data 268 * This function returns register data
269 */ 269 */
270static u32 hw_read_intr_status(struct ci13xxx *ci) 270static u32 hw_read_intr_status(struct ci_hdrc *ci)
271{ 271{
272 return hw_read(ci, OP_USBSTS, ~0); 272 return hw_read(ci, OP_USBSTS, ~0);
273} 273}
@@ -279,7 +279,7 @@ static u32 hw_read_intr_status(struct ci13xxx *ci)
279 * 279 *
280 * This function returns complete status 280 * This function returns complete status
281 */ 281 */
282static int hw_test_and_clear_complete(struct ci13xxx *ci, int n) 282static int hw_test_and_clear_complete(struct ci_hdrc *ci, int n)
283{ 283{
284 n = ep_to_bit(ci, n); 284 n = ep_to_bit(ci, n);
285 return hw_test_and_clear(ci, OP_ENDPTCOMPLETE, BIT(n)); 285 return hw_test_and_clear(ci, OP_ENDPTCOMPLETE, BIT(n));
@@ -291,7 +291,7 @@ static int hw_test_and_clear_complete(struct ci13xxx *ci, int n)
291 * 291 *
292 * This function returns active interrutps 292 * This function returns active interrutps
293 */ 293 */
294static u32 hw_test_and_clear_intr_active(struct ci13xxx *ci) 294static u32 hw_test_and_clear_intr_active(struct ci_hdrc *ci)
295{ 295{
296 u32 reg = hw_read_intr_status(ci) & hw_read_intr_enable(ci); 296 u32 reg = hw_read_intr_status(ci) & hw_read_intr_enable(ci);
297 297
@@ -305,7 +305,7 @@ static u32 hw_test_and_clear_intr_active(struct ci13xxx *ci)
305 * 305 *
306 * This function returns guard value 306 * This function returns guard value
307 */ 307 */
308static int hw_test_and_clear_setup_guard(struct ci13xxx *ci) 308static int hw_test_and_clear_setup_guard(struct ci_hdrc *ci)
309{ 309{
310 return hw_test_and_write(ci, OP_USBCMD, USBCMD_SUTW, 0); 310 return hw_test_and_write(ci, OP_USBCMD, USBCMD_SUTW, 0);
311} 311}
@@ -316,7 +316,7 @@ static int hw_test_and_clear_setup_guard(struct ci13xxx *ci)
316 * 316 *
317 * This function returns guard value 317 * This function returns guard value
318 */ 318 */
319static int hw_test_and_set_setup_guard(struct ci13xxx *ci) 319static int hw_test_and_set_setup_guard(struct ci_hdrc *ci)
320{ 320{
321 return hw_test_and_write(ci, OP_USBCMD, USBCMD_SUTW, USBCMD_SUTW); 321 return hw_test_and_write(ci, OP_USBCMD, USBCMD_SUTW, USBCMD_SUTW);
322} 322}
@@ -328,7 +328,7 @@ static int hw_test_and_set_setup_guard(struct ci13xxx *ci)
328 * This function explicitly sets the address, without the "USBADRA" (advance) 328 * This function explicitly sets the address, without the "USBADRA" (advance)
329 * feature, which is not supported by older versions of the controller. 329 * feature, which is not supported by older versions of the controller.
330 */ 330 */
331static void hw_usb_set_address(struct ci13xxx *ci, u8 value) 331static void hw_usb_set_address(struct ci_hdrc *ci, u8 value)
332{ 332{
333 hw_write(ci, OP_DEVICEADDR, DEVICEADDR_USBADR, 333 hw_write(ci, OP_DEVICEADDR, DEVICEADDR_USBADR,
334 value << __ffs(DEVICEADDR_USBADR)); 334 value << __ffs(DEVICEADDR_USBADR));
@@ -340,7 +340,7 @@ static void hw_usb_set_address(struct ci13xxx *ci, u8 value)
340 * 340 *
341 * This function returns an error code 341 * This function returns an error code
342 */ 342 */
343static int hw_usb_reset(struct ci13xxx *ci) 343static int hw_usb_reset(struct ci_hdrc *ci)
344{ 344{
345 hw_usb_set_address(ci, 0); 345 hw_usb_set_address(ci, 0);
346 346
@@ -369,7 +369,7 @@ static int hw_usb_reset(struct ci13xxx *ci)
369 * UTIL block 369 * UTIL block
370 *****************************************************************************/ 370 *****************************************************************************/
371 371
372static int add_td_to_list(struct ci13xxx_ep *hwep, struct ci13xxx_req *hwreq, 372static int add_td_to_list(struct ci_hw_ep *hwep, struct ci_hw_req *hwreq,
373 unsigned length) 373 unsigned length)
374{ 374{
375 int i; 375 int i;
@@ -387,7 +387,7 @@ static int add_td_to_list(struct ci13xxx_ep *hwep, struct ci13xxx_req *hwreq,
387 return -ENOMEM; 387 return -ENOMEM;
388 } 388 }
389 389
390 memset(node->ptr, 0, sizeof(struct ci13xxx_td)); 390 memset(node->ptr, 0, sizeof(struct ci_hw_td));
391 node->ptr->token = cpu_to_le32(length << __ffs(TD_TOTAL_BYTES)); 391 node->ptr->token = cpu_to_le32(length << __ffs(TD_TOTAL_BYTES));
392 node->ptr->token &= cpu_to_le32(TD_TOTAL_BYTES); 392 node->ptr->token &= cpu_to_le32(TD_TOTAL_BYTES);
393 node->ptr->token |= cpu_to_le32(TD_STATUS_ACTIVE); 393 node->ptr->token |= cpu_to_le32(TD_STATUS_ACTIVE);
@@ -396,7 +396,7 @@ static int add_td_to_list(struct ci13xxx_ep *hwep, struct ci13xxx_req *hwreq,
396 if (length) { 396 if (length) {
397 node->ptr->page[0] = cpu_to_le32(temp); 397 node->ptr->page[0] = cpu_to_le32(temp);
398 for (i = 1; i < TD_PAGE_COUNT; i++) { 398 for (i = 1; i < TD_PAGE_COUNT; i++) {
399 u32 page = temp + i * CI13XXX_PAGE_SIZE; 399 u32 page = temp + i * CI_HDRC_PAGE_SIZE;
400 page &= ~TD_RESERVED_MASK; 400 page &= ~TD_RESERVED_MASK;
401 node->ptr->page[i] = cpu_to_le32(page); 401 node->ptr->page[i] = cpu_to_le32(page);
402 } 402 }
@@ -421,7 +421,7 @@ static int add_td_to_list(struct ci13xxx_ep *hwep, struct ci13xxx_req *hwreq,
421 * _usb_addr: calculates endpoint address from direction & number 421 * _usb_addr: calculates endpoint address from direction & number
422 * @ep: endpoint 422 * @ep: endpoint
423 */ 423 */
424static inline u8 _usb_addr(struct ci13xxx_ep *ep) 424static inline u8 _usb_addr(struct ci_hw_ep *ep)
425{ 425{
426 return ((ep->dir == TX) ? USB_ENDPOINT_DIR_MASK : 0) | ep->num; 426 return ((ep->dir == TX) ? USB_ENDPOINT_DIR_MASK : 0) | ep->num;
427} 427}
@@ -433,9 +433,9 @@ static inline u8 _usb_addr(struct ci13xxx_ep *ep)
433 * 433 *
434 * This function returns an error code 434 * This function returns an error code
435 */ 435 */
436static int _hardware_enqueue(struct ci13xxx_ep *hwep, struct ci13xxx_req *hwreq) 436static int _hardware_enqueue(struct ci_hw_ep *hwep, struct ci_hw_req *hwreq)
437{ 437{
438 struct ci13xxx *ci = hwep->ci; 438 struct ci_hdrc *ci = hwep->ci;
439 int ret = 0; 439 int ret = 0;
440 unsigned rest = hwreq->req.length; 440 unsigned rest = hwreq->req.length;
441 int pages = TD_PAGE_COUNT; 441 int pages = TD_PAGE_COUNT;
@@ -463,7 +463,7 @@ static int _hardware_enqueue(struct ci13xxx_ep *hwep, struct ci13xxx_req *hwreq)
463 463
464 while (rest > 0) { 464 while (rest > 0) {
465 unsigned count = min(hwreq->req.length - hwreq->req.actual, 465 unsigned count = min(hwreq->req.length - hwreq->req.actual,
466 (unsigned)(pages * CI13XXX_PAGE_SIZE)); 466 (unsigned)(pages * CI_HDRC_PAGE_SIZE));
467 add_td_to_list(hwep, hwreq, count); 467 add_td_to_list(hwep, hwreq, count);
468 rest -= count; 468 rest -= count;
469 } 469 }
@@ -484,14 +484,14 @@ static int _hardware_enqueue(struct ci13xxx_ep *hwep, struct ci13xxx_req *hwreq)
484 484
485 hwreq->req.actual = 0; 485 hwreq->req.actual = 0;
486 if (!list_empty(&hwep->qh.queue)) { 486 if (!list_empty(&hwep->qh.queue)) {
487 struct ci13xxx_req *hwreqprev; 487 struct ci_hw_req *hwreqprev;
488 int n = hw_ep_bit(hwep->num, hwep->dir); 488 int n = hw_ep_bit(hwep->num, hwep->dir);
489 int tmp_stat; 489 int tmp_stat;
490 struct td_node *prevlastnode; 490 struct td_node *prevlastnode;
491 u32 next = firstnode->dma & TD_ADDR_MASK; 491 u32 next = firstnode->dma & TD_ADDR_MASK;
492 492
493 hwreqprev = list_entry(hwep->qh.queue.prev, 493 hwreqprev = list_entry(hwep->qh.queue.prev,
494 struct ci13xxx_req, queue); 494 struct ci_hw_req, queue);
495 prevlastnode = list_entry(hwreqprev->tds.prev, 495 prevlastnode = list_entry(hwreqprev->tds.prev,
496 struct td_node, td); 496 struct td_node, td);
497 497
@@ -533,7 +533,7 @@ done:
533 * free_pending_td: remove a pending request for the endpoint 533 * free_pending_td: remove a pending request for the endpoint
534 * @hwep: endpoint 534 * @hwep: endpoint
535 */ 535 */
536static void free_pending_td(struct ci13xxx_ep *hwep) 536static void free_pending_td(struct ci_hw_ep *hwep)
537{ 537{
538 struct td_node *pending = hwep->pending_td; 538 struct td_node *pending = hwep->pending_td;
539 539
@@ -549,7 +549,7 @@ static void free_pending_td(struct ci13xxx_ep *hwep)
549 * 549 *
550 * This function returns an error code 550 * This function returns an error code
551 */ 551 */
552static int _hardware_dequeue(struct ci13xxx_ep *hwep, struct ci13xxx_req *hwreq) 552static int _hardware_dequeue(struct ci_hw_ep *hwep, struct ci_hw_req *hwreq)
553{ 553{
554 u32 tmptoken; 554 u32 tmptoken;
555 struct td_node *node, *tmpnode; 555 struct td_node *node, *tmpnode;
@@ -619,7 +619,7 @@ static int _hardware_dequeue(struct ci13xxx_ep *hwep, struct ci13xxx_req *hwreq)
619 * This function returns an error code 619 * This function returns an error code
620 * Caller must hold lock 620 * Caller must hold lock
621 */ 621 */
622static int _ep_nuke(struct ci13xxx_ep *hwep) 622static int _ep_nuke(struct ci_hw_ep *hwep)
623__releases(hwep->lock) 623__releases(hwep->lock)
624__acquires(hwep->lock) 624__acquires(hwep->lock)
625{ 625{
@@ -632,9 +632,8 @@ __acquires(hwep->lock)
632 while (!list_empty(&hwep->qh.queue)) { 632 while (!list_empty(&hwep->qh.queue)) {
633 633
634 /* pop oldest request */ 634 /* pop oldest request */
635 struct ci13xxx_req *hwreq = list_entry(hwep->qh.queue.next, 635 struct ci_hw_req *hwreq = list_entry(hwep->qh.queue.next,
636 struct ci13xxx_req, 636 struct ci_hw_req, queue);
637 queue);
638 637
639 list_for_each_entry_safe(node, tmpnode, &hwreq->tds, td) { 638 list_for_each_entry_safe(node, tmpnode, &hwreq->tds, td) {
640 dma_pool_free(hwep->td_pool, node->ptr, node->dma); 639 dma_pool_free(hwep->td_pool, node->ptr, node->dma);
@@ -668,7 +667,7 @@ __acquires(hwep->lock)
668static int _gadget_stop_activity(struct usb_gadget *gadget) 667static int _gadget_stop_activity(struct usb_gadget *gadget)
669{ 668{
670 struct usb_ep *ep; 669 struct usb_ep *ep;
671 struct ci13xxx *ci = container_of(gadget, struct ci13xxx, gadget); 670 struct ci_hdrc *ci = container_of(gadget, struct ci_hdrc, gadget);
672 unsigned long flags; 671 unsigned long flags;
673 672
674 spin_lock_irqsave(&ci->lock, flags); 673 spin_lock_irqsave(&ci->lock, flags);
@@ -709,7 +708,7 @@ static int _gadget_stop_activity(struct usb_gadget *gadget)
709 * 708 *
710 * This function resets USB engine after a bus reset occurred 709 * This function resets USB engine after a bus reset occurred
711 */ 710 */
712static void isr_reset_handler(struct ci13xxx *ci) 711static void isr_reset_handler(struct ci_hdrc *ci)
713__releases(ci->lock) 712__releases(ci->lock)
714__acquires(ci->lock) 713__acquires(ci->lock)
715{ 714{
@@ -759,9 +758,9 @@ static void isr_get_status_complete(struct usb_ep *ep, struct usb_request *req)
759static int _ep_queue(struct usb_ep *ep, struct usb_request *req, 758static int _ep_queue(struct usb_ep *ep, struct usb_request *req,
760 gfp_t __maybe_unused gfp_flags) 759 gfp_t __maybe_unused gfp_flags)
761{ 760{
762 struct ci13xxx_ep *hwep = container_of(ep, struct ci13xxx_ep, ep); 761 struct ci_hw_ep *hwep = container_of(ep, struct ci_hw_ep, ep);
763 struct ci13xxx_req *hwreq = container_of(req, struct ci13xxx_req, req); 762 struct ci_hw_req *hwreq = container_of(req, struct ci_hw_req, req);
764 struct ci13xxx *ci = hwep->ci; 763 struct ci_hdrc *ci = hwep->ci;
765 int retval = 0; 764 int retval = 0;
766 765
767 if (ep == NULL || req == NULL || hwep->ep.desc == NULL) 766 if (ep == NULL || req == NULL || hwep->ep.desc == NULL)
@@ -812,12 +811,12 @@ static int _ep_queue(struct usb_ep *ep, struct usb_request *req,
812 * 811 *
813 * This function returns an error code 812 * This function returns an error code
814 */ 813 */
815static int isr_get_status_response(struct ci13xxx *ci, 814static int isr_get_status_response(struct ci_hdrc *ci,
816 struct usb_ctrlrequest *setup) 815 struct usb_ctrlrequest *setup)
817__releases(hwep->lock) 816__releases(hwep->lock)
818__acquires(hwep->lock) 817__acquires(hwep->lock)
819{ 818{
820 struct ci13xxx_ep *hwep = ci->ep0in; 819 struct ci_hw_ep *hwep = ci->ep0in;
821 struct usb_request *req = NULL; 820 struct usb_request *req = NULL;
822 gfp_t gfp_flags = GFP_ATOMIC; 821 gfp_t gfp_flags = GFP_ATOMIC;
823 int dir, num, retval; 822 int dir, num, retval;
@@ -878,7 +877,7 @@ __acquires(hwep->lock)
878static void 877static void
879isr_setup_status_complete(struct usb_ep *ep, struct usb_request *req) 878isr_setup_status_complete(struct usb_ep *ep, struct usb_request *req)
880{ 879{
881 struct ci13xxx *ci = req->context; 880 struct ci_hdrc *ci = req->context;
882 unsigned long flags; 881 unsigned long flags;
883 882
884 if (ci->setaddr) { 883 if (ci->setaddr) {
@@ -898,10 +897,10 @@ isr_setup_status_complete(struct usb_ep *ep, struct usb_request *req)
898 * 897 *
899 * This function returns an error code 898 * This function returns an error code
900 */ 899 */
901static int isr_setup_status_phase(struct ci13xxx *ci) 900static int isr_setup_status_phase(struct ci_hdrc *ci)
902{ 901{
903 int retval; 902 int retval;
904 struct ci13xxx_ep *hwep; 903 struct ci_hw_ep *hwep;
905 904
906 hwep = (ci->ep0_dir == TX) ? ci->ep0out : ci->ep0in; 905 hwep = (ci->ep0_dir == TX) ? ci->ep0out : ci->ep0in;
907 ci->status->context = ci; 906 ci->status->context = ci;
@@ -919,12 +918,12 @@ static int isr_setup_status_phase(struct ci13xxx *ci)
919 * This function returns an error code 918 * This function returns an error code
920 * Caller must hold lock 919 * Caller must hold lock
921 */ 920 */
922static int isr_tr_complete_low(struct ci13xxx_ep *hwep) 921static int isr_tr_complete_low(struct ci_hw_ep *hwep)
923__releases(hwep->lock) 922__releases(hwep->lock)
924__acquires(hwep->lock) 923__acquires(hwep->lock)
925{ 924{
926 struct ci13xxx_req *hwreq, *hwreqtemp; 925 struct ci_hw_req *hwreq, *hwreqtemp;
927 struct ci13xxx_ep *hweptemp = hwep; 926 struct ci_hw_ep *hweptemp = hwep;
928 int retval = 0; 927 int retval = 0;
929 928
930 list_for_each_entry_safe(hwreq, hwreqtemp, &hwep->qh.queue, 929 list_for_each_entry_safe(hwreq, hwreqtemp, &hwep->qh.queue,
@@ -955,7 +954,7 @@ __acquires(hwep->lock)
955 * 954 *
956 * This function handles traffic events 955 * This function handles traffic events
957 */ 956 */
958static void isr_tr_complete_handler(struct ci13xxx *ci) 957static void isr_tr_complete_handler(struct ci_hdrc *ci)
959__releases(ci->lock) 958__releases(ci->lock)
960__acquires(ci->lock) 959__acquires(ci->lock)
961{ 960{
@@ -963,7 +962,7 @@ __acquires(ci->lock)
963 u8 tmode = 0; 962 u8 tmode = 0;
964 963
965 for (i = 0; i < ci->hw_ep_max; i++) { 964 for (i = 0; i < ci->hw_ep_max; i++) {
966 struct ci13xxx_ep *hwep = &ci->ci13xxx_ep[i]; 965 struct ci_hw_ep *hwep = &ci->ci_hw_ep[i];
967 int type, num, dir, err = -EINVAL; 966 int type, num, dir, err = -EINVAL;
968 struct usb_ctrlrequest req; 967 struct usb_ctrlrequest req;
969 968
@@ -1023,10 +1022,10 @@ __acquires(ci->lock)
1023 num &= USB_ENDPOINT_NUMBER_MASK; 1022 num &= USB_ENDPOINT_NUMBER_MASK;
1024 if (dir) /* TX */ 1023 if (dir) /* TX */
1025 num += ci->hw_ep_max/2; 1024 num += ci->hw_ep_max/2;
1026 if (!ci->ci13xxx_ep[num].wedge) { 1025 if (!ci->ci_hw_ep[num].wedge) {
1027 spin_unlock(&ci->lock); 1026 spin_unlock(&ci->lock);
1028 err = usb_ep_clear_halt( 1027 err = usb_ep_clear_halt(
1029 &ci->ci13xxx_ep[num].ep); 1028 &ci->ci_hw_ep[num].ep);
1030 spin_lock(&ci->lock); 1029 spin_lock(&ci->lock);
1031 if (err) 1030 if (err)
1032 break; 1031 break;
@@ -1076,7 +1075,7 @@ __acquires(ci->lock)
1076 num += ci->hw_ep_max/2; 1075 num += ci->hw_ep_max/2;
1077 1076
1078 spin_unlock(&ci->lock); 1077 spin_unlock(&ci->lock);
1079 err = usb_ep_set_halt(&ci->ci13xxx_ep[num].ep); 1078 err = usb_ep_set_halt(&ci->ci_hw_ep[num].ep);
1080 spin_lock(&ci->lock); 1079 spin_lock(&ci->lock);
1081 if (!err) 1080 if (!err)
1082 isr_setup_status_phase(ci); 1081 isr_setup_status_phase(ci);
@@ -1141,7 +1140,7 @@ delegate:
1141static int ep_enable(struct usb_ep *ep, 1140static int ep_enable(struct usb_ep *ep,
1142 const struct usb_endpoint_descriptor *desc) 1141 const struct usb_endpoint_descriptor *desc)
1143{ 1142{
1144 struct ci13xxx_ep *hwep = container_of(ep, struct ci13xxx_ep, ep); 1143 struct ci_hw_ep *hwep = container_of(ep, struct ci_hw_ep, ep);
1145 int retval = 0; 1144 int retval = 0;
1146 unsigned long flags; 1145 unsigned long flags;
1147 u32 cap = 0; 1146 u32 cap = 0;
@@ -1194,7 +1193,7 @@ static int ep_enable(struct usb_ep *ep,
1194 */ 1193 */
1195static int ep_disable(struct usb_ep *ep) 1194static int ep_disable(struct usb_ep *ep)
1196{ 1195{
1197 struct ci13xxx_ep *hwep = container_of(ep, struct ci13xxx_ep, ep); 1196 struct ci_hw_ep *hwep = container_of(ep, struct ci_hw_ep, ep);
1198 int direction, retval = 0; 1197 int direction, retval = 0;
1199 unsigned long flags; 1198 unsigned long flags;
1200 1199
@@ -1230,12 +1229,12 @@ static int ep_disable(struct usb_ep *ep)
1230 */ 1229 */
1231static struct usb_request *ep_alloc_request(struct usb_ep *ep, gfp_t gfp_flags) 1230static struct usb_request *ep_alloc_request(struct usb_ep *ep, gfp_t gfp_flags)
1232{ 1231{
1233 struct ci13xxx_req *hwreq = NULL; 1232 struct ci_hw_req *hwreq = NULL;
1234 1233
1235 if (ep == NULL) 1234 if (ep == NULL)
1236 return NULL; 1235 return NULL;
1237 1236
1238 hwreq = kzalloc(sizeof(struct ci13xxx_req), gfp_flags); 1237 hwreq = kzalloc(sizeof(struct ci_hw_req), gfp_flags);
1239 if (hwreq != NULL) { 1238 if (hwreq != NULL) {
1240 INIT_LIST_HEAD(&hwreq->queue); 1239 INIT_LIST_HEAD(&hwreq->queue);
1241 INIT_LIST_HEAD(&hwreq->tds); 1240 INIT_LIST_HEAD(&hwreq->tds);
@@ -1251,8 +1250,8 @@ static struct usb_request *ep_alloc_request(struct usb_ep *ep, gfp_t gfp_flags)
1251 */ 1250 */
1252static void ep_free_request(struct usb_ep *ep, struct usb_request *req) 1251static void ep_free_request(struct usb_ep *ep, struct usb_request *req)
1253{ 1252{
1254 struct ci13xxx_ep *hwep = container_of(ep, struct ci13xxx_ep, ep); 1253 struct ci_hw_ep *hwep = container_of(ep, struct ci_hw_ep, ep);
1255 struct ci13xxx_req *hwreq = container_of(req, struct ci13xxx_req, req); 1254 struct ci_hw_req *hwreq = container_of(req, struct ci_hw_req, req);
1256 struct td_node *node, *tmpnode; 1255 struct td_node *node, *tmpnode;
1257 unsigned long flags; 1256 unsigned long flags;
1258 1257
@@ -1285,7 +1284,7 @@ static void ep_free_request(struct usb_ep *ep, struct usb_request *req)
1285static int ep_queue(struct usb_ep *ep, struct usb_request *req, 1284static int ep_queue(struct usb_ep *ep, struct usb_request *req,
1286 gfp_t __maybe_unused gfp_flags) 1285 gfp_t __maybe_unused gfp_flags)
1287{ 1286{
1288 struct ci13xxx_ep *hwep = container_of(ep, struct ci13xxx_ep, ep); 1287 struct ci_hw_ep *hwep = container_of(ep, struct ci_hw_ep, ep);
1289 int retval = 0; 1288 int retval = 0;
1290 unsigned long flags; 1289 unsigned long flags;
1291 1290
@@ -1305,8 +1304,8 @@ static int ep_queue(struct usb_ep *ep, struct usb_request *req,
1305 */ 1304 */
1306static int ep_dequeue(struct usb_ep *ep, struct usb_request *req) 1305static int ep_dequeue(struct usb_ep *ep, struct usb_request *req)
1307{ 1306{
1308 struct ci13xxx_ep *hwep = container_of(ep, struct ci13xxx_ep, ep); 1307 struct ci_hw_ep *hwep = container_of(ep, struct ci_hw_ep, ep);
1309 struct ci13xxx_req *hwreq = container_of(req, struct ci13xxx_req, req); 1308 struct ci_hw_req *hwreq = container_of(req, struct ci_hw_req, req);
1310 unsigned long flags; 1309 unsigned long flags;
1311 1310
1312 if (ep == NULL || req == NULL || hwreq->req.status != -EALREADY || 1311 if (ep == NULL || req == NULL || hwreq->req.status != -EALREADY ||
@@ -1342,7 +1341,7 @@ static int ep_dequeue(struct usb_ep *ep, struct usb_request *req)
1342 */ 1341 */
1343static int ep_set_halt(struct usb_ep *ep, int value) 1342static int ep_set_halt(struct usb_ep *ep, int value)
1344{ 1343{
1345 struct ci13xxx_ep *hwep = container_of(ep, struct ci13xxx_ep, ep); 1344 struct ci_hw_ep *hwep = container_of(ep, struct ci_hw_ep, ep);
1346 int direction, retval = 0; 1345 int direction, retval = 0;
1347 unsigned long flags; 1346 unsigned long flags;
1348 1347
@@ -1386,7 +1385,7 @@ static int ep_set_halt(struct usb_ep *ep, int value)
1386 */ 1385 */
1387static int ep_set_wedge(struct usb_ep *ep) 1386static int ep_set_wedge(struct usb_ep *ep)
1388{ 1387{
1389 struct ci13xxx_ep *hwep = container_of(ep, struct ci13xxx_ep, ep); 1388 struct ci_hw_ep *hwep = container_of(ep, struct ci_hw_ep, ep);
1390 unsigned long flags; 1389 unsigned long flags;
1391 1390
1392 if (ep == NULL || hwep->ep.desc == NULL) 1391 if (ep == NULL || hwep->ep.desc == NULL)
@@ -1406,7 +1405,7 @@ static int ep_set_wedge(struct usb_ep *ep)
1406 */ 1405 */
1407static void ep_fifo_flush(struct usb_ep *ep) 1406static void ep_fifo_flush(struct usb_ep *ep)
1408{ 1407{
1409 struct ci13xxx_ep *hwep = container_of(ep, struct ci13xxx_ep, ep); 1408 struct ci_hw_ep *hwep = container_of(ep, struct ci_hw_ep, ep);
1410 unsigned long flags; 1409 unsigned long flags;
1411 1410
1412 if (ep == NULL) { 1411 if (ep == NULL) {
@@ -1440,13 +1439,13 @@ static const struct usb_ep_ops usb_ep_ops = {
1440/****************************************************************************** 1439/******************************************************************************
1441 * GADGET block 1440 * GADGET block
1442 *****************************************************************************/ 1441 *****************************************************************************/
1443static int ci13xxx_vbus_session(struct usb_gadget *_gadget, int is_active) 1442static int ci_udc_vbus_session(struct usb_gadget *_gadget, int is_active)
1444{ 1443{
1445 struct ci13xxx *ci = container_of(_gadget, struct ci13xxx, gadget); 1444 struct ci_hdrc *ci = container_of(_gadget, struct ci_hdrc, gadget);
1446 unsigned long flags; 1445 unsigned long flags;
1447 int gadget_ready = 0; 1446 int gadget_ready = 0;
1448 1447
1449 if (!(ci->platdata->flags & CI13XXX_PULLUP_ON_VBUS)) 1448 if (!(ci->platdata->flags & CI_HDRC_PULLUP_ON_VBUS))
1450 return -EOPNOTSUPP; 1449 return -EOPNOTSUPP;
1451 1450
1452 spin_lock_irqsave(&ci->lock, flags); 1451 spin_lock_irqsave(&ci->lock, flags);
@@ -1464,7 +1463,7 @@ static int ci13xxx_vbus_session(struct usb_gadget *_gadget, int is_active)
1464 hw_device_state(ci, 0); 1463 hw_device_state(ci, 0);
1465 if (ci->platdata->notify_event) 1464 if (ci->platdata->notify_event)
1466 ci->platdata->notify_event(ci, 1465 ci->platdata->notify_event(ci,
1467 CI13XXX_CONTROLLER_STOPPED_EVENT); 1466 CI_HDRC_CONTROLLER_STOPPED_EVENT);
1468 _gadget_stop_activity(&ci->gadget); 1467 _gadget_stop_activity(&ci->gadget);
1469 pm_runtime_put_sync(&_gadget->dev); 1468 pm_runtime_put_sync(&_gadget->dev);
1470 } 1469 }
@@ -1473,9 +1472,9 @@ static int ci13xxx_vbus_session(struct usb_gadget *_gadget, int is_active)
1473 return 0; 1472 return 0;
1474} 1473}
1475 1474
1476static int ci13xxx_wakeup(struct usb_gadget *_gadget) 1475static int ci_udc_wakeup(struct usb_gadget *_gadget)
1477{ 1476{
1478 struct ci13xxx *ci = container_of(_gadget, struct ci13xxx, gadget); 1477 struct ci_hdrc *ci = container_of(_gadget, struct ci_hdrc, gadget);
1479 unsigned long flags; 1478 unsigned long flags;
1480 int ret = 0; 1479 int ret = 0;
1481 1480
@@ -1494,9 +1493,9 @@ out:
1494 return ret; 1493 return ret;
1495} 1494}
1496 1495
1497static int ci13xxx_vbus_draw(struct usb_gadget *_gadget, unsigned ma) 1496static int ci_udc_vbus_draw(struct usb_gadget *_gadget, unsigned ma)
1498{ 1497{
1499 struct ci13xxx *ci = container_of(_gadget, struct ci13xxx, gadget); 1498 struct ci_hdrc *ci = container_of(_gadget, struct ci_hdrc, gadget);
1500 1499
1501 if (ci->transceiver) 1500 if (ci->transceiver)
1502 return usb_phy_set_power(ci->transceiver, ma); 1501 return usb_phy_set_power(ci->transceiver, ma);
@@ -1506,9 +1505,9 @@ static int ci13xxx_vbus_draw(struct usb_gadget *_gadget, unsigned ma)
1506/* Change Data+ pullup status 1505/* Change Data+ pullup status
1507 * this func is used by usb_gadget_connect/disconnet 1506 * this func is used by usb_gadget_connect/disconnet
1508 */ 1507 */
1509static int ci13xxx_pullup(struct usb_gadget *_gadget, int is_on) 1508static int ci_udc_pullup(struct usb_gadget *_gadget, int is_on)
1510{ 1509{
1511 struct ci13xxx *ci = container_of(_gadget, struct ci13xxx, gadget); 1510 struct ci_hdrc *ci = container_of(_gadget, struct ci_hdrc, gadget);
1512 1511
1513 if (is_on) 1512 if (is_on)
1514 hw_write(ci, OP_USBCMD, USBCMD_RS, USBCMD_RS); 1513 hw_write(ci, OP_USBCMD, USBCMD_RS, USBCMD_RS);
@@ -1518,9 +1517,9 @@ static int ci13xxx_pullup(struct usb_gadget *_gadget, int is_on)
1518 return 0; 1517 return 0;
1519} 1518}
1520 1519
1521static int ci13xxx_start(struct usb_gadget *gadget, 1520static int ci_udc_start(struct usb_gadget *gadget,
1522 struct usb_gadget_driver *driver); 1521 struct usb_gadget_driver *driver);
1523static int ci13xxx_stop(struct usb_gadget *gadget, 1522static int ci_udc_stop(struct usb_gadget *gadget,
1524 struct usb_gadget_driver *driver); 1523 struct usb_gadget_driver *driver);
1525/** 1524/**
1526 * Device operations part of the API to the USB controller hardware, 1525 * Device operations part of the API to the USB controller hardware,
@@ -1528,22 +1527,22 @@ static int ci13xxx_stop(struct usb_gadget *gadget,
1528 * Check "usb_gadget.h" for details 1527 * Check "usb_gadget.h" for details
1529 */ 1528 */
1530static const struct usb_gadget_ops usb_gadget_ops = { 1529static const struct usb_gadget_ops usb_gadget_ops = {
1531 .vbus_session = ci13xxx_vbus_session, 1530 .vbus_session = ci_udc_vbus_session,
1532 .wakeup = ci13xxx_wakeup, 1531 .wakeup = ci_udc_wakeup,
1533 .pullup = ci13xxx_pullup, 1532 .pullup = ci_udc_pullup,
1534 .vbus_draw = ci13xxx_vbus_draw, 1533 .vbus_draw = ci_udc_vbus_draw,
1535 .udc_start = ci13xxx_start, 1534 .udc_start = ci_udc_start,
1536 .udc_stop = ci13xxx_stop, 1535 .udc_stop = ci_udc_stop,
1537}; 1536};
1538 1537
1539static int init_eps(struct ci13xxx *ci) 1538static int init_eps(struct ci_hdrc *ci)
1540{ 1539{
1541 int retval = 0, i, j; 1540 int retval = 0, i, j;
1542 1541
1543 for (i = 0; i < ci->hw_ep_max/2; i++) 1542 for (i = 0; i < ci->hw_ep_max/2; i++)
1544 for (j = RX; j <= TX; j++) { 1543 for (j = RX; j <= TX; j++) {
1545 int k = i + j * ci->hw_ep_max/2; 1544 int k = i + j * ci->hw_ep_max/2;
1546 struct ci13xxx_ep *hwep = &ci->ci13xxx_ep[k]; 1545 struct ci_hw_ep *hwep = &ci->ci_hw_ep[k];
1547 1546
1548 scnprintf(hwep->name, sizeof(hwep->name), "ep%i%s", i, 1547 scnprintf(hwep->name, sizeof(hwep->name), "ep%i%s", i,
1549 (j == TX) ? "in" : "out"); 1548 (j == TX) ? "in" : "out");
@@ -1589,28 +1588,28 @@ static int init_eps(struct ci13xxx *ci)
1589 return retval; 1588 return retval;
1590} 1589}
1591 1590
1592static void destroy_eps(struct ci13xxx *ci) 1591static void destroy_eps(struct ci_hdrc *ci)
1593{ 1592{
1594 int i; 1593 int i;
1595 1594
1596 for (i = 0; i < ci->hw_ep_max; i++) { 1595 for (i = 0; i < ci->hw_ep_max; i++) {
1597 struct ci13xxx_ep *hwep = &ci->ci13xxx_ep[i]; 1596 struct ci_hw_ep *hwep = &ci->ci_hw_ep[i];
1598 1597
1599 dma_pool_free(ci->qh_pool, hwep->qh.ptr, hwep->qh.dma); 1598 dma_pool_free(ci->qh_pool, hwep->qh.ptr, hwep->qh.dma);
1600 } 1599 }
1601} 1600}
1602 1601
1603/** 1602/**
1604 * ci13xxx_start: register a gadget driver 1603 * ci_udc_start: register a gadget driver
1605 * @gadget: our gadget 1604 * @gadget: our gadget
1606 * @driver: the driver being registered 1605 * @driver: the driver being registered
1607 * 1606 *
1608 * Interrupts are enabled here. 1607 * Interrupts are enabled here.
1609 */ 1608 */
1610static int ci13xxx_start(struct usb_gadget *gadget, 1609static int ci_udc_start(struct usb_gadget *gadget,
1611 struct usb_gadget_driver *driver) 1610 struct usb_gadget_driver *driver)
1612{ 1611{
1613 struct ci13xxx *ci = container_of(gadget, struct ci13xxx, gadget); 1612 struct ci_hdrc *ci = container_of(gadget, struct ci_hdrc, gadget);
1614 unsigned long flags; 1613 unsigned long flags;
1615 int retval = -ENOMEM; 1614 int retval = -ENOMEM;
1616 1615
@@ -1631,9 +1630,9 @@ static int ci13xxx_start(struct usb_gadget *gadget,
1631 1630
1632 ci->driver = driver; 1631 ci->driver = driver;
1633 pm_runtime_get_sync(&ci->gadget.dev); 1632 pm_runtime_get_sync(&ci->gadget.dev);
1634 if (ci->platdata->flags & CI13XXX_PULLUP_ON_VBUS) { 1633 if (ci->platdata->flags & CI_HDRC_PULLUP_ON_VBUS) {
1635 if (ci->vbus_active) { 1634 if (ci->vbus_active) {
1636 if (ci->platdata->flags & CI13XXX_REGS_SHARED) 1635 if (ci->platdata->flags & CI_HDRC_REGS_SHARED)
1637 hw_device_reset(ci, USBMODE_CM_DC); 1636 hw_device_reset(ci, USBMODE_CM_DC);
1638 } else { 1637 } else {
1639 pm_runtime_put_sync(&ci->gadget.dev); 1638 pm_runtime_put_sync(&ci->gadget.dev);
@@ -1651,22 +1650,22 @@ static int ci13xxx_start(struct usb_gadget *gadget,
1651} 1650}
1652 1651
1653/** 1652/**
1654 * ci13xxx_stop: unregister a gadget driver 1653 * ci_udc_stop: unregister a gadget driver
1655 */ 1654 */
1656static int ci13xxx_stop(struct usb_gadget *gadget, 1655static int ci_udc_stop(struct usb_gadget *gadget,
1657 struct usb_gadget_driver *driver) 1656 struct usb_gadget_driver *driver)
1658{ 1657{
1659 struct ci13xxx *ci = container_of(gadget, struct ci13xxx, gadget); 1658 struct ci_hdrc *ci = container_of(gadget, struct ci_hdrc, gadget);
1660 unsigned long flags; 1659 unsigned long flags;
1661 1660
1662 spin_lock_irqsave(&ci->lock, flags); 1661 spin_lock_irqsave(&ci->lock, flags);
1663 1662
1664 if (!(ci->platdata->flags & CI13XXX_PULLUP_ON_VBUS) || 1663 if (!(ci->platdata->flags & CI_HDRC_PULLUP_ON_VBUS) ||
1665 ci->vbus_active) { 1664 ci->vbus_active) {
1666 hw_device_state(ci, 0); 1665 hw_device_state(ci, 0);
1667 if (ci->platdata->notify_event) 1666 if (ci->platdata->notify_event)
1668 ci->platdata->notify_event(ci, 1667 ci->platdata->notify_event(ci,
1669 CI13XXX_CONTROLLER_STOPPED_EVENT); 1668 CI_HDRC_CONTROLLER_STOPPED_EVENT);
1670 ci->driver = NULL; 1669 ci->driver = NULL;
1671 spin_unlock_irqrestore(&ci->lock, flags); 1670 spin_unlock_irqrestore(&ci->lock, flags);
1672 _gadget_stop_activity(&ci->gadget); 1671 _gadget_stop_activity(&ci->gadget);
@@ -1688,7 +1687,7 @@ static int ci13xxx_stop(struct usb_gadget *gadget,
1688 * This function returns IRQ_HANDLED if the IRQ has been handled 1687 * This function returns IRQ_HANDLED if the IRQ has been handled
1689 * It locks access to registers 1688 * It locks access to registers
1690 */ 1689 */
1691static irqreturn_t udc_irq(struct ci13xxx *ci) 1690static irqreturn_t udc_irq(struct ci_hdrc *ci)
1692{ 1691{
1693 irqreturn_t retval; 1692 irqreturn_t retval;
1694 u32 intr; 1693 u32 intr;
@@ -1698,7 +1697,7 @@ static irqreturn_t udc_irq(struct ci13xxx *ci)
1698 1697
1699 spin_lock(&ci->lock); 1698 spin_lock(&ci->lock);
1700 1699
1701 if (ci->platdata->flags & CI13XXX_REGS_SHARED) { 1700 if (ci->platdata->flags & CI_HDRC_REGS_SHARED) {
1702 if (hw_read(ci, OP_USBMODE, USBMODE_CM) != 1701 if (hw_read(ci, OP_USBMODE, USBMODE_CM) !=
1703 USBMODE_CM_DC) { 1702 USBMODE_CM_DC) {
1704 spin_unlock(&ci->lock); 1703 spin_unlock(&ci->lock);
@@ -1748,7 +1747,7 @@ static irqreturn_t udc_irq(struct ci13xxx *ci)
1748 * udc_start: initialize gadget role 1747 * udc_start: initialize gadget role
1749 * @ci: chipidea controller 1748 * @ci: chipidea controller
1750 */ 1749 */
1751static int udc_start(struct ci13xxx *ci) 1750static int udc_start(struct ci_hdrc *ci)
1752{ 1751{
1753 struct device *dev = ci->dev; 1752 struct device *dev = ci->dev;
1754 int retval = 0; 1753 int retval = 0;
@@ -1764,15 +1763,15 @@ static int udc_start(struct ci13xxx *ci)
1764 INIT_LIST_HEAD(&ci->gadget.ep_list); 1763 INIT_LIST_HEAD(&ci->gadget.ep_list);
1765 1764
1766 /* alloc resources */ 1765 /* alloc resources */
1767 ci->qh_pool = dma_pool_create("ci13xxx_qh", dev, 1766 ci->qh_pool = dma_pool_create("ci_hw_qh", dev,
1768 sizeof(struct ci13xxx_qh), 1767 sizeof(struct ci_hw_qh),
1769 64, CI13XXX_PAGE_SIZE); 1768 64, CI_HDRC_PAGE_SIZE);
1770 if (ci->qh_pool == NULL) 1769 if (ci->qh_pool == NULL)
1771 return -ENOMEM; 1770 return -ENOMEM;
1772 1771
1773 ci->td_pool = dma_pool_create("ci13xxx_td", dev, 1772 ci->td_pool = dma_pool_create("ci_hw_td", dev,
1774 sizeof(struct ci13xxx_td), 1773 sizeof(struct ci_hw_td),
1775 64, CI13XXX_PAGE_SIZE); 1774 64, CI_HDRC_PAGE_SIZE);
1776 if (ci->td_pool == NULL) { 1775 if (ci->td_pool == NULL) {
1777 retval = -ENOMEM; 1776 retval = -ENOMEM;
1778 goto free_qh_pool; 1777 goto free_qh_pool;
@@ -1790,14 +1789,14 @@ static int udc_start(struct ci13xxx *ci)
1790 ci->transceiver = NULL; 1789 ci->transceiver = NULL;
1791 } 1790 }
1792 1791
1793 if (ci->platdata->flags & CI13XXX_REQUIRE_TRANSCEIVER) { 1792 if (ci->platdata->flags & CI_HDRC_REQUIRE_TRANSCEIVER) {
1794 if (ci->transceiver == NULL) { 1793 if (ci->transceiver == NULL) {
1795 retval = -ENODEV; 1794 retval = -ENODEV;
1796 goto destroy_eps; 1795 goto destroy_eps;
1797 } 1796 }
1798 } 1797 }
1799 1798
1800 if (!(ci->platdata->flags & CI13XXX_REGS_SHARED)) { 1799 if (!(ci->platdata->flags & CI_HDRC_REGS_SHARED)) {
1801 retval = hw_device_reset(ci, USBMODE_CM_DC); 1800 retval = hw_device_reset(ci, USBMODE_CM_DC);
1802 if (retval) 1801 if (retval)
1803 goto put_transceiver; 1802 goto put_transceiver;
@@ -1844,7 +1843,7 @@ free_qh_pool:
1844 * 1843 *
1845 * No interrupts active, the IRQ has been released 1844 * No interrupts active, the IRQ has been released
1846 */ 1845 */
1847static void udc_stop(struct ci13xxx *ci) 1846static void udc_stop(struct ci_hdrc *ci)
1848{ 1847{
1849 if (ci == NULL) 1848 if (ci == NULL)
1850 return; 1849 return;
@@ -1871,7 +1870,7 @@ static void udc_stop(struct ci13xxx *ci)
1871 * 1870 *
1872 * This function enables the gadget role, if the device is "device capable". 1871 * This function enables the gadget role, if the device is "device capable".
1873 */ 1872 */
1874int ci_hdrc_gadget_init(struct ci13xxx *ci) 1873int ci_hdrc_gadget_init(struct ci_hdrc *ci)
1875{ 1874{
1876 struct ci_role_driver *rdrv; 1875 struct ci_role_driver *rdrv;
1877 1876
diff --git a/drivers/usb/chipidea/udc.h b/drivers/usb/chipidea/udc.h
index 0ecc0ad4f513..455ac2169226 100644
--- a/drivers/usb/chipidea/udc.h
+++ b/drivers/usb/chipidea/udc.h
@@ -20,7 +20,7 @@
20#define TX 1 /* similar to USB_DIR_IN but can be used as an index */ 20#define TX 1 /* similar to USB_DIR_IN but can be used as an index */
21 21
22/* DMA layout of transfer descriptors */ 22/* DMA layout of transfer descriptors */
23struct ci13xxx_td { 23struct ci_hw_td {
24 /* 0 */ 24 /* 0 */
25 u32 next; 25 u32 next;
26#define TD_TERMINATE BIT(0) 26#define TD_TERMINATE BIT(0)
@@ -43,7 +43,7 @@ struct ci13xxx_td {
43} __attribute__ ((packed, aligned(4))); 43} __attribute__ ((packed, aligned(4)));
44 44
45/* DMA layout of queue heads */ 45/* DMA layout of queue heads */
46struct ci13xxx_qh { 46struct ci_hw_qh {
47 /* 0 */ 47 /* 0 */
48 u32 cap; 48 u32 cap;
49#define QH_IOS BIT(15) 49#define QH_IOS BIT(15)
@@ -54,7 +54,7 @@ struct ci13xxx_qh {
54 /* 1 */ 54 /* 1 */
55 u32 curr; 55 u32 curr;
56 /* 2 - 8 */ 56 /* 2 - 8 */
57 struct ci13xxx_td td; 57 struct ci_hw_td td;
58 /* 9 */ 58 /* 9 */
59 u32 RESERVED; 59 u32 RESERVED;
60 struct usb_ctrlrequest setup; 60 struct usb_ctrlrequest setup;
@@ -63,11 +63,11 @@ struct ci13xxx_qh {
63struct td_node { 63struct td_node {
64 struct list_head td; 64 struct list_head td;
65 dma_addr_t dma; 65 dma_addr_t dma;
66 struct ci13xxx_td *ptr; 66 struct ci_hw_td *ptr;
67}; 67};
68 68
69/** 69/**
70 * struct ci13xxx_req - usb request representation 70 * struct ci_hw_req - usb request representation
71 * @req: request structure for gadget drivers 71 * @req: request structure for gadget drivers
72 * @queue: link to QH list 72 * @queue: link to QH list
73 * @ptr: transfer descriptor for this request 73 * @ptr: transfer descriptor for this request
@@ -75,7 +75,7 @@ struct td_node {
75 * @zptr: transfer descriptor for the zero packet 75 * @zptr: transfer descriptor for the zero packet
76 * @zdma: dma address of the zero packet's transfer descriptor 76 * @zdma: dma address of the zero packet's transfer descriptor
77 */ 77 */
78struct ci13xxx_req { 78struct ci_hw_req {
79 struct usb_request req; 79 struct usb_request req;
80 struct list_head queue; 80 struct list_head queue;
81 struct list_head tds; 81 struct list_head tds;
@@ -83,11 +83,11 @@ struct ci13xxx_req {
83 83
84#ifdef CONFIG_USB_CHIPIDEA_UDC 84#ifdef CONFIG_USB_CHIPIDEA_UDC
85 85
86int ci_hdrc_gadget_init(struct ci13xxx *ci); 86int ci_hdrc_gadget_init(struct ci_hdrc *ci);
87 87
88#else 88#else
89 89
90static inline int ci_hdrc_gadget_init(struct ci13xxx *ci) 90static inline int ci_hdrc_gadget_init(struct ci_hdrc *ci)
91{ 91{
92 return -ENXIO; 92 return -ENXIO;
93} 93}
diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c
index c912e7b418f4..ac5a46155200 100644
--- a/drivers/usb/chipidea/usbmisc_imx.c
+++ b/drivers/usb/chipidea/usbmisc_imx.c
@@ -16,7 +16,7 @@
16#include <linux/io.h> 16#include <linux/io.h>
17#include <linux/delay.h> 17#include <linux/delay.h>
18 18
19#include "ci13xxx_imx.h" 19#include "ci_hdrc_imx.h"
20 20
21#define USB_DEV_MAX 4 21#define USB_DEV_MAX 4
22 22