blob: f85738fb05f0525ba29840ce84af5066dcfa8573 [file] [log] [blame]
Alexey Brodkin83fd3122015-12-14 17:18:50 +03001/*
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
15struct generic_ohci {
16 ohci_t ohci;
17};
18
19static int ohci_usb_probe(struct udevice *dev)
20{
Simon Glassba1dea42017-05-17 17:18:05 -060021 struct ohci_regs *regs = (struct ohci_regs *)devfdt_get_addr(dev);
Alexey Brodkin83fd3122015-12-14 17:18:50 +030022
23 return ohci_register(dev, regs);
24}
25
26static int ohci_usb_remove(struct udevice *dev)
27{
28 return ohci_deregister(dev);
29}
30
31static const struct udevice_id ohci_usb_ids[] = {
32 { .compatible = "generic-ohci" },
33 { }
34};
35
36U_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};