Michael Xie | 7586cef | 2008-09-22 13:11:39 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2008 Advanced Micro Devices, Inc. |
| 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. |
Michael Xie | 7586cef | 2008-09-22 13:11:39 +0000 | [diff] [blame] | 14 | */ |
| 15 | |
Kyösti Mälkki | 1fd7508 | 2013-06-11 16:32:01 +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> |
Kyösti Mälkki | e2227a2 | 2014-02-05 13:02:55 +0200 | [diff] [blame] | 21 | #include <device/pci_ehci.h> |
Uwe Hermann | dc3aa7a | 2010-09-25 23:47:15 +0000 | [diff] [blame] | 22 | #include <device/pci_def.h> |
Patrick Georgi | 5692c57 | 2010-10-05 13:40:31 +0000 | [diff] [blame] | 23 | #include "sb600.h" |
Michael Xie | 7586cef | 2008-09-22 13:11:39 +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 | { |
| 27 | return PCI_DEV(0, 0x13, 5); /* USB EHCI, D19:F5 */ |
| 28 | } |
| 29 | |
Uwe Hermann | b015d02 | 2010-09-24 18:18:20 +0000 | [diff] [blame] | 30 | /* Required for successful build, but currently empty. */ |
Kyösti Mälkki | 8101aa6 | 2013-08-15 16:27:06 +0300 | [diff] [blame] | 31 | void pci_ehci_dbg_set_port(pci_devfn_t dev, unsigned int port) |
Uwe Hermann | b015d02 | 2010-09-24 18:18:20 +0000 | [diff] [blame] | 32 | { |
Uwe Hermann | dc3aa7a | 2010-09-25 23:47:15 +0000 | [diff] [blame] | 33 | /* TODO: Allow changing the physical USB port used as Debug Port. */ |
Uwe Hermann | b015d02 | 2010-09-24 18:18:20 +0000 | [diff] [blame] | 34 | } |
| 35 | |
Kyösti Mälkki | 8101aa6 | 2013-08-15 16:27:06 +0300 | [diff] [blame] | 36 | void pci_ehci_dbg_enable(pci_devfn_t dev, unsigned long base) |
Michael Xie | 7586cef | 2008-09-22 13:11:39 +0000 | [diff] [blame] | 37 | { |
Uwe Hermann | dc3aa7a | 2010-09-25 23:47:15 +0000 | [diff] [blame] | 38 | /* Set the EHCI BAR address. */ |
Kyösti Mälkki | 8101aa6 | 2013-08-15 16:27:06 +0300 | [diff] [blame] | 39 | pci_write_config32(dev, EHCI_BAR_INDEX, base); |
Uwe Hermann | dc3aa7a | 2010-09-25 23:47:15 +0000 | [diff] [blame] | 40 | |
| 41 | /* Enable access to the EHCI memory space registers. */ |
| 42 | pci_write_config8(dev, PCI_COMMAND, PCI_COMMAND_MEMORY); |
Michael Xie | 7586cef | 2008-09-22 13:11:39 +0000 | [diff] [blame] | 43 | } |