ohci-at91.c 16.9 KB
Newer Older
1 2 3 4 5 6
/*
 * OHCI HCD (Host Controller Driver) for USB.
 *
 *  Copyright (C) 2004 SAN People (Pty) Ltd.
 *  Copyright (C) 2005 Thibaut VARENE <varenet@parisc-linux.org>
 *
7
 * AT91 Bus Glue
8 9 10 11 12 13 14 15
 *
 * Based on fragments of 2.4 driver by Rick Bronson.
 * Based on ohci-omap.c
 *
 * This file is licenced under the GPL.
 */

#include <linux/clk.h>
16
#include <linux/dma-mapping.h>
17 18
#include <linux/of_platform.h>
#include <linux/of_gpio.h>
19
#include <linux/platform_device.h>
20
#include <linux/platform_data/atmel.h>
21 22 23 24 25
#include <linux/io.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/usb.h>
#include <linux/usb/hcd.h>
26

27 28
#include <asm/gpio.h>

29
#include "ohci.h"
30

31 32 33 34
#define valid_port(index)	((index) >= 0 && (index) < AT91_MAX_USBH_PORTS)
#define at91_for_each_port(index)	\
		for ((index) = 0; (index) < AT91_MAX_USBH_PORTS; (index)++)

35
/* interface, function and usb clocks; sometimes also an AHB clock */
36 37 38
#define hcd_to_ohci_at91_priv(h) \
	((struct ohci_at91_priv *)hcd_to_ohci(h)->priv)

39 40 41 42 43 44 45 46 47 48 49
#define AT91_MAX_USBH_PORTS	3
struct at91_usbh_data {
	int vbus_pin[AT91_MAX_USBH_PORTS];	/* port power-control pin */
	int overcurrent_pin[AT91_MAX_USBH_PORTS];
	u8 ports;				/* number of ports on root hub */
	u8 overcurrent_supported;
	u8 vbus_pin_active_low[AT91_MAX_USBH_PORTS];
	u8 overcurrent_status[AT91_MAX_USBH_PORTS];
	u8 overcurrent_changed[AT91_MAX_USBH_PORTS];
};

50 51 52 53 54
struct ohci_at91_priv {
	struct clk *iclk;
	struct clk *fclk;
	struct clk *hclk;
	bool clocked;
55
	bool wakeup;		/* Saved wake-up state for resume */
56
};
57 58 59 60 61 62 63
/* interface and function clocks; sometimes also an AHB clock */

#define DRIVER_DESC "OHCI Atmel driver"

static const char hcd_name[] = "ohci-atmel";

static struct hc_driver __read_mostly ohci_at91_hc_driver;
64 65 66 67

static const struct ohci_driver_overrides ohci_at91_drv_overrides __initconst = {
	.extra_priv_size = sizeof(struct ohci_at91_priv),
};
68 69 70 71 72

extern int usb_disabled(void);

/*-------------------------------------------------------------------------*/

73
static void at91_start_clock(struct ohci_at91_priv *ohci_at91)
74
{
75 76
	if (ohci_at91->clocked)
		return;
77 78

	clk_set_rate(ohci_at91->fclk, 48000000);
79 80 81 82
	clk_prepare_enable(ohci_at91->hclk);
	clk_prepare_enable(ohci_at91->iclk);
	clk_prepare_enable(ohci_at91->fclk);
	ohci_at91->clocked = true;
83 84
}

85
static void at91_stop_clock(struct ohci_at91_priv *ohci_at91)
86
{
87 88
	if (!ohci_at91->clocked)
		return;
89

90 91 92 93
	clk_disable_unprepare(ohci_at91->fclk);
	clk_disable_unprepare(ohci_at91->iclk);
	clk_disable_unprepare(ohci_at91->hclk);
	ohci_at91->clocked = false;
94 95
}

96 97 98 99
static void at91_start_hc(struct platform_device *pdev)
{
	struct usb_hcd *hcd = platform_get_drvdata(pdev);
	struct ohci_regs __iomem *regs = hcd->regs;
100
	struct ohci_at91_priv *ohci_at91 = hcd_to_ohci_at91_priv(hcd);
101

102
	dev_dbg(&pdev->dev, "start\n");
103 104 105 106

	/*
	 * Start the USB clocks.
	 */
107
	at91_start_clock(ohci_at91);
108 109 110 111 112 113 114 115 116 117 118

	/*
	 * The USB host controller must remain in reset.
	 */
	writel(0, &regs->control);
}

