Linux 3.9-rc4
[linux-2.6/cjktty.git] / include / linux / usb / renesas_usbhs.h
blobc5d36c65c33bfe7e77f6a984a66f7a06e1683f84
1 /*
2 * Renesas USB
4 * Copyright (C) 2011 Renesas Solutions Corp.
5 * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
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.
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
17 #ifndef RENESAS_USB_H
18 #define RENESAS_USB_H
19 #include <linux/platform_device.h>
20 #include <linux/usb/ch9.h>
23 * module type
25 * it will be return value from get_id
27 enum {
28 USBHS_HOST = 0,
29 USBHS_GADGET,
30 USBHS_MAX,
34 * callback functions table for driver
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
40 struct renesas_usbhs_driver_callback {
41 int (*notify_hotplug)(struct platform_device *pdev);
45 * callback functions for platform
47 * These functions are called from driver for platform
49 struct renesas_usbhs_platform_callback {
52 * option:
54 * Hardware init function for platform.
55 * it is called when driver was probed.
57 int (*hardware_init)(struct platform_device *pdev);
60 * option:
62 * Hardware exit function for platform.
63 * it is called when driver was removed
65 void (*hardware_exit)(struct platform_device *pdev);
68 * option:
70 * for board specific clock control
72 void (*power_ctrl)(struct platform_device *pdev,
73 void __iomem *base, int enable);
76 * option:
78 * Phy reset for platform
80 void (*phy_reset)(struct platform_device *pdev);
83 * get USB ID function
84 * - USBHS_HOST
85 * - USBHS_GADGET
87 int (*get_id)(struct platform_device *pdev);
90 * get VBUS status function.
92 int (*get_vbus)(struct platform_device *pdev);
95 * option:
97 * VBUS control is needed for Host
99 int (*set_vbus)(struct platform_device *pdev, int enable);
103 * parameters for renesas usbhs
105 * some register needs USB chip specific parameters.
106 * This struct show it to driver
108 struct renesas_usbhs_driver_param {
110 * pipe settings
112 u32 *pipe_type; /* array of USB_ENDPOINT_XFER_xxx (from ep0) */
113 int pipe_size; /* pipe_type array size */
116 * option:
118 * for BUSWAIT :: BWAIT
119 * see
120 * renesas_usbhs/common.c :: usbhsc_set_buswait()
121 * */
122 int buswait_bwait;
125 * option:
127 * delay time from notify_hotplug callback
129 int detection_delay; /* msec */
132 * option:
134 * dma id for dmaengine
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,
144 int d0_tx_id;
145 int d0_rx_id;
146 int d1_tx_id;
147 int d1_rx_id;
150 * option:
152 * pio <--> dma border.
154 int pio_dma_border; /* default is 64byte */
157 * option:
159 u32 has_otg:1; /* for controlling PWEN/EXTLP */
160 u32 has_sudmac:1; /* for SUDMAC */
164 * option:
166 * platform information for renesas_usbhs driver.
168 struct renesas_usbhs_platform_info {
170 * option:
172 * platform set these functions before
173 * call platform_add_devices if needed
175 struct renesas_usbhs_platform_callback platform_callback;
178 * driver set these callback functions pointer.
179 * platform can use it on callback functions
181 struct renesas_usbhs_driver_callback driver_callback;
184 * option:
186 * driver use these param for some register
188 struct renesas_usbhs_driver_param driver_param;
192 * macro for platform
194 #define renesas_usbhs_get_info(pdev)\
195 ((struct renesas_usbhs_platform_info *)(pdev)->dev.platform_data)
197 #define renesas_usbhs_call_notify_hotplug(pdev) \
198 ({ \
199 struct renesas_usbhs_driver_callback *dc; \
200 dc = &(renesas_usbhs_get_info(pdev)->driver_callback); \
201 if (dc && dc->notify_hotplug) \
202 dc->notify_hotplug(pdev); \
204 #endif /* RENESAS_USB_H */