aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget
diff options
context:
space:
mode:
authorChao Xie <chao.xie@marvell.com>2013-03-25 03:06:52 -0400
committerFelipe Balbi <balbi@ti.com>2013-04-02 04:42:45 -0400
commit1919811fe635de4689b4f31a20da3d50196cf43f (patch)
tree032f7ee8829b55395b029e05350f84c938a1d974 /drivers/usb/gadget
parentb65ae0f1a7b98c370967cf161ee87011e3ecdd77 (diff)
usb: gadget: mv_udc_core: remove unused clock
The origianl understanding of clock is wrong. The UDC 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>
Diffstat (limited to 'drivers/usb/gadget')
-rw-r--r--drivers/usb/gadget/mv_udc.h3
-rw-r--r--drivers/usb/gadget/mv_udc_core.c27
2 files changed, 8 insertions, 22 deletions
diff --git a/drivers/usb/gadget/mv_udc.h b/drivers/usb/gadget/mv_udc.h
index 9073436d8b24..be77f207dbaf 100644
--- a/drivers/usb/gadget/mv_udc.h
+++ b/drivers/usb/gadget/mv_udc.h
@@ -222,8 +222,7 @@ struct mv_udc {
222 struct mv_usb_platform_data *pdata; 222 struct mv_usb_platform_data *pdata;
223 223
224 /* some SOC has mutiple clock sources for USB*/ 224 /* some SOC has mutiple clock sources for USB*/
225 unsigned int clknum; 225 struct clk *clk;
226 struct clk *clk[0];
227}; 226};
228 227
229/* endpoint data structure */ 228/* endpoint data structure */
diff --git a/drivers/usb/gadget/mv_udc_core.c b/drivers/usb/gadget/mv_udc_core.c
index 88be74e6297d..c2a57023e467 100644
--- a/drivers/usb/gadget/mv_udc_core.c
+++ b/drivers/usb/gadget/mv_udc_core.c
@@ -974,18 +974,12 @@ static struct usb_ep_ops mv_ep_ops = {
974 974
975static void udc_clock_enable(struct mv_udc *udc) 975static void udc_clock_enable(struct mv_udc *udc)
976{ 976{
977 unsigned int i; 977 clk_prepare_enable(udc->clk);
978
979 for (i = 0; i < udc->clknum; i++)
980 clk_prepare_enable(udc->clk[i]);
981} 978}
982 979
983static void udc_clock_disable(struct mv_udc *udc) 980static void udc_clock_disable(struct mv_udc *udc)
984{ 981{
985 unsigned int i; 982 clk_disable_unprepare(udc->clk);
986
987 for (i = 0; i < udc->clknum; i++)
988 clk_disable_unprepare(udc->clk[i]);
989} 983}
990 984
991static void udc_stop(struct mv_udc *udc) 985static void udc_stop(struct mv_udc *udc)
@@ -2109,7 +2103,6 @@ static int mv_udc_probe(struct platform_device *pdev)
2109 struct mv_usb_platform_data *pdata = pdev->dev.platform_data; 2103 struct mv_usb_platform_data *pdata = pdev->dev.platform_data;
2110 struct mv_udc *udc; 2104 struct mv_udc *udc;
2111 int retval = 0; 2105 int retval = 0;
2112 int clk_i = 0;
2113 struct resource *r; 2106 struct resource *r;
2114 size_t size; 2107 size_t size;
2115 2108
@@ -2118,8 +2111,7 @@ static int mv_udc_probe(struct platform_device *pdev)
2118 return -ENODEV; 2111 return -ENODEV;
2119 } 2112 }
2120 2113
2121 size = sizeof(*udc) + sizeof(struct clk *) * pdata->clknum; 2114 udc = devm_kzalloc(&pdev->dev, sizeof(*udc), GFP_KERNEL);
2122 udc = devm_kzalloc(&pdev->dev, size, GFP_KERNEL);
2123 if (udc == NULL) { 2115 if (udc == NULL) {
2124 dev_err(&pdev->dev, "failed to allocate memory for udc\n"); 2116 dev_err(&pdev->dev, "failed to allocate memory for udc\n");
2125 return -ENOMEM; 2117 return -ENOMEM;
@@ -2145,15 +2137,10 @@ static int mv_udc_probe(struct platform_device *pdev)
2145 } 2137 }
2146 } 2138 }
2147 2139
2148 udc->clknum = pdata->clknum; 2140 /* udc only have one sysclk. */
2149 for (clk_i = 0; clk_i < udc->clknum; clk_i++) { 2141 udc->clk = devm_clk_get(&pdev->dev, NULL);
2150 udc->clk[clk_i] = devm_clk_get(&pdev->dev, 2142 if (IS_ERR(udc->clk))
2151 pdata->clkname[clk_i]); 2143 return PTR_ERR(udc->clk);
2152 if (IS_ERR(udc->clk[clk_i])) {
2153 retval = PTR_ERR(udc->clk[clk_i]);
2154 return retval;
2155 }
2156 }
2157 2144
2158 r = platform_get_resource_byname(udc->dev, IORESOURCE_MEM, "capregs"); 2145 r = platform_get_resource_byname(udc->dev, IORESOURCE_MEM, "capregs");
2159 if (r == NULL) { 2146 if (r == NULL) {