static void at91_stop_hc(struct platform_device *pdev)
{
	struct usb_hcd *hcd = platform_get_drvdata(pdev);
	struct ohci_regs __iomem *regs = hcd->regs;
119
	struct ohci_at91_priv *ohci_at91 = hcd_to_ohci_at91_priv(hcd);
120

121
	dev_dbg(&pdev->dev, "stop\n");
122 123 124 125 126 127 128 129 130

	/*
	 * Put the USB host controller into reset.
	 */
	writel(0, &regs->control);

	/*
	 * Stop the USB clocks.
	 */
131
	at91_stop_clock(ohci_at91);
132 133 134 135 136
}


/*-------------------------------------------------------------------------*/

B
Bill Pemberton 已提交
137
static void usb_hcd_at91_remove (struct usb_hcd *, struct platform_device *);
138 139 140 141 142 143

/* configure so an HC device and id are always provided */
/* always called with process context; sleeping is OK */


/**
144
 * usb_hcd_at91_probe - initialize AT91-based HCDs
145 146 147 148 149 150
 * Context: !in_interrupt()
 *
 * Allocates basic resources for this USB host controller, and
 * then invokes the start() method for the HCD associated with it
 * through the hotplug entry's driver_data.
 */
B
Bill Pemberton 已提交
151
static int usb_hcd_at91_probe(const struct hc_driver *driver,
152
			struct platform_device *pdev)
153
{
154 155
	struct at91_usbh_data *board;
	struct ohci_hcd *ohci;
156
	int retval;
157
	struct usb_hcd *hcd;
158
	struct ohci_at91_priv *ohci_at91;
159 160 161 162 163 164 165 166
	struct device *dev = &pdev->dev;
	struct resource *res;
	int irq;

	irq = platform_get_irq(pdev, 0);
	if (irq < 0) {
		dev_dbg(dev, "hcd probe: missing irq resource\n");
		return irq;
167 168
	}

169
	hcd = usb_create_hcd(driver, dev, "at91");
170 171
	if (!hcd)
		return -ENOMEM;
172
	ohci_at91 = hcd_to_ohci_at91_priv(hcd);
173

174
	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
175 176 177 178
	hcd->regs = devm_ioremap_resource(dev, res);
	if (IS_ERR(hcd->regs)) {
		retval = PTR_ERR(hcd->regs);
		goto err;
179
	}
180 181
	hcd->rsrc_start = res->start;
	hcd->rsrc_len = resource_size(res);
182

183 184
	ohci_at91->iclk = devm_clk_get(dev, "ohci_clk");
	if (IS_ERR(ohci_at91->iclk)) {
185
		dev_err(dev, "failed to get ohci_clk\n");
186
		retval = PTR_ERR(ohci_at91->iclk);
187
		goto err;
188
	}
189 190
	ohci_at91->fclk = devm_clk_get(dev, "uhpck");
	if (IS_ERR(ohci_at91->fclk)) {
191
		dev_err(dev, "failed to get uhpck\n");
192
		retval = PTR_ERR(ohci_at91->fclk);
193
		goto err;
194
	}
195 196
	ohci_at91->hclk = devm_clk_get(dev, "hclk");
	if (IS_ERR(ohci_at91->hclk)) {
197
		dev_err(dev, "failed to get hclk\n");
198
		retval = PTR_ERR(ohci_at91->hclk);
199
		goto err;
200
	}
201

202 203 204
	board = hcd->self.controller->platform_data;
	ohci = hcd_to_ohci(hcd);
	ohci->num_ports = board->ports;
205 206
	at91_start_hc(pdev);

207
	retval = usb_add_hcd(hcd, irq, IRQF_SHARED);
208
	if (retval == 0) {
209
		device_wakeup_enable(hcd->self.controller);
210
		return retval;
211
	}
212 213 214 215

	/* Error handling */
	at91_stop_hc(pdev);

216
 err:
217 218 219 220 221 222 223 224
	usb_put_hcd(hcd);
	return retval;
}


/* may be called with controller, bus, and devices active */

/**
225
 * usb_hcd_at91_remove - shutdown processing for AT91-based HCDs
226 227 228 229 230
 * @dev: USB Host Controller being removed
 * Context: !in_interrupt()
 *
 * Reverses the effect of usb_hcd_at91_probe(), first invoking
 * the HCD's stop() method.  It is always called from a thread
231
 * context, "rmmod" or something similar.
232 233
 *
 */
