blob: 96f3939a65e203e5516cf8c31493e316fcad66d4 [file] [log] [blame]
Greg Kroah-Hartman5fd54ac2017-11-03 11:28:30 +01001// SPDX-License-Identifier: GPL-1.0+
Kuninori Morimotof1407d52011-04-04 13:44:59 +09002/*
3 * Renesas USB driver
4 *
5 * Copyright (C) 2011 Renesas Solutions Corp.
Yoshihiro Shimoda09666482019-06-25 14:38:46 +09006 * Copyright (C) 2019 Renesas Electronics Corporation
Kuninori Morimotof1407d52011-04-04 13:44:59 +09007 * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Kuninori Morimotof1407d52011-04-04 13:44:59 +09008 */
Yoshihiro Shimoda3df0e242018-09-11 17:47:05 +09009#include <linux/clk.h>
Thierry Reding148e1132013-01-21 11:09:22 +010010#include <linux/err.h>
Linus Walleij3b31ec12019-12-17 15:12:41 +010011#include <linux/gpio/consumer.h>
Kuninori Morimotof1407d52011-04-04 13:44:59 +090012#include <linux/io.h>
13#include <linux/module.h>
Yoshihiro Shimodab8541002014-09-03 14:25:56 +090014#include <linux/of_device.h>
Kuninori Morimotof1407d52011-04-04 13:44:59 +090015#include <linux/pm_runtime.h>
Yoshihiro Shimodaf181dbb2018-09-11 17:47:03 +090016#include <linux/reset.h>
Kuninori Morimotof1407d52011-04-04 13:44:59 +090017#include <linux/slab.h>
18#include <linux/sysfs.h>
Paul Bollecc502bb2012-06-03 18:39:13 +020019#include "common.h"
Ulrich Hecht8ecef002014-07-10 09:53:59 +020020#include "rcar2.h"
Yoshihiro Shimodade187572016-01-07 18:18:13 +090021#include "rcar3.h"
Chris Brandtaec29272018-01-08 07:30:53 -050022#include "rza.h"
Kuninori Morimotof1407d52011-04-04 13:44:59 +090023
Kuninori Morimoto233f5192011-07-07 00:23:24 -070024/*
25 * image of renesas_usbhs
26 *
27 * ex) gadget case
28
29 * mod.c
30 * mod_gadget.c
31 * mod_host.c pipe.c fifo.c
32 *
33 * +-------+ +-----------+
34 * | pipe0 |------>| fifo pio |
35 * +------------+ +-------+ +-----------+
36 * | mod_gadget |=====> | pipe1 |--+
37 * +------------+ +-------+ | +-----------+
38 * | pipe2 | | +-| fifo dma0 |
39 * +------------+ +-------+ | | +-----------+
40 * | mod_host | | pipe3 |<-|--+
41 * +------------+ +-------+ | +-----------+
42 * | .... | +--->| fifo dma1 |
43 * | .... | +-----------+
44 */
45
Kuninori Morimotof1407d52011-04-04 13:44:59 +090046/*
47 * platform call back
48 *
49 * renesas usb support platform callback function.
50 * Below macro call it.
51 * if platform doesn't have callback, it return 0 (no error)
52 */
53#define usbhs_platform_call(priv, func, args...)\
54 (!(priv) ? -ENODEV : \
Yoshihiro Shimoda426d3ff2019-06-25 14:38:57 +090055 !((priv)->pfunc->func) ? 0 : \
56 (priv)->pfunc->func(args))
Kuninori Morimotof1407d52011-04-04 13:44:59 +090057
58/*
59 * common functions
60 */
61u16 usbhs_read(struct usbhs_priv *priv, u32 reg)
62{
63 return ioread16(priv->base + reg);
64}
65
66void usbhs_write(struct usbhs_priv *priv, u32 reg, u16 data)
67{
68 iowrite16(data, priv->base + reg);
69}
70
71void usbhs_bset(struct usbhs_priv *priv, u32 reg, u16 mask, u16 data)
72{
73 u16 val = usbhs_read(priv, reg);
74
75 val &= ~mask;
76 val |= data & mask;
77
78 usbhs_write(priv, reg, val);
79}
80
Kuninori Morimoto206dcc22011-04-28 16:40:54 +090081struct usbhs_priv *usbhs_pdev_to_priv(struct platform_device *pdev)
82{
83 return dev_get_drvdata(&pdev->dev);
84}
85
Yoshihiro Shimodabe0a42a2019-06-25 14:38:55 +090086int usbhs_get_id_as_gadget(struct platform_device *pdev)
87{
88 return USBHS_GADGET;
89}
90
Kuninori Morimotof1407d52011-04-04 13:44:59 +090091/*
92 * syscfg functions
93 */
Kuninori Morimoto76190152011-10-23 19:56:41 -070094static void usbhs_sys_clock_ctrl(struct usbhs_priv *priv, int enable)
Kuninori Morimotof1407d52011-04-04 13:44:59 +090095{
96 usbhs_bset(priv, SYSCFG, SCKE, enable ? SCKE : 0);
97}
98
Kuninori Morimotof1407d52011-04-04 13:44:59 +090099void usbhs_sys_host_ctrl(struct usbhs_priv *priv, int enable)
100{
Kuninori Morimoto3244a7b2011-10-23 19:56:30 -0700101 u16 mask = DCFM | DRPD | DPRPU | HSE | USBE;
102 u16 val = DCFM | DRPD | HSE | USBE;
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900103
104 /*
105 * if enable
106 *
107 * - select Host mode
108 * - D+ Line/D- Line Pull-down
109 */
110 usbhs_bset(priv, SYSCFG, mask, enable ? val : 0);
111}
112
113void usbhs_sys_function_ctrl(struct usbhs_priv *priv, int enable)
114{
Kuninori Morimoto3244a7b2011-10-23 19:56:30 -0700115 u16 mask = DCFM | DRPD | DPRPU | HSE | USBE;
Takeshi Kihara04a5def2014-11-04 10:05:43 +0900116 u16 val = HSE | USBE;
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900117
Chris Brandt2195e3a2019-05-15 10:20:42 -0500118 /* CNEN bit is required for function operation */
119 if (usbhs_get_dparam(priv, has_cnen)) {
120 mask |= CNEN;
121 val |= CNEN;
122 }
123
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900124 /*
125 * if enable
126 *
127 * - select Function mode
Takeshi Kihara04a5def2014-11-04 10:05:43 +0900128 * - D+ Line Pull-up is disabled
129 * When D+ Line Pull-up is enabled,
130 * calling usbhs_sys_function_pullup(,1)
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900131 */
132 usbhs_bset(priv, SYSCFG, mask, enable ? val : 0);
133}
134
kuninori.morimoto.gx@renesas.com4cd2f592012-10-15 23:24:19 -0700135void usbhs_sys_function_pullup(struct usbhs_priv *priv, int enable)
136{
137 usbhs_bset(priv, SYSCFG, DPRPU, enable ? DPRPU : 0);
138}
139
Kuninori Morimotodfbb7f42011-11-24 17:28:35 -0800140void usbhs_sys_set_test_mode(struct usbhs_priv *priv, u16 mode)
141{
142 usbhs_write(priv, TESTMODE, mode);
143}
144
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900145/*
146 * frame functions
147 */
148int usbhs_frame_get_num(struct usbhs_priv *priv)
149{
150 return usbhs_read(priv, FRMNUM) & FRNM_MASK;
151}
152
153/*
Kuninori Morimotoef8bedb2011-10-10 22:02:33 -0700154 * usb request functions
155 */
156void usbhs_usbreq_get_val(struct usbhs_priv *priv, struct usb_ctrlrequest *req)
157{
158 u16 val;
159
160 val = usbhs_read(priv, USBREQ);
161 req->bRequest = (val >> 8) & 0xFF;
162 req->bRequestType = (val >> 0) & 0xFF;
163
Ben Dooks (Codethink)46f62f82019-10-15 16:50:44 +0100164 req->wValue = cpu_to_le16(usbhs_read(priv, USBVAL));
165 req->wIndex = cpu_to_le16(usbhs_read(priv, USBINDX));
166 req->wLength = cpu_to_le16(usbhs_read(priv, USBLENG));
Kuninori Morimotoef8bedb2011-10-10 22:02:33 -0700167}
168
169void usbhs_usbreq_set_val(struct usbhs_priv *priv, struct usb_ctrlrequest *req)
170{
171 usbhs_write(priv, USBREQ, (req->bRequest << 8) | req->bRequestType);
Ben Dooks (Codethink)46f62f82019-10-15 16:50:44 +0100172 usbhs_write(priv, USBVAL, le16_to_cpu(req->wValue));
173 usbhs_write(priv, USBINDX, le16_to_cpu(req->wIndex));
174 usbhs_write(priv, USBLENG, le16_to_cpu(req->wLength));
Kuninori Morimotoef8bedb2011-10-10 22:02:33 -0700175
176 usbhs_bset(priv, DCPCTR, SUREQ, SUREQ);
177}
178
179/*
Kuninori Morimoto258485d2011-10-10 22:01:40 -0700180 * bus/vbus functions
181 */
182void usbhs_bus_send_sof_enable(struct usbhs_priv *priv)
183{
Kuninori Morimotoa9be4a42011-10-10 22:06:35 -0700184 u16 status = usbhs_read(priv, DVSTCTR) & (USBRST | UACT);
185
186 if (status != USBRST) {
187 struct device *dev = usbhs_priv_to_dev(priv);
188 dev_err(dev, "usbhs should be reset\n");
189 }
190
Kuninori Morimoto258485d2011-10-10 22:01:40 -0700191 usbhs_bset(priv, DVSTCTR, (USBRST | UACT), UACT);
192}
193
194void usbhs_bus_send_reset(struct usbhs_priv *priv)
195{
196 usbhs_bset(priv, DVSTCTR, (USBRST | UACT), USBRST);
197}
198
Kuninori Morimoto75587f52011-10-10 22:01:51 -0700199int usbhs_bus_get_speed(struct usbhs_priv *priv)
200{
201 u16 dvstctr = usbhs_read(priv, DVSTCTR);
202
203 switch (RHST & dvstctr) {
204 case RHST_LOW_SPEED:
205 return USB_SPEED_LOW;
206 case RHST_FULL_SPEED:
207 return USB_SPEED_FULL;
208 case RHST_HIGH_SPEED:
209 return USB_SPEED_HIGH;
210 }
211
212 return USB_SPEED_UNKNOWN;
213}
214
Kuninori Morimoto258485d2011-10-10 22:01:40 -0700215int usbhs_vbus_ctrl(struct usbhs_priv *priv, int enable)
216{
217 struct platform_device *pdev = usbhs_priv_to_pdev(priv);
218
219 return usbhs_platform_call(priv, set_vbus, pdev, enable);
220}
221
222static void usbhsc_bus_init(struct usbhs_priv *priv)
223{
224 usbhs_write(priv, DVSTCTR, 0);
225
226 usbhs_vbus_ctrl(priv, 0);
227}
228
229/*
Kuninori Morimotoeb051912011-10-10 22:06:46 -0700230 * device configuration
231 */
Kuninori Morimoto3dd49262011-10-31 00:47:13 -0700232int usbhs_set_device_config(struct usbhs_priv *priv, int devnum,
Kuninori Morimotoeb051912011-10-10 22:06:46 -0700233 u16 upphub, u16 hubport, u16 speed)
234{
235 struct device *dev = usbhs_priv_to_dev(priv);
236 u16 usbspd = 0;
237 u32 reg = DEVADD0 + (2 * devnum);
238
239 if (devnum > 10) {
240 dev_err(dev, "cannot set speed to unknown device %d\n", devnum);
241 return -EIO;
242 }
243
244 if (upphub > 0xA) {
245 dev_err(dev, "unsupported hub number %d\n", upphub);
246 return -EIO;
247 }
248
249 switch (speed) {
250 case USB_SPEED_LOW:
251 usbspd = USBSPD_SPEED_LOW;
252 break;
253 case USB_SPEED_FULL:
254 usbspd = USBSPD_SPEED_FULL;
255 break;
256 case USB_SPEED_HIGH:
257 usbspd = USBSPD_SPEED_HIGH;
258 break;
259 default:
260 dev_err(dev, "unsupported speed %d\n", speed);
261 return -EIO;
262 }
263
264 usbhs_write(priv, reg, UPPHUB(upphub) |
265 HUBPORT(hubport)|
266 USBSPD(usbspd));
267
268 return 0;
269}
270
271/*
Yoshihiro Shimodaab330cf2015-03-12 15:35:20 +0900272 * interrupt functions
273 */
274void usbhs_xxxsts_clear(struct usbhs_priv *priv, u16 sts_reg, u16 bit)
275{
276 u16 pipe_mask = (u16)GENMASK(usbhs_get_dparam(priv, pipe_size), 0);
277
278 usbhs_write(priv, sts_reg, ~(1 << bit) & pipe_mask);
279}
280
281/*
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900282 * local functions
283 */
Kuninori Morimoto11935de2011-10-10 22:01:28 -0700284static void usbhsc_set_buswait(struct usbhs_priv *priv)
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900285{
286 int wait = usbhs_get_dparam(priv, buswait_bwait);
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900287
Kuninori Morimoto11935de2011-10-10 22:01:28 -0700288 /* set bus wait if platform have */
289 if (wait)
290 usbhs_bset(priv, BUSWAIT, 0x000F, wait);
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900291}
292
Yoshihiro Shimoda3df0e242018-09-11 17:47:05 +0900293static bool usbhsc_is_multi_clks(struct usbhs_priv *priv)
294{
Yoshihiro Shimodadf9f2c22019-06-25 14:38:49 +0900295 return priv->dparam.multi_clks;
Yoshihiro Shimoda3df0e242018-09-11 17:47:05 +0900296}
297
298static int usbhsc_clk_get(struct device *dev, struct usbhs_priv *priv)
299{
300 if (!usbhsc_is_multi_clks(priv))
301 return 0;
302
303 /* The first clock should exist */
Yoshihiro Shimoda31e795c2019-06-25 14:38:51 +0900304 priv->clks[0] = of_clk_get(dev_of_node(dev), 0);
Yoshihiro Shimoda3df0e242018-09-11 17:47:05 +0900305 if (IS_ERR(priv->clks[0]))
306 return PTR_ERR(priv->clks[0]);
307
308 /*
309 * To backward compatibility with old DT, this driver checks the return
310 * value if it's -ENOENT or not.
311 */
Yoshihiro Shimoda31e795c2019-06-25 14:38:51 +0900312 priv->clks[1] = of_clk_get(dev_of_node(dev), 1);
Yoshihiro Shimoda3df0e242018-09-11 17:47:05 +0900313 if (PTR_ERR(priv->clks[1]) == -ENOENT)
314 priv->clks[1] = NULL;
315 else if (IS_ERR(priv->clks[1]))
316 return PTR_ERR(priv->clks[1]);
317
318 return 0;
319}
320
321static void usbhsc_clk_put(struct usbhs_priv *priv)
322{
323 int i;
324
325 if (!usbhsc_is_multi_clks(priv))
326 return;
327
328 for (i = 0; i < ARRAY_SIZE(priv->clks); i++)
329 clk_put(priv->clks[i]);
330}
331
332static int usbhsc_clk_prepare_enable(struct usbhs_priv *priv)
333{
334 int i, ret;
335
336 if (!usbhsc_is_multi_clks(priv))
337 return 0;
338
339 for (i = 0; i < ARRAY_SIZE(priv->clks); i++) {
340 ret = clk_prepare_enable(priv->clks[i]);
341 if (ret) {
342 while (--i >= 0)
343 clk_disable_unprepare(priv->clks[i]);
344 return ret;
345 }
346 }
347
348 return ret;
349}
350
351static void usbhsc_clk_disable_unprepare(struct usbhs_priv *priv)
352{
353 int i;
354
355 if (!usbhsc_is_multi_clks(priv))
356 return;
357
358 for (i = 0; i < ARRAY_SIZE(priv->clks); i++)
359 clk_disable_unprepare(priv->clks[i]);
360}
361
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900362/*
363 * platform default param
364 */
Ulrich Hecht8ecef002014-07-10 09:53:59 +0200365
366/* commonly used on old SH-Mobile SoCs */
Yoshihiro Shimoda51f141a2015-11-18 14:34:09 +0900367static struct renesas_usbhs_driver_pipe_config usbhsc_default_pipe[] = {
368 RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_CONTROL, 64, 0x00, false),
369 RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_ISOC, 1024, 0x08, false),
370 RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_ISOC, 1024, 0x18, false),
371 RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_BULK, 512, 0x28, true),
372 RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_BULK, 512, 0x38, true),
373 RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_BULK, 512, 0x48, true),
374 RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_INT, 64, 0x04, false),
375 RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_INT, 64, 0x05, false),
376 RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_INT, 64, 0x06, false),
377 RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_INT, 64, 0x07, false),
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900378};
379
Ulrich Hecht8ecef002014-07-10 09:53:59 +0200380/* commonly used on newer SH-Mobile and R-Car SoCs */
Yoshihiro Shimoda51f141a2015-11-18 14:34:09 +0900381static struct renesas_usbhs_driver_pipe_config usbhsc_new_pipe[] = {
382 RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_CONTROL, 64, 0x00, false),
383 RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_ISOC, 1024, 0x08, true),
384 RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_ISOC, 1024, 0x28, true),
385 RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_BULK, 512, 0x48, true),
386 RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_BULK, 512, 0x58, true),
387 RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_BULK, 512, 0x68, true),
388 RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_INT, 64, 0x04, false),
389 RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_INT, 64, 0x05, false),
390 RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_INT, 64, 0x06, false),
391 RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_BULK, 512, 0x78, true),
392 RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_BULK, 512, 0x88, true),
393 RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_BULK, 512, 0x98, true),
394 RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_BULK, 512, 0xa8, true),
395 RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_BULK, 512, 0xb8, true),
396 RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_BULK, 512, 0xc8, true),
397 RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_BULK, 512, 0xd8, true),
Ulrich Hecht8ecef002014-07-10 09:53:59 +0200398};
399
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900400/*
Kuninori Morimoto6e267da2011-04-28 16:41:02 +0900401 * power control
402 */
403static void usbhsc_power_ctrl(struct usbhs_priv *priv, int enable)
404{
Kuninori Morimotof1ee56a2011-10-23 19:57:10 -0700405 struct platform_device *pdev = usbhs_priv_to_pdev(priv);
Kuninori Morimoto6e267da2011-04-28 16:41:02 +0900406 struct device *dev = usbhs_priv_to_dev(priv);
407
408 if (enable) {
409 /* enable PM */
410 pm_runtime_get_sync(dev);
411
Yoshihiro Shimoda3df0e242018-09-11 17:47:05 +0900412 /* enable clks */
413 if (usbhsc_clk_prepare_enable(priv))
414 return;
415
Kuninori Morimotof1ee56a2011-10-23 19:57:10 -0700416 /* enable platform power */
417 usbhs_platform_call(priv, power_ctrl, pdev, priv->base, enable);
418
Kuninori Morimoto6e267da2011-04-28 16:41:02 +0900419 /* USB on */
420 usbhs_sys_clock_ctrl(priv, enable);
Kuninori Morimoto6e267da2011-04-28 16:41:02 +0900421 } else {
422 /* USB off */
Kuninori Morimoto6e267da2011-04-28 16:41:02 +0900423 usbhs_sys_clock_ctrl(priv, enable);
424
Kuninori Morimotof1ee56a2011-10-23 19:57:10 -0700425 /* disable platform power */
426 usbhs_platform_call(priv, power_ctrl, pdev, priv->base, enable);
427
Yoshihiro Shimoda3df0e242018-09-11 17:47:05 +0900428 /* disable clks */
429 usbhsc_clk_disable_unprepare(priv);
430
Kuninori Morimoto6e267da2011-04-28 16:41:02 +0900431 /* disable PM */
432 pm_runtime_put_sync(dev);
433 }
434}
435
436/*
Kuninori Morimotoca8a2822011-10-10 21:58:19 -0700437 * hotplug
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900438 */
Kuninori Morimotoca8a2822011-10-10 21:58:19 -0700439static void usbhsc_hotplug(struct usbhs_priv *priv)
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900440{
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900441 struct platform_device *pdev = usbhs_priv_to_pdev(priv);
442 struct usbhs_mod *mod = usbhs_mod_get_current(priv);
443 int id;
444 int enable;
Sergei Shtylyovd7b39682014-12-16 01:42:13 +0300445 int cable;
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900446 int ret;
447
448 /*
449 * get vbus status from platform
450 */
Yoshihiro Shimodaccc32642019-06-25 14:38:48 +0900451 enable = usbhs_mod_info_call(priv, get_vbus, pdev);
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900452
453 /*
454 * get id from platform
455 */
456 id = usbhs_platform_call(priv, get_id, pdev);
457
458 if (enable && !mod) {
Sergei Shtylyovd7b39682014-12-16 01:42:13 +0300459 if (priv->edev) {
Chanwoo Choiea07b8c2017-01-16 21:37:02 +0900460 cable = extcon_get_state(priv->edev, EXTCON_USB_HOST);
Sergei Shtylyovd7b39682014-12-16 01:42:13 +0300461 if ((cable > 0 && id != USBHS_HOST) ||
462 (!cable && id != USBHS_GADGET)) {
463 dev_info(&pdev->dev,
464 "USB cable plugged in doesn't match the selected role!\n");
465 return;
466 }
467 }
468
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900469 ret = usbhs_mod_change(priv, id);
470 if (ret < 0)
471 return;
472
473 dev_dbg(&pdev->dev, "%s enable\n", __func__);
474
Kuninori Morimoto6e267da2011-04-28 16:41:02 +0900475 /* power on */
Chris Brandt97a79682019-05-15 10:20:41 -0500476 if (usbhs_get_dparam(priv, runtime_pwctrl))
Kuninori Morimotob002ff62011-04-28 16:41:20 +0900477 usbhsc_power_ctrl(priv, enable);
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900478
Kuninori Morimoto258485d2011-10-10 22:01:40 -0700479 /* bus init */
480 usbhsc_set_buswait(priv);
481 usbhsc_bus_init(priv);
482
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900483 /* module start */
484 usbhs_mod_call(priv, start, priv);
485
486 } else if (!enable && mod) {
487 dev_dbg(&pdev->dev, "%s disable\n", __func__);
488
489 /* module stop */
490 usbhs_mod_call(priv, stop, priv);
491
Kuninori Morimoto258485d2011-10-10 22:01:40 -0700492 /* bus init */
493 usbhsc_bus_init(priv);
494
Kuninori Morimoto6e267da2011-04-28 16:41:02 +0900495 /* power off */
Chris Brandt97a79682019-05-15 10:20:41 -0500496 if (usbhs_get_dparam(priv, runtime_pwctrl))
Kuninori Morimotob002ff62011-04-28 16:41:20 +0900497 usbhsc_power_ctrl(priv, enable);
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900498
499 usbhs_mod_change(priv, -1);
500
501 /* reset phy for next connection */
502 usbhs_platform_call(priv, phy_reset, pdev);
503 }
504}
505
Kuninori Morimotoca8a2822011-10-10 21:58:19 -0700506/*
507 * notify hotplug
508 */
509static void usbhsc_notify_hotplug(struct work_struct *work)
510{
511 struct usbhs_priv *priv = container_of(work,
512 struct usbhs_priv,
513 notify_hotplug_work.work);
514 usbhsc_hotplug(priv);
515}
516
Yoshihiro Shimoda09666482019-06-25 14:38:46 +0900517int usbhsc_schedule_notify_hotplug(struct platform_device *pdev)
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900518{
Kuninori Morimoto206dcc22011-04-28 16:40:54 +0900519 struct usbhs_priv *priv = usbhs_pdev_to_priv(pdev);
Kuninori Morimotobc573812011-04-28 16:41:14 +0900520 int delay = usbhs_get_dparam(priv, detection_delay);
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900521
522 /*
523 * This functions will be called in interrupt.
524 * To make sure safety context,
525 * use workqueue for usbhs_notify_hotplug
526 */
Kuninori Morimotoa49a88f2011-10-23 19:57:02 -0700527 schedule_delayed_work(&priv->notify_hotplug_work,
528 msecs_to_jiffies(delay));
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900529 return 0;
530}
531
532/*
533 * platform functions
534 */
Yoshihiro Shimodab8541002014-09-03 14:25:56 +0900535static const struct of_device_id usbhs_of_match[] = {
536 {
Fabrizio Castro1d6e81a2018-12-14 08:27:03 +0000537 .compatible = "renesas,usbhs-r8a774c0",
Yoshihiro Shimoda76eff172019-06-25 14:38:56 +0900538 .data = &usbhs_rcar_gen3_with_pll_plat_info,
Fabrizio Castro1d6e81a2018-12-14 08:27:03 +0000539 },
540 {
Yoshihiro Shimodab8541002014-09-03 14:25:56 +0900541 .compatible = "renesas,usbhs-r8a7790",
Yoshihiro Shimoda76eff172019-06-25 14:38:56 +0900542 .data = &usbhs_rcar_gen2_plat_info,
Yoshihiro Shimodab8541002014-09-03 14:25:56 +0900543 },
544 {
545 .compatible = "renesas,usbhs-r8a7791",
Yoshihiro Shimoda76eff172019-06-25 14:38:56 +0900546 .data = &usbhs_rcar_gen2_plat_info,
Yoshihiro Shimodab8541002014-09-03 14:25:56 +0900547 },
Yoshihiro Shimodaaf6e6132015-05-18 20:04:15 +0900548 {
549 .compatible = "renesas,usbhs-r8a7794",
Yoshihiro Shimoda76eff172019-06-25 14:38:56 +0900550 .data = &usbhs_rcar_gen2_plat_info,
Yoshihiro Shimodaaf6e6132015-05-18 20:04:15 +0900551 },
Yoshihiro Shimodaf5f6afa2015-09-29 18:21:19 +0900552 {
Yoshihiro Shimodaf5f6afa2015-09-29 18:21:19 +0900553 .compatible = "renesas,usbhs-r8a7795",
Yoshihiro Shimoda76eff172019-06-25 14:38:56 +0900554 .data = &usbhs_rcar_gen3_plat_info,
Yoshihiro Shimodaf5f6afa2015-09-29 18:21:19 +0900555 },
Simon Horman2f1a9932015-12-16 13:51:51 +0900556 {
Yoshihiro Shimodaaae819e2016-08-24 16:39:53 +0900557 .compatible = "renesas,usbhs-r8a7796",
Yoshihiro Shimoda76eff172019-06-25 14:38:56 +0900558 .data = &usbhs_rcar_gen3_plat_info,
Yoshihiro Shimodaaae819e2016-08-24 16:39:53 +0900559 },
560 {
Yoshihiro Shimoda4d2a8632018-09-21 21:26:32 +0900561 .compatible = "renesas,usbhs-r8a77990",
Yoshihiro Shimoda76eff172019-06-25 14:38:56 +0900562 .data = &usbhs_rcar_gen3_with_pll_plat_info,
Yoshihiro Shimoda4d2a8632018-09-21 21:26:32 +0900563 },
564 {
Yoshihiro Shimoda0f386722017-10-03 20:09:14 +0900565 .compatible = "renesas,usbhs-r8a77995",
Yoshihiro Shimoda76eff172019-06-25 14:38:56 +0900566 .data = &usbhs_rcar_gen3_with_pll_plat_info,
Yoshihiro Shimoda0f386722017-10-03 20:09:14 +0900567 },
568 {
Simon Horman2f1a9932015-12-16 13:51:51 +0900569 .compatible = "renesas,rcar-gen2-usbhs",
Yoshihiro Shimoda76eff172019-06-25 14:38:56 +0900570 .data = &usbhs_rcar_gen2_plat_info,
Simon Horman2f1a9932015-12-16 13:51:51 +0900571 },
572 {
Simon Horman2f1a9932015-12-16 13:51:51 +0900573 .compatible = "renesas,rcar-gen3-usbhs",
Yoshihiro Shimoda76eff172019-06-25 14:38:56 +0900574 .data = &usbhs_rcar_gen3_plat_info,
Simon Horman2f1a9932015-12-16 13:51:51 +0900575 },
Chris Brandtaec29272018-01-08 07:30:53 -0500576 {
577 .compatible = "renesas,rza1-usbhs",
Yoshihiro Shimoda76eff172019-06-25 14:38:56 +0900578 .data = &usbhs_rza1_plat_info,
Chris Brandtaec29272018-01-08 07:30:53 -0500579 },
Chris Brandtb69dce62019-05-15 10:20:44 -0500580 {
581 .compatible = "renesas,rza2-usbhs",
Yoshihiro Shimoda76eff172019-06-25 14:38:56 +0900582 .data = &usbhs_rza2_plat_info,
Chris Brandtb69dce62019-05-15 10:20:44 -0500583 },
Yoshihiro Shimodab8541002014-09-03 14:25:56 +0900584 { },
585};
586MODULE_DEVICE_TABLE(of, usbhs_of_match);
587
Kuninori Morimotob7a8d172011-10-26 19:33:49 -0700588static int usbhs_probe(struct platform_device *pdev)
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900589{
Yoshihiro Shimoda76eff172019-06-25 14:38:56 +0900590 const struct renesas_usbhs_platform_info *info;
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900591 struct usbhs_priv *priv;
Yoshihiro Shimodaf08acaf2019-06-25 14:38:53 +0900592 struct device *dev = &pdev->dev;
Linus Walleij3b31ec12019-12-17 15:12:41 +0100593 struct gpio_desc *gpiod;
594 int ret;
Yoshihiro Shimodab3103d02019-06-25 14:38:54 +0900595 u32 tmp;
Lad Prabhakar22ae6412021-12-20 01:04:07 +0000596 int irq;
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900597
Yoshihiro Shimodab8541002014-09-03 14:25:56 +0900598 /* check device node */
Yoshihiro Shimodaf08acaf2019-06-25 14:38:53 +0900599 if (dev_of_node(dev))
Yoshihiro Shimoda76eff172019-06-25 14:38:56 +0900600 info = of_device_get_match_data(dev);
601 else
602 info = renesas_usbhs_get_info(pdev);
Yoshihiro Shimodab8541002014-09-03 14:25:56 +0900603
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900604 /* check platform information */
Ulrich Hecht8ecef002014-07-10 09:53:59 +0200605 if (!info) {
Yoshihiro Shimodaf08acaf2019-06-25 14:38:53 +0900606 dev_err(dev, "no platform information\n");
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900607 return -EINVAL;
608 }
609
610 /* platform data */
Lad Prabhakar22ae6412021-12-20 01:04:07 +0000611 irq = platform_get_irq(pdev, 0);
612 if (irq < 0)
613 return irq;
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900614
615 /* usb private data */
Yoshihiro Shimodaf08acaf2019-06-25 14:38:53 +0900616 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
Peter Chenb1cb07c2014-10-14 15:56:19 +0800617 if (!priv)
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900618 return -ENOMEM;
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900619
YueHaibingd706a952019-09-04 16:50:45 +0800620 priv->base = devm_platform_ioremap_resource(pdev, 0);
Thierry Reding148e1132013-01-21 11:09:22 +0100621 if (IS_ERR(priv->base))
622 return PTR_ERR(priv->base);
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900623
Yoshihiro Shimodaf08acaf2019-06-25 14:38:53 +0900624 if (of_property_read_bool(dev_of_node(dev), "extcon")) {
625 priv->edev = extcon_get_edev_by_phandle(dev, 0);
Sergei Shtylyovd7b39682014-12-16 01:42:13 +0300626 if (IS_ERR(priv->edev))
627 return PTR_ERR(priv->edev);
628 }
629
Yoshihiro Shimodaf08acaf2019-06-25 14:38:53 +0900630 priv->rsts = devm_reset_control_array_get_optional_shared(dev);
Yoshihiro Shimodaf181dbb2018-09-11 17:47:03 +0900631 if (IS_ERR(priv->rsts))
632 return PTR_ERR(priv->rsts);
633
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900634 /*
635 * care platform info
636 */
Ulrich Hecht8ecef002014-07-10 09:53:59 +0200637
Yoshihiro Shimoda743344a92019-06-13 20:18:48 +0900638 priv->dparam = info->driver_param;
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900639
Yoshihiro Shimodabe21a022019-05-13 11:40:29 +0900640 if (!info->platform_callback.get_id) {
Yoshihiro Shimodaf08acaf2019-06-25 14:38:53 +0900641 dev_err(dev, "no platform callbacks\n");
Yoshihiro Shimodabe21a022019-05-13 11:40:29 +0900642 return -EINVAL;
Ulrich Hecht8ecef002014-07-10 09:53:59 +0200643 }
Yoshihiro Shimoda426d3ff2019-06-25 14:38:57 +0900644 priv->pfunc = &info->platform_callback;
Ulrich Hecht8ecef002014-07-10 09:53:59 +0200645
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900646 /* set default param if platform doesn't have */
Yoshihiro Shimoda98e86502019-06-25 14:38:52 +0900647 if (usbhs_get_dparam(priv, has_new_pipe_configs)) {
648 priv->dparam.pipe_configs = usbhsc_new_pipe;
649 priv->dparam.pipe_size = ARRAY_SIZE(usbhsc_new_pipe);
650 } else if (!priv->dparam.pipe_configs) {
Yoshihiro Shimoda51f141a2015-11-18 14:34:09 +0900651 priv->dparam.pipe_configs = usbhsc_default_pipe;
652 priv->dparam.pipe_size = ARRAY_SIZE(usbhsc_default_pipe);
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900653 }
Kuninori Morimoto48298202011-10-12 21:02:22 -0700654 if (!priv->dparam.pio_dma_border)
655 priv->dparam.pio_dma_border = 64; /* 64byte */
Yoshihiro Shimodab3103d02019-06-25 14:38:54 +0900656 if (!of_property_read_u32(dev_of_node(dev), "renesas,buswait", &tmp))
657 priv->dparam.buswait_bwait = tmp;
Linus Walleij3b31ec12019-12-17 15:12:41 +0100658 gpiod = devm_gpiod_get_optional(dev, "renesas,enable", GPIOD_IN);
659 if (IS_ERR(gpiod))
660 return PTR_ERR(gpiod);
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900661
Kuninori Morimotob002ff62011-04-28 16:41:20 +0900662 /* FIXME */
663 /* runtime power control ? */
Yoshihiro Shimoda426d3ff2019-06-25 14:38:57 +0900664 if (priv->pfunc->get_vbus)
Chris Brandt97a79682019-05-15 10:20:41 -0500665 usbhs_get_dparam(priv, runtime_pwctrl) = 1;
Kuninori Morimotob002ff62011-04-28 16:41:20 +0900666
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900667 /*
668 * priv settings
669 */
Lad Prabhakar22ae6412021-12-20 01:04:07 +0000670 priv->irq = irq;
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900671 priv->pdev = pdev;
Kuninori Morimotobc573812011-04-28 16:41:14 +0900672 INIT_DELAYED_WORK(&priv->notify_hotplug_work, usbhsc_notify_hotplug);
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900673 spin_lock_init(usbhs_priv_to_lock(priv));
674
675 /* call pipe and module init */
676 ret = usbhs_pipe_probe(priv);
677 if (ret < 0)
Kuninori Morimoto58efc772012-09-10 19:01:07 -0700678 return ret;
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900679
Kuninori Morimotod3af90a2011-06-06 14:18:44 +0900680 ret = usbhs_fifo_probe(priv);
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900681 if (ret < 0)
Kuninori Morimoto97f93222011-05-11 16:00:15 +0900682 goto probe_end_pipe_exit;
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900683
Kuninori Morimotod3af90a2011-06-06 14:18:44 +0900684 ret = usbhs_mod_probe(priv);
685 if (ret < 0)
686 goto probe_end_fifo_exit;
687
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900688 /* dev_set_drvdata should be called after usbhs_mod_init */
Libo Chenc9a05522013-08-27 16:10:31 +0800689 platform_set_drvdata(pdev, priv);
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900690
Yoshihiro Shimodaf181dbb2018-09-11 17:47:03 +0900691 ret = reset_control_deassert(priv->rsts);
692 if (ret)
693 goto probe_fail_rst;
694
Yoshihiro Shimodaf08acaf2019-06-25 14:38:53 +0900695 ret = usbhsc_clk_get(dev, priv);
Yoshihiro Shimoda3df0e242018-09-11 17:47:05 +0900696 if (ret)
697 goto probe_fail_clks;
698
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900699 /*
700 * deviece reset here because
701 * USB device might be used in boot loader.
702 */
703 usbhs_sys_clock_ctrl(priv, 0);
704
Ulrich Hecht8ecef002014-07-10 09:53:59 +0200705 /* check GPIO determining if USB function should be enabled */
Linus Walleij3b31ec12019-12-17 15:12:41 +0100706 if (gpiod) {
707 ret = !gpiod_get_value(gpiod);
Ulrich Hecht8ecef002014-07-10 09:53:59 +0200708 if (ret) {
Linus Walleij3b31ec12019-12-17 15:12:41 +0100709 dev_warn(dev, "USB function not selected (GPIO)\n");
Ulrich Hecht8ecef002014-07-10 09:53:59 +0200710 ret = -ENOTSUPP;
711 goto probe_end_mod_exit;
712 }
713 }
714
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900715 /*
716 * platform call
717 *
718 * USB phy setup might depend on CPU/Board.
719 * If platform has its callback functions,
720 * call it here.
721 */
722 ret = usbhs_platform_call(priv, hardware_init, pdev);
723 if (ret < 0) {
Yoshihiro Shimodaf08acaf2019-06-25 14:38:53 +0900724 dev_err(dev, "platform init failed.\n");
Kuninori Morimoto97f93222011-05-11 16:00:15 +0900725 goto probe_end_mod_exit;
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900726 }
727
728 /* reset phy for connection */
729 usbhs_platform_call(priv, phy_reset, pdev);
730
Kuninori Morimotob002ff62011-04-28 16:41:20 +0900731 /* power control */
Yoshihiro Shimodaf08acaf2019-06-25 14:38:53 +0900732 pm_runtime_enable(dev);
Chris Brandt97a79682019-05-15 10:20:41 -0500733 if (!usbhs_get_dparam(priv, runtime_pwctrl)) {
Kuninori Morimotob002ff62011-04-28 16:41:20 +0900734 usbhsc_power_ctrl(priv, 1);
735 usbhs_mod_autonomy_mode(priv);
Yoshihiro Shimodaccc32642019-06-25 14:38:48 +0900736 } else {
737 usbhs_mod_non_autonomy_mode(priv);
Kuninori Morimotob002ff62011-04-28 16:41:20 +0900738 }
739
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900740 /*
741 * manual call notify_hotplug for cold plug
742 */
Yoshihiro Shimoda09666482019-06-25 14:38:46 +0900743 usbhsc_schedule_notify_hotplug(pdev);
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900744
Yoshihiro Shimodaf08acaf2019-06-25 14:38:53 +0900745 dev_info(dev, "probed\n");
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900746
747 return ret;
748
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900749probe_end_mod_exit:
Yoshihiro Shimoda3df0e242018-09-11 17:47:05 +0900750 usbhsc_clk_put(priv);
751probe_fail_clks:
Yoshihiro Shimodaf181dbb2018-09-11 17:47:03 +0900752 reset_control_assert(priv->rsts);
753probe_fail_rst:
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900754 usbhs_mod_remove(priv);
Kuninori Morimotod3af90a2011-06-06 14:18:44 +0900755probe_end_fifo_exit:
756 usbhs_fifo_remove(priv);
Kuninori Morimoto97f93222011-05-11 16:00:15 +0900757probe_end_pipe_exit:
758 usbhs_pipe_remove(priv);
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900759
Yoshihiro Shimodaf08acaf2019-06-25 14:38:53 +0900760 dev_info(dev, "probe failed (%d)\n", ret);
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900761
762 return ret;
763}
764
Bill Pembertonfb4e98a2012-11-19 13:26:20 -0500765static int usbhs_remove(struct platform_device *pdev)
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900766{
Kuninori Morimoto206dcc22011-04-28 16:40:54 +0900767 struct usbhs_priv *priv = usbhs_pdev_to_priv(pdev);
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900768
769 dev_dbg(&pdev->dev, "usb remove\n");
770
Kuninori Morimotob002ff62011-04-28 16:41:20 +0900771 /* power off */
Chris Brandt97a79682019-05-15 10:20:41 -0500772 if (!usbhs_get_dparam(priv, runtime_pwctrl))
Kuninori Morimotob002ff62011-04-28 16:41:20 +0900773 usbhsc_power_ctrl(priv, 0);
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900774
Kuninori Morimotob002ff62011-04-28 16:41:20 +0900775 pm_runtime_disable(&pdev->dev);
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900776
777 usbhs_platform_call(priv, hardware_exit, pdev);
Yoshihiro Shimoda3df0e242018-09-11 17:47:05 +0900778 usbhsc_clk_put(priv);
Yoshihiro Shimodaf181dbb2018-09-11 17:47:03 +0900779 reset_control_assert(priv->rsts);
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900780 usbhs_mod_remove(priv);
Kuninori Morimotod3af90a2011-06-06 14:18:44 +0900781 usbhs_fifo_remove(priv);
Kuninori Morimoto97f93222011-05-11 16:00:15 +0900782 usbhs_pipe_remove(priv);
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900783
784 return 0;
785}
786
Arnd Bergmanneaf30742018-12-11 11:06:25 +0100787static __maybe_unused int usbhsc_suspend(struct device *dev)
Kuninori Morimotoca8a2822011-10-10 21:58:19 -0700788{
789 struct usbhs_priv *priv = dev_get_drvdata(dev);
790 struct usbhs_mod *mod = usbhs_mod_get_current(priv);
791
792 if (mod) {
793 usbhs_mod_call(priv, stop, priv);
794 usbhs_mod_change(priv, -1);
795 }
796
Chris Brandt97a79682019-05-15 10:20:41 -0500797 if (mod || !usbhs_get_dparam(priv, runtime_pwctrl))
Kuninori Morimotoca8a2822011-10-10 21:58:19 -0700798 usbhsc_power_ctrl(priv, 0);
799
800 return 0;
801}
802
Arnd Bergmanneaf30742018-12-11 11:06:25 +0100803static __maybe_unused int usbhsc_resume(struct device *dev)
Kuninori Morimotoca8a2822011-10-10 21:58:19 -0700804{
805 struct usbhs_priv *priv = dev_get_drvdata(dev);
806 struct platform_device *pdev = usbhs_priv_to_pdev(priv);
807
Chris Brandt97a79682019-05-15 10:20:41 -0500808 if (!usbhs_get_dparam(priv, runtime_pwctrl)) {
Kuninori Morimotoca8a2822011-10-10 21:58:19 -0700809 usbhsc_power_ctrl(priv, 1);
Yoshihiro Shimoda59a08792017-07-19 16:16:54 +0900810 usbhs_mod_autonomy_mode(priv);
811 }
Kuninori Morimotoca8a2822011-10-10 21:58:19 -0700812
Kuninori Morimoto5b50d3b2012-08-05 22:44:43 -0700813 usbhs_platform_call(priv, phy_reset, pdev);
814
Yoshihiro Shimoda09666482019-06-25 14:38:46 +0900815 usbhsc_schedule_notify_hotplug(pdev);
Kuninori Morimotoca8a2822011-10-10 21:58:19 -0700816
817 return 0;
818}
819
Yoshihiro Shimodad54d3342018-11-21 06:31:23 +0000820static SIMPLE_DEV_PM_OPS(usbhsc_pm_ops, usbhsc_suspend, usbhsc_resume);
Kuninori Morimotoca8a2822011-10-10 21:58:19 -0700821
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900822static struct platform_driver renesas_usbhs_driver = {
823 .driver = {
824 .name = "renesas_usbhs",
Kuninori Morimotoca8a2822011-10-10 21:58:19 -0700825 .pm = &usbhsc_pm_ops,
Yoshihiro Shimodab8541002014-09-03 14:25:56 +0900826 .of_match_table = of_match_ptr(usbhs_of_match),
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900827 },
828 .probe = usbhs_probe,
Bill Pemberton76904172012-11-19 13:21:08 -0500829 .remove = usbhs_remove,
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900830};
831
Axel Lincc27c962011-11-27 20:16:27 +0800832module_platform_driver(renesas_usbhs_driver);
Kuninori Morimotof1407d52011-04-04 13:44:59 +0900833
834MODULE_LICENSE("GPL");
835MODULE_DESCRIPTION("Renesas USB driver");
836MODULE_AUTHOR("Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>");