libpayload: Use CONFIG_LP_CCACHE instead of CONFIG_CCACHE
[coreboot.git] / util / uio_usbdebug / uio_usbdebug_intel.c
blob34b65f5d2d1de896b2f9e0cd2af1c2e4b25a403c
1 /*
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
17 * Foundation, Inc.
20 #include <arch/io.h>
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)
29 u32 class;
30 pci_devfn_t dev;
32 #if CONFIG_HAVE_USBDEBUG_OPTIONS
33 if (hcd_idx==2)
34 dev = PCI_DEV(0, 0x1a, 0);
35 else
36 dev = PCI_DEV(0, 0x1d, 0);
37 #else
38 dev = PCI_DEV(0, 0x1d, 7);
39 #endif
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;
50 #endif
51 if (class != PCI_EHCI_CLASSCODE)
52 return 0;
54 return dev;
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)