isp1760-hcd.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. #ifndef _ISP1760_HCD_H_
  2. #define _ISP1760_HCD_H_
  3. #include <linux/spinlock.h>
  4. struct isp1760_qh;
  5. struct isp1760_qtd;
  6. struct resource;
  7. struct usb_hcd;
  8. /*
  9. * 60kb divided in:
  10. * - 32 blocks @ 256 bytes
  11. * - 20 blocks @ 1024 bytes
  12. * - 4 blocks @ 8192 bytes
  13. */
  14. #define BLOCK_1_NUM 32
  15. #define BLOCK_2_NUM 20
  16. #define BLOCK_3_NUM 4
  17. #define BLOCK_1_SIZE 256
  18. #define BLOCK_2_SIZE 1024
  19. #define BLOCK_3_SIZE 8192
  20. #define BLOCKS (BLOCK_1_NUM + BLOCK_2_NUM + BLOCK_3_NUM)
  21. #define MAX_PAYLOAD_SIZE BLOCK_3_SIZE
  22. #define PAYLOAD_AREA_SIZE 0xf000
  23. struct isp1760_slotinfo {
  24. struct isp1760_qh *qh;
  25. struct isp1760_qtd *qtd;
  26. unsigned long timestamp;
  27. };
  28. /* chip memory management */
  29. struct isp1760_memory_chunk {
  30. unsigned int start;
  31. unsigned int size;
  32. unsigned int free;
  33. };
  34. enum isp1760_queue_head_types {
  35. QH_CONTROL,
  36. QH_BULK,
  37. QH_INTERRUPT,
  38. QH_END
  39. };
  40. struct isp1760_hcd {
  41. #ifdef CONFIG_USB_ISP1760_HCD
  42. struct usb_hcd *hcd;
  43. u32 hcs_params;
  44. spinlock_t lock;
  45. struct isp1760_slotinfo atl_slots[32];
  46. int atl_done_map;
  47. struct isp1760_slotinfo int_slots[32];
  48. int int_done_map;
  49. struct isp1760_memory_chunk memory_pool[BLOCKS];
  50. struct list_head qh_list[QH_END];
  51. /* periodic schedule support */
  52. #define DEFAULT_I_TDPS 1024
  53. unsigned periodic_size;
  54. unsigned i_thresh;
  55. unsigned long reset_done;
  56. unsigned long next_statechange;
  57. #endif
  58. };
  59. #ifdef CONFIG_USB_ISP1760_HCD
  60. int isp1760_hcd_register(struct isp1760_hcd *priv, void __iomem *regs,
  61. struct resource *mem, int irq, unsigned long irqflags,
  62. struct device *dev);
  63. void isp1760_hcd_unregister(struct isp1760_hcd *priv);
  64. int isp1760_init_kmem_once(void);
  65. void isp1760_deinit_kmem_cache(void);
  66. #else
  67. static inline int isp1760_hcd_register(struct isp1760_hcd *priv,
  68. void __iomem *regs, struct resource *mem,
  69. int irq, unsigned long irqflags,
  70. struct device *dev)
  71. {
  72. return 0;
  73. }
  74. static inline void isp1760_hcd_unregister(struct isp1760_hcd *priv)
  75. {
  76. }
  77. static inline int isp1760_init_kmem_once(void)
  78. {
  79. return 0;
  80. }
  81. static inline void isp1760_deinit_kmem_cache(void)
  82. {
  83. }
  84. #endif
  85. #endif /* _ISP1760_HCD_H_ */