MIPS: Lantiq: Fix external interrupt sources
[linux-2.6/linux-mips.git] / include / linux / usb / renesas_usbhs.h
blob8977431259c6c12660647590bb7ae5f8724e610d
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 * Phy reset for platform
72 void (*phy_reset)(struct platform_device *pdev);
75 * get USB ID function
76 * - USBHS_HOST
77 * - USBHS_GADGET
79 int (*get_id)(struct platform_device *pdev);
82 * get VBUS status function.
84 int (*get_vbus)(struct platform_device *pdev);
88 * parameters for renesas usbhs
90 * some register needs USB chip specific parameters.
91 * This struct show it to driver
93 struct renesas_usbhs_driver_param {
95 * pipe settings
97 u32 *pipe_type; /* array of USB_ENDPOINT_XFER_xxx (from ep0) */
98 int pipe_size; /* pipe_type array size */
101 * option:
103 * for BUSWAIT :: BWAIT
104 * */
105 int buswait_bwait;
108 * option:
110 * delay time from notify_hotplug callback
112 int detection_delay;
115 * option:
117 * dma id for dmaengine
119 int d0_tx_id;
120 int d0_rx_id;
121 int d1_tx_id;
122 int d1_rx_id;
125 * option:
127 * pio <--> dma border.
129 int pio_dma_border; /* default is 64byte */
133 * option:
135 * platform information for renesas_usbhs driver.
137 struct renesas_usbhs_platform_info {
139 * option:
141 * platform set these functions before
142 * call platform_add_devices if needed
144 struct renesas_usbhs_platform_callback platform_callback;
147 * driver set these callback functions pointer.
148 * platform can use it on callback functions
150 struct renesas_usbhs_driver_callback driver_callback;
153 * option:
155 * driver use these param for some register
157 struct renesas_usbhs_driver_param driver_param;
161 * macro for platform
163 #define renesas_usbhs_get_info(pdev)\
164 ((struct renesas_usbhs_platform_info *)(pdev)->dev.platform_data)
166 #define renesas_usbhs_call_notify_hotplug(pdev) \
167 ({ \
168 struct renesas_usbhs_driver_callback *dc; \
169 dc = &(renesas_usbhs_get_info(pdev)->driver_callback); \
170 if (dc && dc->notify_hotplug) \
171 dc->notify_hotplug(pdev); \
173 #endif /* RENESAS_USB_H */