Heiko Schocher | 991e660 | 2019-07-16 10:49:07 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | /* |
| 3 | * Copyright (c) 2019 |
| 4 | * Heiko Schocher, DENX Software Engineering, hs@denx.de. |
| 5 | * |
| 6 | */ |
| 7 | |
| 8 | #include <common.h> |
| 9 | #include <dm.h> |
| 10 | #include <errno.h> |
| 11 | #include <pci.h> |
| 12 | #include <usb.h> |
| 13 | #include <asm/io.h> |
| 14 | |
| 15 | #include "ohci.h" |
| 16 | |
| 17 | static int ohci_pci_probe(struct udevice *dev) |
| 18 | { |
| 19 | struct ohci_regs *regs; |
| 20 | |
Andrew Scull | 2635e3b | 2022-04-21 16:11:13 +0000 | [diff] [blame] | 21 | regs = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, 0, 0, PCI_REGION_TYPE, PCI_REGION_MEM); |
Heiko Schocher | 991e660 | 2019-07-16 10:49:07 +0200 | [diff] [blame] | 22 | return ohci_register(dev, regs); |
| 23 | } |
| 24 | |
| 25 | static int ohci_pci_remove(struct udevice *dev) |
| 26 | { |
| 27 | return ohci_deregister(dev); |
| 28 | } |
| 29 | |
| 30 | static const struct udevice_id ohci_pci_ids[] = { |
| 31 | { .compatible = "ohci-pci" }, |
| 32 | { } |
| 33 | }; |
| 34 | |
| 35 | U_BOOT_DRIVER(ohci_pci) = { |
| 36 | .name = "ohci_pci", |
| 37 | .id = UCLASS_USB, |
| 38 | .probe = ohci_pci_probe, |
| 39 | .remove = ohci_pci_remove, |
| 40 | .of_match = ohci_pci_ids, |
| 41 | .ops = &ohci_usb_ops, |
Simon Glass | 8a8d24b | 2020-12-03 16:55:23 -0700 | [diff] [blame] | 42 | .plat_auto = sizeof(struct usb_plat), |
Simon Glass | 41575d8 | 2020-12-03 16:55:17 -0700 | [diff] [blame] | 43 | .priv_auto = sizeof(ohci_t), |
Heiko Schocher | 991e660 | 2019-07-16 10:49:07 +0200 | [diff] [blame] | 44 | .flags = DM_FLAG_ALLOC_PRIV_DMA, |
| 45 | }; |
| 46 | |
| 47 | static struct pci_device_id ohci_pci_supported[] = { |
| 48 | { PCI_DEVICE_CLASS(PCI_CLASS_SERIAL_USB_OHCI, ~0) }, |
| 49 | {}, |
| 50 | }; |
| 51 | |
| 52 | U_BOOT_PCI_DEVICE(ohci_pci, ohci_pci_supported); |