musb_hcd.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /*
  2. * Mentor USB OTG Core host controller driver.
  3. *
  4. * Copyright (c) 2008 Texas Instruments
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License as
  8. * published by the Free Software Foundation; either version 2 of
  9. * the License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  19. * MA 02111-1307 USA
  20. *
  21. * Author: Thomas Abraham t-abraham@ti.com, Texas Instruments
  22. */
  23. #ifndef __MUSB_HCD_H__
  24. #define __MUSB_HCD_H__
  25. #include "musb_core.h"
  26. #ifdef CONFIG_USB_KEYBOARD
  27. #include <stdio_dev.h>
  28. extern unsigned char new[];
  29. #endif
  30. #ifndef CONFIG_MUSB_TIMEOUT
  31. # define CONFIG_MUSB_TIMEOUT 100000
  32. #endif
  33. /* This defines the endpoint number used for control transfers */
  34. #define MUSB_CONTROL_EP 0
  35. /* This defines the endpoint number used for bulk transfer */
  36. #ifndef MUSB_BULK_EP
  37. # define MUSB_BULK_EP 1
  38. #endif
  39. /* This defines the endpoint number used for interrupt transfer */
  40. #define MUSB_INTR_EP 2
  41. /* Determine the operating speed of MUSB core */
  42. #define musb_ishighspeed() \
  43. ((readb(&musbr->power) & MUSB_POWER_HSMODE) \
  44. >> MUSB_POWER_HSMODE_SHIFT)
  45. #define min_t(type, x, y) \
  46. ({ type __x = (x); type __y = (y); __x < __y ? __x : __y; })
  47. /* USB HUB CONSTANTS (not OHCI-specific; see hub.h) */
  48. /* destination of request */
  49. #define RH_INTERFACE 0x01
  50. #define RH_ENDPOINT 0x02
  51. #define RH_OTHER 0x03
  52. #define RH_CLASS 0x20
  53. #define RH_VENDOR 0x40
  54. /* Requests: bRequest << 8 | bmRequestType */
  55. #define RH_GET_STATUS 0x0080
  56. #define RH_CLEAR_FEATURE 0x0100
  57. #define RH_SET_FEATURE 0x0300
  58. #define RH_SET_ADDRESS 0x0500
  59. #define RH_GET_DESCRIPTOR 0x0680
  60. #define RH_SET_DESCRIPTOR 0x0700
  61. #define RH_GET_CONFIGURATION 0x0880
  62. #define RH_SET_CONFIGURATION 0x0900
  63. #define RH_GET_STATE 0x0280
  64. #define RH_GET_INTERFACE 0x0A80
  65. #define RH_SET_INTERFACE 0x0B00
  66. #define RH_SYNC_FRAME 0x0C80
  67. /* Our Vendor Specific Request */
  68. #define RH_SET_EP 0x2000
  69. /* Hub port features */
  70. #define RH_PORT_CONNECTION 0x00
  71. #define RH_PORT_ENABLE 0x01
  72. #define RH_PORT_SUSPEND 0x02
  73. #define RH_PORT_OVER_CURRENT 0x03
  74. #define RH_PORT_RESET 0x04
  75. #define RH_PORT_POWER 0x08
  76. #define RH_PORT_LOW_SPEED 0x09
  77. #define RH_C_PORT_CONNECTION 0x10
  78. #define RH_C_PORT_ENABLE 0x11
  79. #define RH_C_PORT_SUSPEND 0x12
  80. #define RH_C_PORT_OVER_CURRENT 0x13
  81. #define RH_C_PORT_RESET 0x14
  82. /* Hub features */
  83. #define RH_C_HUB_LOCAL_POWER 0x00
  84. #define RH_C_HUB_OVER_CURRENT 0x01
  85. #define RH_DEVICE_REMOTE_WAKEUP 0x00
  86. #define RH_ENDPOINT_STALL 0x01
  87. #define RH_ACK 0x01
  88. #define RH_REQ_ERR -1
  89. #define RH_NACK 0x00
  90. /* extern functions */
  91. extern int musb_platform_init(void);
  92. extern void musb_platform_deinit(void);
  93. #endif /* __MUSB_HCD_H__ */