summaryrefslogtreecommitdiff
path: root/drivers/usb/host/ohci-pci.c
blob: f061aec28966fc8cb709666efe6d0a5f019f9153 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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, 0, 0, PCI_REGION_TYPE, 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,
	.plat_auto	= sizeof(struct usb_plat),
	.priv_auto	= 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);