]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/arm/mach-omap2/board-2430sdp-usb.c
USB: MUSB: Let board specific code handle clock initialization
[linux-2.6-omap-h63xx.git] / arch / arm / mach-omap2 / board-2430sdp-usb.c
index 908a0c0be5b123e206e72bfd8a9db0a1d0a8ba02..7f4e017f30edb8fd0580c0f634e6371691a5a9f3 100644 (file)
 #include <linux/errno.h>
 #include <linux/delay.h>
 #include <linux/platform_device.h>
+#include <linux/clk.h>
 #include <linux/usb/musb.h>
 
 #include <asm/arch/hardware.h>
+#include <asm/arch/pm.h>
 #include <asm/arch/usb.h>
 
 static struct resource musb_resources[] = {
@@ -34,6 +36,29 @@ static struct resource musb_resources[] = {
        },
 };
 
+static int usbhs_ick_on;
+
+static int musb_set_clock(struct clk *clk, int state)
+{
+       if (state) {
+               if (usbhs_ick_on > 0)
+                       return -ENODEV;
+
+               omap2_block_sleep();
+               clk_enable(clk);
+               usbhs_ick_on = 1;
+       } else {
+               if (usbhs_ick_on == 0)
+                       return -ENODEV;
+
+               clk_disable(clk);
+               usbhs_ick_on = 0;
+               omap2_allow_sleep();
+       }
+
+       return 0;
+}
+
 static struct musb_hdrc_platform_data musb_plat = {
 #ifdef CONFIG_USB_MUSB_OTG
        .mode           = MUSB_OTG,
@@ -43,6 +68,8 @@ static struct musb_hdrc_platform_data musb_plat = {
        .mode           = MUSB_PERIPHERAL,
 #endif
        .multipoint     = 1,
+       .clock          = "usbhs_ick",
+       .set_clock      = musb_set_clock,
 };
 
 static u64 musb_dmamask = ~(u32)0;