blob: f10f109242055aacdfc092413cb868cb7edac4ea [file] [log] [blame]
Heiko Schocher124f9472019-07-16 10:49:07 +02001// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (c) 2019
4 * Heiko Schocher, DENX Software Engineering, hs@denx.de.
5 *
6 */
7
Heiko Schocher124f9472019-07-16 10:49:07 +02008#include <dm.h>
9#include <errno.h>
10#include <pci.h>
11#include <usb.h>
12#include <asm/io.h>
13
14#include "ohci.h"
15
16static int ohci_pci_probe(struct udevice *dev)
17{
18 struct ohci_regs *regs;
19
Andrew Scull6520c822022-04-21 16:11:13 +000020 regs = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, 0, 0, PCI_REGION_TYPE, PCI_REGION_MEM);
Heiko Schocher124f9472019-07-16 10:49:07 +020021 return ohci_register(dev, regs);
22}
23
24static int ohci_pci_remove(struct udevice *dev)
25{
26 return ohci_deregister(dev);
27}
28
29static const struct udevice_id ohci_pci_ids[] = {
30 { .compatible = "ohci-pci" },
31 { }
32};
33
34U_BOOT_DRIVER(ohci_pci) = {
35 .name = "ohci_pci",
36 .id = UCLASS_USB,
37 .probe = ohci_pci_probe,
38 .remove = ohci_pci_remove,
39 .of_match = ohci_pci_ids,
40 .ops = &ohci_usb_ops,
Simon Glassb75b15b2020-12-03 16:55:23 -070041 .plat_auto = sizeof(struct usb_plat),
Simon Glass8a2b47f2020-12-03 16:55:17 -070042 .priv_auto = sizeof(ohci_t),
Heiko Schocher124f9472019-07-16 10:49:07 +020043 .flags = DM_FLAG_ALLOC_PRIV_DMA,
44};
45
46static struct pci_device_id ohci_pci_supported[] = {
47 { PCI_DEVICE_CLASS(PCI_CLASS_SERIAL_USB_OHCI, ~0) },
48 {},
49};
50
51U_BOOT_PCI_DEVICE(ohci_pci, ohci_pci_supported);