aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7366.c1
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7723.c1
-rw-r--r--drivers/usb/host/r8a66597-hcd.c35
-rw-r--r--drivers/usb/host/r8a66597.h8
4 files changed, 40 insertions, 5 deletions
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7366.c b/arch/sh/kernel/cpu/sh4a/setup-sh7366.c
index 2f0905a1b211..5f92c864d7bc 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7366.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7366.c
@@ -185,7 +185,6 @@ static int __init sh7366_devices_setup(void)
185 clk_always_enable("mstp023"); /* INTC3 */ 185 clk_always_enable("mstp023"); /* INTC3 */
186 clk_always_enable("mstp022"); /* INTC */ 186 clk_always_enable("mstp022"); /* INTC */
187 clk_always_enable("mstp020"); /* SuperHyway */ 187 clk_always_enable("mstp020"); /* SuperHyway */
188 clk_always_enable("mstp211"); /* USB */
189 clk_always_enable("mstp207"); /* VEU-2 */ 188 clk_always_enable("mstp207"); /* VEU-2 */
190 clk_always_enable("mstp202"); /* VEU-1 */ 189 clk_always_enable("mstp202"); /* VEU-1 */
191 clk_always_enable("mstp201"); /* VPU */ 190 clk_always_enable("mstp201"); /* VPU */
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7723.c b/arch/sh/kernel/cpu/sh4a/setup-sh7723.c
index 63ec348dec70..e9c9d7ead2b3 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7723.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7723.c
@@ -240,7 +240,6 @@ static int __init sh7723_devices_setup(void)
240 clk_always_enable("mstp020"); /* SuperHyway */ 240 clk_always_enable("mstp020"); /* SuperHyway */
241 clk_always_enable("mstp000"); /* MERAM */ 241 clk_always_enable("mstp000"); /* MERAM */
242 clk_always_enable("mstp108"); /* RTC */ 242 clk_always_enable("mstp108"); /* RTC */
243 clk_always_enable("mstp211"); /* USB */
244 clk_always_enable("mstp206"); /* VEU2H1 */ 243 clk_always_enable("mstp206"); /* VEU2H1 */
245 clk_always_enable("mstp202"); /* VEU2H0 */ 244 clk_always_enable("mstp202"); /* VEU2H0 */
246 clk_always_enable("mstp201"); /* VPU */ 245 clk_always_enable("mstp201"); /* VPU */
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);
diff --git a/drivers/usb/host/r8a66597.h b/drivers/usb/host/r8a66597.h
index 84ee01417315..ecacde4d69b0 100644
--- a/drivers/usb/host/r8a66597.h
+++ b/drivers/usb/host/r8a66597.h
@@ -26,6 +26,10 @@
26#ifndef __R8A66597_H__ 26#ifndef __R8A66597_H__
27#define __R8A66597_H__ 27#define __R8A66597_H__
28 28
29#if defined(CONFIG_SUPERH_ON_CHIP_R8A66597) && defined(CONFIG_HAVE_CLK)
30#include <linux/clk.h>
31#endif
32
29#define SYSCFG0 0x00 33#define SYSCFG0 0x00
30#define SYSCFG1 0x02 34#define SYSCFG1 0x02
31#define SYSSTS0 0x04 35#define SYSSTS0 0x04
@@ -481,7 +485,9 @@ struct r8a66597_root_hub {
481struct r8a66597 { 485struct r8a66597 {
482 spinlock_t lock; 486 spinlock_t lock;
483 unsigned long reg; 487 unsigned long reg;
484 488#if defined(CONFIG_SUPERH_ON_CHIP_R8A66597) && defined(CONFIG_HAVE_CLK)
489 struct clk *clk;
490#endif
485 struct r8a66597_device device0; 491 struct r8a66597_device device0;
486 struct r8a66597_root_hub root_hub[R8A66597_MAX_ROOT_HUB]; 492 struct r8a66597_root_hub root_hub[R8A66597_MAX_ROOT_HUB];
487 struct list_head pipe_queue[R8A66597_MAX_NUM_PIPE]; 493 struct list_head pipe_queue[R8A66597_MAX_NUM_PIPE];