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.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
21 #include <device/device.h>
22 #include <device/pci_ehci.h>
23 #include <console/usb.h>
25 extern void *ehci_bar
;
27 pci_devfn_t
pci_ehci_dbg_dev(unsigned hcd_idx
)
32 #if CONFIG_HAVE_USBDEBUG_OPTIONS
34 dev
= PCI_DEV(0, 0x1a, 0);
36 dev
= PCI_DEV(0, 0x1d, 0);
38 dev
= PCI_DEV(0, 0x1d, 7);
41 class = pci_read_config32(dev
, PCI_CLASS_REVISION
) >> 8;
42 #if CONFIG_HAVE_USBDEBUG_OPTIONS
43 if (class != PCI_EHCI_CLASSCODE
) {
44 /* If we enter here before RCBA programming, EHCI function may
45 * appear with the highest function number instead.
47 dev
|= PCI_DEV(0, 0, 7);
48 class = pci_read_config32(dev
, PCI_CLASS_REVISION
) >> 8;
51 if (class != PCI_EHCI_CLASSCODE
)
57 void pci_ehci_dbg_set_port(pci_devfn_t dev
, unsigned int port
)
59 /* claim usb debug port */
60 const unsigned long dbgctl_addr
=
61 ((unsigned long)ehci_bar
) + CONFIG_EHCI_DEBUG_OFFSET
;
62 write32(dbgctl_addr
, read32(dbgctl_addr
) | (1 << 30));
65 void pci_ehci_dbg_enable(pci_devfn_t dev
, unsigned long base
)