signal: Clear si_sys_private before copying siginfo to userspace
[cris-mirror.git] / include / linux / usb / renesas_usbhs.h
blob67102f3d59d473de0ccfd7da4106cdd76bbeaa0f
1 // SPDX-License-Identifier: GPL-1.0+
2 /*
3 * Renesas USB
5 * Copyright (C) 2011 Renesas Solutions Corp.
6 * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 #ifndef RENESAS_USB_H
19 #define RENESAS_USB_H
20 #include <linux/platform_device.h>
21 #include <linux/usb/ch9.h>
24 * module type
26 * it will be return value from get_id
28 enum {
29 USBHS_HOST = 0,
30 USBHS_GADGET,
31 USBHS_MAX,
35 * callback functions table for driver
37 * These functions are called from platform for driver.
38 * Callback function's pointer will be set before
39 * renesas_usbhs_platform_callback :: hardware_init was called
41 struct renesas_usbhs_driver_callback {
42 int (*notify_hotplug)(struct platform_device *pdev);
46 * callback functions for platform
48 * These functions are called from driver for platform
50 struct renesas_usbhs_platform_callback {
53 * option:
55 * Hardware init function for platform.
56 * it is called when driver was probed.
58 int (*hardware_init)(struct platform_device *pdev);
61 * option:
63 * Hardware exit function for platform.
64 * it is called when driver was removed
66 int (*hardware_exit)(struct platform_device *pdev);
69 * option:
71 * for board specific clock control
73 int (*power_ctrl)(struct platform_device *pdev,
74 void __iomem *base, int enable);
77 * option:
79 * Phy reset for platform
81 int (*phy_reset)(struct platform_device *pdev);
84 * get USB ID function
85 * - USBHS_HOST
86 * - USBHS_GADGET
88 int (*get_id)(struct platform_device *pdev);
91 * get VBUS status function.
93 int (*get_vbus)(struct platform_device *pdev);
96 * option:
98 * VBUS control is needed for Host
100 int (*set_vbus)(struct platform_device *pdev, int enable);
104 * parameters for renesas usbhs
106 * some register needs USB chip specific parameters.
107 * This struct show it to driver
110 struct renesas_usbhs_driver_pipe_config {
111 u8 type; /* USB_ENDPOINT_XFER_xxx */
112 u16 bufsize;
113 u8 bufnum;
114 bool double_buf;
116 #define RENESAS_USBHS_PIPE(_type, _size, _num, _double_buf) { \
117 .type = (_type), \
118 .bufsize = (_size), \
119 .bufnum = (_num), \
120 .double_buf = (_double_buf), \
123 struct renesas_usbhs_driver_param {
125 * pipe settings
127 struct renesas_usbhs_driver_pipe_config *pipe_configs;
128 int pipe_size; /* pipe_configs array size */
131 * option:
133 * for BUSWAIT :: BWAIT
134 * see
135 * renesas_usbhs/common.c :: usbhsc_set_buswait()
136 * */
137 int buswait_bwait;
140 * option:
142 * delay time from notify_hotplug callback
144 int detection_delay; /* msec */
147 * option:
149 * dma id for dmaengine
150 * The data transfer direction on D0FIFO/D1FIFO should be
151 * fixed for keeping consistency.
152 * So, the platform id settings will be..
153 * .d0_tx_id = xx_TX,
154 * .d1_rx_id = xx_RX,
155 * or
156 * .d1_tx_id = xx_TX,
157 * .d0_rx_id = xx_RX,
159 int d0_tx_id;
160 int d0_rx_id;
161 int d1_tx_id;
162 int d1_rx_id;
163 int d2_tx_id;
164 int d2_rx_id;
165 int d3_tx_id;
166 int d3_rx_id;
169 * option:
171 * pio <--> dma border.
173 int pio_dma_border; /* default is 64byte */
175 uintptr_t type;
176 u32 enable_gpio;
179 * option:
181 u32 has_otg:1; /* for controlling PWEN/EXTLP */
182 u32 has_sudmac:1; /* for SUDMAC */
183 u32 has_usb_dmac:1; /* for USB-DMAC */
184 #define USBHS_USB_DMAC_XFER_SIZE 32 /* hardcode the xfer size */
187 #define USBHS_TYPE_RCAR_GEN2 1
188 #define USBHS_TYPE_RCAR_GEN3 2
189 #define USBHS_TYPE_RCAR_GEN3_WITH_PLL 3
192 * option:
194 * platform information for renesas_usbhs driver.
196 struct renesas_usbhs_platform_info {
198 * option:
200 * platform set these functions before
201 * call platform_add_devices if needed
203 struct renesas_usbhs_platform_callback platform_callback;
206 * driver set these callback functions pointer.
207 * platform can use it on callback functions
209 struct renesas_usbhs_driver_callback driver_callback;
212 * option:
214 * driver use these param for some register
216 struct renesas_usbhs_driver_param driver_param;
220 * macro for platform
222 #define renesas_usbhs_get_info(pdev)\
223 ((struct renesas_usbhs_platform_info *)(pdev)->dev.platform_data)
225 #define renesas_usbhs_call_notify_hotplug(pdev) \
226 ({ \
227 struct renesas_usbhs_driver_callback *dc; \
228 dc = &(renesas_usbhs_get_info(pdev)->driver_callback); \
229 if (dc && dc->notify_hotplug) \
230 dc->notify_hotplug(pdev); \
232 #endif /* RENESAS_USB_H */