Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 227003
b: refs/heads/master
c: 0349176
h: refs/heads/master
i:
  227001: 8afce33
  226999: 3cb24a8
v: v3
  • Loading branch information
Felipe Balbi committed Dec 10, 2010
1 parent 675e99b commit b2b18de
Show file tree
Hide file tree
Showing 11 changed files with 147 additions and 132 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3b7029670d39d22f288ece95254e9ba5ceddd6ba
refs/heads/master: 0349176120aa3024e96ae4fd7dc0e0181dc55f52
2 changes: 1 addition & 1 deletion trunk/arch/arm/mach-omap2/clock2430_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -1983,7 +1983,7 @@ static struct omap_clk omap2430_clks[] = {
CLK("omap-aes", "ick", &aes_ick, CK_243X),
CLK(NULL, "pka_ick", &pka_ick, CK_243X),
CLK(NULL, "usb_fck", &usb_fck, CK_243X),
CLK("musb-hdrc", "ick", &usbhs_ick, CK_243X),
CLK("musb-omap2430", "ick", &usbhs_ick, CK_243X),
CLK("mmci-omap-hs.0", "ick", &mmchs1_ick, CK_243X),
CLK("mmci-omap-hs.0", "fck", &mmchs1_fck, CK_243X),
CLK("mmci-omap-hs.1", "ick", &mmchs2_ick, CK_243X),
Expand Down
8 changes: 4 additions & 4 deletions trunk/arch/arm/mach-omap2/clock3xxx_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -3306,8 +3306,8 @@ static struct omap_clk omap3xxx_clks[] = {
CLK(NULL, "ssi_sst_fck", &ssi_sst_fck_3430es1, CK_3430ES1),
CLK(NULL, "ssi_sst_fck", &ssi_sst_fck_3430es2, CK_3430ES2),
CLK(NULL, "core_l3_ick", &core_l3_ick, CK_3XXX),
CLK("musb-hdrc", "ick", &hsotgusb_ick_3430es1, CK_3430ES1),
CLK("musb-hdrc", "ick", &hsotgusb_ick_3430es2, CK_3430ES2),
CLK("musb-omap2430", "ick", &hsotgusb_ick_3430es1, CK_3430ES1),
CLK("musb-omap2430", "ick", &hsotgusb_ick_3430es2, CK_3430ES2),
CLK(NULL, "sdrc_ick", &sdrc_ick, CK_3XXX),
CLK(NULL, "gpmc_fck", &gpmc_fck, CK_3XXX),
CLK(NULL, "security_l3_ick", &security_l3_ick, CK_343X),
Expand Down Expand Up @@ -3442,8 +3442,8 @@ static struct omap_clk omap3xxx_clks[] = {
CLK("davinci_emac", "phy_clk", &emac_fck, CK_AM35XX),
CLK("vpfe-capture", "master", &vpfe_ick, CK_AM35XX),
CLK("vpfe-capture", "slave", &vpfe_fck, CK_AM35XX),
CLK("musb-hdrc", "ick", &hsotgusb_ick_am35xx, CK_AM35XX),
CLK("musb-hdrc", "fck", &hsotgusb_fck_am35xx, CK_AM35XX),
CLK("musb-am35x", "ick", &hsotgusb_ick_am35xx, CK_AM35XX),
CLK("musb-am35x", "fck", &hsotgusb_fck_am35xx, CK_AM35XX),
CLK(NULL, "hecc_ck", &hecc_ck, CK_AM35XX),
CLK(NULL, "uart4_ick", &uart4_ick_am35xx, CK_AM35XX),
};
Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/arm/mach-omap2/clock44xx_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -2953,7 +2953,7 @@ static struct omap_clk omap44xx_clks[] = {
CLK("ehci-omap.0", "usbhost_ick", &dummy_ck, CK_443X),
CLK(NULL, "otg_60m_gfclk", &otg_60m_gfclk, CK_443X),
CLK(NULL, "usb_otg_hs_xclk", &usb_otg_hs_xclk, CK_443X),
CLK("musb-hdrc", "ick", &usb_otg_hs_ick, CK_443X),
CLK("musb-omap2430", "ick", &usb_otg_hs_ick, CK_443X),
CLK(NULL, "usb_phy_cm_clk32k", &usb_phy_cm_clk32k, CK_443X),
CLK(NULL, "usb_tll_hs_usb_ch2_clk", &usb_tll_hs_usb_ch2_clk, CK_443X),
CLK(NULL, "usb_tll_hs_usb_ch0_clk", &usb_tll_hs_usb_ch0_clk, CK_443X),
Expand Down
91 changes: 57 additions & 34 deletions trunk/drivers/usb/musb/am35x.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@
struct am35x_glue {
struct device *dev;
struct platform_device *musb;
struct clk *phy_clk;
struct clk *clk;
};

static inline void phy_on(void)
Expand Down Expand Up @@ -402,34 +404,18 @@ static int am35x_musb_init(struct musb *musb)
{
void __iomem *reg_base = musb->ctrl_base;
u32 rev, lvl_intr, sw_reset;
int status;

musb->mregs += USB_MENTOR_CORE_OFFSET;

clk_enable(musb->clock);
DBG(2, "musb->clock=%lud\n", clk_get_rate(musb->clock));

musb->phy_clock = clk_get(musb->controller, "fck");
if (IS_ERR(musb->phy_clock)) {
status = PTR_ERR(musb->phy_clock);
goto exit0;
}
clk_enable(musb->phy_clock);
DBG(2, "musb->phy_clock=%lud\n", clk_get_rate(musb->phy_clock));

/* Returns zero if e.g. not clocked */
rev = musb_readl(reg_base, USB_REVISION_REG);
if (!rev) {
status = -ENODEV;
goto exit1;
}
if (!rev)
return -ENODEV;

usb_nop_xceiv_register();
musb->xceiv = otg_get_transceiver();
if (!musb->xceiv) {
status = -ENODEV;
goto exit1;
}
if (!musb->xceiv)
return -ENODEV;

if (is_host_enabled(musb))
setup_timer(&otg_workaround, otg_timer, (unsigned long) musb);
Expand Down Expand Up @@ -459,13 +445,8 @@ static int am35x_musb_init(struct musb *musb)
lvl_intr = omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR);
lvl_intr |= AM35XX_USBOTGSS_INT_CLR;
omap_ctrl_writel(lvl_intr, AM35XX_CONTROL_LVL_INTR_CLEAR);

return 0;
exit1:
clk_disable(musb->phy_clock);
clk_put(musb->phy_clock);
exit0:
clk_disable(musb->clock);
return status;
}

static int am35x_musb_exit(struct musb *musb)
Expand All @@ -478,11 +459,6 @@ static int am35x_musb_exit(struct musb *musb)
otg_put_transceiver(musb->xceiv);
usb_nop_xceiv_unregister();

clk_disable(musb->clock);

clk_disable(musb->phy_clock);
clk_put(musb->phy_clock);

return 0;
}

Expand Down Expand Up @@ -551,6 +527,9 @@ static int __init am35x_probe(struct platform_device *pdev)
struct platform_device *musb;
struct am35x_glue *glue;

struct clk *phy_clk;
struct clk *clk;

int ret = -ENOMEM;

glue = kzalloc(sizeof(*glue), GFP_KERNEL);
Expand All @@ -565,12 +544,40 @@ static int __init am35x_probe(struct platform_device *pdev)
goto err1;
}

