Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: musb: remove blackfin port

The blackfin architecture is getting removed, so we can clean up
all the special cases in the musb driver.

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Aaron Wu <aaron.wu@analog.com>
Acked-by: Bin Liu <b-liu@ti.com>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
[arnd: adding in fixups from Aaron and Stephen]
Signed-off-by: Arnd Bergmann <arnd@arndb.de>

+13 -1096
-3
Documentation/driver-api/usb/writing_musb_glue_layer.rst
··· 718 718 719 719 Texas Instruments USB Configuration Wiki Page: 720 720 http://processors.wiki.ti.com/index.php/Usbgeneralpage 721 - 722 - Analog Devices Blackfin MUSB Configuration: 723 - http://docs.blackfin.uclinux.org/doku.php?id=linux-kernel:drivers:musb
+2 -10
drivers/usb/musb/Kconfig
··· 5 5 6 6 # (M)HDRC = (Multipoint) Highspeed Dual-Role Controller 7 7 config USB_MUSB_HDRC 8 - tristate 'Inventra Highspeed Dual Role Controller (TI, ADI, AW, ...)' 8 + tristate 'Inventra Highspeed Dual Role Controller' 9 9 depends on (USB || USB_GADGET) 10 10 depends on HAS_IOMEM 11 11 help ··· 17 17 18 18 Texas Instruments families using this IP include DaVinci 19 19 (35x, 644x ...), OMAP 243x, OMAP 3, and TUSB 6010. 20 - 21 - Analog Devices parts using this IP include Blackfin BF54x, 22 - BF525 and BF527. 23 20 24 21 Allwinner SoCs using this IP include A10, A13, A20, ... 25 22 ··· 104 107 depends on ARCH_OMAP2PLUS || COMPILE_TEST 105 108 depends on OF_IRQ 106 109 107 - config USB_MUSB_BLACKFIN 108 - tristate "Blackfin" 109 - depends on (BF54x && !BF544) || (BF52x && ! BF522 && !BF523) 110 - depends on NOP_USB_XCEIV 111 - 112 110 config USB_MUSB_UX500 113 111 tristate "Ux500 platforms" 114 112 depends on ARCH_U8500 || COMPILE_TEST ··· 141 149 142 150 config USB_INVENTRA_DMA 143 151 bool 'Inventra' 144 - depends on USB_MUSB_OMAP2PLUS || USB_MUSB_BLACKFIN 152 + depends on USB_MUSB_OMAP2PLUS 145 153 help 146 154 Enable DMA transfers using Mentor's engine. 147 155
-1
drivers/usb/musb/Makefile
··· 21 21 obj-$(CONFIG_USB_MUSB_TUSB6010) += tusb6010.o 22 22 obj-$(CONFIG_USB_MUSB_DAVINCI) += davinci.o 23 23 obj-$(CONFIG_USB_MUSB_DA8XX) += da8xx.o 24 - obj-$(CONFIG_USB_MUSB_BLACKFIN) += blackfin.o 25 24 obj-$(CONFIG_USB_MUSB_UX500) += ux500.o 26 25 obj-$(CONFIG_USB_MUSB_JZ4740) += jz4740.o 27 26 obj-$(CONFIG_USB_MUSB_SUNXI) += sunxi.o
-623
drivers/usb/musb/blackfin.c
··· 1 - // SPDX-License-Identifier: GPL-2.0+ 2 - /* 3 - * MUSB OTG controller driver for Blackfin Processors 4 - * 5 - * Copyright 2006-2008 Analog Devices Inc. 6 - * 7 - * Enter bugs at http://blackfin.uclinux.org/ 8 - */ 9 - 10 - #include <linux/module.h> 11 - #include <linux/kernel.h> 12 - #include <linux/sched.h> 13 - #include <linux/list.h> 14 - #include <linux/gpio.h> 15 - #include <linux/io.h> 16 - #include <linux/err.h> 17 - #include <linux/platform_device.h> 18 - #include <linux/dma-mapping.h> 19 - #include <linux/prefetch.h> 20 - #include <linux/usb/usb_phy_generic.h> 21 - 22 - #include <asm/cacheflush.h> 23 - 24 - #include "musb_core.h" 25 - #include "musbhsdma.h" 26 - #include "blackfin.h" 27 - 28 - struct bfin_glue { 29 - struct device *dev; 30 - struct platform_device *musb; 31 - struct platform_device *phy; 32 - }; 33 - #define glue_to_musb(g) platform_get_drvdata(g->musb) 34 - 35 - static u32 bfin_fifo_offset(u8 epnum) 36 - { 37 - return USB_OFFSET(USB_EP0_FIFO) + (epnum * 8); 38 - } 39 - 40 - static u8 bfin_readb(const void __iomem *addr, unsigned offset) 41 - { 42 - return (u8)(bfin_read16(addr + offset)); 43 - } 44 - 45 - static u16 bfin_readw(const void __iomem *addr, unsigned offset) 46 - { 47 - return bfin_read16(addr + offset); 48 - } 49 - 50 - static u32 bfin_readl(const void __iomem *addr, unsigned offset) 51 - { 52 - return (u32)(bfin_read16(addr + offset)); 53 - } 54 - 55 - static void bfin_writeb(void __iomem *addr, unsigned offset, u8 data) 56 - { 57 - bfin_write16(addr + offset, (u16)data); 58 - } 59 - 60 - static void bfin_writew(void __iomem *addr, unsigned offset, u16 data) 61 - { 62 - bfin_write16(addr + offset, data); 63 - } 64 - 65 - static void bfin_writel(void __iomem *addr, unsigned offset, u32 data) 66 - { 67 - bfin_write16(addr + offset, (u16)data); 68 - } 69 - 70 - /* 71 - * Load an endpoint's FIFO 72 - */ 73 - static void bfin_write_fifo(struct musb_hw_ep *hw_ep, u16 len, const u8 *src) 74 - { 75 - struct musb *musb = hw_ep->musb; 76 - void __iomem *fifo = hw_ep->fifo; 77 - void __iomem *epio = hw_ep->regs; 78 - u8 epnum = hw_ep->epnum; 79 - 80 - prefetch((u8 *)src); 81 - 82 - musb_writew(epio, MUSB_TXCOUNT, len); 83 - 84 - dev_dbg(musb->controller, "TX ep%d fifo %p count %d buf %p, epio %p\n", 85 - hw_ep->epnum, fifo, len, src, epio); 86 - 87 - dump_fifo_data(src, len); 88 - 89 - if (!ANOMALY_05000380 && epnum != 0) { 90 - u16 dma_reg; 91 - 92 - flush_dcache_range((unsigned long)src, 93 - (unsigned long)(src + len)); 94 - 95 - /* Setup DMA address register */ 96 - dma_reg = (u32)src; 97 - bfin_write16(USB_DMA_REG(epnum, USB_DMAx_ADDR_LOW), dma_reg); 98 - SSYNC(); 99 - 100 - dma_reg = (u32)src >> 16; 101 - bfin_write16(USB_DMA_REG(epnum, USB_DMAx_ADDR_HIGH), dma_reg); 102 - SSYNC(); 103 - 104 - /* Setup DMA count register */ 105 - bfin_write16(USB_DMA_REG(epnum, USB_DMAx_COUNT_LOW), len); 106 - bfin_write16(USB_DMA_REG(epnum, USB_DMAx_COUNT_HIGH), 0); 107 - SSYNC(); 108 - 109 - /* Enable the DMA */ 110 - dma_reg = (epnum << 4) | DMA_ENA | INT_ENA | DIRECTION; 111 - bfin_write16(USB_DMA_REG(epnum, USB_DMAx_CTRL), dma_reg); 112 - SSYNC(); 113 - 114 - /* Wait for complete */ 115 - while (!(bfin_read_USB_DMA_INTERRUPT() & (1 << epnum))) 116 - cpu_relax(); 117 - 118 - /* acknowledge dma interrupt */ 119 - bfin_write_USB_DMA_INTERRUPT(1 << epnum); 120 - SSYNC(); 121 - 122 - /* Reset DMA */ 123 - bfin_write16(USB_DMA_REG(epnum, USB_DMAx_CTRL), 0); 124 - SSYNC(); 125 - } else { 126 - SSYNC(); 127 - 128 - if (unlikely((unsigned long)src & 0x01)) 129 - outsw_8((unsigned long)fifo, src, (len + 1) >> 1); 130 - else 131 - outsw((unsigned long)fifo, src, (len + 1) >> 1); 132 - } 133 - } 134 - /* 135 - * Unload an endpoint's FIFO 136 - */ 137 - static void bfin_read_fifo(struct musb_hw_ep *hw_ep, u16 len, u8 *dst) 138 - { 139 - struct musb *musb = hw_ep->musb; 140 - void __iomem *fifo = hw_ep->fifo; 141 - u8 epnum = hw_ep->epnum; 142 - 143 - if (ANOMALY_05000467 && epnum != 0) { 144 - u16 dma_reg; 145 - 146 - invalidate_dcache_range((unsigned long)dst, 147 - (unsigned long)(dst + len)); 148 - 149 - /* Setup DMA address register */ 150 - dma_reg = (u32)dst; 151 - bfin_write16(USB_DMA_REG(epnum, USB_DMAx_ADDR_LOW), dma_reg); 152 - SSYNC(); 153 - 154 - dma_reg = (u32)dst >> 16; 155 - bfin_write16(USB_DMA_REG(epnum, USB_DMAx_ADDR_HIGH), dma_reg); 156 - SSYNC(); 157 - 158 - /* Setup DMA count register */ 159 - bfin_write16(USB_DMA_REG(epnum, USB_DMAx_COUNT_LOW), len); 160 - bfin_write16(USB_DMA_REG(epnum, USB_DMAx_COUNT_HIGH), 0); 161 - SSYNC(); 162 - 163 - /* Enable the DMA */ 164 - dma_reg = (epnum << 4) | DMA_ENA | INT_ENA; 165 - bfin_write16(USB_DMA_REG(epnum, USB_DMAx_CTRL), dma_reg); 166 - SSYNC(); 167 - 168 - /* Wait for complete */ 169 - while (!(bfin_read_USB_DMA_INTERRUPT() & (1 << epnum))) 170 - cpu_relax(); 171 - 172 - /* acknowledge dma interrupt */ 173 - bfin_write_USB_DMA_INTERRUPT(1 << epnum); 174 - SSYNC(); 175 - 176 - /* Reset DMA */ 177 - bfin_write16(USB_DMA_REG(epnum, USB_DMAx_CTRL), 0); 178 - SSYNC(); 179 - } else { 180 - SSYNC(); 181 - /* Read the last byte of packet with odd size from address fifo + 4 182 - * to trigger 1 byte access to EP0 FIFO. 183 - */ 184 - if (len == 1) 185 - *dst = (u8)inw((unsigned long)fifo + 4); 186 - else { 187 - if (unlikely((unsigned long)dst & 0x01)) 188 - insw_8((unsigned long)fifo, dst, len >> 1); 189 - else 190 - insw((unsigned long)fifo, dst, len >> 1); 191 - 192 - if (len & 0x01) 193 - *(dst + len - 1) = (u8)inw((unsigned long)fifo + 4); 194 - } 195 - } 196 - dev_dbg(musb->controller, "%cX ep%d fifo %p count %d buf %p\n", 197 - 'R', hw_ep->epnum, fifo, len, dst); 198 - 199 - dump_fifo_data(dst, len); 200 - } 201 - 202 - static irqreturn_t blackfin_interrupt(int irq, void *__hci) 203 - { 204 - unsigned long flags; 205 - irqreturn_t retval = IRQ_NONE; 206 - struct musb *musb = __hci; 207 - 208 - spin_lock_irqsave(&musb->lock, flags); 209 - 210 - musb->int_usb = musb_readb(musb->mregs, MUSB_INTRUSB); 211 - musb->int_tx = musb_readw(musb->mregs, MUSB_INTRTX); 212 - musb->int_rx = musb_readw(musb->mregs, MUSB_INTRRX); 213 - 214 - if (musb->int_usb || musb->int_tx || musb->int_rx) { 215 - musb_writeb(musb->mregs, MUSB_INTRUSB, musb->int_usb); 216 - musb_writew(musb->mregs, MUSB_INTRTX, musb->int_tx); 217 - musb_writew(musb->mregs, MUSB_INTRRX, musb->int_rx); 218 - retval = musb_interrupt(musb); 219 - } 220 - 221 - /* Start sampling ID pin, when plug is removed from MUSB */ 222 - if ((musb->xceiv->otg->state == OTG_STATE_B_IDLE 223 - || musb->xceiv->otg->state == OTG_STATE_A_WAIT_BCON) || 224 - (musb->int_usb & MUSB_INTR_DISCONNECT && is_host_active(musb))) { 225 - mod_timer(&musb->dev_timer, jiffies + TIMER_DELAY); 226 - musb->a_wait_bcon = TIMER_DELAY; 227 - } 228 - 229 - spin_unlock_irqrestore(&musb->lock, flags); 230 - 231 - return retval; 232 - } 233 - 234 - static void musb_conn_timer_handler(struct timer_list *t) 235 - { 236 - struct musb *musb = from_timer(musb, t, dev_timer); 237 - unsigned long flags; 238 - u16 val; 239 - static u8 toggle; 240 - 241 - spin_lock_irqsave(&musb->lock, flags); 242 - switch (musb->xceiv->otg->state) { 243 - case OTG_STATE_A_IDLE: 244 - case OTG_STATE_A_WAIT_BCON: 245 - /* Start a new session */ 246 - val = musb_readw(musb->mregs, MUSB_DEVCTL); 247 - val &= ~MUSB_DEVCTL_SESSION; 248 - musb_writew(musb->mregs, MUSB_DEVCTL, val); 249 - val |= MUSB_DEVCTL_SESSION; 250 - musb_writew(musb->mregs, MUSB_DEVCTL, val); 251 - /* Check if musb is host or peripheral. */ 252 - val = musb_readw(musb->mregs, MUSB_DEVCTL); 253 - 254 - if (!(val & MUSB_DEVCTL_BDEVICE)) { 255 - gpio_set_value(musb->config->gpio_vrsel, 1); 256 - musb->xceiv->otg->state = OTG_STATE_A_WAIT_BCON; 257 - } else { 258 - gpio_set_value(musb->config->gpio_vrsel, 0); 259 - /* Ignore VBUSERROR and SUSPEND IRQ */ 260 - val = musb_readb(musb->mregs, MUSB_INTRUSBE); 261 - val &= ~MUSB_INTR_VBUSERROR; 262 - musb_writeb(musb->mregs, MUSB_INTRUSBE, val); 263 - 264 - val = MUSB_INTR_SUSPEND | MUSB_INTR_VBUSERROR; 265 - musb_writeb(musb->mregs, MUSB_INTRUSB, val); 266 - musb->xceiv->otg->state = OTG_STATE_B_IDLE; 267 - } 268 - mod_timer(&musb->dev_timer, jiffies + TIMER_DELAY); 269 - break; 270 - case OTG_STATE_B_IDLE: 271 - /* 272 - * Start a new session. It seems that MUSB needs taking 273 - * some time to recognize the type of the plug inserted? 274 - */ 275 - val = musb_readw(musb->mregs, MUSB_DEVCTL); 276 - val |= MUSB_DEVCTL_SESSION; 277 - musb_writew(musb->mregs, MUSB_DEVCTL, val); 278 - val = musb_readw(musb->mregs, MUSB_DEVCTL); 279 - 280 - if (!(val & MUSB_DEVCTL_BDEVICE)) { 281 - gpio_set_value(musb->config->gpio_vrsel, 1); 282 - musb->xceiv->otg->state = OTG_STATE_A_WAIT_BCON; 283 - } else { 284 - gpio_set_value(musb->config->gpio_vrsel, 0); 285 - 286 - /* Ignore VBUSERROR and SUSPEND IRQ */ 287 - val = musb_readb(musb->mregs, MUSB_INTRUSBE); 288 - val &= ~MUSB_INTR_VBUSERROR; 289 - musb_writeb(musb->mregs, MUSB_INTRUSBE, val); 290 - 291 - val = MUSB_INTR_SUSPEND | MUSB_INTR_VBUSERROR; 292 - musb_writeb(musb->mregs, MUSB_INTRUSB, val); 293 - 294 - /* Toggle the Soft Conn bit, so that we can response to 295 - * the inserting of either A-plug or B-plug. 296 - */ 297 - if (toggle) { 298 - val = musb_readb(musb->mregs, MUSB_POWER); 299 - val &= ~MUSB_POWER_SOFTCONN; 300 - musb_writeb(musb->mregs, MUSB_POWER, val); 301 - toggle = 0; 302 - } else { 303 - val = musb_readb(musb->mregs, MUSB_POWER); 304 - val |= MUSB_POWER_SOFTCONN; 305 - musb_writeb(musb->mregs, MUSB_POWER, val); 306 - toggle = 1; 307 - } 308 - /* The delay time is set to 1/4 second by default, 309 - * shortening it, if accelerating A-plug detection 310 - * is needed in OTG mode. 311 - */ 312 - mod_timer(&musb->dev_timer, jiffies + TIMER_DELAY / 4); 313 - } 314 - break; 315 - default: 316 - dev_dbg(musb->controller, "%s state not handled\n", 317 - usb_otg_state_string(musb->xceiv->otg->state)); 318 - break; 319 - } 320 - spin_unlock_irqrestore(&musb->lock, flags); 321 - 322 - dev_dbg(musb->controller, "state is %s\n", 323 - usb_otg_state_string(musb->xceiv->otg->state)); 324 - } 325 - 326 - static void bfin_musb_enable(struct musb *musb) 327 - { 328 - /* REVISIT is this really correct ? */ 329 - } 330 - 331 - static void bfin_musb_disable(struct musb *musb) 332 - { 333 - } 334 - 335 - static void bfin_musb_set_vbus(struct musb *musb, int is_on) 336 - { 337 - int value = musb->config->gpio_vrsel_active; 338 - if (!is_on) 339 - value = !value; 340 - gpio_set_value(musb->config->gpio_vrsel, value); 341 - 342 - dev_dbg(musb->controller, "VBUS %s, devctl %02x " 343 - /* otg %3x conf %08x prcm %08x */ "\n", 344 - usb_otg_state_string(musb->xceiv->otg->state), 345 - musb_readb(musb->mregs, MUSB_DEVCTL)); 346 - } 347 - 348 - static int bfin_musb_set_power(struct usb_phy *x, unsigned mA) 349 - { 350 - return 0; 351 - } 352 - 353 - static int bfin_musb_vbus_status(struct musb *musb) 354 - { 355 - return 0; 356 - } 357 - 358 - static int bfin_musb_set_mode(struct musb *musb, u8 musb_mode) 359 - { 360 - return -EIO; 361 - } 362 - 363 - static int bfin_musb_adjust_channel_params(struct dma_channel *channel, 364 - u16 packet_sz, u8 *mode, 365 - dma_addr_t *dma_addr, u32 *len) 366 - { 367 - struct musb_dma_channel *musb_channel = channel->private_data; 368 - 369 - /* 370 - * Anomaly 05000450 might cause data corruption when using DMA 371 - * MODE 1 transmits with short packet. So to work around this, 372 - * we truncate all MODE 1 transfers down to a multiple of the 373 - * max packet size, and then do the last short packet transfer 374 - * (if there is any) using MODE 0. 375 - */ 376 - if (ANOMALY_05000450) { 377 - if (musb_channel->transmit && *mode == 1) 378 - *len = *len - (*len % packet_sz); 379 - } 380 - 381 - return 0; 382 - } 383 - 384 - static void bfin_musb_reg_init(struct musb *musb) 385 - { 386 - if (ANOMALY_05000346) { 387 - bfin_write_USB_APHY_CALIB(ANOMALY_05000346_value); 388 - SSYNC(); 389 - } 390 - 391 - if (ANOMALY_05000347) { 392 - bfin_write_USB_APHY_CNTRL(0x0); 393 - SSYNC(); 394 - } 395 - 396 - /* Configure PLL oscillator register */ 397 - bfin_write_USB_PLLOSC_CTRL(0x3080 | 398 - ((480/musb->config->clkin) << 1)); 399 - SSYNC(); 400 - 401 - bfin_write_USB_SRP_CLKDIV((get_sclk()/1000) / 32 - 1); 402 - SSYNC(); 403 - 404 - bfin_write_USB_EP_NI0_RXMAXP(64); 405 - SSYNC(); 406 - 407 - bfin_write_USB_EP_NI0_TXMAXP(64); 408 - SSYNC(); 409 - 410 - /* Route INTRUSB/INTR_RX/INTR_TX to USB_INT0*/ 411 - bfin_write_USB_GLOBINTR(0x7); 412 - SSYNC(); 413 - 414 - bfin_write_USB_GLOBAL_CTL(GLOBAL_ENA | EP1_TX_ENA | EP2_TX_ENA | 415 - EP3_TX_ENA | EP4_TX_ENA | EP5_TX_ENA | 416 - EP6_TX_ENA | EP7_TX_ENA | EP1_RX_ENA | 417 - EP2_RX_ENA | EP3_RX_ENA | EP4_RX_ENA | 418 - EP5_RX_ENA | EP6_RX_ENA | EP7_RX_ENA); 419 - SSYNC(); 420 - } 421 - 422 - static int bfin_musb_init(struct musb *musb) 423 - { 424 - 425 - /* 426 - * Rev 1.0 BF549 EZ-KITs require PE7 to be high for both DEVICE 427 - * and OTG HOST modes, while rev 1.1 and greater require PE7 to 428 - * be low for DEVICE mode and high for HOST mode. We set it high 429 - * here because we are in host mode 430 - */ 431 - 432 - if (gpio_request(musb->config->gpio_vrsel, "USB_VRSEL")) { 433 - printk(KERN_ERR "Failed ro request USB_VRSEL GPIO_%d\n", 434 - musb->config->gpio_vrsel); 435 - return -ENODEV; 436 - } 437 - gpio_direction_output(musb->config->gpio_vrsel, 0); 438 - 439 - musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); 440 - if (IS_ERR_OR_NULL(musb->xceiv)) { 441 - gpio_free(musb->config->gpio_vrsel); 442 - return -EPROBE_DEFER; 443 - } 444 - 445 - bfin_musb_reg_init(musb); 446 - 447 - timer_setup(&musb->dev_timer, musb_conn_timer_handler, 0); 448 - 449 - musb->xceiv->set_power = bfin_musb_set_power; 450 - 451 - musb->isr = blackfin_interrupt; 452 - musb->double_buffer_not_ok = true; 453 - 454 - return 0; 455 - } 456 - 457 - static int bfin_musb_exit(struct musb *musb) 458 - { 459 - gpio_free(musb->config->gpio_vrsel); 460 - usb_put_phy(musb->xceiv); 461 - 462 - return 0; 463 - } 464 - 465 - static const struct musb_platform_ops bfin_ops = { 466 - .quirks = MUSB_DMA_INVENTRA, 467 - .init = bfin_musb_init, 468 - .exit = bfin_musb_exit, 469 - 470 - .fifo_offset = bfin_fifo_offset, 471 - .readb = bfin_readb, 472 - .writeb = bfin_writeb, 473 - .readw = bfin_readw, 474 - .writew = bfin_writew, 475 - .readl = bfin_readl, 476 - .writel = bfin_writel, 477 - .fifo_mode = 2, 478 - .read_fifo = bfin_read_fifo, 479 - .write_fifo = bfin_write_fifo, 480 - #ifdef CONFIG_USB_INVENTRA_DMA 481 - .dma_init = musbhs_dma_controller_create, 482 - .dma_exit = musbhs_dma_controller_destroy, 483 - #endif 484 - .enable = bfin_musb_enable, 485 - .disable = bfin_musb_disable, 486 - 487 - .set_mode = bfin_musb_set_mode, 488 - 489 - .vbus_status = bfin_musb_vbus_status, 490 - .set_vbus = bfin_musb_set_vbus, 491 - 492 - .adjust_channel_params = bfin_musb_adjust_channel_params, 493 - }; 494 - 495 - static u64 bfin_dmamask = DMA_BIT_MASK(32); 496 - 497 - static int bfin_probe(struct platform_device *pdev) 498 - { 499 - struct resource musb_resources[2]; 500 - struct musb_hdrc_platform_data *pdata = dev_get_platdata(&pdev->dev); 501 - struct platform_device *musb; 502 - struct bfin_glue *glue; 503 - 504 - int ret = -ENOMEM; 505 - 506 - glue = devm_kzalloc(&pdev->dev, sizeof(*glue), GFP_KERNEL); 507 - if (!glue) 508 - goto err0; 509 - 510 - musb = platform_device_alloc("musb-hdrc", PLATFORM_DEVID_AUTO); 511 - if (!musb) 512 - goto err0; 513 - 514 - musb->dev.parent = &pdev->dev; 515 - musb->dev.dma_mask = &bfin_dmamask; 516 - musb->dev.coherent_dma_mask = bfin_dmamask; 517 - 518 - glue->dev = &pdev->dev; 519 - glue->musb = musb; 520 - 521 - pdata->platform_ops = &bfin_ops; 522 - 523 - glue->phy = usb_phy_generic_register(); 524 - if (IS_ERR(glue->phy)) 525 - goto err1; 526 - platform_set_drvdata(pdev, glue); 527 - 528 - memset(musb_resources, 0x00, sizeof(*musb_resources) * 529 - ARRAY_SIZE(musb_resources)); 530 - 531 - musb_resources[0].name = pdev->resource[0].name; 532 - musb_resources[0].start = pdev->resource[0].start; 533 - musb_resources[0].end = pdev->resource[0].end; 534 - musb_resources[0].flags = pdev->resource[0].flags; 535 - 536 - musb_resources[1].name = pdev->resource[1].name; 537 - musb_resources[1].start = pdev->resource[1].start; 538 - musb_resources[1].end = pdev->resource[1].end; 539 - musb_resources[1].flags = pdev->resource[1].flags; 540 - 541 - ret = platform_device_add_resources(musb, musb_resources, 542 - ARRAY_SIZE(musb_resources)); 543 - if (ret) { 544 - dev_err(&pdev->dev, "failed to add resources\n"); 545 - goto err2; 546 - } 547 - 548 - ret = platform_device_add_data(musb, pdata, sizeof(*pdata)); 549 - if (ret) { 550 - dev_err(&pdev->dev, "failed to add platform_data\n"); 551 - goto err2; 552 - } 553 - 554 - ret = platform_device_add(musb); 555 - if (ret) { 556 - dev_err(&pdev->dev, "failed to register musb device\n"); 557 - goto err2; 558 - } 559 - 560 - return 0; 561 - 562 - err2: 563 - usb_phy_generic_unregister(glue->phy); 564 - 565 - err1: 566 - platform_device_put(musb); 567 - 568 - err0: 569 - return ret; 570 - } 571 - 572 - static int bfin_remove(struct platform_device *pdev) 573 - { 574 - struct bfin_glue *glue = platform_get_drvdata(pdev); 575 - 576 - platform_device_unregister(glue->musb); 577 - usb_phy_generic_unregister(glue->phy); 578 - 579 - return 0; 580 - } 581 - 582 - static int __maybe_unused bfin_suspend(struct device *dev) 583 - { 584 - struct bfin_glue *glue = dev_get_drvdata(dev); 585 - struct musb *musb = glue_to_musb(glue); 586 - 587 - if (is_host_active(musb)) 588 - /* 589 - * During hibernate gpio_vrsel will change from high to low 590 - * low which will generate wakeup event resume the system 591 - * immediately. Set it to 0 before hibernate to avoid this 592 - * wakeup event. 593 - */ 594 - gpio_set_value(musb->config->gpio_vrsel, 0); 595 - 596 - return 0; 597 - } 598 - 599 - static int __maybe_unused bfin_resume(struct device *dev) 600 - { 601 - struct bfin_glue *glue = dev_get_drvdata(dev); 602 - struct musb *musb = glue_to_musb(glue); 603 - 604 - bfin_musb_reg_init(musb); 605 - 606 - return 0; 607 - } 608 - 609 - static SIMPLE_DEV_PM_OPS(bfin_pm_ops, bfin_suspend, bfin_resume); 610 - 611 - static struct platform_driver bfin_driver = { 612 - .probe = bfin_probe, 613 - .remove = bfin_remove, 614 - .driver = { 615 - .name = "musb-blackfin", 616 - .pm = &bfin_pm_ops, 617 - }, 618 - }; 619 - 620 - MODULE_DESCRIPTION("Blackfin MUSB Glue Layer"); 621 - MODULE_AUTHOR("Bryan Wy <cooloney@kernel.org>"); 622 - MODULE_LICENSE("GPL v2"); 623 - module_platform_driver(bfin_driver);
-81
drivers/usb/musb/blackfin.h
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - /* 3 - * Copyright (C) 2007 by Analog Devices, Inc. 4 - */ 5 - 6 - #ifndef __MUSB_BLACKFIN_H__ 7 - #define __MUSB_BLACKFIN_H__ 8 - 9 - /* 10 - * Blackfin specific definitions 11 - */ 12 - 13 - /* Anomalies notes: 14 - * 15 - * 05000450 - USB DMA Mode 1 Short Packet Data Corruption: 16 - * MUSB driver is designed to transfer buffer of N * maxpacket size 17 - * in DMA mode 1 and leave the rest of the data to the next 18 - * transfer in DMA mode 0, so we never transmit a short packet in 19 - * DMA mode 1. 20 - * 21 - * 05000463 - This anomaly doesn't affect this driver since it 22 - * never uses L1 or L2 memory as data destination. 23 - * 24 - * 05000464 - This anomaly doesn't affect this driver since it 25 - * never uses L1 or L2 memory as data source. 26 - * 27 - * 05000465 - The anomaly can be seen when SCLK is over 100 MHz, and there is 28 - * no way to workaround for bulk endpoints. Since the wMaxPackSize 29 - * of bulk is less than or equal to 512, while the fifo size of 30 - * endpoint 5, 6, 7 is 1024, the double buffer mode is enabled 31 - * automatically when these endpoints are used for bulk OUT. 32 - * 33 - * 05000466 - This anomaly doesn't affect this driver since it never mixes 34 - * concurrent DMA and core accesses to the TX endpoint FIFOs. 35 - * 36 - * 05000467 - The workaround for this anomaly will introduce another 37 - * anomaly - 05000465. 38 - */ 39 - 40 - /* The Mentor USB DMA engine on BF52x (silicon v0.0 and v0.1) seems to be 41 - * unstable in host mode. This may be caused by Anomaly 05000380. After 42 - * digging out the root cause, we will change this number accordingly. 43 - * So, need to either use silicon v0.2+ or disable DMA mode in MUSB. 44 - */ 45 - #if ANOMALY_05000380 && defined(CONFIG_BF52x) && \ 46 - !defined(CONFIG_MUSB_PIO_ONLY) 47 - # error "Please use PIO mode in MUSB driver on bf52x chip v0.0 and v0.1" 48 - #endif 49 - 50 - #undef DUMP_FIFO_DATA 51 - #ifdef DUMP_FIFO_DATA 52 - static void dump_fifo_data(u8 *buf, u16 len) 53 - { 54 - u8 *tmp = buf; 55 - int i; 56 - 57 - for (i = 0; i < len; i++) { 58 - if (!(i % 16) && i) 59 - pr_debug("\n"); 60 - pr_debug("%02x ", *tmp++); 61 - } 62 - pr_debug("\n"); 63 - } 64 - #else 65 - #define dump_fifo_data(buf, len) do {} while (0) 66 - #endif 67 - 68 - 69 - #define USB_DMA_BASE USB_DMA_INTERRUPT 70 - #define USB_DMAx_CTRL 0x04 71 - #define USB_DMAx_ADDR_LOW 0x08 72 - #define USB_DMAx_ADDR_HIGH 0x0C 73 - #define USB_DMAx_COUNT_LOW 0x10 74 - #define USB_DMAx_COUNT_HIGH 0x14 75 - 76 - #define USB_DMA_REG(ep, reg) (USB_DMA_BASE + 0x20 * ep + reg) 77 - 78 - /* Almost 1 second */ 79 - #define TIMER_DELAY (1 * HZ) 80 - 81 - #endif /* __MUSB_BLACKFIN_H__ */
+1 -6
drivers/usb/musb/musb_core.c
··· 126 126 127 127 /*-------------------------------------------------------------------------*/ 128 128 129 - #ifndef CONFIG_BLACKFIN 130 129 static int musb_ulpi_read(struct usb_phy *phy, u32 reg) 131 130 { 132 131 void __iomem *addr = phy->io_priv; ··· 207 208 208 209 return ret; 209 210 } 210 - #else 211 - #define musb_ulpi_read NULL 212 - #define musb_ulpi_write NULL 213 - #endif 214 211 215 212 static struct usb_phy_io_ops musb_ulpi_access = { 216 213 .read = musb_ulpi_read, ··· 2166 2171 * - initializes musb->xceiv, usually by otg_get_phy() 2167 2172 * - stops powering VBUS 2168 2173 * 2169 - * There are various transceiver configurations. Blackfin, 2174 + * There are various transceiver configurations. 2170 2175 * DaVinci, TUSB60x0, and others integrate them. OMAP3 uses 2171 2176 * external/discrete ones in various flavors (twl4030 family, 2172 2177 * isp1504, non-OTG, etc) mostly hooking up through ULPI.
-43
drivers/usb/musb/musb_core.h
··· 414 414 struct usb_gadget_driver *gadget_driver; /* its driver */ 415 415 struct usb_hcd *hcd; /* the usb hcd */ 416 416 417 - /* 418 - * FIXME: Remove this flag. 419 - * 420 - * This is only added to allow Blackfin to work 421 - * with current driver. For some unknown reason 422 - * Blackfin doesn't work with double buffering 423 - * and that's enabled by default. 424 - * 425 - * We added this flag to forcefully disable double 426 - * buffering until we get it working. 427 - */ 428 - unsigned double_buffer_not_ok:1; 429 - 430 417 const struct musb_hdrc_config *config; 431 418 432 419 int xceiv_old_state; ··· 454 467 return s; 455 468 } 456 469 457 - #ifdef CONFIG_BLACKFIN 458 - static inline int musb_read_fifosize(struct musb *musb, 459 - struct musb_hw_ep *hw_ep, u8 epnum) 460 - { 461 - musb->nr_endpoints++; 462 - musb->epmask |= (1 << epnum); 463 - 464 - if (epnum < 5) { 465 - hw_ep->max_packet_sz_tx = 128; 466 - hw_ep->max_packet_sz_rx = 128; 467 - } else { 468 - hw_ep->max_packet_sz_tx = 1024; 469 - hw_ep->max_packet_sz_rx = 1024; 470 - } 471 - hw_ep->is_shared_fifo = false; 472 - 473 - return 0; 474 - } 475 - 476 - static inline void musb_configure_ep0(struct musb *musb) 477 - { 478 - musb->endpoints[0].max_packet_sz_tx = MUSB_EP0_FIFOSIZE; 479 - musb->endpoints[0].max_packet_sz_rx = MUSB_EP0_FIFOSIZE; 480 - musb->endpoints[0].is_shared_fifo = true; 481 - } 482 - 483 - #else 484 - 485 470 static inline int musb_read_fifosize(struct musb *musb, 486 471 struct musb_hw_ep *hw_ep, u8 epnum) 487 472 { ··· 490 531 musb->endpoints[0].max_packet_sz_rx = MUSB_EP0_FIFOSIZE; 491 532 musb->endpoints[0].is_shared_fifo = true; 492 533 } 493 - #endif /* CONFIG_BLACKFIN */ 494 - 495 534 496 535 /***************************** Glue it together *****************************/ 497 536
-2
drivers/usb/musb/musb_debugfs.c
··· 70 70 { "DMA_CNTLch7", 0x274, 16 }, 71 71 { "DMA_ADDRch7", 0x278, 32 }, 72 72 { "DMA_COUNTch7", 0x27C, 32 }, 73 - #ifndef CONFIG_BLACKFIN 74 73 { "ConfigData", MUSB_CONFIGDATA,8 }, 75 74 { "BabbleCtl", MUSB_BABBLE_CTL,8 }, 76 75 { "TxFIFOsz", MUSB_TXFIFOSZ, 8 }, ··· 78 79 { "RxFIFOadd", MUSB_RXFIFOADD, 16 }, 79 80 { "EPInfo", MUSB_EPINFO, 8 }, 80 81 { "RAMInfo", MUSB_RAMINFO, 8 }, 81 - #endif 82 82 { } /* Terminating Entry */ 83 83 }; 84 84
-11
drivers/usb/musb/musb_dma.h
··· 80 80 #define is_cppi_enabled(musb) 0 81 81 #endif 82 82 83 - /* Anomaly 05000456 - USB Receive Interrupt Is Not Generated in DMA Mode 1 84 - * Only allow DMA mode 1 to be used when the USB will actually generate the 85 - * interrupts we expect. 86 - */ 87 - #ifdef CONFIG_BLACKFIN 88 - # undef USE_MODE1 89 - # if !ANOMALY_05000456 90 - # define USE_MODE1 91 - # endif 92 - #endif 93 - 94 83 /* 95 84 * DMA channel status ... updated by the dma controller driver whenever that 96 85 * status changes, and protected by the overall controller spinlock.
+7 -49
drivers/usb/musb/musb_gadget.c
··· 995 995 /* Set TXMAXP with the FIFO size of the endpoint 996 996 * to disable double buffering mode. 997 997 */ 998 - if (musb->double_buffer_not_ok) { 999 - musb_writew(regs, MUSB_TXMAXP, hw_ep->max_packet_sz_tx); 1000 - } else { 1001 - if (can_bulk_split(musb, musb_ep->type)) 1002 - musb_ep->hb_mult = (hw_ep->max_packet_sz_tx / 1003 - musb_ep->packet_sz) - 1; 1004 - musb_writew(regs, MUSB_TXMAXP, musb_ep->packet_sz 1005 - | (musb_ep->hb_mult << 11)); 1006 - } 998 + if (can_bulk_split(musb, musb_ep->type)) 999 + musb_ep->hb_mult = (hw_ep->max_packet_sz_tx / 1000 + musb_ep->packet_sz) - 1; 1001 + musb_writew(regs, MUSB_TXMAXP, musb_ep->packet_sz 1002 + | (musb_ep->hb_mult << 11)); 1007 1003 1008 1004 csr = MUSB_TXCSR_MODE | MUSB_TXCSR_CLRDATATOG; 1009 1005 if (musb_readw(regs, MUSB_TXCSR) ··· 1034 1038 /* Set RXMAXP with the FIFO size of the endpoint 1035 1039 * to disable double buffering mode. 1036 1040 */ 1037 - if (musb->double_buffer_not_ok) 1038 - musb_writew(regs, MUSB_RXMAXP, hw_ep->max_packet_sz_tx); 1039 - else 1040 - musb_writew(regs, MUSB_RXMAXP, musb_ep->packet_sz 1041 - | (musb_ep->hb_mult << 11)); 1041 + musb_writew(regs, MUSB_RXMAXP, musb_ep->packet_sz 1042 + | (musb_ep->hb_mult << 11)); 1042 1043 1043 1044 /* force shared fifo to OUT-only mode */ 1044 1045 if (hw_ep->is_shared_fifo) { ··· 1673 1680 return 0; 1674 1681 } 1675 1682 1676 - #ifdef CONFIG_BLACKFIN 1677 - static struct usb_ep *musb_match_ep(struct usb_gadget *g, 1678 - struct usb_endpoint_descriptor *desc, 1679 - struct usb_ss_ep_comp_descriptor *ep_comp) 1680 - { 1681 - struct usb_ep *ep = NULL; 1682 - 1683 - switch (usb_endpoint_type(desc)) { 1684 - case USB_ENDPOINT_XFER_ISOC: 1685 - case USB_ENDPOINT_XFER_BULK: 1686 - if (usb_endpoint_dir_in(desc)) 1687 - ep = gadget_find_ep_by_name(g, "ep5in"); 1688 - else 1689 - ep = gadget_find_ep_by_name(g, "ep6out"); 1690 - break; 1691 - case USB_ENDPOINT_XFER_INT: 1692 - if (usb_endpoint_dir_in(desc)) 1693 - ep = gadget_find_ep_by_name(g, "ep1in"); 1694 - else 1695 - ep = gadget_find_ep_by_name(g, "ep2out"); 1696 - break; 1697 - default: 1698 - break; 1699 - } 1700 - 1701 - if (ep && usb_gadget_ep_match_desc(g, ep, desc, ep_comp)) 1702 - return ep; 1703 - 1704 - return NULL; 1705 - } 1706 - #else 1707 - #define musb_match_ep NULL 1708 - #endif 1709 - 1710 1683 static int musb_gadget_start(struct usb_gadget *g, 1711 1684 struct usb_gadget_driver *driver); 1712 1685 static int musb_gadget_stop(struct usb_gadget *g); ··· 1686 1727 .pullup = musb_gadget_pullup, 1687 1728 .udc_start = musb_gadget_start, 1688 1729 .udc_stop = musb_gadget_stop, 1689 - .match_ep = musb_match_ep, 1690 1730 }; 1691 1731 1692 1732 /* ----------------------------------------------------------------------- */
+3 -9
drivers/usb/musb/musb_host.c
··· 574 574 /* Set RXMAXP with the FIFO size of the endpoint 575 575 * to disable double buffer mode. 576 576 */ 577 - if (musb->double_buffer_not_ok) 578 - musb_writew(ep->regs, MUSB_RXMAXP, ep->max_packet_sz_rx); 579 - else 580 - musb_writew(ep->regs, MUSB_RXMAXP, 581 - qh->maxpacket | ((qh->hb_mult - 1) << 11)); 577 + musb_writew(ep->regs, MUSB_RXMAXP, 578 + qh->maxpacket | ((qh->hb_mult - 1) << 11)); 582 579 583 580 ep->rx_reinit = 0; 584 581 } ··· 801 804 /* protocol/endpoint/interval/NAKlimit */ 802 805 if (epnum) { 803 806 musb_writeb(epio, MUSB_TXTYPE, qh->type_reg); 804 - if (musb->double_buffer_not_ok) { 805 - musb_writew(epio, MUSB_TXMAXP, 806 - hw_ep->max_packet_sz_tx); 807 - } else if (can_bulk_split(musb, qh->type)) { 807 + if (can_bulk_split(musb, qh->type)) { 808 808 qh->hb_mult = hw_ep->max_packet_sz_tx 809 809 / packet_sz; 810 810 musb_writew(epio, MUSB_TXMAXP, packet_sz
-182
drivers/usb/musb/musb_regs.h
··· 195 195 #define MUSB_HUBADDR_MULTI_TT 0x80 196 196 197 197 198 - #ifndef CONFIG_BLACKFIN 199 - 200 198 /* 201 199 * Common USB registers 202 200 */ ··· 413 415 return musb_readb(musb->mregs, 414 416 musb->io.busctl_offset(epnum, MUSB_TXHUBPORT)); 415 417 } 416 - 417 - #else /* CONFIG_BLACKFIN */ 418 - 419 - #define USB_BASE USB_FADDR 420 - #define USB_OFFSET(reg) (reg - USB_BASE) 421 - 422 - /* 423 - * Common USB registers 424 - */ 425 - #define MUSB_FADDR USB_OFFSET(USB_FADDR) /* 8-bit */ 426 - #define MUSB_POWER USB_OFFSET(USB_POWER) /* 8-bit */ 427 - #define MUSB_INTRTX USB_OFFSET(USB_INTRTX) /* 16-bit */ 428 - #define MUSB_INTRRX USB_OFFSET(USB_INTRRX) 429 - #define MUSB_INTRTXE USB_OFFSET(USB_INTRTXE) 430 - #define MUSB_INTRRXE USB_OFFSET(USB_INTRRXE) 431 - #define MUSB_INTRUSB USB_OFFSET(USB_INTRUSB) /* 8 bit */ 432 - #define MUSB_INTRUSBE USB_OFFSET(USB_INTRUSBE)/* 8 bit */ 433 - #define MUSB_FRAME USB_OFFSET(USB_FRAME) 434 - #define MUSB_INDEX USB_OFFSET(USB_INDEX) /* 8 bit */ 435 - #define MUSB_TESTMODE USB_OFFSET(USB_TESTMODE)/* 8 bit */ 436 - 437 - /* 438 - * Additional Control Registers 439 - */ 440 - 441 - #define MUSB_DEVCTL USB_OFFSET(USB_OTG_DEV_CTL) /* 8 bit */ 442 - 443 - #define MUSB_LINKINFO USB_OFFSET(USB_LINKINFO)/* 8 bit */ 444 - #define MUSB_VPLEN USB_OFFSET(USB_VPLEN) /* 8 bit */ 445 - #define MUSB_HS_EOF1 USB_OFFSET(USB_HS_EOF1) /* 8 bit */ 446 - #define MUSB_FS_EOF1 USB_OFFSET(USB_FS_EOF1) /* 8 bit */ 447 - #define MUSB_LS_EOF1 USB_OFFSET(USB_LS_EOF1) /* 8 bit */ 448 - 449 - /* Offsets to endpoint registers */ 450 - #define MUSB_TXMAXP 0x00 451 - #define MUSB_TXCSR 0x04 452 - #define MUSB_CSR0 MUSB_TXCSR /* Re-used for EP0 */ 453 - #define MUSB_RXMAXP 0x08 454 - #define MUSB_RXCSR 0x0C 455 - #define MUSB_RXCOUNT 0x10 456 - #define MUSB_COUNT0 MUSB_RXCOUNT /* Re-used for EP0 */ 457 - #define MUSB_TXTYPE 0x14 458 - #define MUSB_TYPE0 MUSB_TXTYPE /* Re-used for EP0 */ 459 - #define MUSB_TXINTERVAL 0x18 460 - #define MUSB_NAKLIMIT0 MUSB_TXINTERVAL /* Re-used for EP0 */ 461 - #define MUSB_RXTYPE 0x1C 462 - #define MUSB_RXINTERVAL 0x20 463 - #define MUSB_TXCOUNT 0x28 464 - 465 - /* Offsets to endpoint registers in indexed model (using INDEX register) */ 466 - #define MUSB_INDEXED_OFFSET(_epnum, _offset) \ 467 - (0x40 + (_offset)) 468 - 469 - /* Offsets to endpoint registers in flat models */ 470 - #define MUSB_FLAT_OFFSET(_epnum, _offset) \ 471 - (USB_OFFSET(USB_EP_NI0_TXMAXP) + (0x40 * (_epnum)) + (_offset)) 472 - 473 - /* Not implemented - HW has separate Tx/Rx FIFO */ 474 - #define MUSB_TXCSR_MODE 0x0000 475 - 476 - static inline void musb_write_txfifosz(void __iomem *mbase, u8 c_size) 477 - { 478 - } 479 - 480 - static inline void musb_write_txfifoadd(void __iomem *mbase, u16 c_off) 481 - { 482 - } 483 - 484 - static inline void musb_write_rxfifosz(void __iomem *mbase, u8 c_size) 485 - { 486 - } 487 - 488 - static inline void musb_write_rxfifoadd(void __iomem *mbase, u16 c_off) 489 - { 490 - } 491 - 492 - static inline void musb_write_ulpi_buscontrol(void __iomem *mbase, u8 val) 493 - { 494 - } 495 - 496 - static inline u8 musb_read_txfifosz(void __iomem *mbase) 497 - { 498 - return 0; 499 - } 500 - 501 - static inline u16 musb_read_txfifoadd(void __iomem *mbase) 502 - { 503 - return 0; 504 - } 505 - 506 - static inline u8 musb_read_rxfifosz(void __iomem *mbase) 507 - { 508 - return 0; 509 - } 510 - 511 - static inline u16 musb_read_rxfifoadd(void __iomem *mbase) 512 - { 513 - return 0; 514 - } 515 - 516 - static inline u8 musb_read_ulpi_buscontrol(void __iomem *mbase) 517 - { 518 - return 0; 519 - } 520 - 521 - static inline u8 musb_read_configdata(void __iomem *mbase) 522 - { 523 - return 0; 524 - } 525 - 526 - static inline u16 musb_read_hwvers(void __iomem *mbase) 527 - { 528 - /* 529 - * This register is invisible on Blackfin, actually the MUSB 530 - * RTL version of Blackfin is 1.9, so just hardcode its value. 531 - */ 532 - return MUSB_HWVERS_1900; 533 - } 534 - 535 - static inline void musb_write_rxfunaddr(void __iomem *mbase, u8 epnum, 536 - u8 qh_addr_req) 537 - { 538 - } 539 - 540 - static inline void musb_write_rxhubaddr(void __iomem *mbase, u8 epnum, 541 - u8 qh_h_addr_reg) 542 - { 543 - } 544 - 545 - static inline void musb_write_rxhubport(void __iomem *mbase, u8 epnum, 546 - u8 qh_h_port_reg) 547 - { 548 - } 549 - 550 - static inline void musb_write_txfunaddr(void __iomem *mbase, u8 epnum, 551 - u8 qh_addr_reg) 552 - { 553 - } 554 - 555 - static inline void musb_write_txhubaddr(void __iomem *mbase, u8 epnum, 556 - u8 qh_addr_reg) 557 - { 558 - } 559 - 560 - static inline void musb_write_txhubport(void __iomem *mbase, u8 epnum, 561 - u8 qh_h_port_reg) 562 - { 563 - } 564 - 565 - static inline u8 musb_read_rxfunaddr(void __iomem *mbase, u8 epnum) 566 - { 567 - return 0; 568 - } 569 - 570 - static inline u8 musb_read_rxhubaddr(void __iomem *mbase, u8 epnum) 571 - { 572 - return 0; 573 - } 574 - 575 - static inline u8 musb_read_rxhubport(void __iomem *mbase, u8 epnum) 576 - { 577 - return 0; 578 - } 579 - 580 - static inline u8 musb_read_txfunaddr(void __iomem *mbase, u8 epnum) 581 - { 582 - return 0; 583 - } 584 - 585 - static inline u8 musb_read_txhubaddr(void __iomem *mbase, u8 epnum) 586 - { 587 - return 0; 588 - } 589 - 590 - static inline u8 musb_read_txhubport(void __iomem *mbase, u8 epnum) 591 - { 592 - return 0; 593 - } 594 - 595 - #endif /* CONFIG_BLACKFIN */ 596 418 597 419 #endif /* __MUSB_REGS_H__ */
-5
drivers/usb/musb/musbhsdma.c
··· 235 235 236 236 int_hsdma = musb_readb(mbase, MUSB_HSDMA_INTR); 237 237 238 - #ifdef CONFIG_BLACKFIN 239 - /* Clear DMA interrupt flags */ 240 - musb_writeb(mbase, MUSB_HSDMA_INTR, int_hsdma); 241 - #endif 242 - 243 238 if (!int_hsdma) { 244 239 musb_dbg(musb, "spurious DMA irq"); 245 240
-64
drivers/usb/musb/musbhsdma.h
··· 6 6 * Copyright (C) 2005-2007 by Texas Instruments 7 7 */ 8 8 9 - #ifndef CONFIG_BLACKFIN 10 - 11 9 #define MUSB_HSDMA_BASE 0x200 12 10 #define MUSB_HSDMA_INTR (MUSB_HSDMA_BASE + 0) 13 11 #define MUSB_HSDMA_CONTROL 0x4 ··· 32 34 musb_writel(mbase, \ 33 35 MUSB_HSDMA_CHANNEL_OFFSET(bchannel, MUSB_HSDMA_COUNT), \ 34 36 len) 35 - #else 36 - 37 - #define MUSB_HSDMA_BASE 0x400 38 - #define MUSB_HSDMA_INTR (MUSB_HSDMA_BASE + 0) 39 - #define MUSB_HSDMA_CONTROL 0x04 40 - #define MUSB_HSDMA_ADDR_LOW 0x08 41 - #define MUSB_HSDMA_ADDR_HIGH 0x0C 42 - #define MUSB_HSDMA_COUNT_LOW 0x10 43 - #define MUSB_HSDMA_COUNT_HIGH 0x14 44 - 45 - #define MUSB_HSDMA_CHANNEL_OFFSET(_bchannel, _offset) \ 46 - (MUSB_HSDMA_BASE + (_bchannel * 0x20) + _offset) 47 - 48 - static inline u32 musb_read_hsdma_addr(void __iomem *mbase, u8 bchannel) 49 - { 50 - u32 addr = musb_readw(mbase, 51 - MUSB_HSDMA_CHANNEL_OFFSET(bchannel, MUSB_HSDMA_ADDR_HIGH)); 52 - 53 - addr = addr << 16; 54 - 55 - addr |= musb_readw(mbase, 56 - MUSB_HSDMA_CHANNEL_OFFSET(bchannel, MUSB_HSDMA_ADDR_LOW)); 57 - 58 - return addr; 59 - } 60 - 61 - static inline void musb_write_hsdma_addr(void __iomem *mbase, 62 - u8 bchannel, dma_addr_t dma_addr) 63 - { 64 - musb_writew(mbase, 65 - MUSB_HSDMA_CHANNEL_OFFSET(bchannel, MUSB_HSDMA_ADDR_LOW), 66 - dma_addr); 67 - musb_writew(mbase, 68 - MUSB_HSDMA_CHANNEL_OFFSET(bchannel, MUSB_HSDMA_ADDR_HIGH), 69 - (dma_addr >> 16)); 70 - } 71 - 72 - static inline u32 musb_read_hsdma_count(void __iomem *mbase, u8 bchannel) 73 - { 74 - u32 count = musb_readw(mbase, 75 - MUSB_HSDMA_CHANNEL_OFFSET(bchannel, MUSB_HSDMA_COUNT_HIGH)); 76 - 77 - count = count << 16; 78 - 79 - count |= musb_readw(mbase, 80 - MUSB_HSDMA_CHANNEL_OFFSET(bchannel, MUSB_HSDMA_COUNT_LOW)); 81 - 82 - return count; 83 - } 84 - 85 - static inline void musb_write_hsdma_count(void __iomem *mbase, 86 - u8 bchannel, u32 len) 87 - { 88 - musb_writew(mbase, 89 - MUSB_HSDMA_CHANNEL_OFFSET(bchannel, MUSB_HSDMA_COUNT_LOW),len); 90 - musb_writew(mbase, 91 - MUSB_HSDMA_CHANNEL_OFFSET(bchannel, MUSB_HSDMA_COUNT_HIGH), 92 - (len >> 16)); 93 - } 94 - 95 - #endif /* CONFIG_BLACKFIN */ 96 - 97 37 /* control register (16-bit): */ 98 38 #define MUSB_HSDMA_ENABLE_SHIFT 0 99 39 #define MUSB_HSDMA_TRANSMIT_SHIFT 1
-7
include/linux/usb/musb.h
··· 89 89 u8 ram_bits; /* ram address size */ 90 90 91 91 struct musb_hdrc_eps_bits *eps_bits __deprecated; 92 - #ifdef CONFIG_BLACKFIN 93 - /* A GPIO controlling VRSEL in Blackfin */ 94 - unsigned int gpio_vrsel; 95 - unsigned int gpio_vrsel_active; 96 - /* musb CLKIN in Blackfin in MHZ */ 97 - unsigned char clkin; 98 - #endif 99 92 u32 maximum_speed; 100 93 }; 101 94