B
Bill Pemberton 已提交
234
static void usb_hcd_at91_remove(struct usb_hcd *hcd,
235
				struct platform_device *pdev)
236 237 238
{
	usb_remove_hcd(hcd);
	at91_stop_hc(pdev);
239
	usb_put_hcd(hcd);
240 241 242
}

/*-------------------------------------------------------------------------*/
243 244
static void ohci_at91_usb_set_power(struct at91_usbh_data *pdata, int port, int enable)
{
245
	if (!valid_port(port))
246 247
		return;

248
	if (!gpio_is_valid(pdata->vbus_pin[port]))
249 250
		return;

251
	gpio_set_value(pdata->vbus_pin[port],
252
		       pdata->vbus_pin_active_low[port] ^ enable);
253 254 255 256
}

static int ohci_at91_usb_get_power(struct at91_usbh_data *pdata, int port)
{
257
	if (!valid_port(port))
258 259
		return -EINVAL;

260
	if (!gpio_is_valid(pdata->vbus_pin[port]))
261 262
		return -EINVAL;

263
	return gpio_get_value(pdata->vbus_pin[port]) ^
264
		pdata->vbus_pin_active_low[port];
265 266 267 268 269 270 271
}

/*
 * Update the status data from the hub with the over-current indicator change.
 */
static int ohci_at91_hub_status_data(struct usb_hcd *hcd, char *buf)
{
272
	struct at91_usbh_data *pdata = hcd->self.controller->platform_data;
273
	int length = ohci_hub_status_data(hcd, buf);
274 275
	int port;

276
	at91_for_each_port(port) {
277
		if (pdata->overcurrent_changed[port]) {
278
			if (!length)
279 280 281 282 283 284 285 286 287 288 289 290 291 292
				length = 1;
			buf[0] |= 1 << (port + 1);
		}
	}

	return length;
}

/*
 * Look at the control requests to the root hub and see if we need to override.
 */
static int ohci_at91_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
				 u16 wIndex, char *buf, u16 wLength)
{
J
Jingoo Han 已提交
293
	struct at91_usbh_data *pdata = dev_get_platdata(hcd->self.controller);
294 295 296 297 298 299 300 301
	struct usb_hub_descriptor *desc;
	int ret = -EINVAL;
	u32 *data = (u32 *)buf;

	dev_dbg(hcd->self.controller,
		"ohci_at91_hub_control(%p,0x%04x,0x%04x,0x%04x,%p,%04x)\n",
		hcd, typeReq, wValue, wIndex, buf, wLength);

302 303
	wIndex--;

304 305 306 307
	switch (typeReq) {
	case SetPortFeature:
		if (wValue == USB_PORT_FEAT_POWER) {
			dev_dbg(hcd->self.controller, "SetPortFeat: POWER\n");
308 309 310 311 312
			if (valid_port(wIndex)) {
				ohci_at91_usb_set_power(pdata, wIndex, 1);
				ret = 0;
			}

313 314 315 316 317 318 319 320 321 322
			goto out;
		}
		break;

	case ClearPortFeature:
		switch (wValue) {
		case USB_PORT_FEAT_C_OVER_CURRENT:
			dev_dbg(hcd->self.controller,
				"ClearPortFeature: C_OVER_CURRENT\n");

323 324 325
			if (valid_port(wIndex)) {
				pdata->overcurrent_changed[wIndex] = 0;
				pdata->overcurrent_status[wIndex] = 0;
326 327 328 329 330 331 332 333
			}

			goto out;

		case USB_PORT_FEAT_OVER_CURRENT:
			dev_dbg(hcd->self.controller,
				"ClearPortFeature: OVER_CURRENT\n");

334 335
			if (valid_port(wIndex))
				pdata->overcurrent_status[wIndex] = 0;
336 337 338 339 340 341 342

			goto out;

		case USB_PORT_FEAT_POWER:
			dev_dbg(hcd->self.controller,
				"ClearPortFeature: POWER\n");

343 344
			if (valid_port(wIndex)) {
				ohci_at91_usb_set_power(pdata, wIndex, 0);
345 346 347 348 349 350
				return 0;
			}
		}
		break;
	}

351
	ret = ohci_hub_control(hcd, typeReq, wValue, wIndex + 1, buf, wLength);
352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369
	if (ret)
		goto out;

	switch (typeReq) {
	case GetHubDescriptor:

		/* update the hub's descriptor */

		desc = (struct usb_hub_descriptor *)buf;

		dev_dbg(hcd->self.controller, "wHubCharacteristics 0x%04x\n",
			desc->wHubCharacteristics);

		/* remove the old configurations for power-switching, and
		 * over-current protection, and insert our new configuration
		 */

		desc->wHubCharacteristics &= ~cpu_to_le16(HUB_CHAR_LPSM);
S
Sergei Shtylyov 已提交
370 371
		desc->wHubCharacteristics |=
			cpu_to_le16(HUB_CHAR_INDV_PORT_LPSM);
372 373 374

		if (pdata->overcurrent_supported) {
			desc->wHubCharacteristics &= ~cpu_to_le16(HUB_CHAR_OCPM);
S
Sergei Shtylyov 已提交
375 376
			desc->wHubCharacteristics |=
				cpu_to_le16(HUB_CHAR_INDV_PORT_OCPM);
377 378 379 380 381 382 383 384 385 386 387 388
		}

		dev_dbg(hcd->self.controller, "wHubCharacteristics after 0x%04x\n",
			desc->wHubCharacteristics);

		return ret;

	case GetPortStatus:
		/* check port status */

		dev_dbg(hcd->self.controller, "GetPortStatus(%d)\n", wIndex);

389 390
		if (valid_port(wIndex)) {
			if (!ohci_at91_usb_get_power(pdata, wIndex))
391 392
				*data &= ~cpu_to_le32(RH_PS_PPS);

393
			if (pdata->overcurrent_changed[wIndex])
394 395
				*data |= cpu_to_le32(RH_PS_OCIC);

396
			if (pdata->overcurrent_status[wIndex])
397 398 399 400 401 402 403 404
				*data |= cpu_to_le32(RH_PS_POCI);
		}
	}

 out:
	return ret;
}

