Stefan Reinauer | 8e07382 | 2012-04-04 00:07:22 +0200 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2008-2009 coresystems GmbH |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU General Public License as |
| 8 | * published by the Free Software Foundation; version 2 of |
| 9 | * the License. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, write to the Free Software |
Patrick Georgi | b890a12 | 2015-03-26 15:17:45 +0100 | [diff] [blame] | 18 | * Foundation, Inc. |
Stefan Reinauer | 8e07382 | 2012-04-04 00:07:22 +0200 | [diff] [blame] | 19 | */ |
| 20 | |
| 21 | #include <arch/io.h> |
Stefan Reinauer | 8e07382 | 2012-04-04 00:07:22 +0200 | [diff] [blame] | 22 | #include <console/console.h> |
| 23 | #include <device/pci_ids.h> |
| 24 | #include <device/pci_def.h> |
| 25 | #include "pch.h" |
| 26 | |
| 27 | #define PCH_EHCI1_TEMP_BAR0 0xe8000000 |
| 28 | #define PCH_EHCI2_TEMP_BAR0 0xe8000400 |
| 29 | |
| 30 | /* |
| 31 | * Setup USB controller MMIO BAR to prevent the |
| 32 | * reference code from resetting the controller. |
| 33 | * |
| 34 | * The BAR will be re-assigned during device |
| 35 | * enumeration so these are only temporary. |
| 36 | */ |
| 37 | void enable_usb_bar(void) |
| 38 | { |
| 39 | device_t usb0 = PCH_EHCI1_DEV; |
| 40 | device_t usb1 = PCH_EHCI2_DEV; |
| 41 | u32 cmd; |
| 42 | |
| 43 | /* USB Controller 1 */ |
| 44 | pci_write_config32(usb0, PCI_BASE_ADDRESS_0, |
| 45 | PCH_EHCI1_TEMP_BAR0); |
| 46 | cmd = pci_read_config32(usb0, PCI_COMMAND); |
| 47 | cmd |= PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY; |
| 48 | pci_write_config32(usb0, PCI_COMMAND, cmd); |
| 49 | |
Kyösti Mälkki | e761b71 | 2013-06-15 12:29:23 +0300 | [diff] [blame] | 50 | /* USB Controller 2 */ |
Stefan Reinauer | 8e07382 | 2012-04-04 00:07:22 +0200 | [diff] [blame] | 51 | pci_write_config32(usb1, PCI_BASE_ADDRESS_0, |
Kyösti Mälkki | e761b71 | 2013-06-15 12:29:23 +0300 | [diff] [blame] | 52 | PCH_EHCI2_TEMP_BAR0); |
Stefan Reinauer | 8e07382 | 2012-04-04 00:07:22 +0200 | [diff] [blame] | 53 | cmd = pci_read_config32(usb1, PCI_COMMAND); |
| 54 | cmd |= PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY; |
| 55 | pci_write_config32(usb1, PCI_COMMAND, cmd); |
Stefan Reinauer | 8e07382 | 2012-04-04 00:07:22 +0200 | [diff] [blame] | 56 | } |