xref: /openbmc/u-boot/drivers/usb/host/ohci-generic.c (revision cb379a34)
1 /*
2  * Copyright (C) 2015 Alexey Brodkin <abrodkin@synopsys.com>
3  *
4  * SPDX-License-Identifier:	GPL-2.0+
5  */
6 
7 #include <common.h>
8 #include <dm.h>
9 #include "ohci.h"
10 
11 #if !defined(CONFIG_USB_OHCI_NEW)
12 # error "Generic OHCI driver requires CONFIG_USB_OHCI_NEW"
13 #endif
14 
15 struct generic_ohci {
16 	ohci_t ohci;
17 };
18 
19 static int ohci_usb_probe(struct udevice *dev)
20 {
21 	struct ohci_regs *regs = (struct ohci_regs *)dev_get_addr(dev);
22 
23 	return ohci_register(dev, regs);
24 }
25 
26 static int ohci_usb_remove(struct udevice *dev)
27 {
28 	return ohci_deregister(dev);
29 }
30 
31 static const struct udevice_id ohci_usb_ids[] = {
32 	{ .compatible = "generic-ohci" },
33 	{ }
34 };
35 
36 U_BOOT_DRIVER(ohci_generic) = {
37 	.name	= "ohci_generic",
38 	.id	= UCLASS_USB,
39 	.of_match = ohci_usb_ids,
40 	.probe = ohci_usb_probe,
41 	.remove = ohci_usb_remove,
42 	.ops	= &ohci_usb_ops,
43 	.priv_auto_alloc_size = sizeof(struct generic_ohci),
44 	.flags	= DM_FLAG_ALLOC_PRIV_DMA,
45 };
46