blob: 8155e3dcaf66de5af189ddf78c8def3bedc46cb0 [file] [log] [blame]
Vitaliy Vasylskyyd8e5fc82024-09-09 01:06:24 +02001// SPDX-License-Identifier: GPL-1.0+
2/*
3 * Renesas USB
4 *
5 * Copyright (C) 2011 Renesas Solutions Corp.
6 * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
7 *
8 * Ported to u-boot
9 * Copyright (C) 2016 GlobalLogic
10 */
11#ifndef RENESAS_USB_H
12#define RENESAS_USB_H
13
14#include <linux/usb/ch9.h>
15#include <linux/compat.h>
16
17struct platform_device {
18 const char *name;
19 struct device dev;
20};
21
22/*
23 * module type
24 *
25 * it will be return value from get_id
26 */
27enum {
28 USBHS_HOST = 0,
29 USBHS_GADGET,
30 USBHS_MAX,
31};
32
33/*
34 * parameters for renesas usbhs
35 *
36 * some register needs USB chip specific parameters.
37 * This struct show it to driver
38 */
39
40struct renesas_usbhs_driver_pipe_config {
41 u8 type; /* USB_ENDPOINT_XFER_xxx */
42 u16 bufsize;
43 u8 bufnum;
44 bool double_buf;
45};
46#define RENESAS_USBHS_PIPE(_type, _size, _num, _double_buf) { \
47 .type = (_type), \
48 .bufsize = (_size), \
49 .bufnum = (_num), \
50 .double_buf = (_double_buf), \
51 }
52
53struct renesas_usbhs_driver_param {
54 /*
55 * pipe settings
56 */
57 struct renesas_usbhs_driver_pipe_config *pipe_configs;
58 int pipe_size; /* pipe_configs array size */
59
60 /*
61 * option:
62 *
63 * for BUSWAIT :: BWAIT
64 * see
65 * renesas_usbhs/common.c :: usbhsc_set_buswait()
66 * */
67 int buswait_bwait;
68
69 /*
70 * option:
71 *
72 * delay time from notify_hotplug callback
73 */
74 int detection_delay; /* msec */
75
76 /*
77 * option:
78 *
79 * dma id for dmaengine
80 * The data transfer direction on D0FIFO/D1FIFO should be
81 * fixed for keeping consistency.
82 * So, the platform id settings will be..
83 * .d0_tx_id = xx_TX,
84 * .d1_rx_id = xx_RX,
85 * or
86 * .d1_tx_id = xx_TX,
87 * .d0_rx_id = xx_RX,
88 */
89 int d0_tx_id;
90 int d0_rx_id;
91 int d1_tx_id;
92 int d1_rx_id;
93 int d2_tx_id;
94 int d2_rx_id;
95 int d3_tx_id;
96 int d3_rx_id;
97
98 /*
99 * option:
100 *
101 * pio <--> dma border.
102 */
103 int pio_dma_border; /* default is 64byte */
104
105 uintptr_t type;
106 u32 enable_gpio;
107
108 /*
109 * option:
110 */
111 u32 has_otg:1; /* for controlling PWEN/EXTLP */
112 u32 has_sudmac:1; /* for SUDMAC */
113 u32 has_usb_dmac:1; /* for USB-DMAC */
114 u32 cfifo_byte_addr:1; /* CFIFO is byte addressable */
115#define USBHS_USB_DMAC_XFER_SIZE 32 /* hardcode the xfer size */
116 u32 multi_clks:1;
117 u32 has_new_pipe_configs:1;
118};
119
120#define USBHS_TYPE_RCAR_GEN3 2
121
122struct usbhs_priv;
123struct usb_gadget *usbhsg_get_gadget(struct usbhs_priv *priv);
124
125#endif /* RENESAS_USB_H */