2 * This file is part of uio_usbdebug
4 * Copyright (C) 2013 Nico Huber <nico.h@gmx.de>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
17 #include <device/device.h>
18 #include <device/pci_ehci.h>
19 #include <console/usb.h>
21 extern void *ehci_bar
;
23 pci_devfn_t
pci_ehci_dbg_dev(unsigned hcd_idx
)
28 #if CONFIG_HAVE_USBDEBUG_OPTIONS
30 dev
= PCI_DEV(0, 0x1a, 0);
32 dev
= PCI_DEV(0, 0x1d, 0);
34 dev
= PCI_DEV(0, 0x1d, 7);
37 class = pci_read_config32(dev
, PCI_CLASS_REVISION
) >> 8;
38 #if CONFIG_HAVE_USBDEBUG_OPTIONS
39 if (class != PCI_EHCI_CLASSCODE
) {
40 /* If we enter here before RCBA programming, EHCI function may
41 * appear with the highest function number instead.
43 dev
|= PCI_DEV(0, 0, 7);
44 class = pci_read_config32(dev
, PCI_CLASS_REVISION
) >> 8;
47 if (class != PCI_EHCI_CLASSCODE
)
53 void pci_ehci_dbg_set_port(pci_devfn_t dev
, unsigned int port
)
55 /* claim usb debug port */
56 const unsigned long dbgctl_addr
=
57 ((unsigned long)ehci_bar
) + CONFIG_EHCI_DEBUG_OFFSET
;
58 write32(dbgctl_addr
, read32(dbgctl_addr
) | (1 << 30));
61 void pci_ehci_dbg_enable(pci_devfn_t dev
, unsigned long base
)