]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - drivers/usb/musb/davinci.h
b55112eeb2e841273e4488a306f99027261b4ae9
[linux-2.6-omap-h63xx.git] / drivers / usb / musb / davinci.h
1 /*
2  * Copyright (C) 2005-2006 by Texas Instruments
3  *
4  * The Inventra Controller Driver for Linux is free software; you
5  * can redistribute it and/or modify it under the terms of the GNU
6  * General Public License version 2 as published by the Free Software
7  * Foundation.
8  */
9
10 #ifndef __MUSB_HDRDF_H__
11 #define __MUSB_HDRDF_H__
12
13 /*
14  * DaVinci-specific definitions
15  */
16
17 /* Integrated highspeed/otg PHY */
18 #define USBPHY_CTL_PADDR        (DAVINCI_SYSTEM_MODULE_BASE + 0x34)
19 #define USBPHY_PHYCLKGD         (1 << 8)
20 #define USBPHY_SESNDEN          (1 << 7)        /* v(sess_end) comparator */
21 #define USBPHY_VBDTCTEN         (1 << 6)        /* v(bus) comparator */
22 #define USBPHY_PHYPLLON         (1 << 4)        /* override pll suspend */
23 #define USBPHY_CLK01SEL         (1 << 3)
24 #define USBPHY_OSCPDWN          (1 << 2)
25 #define USBPHY_PHYSPDWN         (1 << 0)
26
27 /* For now include usb OTG module registers here */
28 #define DAVINCI_USB_VERSION_REG         0x00
29 #define DAVINCI_USB_CTRL_REG            0x04
30 #define DAVINCI_USB_STAT_REG            0x08
31 #define DAVINCI_RNDIS_REG               0x10
32 #define DAVINCI_AUTOREQ_REG             0x14
33 #define DAVINCI_USB_INT_SOURCE_REG      0x20
34 #define DAVINCI_USB_INT_SET_REG         0x24
35 #define DAVINCI_USB_INT_SRC_CLR_REG     0x28
36 #define DAVINCI_USB_INT_MASK_REG        0x2c
37 #define DAVINCI_USB_INT_MASK_SET_REG    0x30
38 #define DAVINCI_USB_INT_MASK_CLR_REG    0x34
39 #define DAVINCI_USB_INT_SRC_MASKED_REG  0x38
40 #define DAVINCI_USB_EOI_REG             0x3c
41 #define DAVINCI_USB_EOI_INTVEC          0x40
42
43 /* CPPI related registers */
44 #define DAVINCI_TXCPPI_CTRL_REG         0x80
45 #define DAVINCI_TXCPPI_TEAR_REG         0x84
46 #define DAVINCI_CPPI_EOI_REG            0x88
47 #define DAVINCI_CPPI_INTVEC_REG         0x8c
48 #define DAVINCI_TXCPPI_MASKED_REG       0x90
49 #define DAVINCI_TXCPPI_RAW_REG          0x94
50 #define DAVINCI_TXCPPI_INTENAB_REG      0x98
51 #define DAVINCI_TXCPPI_INTCLR_REG       0x9c
52
53 #define DAVINCI_RXCPPI_CTRL_REG         0xC0
54 #define DAVINCI_RXCPPI_MASKED_REG       0xD0
55 #define DAVINCI_RXCPPI_RAW_REG          0xD4
56 #define DAVINCI_RXCPPI_INTENAB_REG      0xD8
57 #define DAVINCI_RXCPPI_INTCLR_REG       0xDC
58
59 #define DAVINCI_RXCPPI_BUFCNT0_REG      0xE0
60 #define DAVINCI_RXCPPI_BUFCNT1_REG      0xE4
61 #define DAVINCI_RXCPPI_BUFCNT2_REG      0xE8
62 #define DAVINCI_RXCPPI_BUFCNT3_REG      0xEC
63
64 /* CPPI state RAM entries */
65 #define DAVINCI_CPPI_STATERAM_BASE_OFFSET   0x100
66
67 #define DAVINCI_TXCPPI_STATERAM_OFFSET(channelNum) \
68         (DAVINCI_CPPI_STATERAM_BASE_OFFSET +       ((channelNum)* 0x40))
69 #define DAVINCI_RXCPPI_STATERAM_OFFSET(channelNum) \
70         (DAVINCI_CPPI_STATERAM_BASE_OFFSET + 0x20 +((channelNum)* 0x40))
71
72 /* CPPI masks */
73 #define DAVINCI_DMA_CTRL_ENABLE         1
74 #define DAVINCI_DMA_CTRL_DISABLE        0
75
76 #define DAVINCI_DMA_ALL_CHANNELS_ENABLE 0xF
77 #define DAVINCI_DMA_ALL_CHANNELS_DISABLE 0xF
78
79 /* REVISIT relying on "volatile" here is wrong ... */
80
81 /* define structures of Rx/Tx stateRam entries */
82 struct cppi_tx_stateram {
83         volatile u32 headPtr;
84         volatile u32 sopDescPtr;
85         volatile u32 currDescPtr;
86         volatile u32 currBuffPtr;
87         volatile u32 flags;
88         volatile u32 remLength;
89         volatile u32 dummy;
90         volatile u32 completionPtr;
91 };
92
93 struct cppi_rx_stateram {
94         volatile u32 buffOffset;
95         volatile u32 headPtr;
96         volatile u32 sopDescPtr;
97         volatile u32 currDescPtr;
98         volatile u32 currBuffPtr;
99         volatile u32 pktLength;
100         volatile u32 byteCount;
101         volatile u32 completionPtr;
102 };
103
104 #define DAVINCI_USB_TX_ENDPTS_MASK      0x1f            /* ep0 + 4 tx */
105 #define DAVINCI_USB_RX_ENDPTS_MASK      0x1e            /* 4 rx */
106
107 #define DAVINCI_USB_USBINT_SHIFT        16
108 #define DAVINCI_USB_TXINT_SHIFT         0
109 #define DAVINCI_USB_RXINT_SHIFT         8
110
111 #define DAVINCI_USB_USBINT_MASK         0x01ff0000      /* 8 Mentor, DRVVBUS */
112 #define DAVINCI_USB_TXINT_MASK \
113         (DAVINCI_USB_TX_ENDPTS_MASK << DAVINCI_USB_TXINT_SHIFT)
114 #define DAVINCI_USB_RXINT_MASK \
115         (DAVINCI_USB_RX_ENDPTS_MASK << DAVINCI_USB_RXINT_SHIFT)
116
117 #define DAVINCI_BASE_OFFSET             0x400
118
119 #endif  /* __MUSB_HDRDF_H__ */