Stefan Reinauer | a8e1168 | 2009-03-11 14:54:18 +0000 | [diff] [blame] | 1 | /* |
| 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 Reinauer | a8e1168 | 2009-03-11 14:54:18 +0000 | [diff] [blame] | 14 | */ |
| 15 | |
Kyösti Mälkki | ef84401 | 2013-06-25 23:17:43 +0300 | [diff] [blame] | 16 | // Use simple device model for this file even in ramstage |
| 17 | #define __SIMPLE_DEVICE__ |
| 18 | |
Uwe Hermann | dc3aa7a | 2010-09-25 23:47:15 +0000 | [diff] [blame] | 19 | #include <stdint.h> |
Patrick Georgi | 5692c57 | 2010-10-05 13:40:31 +0000 | [diff] [blame] | 20 | #include <arch/io.h> |
Patrick Georgi | 5692c57 | 2010-10-05 13:40:31 +0000 | [diff] [blame] | 21 | #include <console/console.h> |
Kyösti Mälkki | e2227a2 | 2014-02-05 13:02:55 +0200 | [diff] [blame] | 22 | #include <device/pci_ehci.h> |
Uwe Hermann | dc3aa7a | 2010-09-25 23:47:15 +0000 | [diff] [blame] | 23 | #include <device/pci_def.h> |
Stefan Reinauer | a8e1168 | 2009-03-11 14:54:18 +0000 | [diff] [blame] | 24 | |
Kyösti Mälkki | 8101aa6 | 2013-08-15 16:27:06 +0300 | [diff] [blame] | 25 | pci_devfn_t pci_ehci_dbg_dev(unsigned int hcd_idx) |
| 26 | { |
Kyösti Mälkki | 545b30d | 2013-06-13 13:51:14 +0300 | [diff] [blame] | 27 | u32 class; |
| 28 | pci_devfn_t dev; |
| 29 | |
Kyösti Mälkki | 6683e40 | 2017-07-30 13:23:32 +0300 | [diff] [blame] | 30 | if (!IS_ENABLED(CONFIG_HAVE_USBDEBUG_OPTIONS)) |
| 31 | return PCI_DEV(0, 0x1d, 7); |
| 32 | |
Elyes HAOUAS | 581fe58 | 2018-04-26 09:57:07 +0200 | [diff] [blame] | 33 | if (hcd_idx == 2) |
Kyösti Mälkki | 545b30d | 2013-06-13 13:51:14 +0300 | [diff] [blame] | 34 | dev = PCI_DEV(0, 0x1a, 0); |
| 35 | else |
| 36 | dev = PCI_DEV(0, 0x1d, 0); |
Kyösti Mälkki | 545b30d | 2013-06-13 13:51:14 +0300 | [diff] [blame] | 37 | |
Kyösti Mälkki | 6683e40 | 2017-07-30 13:23:32 +0300 | [diff] [blame] | 38 | /* If we enter here before RCBA programming, EHCI function may |
| 39 | * appear with the highest function number instead. |
| 40 | */ |
Kyösti Mälkki | 545b30d | 2013-06-13 13:51:14 +0300 | [diff] [blame] | 41 | class = pci_read_config32(dev, PCI_CLASS_REVISION) >> 8; |
Kyösti Mälkki | 545b30d | 2013-06-13 13:51:14 +0300 | [diff] [blame] | 42 | if (class != PCI_EHCI_CLASSCODE) |
Kyösti Mälkki | 6683e40 | 2017-07-30 13:23:32 +0300 | [diff] [blame] | 43 | dev |= PCI_DEV(0, 0, 7); |
Kyösti Mälkki | 545b30d | 2013-06-13 13:51:14 +0300 | [diff] [blame] | 44 | |
| 45 | return dev; |
Kyösti Mälkki | 8101aa6 | 2013-08-15 16:27:06 +0300 | [diff] [blame] | 46 | } |
| 47 | |
Uwe Hermann | 370d979 | 2010-09-25 14:23:31 +0000 | [diff] [blame] | 48 | /* Required for successful build, but currently empty. */ |
Kyösti Mälkki | 8101aa6 | 2013-08-15 16:27:06 +0300 | [diff] [blame] | 49 | void pci_ehci_dbg_set_port(pci_devfn_t dev, unsigned int port) |
Uwe Hermann | 370d979 | 2010-09-25 14:23:31 +0000 | [diff] [blame] | 50 | { |
| 51 | /* Not needed, the ICH* southbridges hardcode physical USB port 1. */ |
| 52 | } |