1 --- kernel-power-2.6.28.orig/arch/arm/mach-omap2/usb-musb.c
2 +++ kernel-power-2.6.28/arch/arm/mach-omap2/usb-musb.c
4 .config = &musb_config,
6 /* REVISIT charge pump on TWL4030 can supply up to
7 - * 100 mA ... but this value is board-specific, like
8 + * 200 mA ... but this value is board-specific, like
9 * "mode", and should be passed to usb_musb_init().
11 + * Since the power can come from a Y-cable, let the user
12 + * decide on power constraints and not limit anything here.
14 - .power = 50, /* up to 100 mA */
15 + .power = 0, /* use default of 500 mA */
18 static u64 musb_dmamask = DMA_32BIT_MASK;
19 --- kernel-power-2.6.28.orig/drivers/usb/core/otg_whitelist.h
20 +++ kernel-power-2.6.28/drivers/usb/core/otg_whitelist.h
23 static inline int is_targeted(struct usb_device *d)
30 --- kernel-power-2.6.28.orig/drivers/usb/musb/musb_core.c
31 +++ kernel-power-2.6.28/drivers/usb/musb/musb_core.c
33 * change it unless you really know what you're doing
36 + DBG(4, "Some asshole called musb_charger_detect!");
38 switch(musb->xceiv->state) {
39 case OTG_STATE_B_IDLE:
40 /* we always reset transceiver */
45 - DBG(4, "%cX ep%d fifo %p count %d buf %p\n",
46 + DBG_nonverb(4, "%cX ep%d fifo %p count %d buf %p\n",
47 'T', hw_ep->epnum, fifo, len, src);
49 /* we can't assume unaligned reads work */
52 void __iomem *fifo = hw_ep->fifo;
54 - DBG(4, "%cX ep%d fifo %p count %d buf %p\n",
55 + DBG_nonverb(4, "%cX ep%d fifo %p count %d buf %p\n",
56 'R', hw_ep->epnum, fifo, len, dst);
58 /* we can't assume unaligned writes work */
60 void __iomem *mbase = musb->mregs;
63 - DBG(3, "<== Power=%02x, DevCtl=%02x, int_usb=0x%x\n", power, devctl,
65 + DBG(3, "<== State=%s Power=%02x, DevCtl=%02x, int_usb=0x%x\n",
66 + otg_state_string(musb), power, devctl, int_usb);
68 /* in host mode, the peripheral may issue remote wakeup.
69 * in peripheral mode, the host may resume the link.
70 @@ -2028,12 +2030,16 @@
73 mutex_lock(&musb->mutex);
74 - if (sysfs_streq(buf, "host"))
75 - status = musb_platform_set_mode(musb, MUSB_HOST);
76 + if (sysfs_streq(buf, "hostl"))
77 + status = musb_platform_set_mode(musb, MUSB_HOST, 0);
78 + else if (sysfs_streq(buf, "hostf"))
79 + status = musb_platform_set_mode(musb, MUSB_HOST, 1);
80 + else if (sysfs_streq(buf, "hosth"))
81 + status = musb_platform_set_mode(musb, MUSB_HOST, 2);
82 else if (sysfs_streq(buf, "peripheral"))
83 - status = musb_platform_set_mode(musb, MUSB_PERIPHERAL);
84 + status = musb_platform_set_mode(musb, MUSB_PERIPHERAL, 0);
85 else if (sysfs_streq(buf, "otg"))
86 - status = musb_platform_set_mode(musb, MUSB_OTG);
87 + status = musb_platform_set_mode(musb, MUSB_OTG, 0);
90 mutex_unlock(&musb->mutex);
91 --- kernel-power-2.6.28.orig/drivers/usb/musb/musb_core.h
92 +++ kernel-power-2.6.28/drivers/usb/musb/musb_core.h
95 extern void musb_hnp_stop(struct musb *musb);
97 -extern int musb_platform_set_mode(struct musb *musb, u8 musb_mode);
98 +extern int musb_platform_set_mode(struct musb *musb, u8 musb_mode, u8 hostspeed);
100 #if defined(CONFIG_USB_TUSB6010) || defined(CONFIG_BLACKFIN) || \
101 defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP34XX)
102 --- kernel-power-2.6.28.orig/drivers/usb/musb/musb_debug.h
103 +++ kernel-power-2.6.28/drivers/usb/musb/musb_debug.h
106 #ifdef CONFIG_USB_MUSB_DEBUG
108 +#define xprintk_verb(level, facility, format, args...) do { \
109 + if (_dbg_level(level)) { \
110 + u8 testmode, devctl, power/*, otg_ctrl, func_ctrl, isp_debug*/; \
111 + testmode = musb_readb(musb->mregs, MUSB_TESTMODE); \
112 + devctl = musb_readb(musb->mregs, MUSB_DEVCTL); \
113 + power = musb_readb(musb->mregs, MUSB_POWER); \
114 + /*otg_ctrl = musb_ulpi_readb(musb->mregs, ISP1704_OTG_CTRL); \
115 + func_ctrl = musb_ulpi_readb(musb->mregs, ISP1704_FUNC_CTRL); \
116 + isp_debug = musb_ulpi_readb(musb->mregs, ISP1704_DEBUG); */ \
117 + printk(facility "State=%s Testmode=%02x Power=%02x, DevCtl=%02x\n", \
118 + otg_state_string(musb), testmode, power, devctl/*, otg_ctrl, func_ctrl, isp_debug*/); \
119 + printk(facility "%-20s %4d: " format , \
120 + __func__, __LINE__ , ## args); \
123 #define xprintk(level, facility, format, args...) do { \
124 if (_dbg_level(level)) { \
125 printk(facility "%-20s %4d: " format , \
128 return musb_debug >= l;
130 -#define DBG(level, fmt, args...) xprintk(level, KERN_DEBUG, fmt, ## args)
131 +#define DBG(level, fmt, args...) xprintk_verb(level, KERN_DEBUG, fmt, ## args)
132 +#define DBG_nonverb(level, fmt, args...) xprintk(level, KERN_DEBUG, fmt, ## args)
134 #define DBG(level, fmt, args...) do {} while(0)
135 #endif /* CONFIG_USB_MUSB_DEBUG */
136 --- kernel-power-2.6.28.orig/drivers/usb/musb/musb_gadget.c
137 +++ kernel-power-2.6.28/drivers/usb/musb/musb_gadget.c
138 @@ -816,12 +816,12 @@
142 + musb_ep = to_musb_ep(ep);
143 + musb = musb_ep->musb;
144 DBG(1, "===> enabling %s\n", ep->name);
146 - musb_ep = to_musb_ep(ep);
147 hw_ep = musb_ep->hw_ep;
149 - musb = musb_ep->musb;
151 epnum = musb_ep->current_epnum;
156 musb_ep = to_musb_ep(ep);
157 - DBG(4, "disabling %s\n", musb_ep->name);
158 musb = musb_ep->musb;
159 + DBG(4, "disabling %s\n", musb_ep->name);
160 epnum = musb_ep->current_epnum;
161 epio = musb->endpoints[epnum].regs;
163 --- kernel-power-2.6.28.orig/drivers/usb/musb/musb_host.c
164 +++ kernel-power-2.6.28/drivers/usb/musb/musb_host.c
166 csr = musb_readw(epio, MUSB_TXCSR);
167 while (csr & MUSB_TXCSR_FIFONOTEMPTY) {
169 - DBG(3, "Host TX FIFONOTEMPTY csr: %02x\n", csr);
170 + DBG_nonverb(3, "Host TX FIFONOTEMPTY csr: %02x\n", csr);
172 csr |= MUSB_TXCSR_FLUSHFIFO;
173 musb_writew(epio, MUSB_TXCSR, csr);
174 @@ -2036,7 +2036,7 @@
175 dma = is_in ? ep->rx_channel : ep->tx_channel;
177 status = ep->musb->dma_controller->channel_abort(dma);
178 - DBG(status ? 1 : 3,
179 + DBG_nonverb(status ? 1 : 3,
180 "abort %cX%d DMA for urb %p --> %d\n",
181 is_in ? 'R' : 'T', ep->epnum,
183 --- kernel-power-2.6.28.orig/drivers/usb/musb/musb_procfs.c
184 +++ kernel-power-2.6.28/drivers/usb/musb/musb_procfs.c
186 reg = musb_readb(mbase, MUSB_DEVCTL);
187 reg |= MUSB_DEVCTL_SESSION;
188 musb_writeb(mbase, MUSB_DEVCTL, reg);
190 + /* Pretend there's a session request */
191 + musb->ep0_stage = MUSB_EP0_START;
192 + musb->xceiv->state = OTG_STATE_A_IDLE;
193 + MUSB_HST_MODE(musb);
194 + musb_set_vbus(musb, 1);
196 + /* Connect request */
198 + struct usb_hcd *hcd = musb_to_hcd(musb);
201 + musb->is_active = 1;
202 + set_bit(HCD_FLAG_SAW_IRQ, &hcd->flags);
204 + musb->ep0_stage = MUSB_EP0_START;
206 +#ifdef CONFIG_USB_MUSB_OTG
207 + /* flush endpoints when transitioning from Device Mode */
208 + if (is_peripheral_active(musb)) {
209 + /* REVISIT HNP; just force disconnect */
211 + musb_writew(mbase, MUSB_INTRTXE, musb->epmask);
212 + musb_writew(mbase, MUSB_INTRRXE, musb->epmask & 0xfffe);
213 + musb_writeb(mbase, MUSB_INTRUSBE, 0xf7);
215 + musb->port1_status &= ~(USB_PORT_STAT_LOW_SPEED
216 + |USB_PORT_STAT_HIGH_SPEED
217 + |USB_PORT_STAT_ENABLE
219 + musb->port1_status |= USB_PORT_STAT_CONNECTION
220 + |(USB_PORT_STAT_C_CONNECTION << 16);
222 + testmode = musb_readb(mbase, MUSB_TESTMODE);
223 + if (!(testmode & (MUSB_TEST_FORCE_FS | MUSB_TEST_FORCE_HS)))
224 + musb->port1_status |= USB_PORT_STAT_LOW_SPEED;
226 + if (hcd->status_urb)
227 + usb_hcd_poll_rh_status(hcd);
229 + usb_hcd_resume_root_hub(hcd);
231 + MUSB_HST_MODE(musb);
233 + /* indicate new connection to OTG machine */
234 + switch (musb->xceiv->state) {
236 + musb->xceiv->state = OTG_STATE_A_HOST;
237 + hcd->self.is_b_host = 0;
240 + DBG(1, "CONNECT (%s) devctl %02x\n",
241 + otg_state_string(musb), devctl);
246 --- kernel-power-2.6.28.orig/drivers/usb/musb/musb_regs.h
247 +++ kernel-power-2.6.28/drivers/usb/musb/musb_regs.h
249 while (!(musb_readb(addr, ULPI_REG_CONTROL) & ULPI_REG_CMPLT)) {
252 - DBG(3, "ULPI read timed out\n");
253 + DBG_nonverb(3, "ULPI read timed out\n");
258 while(!(musb_readb(addr, ULPI_REG_CONTROL) & ULPI_REG_CMPLT)) {
261 - DBG(3, "ULPI write timed out\n");
262 + DBG_nonverb(3, "ULPI write timed out\n");
266 --- kernel-power-2.6.28.orig/drivers/usb/musb/musbhsdma.c
267 +++ kernel-power-2.6.28/drivers/usb/musb/musbhsdma.c
269 u8 bchannel = musb_channel->idx;
272 - DBG(4, "%p, pkt_sz %d, addr 0x%x, len %d, mode %d\n",
273 + DBG_nonverb(4, "%p, pkt_sz %d, addr 0x%x, len %d, mode %d\n",
274 channel, packet_sz, dma_addr, len, mode);
279 struct musb_dma_channel *musb_channel = channel->private_data;
281 - DBG(2, "ep%d-%s pkt_sz %d, dma_addr 0x%x length %d, mode %d\n",
282 + DBG_nonverb(2, "ep%d-%s pkt_sz %d, dma_addr 0x%x length %d, mode %d\n",
284 musb_channel->transmit ? "Tx" : "Rx",
285 packet_sz, dma_addr, len, mode);
286 --- kernel-power-2.6.28.orig/drivers/usb/musb/omap2430.c
287 +++ kernel-power-2.6.28/drivers/usb/musb/omap2430.c
290 spin_lock_irqsave(&musb->lock, flags);
292 + DBG(3, "%s\n", otg_state_string(musb));
294 devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
296 switch (musb->xceiv->state) {
297 @@ -211,15 +213,12 @@
299 static int musb_platform_resume(struct musb *musb);
301 -int musb_platform_set_mode(struct musb *musb, u8 musb_mode)
302 +int musb_platform_set_mode(struct musb *musb, u8 musb_mode, u8 hostspeed)
305 struct usb_bus *host;
306 u8 devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
308 - devctl |= MUSB_DEVCTL_SESSION;
309 - musb_writeb(musb->mregs, MUSB_DEVCTL, devctl);
312 #ifdef CONFIG_USB_MUSB_HDRC_HCD
314 @@ -227,10 +226,36 @@
315 host = hcd_to_bus(hcd);
317 otg_set_host(musb->xceiv, host);
319 + if (machine_is_nokia_rx51()) {
322 + musb_platform_resume(musb);
324 + devctl |= MUSB_DEVCTL_SESSION;
325 + musb_writeb(musb->mregs, MUSB_DEVCTL, devctl);
327 + testmode = MUSB_TEST_FORCE_HOST;
328 + if (hostspeed == 1)
329 + testmode |= MUSB_TEST_FORCE_FS;
330 + else if (hostspeed == 2)
331 + testmode |= MUSB_TEST_FORCE_HS;
332 + musb_writeb(musb->mregs, MUSB_TESTMODE, testmode);
336 #ifdef CONFIG_USB_GADGET_MUSB_HDRC
337 case MUSB_PERIPHERAL:
338 + if (machine_is_nokia_rx51()) {
339 + musb_platform_resume(musb);
340 + musb_set_vbus(musb, 0);
342 + devctl &= ~MUSB_DEVCTL_SESSION;
343 + musb_writeb(musb->mregs, MUSB_DEVCTL, devctl);
345 + musb_writeb(musb->mregs, MUSB_TESTMODE, 0);
348 otg_set_peripheral(musb->xceiv, &musb->g);
351 --- kernel-power-2.6.28.orig/drivers/usb/otg/twl4030-usb.c
352 +++ kernel-power-2.6.28/drivers/usb/otg/twl4030-usb.c
355 spin_lock_irq(&twl->lock);
356 twl->linkstat = linkstat;
358 if (linkstat == USB_LINK_ID) {
359 twl->otg.default_a = true;
360 twl->otg.state = OTG_STATE_A_IDLE;
362 twl->otg.default_a = false;
363 twl->otg.state = OTG_STATE_B_IDLE;
366 spin_unlock_irq(&twl->lock);