phy_clk = clk_get(&pdev->dev, "fck");
if (IS_ERR(phy_clk)) {
dev_err(&pdev->dev, "failed to get PHY clock\n");
ret = PTR_ERR(phy_clk);
goto err2;
}

clk = clk_get(&pdev->dev, "ick");
if (IS_ERR(clk)) {
dev_err(&pdev->dev, "failed to get clock\n");
ret = PTR_ERR(clk);
goto err3;
}

ret = clk_enable(phy_clk);
if (ret) {
dev_err(&pdev->dev, "failed to enable PHY clock\n");
goto err4;
}

ret = clk_enable(clk);
if (ret) {
dev_err(&pdev->dev, "failed to enable clock\n");
goto err5;
}

musb->dev.parent = &pdev->dev;
musb->dev.dma_mask = &am35x_dmamask;
musb->dev.coherent_dma_mask = am35x_dmamask;

glue->dev = &pdev->dev;
glue->musb = musb;
glue->phy_clk = phy_clk;
glue->clk = clk;

pdata->platform_ops = &am35x_ops;

Expand All @@ -580,23 +587,35 @@ static int __init am35x_probe(struct platform_device *pdev)
pdev->num_resources);
if (ret) {
dev_err(&pdev->dev, "failed to add resources\n");
goto err2;
goto err6;
}

