mb/google/poppy/variants/nocturne: remove dup'ed dptf_enable
[coreboot.git] / util / uio_usbdebug / uio_usbdebug_intel.c
blob9271896b7d913e9eb598f2c2f3d296772ab36b4e
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.
16 #include <arch/io.h>
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)
25 u32 class;
26 pci_devfn_t dev;
28 #if CONFIG_HAVE_USBDEBUG_OPTIONS
29 if (hcd_idx==2)
30 dev = PCI_DEV(0, 0x1a, 0);
31 else
32 dev = PCI_DEV(0, 0x1d, 0);
33 #else
34 dev = PCI_DEV(0, 0x1d, 7);
35 #endif
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;
46 #endif
47 if (class != PCI_EHCI_CLASSCODE)
48 return 0;
50 return dev;
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)