1 // SPDX-License-Identifier: GPL-1.0+
5 * Copyright (C) 2011 Renesas Solutions Corp.
6 * Copyright (C) 2019 Renesas Electronics Corporation
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 #include <linux/notifier.h>
22 #include <linux/platform_device.h>
23 #include <linux/usb/ch9.h>
28 * it will be return value from get_id
37 * callback functions for platform
39 * These functions are called from driver for platform
41 struct renesas_usbhs_platform_callback {
46 * Hardware init function for platform.
47 * it is called when driver was probed.
49 int (*hardware_init)(struct platform_device *pdev);
54 * Hardware exit function for platform.
55 * it is called when driver was removed
57 int (*hardware_exit)(struct platform_device *pdev);
62 * for board specific clock control
64 int (*power_ctrl)(struct platform_device *pdev,
65 void __iomem *base, int enable);
70 * Phy reset for platform
72 int (*phy_reset)(struct platform_device *pdev);
79 int (*get_id)(struct platform_device *pdev);
82 * get VBUS status function.
84 int (*get_vbus)(struct platform_device *pdev);
89 * VBUS control is needed for Host
91 int (*set_vbus)(struct platform_device *pdev, int enable);
95 * extcon notifier to set host/peripheral mode.
97 int (*notifier)(struct notifier_block *nb, unsigned long event,
102 * parameters for renesas usbhs
104 * some register needs USB chip specific parameters.
105 * This struct show it to driver
108 struct renesas_usbhs_driver_pipe_config {
109 u8 type; /* USB_ENDPOINT_XFER_xxx */
114 #define RENESAS_USBHS_PIPE(_type, _size, _num, _double_buf) { \
116 .bufsize = (_size), \
118 .double_buf = (_double_buf), \
121 struct renesas_usbhs_driver_param {
125 struct renesas_usbhs_driver_pipe_config *pipe_configs;
126 int pipe_size; /* pipe_configs array size */
131 * for BUSWAIT :: BWAIT
133 * renesas_usbhs/common.c :: usbhsc_set_buswait()
140 * delay time from notify_hotplug callback
142 int detection_delay; /* msec */
147 * dma id for dmaengine
148 * The data transfer direction on D0FIFO/D1FIFO should be
149 * fixed for keeping consistency.
150 * So, the platform id settings will be..
169 * pio <--> dma border.
171 int pio_dma_border; /* default is 64byte */
176 u32 has_usb_dmac:1; /* for USB-DMAC */
177 u32 runtime_pwctrl:1;
179 u32 cfifo_byte_addr:1; /* CFIFO is byte addressable */
180 #define USBHS_USB_DMAC_XFER_SIZE 32 /* hardcode the xfer size */
182 u32 has_new_pipe_configs:1;
188 * platform information for renesas_usbhs driver.
190 struct renesas_usbhs_platform_info {
194 * platform set these functions before
195 * call platform_add_devices if needed
197 struct renesas_usbhs_platform_callback platform_callback;
202 * driver use these param for some register
204 struct renesas_usbhs_driver_param driver_param;
210 #define renesas_usbhs_get_info(pdev)\
211 ((struct renesas_usbhs_platform_info *)(pdev)->dev.platform_data)
212 #endif /* RENESAS_USB_H */