405 406
/*-------------------------------------------------------------------------*/

407 408 409
static irqreturn_t ohci_hcd_at91_overcurrent_irq(int irq, void *data)
{
	struct platform_device *pdev = data;
J
Jingoo Han 已提交
410
	struct at91_usbh_data *pdata = dev_get_platdata(&pdev->dev);
411 412 413 414
	int val, gpio, port;

	/* From the GPIO notifying the over-current situation, find
	 * out the corresponding port */
415
	at91_for_each_port(port) {
416 417
		if (gpio_is_valid(pdata->overcurrent_pin[port]) &&
				gpio_to_irq(pdata->overcurrent_pin[port]) == irq) {
418
			gpio = pdata->overcurrent_pin[port];
419
			break;
420
		}
421 422
	}

423
	if (port == AT91_MAX_USBH_PORTS) {
424 425 426 427 428 429 430 431 432
		dev_err(& pdev->dev, "overcurrent interrupt from unknown GPIO\n");
		return IRQ_HANDLED;
	}

	val = gpio_get_value(gpio);

	/* When notified of an over-current situation, disable power
	   on the corresponding port, and mark this port in
	   over-current. */
433
	if (!val) {
434 435 436 437 438 439 440 441 442 443 444
		ohci_at91_usb_set_power(pdata, port, 0);
		pdata->overcurrent_status[port]  = 1;
		pdata->overcurrent_changed[port] = 1;
	}

	dev_dbg(& pdev->dev, "overcurrent situation %s\n",
		val ? "exited" : "notified");

	return IRQ_HANDLED;
}

445 446 447 448 449 450 451
static const struct of_device_id at91_ohci_dt_ids[] = {
	{ .compatible = "atmel,at91rm9200-ohci" },
	{ /* sentinel */ }
};

MODULE_DEVICE_TABLE(of, at91_ohci_dt_ids);

452 453 454
/*-------------------------------------------------------------------------*/

