usb: musb: move usb_phy_generic_{un,}register calls to probe()/remove()

This patch is in preparation to supporting
calling those functions multiple times.

Signed-off-by: Felipe Balbi <balbi@ti.com>
This commit is contained in:
Felipe Balbi 2014-04-16 16:05:17 -05:00
parent d7078df6be
commit e741e637a8
5 changed files with 11 additions and 12 deletions

View File

@ -360,7 +360,6 @@ static int am35x_musb_init(struct musb *musb)
if (!rev) if (!rev)
return -ENODEV; return -ENODEV;
usb_phy_generic_register();
musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
if (IS_ERR_OR_NULL(musb->xceiv)) if (IS_ERR_OR_NULL(musb->xceiv))
return -EPROBE_DEFER; return -EPROBE_DEFER;
@ -402,7 +401,6 @@ static int am35x_musb_exit(struct musb *musb)
data->set_phy_power(0); data->set_phy_power(0);
usb_put_phy(musb->xceiv); usb_put_phy(musb->xceiv);
usb_phy_generic_unregister();
return 0; return 0;
} }
@ -505,6 +503,7 @@ static int am35x_probe(struct platform_device *pdev)
pdata->platform_ops = &am35x_ops; pdata->platform_ops = &am35x_ops;
usb_phy_generic_register();
platform_set_drvdata(pdev, glue); platform_set_drvdata(pdev, glue);
pinfo = am35x_dev_info; pinfo = am35x_dev_info;
@ -547,6 +546,7 @@ static int am35x_remove(struct platform_device *pdev)
struct am35x_glue *glue = platform_get_drvdata(pdev); struct am35x_glue *glue = platform_get_drvdata(pdev);
platform_device_unregister(glue->musb); platform_device_unregister(glue->musb);
usb_phy_generic_unregister();
clk_disable(glue->clk); clk_disable(glue->clk);
clk_disable(glue->phy_clk); clk_disable(glue->phy_clk);
clk_put(glue->clk); clk_put(glue->clk);

View File

