Stefan Reinauer | aeba92a | 2009-04-17 08:37:18 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2007-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 |
Paul Menzel | a46a712 | 2013-02-23 18:37:27 +0100 | [diff] [blame] | 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
Stefan Reinauer | aeba92a | 2009-04-17 08:37:18 +0000 | [diff] [blame] | 18 | */ |
| 19 | |
| 20 | #include <console/console.h> |
| 21 | #include <device/device.h> |
| 22 | #include <device/pci.h> |
| 23 | #include <device/pci_ids.h> |
| 24 | |
| 25 | static void usb_init(struct device *dev) |
| 26 | { |
| 27 | u32 reg32; |
| 28 | u8 reg8; |
| 29 | |
| 30 | /* USB Specification says the device must be Bus Master */ |
Stefan Reinauer | c02b4fc | 2010-03-22 11:42:32 +0000 | [diff] [blame] | 31 | printk(BIOS_DEBUG, "UHCI: Setting up controller.. "); |
Stefan Reinauer | aeba92a | 2009-04-17 08:37:18 +0000 | [diff] [blame] | 32 | |
| 33 | reg32 = pci_read_config32(dev, PCI_COMMAND); |
| 34 | pci_write_config32(dev, PCI_COMMAND, reg32 | PCI_COMMAND_MASTER); |
| 35 | |
| 36 | reg8 = pci_read_config8(dev, 0xca); |
| 37 | reg8 |= (1 << 0); |
| 38 | pci_write_config8(dev, 0xca, reg8); |
| 39 | |
Stefan Reinauer | c02b4fc | 2010-03-22 11:42:32 +0000 | [diff] [blame] | 40 | printk(BIOS_DEBUG, "done.\n"); |
Stefan Reinauer | aeba92a | 2009-04-17 08:37:18 +0000 | [diff] [blame] | 41 | } |
| 42 | |
| 43 | static struct device_operations usb_ops = { |
| 44 | .read_resources = pci_dev_read_resources, |
| 45 | .set_resources = pci_dev_set_resources, |
| 46 | .enable_resources = pci_dev_enable_resources, |
| 47 | .init = usb_init, |
| 48 | .enable = 0, |
| 49 | .ops_pci = 0, |
| 50 | }; |
| 51 | |
| 52 | static const struct pci_driver via_usb_driver __pci_driver = { |
| 53 | .ops = &usb_ops, |
| 54 | .vendor = PCI_VENDOR_ID_VIA, |
| 55 | .device = 0x3038, |
| 56 | }; |