aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChao Xie <chao.xie@marvell.com>2013-03-25 03:06:53 -0400
committerFelipe Balbi <balbi@ti.com>2013-04-02 04:42:45 -0400
commitdf18fedae5f7870529a0a79193e24e67f56d995e (patch)
tree2d7cbf7c44c05784ecb223530567fcc50efe2ab2
parent1919811fe635de4689b4f31a20da3d50196cf43f (diff)
usb: otg: mv_otg: remove unused clock
The origianl understanding of clock is wrong. The OTG controller only have one clock input. Passing clock name by pdata is wrong. The clock is defined by device iteself. Signed-off-by: Chao Xie <chao.xie@marvell.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
-rw-r--r--drivers/usb/phy/phy-mv-usb.c28
-rw-r--r--drivers/usb/phy/phy-mv-usb.h3
2 files changed, 8 insertions, 23 deletions
diff --git a/drivers/usb/phy/phy-mv-usb.c b/drivers/usb/phy/phy-mv-usb.c
index 6872bf0a3681..c987bbe27851 100644
--- a/drivers/usb/phy/phy-mv-usb.c
+++ b/drivers/usb/phy/phy-mv-usb.c
@@ -237,18 +237,12 @@ static void mv_otg_start_periphrals(struct mv_otg *mvotg, int on)
237 237
238static void otg_clock_enable(struct mv_otg *mvotg) 238static void otg_clock_enable(struct mv_otg *mvotg)
239{ 239{
240 unsigned int i; 240 clk_prepare_enable(mvotg->clk);
241
242 for (i = 0; i < mvotg->clknum; i++)
243 clk_prepare_enable(mvotg->clk[i]);
244} 241}
245 242
246static void otg_clock_disable(struct mv_otg *mvotg) 243static void otg_clock_disable(struct mv_otg *mvotg)
247{ 244{
248 unsigned int i; 245 clk_disable_unprepare(mvotg->clk);
249
250 for (i = 0; i < mvotg->clknum; i++)
251 clk_disable_unprepare(mvotg->clk[i]);
252} 246}
253 247
254static int mv_otg_enable_internal(struct mv_otg *mvotg) 248static int mv_otg_enable_internal(struct mv_otg *mvotg)
@@ -684,16 +678,14 @@ static int mv_otg_probe(struct platform_device *pdev)
684 struct mv_otg *mvotg; 678 struct mv_otg *mvotg;
685 struct usb_otg *otg; 679 struct usb_otg *otg;
686 struct resource *r; 680 struct resource *r;
687 int retval = 0, clk_i, i; 681 int retval = 0, i;
688 size_t size;
689 682
690 if (pdata == NULL) { 683 if (pdata == NULL) {
691 dev_err(&pdev->dev, "failed to get platform data\n"); 684 dev_err(&pdev->dev, "failed to get platform data\n");
692 return -ENODEV; 685 return -ENODEV;
693 } 686 }
694 687
695 size = sizeof(*mvotg) + sizeof(struct clk *) * pdata->clknum; 688 mvotg = devm_kzalloc(&pdev->dev, sizeof(*mvotg), GFP_KERNEL);
696 mvotg = devm_kzalloc(&pdev->dev, size, GFP_KERNEL);
697 if (!mvotg) { 689 if (!mvotg) {
698 dev_err(&pdev->dev, "failed to allocate memory!\n"); 690 dev_err(&pdev->dev, "failed to allocate memory!\n");
699 return -ENOMEM; 691 return -ENOMEM;
@@ -708,15 +700,9 @@ static int mv_otg_probe(struct platform_device *pdev)
708 mvotg->pdev = pdev; 700 mvotg->pdev = pdev;
709 mvotg->pdata = pdata; 701 mvotg->pdata = pdata;
710 702
711 mvotg->clknum = pdata->clknum; 703 mvotg->clk = devm_clk_get(&pdev->dev, NULL);
712 for (clk_i = 0; clk_i < mvotg->clknum; clk_i++) { 704 if (IS_ERR(mvotg->clk))
713 mvotg->clk[clk_i] = devm_clk_get(&pdev->dev, 705 return PTR_ERR(mvotg->clk);
714 pdata->clkname[clk_i]);
715 if (IS_ERR(mvotg->clk[clk_i])) {
716 retval = PTR_ERR(mvotg->clk[clk_i]);
717 return retval;
718 }
719 }
720 706
721 mvotg->qwork = create_singlethread_workqueue("mv_otg_queue"); 707 mvotg->qwork = create_singlethread_workqueue("mv_otg_queue");
722 if (!mvotg->qwork) { 708 if (!mvotg->qwork) {
diff --git a/drivers/usb/phy/phy-mv-usb.h b/drivers/usb/phy/phy-mv-usb.h
index 8a9e351b36ba..551da6eb0ba8 100644
--- a/drivers/usb/phy/phy-mv-usb.h
+++ b/drivers/usb/phy/phy-mv-usb.h
@@ -158,8 +158,7 @@ struct mv_otg {
158 158
159 unsigned int active; 159 unsigned int active;
160 unsigned int clock_gating; 160 unsigned int clock_gating;
161 unsigned int clknum; 161 struct clk *clk;
162 struct clk *clk[0];
163}; 162};
164 163
165#endif 164#endif