#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[] = {
},
};
+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,
.mode = MUSB_PERIPHERAL,
#endif
.multipoint = 1,
+ .clock = "usbhs_ick",
+ .set_clock = musb_set_clock,
};
static u64 musb_dmamask = ~(u32)0;
#include <linux/errno.h>
#include <linux/delay.h>
#include <linux/platform_device.h>
+#include <linux/clk.h>
#include <asm/io.h>
#include <asm/arch/mux.h>
#include <linux/usb/musb.h>
#include <asm/arch/hardware.h>
+#include <asm/arch/pm.h>
#include <asm/arch/usb.h>
#ifdef CONFIG_USB_MUSB_SOC
},
};
+static int hsotgusb_ick_on;
+
+static int musb_set_clock(struct clk *clk, int state)
+{
+ if (state) {
+ if (hsotgusb_ick_on > 0)
+ return -ENODEV;
+
+ omap2_block_sleep();
+ clk_enable(clk);
+ hsotgusb_ick_on = 1;
+ } else {
+ if (hsotgusb_ick_on == 0)
+ return -ENODEV;
+
+ clk_disable(clk);
+ hsotgusb_ick_on = 0;
+ omap2_allow_sleep();
+ }
+
+ return 0;
+}
+
static struct musb_hdrc_platform_data musb_plat = {
#ifdef CONFIG_USB_MUSB_OTG
.mode = MUSB_OTG,
.mode = MUSB_PERIPHERAL,
#endif
.multipoint = 1,
- .clock = NULL,
- .set_clock = NULL,
+ .clock = "hsotgusb_ick",
+ .set_clock = musb_set_clock,
};
static u64 musb_dmamask = ~(u32)0;
#if defined(CONFIG_ARCH_OMAP2430)
omap_cfg_reg(AE5_2430_USB0HS_STP);
- /* get the clock */
- musb->clock = clk_get((struct device *)musb->controller, "usbhs_ick");
-#else
- musb->clock = clk_get((struct device *)musb->controller, "hsotgusb_ick");
#endif
- if(IS_ERR(musb->clock))
- return PTR_ERR(musb->clock);
musb->xceiv = *xceiv;
musb_platform_resume(musb);
OTG_SYSCONFIG_REG |= AUTOIDLE; /* enable auto idle */
musb->xceiv.set_suspend(&musb->xceiv, 1);
- clk_disable(musb->clock);
return 0;
}
int musb_platform_resume(struct musb *musb)
{
- clk_enable(musb->clock);
musb->xceiv.set_suspend(&musb->xceiv, 0);
OTG_FORCESTDBY_REG &= ~ENABLEFORCE; /* disable MSTANDBY */