aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/ehci-mv.c
diff options
context:
space:
mode:
authorChao Xie <chao.xie@marvell.com>2013-03-25 03:06:54 -0400
committerFelipe Balbi <balbi@ti.com>2013-04-02 04:42:46 -0400
commitb7e159c29548955a61439d217181d67409bf8bc7 (patch)
treed1744c05ef7b1b6ae79086bcfdb7ddd92ef3e2f9 /drivers/usb/host/ehci-mv.c
parentdf18fedae5f7870529a0a79193e24e67f56d995e (diff)
usb: ehci: mv_ehci: remove unused clock
The origianl understanding of clock is wrong. The EHCI controller only have one clock input. Passing clock name by pdata is wrong. The clock is defined by device iteself. Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Chao Xie <chao.xie@marvell.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/host/ehci-mv.c')
-rw-r--r--drivers/usb/host/ehci-mv.c35
1 files changed, 10 insertions, 25 deletions
diff --git a/drivers/usb/host/ehci-mv.c b/drivers/usb/host/ehci-mv.c
index 38048200977c..6bad41af1c4e 100644
--- a/drivers/usb/host/ehci-mv.c
+++ b/drivers/usb/host/ehci-mv.c
@@ -33,25 +33,17 @@ struct ehci_hcd_mv {
33 33
34 struct mv_usb_platform_data *pdata; 34 struct mv_usb_platform_data *pdata;
35 35
36 /* clock source and total clock number */ 36 struct clk *clk;
37 unsigned int clknum;
38 struct clk *clk[0];
39}; 37};
40 38
41static void ehci_clock_enable(struct ehci_hcd_mv *ehci_mv) 39static void ehci_clock_enable(struct ehci_hcd_mv *ehci_mv)
42{ 40{
43 unsigned int i; 41 clk_prepare_enable(ehci_mv->clk);
44
45 for (i = 0; i < ehci_mv->clknum; i++)
46 clk_prepare_enable(ehci_mv->clk[i]);
47} 42}
48 43
49static void ehci_clock_disable(struct ehci_hcd_mv *ehci_mv) 44static void ehci_clock_disable(struct ehci_hcd_mv *ehci_mv)
50{ 45{
51 unsigned int i; 46 clk_disable_unprepare(ehci_mv->clk);
52
53 for (i = 0; i < ehci_mv->clknum; i++)
54 clk_disable_unprepare(ehci_mv->clk[i]);
55} 47}
56 48
57static int mv_ehci_enable(struct ehci_hcd_mv *ehci_mv) 49static int mv_ehci_enable(struct ehci_hcd_mv *ehci_mv)
@@ -144,9 +136,8 @@ static int mv_ehci_probe(struct platform_device *pdev)
144 struct ehci_hcd *ehci; 136 struct ehci_hcd *ehci;
145 struct ehci_hcd_mv *ehci_mv; 137 struct ehci_hcd_mv *ehci_mv;
146 struct resource *r; 138 struct resource *r;
147 int clk_i, retval = -ENODEV; 139 int retval = -ENODEV;
148 u32 offset; 140 u32 offset;
149 size_t size;
150 141
151 if (!pdata) { 142 if (!pdata) {
152 dev_err(&pdev->dev, "missing platform_data\n"); 143 dev_err(&pdev->dev, "missing platform_data\n");
@@ -160,8 +151,7 @@ static int mv_ehci_probe(struct platform_device *pdev)
160 if (!hcd) 151 if (!hcd)
161 return -ENOMEM; 152 return -ENOMEM;
162 153
163 size = sizeof(*ehci_mv) + sizeof(struct clk *) * pdata->clknum; 154 ehci_mv = devm_kzalloc(&pdev->dev, sizeof(*ehci_mv), GFP_KERNEL);
164 ehci_mv = devm_kzalloc(&pdev->dev, size, GFP_KERNEL);
165 if (ehci_mv == NULL) { 155 if (ehci_mv == NULL) {
166 dev_err(&pdev->dev, "cannot allocate ehci_hcd_mv\n"); 156 dev_err(&pdev->dev, "cannot allocate ehci_hcd_mv\n");
167 retval = -ENOMEM; 157 retval = -ENOMEM;
@@ -172,16 +162,11 @@ static int mv_ehci_probe(struct platform_device *pdev)
172 ehci_mv->pdata = pdata; 162 ehci_mv->pdata = pdata;
173 ehci_mv->hcd = hcd; 163 ehci_mv->hcd = hcd;
174 164
175 ehci_mv->clknum = pdata->clknum; 165 ehci_mv->clk = devm_clk_get(&pdev->dev, NULL);
176 for (clk_i = 0; clk_i < ehci_mv->clknum; clk_i++) { 166 if (IS_ERR(ehci_mv->clk)) {
177 ehci_mv->clk[clk_i] = 167 dev_err(&pdev->dev, "error getting clock\n");
178 devm_clk_get(&pdev->dev, pdata->clkname[clk_i]); 168 retval = PTR_ERR(ehci_mv->clk);
179 if (IS_ERR(ehci_mv->clk[clk_i])) { 169 goto err_clear_drvdata;
180 dev_err(&pdev->dev, "error get clck \"%s\"\n",
181 pdata->clkname[clk_i]);
182 retval = PTR_ERR(ehci_mv->clk[clk_i]);
183 goto err_clear_drvdata;
184 }
185 } 170 }
186 171
187 r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "phyregs"); 172 r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "phyregs");