1 // SPDX-License-Identifier: GPL-1.0+
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
20 #include <linux/platform_device.h>
21 #include <linux/usb/ch9.h>
26 * it will be return value from get_id
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
{
55 * Hardware init function for platform.
56 * it is called when driver was probed.
58 int (*hardware_init
)(struct platform_device
*pdev
);
63 * Hardware exit function for platform.
64 * it is called when driver was removed
66 int (*hardware_exit
)(struct platform_device
*pdev
);
71 * for board specific clock control
73 int (*power_ctrl
)(struct platform_device
*pdev
,
74 void __iomem
*base
, int enable
);
79 * Phy reset for platform
81 int (*phy_reset
)(struct platform_device
*pdev
);
88 int (*get_id
)(struct platform_device
*pdev
);
91 * get VBUS status function.
93 int (*get_vbus
)(struct platform_device
*pdev
);
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 */
116 #define RENESAS_USBHS_PIPE(_type, _size, _num, _double_buf) { \
118 .bufsize = (_size), \
120 .double_buf = (_double_buf), \
123 struct renesas_usbhs_driver_param
{
127 struct renesas_usbhs_driver_pipe_config
*pipe_configs
;
128 int pipe_size
; /* pipe_configs array size */
133 * for BUSWAIT :: BWAIT
135 * renesas_usbhs/common.c :: usbhsc_set_buswait()
142 * delay time from notify_hotplug callback
144 int detection_delay
; /* msec */
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..
171 * pio <--> dma border.
173 int pio_dma_border
; /* default is 64byte */
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
194 * platform information for renesas_usbhs driver.
196 struct renesas_usbhs_platform_info
{
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
;
214 * driver use these param for some register
216 struct renesas_usbhs_driver_param driver_param
;
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) \
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 */