static int ohci_hcd_at91_drv_probe(struct platform_device *pdev)
455 456 457
{
	struct device_node *np = pdev->dev.of_node;
	struct at91_usbh_data	*pdata;
458 459 460 461 462
	int			i;
	int			gpio;
	int			ret;
	enum of_gpio_flags	flags;
	u32			ports;
463 464 465 466 467

	/* Right now device-tree probed devices don't get dma_mask set.
	 * Since shared usb code relies on it, set it here for now.
	 * Once we have dma capability bindings this can go away.
	 */
468
	ret = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
469 470
	if (ret)
		return ret;
471 472 473 474 475 476 477 478

	pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
	if (!pdata)
		return -ENOMEM;

	if (!of_property_read_u32(np, "num-ports", &ports))
		pdata->ports = ports;

479 480 481 482 483 484 485
	at91_for_each_port(i) {
		/*
		 * do not configure PIO if not in relation with
		 * real USB port on board
		 */
		if (i >= pdata->ports) {
			pdata->vbus_pin[i] = -EINVAL;
486
			continue;
487
		}
488

489 490 491 492
		gpio = of_get_named_gpio_flags(np, "atmel,vbus-gpio", i,
					       &flags);
		pdata->vbus_pin[i] = gpio;
		if (!gpio_is_valid(gpio))
493
			continue;
494
		pdata->vbus_pin_active_low[i] = flags & OF_GPIO_ACTIVE_LOW;
495

496 497 498 499 500 501 502 503 504 505 506 507 508 509 510
		ret = gpio_request(gpio, "ohci_vbus");
		if (ret) {
			dev_err(&pdev->dev,
				"can't request vbus gpio %d\n", gpio);
			continue;
		}
		ret = gpio_direction_output(gpio,
					!pdata->vbus_pin_active_low[i]);
		if (ret) {
			dev_err(&pdev->dev,
				"can't put vbus gpio %d as output %d\n",
				gpio, !pdata->vbus_pin_active_low[i]);
			gpio_free(gpio);
			continue;
		}
511

512 513
		ohci_at91_usb_set_power(pdata, i, 1);
	}
514

515
	at91_for_each_port(i) {
516 517 518 519 520 521 522 523
		if (i >= pdata->ports) {
			pdata->overcurrent_pin[i] = -EINVAL;
			continue;
		}

		pdata->overcurrent_pin[i] =
			of_get_named_gpio_flags(np, "atmel,oc-gpio", i, &flags);

524 525 526
		if (!gpio_is_valid(pdata->overcurrent_pin[i]))
			continue;
		gpio = pdata->overcurrent_pin[i];
527

528 529 530 531 532 533
		ret = gpio_request(gpio, "ohci_overcurrent");
		if (ret) {
			dev_err(&pdev->dev,
				"can't request overcurrent gpio %d\n",
				gpio);
			continue;
534 535
		}

536 537 538 539 540 541 542 543
		ret = gpio_direction_input(gpio);
		if (ret) {
			dev_err(&pdev->dev,
				"can't configure overcurrent gpio %d as input\n",
				gpio);
			gpio_free(gpio);
			continue;
		}
544

545 546 547 548 549 550 551
		ret = request_irq(gpio_to_irq(gpio),
				  ohci_hcd_at91_overcurrent_irq,
				  IRQF_SHARED, "ohci_overcurrent", pdev);
		if (ret) {
			gpio_free(gpio);
			dev_err(&pdev->dev,
				"can't get gpio IRQ for overcurrent\n");
552 553 554
		}
	}

555 556
	pdev->dev.platform_data = pdata;

557 558
	device_init_wakeup(&pdev->dev, 1);
	return usb_hcd_at91_probe(&ohci_at91_hc_driver, pdev);
559 560
}

B
Bill Pemberton 已提交
561
static int ohci_hcd_at91_drv_remove(struct platform_device *pdev)
562
{
J
Jingoo Han 已提交
563
	struct at91_usbh_data	*pdata = dev_get_platdata(&pdev->dev);
564 565 566
	int			i;

	if (pdata) {
567
		at91_for_each_port(i) {
568
			if (!gpio_is_valid(pdata->vbus_pin[i]))
569
				continue;
570
			ohci_at91_usb_set_power(pdata, i, 0);
571 572
			gpio_free(pdata->vbus_pin[i]);
		}
573

574
		at91_for_each_port(i) {
575
			if (!gpio_is_valid(pdata->overcurrent_pin[i]))
576 577 578 579
				continue;
			free_irq(gpio_to_irq(pdata->overcurrent_pin[i]), pdev);
			gpio_free(pdata->overcurrent_pin[i]);
		}
580 581
	}

582
	device_init_wakeup(&pdev->dev, 0);
583 584
	usb_hcd_at91_remove(platform_get_drvdata(pdev), pdev);
	return 0;
585 586 587 588
}

