da8xx-usb.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*
  2. * da8xx-usb.h -- TI's DA8xx platform specific usb wrapper definitions.
  3. *
  4. * Author: Ajay Kumar Gupta <ajay.gupta@ti.com>
  5. *
  6. * Based on drivers/usb/musb/davinci.h
  7. *
  8. * Copyright (C) 2009 Texas Instruments Incorporated
  9. *
  10. * SPDX-License-Identifier: GPL-2.0+
  11. */
  12. #ifndef __DA8XX_MUSB_H__
  13. #define __DA8XX_MUSB_H__
  14. #include <asm/arch/hardware.h>
  15. #include <asm/arch/gpio.h>
  16. /* Base address of da8xx usb0 wrapper */
  17. #define DA8XX_USB_OTG_BASE 0x01E00000
  18. /* Base address of da8xx musb core */
  19. #define DA8XX_USB_OTG_CORE_BASE (DA8XX_USB_OTG_BASE + 0x400)
  20. /* Timeout for DA8xx usb module */
  21. #define DA8XX_USB_OTG_TIMEOUT 0x3FFFFFF
  22. /*
  23. * DA8xx platform USB wrapper register overlay.
  24. */
  25. struct da8xx_usb_regs {
  26. dv_reg revision;
  27. dv_reg control;
  28. dv_reg status;
  29. dv_reg emulation;
  30. dv_reg mode;
  31. dv_reg autoreq;
  32. dv_reg srpfixtime;
  33. dv_reg teardown;
  34. dv_reg intsrc;
  35. dv_reg intsrc_set;
  36. dv_reg intsrc_clr;
  37. dv_reg intmsk;
  38. dv_reg intmsk_set;
  39. dv_reg intmsk_clr;
  40. dv_reg intsrcmsk;
  41. dv_reg eoi;
  42. dv_reg intvector;
  43. dv_reg grndis_size[4];
  44. };
  45. #define da8xx_usb_regs ((struct da8xx_usb_regs *)DA8XX_USB_OTG_BASE)
  46. /* DA8XX interrupt bits definitions */
  47. #define DA8XX_USB_TX_ENDPTS_MASK 0x1f /* ep0 + 4 tx */
  48. #define DA8XX_USB_RX_ENDPTS_MASK 0x1e /* 4 rx */
  49. #define DA8XX_USB_TXINT_SHIFT 0
  50. #define DA8XX_USB_RXINT_SHIFT 8
  51. #define DA8XX_USB_USBINT_MASK 0x01ff0000 /* 8 Mentor, DRVVBUS */
  52. #define DA8XX_USB_TXINT_MASK \
  53. (DA8XX_USB_TX_ENDPTS_MASK << DA8XX_USB_TXINT_SHIFT)
  54. #define DA8XX_USB_RXINT_MASK \
  55. (DA8XX_USB_RX_ENDPTS_MASK << DA8XX_USB_RXINT_SHIFT)
  56. /* DA8xx CFGCHIP2 (USB 2.0 PHY Control) register bits */
  57. #define CFGCHIP2_PHYCLKGD (1 << 17)
  58. #define CFGCHIP2_VBUSSENSE (1 << 16)
  59. #define CFGCHIP2_RESET (1 << 15)
  60. #define CFGCHIP2_OTGMODE (3 << 13)
  61. #define CFGCHIP2_NO_OVERRIDE (0 << 13)
  62. #define CFGCHIP2_FORCE_HOST (1 << 13)
  63. #define CFGCHIP2_FORCE_DEVICE (2 << 13)
  64. #define CFGCHIP2_FORCE_HOST_VBUS_LOW (3 << 13)
  65. #define CFGCHIP2_USB1PHYCLKMUX (1 << 12)
  66. #define CFGCHIP2_USB2PHYCLKMUX (1 << 11)
  67. #define CFGCHIP2_PHYPWRDN (1 << 10)
  68. #define CFGCHIP2_OTGPWRDN (1 << 9)
  69. #define CFGCHIP2_DATPOL (1 << 8)
  70. #define CFGCHIP2_USB1SUSPENDM (1 << 7)
  71. #define CFGCHIP2_PHY_PLLON (1 << 6) /* override PLL suspend */
  72. #define CFGCHIP2_SESENDEN (1 << 5) /* Vsess_end comparator */
  73. #define CFGCHIP2_VBDTCTEN (1 << 4) /* Vbus comparator */
  74. #define CFGCHIP2_REFFREQ (0xf << 0)
  75. #define CFGCHIP2_REFFREQ_12MHZ (1 << 0)
  76. #define CFGCHIP2_REFFREQ_24MHZ (2 << 0)
  77. #define CFGCHIP2_REFFREQ_48MHZ (3 << 0)
  78. #define DA8XX_USB_VBUS_GPIO (1 << 15)
  79. int usb_phy_on(void);
  80. void usb_phy_off(void);
  81. #endif /* __DA8XX_MUSB_H__ */