Merge tag 'regmap-v4.1' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie...
[deliverable/linux.git] / include / linux / usb / renesas_usbhs.h
CommitLineData
f1407d5c
KM
1/*
2 * Renesas USB
3 *
4 * Copyright (C) 2011 Renesas Solutions Corp.
5 * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
15 *
16 */
17#ifndef RENESAS_USB_H
18#define RENESAS_USB_H
19#include <linux/platform_device.h>
20#include <linux/usb/ch9.h>
21
22/*
23 * module type
24 *
25 * it will be return value from get_id
26 */
27enum {
28 USBHS_HOST = 0,
29 USBHS_GADGET,
30 USBHS_MAX,
31};
32
33/*
34 * callback functions table for driver
35 *
36 * These functions are called from platform for driver.
37 * Callback function's pointer will be set before
38 * renesas_usbhs_platform_callback :: hardware_init was called
39 */
40struct renesas_usbhs_driver_callback {
41 int (*notify_hotplug)(struct platform_device *pdev);
42};
43
44/*
45 * callback functions for platform
46 *
47 * These functions are called from driver for platform
48 */
49struct renesas_usbhs_platform_callback {
50
51 /*
52 * option:
53 *
54 * Hardware init function for platform.
55 * it is called when driver was probed.
56 */
57 int (*hardware_init)(struct platform_device *pdev);
58
59 /*
60 * option:
61 *
62 * Hardware exit function for platform.
63 * it is called when driver was removed
64 */
225da3e3 65 int (*hardware_exit)(struct platform_device *pdev);
f1407d5c 66
f1ee56a0
KM
67 /*
68 * option:
69 *
70 * for board specific clock control
71 */
225da3e3 72 int (*power_ctrl)(struct platform_device *pdev,
f1ee56a0
KM
73 void __iomem *base, int enable);
74
f1407d5c
KM
75 /*
76 * option:
77 *
78 * Phy reset for platform
79 */
225da3e3 80 int (*phy_reset)(struct platform_device *pdev);
f1407d5c
KM
81
82 /*
83 * get USB ID function
84 * - USBHS_HOST
85 * - USBHS_GADGET
86 */
87 int (*get_id)(struct platform_device *pdev);
88
89 /*
90 * get VBUS status function.
91 */
92 int (*get_vbus)(struct platform_device *pdev);
258485d9
KM
93
94 /*
95 * option:
96 *
97 * VBUS control is needed for Host
98 */
99 int (*set_vbus)(struct platform_device *pdev, int enable);
f1407d5c
KM
100};
101
102/*
103 * parameters for renesas usbhs
104 *
105 * some register needs USB chip specific parameters.
106 * This struct show it to driver
107 */
108struct renesas_usbhs_driver_param {
109 /*
110 * pipe settings
111 */
112 u32 *pipe_type; /* array of USB_ENDPOINT_XFER_xxx (from ep0) */
113 int pipe_size; /* pipe_type array size */
114
115 /*
116 * option:
117 *
118 * for BUSWAIT :: BWAIT
11935de5
KM
119 * see
120 * renesas_usbhs/common.c :: usbhsc_set_buswait()
f1407d5c
KM
121 * */
122 int buswait_bwait;
bc57381e
KM
123
124 /*
125 * option:
126 *
127 * delay time from notify_hotplug callback
128 */
a49a88f1 129 int detection_delay; /* msec */
e73a9891
KM
130
131 /*
132 * option:
133 *
134 * dma id for dmaengine
45277159
KM
135 * The data transfer direction on D0FIFO/D1FIFO should be
136 * fixed for keeping consistency.
137 * So, the platform id settings will be..
138 * .d0_tx_id = xx_TX,
139 * .d1_rx_id = xx_RX,
140 * or
141 * .d1_tx_id = xx_TX,
142 * .d0_rx_id = xx_RX,
e73a9891
KM
143 */
144 int d0_tx_id;
145 int d0_rx_id;
146 int d1_tx_id;
147 int d1_rx_id;
d3cf6a4b
YS
148 int d2_tx_id;
149 int d2_rx_id;
150 int d3_tx_id;
151 int d3_rx_id;
e73a9891
KM
152
153 /*
154 * option:
155 *
156 * pio <--> dma border.
157 */
158 int pio_dma_border; /* default is 64byte */
f427eb64 159
8ecef00f
UH
160 u32 type;
161 u32 enable_gpio;
162
f427eb64
KM
163 /*
164 * option:
165 */
166 u32 has_otg:1; /* for controlling PWEN/EXTLP */
5ea43994 167 u32 has_sudmac:1; /* for SUDMAC */
f1407d5c
KM
168};
169
8ecef00f
UH
170#define USBHS_TYPE_R8A7790 1
171#define USBHS_TYPE_R8A7791 2
172
f1407d5c
KM
173/*
174 * option:
175 *
176 * platform information for renesas_usbhs driver.
177 */
178struct renesas_usbhs_platform_info {
179 /*
180 * option:
181 *
182 * platform set these functions before
183 * call platform_add_devices if needed
184 */
185 struct renesas_usbhs_platform_callback platform_callback;
186
187 /*
188 * driver set these callback functions pointer.
189 * platform can use it on callback functions
190 */
191 struct renesas_usbhs_driver_callback driver_callback;
192
193 /*
194 * option:
195 *
196 * driver use these param for some register
197 */
198 struct renesas_usbhs_driver_param driver_param;
199};
200
201/*
202 * macro for platform
203 */
204#define renesas_usbhs_get_info(pdev)\
205 ((struct renesas_usbhs_platform_info *)(pdev)->dev.platform_data)
206
207#define renesas_usbhs_call_notify_hotplug(pdev) \
208 ({ \
209 struct renesas_usbhs_driver_callback *dc; \
210 dc = &(renesas_usbhs_get_info(pdev)->driver_callback); \
af32fe51 211 if (dc && dc->notify_hotplug) \
f1407d5c
KM
212 dc->notify_hotplug(pdev); \
213 })
214#endif /* RENESAS_USB_H */
This page took 0.400276 seconds and 5 git commands to generate.