Skip to content

Commit e96bdc3

Browse files
Sebastian Andrzej SiewiorFelipe Balbi
Sebastian Andrzej Siewior
authored and
Felipe Balbi
committed
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 <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
1 parent 3bb869c commit e96bdc3

File tree

1 file changed

+1
-96
lines changed

1 file changed

+1
-96
lines changed

drivers/usb/musb/musb_dsps.c

Lines changed: 1 addition & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -120,49 +120,8 @@ struct dsps_glue {
120120
const struct dsps_musb_wrapper *wrp; /* wrapper register offsets */
121121
struct timer_list timer[2]; /* otg_workaround timer */
122122
unsigned long last_timer[2]; /* last timer data for each instance */
123-
u32 __iomem *usb_ctrl[2];
124123
};
125124

126-
#define DSPS_AM33XX_CONTROL_MODULE_PHYS_0 0x44e10620
127-
#define DSPS_AM33XX_CONTROL_MODULE_PHYS_1 0x44e10628
128-
129-
static 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-
*/
151-
static 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-
}
166125
/**
167126
* dsps_musb_enable - enable interrupts
168127
*/
@@ -407,8 +366,7 @@ static int dsps_musb_init(struct musb *musb)
407366
musb->mregs += wrp->musb_core_offset;
408367

409368
/* NOP driver needs change if supporting dual instance */
410-
usb_nop_xceiv_register();
411-
musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
369+
musb->xceiv = devm_usb_get_phy_by_phandle(glue->dev, "phys", 0);
412370
if (IS_ERR_OR_NULL(musb->xceiv))
413371
return -EPROBE_DEFER;
414372

@@ -426,9 +384,6 @@ static int dsps_musb_init(struct musb *musb)
426384
/* Reset the musb */
427385
dsps_writel(reg_base, wrp->control, (1 << wrp->reset));
428386

429-
/* Start the on-chip PHY and its PLL. */
430-
musb_dsps_phy_control(glue, pdev->id, 1);
431-
432387
musb->isr = dsps_interrupt;
433388

434389
/* reset the otgdisable bit, needed for host mode to work */
@@ -438,8 +393,6 @@ static int dsps_musb_init(struct musb *musb)
438393

439394
return 0;
440395
err0:
441-
usb_put_phy(musb->xceiv);
442-
usb_nop_xceiv_unregister();
443396
return status;
444397
}
445398

@@ -451,14 +404,7 @@ static int dsps_musb_exit(struct musb *musb)
451404

452405
del_timer_sync(&glue->timer[pdev->id]);
453406

454-
/* Shutdown the on-chip PHY and its PLL. */
455-
musb_dsps_phy_control(glue, pdev->id, 0);
456407
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-
462408
return 0;
463409
}
464410

@@ -487,16 +433,6 @@ static int dsps_create_musb_pdev(struct dsps_glue *glue, u8 id)
487433
char res_name[11];
488434
int ret;
489435

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-
500436
/* first resource is for usbss, so start index from 1 */
501437
res = platform_get_resource(pdev, IORESOURCE_MEM, id + 1);
502438
if (!res) {
@@ -680,36 +616,6 @@ static int dsps_remove(struct platform_device *pdev)
680616
return 0;
681617
}
682618

683-
#ifdef CONFIG_PM_SLEEP
684-
static 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-
697-
static 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-
711-
static SIMPLE_DEV_PM_OPS(dsps_pm_ops, dsps_suspend, dsps_resume);
712-
713619
static const struct dsps_musb_wrapper am33xx_driver_data = {
714620
.revision = 0x00,
715621
.control = 0x14,
@@ -752,7 +658,6 @@ static struct platform_driver dsps_usbss_driver = {
752658
.remove = dsps_remove,
753659
.driver = {
754660
.name = "musb-dsps",
755-
.pm = &dsps_pm_ops,
756661
.of_match_table = of_match_ptr(musb_dsps_of_match),
757662
},
758663
};

0 commit comments

Comments
 (0)