1 // SPDX-License-Identifier: GPL-1.0+
5 * Copyright (C) 2011 Renesas Solutions Corp.
6 * Copyright (C) 2019 Renesas Electronics Corporation
7 * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
11 #include <linux/notifier.h>
12 #include <linux/platform_device.h>
13 #include <linux/usb/ch9.h>
18 * it will be return value from get_id
27 * callback functions for platform
29 * These functions are called from driver for platform
31 struct renesas_usbhs_platform_callback
{
36 * Hardware init function for platform.
37 * it is called when driver was probed.
39 int (*hardware_init
)(struct platform_device
*pdev
);
44 * Hardware exit function for platform.
45 * it is called when driver was removed
47 int (*hardware_exit
)(struct platform_device
*pdev
);
52 * for board specific clock control
54 int (*power_ctrl
)(struct platform_device
*pdev
,
55 void __iomem
*base
, int enable
);
60 * Phy reset for platform
62 int (*phy_reset
)(struct platform_device
*pdev
);
69 int (*get_id
)(struct platform_device
*pdev
);
72 * get VBUS status function.
74 int (*get_vbus
)(struct platform_device
*pdev
);
79 * VBUS control is needed for Host
81 int (*set_vbus
)(struct platform_device
*pdev
, int enable
);
85 * extcon notifier to set host/peripheral mode.
87 int (*notifier
)(struct notifier_block
*nb
, unsigned long event
,
92 * parameters for renesas usbhs
94 * some register needs USB chip specific parameters.
95 * This struct show it to driver
98 struct renesas_usbhs_driver_pipe_config
{
99 u8 type
; /* USB_ENDPOINT_XFER_xxx */
104 #define RENESAS_USBHS_PIPE(_type, _size, _num, _double_buf) { \
106 .bufsize = (_size), \
108 .double_buf = (_double_buf), \
111 struct renesas_usbhs_driver_param
{
115 struct renesas_usbhs_driver_pipe_config
*pipe_configs
;
116 int pipe_size
; /* pipe_configs array size */
121 * for BUSWAIT :: BWAIT
123 * renesas_usbhs/common.c :: usbhsc_set_buswait()
130 * delay time from notify_hotplug callback
132 int detection_delay
; /* msec */
137 * dma id for dmaengine
138 * The data transfer direction on D0FIFO/D1FIFO should be
139 * fixed for keeping consistency.
140 * So, the platform id settings will be..
159 * pio <--> dma border.
161 int pio_dma_border
; /* default is 64byte */
166 u32 has_usb_dmac
:1; /* for USB-DMAC */
167 u32 runtime_pwctrl
:1;
169 u32 cfifo_byte_addr
:1; /* CFIFO is byte addressable */
170 #define USBHS_USB_DMAC_XFER_SIZE 32 /* hardcode the xfer size */
172 u32 has_new_pipe_configs
:1;
178 * platform information for renesas_usbhs driver.
180 struct renesas_usbhs_platform_info
{
184 * platform set these functions before
185 * call platform_add_devices if needed
187 struct renesas_usbhs_platform_callback platform_callback
;
192 * driver use these param for some register
194 struct renesas_usbhs_driver_param driver_param
;
197 #endif /* RENESAS_USB_H */