diff options
author | Heiko Schocher <hs@denx.de> | 2019-07-16 10:49:07 +0200 |
---|---|---|
committer | Marek Vasut <marex@denx.de> | 2019-08-08 11:35:02 +0200 |
commit | 991e66017ccd79cf4b89a729433a9606a771bd2b (patch) | |
tree | fe4b1d2a7e27572c31310beff8b1141cc4e64088 /drivers/usb/host/ohci-pci.c | |
parent | f9c7fecbeb938d9a17e31bf7c8766190752790ae (diff) | |
download | u-boot-991e66017ccd79cf4b89a729433a9606a771bd2b.tar.gz u-boot-991e66017ccd79cf4b89a729433a9606a771bd2b.tar.bz2 u-boot-991e66017ccd79cf4b89a729433a9606a771bd2b.zip |
usb, ohci, pci: add DM support for PCI-based OHCI USB controller
add new DM based PCI driver ohci-pci for PCI-based
OHCI USB support.
Signed-off-by: Heiko Schocher <hs@denx.de>
Diffstat (limited to 'drivers/usb/host/ohci-pci.c')
-rw-r--r-- | drivers/usb/host/ohci-pci.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/drivers/usb/host/ohci-pci.c b/drivers/usb/host/ohci-pci.c new file mode 100644 index 0000000000..4c1c778672 --- /dev/null +++ b/drivers/usb/host/ohci-pci.c @@ -0,0 +1,52 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2019 + * Heiko Schocher, DENX Software Engineering, hs@denx.de. + * + */ + +#include <common.h> +#include <dm.h> +#include <errno.h> +#include <pci.h> +#include <usb.h> +#include <asm/io.h> + +#include "ohci.h" + +static int ohci_pci_probe(struct udevice *dev) +{ + struct ohci_regs *regs; + + regs = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, PCI_REGION_MEM); + return ohci_register(dev, regs); +} + +static int ohci_pci_remove(struct udevice *dev) +{ + return ohci_deregister(dev); +} + +static const struct udevice_id ohci_pci_ids[] = { + { .compatible = "ohci-pci" }, + { } +}; + +U_BOOT_DRIVER(ohci_pci) = { + .name = "ohci_pci", + .id = UCLASS_USB, + .probe = ohci_pci_probe, + .remove = ohci_pci_remove, + .of_match = ohci_pci_ids, + .ops = &ohci_usb_ops, + .platdata_auto_alloc_size = sizeof(struct usb_platdata), + .priv_auto_alloc_size = sizeof(ohci_t), + .flags = DM_FLAG_ALLOC_PRIV_DMA, +}; + +static struct pci_device_id ohci_pci_supported[] = { + { PCI_DEVICE_CLASS(PCI_CLASS_SERIAL_USB_OHCI, ~0) }, + {}, +}; + +U_BOOT_PCI_DEVICE(ohci_pci, ohci_pci_supported); |