davinci.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. * TI's Davinci platform specific USB wrapper functions.
  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 __DAVINCI_USB_H__
  24. #define __DAVINCI_USB_H__
  25. #include <asm/arch/hardware.h>
  26. #include "musb_core.h"
  27. /* Base address of DAVINCI usb0 wrapper */
  28. #define DAVINCI_USB0_BASE 0x01C64000
  29. /* Base address of DAVINCI musb core */
  30. #define MENTOR_USB0_BASE (DAVINCI_USB0_BASE+0x400)
  31. /*
  32. * Davinci platform USB wrapper register overlay. Note: Only the required
  33. * registers are included in this structure. It can be expanded as required.
  34. */
  35. struct davinci_usb_regs {
  36. u32 version;
  37. u32 ctrlr;
  38. u32 reserved[0x20];
  39. u32 intclrr;
  40. u32 intmskr;
  41. u32 intmsksetr;
  42. };
  43. #define DAVINCI_USB_TX_ENDPTS_MASK 0x1f /* ep0 + 4 tx */
  44. #define DAVINCI_USB_RX_ENDPTS_MASK 0x1e /* 4 rx */
  45. #define DAVINCI_USB_USBINT_SHIFT 16
  46. #define DAVINCI_USB_TXINT_SHIFT 0
  47. #define DAVINCI_USB_RXINT_SHIFT 8
  48. #define DAVINCI_INTR_DRVVBUS 0x0100
  49. #define DAVINCI_USB_USBINT_MASK 0x01ff0000 /* 8 Mentor, DRVVBUS */
  50. #define DAVINCI_USB_TXINT_MASK \
  51. (DAVINCI_USB_TX_ENDPTS_MASK << DAVINCI_USB_TXINT_SHIFT)
  52. #define DAVINCI_USB_RXINT_MASK \
  53. (DAVINCI_USB_RX_ENDPTS_MASK << DAVINCI_USB_RXINT_SHIFT)
  54. #define MGC_BUSCTL_OFFSET(_bEnd, _bOffset) \
  55. (0x80 + (8*(_bEnd)) + (_bOffset))
  56. /* Integrated highspeed/otg PHY */
  57. #define USBPHY_CTL_PADDR (DAVINCI_SYSTEM_MODULE_BASE + 0x34)
  58. #define USBPHY_PHYCLKGD (1 << 8)
  59. #define USBPHY_SESNDEN (1 << 7) /* v(sess_end) comparator */
  60. #define USBPHY_VBDTCTEN (1 << 6) /* v(bus) comparator */
  61. #define USBPHY_PHYPLLON (1 << 4) /* override pll suspend */
  62. #define USBPHY_CLKO1SEL (1 << 3)
  63. #define USBPHY_OSCPDWN (1 << 2)
  64. #define USBPHY_PHYPDWN (1 << 0)
  65. /* Timeout for Davinci USB module */
  66. #define DAVINCI_USB_TIMEOUT 0x3FFFFFF
  67. /* IO Expander I2C address and VBUS enable mask */
  68. #define IOEXP_I2C_ADDR 0x3A
  69. #define IOEXP_VBUSEN_MASK 1
  70. /* extern functions */
  71. extern void lpsc_on(unsigned int id);
  72. extern int i2c_write(uchar chip, uint addr, int alen, uchar *buffer, int len);
  73. extern int i2c_read(uchar chip, uint addr, int alen, uchar *buffer, int len);
  74. extern void enable_vbus(void);
  75. #endif /* __DAVINCI_USB_H__ */