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