davinci.h 2.2 KB

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