blob: ead7bdca7f9381cfd432c9f3d43988424d9c450a [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.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20// An arbitrary address for the BAR
21#define EHCI_BAR 0xFEF00000
22// These could be read from DEBUG_BASE (0:1d.7 R 0x5A 16bit)
23#define EHCI_BAR_INDEX 0x10
Stefan Reinauer573f7d42009-07-21 21:50:34 +000024
25#define EHCI_CONFIG_FLAG 0x40
26#define EHCI_PORTSC 0x44
Stefan Reinauera8e11682009-03-11 14:54:18 +000027#define EHCI_DEBUG_OFFSET 0xA0
28
Stefan Reinauer573f7d42009-07-21 21:50:34 +000029void set_debug_port(unsigned port)
Stefan Reinauera8e11682009-03-11 14:54:18 +000030{
Stefan Reinauer573f7d42009-07-21 21:50:34 +000031 u32 dbgctl;
32
Stefan Reinauerc02b4fc2010-03-22 11:42:32 +000033 printk(BIOS_DEBUG, "Enabling OWNER_CNT\n");
Stefan Reinauer9fe4d792010-01-16 17:53:38 +000034 dbgctl = read32(EHCI_BAR + EHCI_DEBUG_OFFSET);
Stefan Reinauer573f7d42009-07-21 21:50:34 +000035 dbgctl |= (1 << 30);
Stefan Reinauer9fe4d792010-01-16 17:53:38 +000036 write32(EHCI_BAR + EHCI_DEBUG_OFFSET, dbgctl);
Stefan Reinauera8e11682009-03-11 14:54:18 +000037}
38
39static void i82801gx_enable_usbdebug_direct(unsigned port)
40{
41 pci_write_config32(PCI_DEV(0, 0x1d, 7), EHCI_BAR_INDEX, EHCI_BAR);
42 pci_write_config8(PCI_DEV(0, 0x1d, 7), 0x04, 0x2); // Memory Space Enable
Stefan Reinauer573f7d42009-07-21 21:50:34 +000043 set_debug_port(port);
Stefan Reinauera8e11682009-03-11 14:54:18 +000044}
45