aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/r8a66597-hcd.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/host/r8a66597-hcd.c')
-rw-r--r--drivers/usb/host/r8a66597-hcd.c35
1 files changed, 33 insertions, 2 deletions
diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c
index 2376f24f3c83..d99b9c7098b5 100644
--- a/drivers/usb/host/r8a66597-hcd.c
+++ b/drivers/usb/host/r8a66597-hcd.c
@@ -114,6 +114,9 @@ static int r8a66597_clock_enable(struct r8a66597 *r8a66597)
114 int i = 0; 114 int i = 0;
115 115
116#if defined(CONFIG_SUPERH_ON_CHIP_R8A66597) 116#if defined(CONFIG_SUPERH_ON_CHIP_R8A66597)
117#if defined(CONFIG_HAVE_CLK)
118 clk_enable(r8a66597->clk);
119#endif
117 do { 120 do {
118 r8a66597_write(r8a66597, SCKE, SYSCFG0); 121 r8a66597_write(r8a66597, SCKE, SYSCFG0);
119 tmp = r8a66597_read(r8a66597, SYSCFG0); 122 tmp = r8a66597_read(r8a66597, SYSCFG0);
@@ -154,7 +157,11 @@ static void r8a66597_clock_disable(struct r8a66597 *r8a66597)
154{ 157{
155 r8a66597_bclr(r8a66597, SCKE, SYSCFG0); 158 r8a66597_bclr(r8a66597, SCKE, SYSCFG0);
156 udelay(1); 159 udelay(1);
157#if !defined(CONFIG_SUPERH_ON_CHIP_R8A66597) 160#if defined(CONFIG_SUPERH_ON_CHIP_R8A66597)
161#if defined(CONFIG_HAVE_CLK)
162 clk_disable(r8a66597->clk);
163#endif
164#else
158 r8a66597_bclr(r8a66597, PLLC, SYSCFG0); 165 r8a66597_bclr(r8a66597, PLLC, SYSCFG0);
159 r8a66597_bclr(r8a66597, XCKE, SYSCFG0); 166 r8a66597_bclr(r8a66597, XCKE, SYSCFG0);
160 r8a66597_bclr(r8a66597, USBE, SYSCFG0); 167 r8a66597_bclr(r8a66597, USBE, SYSCFG0);
@@ -2261,6 +2268,9 @@ static int __init_or_module r8a66597_remove(struct platform_device *pdev)
2261 del_timer_sync(&r8a66597->rh_timer); 2268 del_timer_sync(&r8a66597->rh_timer);
2262 usb_remove_hcd(hcd); 2269 usb_remove_hcd(hcd);
2263 iounmap((void *)r8a66597->reg); 2270 iounmap((void *)r8a66597->reg);
2271#if defined(CONFIG_SUPERH_ON_CHIP_R8A66597) && defined(CONFIG_HAVE_CLK)
2272 clk_put(r8a66597->clk);
2273#endif
2264 usb_put_hcd(hcd); 2274 usb_put_hcd(hcd);
2265 return 0; 2275 return 0;
2266} 2276}
@@ -2268,6 +2278,9 @@ static int __init_or_module r8a66597_remove(struct platform_device *pdev)
2268#define resource_len(r) (((r)->end - (r)->start) + 1) 2278#define resource_len(r) (((r)->end - (r)->start) + 1)
2269static int __init r8a66597_probe(struct platform_device *pdev) 2279static int __init r8a66597_probe(struct platform_device *pdev)
2270{ 2280{
2281#if defined(CONFIG_SUPERH_ON_CHIP_R8A66597) && defined(CONFIG_HAVE_CLK)
2282 char clk_name[8];
2283#endif
2271 struct resource *res = NULL, *ires; 2284 struct resource *res = NULL, *ires;
2272 int irq = -1; 2285 int irq = -1;
2273 void __iomem *reg = NULL; 2286 void __iomem *reg = NULL;
@@ -2320,6 +2333,16 @@ static int __init r8a66597_probe(struct platform_device *pdev)
2320 memset(r8a66597, 0, sizeof(struct r8a66597)); 2333 memset(r8a66597, 0, sizeof(struct r8a66597));
2321 dev_set_drvdata(&pdev->dev, r8a66597); 2334 dev_set_drvdata(&pdev->dev, r8a66597);
2322 2335
2336#if defined(CONFIG_SUPERH_ON_CHIP_R8A66597) && defined(CONFIG_HAVE_CLK)
2337 snprintf(clk_name, sizeof(clk_name), "usb%d", pdev->id);
2338 r8a66597->clk = clk_get(&pdev->dev, clk_name);
2339 if (IS_ERR(r8a66597->clk)) {
2340 dev_err(&pdev->dev, "cannot get clock \"%s\"\n", clk_name);
2341 ret = PTR_ERR(r8a66597->clk);
2342 goto clean_up2;
2343 }
2344#endif
2345
2323 spin_lock_init(&r8a66597->lock); 2346 spin_lock_init(&r8a66597->lock);
2324 init_timer(&r8a66597->rh_timer); 2347 init_timer(&r8a66597->rh_timer);
2325 r8a66597->rh_timer.function = r8a66597_timer; 2348 r8a66597->rh_timer.function = r8a66597_timer;
@@ -2365,11 +2388,19 @@ static int __init r8a66597_probe(struct platform_device *pdev)
2365 ret = usb_add_hcd(hcd, irq, IRQF_DISABLED | irq_trigger); 2388 ret = usb_add_hcd(hcd, irq, IRQF_DISABLED | irq_trigger);
2366 if (ret != 0) { 2389 if (ret != 0) {
2367 dev_err(&pdev->dev, "Failed to add hcd\n"); 2390 dev_err(&pdev->dev, "Failed to add hcd\n");
2368 goto clean_up; 2391 goto clean_up3;
2369 } 2392 }
2370 2393
2371 return 0; 2394 return 0;
2372 2395
2396clean_up3:
2397#if defined(CONFIG_SUPERH_ON_CHIP_R8A66597) && defined(CONFIG_HAVE_CLK)
2398 clk_put(r8a66597->clk);
2399#endif
2400
2401clean_up2:
2402 usb_put_hcd(hcd);
2403
2373clean_up: 2404clean_up:
2374 if (reg) 2405 if (reg)
2375 iounmap(reg); 2406 iounmap(reg);