#ifdef CONFIG_PM

589
static int
590
ohci_hcd_at91_drv_suspend(struct device *dev)
591
{
592
	struct usb_hcd	*hcd = dev_get_drvdata(dev);
593
	struct ohci_hcd	*ohci = hcd_to_ohci(hcd);
594
	struct ohci_at91_priv *ohci_at91 = hcd_to_ohci_at91_priv(hcd);
595
	int		ret;
596

597 598 599 600 601 602 603 604
	/*
	 * Disable wakeup if we are going to sleep with slow clock mode
	 * enabled.
	 */
	ohci_at91->wakeup = device_may_wakeup(dev)
			&& !at91_suspend_entering_slow_clock();

	if (ohci_at91->wakeup)
605 606
		enable_irq_wake(hcd->irq);

607
	ret = ohci_suspend(hcd, ohci_at91->wakeup);
608
	if (ret) {
609 610
		if (ohci_at91->wakeup)
			disable_irq_wake(hcd->irq);
611 612
		return ret;
	}
613 614 615 616 617 618 619
	/*
	 * The integrated transceivers seem unable to notice disconnect,
	 * reconnect, or wakeup without the 48 MHz clock active.  so for
	 * correctness, always discard connection state (using reset).
	 *
	 * REVISIT: some boards will be able to turn VBUS off...
	 */
620
	if (!ohci_at91->wakeup) {
621 622 623 624 625
		ohci->hc_control = ohci_readl(ohci, &ohci->regs->control);
		ohci->hc_control &= OHCI_CTRL_RWC;
		ohci_writel(ohci, ohci->hc_control, &ohci->regs->control);
		ohci->rh_state = OHCI_RH_HALTED;

626 627
		/* flush the writes */
		(void) ohci_readl (ohci, &ohci->regs->control);
628
		at91_stop_clock(ohci_at91);
629
	}
630

631
	return ret;
632 633
}

634
static int ohci_hcd_at91_drv_resume(struct device *dev)
635
{
636
	struct usb_hcd	*hcd = dev_get_drvdata(dev);
637
	struct ohci_at91_priv *ohci_at91 = hcd_to_ohci_at91_priv(hcd);
638

639
	if (ohci_at91->wakeup)
640 641
		disable_irq_wake(hcd->irq);

642
	at91_start_clock(ohci_at91);
643

644
	ohci_resume(hcd, false);
645 646 647 648
	return 0;
}
#endif

649 650 651
static SIMPLE_DEV_PM_OPS(ohci_hcd_at91_pm_ops, ohci_hcd_at91_drv_suspend,
					ohci_hcd_at91_drv_resume);

652 653
static struct platform_driver ohci_hcd_at91_driver = {
	.probe		= ohci_hcd_at91_drv_probe,
B
Bill Pemberton 已提交
654
	.remove		= ohci_hcd_at91_drv_remove,
655
	.shutdown	= usb_hcd_platform_shutdown,
656
	.driver		= {
657
		.name	= "at91_ohci",
658
		.pm	= &ohci_hcd_at91_pm_ops,
659
		.of_match_table	= at91_ohci_dt_ids,
660 661
	},
};
662 663 664 665 666 667 668

static int __init ohci_at91_init(void)
{
	if (usb_disabled())
		return -ENODEV;

	pr_info("%s: " DRIVER_DESC "\n", hcd_name);
669
	ohci_init_driver(&ohci_at91_hc_driver, &ohci_at91_drv_overrides);
670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695

	/*
	 * The Atmel HW has some unusual quirks, which require Atmel-specific
	 * workarounds. We override certain hc_driver functions here to
	 * achieve that. We explicitly do not enhance ohci_driver_overrides to
	 * allow this more easily, since this is an unusual case, and we don't
	 * want to encourage others to override these functions by making it
	 * too easy.
	 */

	ohci_at91_hc_driver.hub_status_data	= ohci_at91_hub_status_data;
	ohci_at91_hc_driver.hub_control		= ohci_at91_hub_control;

	return platform_driver_register(&ohci_hcd_at91_driver);
}
module_init(ohci_at91_init);

static void __exit ohci_at91_cleanup(void)
{
	platform_driver_unregister(&ohci_hcd_at91_driver);
}
module_exit(ohci_at91_cleanup);

MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:at91_ohci");