blob: 0533ae747799485e1a37173cde9787970c712393 [file] [log] [blame]
Stefan Reinauer8e073822012-04-04 00:07:22 +02001/*
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 Georgib890a122015-03-26 15:17:45 +010018 * Foundation, Inc.
Stefan Reinauer8e073822012-04-04 00:07:22 +020019 */
20
21#include <arch/io.h>
Stefan Reinauer8e073822012-04-04 00:07:22 +020022#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 */
37void 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älkkie761b712013-06-15 12:29:23 +030050 /* USB Controller 2 */
Stefan Reinauer8e073822012-04-04 00:07:22 +020051 pci_write_config32(usb1, PCI_BASE_ADDRESS_0,
Kyösti Mälkkie761b712013-06-15 12:29:23 +030052 PCH_EHCI2_TEMP_BAR0);
Stefan Reinauer8e073822012-04-04 00:07:22 +020053 cmd = pci_read_config32(usb1, PCI_COMMAND);
54 cmd |= PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY;
55 pci_write_config32(usb1, PCI_COMMAND, cmd);
Stefan Reinauer8e073822012-04-04 00:07:22 +020056}