2 * Copyright (C) 2005-2006 by Texas Instruments
4 * This file is part of the Inventra Controller Driver for Linux.
6 * The Inventra Controller Driver for Linux is free software; you
7 * can redistribute it and/or modify it under the terms of the GNU
8 * General Public License version 2 as published by the Free Software
11 * The Inventra Controller Driver for Linux is distributed in
12 * the hope that it will be useful, but WITHOUT ANY WARRANTY;
13 * without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
15 * License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with The Inventra Controller Driver for Linux ; if not,
19 * write to the Free Software Foundation, Inc., 59 Temple Place,
20 * Suite 330, Boston, MA 02111-1307 USA
23 #include <linux/module.h>
24 #include <linux/kernel.h>
25 #include <linux/sched.h>
26 #include <linux/slab.h>
27 #include <linux/init.h>
28 #include <linux/list.h>
29 #include <linux/clk.h>
32 #include <asm/mach-types.h>
33 #include <asm/arch/hardware.h>
34 #include <asm/arch/mux.h>
42 void musb_platform_enable(struct musb *musb)
44 if (is_dma_capable() && dma_off)
45 printk(KERN_WARNING "%s %s: dma not reactivated\n",
46 __FILE__, __FUNCTION__);
51 void musb_platform_disable(struct musb *musb)
53 if (is_dma_capable()) {
54 printk(KERN_WARNING "%s %s: dma still active\n",
55 __FILE__, __FUNCTION__);
60 static void omap_vbus_power(struct musb *musb, int is_on, int sleeping)
64 static void omap_set_vbus(struct musb *musb, int is_on)
66 WARN_ON(is_on && is_peripheral_active(musb));
67 return omap_vbus_power(musb, is_on, 0);
70 int __init musb_platform_init(struct musb *musb)
72 /* Erratum - reset value of STP has pull-down.
73 Change it to pull-up. */
74 omap_cfg_reg(AE5_2430_USB0HS_STP);
77 musb->clock = clk_get((struct device *)musb->controller, "usbhs_ick");
78 clk_enable(musb->clock);
80 omap_writel(omap_readl(OTG_INTERFSEL) | (1<<0), OTG_INTERFSEL);
81 omap_writel(omap_readl(OTG_SYSCONFIG) |
82 ((1 << 12) | (1 << 3) | (1 << 2)),
85 pr_debug("HS USB OTG: revision 0x%x, sysconfig 0x%02x, "
86 "sysstatus 0x%x, intrfsel 0x%x, simenable 0x%x\n",
87 omap_readl(OTG_REVISION), omap_readl(OTG_SYSCONFIG),
88 omap_readl(OTG_SYSSTATUS), omap_readl(OTG_INTERFSEL),
89 omap_readl(OTG_SIMENABLE));
91 musb->board_set_vbus = omap_set_vbus;
92 omap_vbus_power(musb, musb->board_mode == MUSB_HOST, 1);
97 int musb_platform_exit(struct musb *musb)
99 omap_vbus_power(musb, 0 /*off*/, 1);
100 clk_disable(musb->clock);