Commit 8e22978c57087aac4d88693278db1cc3e94f1253
Committed by
Greg Kroah-Hartman
1 parent
38dcdb3a7d
Exists in
smarc-imx_3.14.28_1.0.0_ga
and in
1 other branch
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>
Showing 19 changed files with 739 additions and 738 deletions Side-by-side Diff
- drivers/usb/chipidea/Makefile
- drivers/usb/chipidea/ci.h
- drivers/usb/chipidea/ci13xxx_imx.c
- drivers/usb/chipidea/ci13xxx_imx.h
- drivers/usb/chipidea/ci13xxx_msm.c
- drivers/usb/chipidea/ci13xxx_pci.c
- drivers/usb/chipidea/ci_hdrc_imx.c
- drivers/usb/chipidea/ci_hdrc_imx.h
- drivers/usb/chipidea/ci_hdrc_msm.c
- drivers/usb/chipidea/ci_hdrc_pci.c
- drivers/usb/chipidea/core.c
- drivers/usb/chipidea/debug.c
- drivers/usb/chipidea/debug.h
- drivers/usb/chipidea/host.c
- drivers/usb/chipidea/host.h
- drivers/usb/chipidea/udc.c
- drivers/usb/chipidea/udc.h
- drivers/usb/chipidea/usbmisc_imx.c
- include/linux/usb/chipidea.h
drivers/usb/chipidea/Makefile
... | ... | @@ -9,14 +9,14 @@ |
9 | 9 | |
10 | 10 | # Glue/Bridge layers go here |
11 | 11 | |
12 | -obj-$(CONFIG_USB_CHIPIDEA) += ci13xxx_msm.o | |
12 | +obj-$(CONFIG_USB_CHIPIDEA) += ci_hdrc_msm.o | |
13 | 13 | |
14 | 14 | # PCI doesn't provide stubs, need to check |
15 | 15 | ifneq ($(CONFIG_PCI),) |
16 | - obj-$(CONFIG_USB_CHIPIDEA) += ci13xxx_pci.o | |
16 | + obj-$(CONFIG_USB_CHIPIDEA) += ci_hdrc_pci.o | |
17 | 17 | endif |
18 | 18 | |
19 | 19 | ifneq ($(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 | |
21 | 21 | endif |
drivers/usb/chipidea/ci.h
... | ... | @@ -22,14 +22,14 @@ |
22 | 22 | * DEFINE |
23 | 23 | *****************************************************************************/ |
24 | 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 | 26 | #define ENDPT_MAX 32 |
27 | 27 | |
28 | 28 | /****************************************************************************** |
29 | 29 | * STRUCTURES |
30 | 30 | *****************************************************************************/ |
31 | 31 | /** |
32 | - * struct ci13xxx_ep - endpoint representation | |
32 | + * struct ci_hw_ep - endpoint representation | |
33 | 33 | * @ep: endpoint structure for gadget drivers |
34 | 34 | * @dir: endpoint direction (TX/RX) |
35 | 35 | * @num: endpoint number |
... | ... | @@ -41,7 +41,7 @@ |
41 | 41 | * @lock: pointer to controller's spinlock |
42 | 42 | * @td_pool: pointer to controller's TD pool |
43 | 43 | */ |
44 | -struct ci13xxx_ep { | |
44 | +struct ci_hw_ep { | |
45 | 45 | struct usb_ep ep; |
46 | 46 | u8 dir; |
47 | 47 | u8 num; |
48 | 48 | |
... | ... | @@ -49,13 +49,13 @@ |
49 | 49 | char name[16]; |
50 | 50 | struct { |
51 | 51 | struct list_head queue; |
52 | - struct ci13xxx_qh *ptr; | |
52 | + struct ci_hw_qh *ptr; | |
53 | 53 | dma_addr_t dma; |
54 | 54 | } qh; |
55 | 55 | int wedge; |
56 | 56 | |
57 | 57 | /* global resources */ |
58 | - struct ci13xxx *ci; | |
58 | + struct ci_hdrc *ci; | |
59 | 59 | spinlock_t *lock; |
60 | 60 | struct dma_pool *td_pool; |
61 | 61 | struct td_node *pending_td; |
... | ... | @@ -75,9 +75,9 @@ |
75 | 75 | * name: role name string (host/gadget) |
76 | 76 | */ |
77 | 77 | struct ci_role_driver { |
78 | - int (*start)(struct ci13xxx *); | |
79 | - void (*stop)(struct ci13xxx *); | |
80 | - irqreturn_t (*irq)(struct ci13xxx *); | |
78 | + int (*start)(struct ci_hdrc *); | |
79 | + void (*stop)(struct ci_hdrc *); | |
80 | + irqreturn_t (*irq)(struct ci_hdrc *); | |
81 | 81 | const char *name; |
82 | 82 | }; |
83 | 83 | |
... | ... | @@ -102,7 +102,7 @@ |
102 | 102 | }; |
103 | 103 | |
104 | 104 | /** |
105 | - * struct ci13xxx - chipidea device representation | |
105 | + * struct ci_hdrc - chipidea device representation | |
106 | 106 | * @dev: pointer to parent device |
107 | 107 | * @lock: access synchronization |
108 | 108 | * @hw_bank: hardware register mapping |
... | ... | @@ -117,7 +117,7 @@ |
117 | 117 | * @gadget: device side representation for peripheral controller |
118 | 118 | * @driver: gadget driver |
119 | 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 | 121 | * @ep0_dir: ep0 direction |
122 | 122 | * @ep0out: pointer to ep0 OUT endpoint |
123 | 123 | * @ep0in: pointer to ep0 IN endpoint |
... | ... | @@ -133,7 +133,7 @@ |
133 | 133 | * @hcd: pointer to usb_hcd for ehci host driver |
134 | 134 | * @debugfs: root dentry for this controller in debugfs |
135 | 135 | */ |
136 | -struct ci13xxx { | |
136 | +struct ci_hdrc { | |
137 | 137 | struct device *dev; |
138 | 138 | spinlock_t lock; |
139 | 139 | struct hw_bank hw_bank; |
140 | 140 | |
... | ... | @@ -150,9 +150,9 @@ |
150 | 150 | struct usb_gadget gadget; |
151 | 151 | struct usb_gadget_driver *driver; |
152 | 152 | unsigned hw_ep_max; |
153 | - struct ci13xxx_ep ci13xxx_ep[ENDPT_MAX]; | |
153 | + struct ci_hw_ep ci_hw_ep[ENDPT_MAX]; | |
154 | 154 | u32 ep0_dir; |
155 | - struct ci13xxx_ep *ep0out, *ep0in; | |
155 | + struct ci_hw_ep *ep0out, *ep0in; | |
156 | 156 | |
157 | 157 | struct usb_request *status; |
158 | 158 | bool setaddr; |
... | ... | @@ -161,7 +161,7 @@ |
161 | 161 | u8 suspended; |
162 | 162 | u8 test_mode; |
163 | 163 | |
164 | - struct ci13xxx_platform_data *platdata; | |
164 | + struct ci_hdrc_platform_data *platdata; | |
165 | 165 | int vbus_active; |
166 | 166 | /* FIXME: some day, we'll not use global phy */ |
167 | 167 | bool global_phy; |
168 | 168 | |
... | ... | @@ -170,13 +170,13 @@ |
170 | 170 | struct dentry *debugfs; |
171 | 171 | }; |
172 | 172 | |
173 | -static inline struct ci_role_driver *ci_role(struct ci13xxx *ci) | |
173 | +static inline struct ci_role_driver *ci_role(struct ci_hdrc *ci) | |
174 | 174 | { |
175 | 175 | BUG_ON(ci->role >= CI_ROLE_END || !ci->roles[ci->role]); |
176 | 176 | return ci->roles[ci->role]; |
177 | 177 | } |
178 | 178 | |
179 | -static inline int ci_role_start(struct ci13xxx *ci, enum ci_role role) | |
179 | +static inline int ci_role_start(struct ci_hdrc *ci, enum ci_role role) | |
180 | 180 | { |
181 | 181 | int ret; |
182 | 182 | |
... | ... | @@ -192,7 +192,7 @@ |
192 | 192 | return ret; |
193 | 193 | } |
194 | 194 | |
195 | -static inline void ci_role_stop(struct ci13xxx *ci) | |
195 | +static inline void ci_role_stop(struct ci_hdrc *ci) | |
196 | 196 | { |
197 | 197 | enum ci_role role = ci->role; |
198 | 198 | |
... | ... | @@ -211,7 +211,7 @@ |
211 | 211 | #define REG_BITS (32) |
212 | 212 | |
213 | 213 | /* register indices */ |
214 | -enum ci13xxx_regs { | |
214 | +enum ci_hw_regs { | |
215 | 215 | CAP_CAPLENGTH, |
216 | 216 | CAP_HCCPARAMS, |
217 | 217 | CAP_DCCPARAMS, |
... | ... | @@ -243,7 +243,7 @@ |
243 | 243 | * |
244 | 244 | * This function returns register contents |
245 | 245 | */ |
246 | -static inline u32 hw_read(struct ci13xxx *ci, enum ci13xxx_regs reg, u32 mask) | |
246 | +static inline u32 hw_read(struct ci_hdrc *ci, enum ci_hw_regs reg, u32 mask) | |
247 | 247 | { |
248 | 248 | return ioread32(ci->hw_bank.regmap[reg]) & mask; |
249 | 249 | } |
... | ... | @@ -254,7 +254,7 @@ |
254 | 254 | * @mask: bitfield mask |
255 | 255 | * @data: new value |
256 | 256 | */ |
257 | -static inline void hw_write(struct ci13xxx *ci, enum ci13xxx_regs reg, | |
257 | +static inline void hw_write(struct ci_hdrc *ci, enum ci_hw_regs reg, | |
258 | 258 | u32 mask, u32 data) |
259 | 259 | { |
260 | 260 | if (~mask) |
... | ... | @@ -271,7 +271,7 @@ |
271 | 271 | * |
272 | 272 | * This function returns register contents |
273 | 273 | */ |
274 | -static inline u32 hw_test_and_clear(struct ci13xxx *ci, enum ci13xxx_regs reg, | |
274 | +static inline u32 hw_test_and_clear(struct ci_hdrc *ci, enum ci_hw_regs reg, | |
275 | 275 | u32 mask) |
276 | 276 | { |
277 | 277 | u32 val = ioread32(ci->hw_bank.regmap[reg]) & mask; |
... | ... | @@ -288,7 +288,7 @@ |
288 | 288 | * |
289 | 289 | * This function returns register contents |
290 | 290 | */ |
291 | -static inline u32 hw_test_and_write(struct ci13xxx *ci, enum ci13xxx_regs reg, | |
291 | +static inline u32 hw_test_and_write(struct ci_hdrc *ci, enum ci_hw_regs reg, | |
292 | 292 | u32 mask, u32 data) |
293 | 293 | { |
294 | 294 | u32 val = hw_read(ci, reg, ~0); |
295 | 295 | |
296 | 296 | |
... | ... | @@ -297,11 +297,11 @@ |
297 | 297 | return (val & mask) >> __ffs(mask); |
298 | 298 | } |
299 | 299 | |
300 | -int hw_device_reset(struct ci13xxx *ci, u32 mode); | |
300 | +int hw_device_reset(struct ci_hdrc *ci, u32 mode); | |
301 | 301 | |
302 | -int hw_port_test_set(struct ci13xxx *ci, u8 mode); | |
302 | +int hw_port_test_set(struct ci_hdrc *ci, u8 mode); | |
303 | 303 | |
304 | -u8 hw_port_test_get(struct ci13xxx *ci); | |
304 | +u8 hw_port_test_get(struct ci_hdrc *ci); | |
305 | 305 | |
306 | 306 | #endif /* __DRIVERS_USB_CHIPIDEA_CI_H */ |
drivers/usb/chipidea/ci13xxx_imx.c
1 | -/* | |
2 | - * Copyright 2012 Freescale Semiconductor, Inc. | |
3 | - * Copyright (C) 2012 Marek Vasut <marex@denx.de> | |
4 | - * on behalf of DENX Software Engineering GmbH | |
5 | - * | |
6 | - * The code contained herein is licensed under the GNU General Public | |
7 | - * License. You may obtain a copy of the GNU General Public License | |
8 | - * Version 2 or later at the following locations: | |
9 | - * | |
10 | - * http://www.opensource.org/licenses/gpl-license.html | |
11 | - * http://www.gnu.org/copyleft/gpl.html | |
12 | - */ | |
13 | - | |
14 | -#include <linux/module.h> | |
15 | -#include <linux/of_platform.h> | |
16 | -#include <linux/of_gpio.h> | |
17 | -#include <linux/platform_device.h> | |
18 | -#include <linux/pm_runtime.h> | |
19 | -#include <linux/dma-mapping.h> | |
20 | -#include <linux/usb/chipidea.h> | |
21 | -#include <linux/clk.h> | |
22 | -#include <linux/regulator/consumer.h> | |
23 | - | |
24 | -#include "ci.h" | |
25 | -#include "ci13xxx_imx.h" | |
26 | - | |
27 | -#define pdev_to_phy(pdev) \ | |
28 | - ((struct usb_phy *)platform_get_drvdata(pdev)) | |
29 | - | |
30 | -struct ci13xxx_imx_data { | |
31 | - struct usb_phy *phy; | |
32 | - struct platform_device *ci_pdev; | |
33 | - struct clk *clk; | |
34 | - struct regulator *reg_vbus; | |
35 | -}; | |
36 | - | |
37 | -static const struct usbmisc_ops *usbmisc_ops; | |
38 | - | |
39 | -/* Common functions shared by usbmisc drivers */ | |
40 | - | |
41 | -int usbmisc_set_ops(const struct usbmisc_ops *ops) | |
42 | -{ | |
43 | - if (usbmisc_ops) | |
44 | - return -EBUSY; | |
45 | - | |
46 | - usbmisc_ops = ops; | |
47 | - | |
48 | - return 0; | |
49 | -} | |
50 | -EXPORT_SYMBOL_GPL(usbmisc_set_ops); | |
51 | - | |
52 | -void usbmisc_unset_ops(const struct usbmisc_ops *ops) | |
53 | -{ | |
54 | - usbmisc_ops = NULL; | |
55 | -} | |
56 | -EXPORT_SYMBOL_GPL(usbmisc_unset_ops); | |
57 | - | |
58 | -int usbmisc_get_init_data(struct device *dev, struct usbmisc_usb_device *usbdev) | |
59 | -{ | |
60 | - struct device_node *np = dev->of_node; | |
61 | - struct of_phandle_args args; | |
62 | - int ret; | |
63 | - | |
64 | - usbdev->dev = dev; | |
65 | - | |
66 | - ret = of_parse_phandle_with_args(np, "fsl,usbmisc", "#index-cells", | |
67 | - 0, &args); | |
68 | - if (ret) { | |
69 | - dev_err(dev, "Failed to parse property fsl,usbmisc, errno %d\n", | |
70 | - ret); | |
71 | - memset(usbdev, 0, sizeof(*usbdev)); | |
72 | - return ret; | |
73 | - } | |
74 | - usbdev->index = args.args[0]; | |
75 | - of_node_put(args.np); | |
76 | - | |
77 | - if (of_find_property(np, "disable-over-current", NULL)) | |
78 | - usbdev->disable_oc = 1; | |
79 | - | |
80 | - if (of_find_property(np, "external-vbus-divider", NULL)) | |
81 | - usbdev->evdo = 1; | |
82 | - | |
83 | - return 0; | |
84 | -} | |
85 | -EXPORT_SYMBOL_GPL(usbmisc_get_init_data); | |
86 | - | |
87 | -/* End of common functions shared by usbmisc drivers*/ | |
88 | - | |
89 | -static int ci13xxx_imx_probe(struct platform_device *pdev) | |
90 | -{ | |
91 | - struct ci13xxx_imx_data *data; | |
92 | - struct ci13xxx_platform_data pdata = { | |
93 | - .name = "ci13xxx_imx", | |
94 | - .capoffset = DEF_CAPOFFSET, | |
95 | - .flags = CI13XXX_REQUIRE_TRANSCEIVER | | |
96 | - CI13XXX_PULLUP_ON_VBUS | | |
97 | - CI13XXX_DISABLE_STREAMING, | |
98 | - }; | |
99 | - struct resource *res; | |
100 | - int ret; | |
101 | - struct usb_phy *phy; | |
102 | - | |
103 | - if (of_find_property(pdev->dev.of_node, "fsl,usbmisc", NULL) | |
104 | - && !usbmisc_ops) | |
105 | - return -EPROBE_DEFER; | |
106 | - | |
107 | - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); | |
108 | - if (!data) { | |
109 | - dev_err(&pdev->dev, "Failed to allocate CI13xxx-IMX data!\n"); | |
110 | - return -ENOMEM; | |
111 | - } | |
112 | - | |
113 | - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | |
114 | - if (!res) { | |
115 | - dev_err(&pdev->dev, "Can't get device resources!\n"); | |
116 | - return -ENOENT; | |
117 | - } | |
118 | - | |
119 | - data->clk = devm_clk_get(&pdev->dev, NULL); | |
120 | - if (IS_ERR(data->clk)) { | |
121 | - dev_err(&pdev->dev, | |
122 | - "Failed to get clock, err=%ld\n", PTR_ERR(data->clk)); | |
123 | - return PTR_ERR(data->clk); | |
124 | - } | |
125 | - | |
126 | - ret = clk_prepare_enable(data->clk); | |
127 | - if (ret) { | |
128 | - dev_err(&pdev->dev, | |
129 | - "Failed to prepare or enable clock, err=%d\n", ret); | |
130 | - return ret; | |
131 | - } | |
132 | - | |
133 | - phy = devm_usb_get_phy_by_phandle(&pdev->dev, "fsl,usbphy", 0); | |
134 | - if (!IS_ERR(phy)) { | |
135 | - ret = usb_phy_init(phy); | |
136 | - if (ret) { | |
137 | - dev_err(&pdev->dev, "unable to init phy: %d\n", ret); | |
138 | - goto err_clk; | |
139 | - } | |
140 | - } else if (PTR_ERR(phy) == -EPROBE_DEFER) { | |
141 | - ret = -EPROBE_DEFER; | |
142 | - goto err_clk; | |
143 | - } | |
144 | - | |
145 | - /* we only support host now, so enable vbus here */ | |
146 | - data->reg_vbus = devm_regulator_get(&pdev->dev, "vbus"); | |
147 | - if (!IS_ERR(data->reg_vbus)) { | |
148 | - ret = regulator_enable(data->reg_vbus); | |
149 | - if (ret) { | |
150 | - dev_err(&pdev->dev, | |
151 | - "Failed to enable vbus regulator, err=%d\n", | |
152 | - ret); | |
153 | - goto err_clk; | |
154 | - } | |
155 | - } else { | |
156 | - data->reg_vbus = NULL; | |
157 | - } | |
158 | - | |
159 | - pdata.phy = data->phy; | |
160 | - | |
161 | - if (!pdev->dev.dma_mask) | |
162 | - pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; | |
163 | - if (!pdev->dev.coherent_dma_mask) | |
164 | - pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); | |
165 | - | |
166 | - if (usbmisc_ops && usbmisc_ops->init) { | |
167 | - ret = usbmisc_ops->init(&pdev->dev); | |
168 | - if (ret) { | |
169 | - dev_err(&pdev->dev, | |
170 | - "usbmisc init failed, ret=%d\n", ret); | |
171 | - goto err; | |
172 | - } | |
173 | - } | |
174 | - | |
175 | - data->ci_pdev = ci13xxx_add_device(&pdev->dev, | |
176 | - pdev->resource, pdev->num_resources, | |
177 | - &pdata); | |
178 | - if (IS_ERR(data->ci_pdev)) { | |
179 | - ret = PTR_ERR(data->ci_pdev); | |
180 | - dev_err(&pdev->dev, | |
181 | - "Can't register ci_hdrc platform device, err=%d\n", | |
182 | - ret); | |
183 | - goto err; | |
184 | - } | |
185 | - | |
186 | - if (usbmisc_ops && usbmisc_ops->post) { | |
187 | - ret = usbmisc_ops->post(&pdev->dev); | |
188 | - if (ret) { | |
189 | - dev_err(&pdev->dev, | |
190 | - "usbmisc post failed, ret=%d\n", ret); | |
191 | - goto disable_device; | |
192 | - } | |
193 | - } | |
194 | - | |
195 | - platform_set_drvdata(pdev, data); | |
196 | - | |
197 | - pm_runtime_no_callbacks(&pdev->dev); | |
198 | - pm_runtime_enable(&pdev->dev); | |
199 | - | |
200 | - return 0; | |
201 | - | |
202 | -disable_device: | |
203 | - ci13xxx_remove_device(data->ci_pdev); | |
204 | -err: | |
205 | - if (data->reg_vbus) | |
206 | - regulator_disable(data->reg_vbus); | |
207 | -err_clk: | |
208 | - clk_disable_unprepare(data->clk); | |
209 | - return ret; | |
210 | -} | |
211 | - | |
212 | -static int ci13xxx_imx_remove(struct platform_device *pdev) | |
213 | -{ | |
214 | - struct ci13xxx_imx_data *data = platform_get_drvdata(pdev); | |
215 | - | |
216 | - pm_runtime_disable(&pdev->dev); | |
217 | - ci13xxx_remove_device(data->ci_pdev); | |
218 | - | |
219 | - if (data->reg_vbus) | |
220 | - regulator_disable(data->reg_vbus); | |
221 | - | |
222 | - if (data->phy) { | |
223 | - usb_phy_shutdown(data->phy); | |
224 | - module_put(data->phy->dev->driver->owner); | |
225 | - } | |
226 | - | |
227 | - clk_disable_unprepare(data->clk); | |
228 | - | |
229 | - return 0; | |
230 | -} | |
231 | - | |
232 | -static const struct of_device_id ci13xxx_imx_dt_ids[] = { | |
233 | - { .compatible = "fsl,imx27-usb", }, | |
234 | - { /* sentinel */ } | |
235 | -}; | |
236 | -MODULE_DEVICE_TABLE(of, ci13xxx_imx_dt_ids); | |
237 | - | |
238 | -static struct platform_driver ci13xxx_imx_driver = { | |
239 | - .probe = ci13xxx_imx_probe, | |
240 | - .remove = ci13xxx_imx_remove, | |
241 | - .driver = { | |
242 | - .name = "imx_usb", | |
243 | - .owner = THIS_MODULE, | |
244 | - .of_match_table = ci13xxx_imx_dt_ids, | |
245 | - }, | |
246 | -}; | |
247 | - | |
248 | -module_platform_driver(ci13xxx_imx_driver); | |
249 | - | |
250 | -MODULE_ALIAS("platform:imx-usb"); | |
251 | -MODULE_LICENSE("GPL v2"); | |
252 | -MODULE_DESCRIPTION("CI13xxx i.MX USB binding"); | |
253 | -MODULE_AUTHOR("Marek Vasut <marex@denx.de>"); | |
254 | -MODULE_AUTHOR("Richard Zhao <richard.zhao@freescale.com>"); |
drivers/usb/chipidea/ci13xxx_imx.h
1 | -/* | |
2 | - * Copyright 2012 Freescale Semiconductor, Inc. | |
3 | - * | |
4 | - * The code contained herein is licensed under the GNU General Public | |
5 | - * License. You may obtain a copy of the GNU General Public License | |
6 | - * Version 2 or later at the following locations: | |
7 | - * | |
8 | - * http://www.opensource.org/licenses/gpl-license.html | |
9 | - * http://www.gnu.org/copyleft/gpl.html | |
10 | - */ | |
11 | - | |
12 | -/* Used to set SoC specific callbacks */ | |
13 | -struct usbmisc_ops { | |
14 | - /* It's called once when probe a usb device */ | |
15 | - int (*init)(struct device *dev); | |
16 | - /* It's called once after adding a usb device */ | |
17 | - int (*post)(struct device *dev); | |
18 | -}; | |
19 | - | |
20 | -struct usbmisc_usb_device { | |
21 | - struct device *dev; /* usb controller device */ | |
22 | - int index; | |
23 | - | |
24 | - unsigned int disable_oc:1; /* over current detect disabled */ | |
25 | - unsigned int evdo:1; /* set external vbus divider option */ | |
26 | -}; | |
27 | - | |
28 | -int usbmisc_set_ops(const struct usbmisc_ops *ops); | |
29 | -void usbmisc_unset_ops(const struct usbmisc_ops *ops); | |
30 | -int | |
31 | -usbmisc_get_init_data(struct device *dev, struct usbmisc_usb_device *usbdev); |
drivers/usb/chipidea/ci13xxx_msm.c
1 | -/* Copyright (c) 2010, Code Aurora Forum. All rights reserved. | |
2 | - * | |
3 | - * This program is free software; you can redistribute it and/or modify | |
4 | - * it under the terms of the GNU General Public License version 2 and | |
5 | - * only version 2 as published by the Free Software Foundation. | |
6 | - */ | |
7 | - | |
8 | -#include <linux/module.h> | |
9 | -#include <linux/platform_device.h> | |
10 | -#include <linux/pm_runtime.h> | |
11 | -#include <linux/usb/msm_hsusb_hw.h> | |
12 | -#include <linux/usb/ulpi.h> | |
13 | -#include <linux/usb/gadget.h> | |
14 | -#include <linux/usb/chipidea.h> | |
15 | - | |
16 | -#include "ci.h" | |
17 | - | |
18 | -#define MSM_USB_BASE (ci->hw_bank.abs) | |
19 | - | |
20 | -static void ci13xxx_msm_notify_event(struct ci13xxx *ci, unsigned event) | |
21 | -{ | |
22 | - struct device *dev = ci->gadget.dev.parent; | |
23 | - int val; | |
24 | - | |
25 | - switch (event) { | |
26 | - case CI13XXX_CONTROLLER_RESET_EVENT: | |
27 | - dev_dbg(dev, "CI13XXX_CONTROLLER_RESET_EVENT received\n"); | |
28 | - writel(0, USB_AHBBURST); | |
29 | - writel(0, USB_AHBMODE); | |
30 | - break; | |
31 | - case CI13XXX_CONTROLLER_STOPPED_EVENT: | |
32 | - dev_dbg(dev, "CI13XXX_CONTROLLER_STOPPED_EVENT received\n"); | |
33 | - /* | |
34 | - * Put the transceiver in non-driving mode. Otherwise host | |
35 | - * may not detect soft-disconnection. | |
36 | - */ | |
37 | - val = usb_phy_io_read(ci->transceiver, ULPI_FUNC_CTRL); | |
38 | - val &= ~ULPI_FUNC_CTRL_OPMODE_MASK; | |
39 | - val |= ULPI_FUNC_CTRL_OPMODE_NONDRIVING; | |
40 | - usb_phy_io_write(ci->transceiver, val, ULPI_FUNC_CTRL); | |
41 | - break; | |
42 | - default: | |
43 | - dev_dbg(dev, "unknown ci13xxx event\n"); | |
44 | - break; | |
45 | - } | |
46 | -} | |
47 | - | |
48 | -static struct ci13xxx_platform_data ci13xxx_msm_platdata = { | |
49 | - .name = "ci13xxx_msm", | |
50 | - .flags = CI13XXX_REGS_SHARED | | |
51 | - CI13XXX_REQUIRE_TRANSCEIVER | | |
52 | - CI13XXX_PULLUP_ON_VBUS | | |
53 | - CI13XXX_DISABLE_STREAMING, | |
54 | - | |
55 | - .notify_event = ci13xxx_msm_notify_event, | |
56 | -}; | |
57 | - | |
58 | -static int ci13xxx_msm_probe(struct platform_device *pdev) | |
59 | -{ | |
60 | - struct platform_device *plat_ci; | |
61 | - | |
62 | - dev_dbg(&pdev->dev, "ci13xxx_msm_probe\n"); | |
63 | - | |
64 | - plat_ci = ci13xxx_add_device(&pdev->dev, | |
65 | - pdev->resource, pdev->num_resources, | |
66 | - &ci13xxx_msm_platdata); | |
67 | - if (IS_ERR(plat_ci)) { | |
68 | - dev_err(&pdev->dev, "ci13xxx_add_device failed!\n"); | |
69 | - return PTR_ERR(plat_ci); | |
70 | - } | |
71 | - | |
72 | - platform_set_drvdata(pdev, plat_ci); | |
73 | - | |
74 | - pm_runtime_no_callbacks(&pdev->dev); | |
75 | - pm_runtime_enable(&pdev->dev); | |
76 | - | |
77 | - return 0; | |
78 | -} | |
79 | - | |
80 | -static int ci13xxx_msm_remove(struct platform_device *pdev) | |
81 | -{ | |
82 | - struct platform_device *plat_ci = platform_get_drvdata(pdev); | |
83 | - | |
84 | - pm_runtime_disable(&pdev->dev); | |
85 | - ci13xxx_remove_device(plat_ci); | |
86 | - | |
87 | - return 0; | |
88 | -} | |
89 | - | |
90 | -static struct platform_driver ci13xxx_msm_driver = { | |
91 | - .probe = ci13xxx_msm_probe, | |
92 | - .remove = ci13xxx_msm_remove, | |
93 | - .driver = { .name = "msm_hsusb", }, | |
94 | -}; | |
95 | - | |
96 | -module_platform_driver(ci13xxx_msm_driver); | |
97 | - | |
98 | -MODULE_ALIAS("platform:msm_hsusb"); | |
99 | -MODULE_LICENSE("GPL v2"); |
drivers/usb/chipidea/ci13xxx_pci.c
1 | -/* | |
2 | - * ci13xxx_pci.c - MIPS USB IP core family device controller | |
3 | - * | |
4 | - * Copyright (C) 2008 Chipidea - MIPS Technologies, Inc. All rights reserved. | |
5 | - * | |
6 | - * Author: David Lopo | |
7 | - * | |
8 | - * This program is free software; you can redistribute it and/or modify | |
9 | - * it under the terms of the GNU General Public License version 2 as | |
10 | - * published by the Free Software Foundation. | |
11 | - */ | |
12 | - | |
13 | -#include <linux/platform_device.h> | |
14 | -#include <linux/module.h> | |
15 | -#include <linux/pci.h> | |
16 | -#include <linux/interrupt.h> | |
17 | -#include <linux/usb/gadget.h> | |
18 | -#include <linux/usb/chipidea.h> | |
19 | - | |
20 | -/* driver name */ | |
21 | -#define UDC_DRIVER_NAME "ci13xxx_pci" | |
22 | - | |
23 | -/****************************************************************************** | |
24 | - * PCI block | |
25 | - *****************************************************************************/ | |
26 | -static struct ci13xxx_platform_data pci_platdata = { | |
27 | - .name = UDC_DRIVER_NAME, | |
28 | - .capoffset = DEF_CAPOFFSET, | |
29 | -}; | |
30 | - | |
31 | -static struct ci13xxx_platform_data langwell_pci_platdata = { | |
32 | - .name = UDC_DRIVER_NAME, | |
33 | - .capoffset = 0, | |
34 | -}; | |
35 | - | |
36 | -static struct ci13xxx_platform_data penwell_pci_platdata = { | |
37 | - .name = UDC_DRIVER_NAME, | |
38 | - .capoffset = 0, | |
39 | - .power_budget = 200, | |
40 | -}; | |
41 | - | |
42 | -/** | |
43 | - * ci13xxx_pci_probe: PCI probe | |
44 | - * @pdev: USB device controller being probed | |
45 | - * @id: PCI hotplug ID connecting controller to UDC framework | |
46 | - * | |
47 | - * This function returns an error code | |
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 | |
50 | - */ | |
51 | -static int ci13xxx_pci_probe(struct pci_dev *pdev, | |
52 | - const struct pci_device_id *id) | |
53 | -{ | |
54 | - struct ci13xxx_platform_data *platdata = (void *)id->driver_data; | |
55 | - struct platform_device *plat_ci; | |
56 | - struct resource res[3]; | |
57 | - int retval = 0, nres = 2; | |
58 | - | |
59 | - if (!platdata) { | |
60 | - dev_err(&pdev->dev, "device doesn't provide driver data\n"); | |
61 | - return -ENODEV; | |
62 | - } | |
63 | - | |
64 | - retval = pcim_enable_device(pdev); | |
65 | - if (retval) | |
66 | - return retval; | |
67 | - | |
68 | - if (!pdev->irq) { | |
69 | - dev_err(&pdev->dev, "No IRQ, check BIOS/PCI setup!"); | |
70 | - return -ENODEV; | |
71 | - } | |
72 | - | |
73 | - pci_set_master(pdev); | |
74 | - pci_try_set_mwi(pdev); | |
75 | - | |
76 | - memset(res, 0, sizeof(res)); | |
77 | - res[0].start = pci_resource_start(pdev, 0); | |
78 | - res[0].end = pci_resource_end(pdev, 0); | |
79 | - res[0].flags = IORESOURCE_MEM; | |
80 | - res[1].start = pdev->irq; | |
81 | - res[1].flags = IORESOURCE_IRQ; | |
82 | - | |
83 | - plat_ci = ci13xxx_add_device(&pdev->dev, res, nres, platdata); | |
84 | - if (IS_ERR(plat_ci)) { | |
85 | - dev_err(&pdev->dev, "ci13xxx_add_device failed!\n"); | |
86 | - return PTR_ERR(plat_ci); | |
87 | - } | |
88 | - | |
89 | - pci_set_drvdata(pdev, plat_ci); | |
90 | - | |
91 | - return 0; | |
92 | -} | |
93 | - | |
94 | -/** | |
95 | - * ci13xxx_pci_remove: PCI remove | |
96 | - * @pdev: USB Device Controller being removed | |
97 | - * | |
98 | - * Reverses the effect of ci13xxx_pci_probe(), | |
99 | - * first invoking the udc_remove() and then releases | |
100 | - * all PCI resources allocated for this USB device controller | |
101 | - */ | |
102 | -static void ci13xxx_pci_remove(struct pci_dev *pdev) | |
103 | -{ | |
104 | - struct platform_device *plat_ci = pci_get_drvdata(pdev); | |
105 | - | |
106 | - ci13xxx_remove_device(plat_ci); | |
107 | -} | |
108 | - | |
109 | -/** | |
110 | - * PCI device table | |
111 | - * PCI device structure | |
112 | - * | |
113 | - * Check "pci.h" for details | |
114 | - */ | |
115 | -static DEFINE_PCI_DEVICE_TABLE(ci13xxx_pci_id_table) = { | |
116 | - { | |
117 | - PCI_DEVICE(0x153F, 0x1004), | |
118 | - .driver_data = (kernel_ulong_t)&pci_platdata, | |
119 | - }, | |
120 | - { | |
121 | - PCI_DEVICE(0x153F, 0x1006), | |
122 | - .driver_data = (kernel_ulong_t)&pci_platdata, | |
123 | - }, | |
124 | - { | |
125 | - PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x0811), | |
126 | - .driver_data = (kernel_ulong_t)&langwell_pci_platdata, | |
127 | - }, | |
128 | - { | |
129 | - PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x0829), | |
130 | - .driver_data = (kernel_ulong_t)&penwell_pci_platdata, | |
131 | - }, | |
132 | - { 0, 0, 0, 0, 0, 0, 0 /* end: all zeroes */ } | |
133 | -}; | |
134 | -MODULE_DEVICE_TABLE(pci, ci13xxx_pci_id_table); | |
135 | - | |
136 | -static struct pci_driver ci13xxx_pci_driver = { | |
137 | - .name = UDC_DRIVER_NAME, | |
138 | - .id_table = ci13xxx_pci_id_table, | |
139 | - .probe = ci13xxx_pci_probe, | |
140 | - .remove = ci13xxx_pci_remove, | |
141 | -}; | |
142 | - | |
143 | -module_pci_driver(ci13xxx_pci_driver); | |
144 | - | |
145 | -MODULE_AUTHOR("MIPS - David Lopo <dlopo@chipidea.mips.com>"); | |
146 | -MODULE_DESCRIPTION("MIPS CI13XXX USB Peripheral Controller"); | |
147 | -MODULE_LICENSE("GPL"); | |
148 | -MODULE_VERSION("June 2008"); |
drivers/usb/chipidea/ci_hdrc_imx.c
1 | +/* | |
2 | + * Copyright 2012 Freescale Semiconductor, Inc. | |
3 | + * Copyright (C) 2012 Marek Vasut <marex@denx.de> | |
4 | + * on behalf of DENX Software Engineering GmbH | |
5 | + * | |
6 | + * The code contained herein is licensed under the GNU General Public | |
7 | + * License. You may obtain a copy of the GNU General Public License | |
8 | + * Version 2 or later at the following locations: | |
9 | + * | |
10 | + * http://www.opensource.org/licenses/gpl-license.html | |
11 | + * http://www.gnu.org/copyleft/gpl.html | |
12 | + */ | |
13 | + | |
14 | +#include <linux/module.h> | |
15 | +#include <linux/of_platform.h> | |
16 | +#include <linux/of_gpio.h> | |
17 | +#include <linux/platform_device.h> | |
18 | +#include <linux/pm_runtime.h> | |
19 | +#include <linux/dma-mapping.h> | |
20 | +#include <linux/usb/chipidea.h> | |
21 | +#include <linux/clk.h> | |
22 | +#include <linux/regulator/consumer.h> | |
23 | + | |
24 | +#include "ci.h" | |
25 | +#include "ci_hdrc_imx.h" | |
26 | + | |
27 | +#define pdev_to_phy(pdev) \ | |
28 | + ((struct usb_phy *)platform_get_drvdata(pdev)) | |
29 | + | |
30 | +struct ci_hdrc_imx_data { | |
31 | + struct usb_phy *phy; | |
32 | + struct platform_device *ci_pdev; | |
33 | + struct clk *clk; | |
34 | + struct regulator *reg_vbus; | |
35 | +}; | |
36 | + | |
37 | +static const struct usbmisc_ops *usbmisc_ops; | |
38 | + | |
39 | +/* Common functions shared by usbmisc drivers */ | |
40 | + | |
41 | +int usbmisc_set_ops(const struct usbmisc_ops *ops) | |
42 | +{ | |
43 | + if (usbmisc_ops) | |
44 | + return -EBUSY; | |
45 | + | |
46 | + usbmisc_ops = ops; | |
47 | + | |
48 | + return 0; | |
49 | +} | |
50 | +EXPORT_SYMBOL_GPL(usbmisc_set_ops); | |
51 | + | |
52 | +void usbmisc_unset_ops(const struct usbmisc_ops *ops) | |
53 | +{ | |
54 | + usbmisc_ops = NULL; | |
55 | +} | |
56 | +EXPORT_SYMBOL_GPL(usbmisc_unset_ops); | |
57 | + | |
58 | +int usbmisc_get_init_data(struct device *dev, struct usbmisc_usb_device *usbdev) | |
59 | +{ | |
60 | + struct device_node *np = dev->of_node; | |
61 | + struct of_phandle_args args; | |
62 | + int ret; | |
63 | + | |
64 | + usbdev->dev = dev; | |
65 | + | |
66 | + ret = of_parse_phandle_with_args(np, "fsl,usbmisc", "#index-cells", | |
67 | + 0, &args); | |
68 | + if (ret) { | |
69 | + dev_err(dev, "Failed to parse property fsl,usbmisc, errno %d\n", | |
70 | + ret); | |
71 | + memset(usbdev, 0, sizeof(*usbdev)); | |
72 | + return ret; | |
73 | + } | |
74 | + usbdev->index = args.args[0]; | |
75 | + of_node_put(args.np); | |
76 | + | |
77 | + if (of_find_property(np, "disable-over-current", NULL)) | |
78 | + usbdev->disable_oc = 1; | |
79 | + | |
80 | + if (of_find_property(np, "external-vbus-divider", NULL)) | |
81 | + usbdev->evdo = 1; | |
82 | + | |
83 | + return 0; | |
84 | +} | |
85 | +EXPORT_SYMBOL_GPL(usbmisc_get_init_data); | |
86 | + | |
87 | +/* End of common functions shared by usbmisc drivers*/ | |
88 | + | |
89 | +static int ci_hdrc_imx_probe(struct platform_device *pdev) | |
90 | +{ | |
91 | + struct ci_hdrc_imx_data *data; | |
92 | + struct ci_hdrc_platform_data pdata = { | |
93 | + .name = "ci_hdrc_imx", | |
94 | + .capoffset = DEF_CAPOFFSET, | |
95 | + .flags = CI_HDRC_REQUIRE_TRANSCEIVER | | |
96 | + CI_HDRC_PULLUP_ON_VBUS | | |
97 | + CI_HDRC_DISABLE_STREAMING, | |
98 | + }; | |
99 | + struct resource *res; | |
100 | + int ret; | |
101 | + struct usb_phy *phy; | |
102 | + | |
103 | + if (of_find_property(pdev->dev.of_node, "fsl,usbmisc", NULL) | |
104 | + && !usbmisc_ops) | |
105 | + return -EPROBE_DEFER; | |
106 | + | |
107 | + data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); | |
108 | + if (!data) { | |
109 | + dev_err(&pdev->dev, "Failed to allocate ci_hdrc-imx data!\n"); | |
110 | + return -ENOMEM; | |
111 | + } | |
112 | + | |
113 | + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | |
114 | + if (!res) { | |
115 | + dev_err(&pdev->dev, "Can't get device resources!\n"); | |
116 | + return -ENOENT; | |
117 | + } | |
118 | + | |
119 | + data->clk = devm_clk_get(&pdev->dev, NULL); | |
120 | + if (IS_ERR(data->clk)) { | |
121 | + dev_err(&pdev->dev, | |
122 | + "Failed to get clock, err=%ld\n", PTR_ERR(data->clk)); | |
123 | + return PTR_ERR(data->clk); | |
124 | + } | |
125 | + | |
126 | + ret = clk_prepare_enable(data->clk); | |
127 | + if (ret) { | |
128 | + dev_err(&pdev->dev, | |
129 | + "Failed to prepare or enable clock, err=%d\n", ret); | |
130 | + return ret; | |
131 | + } | |
132 | + | |
133 | + phy = devm_usb_get_phy_by_phandle(&pdev->dev, "fsl,usbphy", 0); | |
134 | + if (!IS_ERR(phy)) { | |
135 | + ret = usb_phy_init(phy); | |
136 | + if (ret) { | |
137 | + dev_err(&pdev->dev, "unable to init phy: %d\n", ret); | |
138 | + goto err_clk; | |
139 | + } | |
140 | + } else if (PTR_ERR(phy) == -EPROBE_DEFER) { | |
141 | + ret = -EPROBE_DEFER; | |
142 | + goto err_clk; | |
143 | + } | |
144 | + | |
145 | + /* we only support host now, so enable vbus here */ | |
146 | + data->reg_vbus = devm_regulator_get(&pdev->dev, "vbus"); | |
147 | + if (!IS_ERR(data->reg_vbus)) { | |
148 | + ret = regulator_enable(data->reg_vbus); | |
149 | + if (ret) { | |
150 | + dev_err(&pdev->dev, | |
151 | + "Failed to enable vbus regulator, err=%d\n", | |
152 | + ret); | |
153 | + goto err_clk; | |
154 | + } | |
155 | + } else { | |
156 | + data->reg_vbus = NULL; | |
157 | + } | |
158 | + | |
159 | + pdata.phy = data->phy; | |
160 | + | |
161 | + if (!pdev->dev.dma_mask) | |
162 | + pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; | |
163 | + if (!pdev->dev.coherent_dma_mask) | |
164 | + pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); | |
165 | + | |
166 | + if (usbmisc_ops && usbmisc_ops->init) { | |
167 | + ret = usbmisc_ops->init(&pdev->dev); | |
168 | + if (ret) { | |
169 | + dev_err(&pdev->dev, | |
170 | + "usbmisc init failed, ret=%d\n", ret); | |
171 | + goto err; | |
172 | + } | |
173 | + } | |
174 | + | |
175 | + data->ci_pdev = ci_hdrc_add_device(&pdev->dev, | |
176 | + pdev->resource, pdev->num_resources, | |
177 | + &pdata); | |
178 | + if (IS_ERR(data->ci_pdev)) { | |
179 | + ret = PTR_ERR(data->ci_pdev); | |
180 | + dev_err(&pdev->dev, | |
181 | + "Can't register ci_hdrc platform device, err=%d\n", | |
182 | + ret); | |
183 | + goto err; | |
184 | + } | |
185 | + | |
186 | + if (usbmisc_ops && usbmisc_ops->post) { | |
187 | + ret = usbmisc_ops->post(&pdev->dev); | |
188 | + if (ret) { | |
189 | + dev_err(&pdev->dev, | |
190 | + "usbmisc post failed, ret=%d\n", ret); | |
191 | + goto disable_device; | |
192 | + } | |
193 | + } | |
194 | + | |
195 | + platform_set_drvdata(pdev, data); | |
196 | + | |
197 | + pm_runtime_no_callbacks(&pdev->dev); | |
198 | + pm_runtime_enable(&pdev->dev); | |
199 | + | |
200 | + return 0; | |
201 | + | |
202 | +disable_device: | |
203 | + ci_hdrc_remove_device(data->ci_pdev); | |
204 | +err: | |
205 | + if (data->reg_vbus) | |
206 | + regulator_disable(data->reg_vbus); | |
207 | +err_clk: | |
208 | + clk_disable_unprepare(data->clk); | |
209 | + return ret; | |
210 | +} | |
211 | + | |
212 | +static int ci_hdrc_imx_remove(struct platform_device *pdev) | |
213 | +{ | |
214 | + struct ci_hdrc_imx_data *data = platform_get_drvdata(pdev); | |
215 | + | |
216 | + pm_runtime_disable(&pdev->dev); | |
217 | + ci_hdrc_remove_device(data->ci_pdev); | |
218 | + | |
219 | + if (data->reg_vbus) | |
220 | + regulator_disable(data->reg_vbus); | |
221 | + | |
222 | + if (data->phy) { | |
223 | + usb_phy_shutdown(data->phy); | |
224 | + module_put(data->phy->dev->driver->owner); | |
225 | + } | |
226 | + | |
227 | + clk_disable_unprepare(data->clk); | |
228 | + | |
229 | + return 0; | |
230 | +} | |
231 | + | |
232 | +static const struct of_device_id ci_hdrc_imx_dt_ids[] = { | |
233 | + { .compatible = "fsl,imx27-usb", }, | |
234 | + { /* sentinel */ } | |
235 | +}; | |
236 | +MODULE_DEVICE_TABLE(of, ci_hdrc_imx_dt_ids); | |
237 | + | |
238 | +static struct platform_driver ci_hdrc_imx_driver = { | |
239 | + .probe = ci_hdrc_imx_probe, | |
240 | + .remove = ci_hdrc_imx_remove, | |
241 | + .driver = { | |
242 | + .name = "imx_usb", | |
243 | + .owner = THIS_MODULE, | |
244 | + .of_match_table = ci_hdrc_imx_dt_ids, | |
245 | + }, | |
246 | +}; | |
247 | + | |
248 | +module_platform_driver(ci_hdrc_imx_driver); | |
249 | + | |
250 | +MODULE_ALIAS("platform:imx-usb"); | |
251 | +MODULE_LICENSE("GPL v2"); | |
252 | +MODULE_DESCRIPTION("CI HDRC i.MX USB binding"); | |
253 | +MODULE_AUTHOR("Marek Vasut <marex@denx.de>"); | |
254 | +MODULE_AUTHOR("Richard Zhao <richard.zhao@freescale.com>"); |
drivers/usb/chipidea/ci_hdrc_imx.h
1 | +/* | |
2 | + * Copyright 2012 Freescale Semiconductor, Inc. | |
3 | + * | |
4 | + * The code contained herein is licensed under the GNU General Public | |
5 | + * License. You may obtain a copy of the GNU General Public License | |
6 | + * Version 2 or later at the following locations: | |
7 | + * | |
8 | + * http://www.opensource.org/licenses/gpl-license.html | |
9 | + * http://www.gnu.org/copyleft/gpl.html | |
10 | + */ | |
11 | + | |
12 | +/* Used to set SoC specific callbacks */ | |
13 | +struct usbmisc_ops { | |
14 | + /* It's called once when probe a usb device */ | |
15 | + int (*init)(struct device *dev); | |
16 | + /* It's called once after adding a usb device */ | |
17 | + int (*post)(struct device *dev); | |
18 | +}; | |
19 | + | |
20 | +struct usbmisc_usb_device { | |
21 | + struct device *dev; /* usb controller device */ | |
22 | + int index; | |
23 | + | |
24 | + unsigned int disable_oc:1; /* over current detect disabled */ | |
25 | + unsigned int evdo:1; /* set external vbus divider option */ | |
26 | +}; | |
27 | + | |
28 | +int usbmisc_set_ops(const struct usbmisc_ops *ops); | |
29 | +void usbmisc_unset_ops(const struct usbmisc_ops *ops); | |
30 | +int | |
31 | +usbmisc_get_init_data(struct device *dev, struct usbmisc_usb_device *usbdev); |
drivers/usb/chipidea/ci_hdrc_msm.c
1 | +/* Copyright (c) 2010, Code Aurora Forum. All rights reserved. | |
2 | + * | |
3 | + * This program is free software; you can redistribute it and/or modify | |
4 | + * it under the terms of the GNU General Public License version 2 and | |
5 | + * only version 2 as published by the Free Software Foundation. | |
6 | + */ | |
7 | + | |
8 | +#include <linux/module.h> | |
9 | +#include <linux/platform_device.h> | |
10 | +#include <linux/pm_runtime.h> | |
11 | +#include <linux/usb/msm_hsusb_hw.h> | |
12 | +#include <linux/usb/ulpi.h> | |
13 | +#include <linux/usb/gadget.h> | |
14 | +#include <linux/usb/chipidea.h> | |
15 | + | |
16 | +#include "ci.h" | |
17 | + | |
18 | +#define MSM_USB_BASE (ci->hw_bank.abs) | |
19 | + | |
20 | +static void ci_hdrc_msm_notify_event(struct ci_hdrc *ci, unsigned event) | |
21 | +{ | |
22 | + struct device *dev = ci->gadget.dev.parent; | |
23 | + int val; | |
24 | + | |
25 | + switch (event) { | |
26 | + case CI_HDRC_CONTROLLER_RESET_EVENT: | |
27 | + dev_dbg(dev, "CI_HDRC_CONTROLLER_RESET_EVENT received\n"); | |
28 | + writel(0, USB_AHBBURST); | |
29 | + writel(0, USB_AHBMODE); | |
30 | + break; | |
31 | + case CI_HDRC_CONTROLLER_STOPPED_EVENT: | |
32 | + dev_dbg(dev, "CI_HDRC_CONTROLLER_STOPPED_EVENT received\n"); | |
33 | + /* | |
34 | + * Put the transceiver in non-driving mode. Otherwise host | |
35 | + * may not detect soft-disconnection. | |
36 | + */ | |
37 | + val = usb_phy_io_read(ci->transceiver, ULPI_FUNC_CTRL); | |
38 | + val &= ~ULPI_FUNC_CTRL_OPMODE_MASK; | |
39 | + val |= ULPI_FUNC_CTRL_OPMODE_NONDRIVING; | |
40 | + usb_phy_io_write(ci->transceiver, val, ULPI_FUNC_CTRL); | |
41 | + break; | |
42 | + default: | |
43 | + dev_dbg(dev, "unknown ci_hdrc event\n"); | |
44 | + break; | |
45 | + } | |
46 | +} | |
47 | + | |
48 | +static struct ci_hdrc_platform_data ci_hdrc_msm_platdata = { | |
49 | + .name = "ci_hdrc_msm", | |
50 | + .flags = CI_HDRC_REGS_SHARED | | |
51 | + CI_HDRC_REQUIRE_TRANSCEIVER | | |
52 | + CI_HDRC_PULLUP_ON_VBUS | | |
53 | + CI_HDRC_DISABLE_STREAMING, | |
54 | + | |
55 | + .notify_event = ci_hdrc_msm_notify_event, | |
56 | +}; | |
57 | + | |
58 | +static int ci_hdrc_msm_probe(struct platform_device *pdev) | |
59 | +{ | |
60 | + struct platform_device *plat_ci; | |
61 | + | |
62 | + dev_dbg(&pdev->dev, "ci_hdrc_msm_probe\n"); | |
63 | + | |
64 | + plat_ci = ci_hdrc_add_device(&pdev->dev, | |
65 | + pdev->resource, pdev->num_resources, | |
66 | + &ci_hdrc_msm_platdata); | |
67 | + if (IS_ERR(plat_ci)) { | |
68 | + dev_err(&pdev->dev, "ci_hdrc_add_device failed!\n"); | |
69 | + return PTR_ERR(plat_ci); | |
70 | + } | |
71 | + | |
72 | + platform_set_drvdata(pdev, plat_ci); | |
73 | + | |
74 | + pm_runtime_no_callbacks(&pdev->dev); | |
75 | + pm_runtime_enable(&pdev->dev); | |
76 | + | |
77 | + return 0; | |
78 | +} | |
79 | + | |
80 | +static int ci_hdrc_msm_remove(struct platform_device *pdev) | |
81 | +{ | |
82 | + struct platform_device *plat_ci = platform_get_drvdata(pdev); | |
83 | + | |
84 | + pm_runtime_disable(&pdev->dev); | |
85 | + ci_hdrc_remove_device(plat_ci); | |
86 | + | |
87 | + return 0; | |
88 | +} | |
89 | + | |
90 | +static struct platform_driver ci_hdrc_msm_driver = { | |
91 | + .probe = ci_hdrc_msm_probe, | |
92 | + .remove = ci_hdrc_msm_remove, | |
93 | + .driver = { .name = "msm_hsusb", }, | |
94 | +}; | |
95 | + | |
96 | +module_platform_driver(ci_hdrc_msm_driver); | |
97 | + | |
98 | +MODULE_ALIAS("platform:msm_hsusb"); | |
99 | +MODULE_ALIAS("platform:ci13xxx_msm"); | |
100 | +MODULE_LICENSE("GPL v2"); |
drivers/usb/chipidea/ci_hdrc_pci.c
1 | +/* | |
2 | + * ci_hdrc_pci.c - MIPS USB IP core family device controller | |
3 | + * | |
4 | + * Copyright (C) 2008 Chipidea - MIPS Technologies, Inc. All rights reserved. | |
5 | + * | |
6 | + * Author: David Lopo | |
7 | + * | |
8 | + * This program is free software; you can redistribute it and/or modify | |
9 | + * it under the terms of the GNU General Public License version 2 as | |
10 | + * published by the Free Software Foundation. | |
11 | + */ | |
12 | + | |
13 | +#include <linux/platform_device.h> | |
14 | +#include <linux/module.h> | |
15 | +#include <linux/pci.h> | |
16 | +#include <linux/interrupt.h> | |
17 | +#include <linux/usb/gadget.h> | |
18 | +#include <linux/usb/chipidea.h> | |
19 | + | |
20 | +/* driver name */ | |
21 | +#define UDC_DRIVER_NAME "ci_hdrc_pci" | |
22 | + | |
23 | +/****************************************************************************** | |
24 | + * PCI block | |
25 | + *****************************************************************************/ | |
26 | +static struct ci_hdrc_platform_data pci_platdata = { | |
27 | + .name = UDC_DRIVER_NAME, | |
28 | + .capoffset = DEF_CAPOFFSET, | |
29 | +}; | |
30 | + | |
31 | +static struct ci_hdrc_platform_data langwell_pci_platdata = { | |
32 | + .name = UDC_DRIVER_NAME, | |
33 | + .capoffset = 0, | |
34 | +}; | |
35 | + | |
36 | +static struct ci_hdrc_platform_data penwell_pci_platdata = { | |
37 | + .name = UDC_DRIVER_NAME, | |
38 | + .capoffset = 0, | |
39 | + .power_budget = 200, | |
40 | +}; | |
41 | + | |
42 | +/** | |
43 | + * ci_hdrc_pci_probe: PCI probe | |
44 | + * @pdev: USB device controller being probed | |
45 | + * @id: PCI hotplug ID connecting controller to UDC framework | |
46 | + * | |
47 | + * This function returns an error code | |
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 | |
50 | + */ | |
51 | +static int ci_hdrc_pci_probe(struct pci_dev *pdev, | |
52 | + const struct pci_device_id *id) | |
53 | +{ | |
54 | + struct ci_hdrc_platform_data *platdata = (void *)id->driver_data; | |
55 | + struct platform_device *plat_ci; | |
56 | + struct resource res[3]; | |
57 | + int retval = 0, nres = 2; | |
58 | + | |
59 | + if (!platdata) { | |
60 | + dev_err(&pdev->dev, "device doesn't provide driver data\n"); | |
61 | + return -ENODEV; | |
62 | + } | |
63 | + | |
64 | + retval = pcim_enable_device(pdev); | |
65 | + if (retval) | |
66 | + return retval; | |
67 | + | |
68 | + if (!pdev->irq) { | |
69 | + dev_err(&pdev->dev, "No IRQ, check BIOS/PCI setup!"); | |
70 | + return -ENODEV; | |
71 | + } | |
72 | + | |
73 | + pci_set_master(pdev); | |
74 | + pci_try_set_mwi(pdev); | |
75 | + | |
76 | + memset(res, 0, sizeof(res)); | |
77 | + res[0].start = pci_resource_start(pdev, 0); | |
78 | + res[0].end = pci_resource_end(pdev, 0); | |
79 | + res[0].flags = IORESOURCE_MEM; | |
80 | + res[1].start = pdev->irq; | |
81 | + res[1].flags = IORESOURCE_IRQ; | |
82 | + | |
83 | + plat_ci = ci_hdrc_add_device(&pdev->dev, res, nres, platdata); | |
84 | + if (IS_ERR(plat_ci)) { | |
85 | + dev_err(&pdev->dev, "ci_hdrc_add_device failed!\n"); | |
86 | + return PTR_ERR(plat_ci); | |
87 | + } | |
88 | + | |
89 | + pci_set_drvdata(pdev, plat_ci); | |
90 | + | |
91 | + return 0; | |
92 | +} | |
93 | + | |
94 | +/** | |
95 | + * ci_hdrc_pci_remove: PCI remove | |
96 | + * @pdev: USB Device Controller being removed | |
97 | + * | |
98 | + * Reverses the effect of ci_hdrc_pci_probe(), | |
99 | + * first invoking the udc_remove() and then releases | |
100 | + * all PCI resources allocated for this USB device controller | |
101 | + */ | |
102 | +static void ci_hdrc_pci_remove(struct pci_dev *pdev) | |
103 | +{ | |
104 | + struct platform_device *plat_ci = pci_get_drvdata(pdev); | |
105 | + | |
106 | + ci_hdrc_remove_device(plat_ci); | |
107 | +} | |
108 | + | |
109 | +/** | |
110 | + * PCI device table | |
111 | + * PCI device structure | |
112 | + * | |
113 | + * Check "pci.h" for details | |
114 | + */ | |
115 | +static DEFINE_PCI_DEVICE_TABLE(ci_hdrc_pci_id_table) = { | |
116 | + { | |
117 | + PCI_DEVICE(0x153F, 0x1004), | |
118 | + .driver_data = (kernel_ulong_t)&pci_platdata, | |
119 | + }, | |
120 | + { | |
121 | + PCI_DEVICE(0x153F, 0x1006), | |
122 | + .driver_data = (kernel_ulong_t)&pci_platdata, | |
123 | + }, | |
124 | + { | |
125 | + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x0811), | |
126 | + .driver_data = (kernel_ulong_t)&langwell_pci_platdata, | |
127 | + }, | |
128 | + { | |
129 | + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x0829), | |
130 | + .driver_data = (kernel_ulong_t)&penwell_pci_platdata, | |
131 | + }, | |
132 | + { 0, 0, 0, 0, 0, 0, 0 /* end: all zeroes */ } | |
133 | +}; | |
134 | +MODULE_DEVICE_TABLE(pci, ci_hdrc_pci_id_table); | |
135 | + | |
136 | +static struct pci_driver ci_hdrc_pci_driver = { | |
137 | + .name = UDC_DRIVER_NAME, | |
138 | + .id_table = ci_hdrc_pci_id_table, | |
139 | + .probe = ci_hdrc_pci_probe, | |
140 | + .remove = ci_hdrc_pci_remove, | |
141 | +}; | |
142 | + | |
143 | +module_pci_driver(ci_hdrc_pci_driver); | |
144 | + | |
145 | +MODULE_AUTHOR("MIPS - David Lopo <dlopo@chipidea.mips.com>"); | |
146 | +MODULE_DESCRIPTION("MIPS CI13XXX USB Peripheral Controller"); | |
147 | +MODULE_LICENSE("GPL"); | |
148 | +MODULE_VERSION("June 2008"); | |
149 | +MODULE_ALIAS("platform:ci13xxx_pci"); |
drivers/usb/chipidea/core.c
... | ... | @@ -117,7 +117,7 @@ |
117 | 117 | [OP_ENDPTCTRL] = 0x0ECUL, |
118 | 118 | }; |
119 | 119 | |
120 | -static int hw_alloc_regmap(struct ci13xxx *ci, bool is_lpm) | |
120 | +static int hw_alloc_regmap(struct ci_hdrc *ci, bool is_lpm) | |
121 | 121 | { |
122 | 122 | int i; |
123 | 123 | |
... | ... | @@ -149,7 +149,7 @@ |
149 | 149 | * |
150 | 150 | * This function returns an error code |
151 | 151 | */ |
152 | -int hw_port_test_set(struct ci13xxx *ci, u8 mode) | |
152 | +int hw_port_test_set(struct ci_hdrc *ci, u8 mode) | |
153 | 153 | { |
154 | 154 | const u8 TEST_MODE_MAX = 7; |
155 | 155 | |
156 | 156 | |
... | ... | @@ -165,12 +165,12 @@ |
165 | 165 | * |
166 | 166 | * This function returns port test mode value |
167 | 167 | */ |
168 | -u8 hw_port_test_get(struct ci13xxx *ci) | |
168 | +u8 hw_port_test_get(struct ci_hdrc *ci) | |
169 | 169 | { |
170 | 170 | return hw_read(ci, OP_PORTSC, PORTSC_PTC) >> __ffs(PORTSC_PTC); |
171 | 171 | } |
172 | 172 | |
173 | -static int hw_device_init(struct ci13xxx *ci, void __iomem *base) | |
173 | +static int hw_device_init(struct ci_hdrc *ci, void __iomem *base) | |
174 | 174 | { |
175 | 175 | u32 reg; |
176 | 176 | |
... | ... | @@ -209,7 +209,7 @@ |
209 | 209 | return 0; |
210 | 210 | } |
211 | 211 | |
212 | -static void hw_phymode_configure(struct ci13xxx *ci) | |
212 | +static void hw_phymode_configure(struct ci_hdrc *ci) | |
213 | 213 | { |
214 | 214 | u32 portsc, lpm, sts; |
215 | 215 | |
... | ... | @@ -254,7 +254,7 @@ |
254 | 254 | * |
255 | 255 | * This function returns an error code |
256 | 256 | */ |
257 | -int hw_device_reset(struct ci13xxx *ci, u32 mode) | |
257 | +int hw_device_reset(struct ci_hdrc *ci, u32 mode) | |
258 | 258 | { |
259 | 259 | /* should flush & stop before reset */ |
260 | 260 | hw_write(ci, OP_ENDPTFLUSH, ~0, ~0); |
261 | 261 | |
... | ... | @@ -268,9 +268,9 @@ |
268 | 268 | |
269 | 269 | if (ci->platdata->notify_event) |
270 | 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 | 274 | hw_write(ci, OP_USBMODE, USBMODE_CI_SDIS, USBMODE_CI_SDIS); |
275 | 275 | |
276 | 276 | /* USBMODE should be configured step by step */ |
... | ... | @@ -292,7 +292,7 @@ |
292 | 292 | * ci_otg_role - pick role based on ID pin state |
293 | 293 | * @ci: the controller |
294 | 294 | */ |
295 | -static enum ci_role ci_otg_role(struct ci13xxx *ci) | |
295 | +static enum ci_role ci_otg_role(struct ci_hdrc *ci) | |
296 | 296 | { |
297 | 297 | u32 sts = hw_read(ci, OP_OTGSC, ~0); |
298 | 298 | enum ci_role role = sts & OTGSC_ID |
... | ... | @@ -308,7 +308,7 @@ |
308 | 308 | */ |
309 | 309 | static 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 | 312 | enum ci_role role = ci_otg_role(ci); |
313 | 313 | |
314 | 314 | if (role != ci->role) { |
... | ... | @@ -324,7 +324,7 @@ |
324 | 324 | |
325 | 325 | static irqreturn_t ci_irq(int irq, void *data) |
326 | 326 | { |
327 | - struct ci13xxx *ci = data; | |
327 | + struct ci_hdrc *ci = data; | |
328 | 328 | irqreturn_t ret = IRQ_NONE; |
329 | 329 | u32 otgsc = 0; |
330 | 330 | |
331 | 331 | |
... | ... | @@ -346,9 +346,9 @@ |
346 | 346 | |
347 | 347 | static DEFINE_IDA(ci_ida); |
348 | 348 | |
349 | -struct platform_device *ci13xxx_add_device(struct device *dev, | |
349 | +struct platform_device *ci_hdrc_add_device(struct device *dev, | |
350 | 350 | struct resource *res, int nres, |
351 | - struct ci13xxx_platform_data *platdata) | |
351 | + struct ci_hdrc_platform_data *platdata) | |
352 | 352 | { |
353 | 353 | struct platform_device *pdev; |
354 | 354 | int id, ret; |
355 | 355 | |
356 | 356 | |
357 | 357 | |
... | ... | @@ -388,20 +388,20 @@ |
388 | 388 | ida_simple_remove(&ci_ida, id); |
389 | 389 | return ERR_PTR(ret); |
390 | 390 | } |
391 | -EXPORT_SYMBOL_GPL(ci13xxx_add_device); | |
391 | +EXPORT_SYMBOL_GPL(ci_hdrc_add_device); | |
392 | 392 | |
393 | -void ci13xxx_remove_device(struct platform_device *pdev) | |
393 | +void ci_hdrc_remove_device(struct platform_device *pdev) | |
394 | 394 | { |
395 | 395 | int id = pdev->id; |
396 | 396 | platform_device_unregister(pdev); |
397 | 397 | ida_simple_remove(&ci_ida, id); |
398 | 398 | } |
399 | -EXPORT_SYMBOL_GPL(ci13xxx_remove_device); | |
399 | +EXPORT_SYMBOL_GPL(ci_hdrc_remove_device); | |
400 | 400 | |
401 | 401 | static int ci_hdrc_probe(struct platform_device *pdev) |
402 | 402 | { |
403 | 403 | struct device *dev = &pdev->dev; |
404 | - struct ci13xxx *ci; | |
404 | + struct ci_hdrc *ci; | |
405 | 405 | struct resource *res; |
406 | 406 | void __iomem *base; |
407 | 407 | int ret; |
... | ... | @@ -526,7 +526,7 @@ |
526 | 526 | |
527 | 527 | static 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 | 531 | dbg_remove_files(ci); |
532 | 532 | flush_workqueue(ci->wq); |
drivers/usb/chipidea/debug.c
... | ... | @@ -18,7 +18,7 @@ |
18 | 18 | */ |
19 | 19 | static 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 | 22 | struct usb_gadget *gadget = &ci->gadget; |
23 | 23 | |
24 | 24 | seq_printf(s, "speed = %d\n", gadget->speed); |
... | ... | @@ -58,7 +58,7 @@ |
58 | 58 | */ |
59 | 59 | static 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 | 62 | unsigned long flags; |
63 | 63 | unsigned mode; |
64 | 64 | |
... | ... | @@ -78,7 +78,7 @@ |
78 | 78 | size_t count, loff_t *ppos) |
79 | 79 | { |
80 | 80 | struct seq_file *s = file->private_data; |
81 | - struct ci13xxx *ci = s->private; | |
81 | + struct ci_hdrc *ci = s->private; | |
82 | 82 | unsigned long flags; |
83 | 83 | unsigned mode; |
84 | 84 | char buf[32]; |
... | ... | @@ -115,7 +115,7 @@ |
115 | 115 | */ |
116 | 116 | static 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 | 119 | unsigned long flags; |
120 | 120 | unsigned i, j; |
121 | 121 | |
122 | 122 | |
... | ... | @@ -126,12 +126,12 @@ |
126 | 126 | |
127 | 127 | spin_lock_irqsave(&ci->lock, flags); |
128 | 128 | for (i = 0; i < ci->hw_ep_max/2; i++) { |
129 | - struct ci13xxx_ep *hweprx = &ci->ci13xxx_ep[i]; | |
130 | - struct ci13xxx_ep *hweptx = | |
131 | - &ci->ci13xxx_ep[i + ci->hw_ep_max/2]; | |
129 | + struct ci_hw_ep *hweprx = &ci->ci_hw_ep[i]; | |
130 | + struct ci_hw_ep *hweptx = | |
131 | + &ci->ci_hw_ep[i + ci->hw_ep_max/2]; | |
132 | 132 | seq_printf(s, "EP=%02i: RX=%08X TX=%08X\n", |
133 | 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 | 135 | seq_printf(s, " %04X: %08X %08X\n", j, |
136 | 136 | *((u32 *)hweprx->qh.ptr + j), |
137 | 137 | *((u32 *)hweptx->qh.ptr + j)); |
138 | 138 | |
139 | 139 | |
... | ... | @@ -158,12 +158,12 @@ |
158 | 158 | */ |
159 | 159 | static 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 | 162 | unsigned long flags; |
163 | 163 | struct list_head *ptr = NULL; |
164 | - struct ci13xxx_req *req = NULL; | |
164 | + struct ci_hw_req *req = NULL; | |
165 | 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 | 168 | if (ci->role != CI_ROLE_GADGET) { |
169 | 169 | seq_printf(s, "not in gadget mode\n"); |
... | ... | @@ -172,8 +172,8 @@ |
172 | 172 | |
173 | 173 | spin_lock_irqsave(&ci->lock, flags); |
174 | 174 | for (i = 0; i < ci->hw_ep_max; i++) |
175 | - list_for_each(ptr, &ci->ci13xxx_ep[i].qh.queue) { | |
176 | - req = list_entry(ptr, struct ci13xxx_req, queue); | |
175 | + list_for_each(ptr, &ci->ci_hw_ep[i].qh.queue) { | |
176 | + req = list_entry(ptr, struct ci_hw_req, queue); | |
177 | 177 | |
178 | 178 | list_for_each_entry_safe(node, tmpnode, &req->tds, td) { |
179 | 179 | seq_printf(s, "EP=%02i: TD=%08X %s\n", |
... | ... | @@ -206,7 +206,7 @@ |
206 | 206 | |
207 | 207 | static 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 | 211 | seq_printf(s, "%s\n", ci_role(ci)->name); |
212 | 212 | |
... | ... | @@ -217,7 +217,7 @@ |
217 | 217 | size_t count, loff_t *ppos) |
218 | 218 | { |
219 | 219 | struct seq_file *s = file->private_data; |
220 | - struct ci13xxx *ci = s->private; | |
220 | + struct ci_hdrc *ci = s->private; | |
221 | 221 | enum ci_role role; |
222 | 222 | char buf[8]; |
223 | 223 | int ret; |
... | ... | @@ -259,7 +259,7 @@ |
259 | 259 | * |
260 | 260 | * This function returns an error code |
261 | 261 | */ |
262 | -int dbg_create_files(struct ci13xxx *ci) | |
262 | +int dbg_create_files(struct ci_hdrc *ci) | |
263 | 263 | { |
264 | 264 | struct dentry *dent; |
265 | 265 | |
... | ... | @@ -300,7 +300,7 @@ |
300 | 300 | * dbg_remove_files: destroys the attribute interface |
301 | 301 | * @ci: device |
302 | 302 | */ |
303 | -void dbg_remove_files(struct ci13xxx *ci) | |
303 | +void dbg_remove_files(struct ci_hdrc *ci) | |
304 | 304 | { |
305 | 305 | debugfs_remove_recursive(ci->debugfs); |
306 | 306 | } |
drivers/usb/chipidea/debug.h
... | ... | @@ -14,15 +14,15 @@ |
14 | 14 | #define __DRIVERS_USB_CHIPIDEA_DEBUG_H |
15 | 15 | |
16 | 16 | #ifdef CONFIG_USB_CHIPIDEA_DEBUG |
17 | -int dbg_create_files(struct ci13xxx *ci); | |
18 | -void dbg_remove_files(struct ci13xxx *ci); | |
17 | +int dbg_create_files(struct ci_hdrc *ci); | |
18 | +void dbg_remove_files(struct ci_hdrc *ci); | |
19 | 19 | #else |
20 | -static inline int dbg_create_files(struct ci13xxx *ci) | |
20 | +static inline int dbg_create_files(struct ci_hdrc *ci) | |
21 | 21 | { |
22 | 22 | return 0; |
23 | 23 | } |
24 | 24 | |
25 | -static inline void dbg_remove_files(struct ci13xxx *ci) | |
25 | +static inline void dbg_remove_files(struct ci_hdrc *ci) | |
26 | 26 | { |
27 | 27 | } |
28 | 28 | #endif |
drivers/usb/chipidea/host.c
... | ... | @@ -33,12 +33,12 @@ |
33 | 33 | |
34 | 34 | static struct hc_driver __read_mostly ci_ehci_hc_driver; |
35 | 35 | |
36 | -static irqreturn_t host_irq(struct ci13xxx *ci) | |
36 | +static irqreturn_t host_irq(struct ci_hdrc *ci) | |
37 | 37 | { |
38 | 38 | return usb_hcd_irq(ci->irq, ci->hcd); |
39 | 39 | } |
40 | 40 | |
41 | -static int host_start(struct ci13xxx *ci) | |
41 | +static int host_start(struct ci_hdrc *ci) | |
42 | 42 | { |
43 | 43 | struct usb_hcd *hcd; |
44 | 44 | struct ehci_hcd *ehci; |
45 | 45 | |
... | ... | @@ -70,13 +70,13 @@ |
70 | 70 | else |
71 | 71 | ci->hcd = hcd; |
72 | 72 | |
73 | - if (ci->platdata->flags & CI13XXX_DISABLE_STREAMING) | |
73 | + if (ci->platdata->flags & CI_HDRC_DISABLE_STREAMING) | |
74 | 74 | hw_write(ci, OP_USBMODE, USBMODE_CI_SDIS, USBMODE_CI_SDIS); |
75 | 75 | |
76 | 76 | return ret; |
77 | 77 | } |
78 | 78 | |
79 | -static void host_stop(struct ci13xxx *ci) | |
79 | +static void host_stop(struct ci_hdrc *ci) | |
80 | 80 | { |
81 | 81 | struct usb_hcd *hcd = ci->hcd; |
82 | 82 | |
... | ... | @@ -84,7 +84,7 @@ |
84 | 84 | usb_put_hcd(hcd); |
85 | 85 | } |
86 | 86 | |
87 | -int ci_hdrc_host_init(struct ci13xxx *ci) | |
87 | +int ci_hdrc_host_init(struct ci_hdrc *ci) | |
88 | 88 | { |
89 | 89 | struct ci_role_driver *rdrv; |
90 | 90 |
drivers/usb/chipidea/host.h
... | ... | @@ -3,11 +3,11 @@ |
3 | 3 | |
4 | 4 | #ifdef CONFIG_USB_CHIPIDEA_HOST |
5 | 5 | |
6 | -int ci_hdrc_host_init(struct ci13xxx *ci); | |
6 | +int ci_hdrc_host_init(struct ci_hdrc *ci); | |
7 | 7 | |
8 | 8 | #else |
9 | 9 | |
10 | -static inline int ci_hdrc_host_init(struct ci13xxx *ci) | |
10 | +static inline int ci_hdrc_host_init(struct ci_hdrc *ci) | |
11 | 11 | { |
12 | 12 | return -ENXIO; |
13 | 13 | } |
drivers/usb/chipidea/udc.c
... | ... | @@ -61,7 +61,7 @@ |
61 | 61 | return num + (dir ? 16 : 0); |
62 | 62 | } |
63 | 63 | |
64 | -static inline int ep_to_bit(struct ci13xxx *ci, int n) | |
64 | +static inline int ep_to_bit(struct ci_hdrc *ci, int n) | |
65 | 65 | { |
66 | 66 | int fill = 16 - ci->hw_ep_max / 2; |
67 | 67 | |
... | ... | @@ -77,7 +77,7 @@ |
77 | 77 | * |
78 | 78 | * This function returns an error code |
79 | 79 | */ |
80 | -static int hw_device_state(struct ci13xxx *ci, u32 dma) | |
80 | +static int hw_device_state(struct ci_hdrc *ci, u32 dma) | |
81 | 81 | { |
82 | 82 | if (dma) { |
83 | 83 | hw_write(ci, OP_ENDPTLISTADDR, ~0, dma); |
... | ... | @@ -97,7 +97,7 @@ |
97 | 97 | * |
98 | 98 | * This function returns an error code |
99 | 99 | */ |
100 | -static int hw_ep_flush(struct ci13xxx *ci, int num, int dir) | |
100 | +static int hw_ep_flush(struct ci_hdrc *ci, int num, int dir) | |
101 | 101 | { |
102 | 102 | int n = hw_ep_bit(num, dir); |
103 | 103 | |
... | ... | @@ -118,7 +118,7 @@ |
118 | 118 | * |
119 | 119 | * This function returns an error code |
120 | 120 | */ |
121 | -static int hw_ep_disable(struct ci13xxx *ci, int num, int dir) | |
121 | +static int hw_ep_disable(struct ci_hdrc *ci, int num, int dir) | |
122 | 122 | { |
123 | 123 | hw_ep_flush(ci, num, dir); |
124 | 124 | hw_write(ci, OP_ENDPTCTRL + num, |
... | ... | @@ -134,7 +134,7 @@ |
134 | 134 | * |
135 | 135 | * This function returns an error code |
136 | 136 | */ |
137 | -static int hw_ep_enable(struct ci13xxx *ci, int num, int dir, int type) | |
137 | +static int hw_ep_enable(struct ci_hdrc *ci, int num, int dir, int type) | |
138 | 138 | { |
139 | 139 | u32 mask, data; |
140 | 140 | |
... | ... | @@ -168,7 +168,7 @@ |
168 | 168 | * |
169 | 169 | * This function returns 1 if endpoint halted |
170 | 170 | */ |
171 | -static int hw_ep_get_halt(struct ci13xxx *ci, int num, int dir) | |
171 | +static int hw_ep_get_halt(struct ci_hdrc *ci, int num, int dir) | |
172 | 172 | { |
173 | 173 | u32 mask = dir ? ENDPTCTRL_TXS : ENDPTCTRL_RXS; |
174 | 174 | |
... | ... | @@ -182,7 +182,7 @@ |
182 | 182 | * |
183 | 183 | * This function returns setup status |
184 | 184 | */ |
185 | -static int hw_test_and_clear_setup_status(struct ci13xxx *ci, int n) | |
185 | +static int hw_test_and_clear_setup_status(struct ci_hdrc *ci, int n) | |
186 | 186 | { |
187 | 187 | n = ep_to_bit(ci, n); |
188 | 188 | return hw_test_and_clear(ci, OP_ENDPTSETUPSTAT, BIT(n)); |
... | ... | @@ -196,7 +196,7 @@ |
196 | 196 | * |
197 | 197 | * This function returns an error code |
198 | 198 | */ |
199 | -static int hw_ep_prime(struct ci13xxx *ci, int num, int dir, int is_ctrl) | |
199 | +static int hw_ep_prime(struct ci_hdrc *ci, int num, int dir, int is_ctrl) | |
200 | 200 | { |
201 | 201 | int n = hw_ep_bit(num, dir); |
202 | 202 | |
203 | 203 | |
... | ... | @@ -223,13 +223,13 @@ |
223 | 223 | * |
224 | 224 | * This function returns an error code |
225 | 225 | */ |
226 | -static int hw_ep_set_halt(struct ci13xxx *ci, int num, int dir, int value) | |
226 | +static int hw_ep_set_halt(struct ci_hdrc *ci, int num, int dir, int value) | |
227 | 227 | { |
228 | 228 | if (value != 0 && value != 1) |
229 | 229 | return -EINVAL; |
230 | 230 | |
231 | 231 | do { |
232 | - enum ci13xxx_regs reg = OP_ENDPTCTRL + num; | |
232 | + enum ci_hw_regs reg = OP_ENDPTCTRL + num; | |
233 | 233 | u32 mask_xs = dir ? ENDPTCTRL_TXS : ENDPTCTRL_RXS; |
234 | 234 | u32 mask_xr = dir ? ENDPTCTRL_TXR : ENDPTCTRL_RXR; |
235 | 235 | |
... | ... | @@ -246,7 +246,7 @@ |
246 | 246 | * |
247 | 247 | * This function returns true if high speed port |
248 | 248 | */ |
249 | -static int hw_port_is_high_speed(struct ci13xxx *ci) | |
249 | +static int hw_port_is_high_speed(struct ci_hdrc *ci) | |
250 | 250 | { |
251 | 251 | return ci->hw_bank.lpm ? hw_read(ci, OP_DEVLC, DEVLC_PSPD) : |
252 | 252 | hw_read(ci, OP_PORTSC, PORTSC_HSP); |
... | ... | @@ -257,7 +257,7 @@ |
257 | 257 | * |
258 | 258 | * This function returns register data |
259 | 259 | */ |
260 | -static u32 hw_read_intr_enable(struct ci13xxx *ci) | |
260 | +static u32 hw_read_intr_enable(struct ci_hdrc *ci) | |
261 | 261 | { |
262 | 262 | return hw_read(ci, OP_USBINTR, ~0); |
263 | 263 | } |
... | ... | @@ -267,7 +267,7 @@ |
267 | 267 | * |
268 | 268 | * This function returns register data |
269 | 269 | */ |
270 | -static u32 hw_read_intr_status(struct ci13xxx *ci) | |
270 | +static u32 hw_read_intr_status(struct ci_hdrc *ci) | |
271 | 271 | { |
272 | 272 | return hw_read(ci, OP_USBSTS, ~0); |
273 | 273 | } |
... | ... | @@ -279,7 +279,7 @@ |
279 | 279 | * |
280 | 280 | * This function returns complete status |
281 | 281 | */ |
282 | -static int hw_test_and_clear_complete(struct ci13xxx *ci, int n) | |
282 | +static int hw_test_and_clear_complete(struct ci_hdrc *ci, int n) | |
283 | 283 | { |
284 | 284 | n = ep_to_bit(ci, n); |
285 | 285 | return hw_test_and_clear(ci, OP_ENDPTCOMPLETE, BIT(n)); |
... | ... | @@ -291,7 +291,7 @@ |
291 | 291 | * |
292 | 292 | * This function returns active interrutps |
293 | 293 | */ |
294 | -static u32 hw_test_and_clear_intr_active(struct ci13xxx *ci) | |
294 | +static u32 hw_test_and_clear_intr_active(struct ci_hdrc *ci) | |
295 | 295 | { |
296 | 296 | u32 reg = hw_read_intr_status(ci) & hw_read_intr_enable(ci); |
297 | 297 | |
... | ... | @@ -305,7 +305,7 @@ |
305 | 305 | * |
306 | 306 | * This function returns guard value |
307 | 307 | */ |
308 | -static int hw_test_and_clear_setup_guard(struct ci13xxx *ci) | |
308 | +static int hw_test_and_clear_setup_guard(struct ci_hdrc *ci) | |
309 | 309 | { |
310 | 310 | return hw_test_and_write(ci, OP_USBCMD, USBCMD_SUTW, 0); |
311 | 311 | } |
... | ... | @@ -316,7 +316,7 @@ |
316 | 316 | * |
317 | 317 | * This function returns guard value |
318 | 318 | */ |
319 | -static int hw_test_and_set_setup_guard(struct ci13xxx *ci) | |
319 | +static int hw_test_and_set_setup_guard(struct ci_hdrc *ci) | |
320 | 320 | { |
321 | 321 | return hw_test_and_write(ci, OP_USBCMD, USBCMD_SUTW, USBCMD_SUTW); |
322 | 322 | } |
... | ... | @@ -328,7 +328,7 @@ |
328 | 328 | * This function explicitly sets the address, without the "USBADRA" (advance) |
329 | 329 | * feature, which is not supported by older versions of the controller. |
330 | 330 | */ |
331 | -static void hw_usb_set_address(struct ci13xxx *ci, u8 value) | |
331 | +static void hw_usb_set_address(struct ci_hdrc *ci, u8 value) | |
332 | 332 | { |
333 | 333 | hw_write(ci, OP_DEVICEADDR, DEVICEADDR_USBADR, |
334 | 334 | value << __ffs(DEVICEADDR_USBADR)); |
... | ... | @@ -340,7 +340,7 @@ |
340 | 340 | * |
341 | 341 | * This function returns an error code |
342 | 342 | */ |
343 | -static int hw_usb_reset(struct ci13xxx *ci) | |
343 | +static int hw_usb_reset(struct ci_hdrc *ci) | |
344 | 344 | { |
345 | 345 | hw_usb_set_address(ci, 0); |
346 | 346 | |
... | ... | @@ -369,7 +369,7 @@ |
369 | 369 | * UTIL block |
370 | 370 | *****************************************************************************/ |
371 | 371 | |
372 | -static int add_td_to_list(struct ci13xxx_ep *hwep, struct ci13xxx_req *hwreq, | |
372 | +static int add_td_to_list(struct ci_hw_ep *hwep, struct ci_hw_req *hwreq, | |
373 | 373 | unsigned length) |
374 | 374 | { |
375 | 375 | int i; |
... | ... | @@ -387,7 +387,7 @@ |
387 | 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 | 391 | node->ptr->token = cpu_to_le32(length << __ffs(TD_TOTAL_BYTES)); |
392 | 392 | node->ptr->token &= cpu_to_le32(TD_TOTAL_BYTES); |
393 | 393 | node->ptr->token |= cpu_to_le32(TD_STATUS_ACTIVE); |
... | ... | @@ -396,7 +396,7 @@ |
396 | 396 | if (length) { |
397 | 397 | node->ptr->page[0] = cpu_to_le32(temp); |
398 | 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 | 400 | page &= ~TD_RESERVED_MASK; |
401 | 401 | node->ptr->page[i] = cpu_to_le32(page); |
402 | 402 | } |
... | ... | @@ -421,7 +421,7 @@ |
421 | 421 | * _usb_addr: calculates endpoint address from direction & number |
422 | 422 | * @ep: endpoint |
423 | 423 | */ |
424 | -static inline u8 _usb_addr(struct ci13xxx_ep *ep) | |
424 | +static inline u8 _usb_addr(struct ci_hw_ep *ep) | |
425 | 425 | { |
426 | 426 | return ((ep->dir == TX) ? USB_ENDPOINT_DIR_MASK : 0) | ep->num; |
427 | 427 | } |
428 | 428 | |
... | ... | @@ -433,9 +433,9 @@ |
433 | 433 | * |
434 | 434 | * This function returns an error code |
435 | 435 | */ |
436 | -static int _hardware_enqueue(struct ci13xxx_ep *hwep, struct ci13xxx_req *hwreq) | |
436 | +static 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 | 439 | int ret = 0; |
440 | 440 | unsigned rest = hwreq->req.length; |
441 | 441 | int pages = TD_PAGE_COUNT; |
... | ... | @@ -463,7 +463,7 @@ |
463 | 463 | |
464 | 464 | while (rest > 0) { |
465 | 465 | unsigned count = min(hwreq->req.length - hwreq->req.actual, |
466 | - (unsigned)(pages * CI13XXX_PAGE_SIZE)); | |
466 | + (unsigned)(pages * CI_HDRC_PAGE_SIZE)); | |
467 | 467 | add_td_to_list(hwep, hwreq, count); |
468 | 468 | rest -= count; |
469 | 469 | } |
470 | 470 | |
... | ... | @@ -484,14 +484,14 @@ |
484 | 484 | |
485 | 485 | hwreq->req.actual = 0; |
486 | 486 | if (!list_empty(&hwep->qh.queue)) { |
487 | - struct ci13xxx_req *hwreqprev; | |
487 | + struct ci_hw_req *hwreqprev; | |
488 | 488 | int n = hw_ep_bit(hwep->num, hwep->dir); |
489 | 489 | int tmp_stat; |
490 | 490 | struct td_node *prevlastnode; |
491 | 491 | u32 next = firstnode->dma & TD_ADDR_MASK; |
492 | 492 | |
493 | 493 | hwreqprev = list_entry(hwep->qh.queue.prev, |
494 | - struct ci13xxx_req, queue); | |
494 | + struct ci_hw_req, queue); | |
495 | 495 | prevlastnode = list_entry(hwreqprev->tds.prev, |
496 | 496 | struct td_node, td); |
497 | 497 | |
... | ... | @@ -533,7 +533,7 @@ |
533 | 533 | * free_pending_td: remove a pending request for the endpoint |
534 | 534 | * @hwep: endpoint |
535 | 535 | */ |
536 | -static void free_pending_td(struct ci13xxx_ep *hwep) | |
536 | +static void free_pending_td(struct ci_hw_ep *hwep) | |
537 | 537 | { |
538 | 538 | struct td_node *pending = hwep->pending_td; |
539 | 539 | |
... | ... | @@ -549,7 +549,7 @@ |
549 | 549 | * |
550 | 550 | * This function returns an error code |
551 | 551 | */ |
552 | -static int _hardware_dequeue(struct ci13xxx_ep *hwep, struct ci13xxx_req *hwreq) | |
552 | +static int _hardware_dequeue(struct ci_hw_ep *hwep, struct ci_hw_req *hwreq) | |
553 | 553 | { |
554 | 554 | u32 tmptoken; |
555 | 555 | struct td_node *node, *tmpnode; |
... | ... | @@ -619,7 +619,7 @@ |
619 | 619 | * This function returns an error code |
620 | 620 | * Caller must hold lock |
621 | 621 | */ |
622 | -static int _ep_nuke(struct ci13xxx_ep *hwep) | |
622 | +static int _ep_nuke(struct ci_hw_ep *hwep) | |
623 | 623 | __releases(hwep->lock) |
624 | 624 | __acquires(hwep->lock) |
625 | 625 | { |
... | ... | @@ -632,9 +632,8 @@ |
632 | 632 | while (!list_empty(&hwep->qh.queue)) { |
633 | 633 | |
634 | 634 | /* pop oldest request */ |
635 | - struct ci13xxx_req *hwreq = list_entry(hwep->qh.queue.next, | |
636 | - struct ci13xxx_req, | |
637 | - queue); | |
635 | + struct ci_hw_req *hwreq = list_entry(hwep->qh.queue.next, | |
636 | + struct ci_hw_req, queue); | |
638 | 637 | |
639 | 638 | list_for_each_entry_safe(node, tmpnode, &hwreq->tds, td) { |
640 | 639 | dma_pool_free(hwep->td_pool, node->ptr, node->dma); |
... | ... | @@ -668,7 +667,7 @@ |
668 | 667 | static int _gadget_stop_activity(struct usb_gadget *gadget) |
669 | 668 | { |
670 | 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 | 671 | unsigned long flags; |
673 | 672 | |
674 | 673 | spin_lock_irqsave(&ci->lock, flags); |
... | ... | @@ -709,7 +708,7 @@ |
709 | 708 | * |
710 | 709 | * This function resets USB engine after a bus reset occurred |
711 | 710 | */ |
712 | -static void isr_reset_handler(struct ci13xxx *ci) | |
711 | +static void isr_reset_handler(struct ci_hdrc *ci) | |
713 | 712 | __releases(ci->lock) |
714 | 713 | __acquires(ci->lock) |
715 | 714 | { |
... | ... | @@ -759,9 +758,9 @@ |
759 | 758 | static int _ep_queue(struct usb_ep *ep, struct usb_request *req, |
760 | 759 | gfp_t __maybe_unused gfp_flags) |
761 | 760 | { |
762 | - struct ci13xxx_ep *hwep = container_of(ep, struct ci13xxx_ep, ep); | |
763 | - struct ci13xxx_req *hwreq = container_of(req, struct ci13xxx_req, req); | |
764 | - struct ci13xxx *ci = hwep->ci; | |
761 | + struct ci_hw_ep *hwep = container_of(ep, struct ci_hw_ep, ep); | |
762 | + struct ci_hw_req *hwreq = container_of(req, struct ci_hw_req, req); | |
763 | + struct ci_hdrc *ci = hwep->ci; | |
765 | 764 | int retval = 0; |
766 | 765 | |
767 | 766 | if (ep == NULL || req == NULL || hwep->ep.desc == NULL) |
768 | 767 | |
... | ... | @@ -812,12 +811,12 @@ |
812 | 811 | * |
813 | 812 | * This function returns an error code |
814 | 813 | */ |
815 | -static int isr_get_status_response(struct ci13xxx *ci, | |
814 | +static int isr_get_status_response(struct ci_hdrc *ci, | |
816 | 815 | struct usb_ctrlrequest *setup) |
817 | 816 | __releases(hwep->lock) |
818 | 817 | __acquires(hwep->lock) |
819 | 818 | { |
820 | - struct ci13xxx_ep *hwep = ci->ep0in; | |
819 | + struct ci_hw_ep *hwep = ci->ep0in; | |
821 | 820 | struct usb_request *req = NULL; |
822 | 821 | gfp_t gfp_flags = GFP_ATOMIC; |
823 | 822 | int dir, num, retval; |
... | ... | @@ -878,7 +877,7 @@ |
878 | 877 | static void |
879 | 878 | isr_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 | 881 | unsigned long flags; |
883 | 882 | |
884 | 883 | if (ci->setaddr) { |
885 | 884 | |
... | ... | @@ -898,10 +897,10 @@ |
898 | 897 | * |
899 | 898 | * This function returns an error code |
900 | 899 | */ |
901 | -static int isr_setup_status_phase(struct ci13xxx *ci) | |
900 | +static int isr_setup_status_phase(struct ci_hdrc *ci) | |
902 | 901 | { |
903 | 902 | int retval; |
904 | - struct ci13xxx_ep *hwep; | |
903 | + struct ci_hw_ep *hwep; | |
905 | 904 | |
906 | 905 | hwep = (ci->ep0_dir == TX) ? ci->ep0out : ci->ep0in; |
907 | 906 | ci->status->context = ci; |
908 | 907 | |
... | ... | @@ -919,12 +918,12 @@ |
919 | 918 | * This function returns an error code |
920 | 919 | * Caller must hold lock |
921 | 920 | */ |
922 | -static int isr_tr_complete_low(struct ci13xxx_ep *hwep) | |
921 | +static int isr_tr_complete_low(struct ci_hw_ep *hwep) | |
923 | 922 | __releases(hwep->lock) |
924 | 923 | __acquires(hwep->lock) |
925 | 924 | { |
926 | - struct ci13xxx_req *hwreq, *hwreqtemp; | |
927 | - struct ci13xxx_ep *hweptemp = hwep; | |
925 | + struct ci_hw_req *hwreq, *hwreqtemp; | |
926 | + struct ci_hw_ep *hweptemp = hwep; | |
928 | 927 | int retval = 0; |
929 | 928 | |
930 | 929 | list_for_each_entry_safe(hwreq, hwreqtemp, &hwep->qh.queue, |
... | ... | @@ -955,7 +954,7 @@ |
955 | 954 | * |
956 | 955 | * This function handles traffic events |
957 | 956 | */ |
958 | -static void isr_tr_complete_handler(struct ci13xxx *ci) | |
957 | +static void isr_tr_complete_handler(struct ci_hdrc *ci) | |
959 | 958 | __releases(ci->lock) |
960 | 959 | __acquires(ci->lock) |
961 | 960 | { |
... | ... | @@ -963,7 +962,7 @@ |
963 | 962 | u8 tmode = 0; |
964 | 963 | |
965 | 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 | 966 | int type, num, dir, err = -EINVAL; |
968 | 967 | struct usb_ctrlrequest req; |
969 | 968 | |
970 | 969 | |
... | ... | @@ -1023,10 +1022,10 @@ |
1023 | 1022 | num &= USB_ENDPOINT_NUMBER_MASK; |
1024 | 1023 | if (dir) /* TX */ |
1025 | 1024 | num += ci->hw_ep_max/2; |
1026 | - if (!ci->ci13xxx_ep[num].wedge) { | |
1025 | + if (!ci->ci_hw_ep[num].wedge) { | |
1027 | 1026 | spin_unlock(&ci->lock); |
1028 | 1027 | err = usb_ep_clear_halt( |
1029 | - &ci->ci13xxx_ep[num].ep); | |
1028 | + &ci->ci_hw_ep[num].ep); | |
1030 | 1029 | spin_lock(&ci->lock); |
1031 | 1030 | if (err) |
1032 | 1031 | break; |
... | ... | @@ -1076,7 +1075,7 @@ |
1076 | 1075 | num += ci->hw_ep_max/2; |
1077 | 1076 | |
1078 | 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 | 1079 | spin_lock(&ci->lock); |
1081 | 1080 | if (!err) |
1082 | 1081 | isr_setup_status_phase(ci); |
... | ... | @@ -1141,7 +1140,7 @@ |
1141 | 1140 | static int ep_enable(struct usb_ep *ep, |
1142 | 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 | 1144 | int retval = 0; |
1146 | 1145 | unsigned long flags; |
1147 | 1146 | u32 cap = 0; |
... | ... | @@ -1194,7 +1193,7 @@ |
1194 | 1193 | */ |
1195 | 1194 | static 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 | 1197 | int direction, retval = 0; |
1199 | 1198 | unsigned long flags; |
1200 | 1199 | |
1201 | 1200 | |
... | ... | @@ -1230,12 +1229,12 @@ |
1230 | 1229 | */ |
1231 | 1230 | static 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 | 1234 | if (ep == NULL) |
1236 | 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 | 1238 | if (hwreq != NULL) { |
1240 | 1239 | INIT_LIST_HEAD(&hwreq->queue); |
1241 | 1240 | INIT_LIST_HEAD(&hwreq->tds); |
... | ... | @@ -1251,8 +1250,8 @@ |
1251 | 1250 | */ |
1252 | 1251 | static 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); | |
1255 | - struct ci13xxx_req *hwreq = container_of(req, struct ci13xxx_req, req); | |
1253 | + struct ci_hw_ep *hwep = container_of(ep, struct ci_hw_ep, ep); | |
1254 | + struct ci_hw_req *hwreq = container_of(req, struct ci_hw_req, req); | |
1256 | 1255 | struct td_node *node, *tmpnode; |
1257 | 1256 | unsigned long flags; |
1258 | 1257 | |
... | ... | @@ -1285,7 +1284,7 @@ |
1285 | 1284 | static int ep_queue(struct usb_ep *ep, struct usb_request *req, |
1286 | 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 | 1288 | int retval = 0; |
1290 | 1289 | unsigned long flags; |
1291 | 1290 | |
... | ... | @@ -1305,8 +1304,8 @@ |
1305 | 1304 | */ |
1306 | 1305 | static 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); | |
1309 | - struct ci13xxx_req *hwreq = container_of(req, struct ci13xxx_req, req); | |
1307 | + struct ci_hw_ep *hwep = container_of(ep, struct ci_hw_ep, ep); | |
1308 | + struct ci_hw_req *hwreq = container_of(req, struct ci_hw_req, req); | |
1310 | 1309 | unsigned long flags; |
1311 | 1310 | |
1312 | 1311 | if (ep == NULL || req == NULL || hwreq->req.status != -EALREADY || |
... | ... | @@ -1342,7 +1341,7 @@ |
1342 | 1341 | */ |
1343 | 1342 | static 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 | 1345 | int direction, retval = 0; |
1347 | 1346 | unsigned long flags; |
1348 | 1347 | |
... | ... | @@ -1386,7 +1385,7 @@ |
1386 | 1385 | */ |
1387 | 1386 | static 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 | 1389 | unsigned long flags; |
1391 | 1390 | |
1392 | 1391 | if (ep == NULL || hwep->ep.desc == NULL) |
... | ... | @@ -1406,7 +1405,7 @@ |
1406 | 1405 | */ |
1407 | 1406 | static 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 | 1409 | unsigned long flags; |
1411 | 1410 | |
1412 | 1411 | if (ep == NULL) { |
1413 | 1412 | |
1414 | 1413 | |
... | ... | @@ -1440,13 +1439,13 @@ |
1440 | 1439 | /****************************************************************************** |
1441 | 1440 | * GADGET block |
1442 | 1441 | *****************************************************************************/ |
1443 | -static int ci13xxx_vbus_session(struct usb_gadget *_gadget, int is_active) | |
1442 | +static 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 | 1445 | unsigned long flags; |
1447 | 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 | 1449 | return -EOPNOTSUPP; |
1451 | 1450 | |
1452 | 1451 | spin_lock_irqsave(&ci->lock, flags); |
... | ... | @@ -1464,7 +1463,7 @@ |
1464 | 1463 | hw_device_state(ci, 0); |
1465 | 1464 | if (ci->platdata->notify_event) |
1466 | 1465 | ci->platdata->notify_event(ci, |
1467 | - CI13XXX_CONTROLLER_STOPPED_EVENT); | |
1466 | + CI_HDRC_CONTROLLER_STOPPED_EVENT); | |
1468 | 1467 | _gadget_stop_activity(&ci->gadget); |
1469 | 1468 | pm_runtime_put_sync(&_gadget->dev); |
1470 | 1469 | } |
1471 | 1470 | |
... | ... | @@ -1473,9 +1472,9 @@ |
1473 | 1472 | return 0; |
1474 | 1473 | } |
1475 | 1474 | |
1476 | -static int ci13xxx_wakeup(struct usb_gadget *_gadget) | |
1475 | +static 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 | 1478 | unsigned long flags; |
1480 | 1479 | int ret = 0; |
1481 | 1480 | |
1482 | 1481 | |
... | ... | @@ -1494,9 +1493,9 @@ |
1494 | 1493 | return ret; |
1495 | 1494 | } |
1496 | 1495 | |
1497 | -static int ci13xxx_vbus_draw(struct usb_gadget *_gadget, unsigned ma) | |
1496 | +static 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 | 1500 | if (ci->transceiver) |
1502 | 1501 | return usb_phy_set_power(ci->transceiver, ma); |
1503 | 1502 | |
... | ... | @@ -1506,9 +1505,9 @@ |
1506 | 1505 | /* Change Data+ pullup status |
1507 | 1506 | * this func is used by usb_gadget_connect/disconnet |
1508 | 1507 | */ |
1509 | -static int ci13xxx_pullup(struct usb_gadget *_gadget, int is_on) | |
1508 | +static 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 | 1512 | if (is_on) |
1514 | 1513 | hw_write(ci, OP_USBCMD, USBCMD_RS, USBCMD_RS); |
1515 | 1514 | |
... | ... | @@ -1518,9 +1517,9 @@ |
1518 | 1517 | return 0; |
1519 | 1518 | } |
1520 | 1519 | |
1521 | -static int ci13xxx_start(struct usb_gadget *gadget, | |
1520 | +static int ci_udc_start(struct usb_gadget *gadget, | |
1522 | 1521 | struct usb_gadget_driver *driver); |
1523 | -static int ci13xxx_stop(struct usb_gadget *gadget, | |
1522 | +static int ci_udc_stop(struct usb_gadget *gadget, | |
1524 | 1523 | struct usb_gadget_driver *driver); |
1525 | 1524 | /** |
1526 | 1525 | * Device operations part of the API to the USB controller hardware, |
1527 | 1526 | |
1528 | 1527 | |
... | ... | @@ -1528,22 +1527,22 @@ |
1528 | 1527 | * Check "usb_gadget.h" for details |
1529 | 1528 | */ |
1530 | 1529 | static const struct usb_gadget_ops usb_gadget_ops = { |
1531 | - .vbus_session = ci13xxx_vbus_session, | |
1532 | - .wakeup = ci13xxx_wakeup, | |
1533 | - .pullup = ci13xxx_pullup, | |
1534 | - .vbus_draw = ci13xxx_vbus_draw, | |
1535 | - .udc_start = ci13xxx_start, | |
1536 | - .udc_stop = ci13xxx_stop, | |
1530 | + .vbus_session = ci_udc_vbus_session, | |
1531 | + .wakeup = ci_udc_wakeup, | |
1532 | + .pullup = ci_udc_pullup, | |
1533 | + .vbus_draw = ci_udc_vbus_draw, | |
1534 | + .udc_start = ci_udc_start, | |
1535 | + .udc_stop = ci_udc_stop, | |
1537 | 1536 | }; |
1538 | 1537 | |
1539 | -static int init_eps(struct ci13xxx *ci) | |
1538 | +static int init_eps(struct ci_hdrc *ci) | |
1540 | 1539 | { |
1541 | 1540 | int retval = 0, i, j; |
1542 | 1541 | |
1543 | 1542 | for (i = 0; i < ci->hw_ep_max/2; i++) |
1544 | 1543 | for (j = RX; j <= TX; j++) { |
1545 | 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 | 1547 | scnprintf(hwep->name, sizeof(hwep->name), "ep%i%s", i, |
1549 | 1548 | (j == TX) ? "in" : "out"); |
1550 | 1549 | |
1551 | 1550 | |
1552 | 1551 | |
1553 | 1552 | |
... | ... | @@ -1589,28 +1588,28 @@ |
1589 | 1588 | return retval; |
1590 | 1589 | } |
1591 | 1590 | |
1592 | -static void destroy_eps(struct ci13xxx *ci) | |
1591 | +static void destroy_eps(struct ci_hdrc *ci) | |
1593 | 1592 | { |
1594 | 1593 | int i; |
1595 | 1594 | |
1596 | 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 | 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 | 1604 | * @gadget: our gadget |
1606 | 1605 | * @driver: the driver being registered |
1607 | 1606 | * |
1608 | 1607 | * Interrupts are enabled here. |
1609 | 1608 | */ |
1610 | -static int ci13xxx_start(struct usb_gadget *gadget, | |
1609 | +static int ci_udc_start(struct usb_gadget *gadget, | |
1611 | 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 | 1613 | unsigned long flags; |
1615 | 1614 | int retval = -ENOMEM; |
1616 | 1615 | |
1617 | 1616 | |
... | ... | @@ -1631,9 +1630,9 @@ |
1631 | 1630 | |
1632 | 1631 | ci->driver = driver; |
1633 | 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 | 1634 | if (ci->vbus_active) { |
1636 | - if (ci->platdata->flags & CI13XXX_REGS_SHARED) | |
1635 | + if (ci->platdata->flags & CI_HDRC_REGS_SHARED) | |
1637 | 1636 | hw_device_reset(ci, USBMODE_CM_DC); |
1638 | 1637 | } else { |
1639 | 1638 | pm_runtime_put_sync(&ci->gadget.dev); |
1640 | 1639 | |
1641 | 1640 | |
1642 | 1641 | |
1643 | 1642 | |
... | ... | @@ -1651,22 +1650,22 @@ |
1651 | 1650 | } |
1652 | 1651 | |
1653 | 1652 | /** |
1654 | - * ci13xxx_stop: unregister a gadget driver | |
1653 | + * ci_udc_stop: unregister a gadget driver | |
1655 | 1654 | */ |
1656 | -static int ci13xxx_stop(struct usb_gadget *gadget, | |
1655 | +static int ci_udc_stop(struct usb_gadget *gadget, | |
1657 | 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 | 1659 | unsigned long flags; |
1661 | 1660 | |
1662 | 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 | 1664 | ci->vbus_active) { |
1666 | 1665 | hw_device_state(ci, 0); |
1667 | 1666 | if (ci->platdata->notify_event) |
1668 | 1667 | ci->platdata->notify_event(ci, |
1669 | - CI13XXX_CONTROLLER_STOPPED_EVENT); | |
1668 | + CI_HDRC_CONTROLLER_STOPPED_EVENT); | |
1670 | 1669 | ci->driver = NULL; |
1671 | 1670 | spin_unlock_irqrestore(&ci->lock, flags); |
1672 | 1671 | _gadget_stop_activity(&ci->gadget); |
... | ... | @@ -1688,7 +1687,7 @@ |
1688 | 1687 | * This function returns IRQ_HANDLED if the IRQ has been handled |
1689 | 1688 | * It locks access to registers |
1690 | 1689 | */ |
1691 | -static irqreturn_t udc_irq(struct ci13xxx *ci) | |
1690 | +static irqreturn_t udc_irq(struct ci_hdrc *ci) | |
1692 | 1691 | { |
1693 | 1692 | irqreturn_t retval; |
1694 | 1693 | u32 intr; |
... | ... | @@ -1698,7 +1697,7 @@ |
1698 | 1697 | |
1699 | 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 | 1701 | if (hw_read(ci, OP_USBMODE, USBMODE_CM) != |
1703 | 1702 | USBMODE_CM_DC) { |
1704 | 1703 | spin_unlock(&ci->lock); |
... | ... | @@ -1748,7 +1747,7 @@ |
1748 | 1747 | * udc_start: initialize gadget role |
1749 | 1748 | * @ci: chipidea controller |
1750 | 1749 | */ |
1751 | -static int udc_start(struct ci13xxx *ci) | |
1750 | +static int udc_start(struct ci_hdrc *ci) | |
1752 | 1751 | { |
1753 | 1752 | struct device *dev = ci->dev; |
1754 | 1753 | int retval = 0; |
1755 | 1754 | |
... | ... | @@ -1764,15 +1763,15 @@ |
1764 | 1763 | INIT_LIST_HEAD(&ci->gadget.ep_list); |
1765 | 1764 | |
1766 | 1765 | /* alloc resources */ |
1767 | - ci->qh_pool = dma_pool_create("ci13xxx_qh", dev, | |
1768 | - sizeof(struct ci13xxx_qh), | |
1769 | - 64, CI13XXX_PAGE_SIZE); | |
1766 | + ci->qh_pool = dma_pool_create("ci_hw_qh", dev, | |
1767 | + sizeof(struct ci_hw_qh), | |
1768 | + 64, CI_HDRC_PAGE_SIZE); | |
1770 | 1769 | if (ci->qh_pool == NULL) |
1771 | 1770 | return -ENOMEM; |
1772 | 1771 | |
1773 | - ci->td_pool = dma_pool_create("ci13xxx_td", dev, | |
1774 | - sizeof(struct ci13xxx_td), | |
1775 | - 64, CI13XXX_PAGE_SIZE); | |
1772 | + ci->td_pool = dma_pool_create("ci_hw_td", dev, | |
1773 | + sizeof(struct ci_hw_td), | |
1774 | + 64, CI_HDRC_PAGE_SIZE); | |
1776 | 1775 | if (ci->td_pool == NULL) { |
1777 | 1776 | retval = -ENOMEM; |
1778 | 1777 | goto free_qh_pool; |
1779 | 1778 | |
... | ... | @@ -1790,14 +1789,14 @@ |
1790 | 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 | 1793 | if (ci->transceiver == NULL) { |
1795 | 1794 | retval = -ENODEV; |
1796 | 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 | 1800 | retval = hw_device_reset(ci, USBMODE_CM_DC); |
1802 | 1801 | if (retval) |
1803 | 1802 | goto put_transceiver; |
... | ... | @@ -1844,7 +1843,7 @@ |
1844 | 1843 | * |
1845 | 1844 | * No interrupts active, the IRQ has been released |
1846 | 1845 | */ |
1847 | -static void udc_stop(struct ci13xxx *ci) | |
1846 | +static void udc_stop(struct ci_hdrc *ci) | |
1848 | 1847 | { |
1849 | 1848 | if (ci == NULL) |
1850 | 1849 | return; |
... | ... | @@ -1871,7 +1870,7 @@ |
1871 | 1870 | * |
1872 | 1871 | * This function enables the gadget role, if the device is "device capable". |
1873 | 1872 | */ |
1874 | -int ci_hdrc_gadget_init(struct ci13xxx *ci) | |
1873 | +int ci_hdrc_gadget_init(struct ci_hdrc *ci) | |
1875 | 1874 | { |
1876 | 1875 | struct ci_role_driver *rdrv; |
1877 | 1876 |
drivers/usb/chipidea/udc.h
... | ... | @@ -20,7 +20,7 @@ |
20 | 20 | #define TX 1 /* similar to USB_DIR_IN but can be used as an index */ |
21 | 21 | |
22 | 22 | /* DMA layout of transfer descriptors */ |
23 | -struct ci13xxx_td { | |
23 | +struct ci_hw_td { | |
24 | 24 | /* 0 */ |
25 | 25 | u32 next; |
26 | 26 | #define TD_TERMINATE BIT(0) |
... | ... | @@ -43,7 +43,7 @@ |
43 | 43 | } __attribute__ ((packed, aligned(4))); |
44 | 44 | |
45 | 45 | /* DMA layout of queue heads */ |
46 | -struct ci13xxx_qh { | |
46 | +struct ci_hw_qh { | |
47 | 47 | /* 0 */ |
48 | 48 | u32 cap; |
49 | 49 | #define QH_IOS BIT(15) |
... | ... | @@ -54,7 +54,7 @@ |
54 | 54 | /* 1 */ |
55 | 55 | u32 curr; |
56 | 56 | /* 2 - 8 */ |
57 | - struct ci13xxx_td td; | |
57 | + struct ci_hw_td td; | |
58 | 58 | /* 9 */ |
59 | 59 | u32 RESERVED; |
60 | 60 | struct usb_ctrlrequest setup; |
61 | 61 | |
... | ... | @@ -63,11 +63,11 @@ |
63 | 63 | struct td_node { |
64 | 64 | struct list_head td; |
65 | 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 | 71 | * @req: request structure for gadget drivers |
72 | 72 | * @queue: link to QH list |
73 | 73 | * @ptr: transfer descriptor for this request |
... | ... | @@ -75,7 +75,7 @@ |
75 | 75 | * @zptr: transfer descriptor for the zero packet |
76 | 76 | * @zdma: dma address of the zero packet's transfer descriptor |
77 | 77 | */ |
78 | -struct ci13xxx_req { | |
78 | +struct ci_hw_req { | |
79 | 79 | struct usb_request req; |
80 | 80 | struct list_head queue; |
81 | 81 | struct list_head tds; |
82 | 82 | |
... | ... | @@ -83,11 +83,11 @@ |
83 | 83 | |
84 | 84 | #ifdef CONFIG_USB_CHIPIDEA_UDC |
85 | 85 | |
86 | -int ci_hdrc_gadget_init(struct ci13xxx *ci); | |
86 | +int ci_hdrc_gadget_init(struct ci_hdrc *ci); | |
87 | 87 | |
88 | 88 | #else |
89 | 89 | |
90 | -static inline int ci_hdrc_gadget_init(struct ci13xxx *ci) | |
90 | +static inline int ci_hdrc_gadget_init(struct ci_hdrc *ci) | |
91 | 91 | { |
92 | 92 | return -ENXIO; |
93 | 93 | } |
drivers/usb/chipidea/usbmisc_imx.c
include/linux/usb/chipidea.h
... | ... | @@ -7,8 +7,8 @@ |
7 | 7 | |
8 | 8 | #include <linux/usb/otg.h> |
9 | 9 | |
10 | -struct ci13xxx; | |
11 | -struct ci13xxx_platform_data { | |
10 | +struct ci_hdrc; | |
11 | +struct ci_hdrc_platform_data { | |
12 | 12 | const char *name; |
13 | 13 | /* offset of the capability registers */ |
14 | 14 | uintptr_t capoffset; |
15 | 15 | |
16 | 16 | |
17 | 17 | |
... | ... | @@ -16,25 +16,25 @@ |
16 | 16 | struct usb_phy *phy; |
17 | 17 | enum usb_phy_interface phy_mode; |
18 | 18 | unsigned long flags; |
19 | -#define CI13XXX_REGS_SHARED BIT(0) | |
20 | -#define CI13XXX_REQUIRE_TRANSCEIVER BIT(1) | |
21 | -#define CI13XXX_PULLUP_ON_VBUS BIT(2) | |
22 | -#define CI13XXX_DISABLE_STREAMING BIT(3) | |
19 | +#define CI_HDRC_REGS_SHARED BIT(0) | |
20 | +#define CI_HDRC_REQUIRE_TRANSCEIVER BIT(1) | |
21 | +#define CI_HDRC_PULLUP_ON_VBUS BIT(2) | |
22 | +#define CI_HDRC_DISABLE_STREAMING BIT(3) | |
23 | 23 | enum usb_dr_mode dr_mode; |
24 | -#define CI13XXX_CONTROLLER_RESET_EVENT 0 | |
25 | -#define CI13XXX_CONTROLLER_STOPPED_EVENT 1 | |
26 | - void (*notify_event) (struct ci13xxx *ci, unsigned event); | |
24 | +#define CI_HDRC_CONTROLLER_RESET_EVENT 0 | |
25 | +#define CI_HDRC_CONTROLLER_STOPPED_EVENT 1 | |
26 | + void (*notify_event) (struct ci_hdrc *ci, unsigned event); | |
27 | 27 | }; |
28 | 28 | |
29 | 29 | /* Default offset of capability registers */ |
30 | 30 | #define DEF_CAPOFFSET 0x100 |
31 | 31 | |
32 | -/* Add ci13xxx device */ | |
33 | -struct platform_device *ci13xxx_add_device(struct device *dev, | |
32 | +/* Add ci hdrc device */ | |
33 | +struct platform_device *ci_hdrc_add_device(struct device *dev, | |
34 | 34 | struct resource *res, int nres, |
35 | - struct ci13xxx_platform_data *platdata); | |
36 | -/* Remove ci13xxx device */ | |
37 | -void ci13xxx_remove_device(struct platform_device *pdev); | |
35 | + struct ci_hdrc_platform_data *platdata); | |
36 | +/* Remove ci hdrc device */ | |
37 | +void ci_hdrc_remove_device(struct platform_device *pdev); | |
38 | 38 | |
39 | 39 | #endif |