blackfin.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*
  2. * Copyright (C) 2007 by Analog Devices, Inc.
  3. *
  4. * The Inventra Controller Driver for Linux is free software; you
  5. * can redistribute it and/or modify it under the terms of the GNU
  6. * General Public License version 2 as published by the Free Software
  7. * Foundation.
  8. */
  9. #ifndef __MUSB_BLACKFIN_H__
  10. #define __MUSB_BLACKFIN_H__
  11. /*
  12. * Blackfin specific definitions
  13. */
  14. /* Anomalies notes:
  15. *
  16. * 05000450 - USB DMA Mode 1 Short Packet Data Corruption:
  17. * MUSB driver is designed to transfer buffer of N * maxpacket size
  18. * in DMA mode 1 and leave the rest of the data to the next
  19. * transfer in DMA mode 0, so we never transmit a short packet in
  20. * DMA mode 1.
  21. *
  22. * 05000463 - This anomaly doesn't affect this driver since it
  23. * never uses L1 or L2 memory as data destination.
  24. *
  25. * 05000464 - This anomaly doesn't affect this driver since it
  26. * never uses L1 or L2 memory as data source.
  27. *
  28. * 05000465 - The anomaly can be seen when SCLK is over 100 MHz, and there is
  29. * no way to workaround for bulk endpoints. Since the wMaxPackSize
  30. * of bulk is less than or equal to 512, while the fifo size of
  31. * endpoint 5, 6, 7 is 1024, the double buffer mode is enabled
  32. * automatically when these endpoints are used for bulk OUT.
  33. *
  34. * 05000466 - This anomaly doesn't affect this driver since it never mixes
  35. * concurrent DMA and core accesses to the TX endpoint FIFOs.
  36. *
  37. * 05000467 - The workaround for this anomaly will introduce another
  38. * anomaly - 05000465.
  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. #undef DUMP_FIFO_DATA
  50. #ifdef DUMP_FIFO_DATA
  51. static void dump_fifo_data(u8 *buf, u16 len)
  52. {
  53. u8 *tmp = buf;
  54. int i;
  55. for (i = 0; i < len; i++) {
  56. if (!(i % 16) && i)
  57. pr_debug("\n");
  58. pr_debug("%02x ", *tmp++);
  59. }
  60. pr_debug("\n");
  61. }
  62. #else
  63. #define dump_fifo_data(buf, len) do {} while (0)
  64. #endif
  65. #define USB_DMA_BASE USB_DMA_INTERRUPT
  66. #define USB_DMAx_CTRL 0x04
  67. #define USB_DMAx_ADDR_LOW 0x08
  68. #define USB_DMAx_ADDR_HIGH 0x0C
  69. #define USB_DMAx_COUNT_LOW 0x10
  70. #define USB_DMAx_COUNT_HIGH 0x14
  71. #define USB_DMA_REG(ep, reg) (USB_DMA_BASE + 0x20 * ep + reg)
  72. /* Almost 1 second */
  73. #define TIMER_DELAY (1 * HZ)
  74. static struct timer_list musb_conn_timer;
  75. #endif /* __MUSB_BLACKFIN_H__ */