.. | .. |
---|
77 | 77 | { |
---|
78 | 78 | struct mu3c_ippc_regs __iomem *ippc = mtk->ippc_regs; |
---|
79 | 79 | u32 value, check_val; |
---|
80 | | - int u3_ports_disabed = 0; |
---|
| 80 | + int u3_ports_disabled = 0; |
---|
81 | 81 | int ret; |
---|
82 | 82 | int i; |
---|
83 | 83 | |
---|
.. | .. |
---|
92 | 92 | /* power on and enable u3 ports except skipped ones */ |
---|
93 | 93 | for (i = 0; i < mtk->num_u3_ports; i++) { |
---|
94 | 94 | if ((0x1 << i) & mtk->u3p_dis_msk) { |
---|
95 | | - u3_ports_disabed++; |
---|
| 95 | + u3_ports_disabled++; |
---|
96 | 96 | continue; |
---|
97 | 97 | } |
---|
98 | 98 | |
---|
.. | .. |
---|
117 | 117 | check_val = STS1_SYSPLL_STABLE | STS1_REF_RST | |
---|
118 | 118 | STS1_SYS125_RST | STS1_XHCI_RST; |
---|
119 | 119 | |
---|
120 | | - if (mtk->num_u3_ports > u3_ports_disabed) |
---|
| 120 | + if (mtk->num_u3_ports > u3_ports_disabled) |
---|
121 | 121 | check_val |= STS1_U3_MAC_RST; |
---|
122 | 122 | |
---|
123 | 123 | ret = readl_poll_timeout(&ippc->ip_pw_sts1, value, |
---|
.. | .. |
---|
206 | 206 | return xhci_mtk_host_enable(mtk); |
---|
207 | 207 | } |
---|
208 | 208 | |
---|
209 | | -/* ignore the error if the clock does not exist */ |
---|
210 | | -static struct clk *optional_clk_get(struct device *dev, const char *id) |
---|
211 | | -{ |
---|
212 | | - struct clk *opt_clk; |
---|
213 | | - |
---|
214 | | - opt_clk = devm_clk_get(dev, id); |
---|
215 | | - /* ignore error number except EPROBE_DEFER */ |
---|
216 | | - if (IS_ERR(opt_clk) && (PTR_ERR(opt_clk) != -EPROBE_DEFER)) |
---|
217 | | - opt_clk = NULL; |
---|
218 | | - |
---|
219 | | - return opt_clk; |
---|
220 | | -} |
---|
221 | | - |
---|
222 | 209 | static int xhci_mtk_clks_get(struct xhci_hcd_mtk *mtk) |
---|
223 | 210 | { |
---|
224 | 211 | struct device *dev = mtk->dev; |
---|
.. | .. |
---|
229 | 216 | return PTR_ERR(mtk->sys_clk); |
---|
230 | 217 | } |
---|
231 | 218 | |
---|
232 | | - mtk->ref_clk = optional_clk_get(dev, "ref_ck"); |
---|
| 219 | + mtk->xhci_clk = devm_clk_get_optional(dev, "xhci_ck"); |
---|
| 220 | + if (IS_ERR(mtk->xhci_clk)) |
---|
| 221 | + return PTR_ERR(mtk->xhci_clk); |
---|
| 222 | + |
---|
| 223 | + mtk->ref_clk = devm_clk_get_optional(dev, "ref_ck"); |
---|
233 | 224 | if (IS_ERR(mtk->ref_clk)) |
---|
234 | 225 | return PTR_ERR(mtk->ref_clk); |
---|
235 | 226 | |
---|
236 | | - mtk->mcu_clk = optional_clk_get(dev, "mcu_ck"); |
---|
| 227 | + mtk->mcu_clk = devm_clk_get_optional(dev, "mcu_ck"); |
---|
237 | 228 | if (IS_ERR(mtk->mcu_clk)) |
---|
238 | 229 | return PTR_ERR(mtk->mcu_clk); |
---|
239 | 230 | |
---|
240 | | - mtk->dma_clk = optional_clk_get(dev, "dma_ck"); |
---|
| 231 | + mtk->dma_clk = devm_clk_get_optional(dev, "dma_ck"); |
---|
241 | 232 | return PTR_ERR_OR_ZERO(mtk->dma_clk); |
---|
242 | 233 | } |
---|
243 | 234 | |
---|
.. | .. |
---|
257 | 248 | goto sys_clk_err; |
---|
258 | 249 | } |
---|
259 | 250 | |
---|
| 251 | + ret = clk_prepare_enable(mtk->xhci_clk); |
---|
| 252 | + if (ret) { |
---|
| 253 | + dev_err(mtk->dev, "failed to enable xhci_clk\n"); |
---|
| 254 | + goto xhci_clk_err; |
---|
| 255 | + } |
---|
| 256 | + |
---|
260 | 257 | ret = clk_prepare_enable(mtk->mcu_clk); |
---|
261 | 258 | if (ret) { |
---|
262 | 259 | dev_err(mtk->dev, "failed to enable mcu_clk\n"); |
---|
.. | .. |
---|
274 | 271 | dma_clk_err: |
---|
275 | 272 | clk_disable_unprepare(mtk->mcu_clk); |
---|
276 | 273 | mcu_clk_err: |
---|
| 274 | + clk_disable_unprepare(mtk->xhci_clk); |
---|
| 275 | +xhci_clk_err: |
---|
277 | 276 | clk_disable_unprepare(mtk->sys_clk); |
---|
278 | 277 | sys_clk_err: |
---|
279 | 278 | clk_disable_unprepare(mtk->ref_clk); |
---|
.. | .. |
---|
285 | 284 | { |
---|
286 | 285 | clk_disable_unprepare(mtk->dma_clk); |
---|
287 | 286 | clk_disable_unprepare(mtk->mcu_clk); |
---|
| 287 | + clk_disable_unprepare(mtk->xhci_clk); |
---|
288 | 288 | clk_disable_unprepare(mtk->sys_clk); |
---|
289 | 289 | clk_disable_unprepare(mtk->ref_clk); |
---|
290 | 290 | } |
---|
.. | .. |
---|
343 | 343 | if (mtk->uwk_en) |
---|
344 | 344 | usb_wakeup_ip_sleep_set(mtk, enable); |
---|
345 | 345 | } |
---|
346 | | - |
---|
347 | | -static int xhci_mtk_setup(struct usb_hcd *hcd); |
---|
348 | | -static const struct xhci_driver_overrides xhci_mtk_overrides __initconst = { |
---|
349 | | - .reset = xhci_mtk_setup, |
---|
350 | | -}; |
---|
351 | | - |
---|
352 | | -static struct hc_driver __read_mostly xhci_mtk_hc_driver; |
---|
353 | 346 | |
---|
354 | 347 | static int xhci_mtk_ldos_enable(struct xhci_hcd_mtk *mtk) |
---|
355 | 348 | { |
---|
.. | .. |
---|
431 | 424 | return ret; |
---|
432 | 425 | } |
---|
433 | 426 | |
---|
| 427 | +static const struct xhci_driver_overrides xhci_mtk_overrides __initconst = { |
---|
| 428 | + .reset = xhci_mtk_setup, |
---|
| 429 | + .add_endpoint = xhci_mtk_add_ep, |
---|
| 430 | + .drop_endpoint = xhci_mtk_drop_ep, |
---|
| 431 | + .check_bandwidth = xhci_mtk_check_bandwidth, |
---|
| 432 | + .reset_bandwidth = xhci_mtk_reset_bandwidth, |
---|
| 433 | +}; |
---|
| 434 | + |
---|
| 435 | +static struct hc_driver __read_mostly xhci_mtk_hc_driver; |
---|
| 436 | + |
---|
434 | 437 | static int xhci_mtk_probe(struct platform_device *pdev) |
---|
435 | 438 | { |
---|
436 | 439 | struct device *dev = &pdev->dev; |
---|
.. | .. |
---|
498 | 501 | goto disable_clk; |
---|
499 | 502 | } |
---|
500 | 503 | |
---|
501 | | - /* Initialize dma_mask and coherent_dma_mask to 32-bits */ |
---|
502 | | - ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32)); |
---|
503 | | - if (ret) |
---|
504 | | - goto disable_clk; |
---|
505 | | - |
---|
506 | 504 | hcd = usb_create_hcd(driver, dev, dev_name(dev)); |
---|
507 | 505 | if (!hcd) { |
---|
508 | 506 | ret = -ENOMEM; |
---|
.. | .. |
---|
538 | 536 | } |
---|
539 | 537 | |
---|
540 | 538 | device_init_wakeup(dev, true); |
---|
| 539 | + dma_set_max_seg_size(dev, UINT_MAX); |
---|
541 | 540 | |
---|
542 | 541 | xhci = hcd_to_xhci(hcd); |
---|
543 | 542 | xhci->main_hcd = hcd; |
---|