ret = platform_device_add_data(musb, pdata, sizeof(*pdata));
if (ret) {
dev_err(&pdev->dev, "failed to add platform_data\n");
goto err2;
goto err6;
}

ret = platform_device_add(musb);
if (ret) {
dev_err(&pdev->dev, "failed to register musb device\n");
goto err2;
goto err6;
}

return 0;

err6:
clk_disable(clk);

err5:
clk_disable(phy_clk);

err4:
clk_put(clk);

err3:
clk_put(phy_clk);

err2:
platform_device_put(musb);

Expand All @@ -613,6 +632,10 @@ static int __exit am35x_remove(struct platform_device *pdev)

platform_device_del(glue->musb);
platform_device_put(glue->musb);
clk_disable(glue->clk);
clk_disable(glue->phy_clk);
clk_put(glue->clk);
clk_put(glue->phy_clk);
kfree(glue);

return 0;
Expand Down
36 changes: 28 additions & 8 deletions trunk/drivers/usb/musb/da8xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
struct da8xx_glue {
struct device *dev;
struct platform_device *musb;
struct clk *clk;
};

/*
Expand Down Expand Up @@ -423,8 +424,6 @@ static int da8xx_musb_init(struct musb *musb)

musb->mregs += DA8XX_MENTOR_CORE_OFFSET;

clk_enable(musb->clock);

/* Returns zero if e.g. not clocked */
rev = musb_readl(reg_base, DA8XX_USB_REVISION_REG);
if (!rev)
Expand Down Expand Up @@ -456,7 +455,6 @@ static int da8xx_musb_init(struct musb *musb)
musb->isr = da8xx_musb_interrupt;
return 0;
fail:
clk_disable(musb->clock);
return -ENODEV;
}

Expand All @@ -470,8 +468,6 @@ static int da8xx_musb_exit(struct musb *musb)
otg_put_transceiver(musb->xceiv);
usb_nop_xceiv_unregister();

clk_disable(musb->clock);

return 0;
}

Expand All @@ -496,6 +492,8 @@ static int __init da8xx_probe(struct platform_device *pdev)
struct platform_device *musb;
struct da8xx_glue *glue;

struct clk *clk;

int ret = -ENOMEM;

glue = kzalloc(sizeof(*glue), GFP_KERNEL);
Expand All @@ -510,12 +508,26 @@ static int __init da8xx_probe(struct platform_device *pdev)
goto err1;
}

clk = clk_get(&pdev->dev, "usb20");
if (IS_ERR(clk)) {
dev_err(&pdev->dev, "failed to get clock\n");
ret = PTR_ERR(clk);
goto err2;
}

ret = clk_enable(clk);
if (ret) {
dev_err(&pdev->dev, "failed to enable clock\n");
goto err3;
}

musb->dev.parent = &pdev->dev;
musb->dev.dma_mask = &da8xx_dmamask;
musb->dev.coherent_dma_mask = da8xx_dmamask;

glue->dev = &pdev->dev;
glue->musb = musb;
glue->clk = clk;

pdata->platform_ops = &da8xx_ops;

Expand All @@ -525,23 +537,29 @@ static int __init da8xx_probe(struct platform_device *pdev)
pdev->num_resources);
if (ret) {
dev_err(&pdev->dev, "failed to add resources\n");
goto err2;
goto err4;
}

ret = platform_device_add_data(musb, pdata, sizeof(*pdata));
if (ret) {
dev_err(&pdev->dev, "failed to add platform_data\n");
goto err2;
goto err4;
}

ret = platform_device_add(musb);
if (ret) {
dev_err(&pdev->dev, "failed to register musb device\n");
goto err2;
goto err4;
}

return 0;

err4:
clk_disable(clk);

err3:
clk_put(clk);

err2:
platform_device_put(musb);

Expand All @@ -558,6 +576,8 @@ static int __exit da8xx_remove(struct platform_device *pdev)

platform_device_del(glue->musb);
platform_device_put(glue->musb);
clk_disable(glue->clk);
clk_put(glue->clk);
kfree(glue);

return 0;
Expand Down
Loading

0 comments on commit b2b18de

Please sign in to comment.