xtensa: fix high memory/reserved memory collision
[cris-mirror.git] / include / linux / usb / renesas_usbhs.h
blob53924f8e840c9e8f095a94d54f20ebae15fb0e91
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/notifier.h>
21 #include <linux/platform_device.h>
22 #include <linux/usb/ch9.h>
25 * module type
27 * it will be return value from get_id
29 enum {
30 USBHS_HOST = 0,
31 USBHS_GADGET,
32 USBHS_MAX,
36 * callback functions table for driver
38 * These functions are called from platform for driver.
39 * Callback function's pointer will be set before
40 * renesas_usbhs_platform_callback :: hardware_init was called
42 struct renesas_usbhs_driver_callback {
43 int (*notify_hotplug)(struct platform_device *pdev);
47 * callback functions for platform
49 * These functions are called from driver for platform
51 struct renesas_usbhs_platform_callback {
54 * option:
56 * Hardware init function for platform.
57 * it is called when driver was probed.
59 int (*hardware_init)(struct platform_device *pdev);
62 * option:
64 * Hardware exit function for platform.
65 * it is called when driver was removed
67 int (*hardware_exit)(struct platform_device *pdev);
70 * option:
72 * for board specific clock control
74 int (*power_ctrl)(struct platform_device *pdev,
75 void __iomem *base, int enable);
78 * option:
80 * Phy reset for platform
82 int (*phy_reset)(struct platform_device *pdev);
85 * get USB ID function
86 * - USBHS_HOST
87 * - USBHS_GADGET
89 int (*get_id)(struct platform_device *pdev);
92 * get VBUS status function.
94 int (*get_vbus)(struct platform_device *pdev);
97 * option:
99 * VBUS control is needed for Host
101 int (*set_vbus)(struct platform_device *pdev, int enable);
104 * option:
105 * extcon notifier to set host/peripheral mode.
107 int (*notifier)(struct notifier_block *nb, unsigned long event,
108 void *data);
112 * parameters for renesas usbhs
114 * some register needs USB chip specific parameters.
115 * This struct show it to driver
118 struct renesas_usbhs_driver_pipe_config {
119 u8 type; /* USB_ENDPOINT_XFER_xxx */
120 u16 bufsize;
121 u8 bufnum;
122 bool double_buf;
124 #define RENESAS_USBHS_PIPE(_type, _size, _num, _double_buf) { \
125 .type = (_type), \
126 .bufsize = (_size), \
127 .bufnum = (_num), \
128 .double_buf = (_double_buf), \
131 struct renesas_usbhs_driver_param {
133 * pipe settings
135 struct renesas_usbhs_driver_pipe_config *pipe_configs;
136 int pipe_size; /* pipe_configs array size */
139 * option:
141 * for BUSWAIT :: BWAIT
142 * see
143 * renesas_usbhs/common.c :: usbhsc_set_buswait()
144 * */
145 int buswait_bwait;
148 * option:
150 * delay time from notify_hotplug callback
152 int detection_delay; /* msec */
155 * option:
157 * dma id for dmaengine
158 * The data transfer direction on D0FIFO/D1FIFO should be
159 * fixed for keeping consistency.
160 * So, the platform id settings will be..
161 * .d0_tx_id = xx_TX,
162 * .d1_rx_id = xx_RX,
163 * or
164 * .d1_tx_id = xx_TX,
165 * .d0_rx_id = xx_RX,
167 int d0_tx_id;
168 int d0_rx_id;
169 int d1_tx_id;
170 int d1_rx_id;
171 int d2_tx_id;
172 int d2_rx_id;
173 int d3_tx_id;
174 int d3_rx_id;
177 * option:
179 * pio <--> dma border.
181 int pio_dma_border; /* default is 64byte */
183 uintptr_t type;
184 u32 enable_gpio;
187 * option:
189 u32 has_otg:1; /* for controlling PWEN/EXTLP */
190 u32 has_sudmac:1; /* for SUDMAC */
191 u32 has_usb_dmac:1; /* for USB-DMAC */
192 #define USBHS_USB_DMAC_XFER_SIZE 32 /* hardcode the xfer size */
195 #define USBHS_TYPE_RCAR_GEN2 1
196 #define USBHS_TYPE_RCAR_GEN3 2
197 #define USBHS_TYPE_RCAR_GEN3_WITH_PLL 3
198 #define USBHS_TYPE_RZA1 4
201 * option:
203 * platform information for renesas_usbhs driver.
205 struct renesas_usbhs_platform_info {
207 * option:
209 * platform set these functions before
210 * call platform_add_devices if needed
212 struct renesas_usbhs_platform_callback platform_callback;
215 * driver set these callback functions pointer.
216 * platform can use it on callback functions
218 struct renesas_usbhs_driver_callback driver_callback;
221 * option:
223 * driver use these param for some register
225 struct renesas_usbhs_driver_param driver_param;
229 * macro for platform
231 #define renesas_usbhs_get_info(pdev)\
232 ((struct renesas_usbhs_platform_info *)(pdev)->dev.platform_data)
234 #define renesas_usbhs_call_notify_hotplug(pdev) \
235 ({ \
236 struct renesas_usbhs_driver_callback *dc; \
237 dc = &(renesas_usbhs_get_info(pdev)->driver_callback); \
238 if (dc && dc->notify_hotplug) \
239 dc->notify_hotplug(pdev); \
241 #endif /* RENESAS_USB_H */