aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/musb
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>2013-07-05 06:33:33 -0400
committerFelipe Balbi <balbi@ti.com>2013-08-09 10:34:16 -0400
commite96bdc3dafe471375e2e780e319e3ead2d9ad4a7 (patch)
tree4bbe8e7c200f92556777bb5d971567c184bfd2c7 /drivers/usb/musb
parent3bb869c8b3f1a11f1854cd74ebdeb60753614cf8 (diff)
usb: musb: dsps: remove the hardcoded phy pieces
dsps uses a nop driver which is added in dsps itself and does the PHY on/off calls within dsps. Since those calls are now moved the nop driver itself, we can now request the phy proper phy and remove those calls. Currently only the first musb interface is used so we only add one phy node for now. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/musb')
-rw-r--r--drivers/usb/musb/musb_dsps.c97
1 files changed, 1 insertions, 96 deletions
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index e7a2cd1c6630..74333321cb62 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -120,49 +120,8 @@ struct dsps_glue {
120 const struct dsps_musb_wrapper *wrp; /* wrapper register offsets */ 120 const struct dsps_musb_wrapper *wrp; /* wrapper register offsets */
121 struct timer_list timer[2]; /* otg_workaround timer */ 121 struct timer_list timer[2]; /* otg_workaround timer */
122 unsigned long last_timer[2]; /* last timer data for each instance */ 122 unsigned long last_timer[2]; /* last timer data for each instance */
123 u32 __iomem *usb_ctrl[2];
124}; 123};
125 124
126#define DSPS_AM33XX_CONTROL_MODULE_PHYS_0 0x44e10620
127#define DSPS_AM33XX_CONTROL_MODULE_PHYS_1 0x44e10628
128
129static const resource_size_t dsps_control_module_phys[] = {
130 DSPS_AM33XX_CONTROL_MODULE_PHYS_0,
131 DSPS_AM33XX_CONTROL_MODULE_PHYS_1,
132};
133
134#define USBPHY_CM_PWRDN (1 << 0)
135#define USBPHY_OTG_PWRDN (1 << 1)
136#define USBPHY_OTGVDET_EN (1 << 19)
137#define USBPHY_OTGSESSEND_EN (1 << 20)
138
139/**
140 * musb_dsps_phy_control - phy on/off
141 * @glue: struct dsps_glue *
142 * @id: musb instance
143 * @on: flag for phy to be switched on or off
144 *
145 * This is to enable the PHY using usb_ctrl register in system control
146 * module space.
147 *
148 * XXX: This function will be removed once we have a seperate driver for
149 * control module
150 */
151static void musb_dsps_phy_control(struct dsps_glue *glue, u8 id, u8 on)
152{
153 u32 usbphycfg;
154
155 usbphycfg = readl(glue->usb_ctrl[id]);
156
157 if (on) {
158 usbphycfg &= ~(USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN);
159 usbphycfg |= USBPHY_OTGVDET_EN | USBPHY_OTGSESSEND_EN;
160 } else {
161 usbphycfg |= USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN;
162 }
163
164 writel(usbphycfg, glue->usb_ctrl[id]);
165}
166/** 125/**
167 * dsps_musb_enable - enable interrupts 126 * dsps_musb_enable - enable interrupts
168 */ 127 */
@@ -407,8 +366,7 @@ static int dsps_musb_init(struct musb *musb)
407 musb->mregs += wrp->musb_core_offset; 366 musb->mregs += wrp->musb_core_offset;
408 367
409 /* NOP driver needs change if supporting dual instance */ 368 /* NOP driver needs change if supporting dual instance */
410 usb_nop_xceiv_register(); 369 musb->xceiv = devm_usb_get_phy_by_phandle(glue->dev, "phys", 0);
411 musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
412 if (IS_ERR_OR_NULL(musb->xceiv)) 370 if (IS_ERR_OR_NULL(musb->xceiv))
413 return -EPROBE_DEFER; 371 return -EPROBE_DEFER;
414 372
@@ -426,9 +384,6 @@ static int dsps_musb_init(struct musb *musb)
426 /* Reset the musb */ 384 /* Reset the musb */
427 dsps_writel(reg_base, wrp->control, (1 << wrp->reset)); 385 dsps_writel(reg_base, wrp->control, (1 << wrp->reset));
428 386
429 /* Start the on-chip PHY and its PLL. */
430 musb_dsps_phy_control(glue, pdev->id, 1);
431
432 musb->isr = dsps_interrupt; 387 musb->isr = dsps_interrupt;
433 388
434 /* reset the otgdisable bit, needed for host mode to work */ 389 /* reset the otgdisable bit, needed for host mode to work */
@@ -438,8 +393,6 @@ static int dsps_musb_init(struct musb *musb)
438 393
439 return 0; 394 return 0;
440err0: 395err0:
441 usb_put_phy(musb->xceiv);
442 usb_nop_xceiv_unregister();
443 return status; 396 return status;
444} 397}
445 398
@@ -451,14 +404,7 @@ static int dsps_musb_exit(struct musb *musb)
451 404
452 del_timer_sync(&glue->timer[pdev->id]); 405 del_timer_sync(&glue->timer[pdev->id]);
453 406
454 /* Shutdown the on-chip PHY and its PLL. */
455 musb_dsps_phy_control(glue, pdev->id, 0);
456 usb_phy_shutdown(musb->xceiv); 407 usb_phy_shutdown(musb->xceiv);
457
458 /* NOP driver needs change if supporting dual instance */
459 usb_put_phy(musb->xceiv);
460 usb_nop_xceiv_unregister();
461
462 return 0; 408 return 0;
463} 409}
464 410
@@ -487,16 +433,6 @@ static int dsps_create_musb_pdev(struct dsps_glue *glue, u8 id)
487 char res_name[11]; 433 char res_name[11];
488 int ret; 434 int ret;
489 435
490 resources[0].start = dsps_control_module_phys[id];
491 resources[0].end = resources[0].start + SZ_4 - 1;
492 resources[0].flags = IORESOURCE_MEM;
493
494 glue->usb_ctrl[id] = devm_ioremap_resource(&pdev->dev, resources);
495 if (IS_ERR(glue->usb_ctrl[id])) {
496 ret = PTR_ERR(glue->usb_ctrl[id]);
497 goto err0;
498 }
499
500 /* first resource is for usbss, so start index from 1 */ 436 /* first resource is for usbss, so start index from 1 */
501 res = platform_get_resource(pdev, IORESOURCE_MEM, id + 1); 437 res = platform_get_resource(pdev, IORESOURCE_MEM, id + 1);
502 if (!res) { 438 if (!res) {
@@ -680,36 +616,6 @@ static int dsps_remove(struct platform_device *pdev)
680 return 0; 616 return 0;
681} 617}
682 618
683#ifdef CONFIG_PM_SLEEP
684static int dsps_suspend(struct device *dev)
685{
686 struct platform_device *pdev = to_platform_device(dev->parent);
687 struct dsps_glue *glue = platform_get_drvdata(pdev);
688 const struct dsps_musb_wrapper *wrp = glue->wrp;
689 int i;
690
691 for (i = 0; i < wrp->instances; i++)
692 musb_dsps_phy_control(glue, i, 0);
693
694 return 0;
695}
696
697static int dsps_resume(struct device *dev)
698{
699 struct platform_device *pdev = to_platform_device(dev->parent);
700 struct dsps_glue *glue = platform_get_drvdata(pdev);
701 const struct dsps_musb_wrapper *wrp = glue->wrp;
702 int i;
703
704 for (i = 0; i < wrp->instances; i++)
705 musb_dsps_phy_control(glue, i, 1);
706
707 return 0;
708}
709#endif
710
711static SIMPLE_DEV_PM_OPS(dsps_pm_ops, dsps_suspend, dsps_resume);
712
713static const struct dsps_musb_wrapper am33xx_driver_data = { 619static const struct dsps_musb_wrapper am33xx_driver_data = {
714 .revision = 0x00, 620 .revision = 0x00,
715 .control = 0x14, 621 .control = 0x14,
@@ -752,7 +658,6 @@ static struct platform_driver dsps_usbss_driver = {
752 .remove = dsps_remove, 658 .remove = dsps_remove,
753 .driver = { 659 .driver = {
754 .name = "musb-dsps", 660 .name = "musb-dsps",
755 .pm = &dsps_pm_ops,
756 .of_match_table = of_match_ptr(musb_dsps_of_match), 661 .of_match_table = of_match_ptr(musb_dsps_of_match),
757 }, 662 },
758}; 663};