davinci.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * TI's Davinci platform specific USB wrapper functions.
  4. *
  5. * Copyright (c) 2008 Texas Instruments
  6. *
  7. * Author: Thomas Abraham t-abraham@ti.com, Texas Instruments
  8. */
  9. #ifndef __DAVINCI_USB_H__
  10. #define __DAVINCI_USB_H__
  11. #include <asm/arch/hardware.h>
  12. #include "musb_core.h"
  13. /* Base address of DAVINCI usb0 wrapper */
  14. #define DAVINCI_USB0_BASE 0x01C64000
  15. /* Base address of DAVINCI musb core */
  16. #define MENTOR_USB0_BASE (DAVINCI_USB0_BASE+0x400)
  17. /*
  18. * Davinci platform USB wrapper register overlay. Note: Only the required
  19. * registers are included in this structure. It can be expanded as required.
  20. */
  21. struct davinci_usb_regs {
  22. u32 version;
  23. u32 ctrlr;
  24. u32 reserved[0x20];
  25. u32 intclrr;
  26. u32 intmskr;
  27. u32 intmsksetr;
  28. };
  29. #define DAVINCI_USB_TX_ENDPTS_MASK 0x1f /* ep0 + 4 tx */
  30. #define DAVINCI_USB_RX_ENDPTS_MASK 0x1e /* 4 rx */
  31. #define DAVINCI_USB_USBINT_SHIFT 16
  32. #define DAVINCI_USB_TXINT_SHIFT 0
  33. #define DAVINCI_USB_RXINT_SHIFT 8
  34. #define DAVINCI_INTR_DRVVBUS 0x0100
  35. #define DAVINCI_USB_USBINT_MASK 0x01ff0000 /* 8 Mentor, DRVVBUS */
  36. #define DAVINCI_USB_TXINT_MASK \
  37. (DAVINCI_USB_TX_ENDPTS_MASK << DAVINCI_USB_TXINT_SHIFT)
  38. #define DAVINCI_USB_RXINT_MASK \
  39. (DAVINCI_USB_RX_ENDPTS_MASK << DAVINCI_USB_RXINT_SHIFT)
  40. #define MGC_BUSCTL_OFFSET(_bEnd, _bOffset) \
  41. (0x80 + (8*(_bEnd)) + (_bOffset))
  42. /* Integrated highspeed/otg PHY */
  43. #define USBPHY_CTL_PADDR (DAVINCI_SYSTEM_MODULE_BASE + 0x34)
  44. #define USBPHY_PHY24MHZ (1 << 13)
  45. #define USBPHY_PHYCLKGD (1 << 8)
  46. #define USBPHY_SESNDEN (1 << 7) /* v(sess_end) comparator */
  47. #define USBPHY_VBDTCTEN (1 << 6) /* v(bus) comparator */
  48. #define USBPHY_PHYPLLON (1 << 4) /* override pll suspend */
  49. #define USBPHY_CLKO1SEL (1 << 3)
  50. #define USBPHY_OSCPDWN (1 << 2)
  51. #define USBPHY_PHYPDWN (1 << 0)
  52. /* Timeout for Davinci USB module */
  53. #define DAVINCI_USB_TIMEOUT 0x3FFFFFF
  54. /* IO Expander I2C address and VBUS enable mask */
  55. #define IOEXP_I2C_ADDR 0x3A
  56. #define IOEXP_VBUSEN_MASK 1
  57. /* extern functions */
  58. extern void lpsc_on(unsigned int id);
  59. extern int i2c_write(uchar chip, uint addr, int alen, uchar *buffer, int len);
  60. extern int i2c_read(uchar chip, uint addr, int alen, uchar *buffer, int len);
  61. extern void enable_vbus(void);
  62. #endif /* __DAVINCI_USB_H__ */