blob: d87e018d85eeac41409aa32f8579bb867a229573 [file] [log] [blame]
Stefan Reinauera8e11682009-03-11 14:54:18 +00001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2009 coresystems GmbH
5 *
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.
9 *
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.
Stefan Reinauera8e11682009-03-11 14:54:18 +000014 */
15
Kyösti Mälkkief844012013-06-25 23:17:43 +030016// Use simple device model for this file even in ramstage
17#define __SIMPLE_DEVICE__
18
Uwe Hermanndc3aa7a2010-09-25 23:47:15 +000019#include <stdint.h>
Patrick Georgi5692c572010-10-05 13:40:31 +000020#include <arch/io.h>
Patrick Georgi5692c572010-10-05 13:40:31 +000021#include <console/console.h>
Kyösti Mälkkie2227a22014-02-05 13:02:55 +020022#include <device/pci_ehci.h>
Uwe Hermanndc3aa7a2010-09-25 23:47:15 +000023#include <device/pci_def.h>
Stefan Reinauera8e11682009-03-11 14:54:18 +000024
Kyösti Mälkki8101aa62013-08-15 16:27:06 +030025pci_devfn_t pci_ehci_dbg_dev(unsigned int hcd_idx)
26{
Kyösti Mälkki545b30d2013-06-13 13:51:14 +030027 u32 class;
28 pci_devfn_t dev;
29
Kyösti Mälkki6683e402017-07-30 13:23:32 +030030 if (!IS_ENABLED(CONFIG_HAVE_USBDEBUG_OPTIONS))
31 return PCI_DEV(0, 0x1d, 7);
32
Elyes HAOUAS581fe582018-04-26 09:57:07 +020033 if (hcd_idx == 2)
Kyösti Mälkki545b30d2013-06-13 13:51:14 +030034 dev = PCI_DEV(0, 0x1a, 0);
35 else
36 dev = PCI_DEV(0, 0x1d, 0);
Kyösti Mälkki545b30d2013-06-13 13:51:14 +030037
Kyösti Mälkki6683e402017-07-30 13:23:32 +030038 /* If we enter here before RCBA programming, EHCI function may
39 * appear with the highest function number instead.
40 */
Kyösti Mälkki545b30d2013-06-13 13:51:14 +030041 class = pci_read_config32(dev, PCI_CLASS_REVISION) >> 8;
Kyösti Mälkki545b30d2013-06-13 13:51:14 +030042 if (class != PCI_EHCI_CLASSCODE)
Kyösti Mälkki6683e402017-07-30 13:23:32 +030043 dev |= PCI_DEV(0, 0, 7);
Kyösti Mälkki545b30d2013-06-13 13:51:14 +030044
45 return dev;
Kyösti Mälkki8101aa62013-08-15 16:27:06 +030046}
47
Uwe Hermann370d9792010-09-25 14:23:31 +000048/* Required for successful build, but currently empty. */
Kyösti Mälkki8101aa62013-08-15 16:27:06 +030049void pci_ehci_dbg_set_port(pci_devfn_t dev, unsigned int port)
Uwe Hermann370d9792010-09-25 14:23:31 +000050{
51 /* Not needed, the ICH* southbridges hardcode physical USB port 1. */
52}