@ -401,7 +401,6 @@ static int bfin_musb_init(struct musb *musb)
} }
gpio_direction_output(musb->config->gpio_vrsel, 0); gpio_direction_output(musb->config->gpio_vrsel, 0);
usb_phy_generic_register();
musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
if (IS_ERR_OR_NULL(musb->xceiv)) { if (IS_ERR_OR_NULL(musb->xceiv)) {
gpio_free(musb->config->gpio_vrsel); gpio_free(musb->config->gpio_vrsel);
@ -424,9 +423,8 @@ static int bfin_musb_init(struct musb *musb)
static int bfin_musb_exit(struct musb *musb) static int bfin_musb_exit(struct musb *musb)
{ {
gpio_free(musb->config->gpio_vrsel); gpio_free(musb->config->gpio_vrsel);
usb_put_phy(musb->xceiv); usb_put_phy(musb->xceiv);
usb_phy_generic_unregister();
return 0; return 0;
} }
@ -477,6 +475,7 @@ static int bfin_probe(struct platform_device *pdev)
pdata->platform_ops = &bfin_ops; pdata->platform_ops = &bfin_ops;
usb_phy_generic_register();
platform_set_drvdata(pdev, glue); platform_set_drvdata(pdev, glue);
memset(musb_resources, 0x00, sizeof(*musb_resources) * memset(musb_resources, 0x00, sizeof(*musb_resources) *
@ -528,6 +527,7 @@ static int bfin_remove(struct platform_device *pdev)
struct bfin_glue *glue = platform_get_drvdata(pdev); struct bfin_glue *glue = platform_get_drvdata(pdev);
platform_device_unregister(glue->musb); platform_device_unregister(glue->musb);
usb_phy_generic_unregister();
kfree(glue); kfree(glue);
return 0; return 0;

View File

@ -418,7 +418,6 @@ static int da8xx_musb_init(struct musb *musb)
if (!rev) if (!rev)
goto fail; goto fail;
usb_phy_generic_register();
musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
if (IS_ERR_OR_NULL(musb->xceiv)) { if (IS_ERR_OR_NULL(musb->xceiv)) {
ret = -EPROBE_DEFER; ret = -EPROBE_DEFER;
@ -453,7 +452,6 @@ static int da8xx_musb_exit(struct musb *musb)
phy_off(); phy_off();
usb_put_phy(musb->xceiv); usb_put_phy(musb->xceiv);
usb_phy_generic_unregister();
return 0; return 0;
} }
@ -512,6 +510,7 @@ static int da8xx_probe(struct platform_device *pdev)
pdata->platform_ops = &da8xx_ops; pdata->platform_ops = &da8xx_ops;
usb_phy_generic_register();
platform_set_drvdata(pdev, glue); platform_set_drvdata(pdev, glue);
memset(musb_resources, 0x00, sizeof(*musb_resources) * memset(musb_resources, 0x00, sizeof(*musb_resources) *
@ -561,6 +560,7 @@ static int da8xx_remove(struct platform_device *pdev)
struct da8xx_glue *glue = platform_get_drvdata(pdev); struct da8xx_glue *glue = platform_get_drvdata(pdev);
platform_device_unregister(glue->musb); platform_device_unregister(glue->musb);
usb_phy_generic_unregister();
clk_disable(glue->clk); clk_disable(glue->clk);
clk_put(glue->clk); clk_put(glue->clk);
kfree(glue); kfree(glue);

View File

@ -381,7 +381,6 @@ static int davinci_musb_init(struct musb *musb)
u32 revision; u32 revision;
int ret = -ENODEV; int ret = -ENODEV;
usb_phy_generic_register();
musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
if (IS_ERR_OR_NULL(musb->xceiv)) { if (IS_ERR_OR_NULL(musb->xceiv)) {
ret = -EPROBE_DEFER; ret = -EPROBE_DEFER;
@ -487,7 +486,6 @@ static int davinci_musb_exit(struct musb *musb)
phy_off(); phy_off();
usb_put_phy(musb->xceiv); usb_put_phy(musb->xceiv);
usb_phy_generic_unregister();
return 0; return 0;
} }
@ -545,6 +543,7 @@ static int davinci_probe(struct platform_device *pdev)
pdata->platform_ops = &davinci_ops; pdata->platform_ops = &davinci_ops;
usb_phy_generic_register();
platform_set_drvdata(pdev, glue); platform_set_drvdata(pdev, glue);
memset(musb_resources, 0x00, sizeof(*musb_resources) * memset(musb_resources, 0x00, sizeof(*musb_resources) *
@ -603,6 +602,7 @@ static int davinci_remove(struct platform_device *pdev)
struct davinci_glue *glue = platform_get_drvdata(pdev); struct davinci_glue *glue = platform_get_drvdata(pdev);
platform_device_unregister(glue->musb); platform_device_unregister(glue->musb);
usb_phy_generic_unregister();
clk_disable(glue->clk); clk_disable(glue->clk);
clk_put(glue->clk); clk_put(glue->clk);
kfree(glue); kfree(glue);

View File

@ -1065,7 +1065,6 @@ static int tusb_musb_init(struct musb *musb)
void __iomem *sync = NULL; void __iomem *sync = NULL;
int ret; int ret;
usb_phy_generic_register();
musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
if (IS_ERR_OR_NULL(musb->xceiv)) if (IS_ERR_OR_NULL(musb->xceiv))
return -EPROBE_DEFER; return -EPROBE_DEFER;
@ -1117,7 +1116,6 @@ done:
iounmap(sync); iounmap(sync);
usb_put_phy(musb->xceiv); usb_put_phy(musb->xceiv);
usb_phy_generic_unregister();
} }
return ret; return ret;
} }
@ -1133,7 +1131,6 @@ static int tusb_musb_exit(struct musb *musb)
iounmap(musb->sync_va); iounmap(musb->sync_va);
usb_put_phy(musb->xceiv); usb_put_phy(musb->xceiv);
usb_phy_generic_unregister();
return 0; return 0;
} }
@ -1176,6 +1173,7 @@ static int tusb_probe(struct platform_device *pdev)
pdata->platform_ops = &tusb_ops; pdata->platform_ops = &tusb_ops;
usb_phy_generic_register();
platform_set_drvdata(pdev, glue); platform_set_drvdata(pdev, glue);
memset(musb_resources, 0x00, sizeof(*musb_resources) * memset(musb_resources, 0x00, sizeof(*musb_resources) *
@ -1224,6 +1222,7 @@ static int tusb_remove(struct platform_device *pdev)
struct tusb6010_glue *glue = platform_get_drvdata(pdev); struct tusb6010_glue *glue = platform_get_drvdata(pdev);
platform_device_unregister(glue->musb); platform_device_unregister(glue->musb);
usb_phy_generic_unregister();
kfree(glue); kfree(glue);
return 0; return 0;