1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun * Texas Instruments DSPS platforms "glue layer"
3*4882a593Smuzhiyun *
4*4882a593Smuzhiyun * Copyright (C) 2012, by Texas Instruments
5*4882a593Smuzhiyun *
6*4882a593Smuzhiyun * Based on the am35x "glue layer" code.
7*4882a593Smuzhiyun *
8*4882a593Smuzhiyun * This file is part of the Inventra Controller Driver for Linux.
9*4882a593Smuzhiyun *
10*4882a593Smuzhiyun * SPDX-License-Identifier: GPL-2.0
11*4882a593Smuzhiyun *
12*4882a593Smuzhiyun * musb_dsps.c will be a common file for all the TI DSPS platforms
13*4882a593Smuzhiyun * such as dm64x, dm36x, dm35x, da8x, am35x and ti81x.
14*4882a593Smuzhiyun * For now only ti81x is using this and in future davinci.c, am35x.c
15*4882a593Smuzhiyun * da8xx.c would be merged to this file after testing.
16*4882a593Smuzhiyun */
17*4882a593Smuzhiyun
18*4882a593Smuzhiyun #ifndef __UBOOT__
19*4882a593Smuzhiyun #include <linux/init.h>
20*4882a593Smuzhiyun #include <linux/io.h>
21*4882a593Smuzhiyun #include <linux/err.h>
22*4882a593Smuzhiyun #include <linux/platform_device.h>
23*4882a593Smuzhiyun #include <linux/dma-mapping.h>
24*4882a593Smuzhiyun #include <linux/pm_runtime.h>
25*4882a593Smuzhiyun #include <linux/module.h>
26*4882a593Smuzhiyun
27*4882a593Smuzhiyun #include <linux/of.h>
28*4882a593Smuzhiyun #include <linux/of_device.h>
29*4882a593Smuzhiyun #include <linux/of_address.h>
30*4882a593Smuzhiyun
31*4882a593Smuzhiyun #include <plat/usb.h>
32*4882a593Smuzhiyun #else
33*4882a593Smuzhiyun #include <common.h>
34*4882a593Smuzhiyun #include <asm/omap_musb.h>
35*4882a593Smuzhiyun #include "linux-compat.h"
36*4882a593Smuzhiyun #endif
37*4882a593Smuzhiyun
38*4882a593Smuzhiyun #include "musb_core.h"
39*4882a593Smuzhiyun
40*4882a593Smuzhiyun /**
41*4882a593Smuzhiyun * avoid using musb_readx()/musb_writex() as glue layer should not be
42*4882a593Smuzhiyun * dependent on musb core layer symbols.
43*4882a593Smuzhiyun */
dsps_readb(const void __iomem * addr,unsigned offset)44*4882a593Smuzhiyun static inline u8 dsps_readb(const void __iomem *addr, unsigned offset)
45*4882a593Smuzhiyun { return __raw_readb(addr + offset); }
46*4882a593Smuzhiyun
dsps_readl(const void __iomem * addr,unsigned offset)47*4882a593Smuzhiyun static inline u32 dsps_readl(const void __iomem *addr, unsigned offset)
48*4882a593Smuzhiyun { return __raw_readl(addr + offset); }
49*4882a593Smuzhiyun
dsps_writeb(void __iomem * addr,unsigned offset,u8 data)50*4882a593Smuzhiyun static inline void dsps_writeb(void __iomem *addr, unsigned offset, u8 data)
51*4882a593Smuzhiyun { __raw_writeb(data, addr + offset); }
52*4882a593Smuzhiyun
dsps_writel(void __iomem * addr,unsigned offset,u32 data)53*4882a593Smuzhiyun static inline void dsps_writel(void __iomem *addr, unsigned offset, u32 data)
54*4882a593Smuzhiyun { __raw_writel(data, addr + offset); }
55*4882a593Smuzhiyun
56*4882a593Smuzhiyun /**
57*4882a593Smuzhiyun * DSPS musb wrapper register offset.
58*4882a593Smuzhiyun * FIXME: This should be expanded to have all the wrapper registers from TI DSPS
59*4882a593Smuzhiyun * musb ips.
60*4882a593Smuzhiyun */
61*4882a593Smuzhiyun struct dsps_musb_wrapper {
62*4882a593Smuzhiyun u16 revision;
63*4882a593Smuzhiyun u16 control;
64*4882a593Smuzhiyun u16 status;
65*4882a593Smuzhiyun u16 eoi;
66*4882a593Smuzhiyun u16 epintr_set;
67*4882a593Smuzhiyun u16 epintr_clear;
68*4882a593Smuzhiyun u16 epintr_status;
69*4882a593Smuzhiyun u16 coreintr_set;
70*4882a593Smuzhiyun u16 coreintr_clear;
71*4882a593Smuzhiyun u16 coreintr_status;
72*4882a593Smuzhiyun u16 phy_utmi;
73*4882a593Smuzhiyun u16 mode;
74*4882a593Smuzhiyun
75*4882a593Smuzhiyun /* bit positions for control */
76*4882a593Smuzhiyun unsigned reset:5;
77*4882a593Smuzhiyun
78*4882a593Smuzhiyun /* bit positions for interrupt */
79*4882a593Smuzhiyun unsigned usb_shift:5;
80*4882a593Smuzhiyun u32 usb_mask;
81*4882a593Smuzhiyun u32 usb_bitmap;
82*4882a593Smuzhiyun unsigned drvvbus:5;
83*4882a593Smuzhiyun
84*4882a593Smuzhiyun unsigned txep_shift:5;
85*4882a593Smuzhiyun u32 txep_mask;
86*4882a593Smuzhiyun u32 txep_bitmap;
87*4882a593Smuzhiyun
88*4882a593Smuzhiyun unsigned rxep_shift:5;
89*4882a593Smuzhiyun u32 rxep_mask;
90*4882a593Smuzhiyun u32 rxep_bitmap;
91*4882a593Smuzhiyun
92*4882a593Smuzhiyun /* bit positions for phy_utmi */
93*4882a593Smuzhiyun unsigned otg_disable:5;
94*4882a593Smuzhiyun
95*4882a593Smuzhiyun /* bit positions for mode */
96*4882a593Smuzhiyun unsigned iddig:5;
97*4882a593Smuzhiyun /* miscellaneous stuff */
98*4882a593Smuzhiyun u32 musb_core_offset;
99*4882a593Smuzhiyun u8 poll_seconds;
100*4882a593Smuzhiyun };
101*4882a593Smuzhiyun
102*4882a593Smuzhiyun static const struct dsps_musb_wrapper ti81xx_driver_data __devinitconst = {
103*4882a593Smuzhiyun .revision = 0x00,
104*4882a593Smuzhiyun .control = 0x14,
105*4882a593Smuzhiyun .status = 0x18,
106*4882a593Smuzhiyun .eoi = 0x24,
107*4882a593Smuzhiyun .epintr_set = 0x38,
108*4882a593Smuzhiyun .epintr_clear = 0x40,
109*4882a593Smuzhiyun .epintr_status = 0x30,
110*4882a593Smuzhiyun .coreintr_set = 0x3c,
111*4882a593Smuzhiyun .coreintr_clear = 0x44,
112*4882a593Smuzhiyun .coreintr_status = 0x34,
113*4882a593Smuzhiyun .phy_utmi = 0xe0,
114*4882a593Smuzhiyun .mode = 0xe8,
115*4882a593Smuzhiyun .reset = 0,
116*4882a593Smuzhiyun .otg_disable = 21,
117*4882a593Smuzhiyun .iddig = 8,
118*4882a593Smuzhiyun .usb_shift = 0,
119*4882a593Smuzhiyun .usb_mask = 0x1ff,
120*4882a593Smuzhiyun .usb_bitmap = (0x1ff << 0),
121*4882a593Smuzhiyun .drvvbus = 8,
122*4882a593Smuzhiyun .txep_shift = 0,
123*4882a593Smuzhiyun .txep_mask = 0xffff,
124*4882a593Smuzhiyun .txep_bitmap = (0xffff << 0),
125*4882a593Smuzhiyun .rxep_shift = 16,
126*4882a593Smuzhiyun .rxep_mask = 0xfffe,
127*4882a593Smuzhiyun .rxep_bitmap = (0xfffe << 16),
128*4882a593Smuzhiyun .musb_core_offset = 0x400,
129*4882a593Smuzhiyun .poll_seconds = 2,
130*4882a593Smuzhiyun };
131*4882a593Smuzhiyun
132*4882a593Smuzhiyun /**
133*4882a593Smuzhiyun * DSPS glue structure.
134*4882a593Smuzhiyun */
135*4882a593Smuzhiyun struct dsps_glue {
136*4882a593Smuzhiyun struct device *dev;
137*4882a593Smuzhiyun struct platform_device *musb; /* child musb pdev */
138*4882a593Smuzhiyun const struct dsps_musb_wrapper *wrp; /* wrapper register offsets */
139*4882a593Smuzhiyun struct timer_list timer; /* otg_workaround timer */
140*4882a593Smuzhiyun };
141*4882a593Smuzhiyun
142*4882a593Smuzhiyun /**
143*4882a593Smuzhiyun * dsps_musb_enable - enable interrupts
144*4882a593Smuzhiyun */
145*4882a593Smuzhiyun #ifndef __UBOOT__
dsps_musb_enable(struct musb * musb)146*4882a593Smuzhiyun static void dsps_musb_enable(struct musb *musb)
147*4882a593Smuzhiyun #else
148*4882a593Smuzhiyun static int dsps_musb_enable(struct musb *musb)
149*4882a593Smuzhiyun #endif
150*4882a593Smuzhiyun {
151*4882a593Smuzhiyun #ifndef __UBOOT__
152*4882a593Smuzhiyun struct device *dev = musb->controller;
153*4882a593Smuzhiyun struct platform_device *pdev = to_platform_device(dev->parent);
154*4882a593Smuzhiyun struct dsps_glue *glue = platform_get_drvdata(pdev);
155*4882a593Smuzhiyun const struct dsps_musb_wrapper *wrp = glue->wrp;
156*4882a593Smuzhiyun #else
157*4882a593Smuzhiyun const struct dsps_musb_wrapper *wrp = &ti81xx_driver_data;
158*4882a593Smuzhiyun #endif
159*4882a593Smuzhiyun void __iomem *reg_base = musb->ctrl_base;
160*4882a593Smuzhiyun u32 epmask, coremask;
161*4882a593Smuzhiyun
162*4882a593Smuzhiyun /* Workaround: setup IRQs through both register sets. */
163*4882a593Smuzhiyun epmask = ((musb->epmask & wrp->txep_mask) << wrp->txep_shift) |
164*4882a593Smuzhiyun ((musb->epmask & wrp->rxep_mask) << wrp->rxep_shift);
165*4882a593Smuzhiyun coremask = (wrp->usb_bitmap & ~MUSB_INTR_SOF);
166*4882a593Smuzhiyun
167*4882a593Smuzhiyun dsps_writel(reg_base, wrp->epintr_set, epmask);
168*4882a593Smuzhiyun dsps_writel(reg_base, wrp->coreintr_set, coremask);
169*4882a593Smuzhiyun /* Force the DRVVBUS IRQ so we can start polling for ID change. */
170*4882a593Smuzhiyun #ifndef __UBOOT__
171*4882a593Smuzhiyun if (is_otg_enabled(musb))
172*4882a593Smuzhiyun dsps_writel(reg_base, wrp->coreintr_set,
173*4882a593Smuzhiyun (1 << wrp->drvvbus) << wrp->usb_shift);
174*4882a593Smuzhiyun #else
175*4882a593Smuzhiyun return 0;
176*4882a593Smuzhiyun #endif
177*4882a593Smuzhiyun }
178*4882a593Smuzhiyun
179*4882a593Smuzhiyun /**
180*4882a593Smuzhiyun * dsps_musb_disable - disable HDRC and flush interrupts
181*4882a593Smuzhiyun */
dsps_musb_disable(struct musb * musb)182*4882a593Smuzhiyun static void dsps_musb_disable(struct musb *musb)
183*4882a593Smuzhiyun {
184*4882a593Smuzhiyun #ifndef __UBOOT__
185*4882a593Smuzhiyun struct device *dev = musb->controller;
186*4882a593Smuzhiyun struct platform_device *pdev = to_platform_device(dev->parent);
187*4882a593Smuzhiyun struct dsps_glue *glue = platform_get_drvdata(pdev);
188*4882a593Smuzhiyun const struct dsps_musb_wrapper *wrp = glue->wrp;
189*4882a593Smuzhiyun void __iomem *reg_base = musb->ctrl_base;
190*4882a593Smuzhiyun
191*4882a593Smuzhiyun dsps_writel(reg_base, wrp->coreintr_clear, wrp->usb_bitmap);
192*4882a593Smuzhiyun dsps_writel(reg_base, wrp->epintr_clear,
193*4882a593Smuzhiyun wrp->txep_bitmap | wrp->rxep_bitmap);
194*4882a593Smuzhiyun dsps_writeb(musb->mregs, MUSB_DEVCTL, 0);
195*4882a593Smuzhiyun dsps_writel(reg_base, wrp->eoi, 0);
196*4882a593Smuzhiyun #endif
197*4882a593Smuzhiyun }
198*4882a593Smuzhiyun
199*4882a593Smuzhiyun #ifndef __UBOOT__
otg_timer(unsigned long _musb)200*4882a593Smuzhiyun static void otg_timer(unsigned long _musb)
201*4882a593Smuzhiyun {
202*4882a593Smuzhiyun struct musb *musb = (void *)_musb;
203*4882a593Smuzhiyun void __iomem *mregs = musb->mregs;
204*4882a593Smuzhiyun struct device *dev = musb->controller;
205*4882a593Smuzhiyun struct platform_device *pdev = to_platform_device(dev->parent);
206*4882a593Smuzhiyun struct dsps_glue *glue = platform_get_drvdata(pdev);
207*4882a593Smuzhiyun const struct dsps_musb_wrapper *wrp = glue->wrp;
208*4882a593Smuzhiyun u8 devctl;
209*4882a593Smuzhiyun unsigned long flags;
210*4882a593Smuzhiyun
211*4882a593Smuzhiyun /*
212*4882a593Smuzhiyun * We poll because DSPS IP's won't expose several OTG-critical
213*4882a593Smuzhiyun * status change events (from the transceiver) otherwise.
214*4882a593Smuzhiyun */
215*4882a593Smuzhiyun devctl = dsps_readb(mregs, MUSB_DEVCTL);
216*4882a593Smuzhiyun dev_dbg(musb->controller, "Poll devctl %02x (%s)\n", devctl,
217*4882a593Smuzhiyun otg_state_string(musb->xceiv->state));
218*4882a593Smuzhiyun
219*4882a593Smuzhiyun spin_lock_irqsave(&musb->lock, flags);
220*4882a593Smuzhiyun switch (musb->xceiv->state) {
221*4882a593Smuzhiyun case OTG_STATE_A_WAIT_BCON:
222*4882a593Smuzhiyun devctl &= ~MUSB_DEVCTL_SESSION;
223*4882a593Smuzhiyun dsps_writeb(musb->mregs, MUSB_DEVCTL, devctl);
224*4882a593Smuzhiyun
225*4882a593Smuzhiyun devctl = dsps_readb(musb->mregs, MUSB_DEVCTL);
226*4882a593Smuzhiyun if (devctl & MUSB_DEVCTL_BDEVICE) {
227*4882a593Smuzhiyun musb->xceiv->state = OTG_STATE_B_IDLE;
228*4882a593Smuzhiyun MUSB_DEV_MODE(musb);
229*4882a593Smuzhiyun } else {
230*4882a593Smuzhiyun musb->xceiv->state = OTG_STATE_A_IDLE;
231*4882a593Smuzhiyun MUSB_HST_MODE(musb);
232*4882a593Smuzhiyun }
233*4882a593Smuzhiyun break;
234*4882a593Smuzhiyun case OTG_STATE_A_WAIT_VFALL:
235*4882a593Smuzhiyun musb->xceiv->state = OTG_STATE_A_WAIT_VRISE;
236*4882a593Smuzhiyun dsps_writel(musb->ctrl_base, wrp->coreintr_set,
237*4882a593Smuzhiyun MUSB_INTR_VBUSERROR << wrp->usb_shift);
238*4882a593Smuzhiyun break;
239*4882a593Smuzhiyun case OTG_STATE_B_IDLE:
240*4882a593Smuzhiyun if (!is_peripheral_enabled(musb))
241*4882a593Smuzhiyun break;
242*4882a593Smuzhiyun
243*4882a593Smuzhiyun devctl = dsps_readb(mregs, MUSB_DEVCTL);
244*4882a593Smuzhiyun if (devctl & MUSB_DEVCTL_BDEVICE)
245*4882a593Smuzhiyun mod_timer(&glue->timer,
246*4882a593Smuzhiyun jiffies + wrp->poll_seconds * HZ);
247*4882a593Smuzhiyun else
248*4882a593Smuzhiyun musb->xceiv->state = OTG_STATE_A_IDLE;
249*4882a593Smuzhiyun break;
250*4882a593Smuzhiyun default:
251*4882a593Smuzhiyun break;
252*4882a593Smuzhiyun }
253*4882a593Smuzhiyun spin_unlock_irqrestore(&musb->lock, flags);
254*4882a593Smuzhiyun }
255*4882a593Smuzhiyun
dsps_musb_try_idle(struct musb * musb,unsigned long timeout)256*4882a593Smuzhiyun static void dsps_musb_try_idle(struct musb *musb, unsigned long timeout)
257*4882a593Smuzhiyun {
258*4882a593Smuzhiyun struct device *dev = musb->controller;
259*4882a593Smuzhiyun struct platform_device *pdev = to_platform_device(dev->parent);
260*4882a593Smuzhiyun struct dsps_glue *glue = platform_get_drvdata(pdev);
261*4882a593Smuzhiyun static unsigned long last_timer;
262*4882a593Smuzhiyun
263*4882a593Smuzhiyun if (!is_otg_enabled(musb))
264*4882a593Smuzhiyun return;
265*4882a593Smuzhiyun
266*4882a593Smuzhiyun if (timeout == 0)
267*4882a593Smuzhiyun timeout = jiffies + msecs_to_jiffies(3);
268*4882a593Smuzhiyun
269*4882a593Smuzhiyun /* Never idle if active, or when VBUS timeout is not set as host */
270*4882a593Smuzhiyun if (musb->is_active || (musb->a_wait_bcon == 0 &&
271*4882a593Smuzhiyun musb->xceiv->state == OTG_STATE_A_WAIT_BCON)) {
272*4882a593Smuzhiyun dev_dbg(musb->controller, "%s active, deleting timer\n",
273*4882a593Smuzhiyun otg_state_string(musb->xceiv->state));
274*4882a593Smuzhiyun del_timer(&glue->timer);
275*4882a593Smuzhiyun last_timer = jiffies;
276*4882a593Smuzhiyun return;
277*4882a593Smuzhiyun }
278*4882a593Smuzhiyun
279*4882a593Smuzhiyun if (time_after(last_timer, timeout) && timer_pending(&glue->timer)) {
280*4882a593Smuzhiyun dev_dbg(musb->controller,
281*4882a593Smuzhiyun "Longer idle timer already pending, ignoring...\n");
282*4882a593Smuzhiyun return;
283*4882a593Smuzhiyun }
284*4882a593Smuzhiyun last_timer = timeout;
285*4882a593Smuzhiyun
286*4882a593Smuzhiyun dev_dbg(musb->controller, "%s inactive, starting idle timer for %u ms\n",
287*4882a593Smuzhiyun otg_state_string(musb->xceiv->state),
288*4882a593Smuzhiyun jiffies_to_msecs(timeout - jiffies));
289*4882a593Smuzhiyun mod_timer(&glue->timer, timeout);
290*4882a593Smuzhiyun }
291*4882a593Smuzhiyun #endif
292*4882a593Smuzhiyun
dsps_interrupt(int irq,void * hci)293*4882a593Smuzhiyun static irqreturn_t dsps_interrupt(int irq, void *hci)
294*4882a593Smuzhiyun {
295*4882a593Smuzhiyun struct musb *musb = hci;
296*4882a593Smuzhiyun void __iomem *reg_base = musb->ctrl_base;
297*4882a593Smuzhiyun #ifndef __UBOOT__
298*4882a593Smuzhiyun struct device *dev = musb->controller;
299*4882a593Smuzhiyun struct platform_device *pdev = to_platform_device(dev->parent);
300*4882a593Smuzhiyun struct dsps_glue *glue = platform_get_drvdata(pdev);
301*4882a593Smuzhiyun const struct dsps_musb_wrapper *wrp = glue->wrp;
302*4882a593Smuzhiyun #else
303*4882a593Smuzhiyun const struct dsps_musb_wrapper *wrp = &ti81xx_driver_data;
304*4882a593Smuzhiyun #endif
305*4882a593Smuzhiyun unsigned long flags;
306*4882a593Smuzhiyun irqreturn_t ret = IRQ_NONE;
307*4882a593Smuzhiyun u32 epintr, usbintr;
308*4882a593Smuzhiyun
309*4882a593Smuzhiyun spin_lock_irqsave(&musb->lock, flags);
310*4882a593Smuzhiyun
311*4882a593Smuzhiyun /* Get endpoint interrupts */
312*4882a593Smuzhiyun epintr = dsps_readl(reg_base, wrp->epintr_status);
313*4882a593Smuzhiyun musb->int_rx = (epintr & wrp->rxep_bitmap) >> wrp->rxep_shift;
314*4882a593Smuzhiyun musb->int_tx = (epintr & wrp->txep_bitmap) >> wrp->txep_shift;
315*4882a593Smuzhiyun
316*4882a593Smuzhiyun if (epintr)
317*4882a593Smuzhiyun dsps_writel(reg_base, wrp->epintr_status, epintr);
318*4882a593Smuzhiyun
319*4882a593Smuzhiyun /* Get usb core interrupts */
320*4882a593Smuzhiyun usbintr = dsps_readl(reg_base, wrp->coreintr_status);
321*4882a593Smuzhiyun if (!usbintr && !epintr)
322*4882a593Smuzhiyun goto eoi;
323*4882a593Smuzhiyun
324*4882a593Smuzhiyun musb->int_usb = (usbintr & wrp->usb_bitmap) >> wrp->usb_shift;
325*4882a593Smuzhiyun if (usbintr)
326*4882a593Smuzhiyun dsps_writel(reg_base, wrp->coreintr_status, usbintr);
327*4882a593Smuzhiyun
328*4882a593Smuzhiyun dev_dbg(musb->controller, "usbintr (%x) epintr(%x)\n",
329*4882a593Smuzhiyun usbintr, epintr);
330*4882a593Smuzhiyun #ifndef __UBOOT__
331*4882a593Smuzhiyun /*
332*4882a593Smuzhiyun * DRVVBUS IRQs are the only proxy we have (a very poor one!) for
333*4882a593Smuzhiyun * DSPS IP's missing ID change IRQ. We need an ID change IRQ to
334*4882a593Smuzhiyun * switch appropriately between halves of the OTG state machine.
335*4882a593Smuzhiyun * Managing DEVCTL.SESSION per Mentor docs requires that we know its
336*4882a593Smuzhiyun * value but DEVCTL.BDEVICE is invalid without DEVCTL.SESSION set.
337*4882a593Smuzhiyun * Also, DRVVBUS pulses for SRP (but not at 5V) ...
338*4882a593Smuzhiyun */
339*4882a593Smuzhiyun if ((usbintr & MUSB_INTR_BABBLE) && is_host_enabled(musb))
340*4882a593Smuzhiyun pr_info("CAUTION: musb: Babble Interrupt Occured\n");
341*4882a593Smuzhiyun
342*4882a593Smuzhiyun if (usbintr & ((1 << wrp->drvvbus) << wrp->usb_shift)) {
343*4882a593Smuzhiyun int drvvbus = dsps_readl(reg_base, wrp->status);
344*4882a593Smuzhiyun void __iomem *mregs = musb->mregs;
345*4882a593Smuzhiyun u8 devctl = dsps_readb(mregs, MUSB_DEVCTL);
346*4882a593Smuzhiyun int err;
347*4882a593Smuzhiyun
348*4882a593Smuzhiyun err = is_host_enabled(musb) && (musb->int_usb &
349*4882a593Smuzhiyun MUSB_INTR_VBUSERROR);
350*4882a593Smuzhiyun if (err) {
351*4882a593Smuzhiyun /*
352*4882a593Smuzhiyun * The Mentor core doesn't debounce VBUS as needed
353*4882a593Smuzhiyun * to cope with device connect current spikes. This
354*4882a593Smuzhiyun * means it's not uncommon for bus-powered devices
355*4882a593Smuzhiyun * to get VBUS errors during enumeration.
356*4882a593Smuzhiyun *
357*4882a593Smuzhiyun * This is a workaround, but newer RTL from Mentor
358*4882a593Smuzhiyun * seems to allow a better one: "re"-starting sessions
359*4882a593Smuzhiyun * without waiting for VBUS to stop registering in
360*4882a593Smuzhiyun * devctl.
361*4882a593Smuzhiyun */
362*4882a593Smuzhiyun musb->int_usb &= ~MUSB_INTR_VBUSERROR;
363*4882a593Smuzhiyun musb->xceiv->state = OTG_STATE_A_WAIT_VFALL;
364*4882a593Smuzhiyun mod_timer(&glue->timer,
365*4882a593Smuzhiyun jiffies + wrp->poll_seconds * HZ);
366*4882a593Smuzhiyun WARNING("VBUS error workaround (delay coming)\n");
367*4882a593Smuzhiyun } else if (is_host_enabled(musb) && drvvbus) {
368*4882a593Smuzhiyun musb->is_active = 1;
369*4882a593Smuzhiyun MUSB_HST_MODE(musb);
370*4882a593Smuzhiyun musb->xceiv->otg->default_a = 1;
371*4882a593Smuzhiyun musb->xceiv->state = OTG_STATE_A_WAIT_VRISE;
372*4882a593Smuzhiyun del_timer(&glue->timer);
373*4882a593Smuzhiyun } else {
374*4882a593Smuzhiyun musb->is_active = 0;
375*4882a593Smuzhiyun MUSB_DEV_MODE(musb);
376*4882a593Smuzhiyun musb->xceiv->otg->default_a = 0;
377*4882a593Smuzhiyun musb->xceiv->state = OTG_STATE_B_IDLE;
378*4882a593Smuzhiyun }
379*4882a593Smuzhiyun
380*4882a593Smuzhiyun /* NOTE: this must complete power-on within 100 ms. */
381*4882a593Smuzhiyun dev_dbg(musb->controller, "VBUS %s (%s)%s, devctl %02x\n",
382*4882a593Smuzhiyun drvvbus ? "on" : "off",
383*4882a593Smuzhiyun otg_state_string(musb->xceiv->state),
384*4882a593Smuzhiyun err ? " ERROR" : "",
385*4882a593Smuzhiyun devctl);
386*4882a593Smuzhiyun ret = IRQ_HANDLED;
387*4882a593Smuzhiyun }
388*4882a593Smuzhiyun #endif
389*4882a593Smuzhiyun
390*4882a593Smuzhiyun if (musb->int_tx || musb->int_rx || musb->int_usb)
391*4882a593Smuzhiyun ret |= musb_interrupt(musb);
392*4882a593Smuzhiyun
393*4882a593Smuzhiyun eoi:
394*4882a593Smuzhiyun /* EOI needs to be written for the IRQ to be re-asserted. */
395*4882a593Smuzhiyun if (ret == IRQ_HANDLED || epintr || usbintr)
396*4882a593Smuzhiyun dsps_writel(reg_base, wrp->eoi, 1);
397*4882a593Smuzhiyun
398*4882a593Smuzhiyun #ifndef __UBOOT__
399*4882a593Smuzhiyun /* Poll for ID change */
400*4882a593Smuzhiyun if (is_otg_enabled(musb) && musb->xceiv->state == OTG_STATE_B_IDLE)
401*4882a593Smuzhiyun mod_timer(&glue->timer, jiffies + wrp->poll_seconds * HZ);
402*4882a593Smuzhiyun #endif
403*4882a593Smuzhiyun
404*4882a593Smuzhiyun spin_unlock_irqrestore(&musb->lock, flags);
405*4882a593Smuzhiyun
406*4882a593Smuzhiyun return ret;
407*4882a593Smuzhiyun }
408*4882a593Smuzhiyun
dsps_musb_init(struct musb * musb)409*4882a593Smuzhiyun static int dsps_musb_init(struct musb *musb)
410*4882a593Smuzhiyun {
411*4882a593Smuzhiyun #ifndef __UBOOT__
412*4882a593Smuzhiyun struct device *dev = musb->controller;
413*4882a593Smuzhiyun struct musb_hdrc_platform_data *plat = dev->platform_data;
414*4882a593Smuzhiyun struct platform_device *pdev = to_platform_device(dev->parent);
415*4882a593Smuzhiyun struct dsps_glue *glue = platform_get_drvdata(pdev);
416*4882a593Smuzhiyun const struct dsps_musb_wrapper *wrp = glue->wrp;
417*4882a593Smuzhiyun struct omap_musb_board_data *data = plat->board_data;
418*4882a593Smuzhiyun #else
419*4882a593Smuzhiyun struct omap_musb_board_data *data =
420*4882a593Smuzhiyun (struct omap_musb_board_data *)musb->controller;
421*4882a593Smuzhiyun const struct dsps_musb_wrapper *wrp = &ti81xx_driver_data;
422*4882a593Smuzhiyun #endif
423*4882a593Smuzhiyun void __iomem *reg_base = musb->ctrl_base;
424*4882a593Smuzhiyun u32 rev, val;
425*4882a593Smuzhiyun int status;
426*4882a593Smuzhiyun
427*4882a593Smuzhiyun /* mentor core register starts at offset of 0x400 from musb base */
428*4882a593Smuzhiyun musb->mregs += wrp->musb_core_offset;
429*4882a593Smuzhiyun
430*4882a593Smuzhiyun #ifndef __UBOOT__
431*4882a593Smuzhiyun /* NOP driver needs change if supporting dual instance */
432*4882a593Smuzhiyun usb_nop_xceiv_register();
433*4882a593Smuzhiyun musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
434*4882a593Smuzhiyun if (IS_ERR_OR_NULL(musb->xceiv))
435*4882a593Smuzhiyun return -ENODEV;
436*4882a593Smuzhiyun #endif
437*4882a593Smuzhiyun
438*4882a593Smuzhiyun /* Returns zero if e.g. not clocked */
439*4882a593Smuzhiyun rev = dsps_readl(reg_base, wrp->revision);
440*4882a593Smuzhiyun if (!rev) {
441*4882a593Smuzhiyun status = -ENODEV;
442*4882a593Smuzhiyun goto err0;
443*4882a593Smuzhiyun }
444*4882a593Smuzhiyun
445*4882a593Smuzhiyun #ifndef __UBOOT__
446*4882a593Smuzhiyun if (is_host_enabled(musb))
447*4882a593Smuzhiyun setup_timer(&glue->timer, otg_timer, (unsigned long) musb);
448*4882a593Smuzhiyun #endif
449*4882a593Smuzhiyun
450*4882a593Smuzhiyun /* Reset the musb */
451*4882a593Smuzhiyun dsps_writel(reg_base, wrp->control, (1 << wrp->reset));
452*4882a593Smuzhiyun
453*4882a593Smuzhiyun /* Start the on-chip PHY and its PLL. */
454*4882a593Smuzhiyun if (data->set_phy_power)
455*4882a593Smuzhiyun data->set_phy_power(data->dev, 1);
456*4882a593Smuzhiyun
457*4882a593Smuzhiyun musb->isr = dsps_interrupt;
458*4882a593Smuzhiyun
459*4882a593Smuzhiyun /* reset the otgdisable bit, needed for host mode to work */
460*4882a593Smuzhiyun val = dsps_readl(reg_base, wrp->phy_utmi);
461*4882a593Smuzhiyun val &= ~(1 << wrp->otg_disable);
462*4882a593Smuzhiyun dsps_writel(musb->ctrl_base, wrp->phy_utmi, val);
463*4882a593Smuzhiyun
464*4882a593Smuzhiyun /* clear level interrupt */
465*4882a593Smuzhiyun dsps_writel(reg_base, wrp->eoi, 0);
466*4882a593Smuzhiyun
467*4882a593Smuzhiyun return 0;
468*4882a593Smuzhiyun err0:
469*4882a593Smuzhiyun #ifndef __UBOOT__
470*4882a593Smuzhiyun usb_put_phy(musb->xceiv);
471*4882a593Smuzhiyun usb_nop_xceiv_unregister();
472*4882a593Smuzhiyun #endif
473*4882a593Smuzhiyun return status;
474*4882a593Smuzhiyun }
475*4882a593Smuzhiyun
dsps_musb_exit(struct musb * musb)476*4882a593Smuzhiyun static int dsps_musb_exit(struct musb *musb)
477*4882a593Smuzhiyun {
478*4882a593Smuzhiyun #ifndef __UBOOT__
479*4882a593Smuzhiyun struct device *dev = musb->controller;
480*4882a593Smuzhiyun struct musb_hdrc_platform_data *plat = dev->platform_data;
481*4882a593Smuzhiyun struct omap_musb_board_data *data = plat->board_data;
482*4882a593Smuzhiyun struct platform_device *pdev = to_platform_device(dev->parent);
483*4882a593Smuzhiyun struct dsps_glue *glue = platform_get_drvdata(pdev);
484*4882a593Smuzhiyun #else
485*4882a593Smuzhiyun struct omap_musb_board_data *data =
486*4882a593Smuzhiyun (struct omap_musb_board_data *)musb->controller;
487*4882a593Smuzhiyun #endif
488*4882a593Smuzhiyun
489*4882a593Smuzhiyun #ifndef __UBOOT__
490*4882a593Smuzhiyun if (is_host_enabled(musb))
491*4882a593Smuzhiyun del_timer_sync(&glue->timer);
492*4882a593Smuzhiyun #endif
493*4882a593Smuzhiyun
494*4882a593Smuzhiyun /* Shutdown the on-chip PHY and its PLL. */
495*4882a593Smuzhiyun if (data->set_phy_power)
496*4882a593Smuzhiyun data->set_phy_power(data->dev, 0);
497*4882a593Smuzhiyun
498*4882a593Smuzhiyun #ifndef __UBOOT__
499*4882a593Smuzhiyun /* NOP driver needs change if supporting dual instance */
500*4882a593Smuzhiyun usb_put_phy(musb->xceiv);
501*4882a593Smuzhiyun usb_nop_xceiv_unregister();
502*4882a593Smuzhiyun #endif
503*4882a593Smuzhiyun
504*4882a593Smuzhiyun return 0;
505*4882a593Smuzhiyun }
506*4882a593Smuzhiyun
507*4882a593Smuzhiyun #ifndef __UBOOT__
508*4882a593Smuzhiyun static struct musb_platform_ops dsps_ops = {
509*4882a593Smuzhiyun #else
510*4882a593Smuzhiyun struct musb_platform_ops musb_dsps_ops = {
511*4882a593Smuzhiyun #endif
512*4882a593Smuzhiyun .init = dsps_musb_init,
513*4882a593Smuzhiyun .exit = dsps_musb_exit,
514*4882a593Smuzhiyun
515*4882a593Smuzhiyun .enable = dsps_musb_enable,
516*4882a593Smuzhiyun .disable = dsps_musb_disable,
517*4882a593Smuzhiyun
518*4882a593Smuzhiyun #ifndef __UBOOT__
519*4882a593Smuzhiyun .try_idle = dsps_musb_try_idle,
520*4882a593Smuzhiyun #endif
521*4882a593Smuzhiyun };
522*4882a593Smuzhiyun
523*4882a593Smuzhiyun #ifndef __UBOOT__
524*4882a593Smuzhiyun static u64 musb_dmamask = DMA_BIT_MASK(32);
525*4882a593Smuzhiyun #endif
526*4882a593Smuzhiyun
527*4882a593Smuzhiyun #ifndef __UBOOT__
dsps_create_musb_pdev(struct dsps_glue * glue,u8 id)528*4882a593Smuzhiyun static int __devinit dsps_create_musb_pdev(struct dsps_glue *glue, u8 id)
529*4882a593Smuzhiyun {
530*4882a593Smuzhiyun struct device *dev = glue->dev;
531*4882a593Smuzhiyun struct platform_device *pdev = to_platform_device(dev);
532*4882a593Smuzhiyun struct musb_hdrc_platform_data *pdata = dev->platform_data;
533*4882a593Smuzhiyun struct platform_device *musb;
534*4882a593Smuzhiyun struct resource *res;
535*4882a593Smuzhiyun struct resource resources[2];
536*4882a593Smuzhiyun char res_name[10];
537*4882a593Smuzhiyun int ret;
538*4882a593Smuzhiyun
539*4882a593Smuzhiyun /* get memory resource */
540*4882a593Smuzhiyun sprintf(res_name, "musb%d", id);
541*4882a593Smuzhiyun res = platform_get_resource_byname(pdev, IORESOURCE_MEM, res_name);
542*4882a593Smuzhiyun if (!res) {
543*4882a593Smuzhiyun dev_err(dev, "%s get mem resource failed\n", res_name);
544*4882a593Smuzhiyun ret = -ENODEV;
545*4882a593Smuzhiyun goto err0;
546*4882a593Smuzhiyun }
547*4882a593Smuzhiyun res->parent = NULL;
548*4882a593Smuzhiyun resources[0] = *res;
549*4882a593Smuzhiyun
550*4882a593Smuzhiyun /* get irq resource */
551*4882a593Smuzhiyun sprintf(res_name, "musb%d-irq", id);
552*4882a593Smuzhiyun res = platform_get_resource_byname(pdev, IORESOURCE_IRQ, res_name);
553*4882a593Smuzhiyun if (!res) {
554*4882a593Smuzhiyun dev_err(dev, "%s get irq resource failed\n", res_name);
555*4882a593Smuzhiyun ret = -ENODEV;
556*4882a593Smuzhiyun goto err0;
557*4882a593Smuzhiyun }
558*4882a593Smuzhiyun res->parent = NULL;
559*4882a593Smuzhiyun resources[1] = *res;
560*4882a593Smuzhiyun resources[1].name = "mc";
561*4882a593Smuzhiyun
562*4882a593Smuzhiyun /* allocate the child platform device */
563*4882a593Smuzhiyun musb = platform_device_alloc("musb-hdrc", -1);
564*4882a593Smuzhiyun if (!musb) {
565*4882a593Smuzhiyun dev_err(dev, "failed to allocate musb device\n");
566*4882a593Smuzhiyun ret = -ENOMEM;
567*4882a593Smuzhiyun goto err0;
568*4882a593Smuzhiyun }
569*4882a593Smuzhiyun
570*4882a593Smuzhiyun musb->dev.parent = dev;
571*4882a593Smuzhiyun musb->dev.dma_mask = &musb_dmamask;
572*4882a593Smuzhiyun musb->dev.coherent_dma_mask = musb_dmamask;
573*4882a593Smuzhiyun
574*4882a593Smuzhiyun glue->musb = musb;
575*4882a593Smuzhiyun
576*4882a593Smuzhiyun pdata->platform_ops = &dsps_ops;
577*4882a593Smuzhiyun
578*4882a593Smuzhiyun ret = platform_device_add_resources(musb, resources, 2);
579*4882a593Smuzhiyun if (ret) {
580*4882a593Smuzhiyun dev_err(dev, "failed to add resources\n");
581*4882a593Smuzhiyun goto err1;
582*4882a593Smuzhiyun }
583*4882a593Smuzhiyun
584*4882a593Smuzhiyun ret = platform_device_add_data(musb, pdata, sizeof(*pdata));
585*4882a593Smuzhiyun if (ret) {
586*4882a593Smuzhiyun dev_err(dev, "failed to add platform_data\n");
587*4882a593Smuzhiyun goto err1;
588*4882a593Smuzhiyun }
589*4882a593Smuzhiyun
590*4882a593Smuzhiyun ret = platform_device_add(musb);
591*4882a593Smuzhiyun if (ret) {
592*4882a593Smuzhiyun dev_err(dev, "failed to register musb device\n");
593*4882a593Smuzhiyun goto err1;
594*4882a593Smuzhiyun }
595*4882a593Smuzhiyun
596*4882a593Smuzhiyun return 0;
597*4882a593Smuzhiyun
598*4882a593Smuzhiyun err1:
599*4882a593Smuzhiyun platform_device_put(musb);
600*4882a593Smuzhiyun err0:
601*4882a593Smuzhiyun return ret;
602*4882a593Smuzhiyun }
603*4882a593Smuzhiyun
dsps_delete_musb_pdev(struct dsps_glue * glue)604*4882a593Smuzhiyun static void __devexit dsps_delete_musb_pdev(struct dsps_glue *glue)
605*4882a593Smuzhiyun {
606*4882a593Smuzhiyun platform_device_del(glue->musb);
607*4882a593Smuzhiyun platform_device_put(glue->musb);
608*4882a593Smuzhiyun }
609*4882a593Smuzhiyun
dsps_probe(struct platform_device * pdev)610*4882a593Smuzhiyun static int __devinit dsps_probe(struct platform_device *pdev)
611*4882a593Smuzhiyun {
612*4882a593Smuzhiyun const struct platform_device_id *id = platform_get_device_id(pdev);
613*4882a593Smuzhiyun const struct dsps_musb_wrapper *wrp =
614*4882a593Smuzhiyun (struct dsps_musb_wrapper *)id->driver_data;
615*4882a593Smuzhiyun struct dsps_glue *glue;
616*4882a593Smuzhiyun struct resource *iomem;
617*4882a593Smuzhiyun int ret;
618*4882a593Smuzhiyun
619*4882a593Smuzhiyun /* allocate glue */
620*4882a593Smuzhiyun glue = kzalloc(sizeof(*glue), GFP_KERNEL);
621*4882a593Smuzhiyun if (!glue) {
622*4882a593Smuzhiyun dev_err(&pdev->dev, "unable to allocate glue memory\n");
623*4882a593Smuzhiyun ret = -ENOMEM;
624*4882a593Smuzhiyun goto err0;
625*4882a593Smuzhiyun }
626*4882a593Smuzhiyun
627*4882a593Smuzhiyun /* get memory resource */
628*4882a593Smuzhiyun iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
629*4882a593Smuzhiyun if (!iomem) {
630*4882a593Smuzhiyun dev_err(&pdev->dev, "failed to get usbss mem resource\n");
631*4882a593Smuzhiyun ret = -ENODEV;
632*4882a593Smuzhiyun goto err1;
633*4882a593Smuzhiyun }
634*4882a593Smuzhiyun
635*4882a593Smuzhiyun glue->dev = &pdev->dev;
636*4882a593Smuzhiyun
637*4882a593Smuzhiyun glue->wrp = kmemdup(wrp, sizeof(*wrp), GFP_KERNEL);
638*4882a593Smuzhiyun if (!glue->wrp) {
639*4882a593Smuzhiyun dev_err(&pdev->dev, "failed to duplicate wrapper struct memory\n");
640*4882a593Smuzhiyun ret = -ENOMEM;
641*4882a593Smuzhiyun goto err1;
642*4882a593Smuzhiyun }
643*4882a593Smuzhiyun platform_set_drvdata(pdev, glue);
644*4882a593Smuzhiyun
645*4882a593Smuzhiyun /* enable the usbss clocks */
646*4882a593Smuzhiyun pm_runtime_enable(&pdev->dev);
647*4882a593Smuzhiyun
648*4882a593Smuzhiyun ret = pm_runtime_get_sync(&pdev->dev);
649*4882a593Smuzhiyun if (ret < 0) {
650*4882a593Smuzhiyun dev_err(&pdev->dev, "pm_runtime_get_sync FAILED");
651*4882a593Smuzhiyun goto err2;
652*4882a593Smuzhiyun }
653*4882a593Smuzhiyun
654*4882a593Smuzhiyun /* create the child platform device for first instances of musb */
655*4882a593Smuzhiyun ret = dsps_create_musb_pdev(glue, 0);
656*4882a593Smuzhiyun if (ret != 0) {
657*4882a593Smuzhiyun dev_err(&pdev->dev, "failed to create child pdev\n");
658*4882a593Smuzhiyun goto err3;
659*4882a593Smuzhiyun }
660*4882a593Smuzhiyun
661*4882a593Smuzhiyun return 0;
662*4882a593Smuzhiyun
663*4882a593Smuzhiyun err3:
664*4882a593Smuzhiyun pm_runtime_put(&pdev->dev);
665*4882a593Smuzhiyun err2:
666*4882a593Smuzhiyun pm_runtime_disable(&pdev->dev);
667*4882a593Smuzhiyun kfree(glue->wrp);
668*4882a593Smuzhiyun err1:
669*4882a593Smuzhiyun kfree(glue);
670*4882a593Smuzhiyun err0:
671*4882a593Smuzhiyun return ret;
672*4882a593Smuzhiyun }
dsps_remove(struct platform_device * pdev)673*4882a593Smuzhiyun static int __devexit dsps_remove(struct platform_device *pdev)
674*4882a593Smuzhiyun {
675*4882a593Smuzhiyun struct dsps_glue *glue = platform_get_drvdata(pdev);
676*4882a593Smuzhiyun
677*4882a593Smuzhiyun /* delete the child platform device */
678*4882a593Smuzhiyun dsps_delete_musb_pdev(glue);
679*4882a593Smuzhiyun
680*4882a593Smuzhiyun /* disable usbss clocks */
681*4882a593Smuzhiyun pm_runtime_put(&pdev->dev);
682*4882a593Smuzhiyun pm_runtime_disable(&pdev->dev);
683*4882a593Smuzhiyun kfree(glue->wrp);
684*4882a593Smuzhiyun kfree(glue);
685*4882a593Smuzhiyun return 0;
686*4882a593Smuzhiyun }
687*4882a593Smuzhiyun
688*4882a593Smuzhiyun #ifdef CONFIG_PM_SLEEP
dsps_suspend(struct device * dev)689*4882a593Smuzhiyun static int dsps_suspend(struct device *dev)
690*4882a593Smuzhiyun {
691*4882a593Smuzhiyun struct musb_hdrc_platform_data *plat = dev->platform_data;
692*4882a593Smuzhiyun struct omap_musb_board_data *data = plat->board_data;
693*4882a593Smuzhiyun
694*4882a593Smuzhiyun /* Shutdown the on-chip PHY and its PLL. */
695*4882a593Smuzhiyun if (data->set_phy_power)
696*4882a593Smuzhiyun data->set_phy_power(data->dev, 0);
697*4882a593Smuzhiyun
698*4882a593Smuzhiyun return 0;
699*4882a593Smuzhiyun }
700*4882a593Smuzhiyun
dsps_resume(struct device * dev)701*4882a593Smuzhiyun static int dsps_resume(struct device *dev)
702*4882a593Smuzhiyun {
703*4882a593Smuzhiyun struct musb_hdrc_platform_data *plat = dev->platform_data;
704*4882a593Smuzhiyun struct omap_musb_board_data *data = plat->board_data;
705*4882a593Smuzhiyun
706*4882a593Smuzhiyun /* Start the on-chip PHY and its PLL. */
707*4882a593Smuzhiyun if (data->set_phy_power)
708*4882a593Smuzhiyun data->set_phy_power(data->dev, 1);
709*4882a593Smuzhiyun
710*4882a593Smuzhiyun return 0;
711*4882a593Smuzhiyun }
712*4882a593Smuzhiyun #endif
713*4882a593Smuzhiyun
714*4882a593Smuzhiyun static SIMPLE_DEV_PM_OPS(dsps_pm_ops, dsps_suspend, dsps_resume);
715*4882a593Smuzhiyun #endif
716*4882a593Smuzhiyun
717*4882a593Smuzhiyun #ifndef __UBOOT__
718*4882a593Smuzhiyun static const struct platform_device_id musb_dsps_id_table[] __devinitconst = {
719*4882a593Smuzhiyun {
720*4882a593Smuzhiyun .name = "musb-ti81xx",
721*4882a593Smuzhiyun .driver_data = (kernel_ulong_t) &ti81xx_driver_data,
722*4882a593Smuzhiyun },
723*4882a593Smuzhiyun { }, /* Terminating Entry */
724*4882a593Smuzhiyun };
725*4882a593Smuzhiyun MODULE_DEVICE_TABLE(platform, musb_dsps_id_table);
726*4882a593Smuzhiyun
727*4882a593Smuzhiyun static const struct of_device_id musb_dsps_of_match[] __devinitconst = {
728*4882a593Smuzhiyun { .compatible = "musb-ti81xx", },
729*4882a593Smuzhiyun { .compatible = "ti,ti81xx-musb", },
730*4882a593Smuzhiyun { .compatible = "ti,am335x-musb", },
731*4882a593Smuzhiyun { },
732*4882a593Smuzhiyun };
733*4882a593Smuzhiyun MODULE_DEVICE_TABLE(of, musb_dsps_of_match);
734*4882a593Smuzhiyun
735*4882a593Smuzhiyun static struct platform_driver dsps_usbss_driver = {
736*4882a593Smuzhiyun .probe = dsps_probe,
737*4882a593Smuzhiyun .remove = __devexit_p(dsps_remove),
738*4882a593Smuzhiyun .driver = {
739*4882a593Smuzhiyun .name = "musb-dsps",
740*4882a593Smuzhiyun .pm = &dsps_pm_ops,
741*4882a593Smuzhiyun .of_match_table = musb_dsps_of_match,
742*4882a593Smuzhiyun },
743*4882a593Smuzhiyun .id_table = musb_dsps_id_table,
744*4882a593Smuzhiyun };
745*4882a593Smuzhiyun
746*4882a593Smuzhiyun MODULE_DESCRIPTION("TI DSPS MUSB Glue Layer");
747*4882a593Smuzhiyun MODULE_AUTHOR("Ravi B <ravibabu@ti.com>");
748*4882a593Smuzhiyun MODULE_AUTHOR("Ajay Kumar Gupta <ajay.gupta@ti.com>");
749*4882a593Smuzhiyun MODULE_LICENSE("GPL v2");
750*4882a593Smuzhiyun
dsps_init(void)751*4882a593Smuzhiyun static int __init dsps_init(void)
752*4882a593Smuzhiyun {
753*4882a593Smuzhiyun return platform_driver_register(&dsps_usbss_driver);
754*4882a593Smuzhiyun }
755*4882a593Smuzhiyun subsys_initcall(dsps_init);
756*4882a593Smuzhiyun
dsps_exit(void)757*4882a593Smuzhiyun static void __exit dsps_exit(void)
758*4882a593Smuzhiyun {
759*4882a593Smuzhiyun platform_driver_unregister(&dsps_usbss_driver);
760*4882a593Smuzhiyun }
761*4882a593Smuzhiyun module_exit(dsps_exit);
762*4882a593Smuzhiyun #endif
763