blob: c5c9b4cbcb9a3c783edeaf4714d54b7a5dc86f09 [file] [log] [blame]
Greg Kroah-Hartman5fd54ac2017-11-03 11:28:30 +01001// SPDX-License-Identifier: GPL-1.0+
Ben Dooks3eb0c5f2005-07-29 12:18:03 -07002/*
3 * OHCI HCD (Host Controller Driver) for USB.
4 *
5 * (C) Copyright 1999 Roman Weissgaerber <weissg@vienna.at>
6 * (C) Copyright 2000-2002 David Brownell <dbrownell@users.sourceforge.net>
7 * (C) Copyright 2002 Hewlett-Packard Company
8 *
9 * USB Bus Glue for Samsung S3C2410
10 *
11 * Written by Christopher Hoover <ch@hpl.hp.com>
Uwe Kleine-Königac310bb2008-07-10 17:30:46 -070012 * Based on fragments of previous driver by Russell King et al.
Ben Dooks3eb0c5f2005-07-29 12:18:03 -070013 *
14 * Modified for S3C2410 from ohci-sa1111.c, ohci-omap.c and ohci-lh7a40.c
15 * by Ben Dooks, <ben@simtec.co.uk>
16 * Copyright (C) 2004 Simtec Electronics
17 *
18 * Thanks to basprog@mail.ru for updates to newer kernels
19 *
20 * This file is licenced under the GPL.
21*/
22
Russell Kingf8ce2542006-01-07 16:15:52 +000023#include <linux/clk.h>
Manjunath Goudarf23b71f2013-09-21 16:38:43 +053024#include <linux/io.h>
25#include <linux/kernel.h>
26#include <linux/module.h>
27#include <linux/platform_device.h>
Arnd Bergmann436d42c2012-08-24 15:22:12 +020028#include <linux/platform_data/usb-ohci-s3c2410.h>
Manjunath Goudarf23b71f2013-09-21 16:38:43 +053029#include <linux/usb.h>
30#include <linux/usb/hcd.h>
31
32#include "ohci.h"
33
Ben Dooks3eb0c5f2005-07-29 12:18:03 -070034
35#define valid_port(idx) ((idx) == 1 || (idx) == 2)
36
37/* clock device associated with the hcd */
38
Manjunath Goudarf23b71f2013-09-21 16:38:43 +053039
40#define DRIVER_DESC "OHCI S3C2410 driver"
41
Ben Dooks3eb0c5f2005-07-29 12:18:03 -070042static struct clk *clk;
Ben Dooks3799c402006-04-02 01:45:00 +010043static struct clk *usb_clk;
Ben Dooks3eb0c5f2005-07-29 12:18:03 -070044
Manjunath Goudarf83fb632016-12-03 03:46:55 +000045static struct hc_driver __read_mostly ohci_s3c2410_hc_driver;
46
Ben Dooks3eb0c5f2005-07-29 12:18:03 -070047/* forward definitions */
48
49static void s3c2410_hcd_oc(struct s3c2410_hcd_info *info, int port_oc);
50
51/* conversion functions */
52
Ben Dooksf096e042006-03-21 22:54:47 +000053static struct s3c2410_hcd_info *to_s3c2410_info(struct usb_hcd *hcd)
Ben Dooks3eb0c5f2005-07-29 12:18:03 -070054{
Jingoo Hand4f09e22013-07-30 19:59:40 +090055 return dev_get_platdata(hcd->self.controller);
Ben Dooks3eb0c5f2005-07-29 12:18:03 -070056}
57
58static void s3c2410_start_hc(struct platform_device *dev, struct usb_hcd *hcd)
59{
Jingoo Hand4f09e22013-07-30 19:59:40 +090060 struct s3c2410_hcd_info *info = dev_get_platdata(&dev->dev);
Ben Dooks3eb0c5f2005-07-29 12:18:03 -070061
62 dev_dbg(&dev->dev, "s3c2410_start_hc:\n");
Ben Dooks3799c402006-04-02 01:45:00 +010063
Tomasz Figad0127f62013-08-26 02:00:37 +090064 clk_prepare_enable(usb_clk);
Ben Dooks3799c402006-04-02 01:45:00 +010065 mdelay(2); /* let the bus clock stabilise */
66
Tomasz Figad0127f62013-08-26 02:00:37 +090067 clk_prepare_enable(clk);
Ben Dooks3eb0c5f2005-07-29 12:18:03 -070068
69 if (info != NULL) {
70 info->hcd = hcd;
71 info->report_oc = s3c2410_hcd_oc;
72
Jingoo Han7af85a82011-05-04 16:45:47 +090073 if (info->enable_oc != NULL)
Ben Dooks3eb0c5f2005-07-29 12:18:03 -070074 (info->enable_oc)(info, 1);
Ben Dooks3eb0c5f2005-07-29 12:18:03 -070075 }
76}
77
78static void s3c2410_stop_hc(struct platform_device *dev)
79{
Jingoo Hand4f09e22013-07-30 19:59:40 +090080 struct s3c2410_hcd_info *info = dev_get_platdata(&dev->dev);
Ben Dooks3eb0c5f2005-07-29 12:18:03 -070081
82 dev_dbg(&dev->dev, "s3c2410_stop_hc:\n");
83
84 if (info != NULL) {
85 info->report_oc = NULL;
86 info->hcd = NULL;
87
Jingoo Han7af85a82011-05-04 16:45:47 +090088 if (info->enable_oc != NULL)
Ben Dooks3eb0c5f2005-07-29 12:18:03 -070089 (info->enable_oc)(info, 0);
Ben Dooks3eb0c5f2005-07-29 12:18:03 -070090 }
91
Tomasz Figad0127f62013-08-26 02:00:37 +090092 clk_disable_unprepare(clk);
93 clk_disable_unprepare(usb_clk);
Ben Dooks3eb0c5f2005-07-29 12:18:03 -070094}
95
96/* ohci_s3c2410_hub_status_data
97 *
98 * update the status data from the hub with anything that
99 * has been detected by our system
100*/
101
102static int
Jingoo Han7af85a82011-05-04 16:45:47 +0900103ohci_s3c2410_hub_status_data(struct usb_hcd *hcd, char *buf)
Ben Dooks3eb0c5f2005-07-29 12:18:03 -0700104{
105 struct s3c2410_hcd_info *info = to_s3c2410_info(hcd);
106 struct s3c2410_hcd_port *port;
107 int orig;
108 int portno;
109
Laurent Pinchart42b59eb2014-04-16 18:00:09 +0200110 orig = ohci_hub_status_data(hcd, buf);
Ben Dooks3eb0c5f2005-07-29 12:18:03 -0700111
112 if (info == NULL)
113 return orig;
114
115 port = &info->port[0];
116
117 /* mark any changed port as changed */
118
119 for (portno = 0; portno < 2; port++, portno++) {
120 if (port->oc_changed == 1 &&
121 port->flags & S3C_HCDFLG_USED) {
122 dev_dbg(hcd->self.controller,
123 "oc change on port %d\n", portno);
124
125 if (orig < 1)
126 orig = 1;
127
128 buf[0] |= 1<<(portno+1);
129 }
130 }
131
132 return orig;
133}
134
135/* s3c2410_usb_set_power
136 *
137 * configure the power on a port, by calling the platform device
138 * routine registered with the platform device
139*/
140
141static void s3c2410_usb_set_power(struct s3c2410_hcd_info *info,
142 int port, int to)
143{
144 if (info == NULL)
145 return;
146
147 if (info->power_control != NULL) {
148 info->port[port-1].power = to;
Ben Dooksba44e7c2005-08-09 15:04:00 +0100149 (info->power_control)(port-1, to);
Ben Dooks3eb0c5f2005-07-29 12:18:03 -0700150 }
151}
152
153/* ohci_s3c2410_hub_control
154 *
155 * look at control requests to the hub, and see if we need
156 * to take any action or over-ride the results from the
157 * request.
158*/
159
Jingoo Han7af85a82011-05-04 16:45:47 +0900160static int ohci_s3c2410_hub_control(
Ben Dooks3eb0c5f2005-07-29 12:18:03 -0700161 struct usb_hcd *hcd,
162 u16 typeReq,
163 u16 wValue,
164 u16 wIndex,
165 char *buf,
166 u16 wLength)
167{
168 struct s3c2410_hcd_info *info = to_s3c2410_info(hcd);
169 struct usb_hub_descriptor *desc;
170 int ret = -EINVAL;
171 u32 *data = (u32 *)buf;
172
173 dev_dbg(hcd->self.controller,
174 "s3c2410_hub_control(%p,0x%04x,0x%04x,0x%04x,%p,%04x)\n",
175 hcd, typeReq, wValue, wIndex, buf, wLength);
176
Alexey Dobriyan7f927fc2006-03-28 01:56:53 -0800177 /* if we are only an humble host without any special capabilities
Ben Dooks3eb0c5f2005-07-29 12:18:03 -0700178 * process the request straight away and exit */
179
180 if (info == NULL) {
Laurent Pinchart42b59eb2014-04-16 18:00:09 +0200181 ret = ohci_hub_control(hcd, typeReq, wValue,
Ben Dooks3eb0c5f2005-07-29 12:18:03 -0700182 wIndex, buf, wLength);
183 goto out;
184 }
185
186 /* check the request to see if it needs handling */
187
188 switch (typeReq) {
189 case SetPortFeature:
190 if (wValue == USB_PORT_FEAT_POWER) {
191 dev_dbg(hcd->self.controller, "SetPortFeat: POWER\n");
192 s3c2410_usb_set_power(info, wIndex, 1);
193 goto out;
194 }
195 break;
196
197 case ClearPortFeature:
198 switch (wValue) {
199 case USB_PORT_FEAT_C_OVER_CURRENT:
200 dev_dbg(hcd->self.controller,
201 "ClearPortFeature: C_OVER_CURRENT\n");
202
203 if (valid_port(wIndex)) {
204 info->port[wIndex-1].oc_changed = 0;
205 info->port[wIndex-1].oc_status = 0;
206 }
207
208 goto out;
209
210 case USB_PORT_FEAT_OVER_CURRENT:
211 dev_dbg(hcd->self.controller,
212 "ClearPortFeature: OVER_CURRENT\n");
213
Jingoo Han7af85a82011-05-04 16:45:47 +0900214 if (valid_port(wIndex))
Ben Dooks3eb0c5f2005-07-29 12:18:03 -0700215 info->port[wIndex-1].oc_status = 0;
Ben Dooks3eb0c5f2005-07-29 12:18:03 -0700216
217 goto out;
218
219 case USB_PORT_FEAT_POWER:
220 dev_dbg(hcd->self.controller,
221 "ClearPortFeature: POWER\n");
222
223 if (valid_port(wIndex)) {
224 s3c2410_usb_set_power(info, wIndex, 0);
225 return 0;
226 }
227 }
228 break;
229 }
230
Laurent Pinchart42b59eb2014-04-16 18:00:09 +0200231 ret = ohci_hub_control(hcd, typeReq, wValue, wIndex, buf, wLength);
Ben Dooks3eb0c5f2005-07-29 12:18:03 -0700232 if (ret)
233 goto out;
234
235 switch (typeReq) {
236 case GetHubDescriptor:
237
238 /* update the hub's descriptor */
239
240 desc = (struct usb_hub_descriptor *)buf;
241
242 if (info->power_control == NULL)
243 return ret;
244
245 dev_dbg(hcd->self.controller, "wHubCharacteristics 0x%04x\n",
246 desc->wHubCharacteristics);
247
248 /* remove the old configurations for power-switching, and
249 * over-current protection, and insert our new configuration
250 */
251
252 desc->wHubCharacteristics &= ~cpu_to_le16(HUB_CHAR_LPSM);
Sergei Shtylyovdd709762015-01-19 01:44:12 +0300253 desc->wHubCharacteristics |= cpu_to_le16(
254 HUB_CHAR_INDV_PORT_LPSM);
Ben Dooks3eb0c5f2005-07-29 12:18:03 -0700255
256 if (info->enable_oc) {
Jingoo Han7af85a82011-05-04 16:45:47 +0900257 desc->wHubCharacteristics &= ~cpu_to_le16(
258 HUB_CHAR_OCPM);
259 desc->wHubCharacteristics |= cpu_to_le16(
Sergei Shtylyovdd709762015-01-19 01:44:12 +0300260 HUB_CHAR_INDV_PORT_OCPM);
Ben Dooks3eb0c5f2005-07-29 12:18:03 -0700261 }
262
263 dev_dbg(hcd->self.controller, "wHubCharacteristics after 0x%04x\n",
264 desc->wHubCharacteristics);
265
266 return ret;
267
268 case GetPortStatus:
269 /* check port status */
270
271 dev_dbg(hcd->self.controller, "GetPortStatus(%d)\n", wIndex);
272
273 if (valid_port(wIndex)) {
Jingoo Han7af85a82011-05-04 16:45:47 +0900274 if (info->port[wIndex-1].oc_changed)
Ben Dooks3eb0c5f2005-07-29 12:18:03 -0700275 *data |= cpu_to_le32(RH_PS_OCIC);
Ben Dooks3eb0c5f2005-07-29 12:18:03 -0700276
Jingoo Han7af85a82011-05-04 16:45:47 +0900277 if (info->port[wIndex-1].oc_status)
Ben Dooks3eb0c5f2005-07-29 12:18:03 -0700278 *data |= cpu_to_le32(RH_PS_POCI);
Ben Dooks3eb0c5f2005-07-29 12:18:03 -0700279 }
280 }
281
282 out:
283 return ret;
284}
285
286/* s3c2410_hcd_oc
287 *
288 * handle an over-current report
289*/
290
291static void s3c2410_hcd_oc(struct s3c2410_hcd_info *info, int port_oc)
292{
293 struct s3c2410_hcd_port *port;
Ben Dooks3eb0c5f2005-07-29 12:18:03 -0700294 unsigned long flags;
295 int portno;
296
297 if (info == NULL)
298 return;
299
300 port = &info->port[0];
Ben Dooks3eb0c5f2005-07-29 12:18:03 -0700301
302 local_irq_save(flags);
303
304 for (portno = 0; portno < 2; port++, portno++) {
305 if (port_oc & (1<<portno) &&
306 port->flags & S3C_HCDFLG_USED) {
307 port->oc_status = 1;
308 port->oc_changed = 1;
309
310 /* ok, once over-current is detected,
311 the port needs to be powered down */
312 s3c2410_usb_set_power(info, portno+1, 0);
313 }
314 }
315
316 local_irq_restore(flags);
317}
318
319/* may be called without controller electrically present */
320/* may be called with controller, bus, and devices active */
321
322/*
Manjunath Goudarf83fb632016-12-03 03:46:55 +0000323 * ohci_hcd_s3c2410_remove - shutdown processing for HCD
Ben Dooks3eb0c5f2005-07-29 12:18:03 -0700324 * @dev: USB Host Controller being removed
Ahmed S. Darwish19220ba2020-10-19 12:06:37 +0200325 *
326 * Context: task context, might sleep
Ben Dooks3eb0c5f2005-07-29 12:18:03 -0700327 *
Manjunath Goudarf83fb632016-12-03 03:46:55 +0000328 * Reverses the effect of ohci_hcd_3c2410_probe(), first invoking
Ben Dooks3eb0c5f2005-07-29 12:18:03 -0700329 * the HCD's stop() method. It is always called from a thread
330 * context, normally "rmmod", "apmd", or something similar.
Ahmed S. Darwish19220ba2020-10-19 12:06:37 +0200331 */
Uwe Kleine-Königa0f28632023-05-18 01:02:14 +0200332static void
Manjunath Goudarf83fb632016-12-03 03:46:55 +0000333ohci_hcd_s3c2410_remove(struct platform_device *dev)
Ben Dooks3eb0c5f2005-07-29 12:18:03 -0700334{
Manjunath Goudarf83fb632016-12-03 03:46:55 +0000335 struct usb_hcd *hcd = platform_get_drvdata(dev);
336
Ben Dooks3eb0c5f2005-07-29 12:18:03 -0700337 usb_remove_hcd(hcd);
338 s3c2410_stop_hc(dev);
Ben Dooks3eb0c5f2005-07-29 12:18:03 -0700339 usb_put_hcd(hcd);
340}
341
Lee Jones04592682020-07-03 18:41:20 +0100342/*
Manjunath Goudarf83fb632016-12-03 03:46:55 +0000343 * ohci_hcd_s3c2410_probe - initialize S3C2410-based HCDs
Ahmed S. Darwish19220ba2020-10-19 12:06:37 +0200344 * @dev: USB Host Controller to be probed
345 *
346 * Context: task context, might sleep
Ben Dooks3eb0c5f2005-07-29 12:18:03 -0700347 *
348 * Allocates basic resources for this USB host controller, and
349 * then invokes the start() method for the HCD associated with it
350 * through the hotplug entry's driver_data.
Ben Dooks3eb0c5f2005-07-29 12:18:03 -0700351 */
Manjunath Goudarf83fb632016-12-03 03:46:55 +0000352static int ohci_hcd_s3c2410_probe(struct platform_device *dev)
Ben Dooks3eb0c5f2005-07-29 12:18:03 -0700353{
354 struct usb_hcd *hcd = NULL;
Jingoo Hand4f09e22013-07-30 19:59:40 +0900355 struct s3c2410_hcd_info *info = dev_get_platdata(&dev->dev);
Rob Herringb6886c72021-12-15 16:53:57 -0600356 int retval, irq;
Ben Dooks3eb0c5f2005-07-29 12:18:03 -0700357
Jingoo Hand4f09e22013-07-30 19:59:40 +0900358 s3c2410_usb_set_power(info, 1, 1);
359 s3c2410_usb_set_power(info, 2, 1);
Ben Dooks3eb0c5f2005-07-29 12:18:03 -0700360
Manjunath Goudarf83fb632016-12-03 03:46:55 +0000361 hcd = usb_create_hcd(&ohci_s3c2410_hc_driver, &dev->dev, "s3c24xx");
Ben Dooks3eb0c5f2005-07-29 12:18:03 -0700362 if (hcd == NULL)
363 return -ENOMEM;
364
365 hcd->rsrc_start = dev->resource[0].start;
Jingoo Han3c86c072011-04-14 21:09:16 +0900366 hcd->rsrc_len = resource_size(&dev->resource[0]);
Ben Dooks3eb0c5f2005-07-29 12:18:03 -0700367
Thierry Reding148e1132013-01-21 11:09:22 +0100368 hcd->regs = devm_ioremap_resource(&dev->dev, &dev->resource[0]);
369 if (IS_ERR(hcd->regs)) {
370 retval = PTR_ERR(hcd->regs);
Ben Dooks3799c402006-04-02 01:45:00 +0100371 goto err_put;
Ben Dooks3eb0c5f2005-07-29 12:18:03 -0700372 }
373
Jingoo Han801f0062012-10-08 11:28:25 +0900374 clk = devm_clk_get(&dev->dev, "usb-host");
Ben Dooks3eb0c5f2005-07-29 12:18:03 -0700375 if (IS_ERR(clk)) {
376 dev_err(&dev->dev, "cannot get usb-host clock\n");
Jingoo Han69248d42011-05-05 08:46:07 +0900377 retval = PTR_ERR(clk);
Jingoo Han801f0062012-10-08 11:28:25 +0900378 goto err_put;
Ben Dooks3799c402006-04-02 01:45:00 +0100379 }
380
Jingoo Han801f0062012-10-08 11:28:25 +0900381 usb_clk = devm_clk_get(&dev->dev, "usb-bus-host");
Ben Dooks3799c402006-04-02 01:45:00 +0100382 if (IS_ERR(usb_clk)) {
Ben Dooks2dfa3192009-02-26 23:03:15 +0000383 dev_err(&dev->dev, "cannot get usb-bus-host clock\n");
Jingoo Han69248d42011-05-05 08:46:07 +0900384 retval = PTR_ERR(usb_clk);
Jingoo Han801f0062012-10-08 11:28:25 +0900385 goto err_put;
Ben Dooks3eb0c5f2005-07-29 12:18:03 -0700386 }
387
Rob Herringb6886c72021-12-15 16:53:57 -0600388 irq = platform_get_irq(dev, 0);
389 if (irq < 0) {
390 retval = irq;
391 goto err_put;
392 }
393
Ben Dooks3eb0c5f2005-07-29 12:18:03 -0700394 s3c2410_start_hc(dev, hcd);
395
Rob Herringb6886c72021-12-15 16:53:57 -0600396 retval = usb_add_hcd(hcd, irq, 0);
Ben Dooks3eb0c5f2005-07-29 12:18:03 -0700397 if (retval != 0)
Ben Dooks3799c402006-04-02 01:45:00 +0100398 goto err_ioremap;
Ben Dooks3eb0c5f2005-07-29 12:18:03 -0700399
Peter Chen3c9740a2013-11-05 10:46:02 +0800400 device_wakeup_enable(hcd->self.controller);
Ben Dooks3eb0c5f2005-07-29 12:18:03 -0700401 return 0;
402
Ben Dooks3799c402006-04-02 01:45:00 +0100403 err_ioremap:
Ben Dooks3eb0c5f2005-07-29 12:18:03 -0700404 s3c2410_stop_hc(dev);
Ben Dooks3eb0c5f2005-07-29 12:18:03 -0700405
Ben Dooks3799c402006-04-02 01:45:00 +0100406 err_put:
Ben Dooks3eb0c5f2005-07-29 12:18:03 -0700407 usb_put_hcd(hcd);
408 return retval;
409}
410
411/*-------------------------------------------------------------------------*/
412
Jingoo Hanb870def2011-11-28 15:56:06 +0900413#ifdef CONFIG_PM
414static int ohci_hcd_s3c2410_drv_suspend(struct device *dev)
415{
416 struct usb_hcd *hcd = dev_get_drvdata(dev);
Jingoo Hanb870def2011-11-28 15:56:06 +0900417 struct platform_device *pdev = to_platform_device(dev);
Majunath Goudar0ded36d2013-11-13 17:40:18 +0530418 bool do_wakeup = device_may_wakeup(dev);
Jingoo Hanb870def2011-11-28 15:56:06 +0900419 int rc = 0;
420
Majunath Goudar0ded36d2013-11-13 17:40:18 +0530421 rc = ohci_suspend(hcd, do_wakeup);
422 if (rc)
423 return rc;
Jingoo Hanb870def2011-11-28 15:56:06 +0900424
425 s3c2410_stop_hc(pdev);
Jingoo Hanb870def2011-11-28 15:56:06 +0900426
427 return rc;
428}
429
430static int ohci_hcd_s3c2410_drv_resume(struct device *dev)
431{
432 struct usb_hcd *hcd = dev_get_drvdata(dev);
433 struct platform_device *pdev = to_platform_device(dev);
434
435 s3c2410_start_hc(pdev, hcd);
436
Florian Fainellicfa49b42012-10-08 15:11:29 +0200437 ohci_resume(hcd, false);
Jingoo Hanb870def2011-11-28 15:56:06 +0900438
439 return 0;
440}
441#else
442#define ohci_hcd_s3c2410_drv_suspend NULL
443#define ohci_hcd_s3c2410_drv_resume NULL
444#endif
445
446static const struct dev_pm_ops ohci_hcd_s3c2410_pm_ops = {
447 .suspend = ohci_hcd_s3c2410_drv_suspend,
448 .resume = ohci_hcd_s3c2410_drv_resume,
449};
450
Sergio Prado96cad6f2016-11-25 12:47:29 -0200451static const struct of_device_id ohci_hcd_s3c2410_dt_ids[] = {
452 { .compatible = "samsung,s3c2410-ohci" },
453 { /* sentinel */ }
454};
455
456MODULE_DEVICE_TABLE(of, ohci_hcd_s3c2410_dt_ids);
457
Russell King3ae5eae2005-11-09 22:32:44 +0000458static struct platform_driver ohci_hcd_s3c2410_driver = {
Manjunath Goudarf83fb632016-12-03 03:46:55 +0000459 .probe = ohci_hcd_s3c2410_probe,
Uwe Kleine-Königa0f28632023-05-18 01:02:14 +0200460 .remove_new = ohci_hcd_s3c2410_remove,
David Brownelldd9048a2006-12-05 03:18:31 -0800461 .shutdown = usb_hcd_platform_shutdown,
Russell King3ae5eae2005-11-09 22:32:44 +0000462 .driver = {
Russell King3ae5eae2005-11-09 22:32:44 +0000463 .name = "s3c2410-ohci",
Jingoo Hanb870def2011-11-28 15:56:06 +0900464 .pm = &ohci_hcd_s3c2410_pm_ops,
Sergio Prado96cad6f2016-11-25 12:47:29 -0200465 .of_match_table = ohci_hcd_s3c2410_dt_ids,
Russell King3ae5eae2005-11-09 22:32:44 +0000466 },
Ben Dooks3eb0c5f2005-07-29 12:18:03 -0700467};
468
Manjunath Goudarf23b71f2013-09-21 16:38:43 +0530469static int __init ohci_s3c2410_init(void)
470{
471 if (usb_disabled())
472 return -ENODEV;
473
Manjunath Goudarf23b71f2013-09-21 16:38:43 +0530474 ohci_init_driver(&ohci_s3c2410_hc_driver, NULL);
475
476 /*
477 * The Samsung HW has some unusual quirks, which require
478 * Sumsung-specific workarounds. We override certain hc_driver
479 * functions here to achieve that. We explicitly do not enhance
480 * ohci_driver_overrides to allow this more easily, since this
481 * is an unusual case, and we don't want to encourage others to
482 * override these functions by making it too easy.
483 */
484
Manjunath Goudarf23b71f2013-09-21 16:38:43 +0530485 ohci_s3c2410_hc_driver.hub_status_data = ohci_s3c2410_hub_status_data;
486 ohci_s3c2410_hc_driver.hub_control = ohci_s3c2410_hub_control;
487
488 return platform_driver_register(&ohci_hcd_s3c2410_driver);
489}
490module_init(ohci_s3c2410_init);
491
492static void __exit ohci_s3c2410_cleanup(void)
493{
494 platform_driver_unregister(&ohci_hcd_s3c2410_driver);
495}
496module_exit(ohci_s3c2410_cleanup);
497
498MODULE_DESCRIPTION(DRIVER_DESC);
499MODULE_LICENSE("GPL");
Kay Sieversf4fce612008-04-10 21:29:22 -0700500MODULE_ALIAS("platform:s3c2410-ohci");