Yinghai Lu | afd34e6 | 2006-02-16 17:22:19 +0000 | [diff] [blame] | 1 | /* |
Uwe Hermann | c6a1062 | 2010-10-17 19:30:58 +0000 | [diff] [blame] | 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2005 AMD |
| 5 | * Written by Yinghai Lu <yinghai.lu@amd.com> for AMD. |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; version 2 of 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. |
Yinghai Lu | afd34e6 | 2006-02-16 17:22:19 +0000 | [diff] [blame] | 15 | */ |
| 16 | |
| 17 | #include <console/console.h> |
| 18 | #include <device/device.h> |
| 19 | #include <device/pci.h> |
| 20 | #include <device/pci_ids.h> |
| 21 | #include <device/pci_ops.h> |
| 22 | #include "bcm5785.h" |
| 23 | |
| 24 | static void usb_init(struct device *dev) |
| 25 | { |
| 26 | uint32_t dword; |
| 27 | |
| 28 | dword = pci_read_config32(dev, 0x04); |
| 29 | dword |= (1<<2)|(1<<1)|(1<<0); |
| 30 | pci_write_config32(dev, 0x04, dword); |
| 31 | |
| 32 | pci_write_config8(dev, 0x41, 0x00); // Serversworks said |
| 33 | |
| 34 | } |
| 35 | |
| 36 | static void lpci_set_subsystem(device_t dev, unsigned vendor, unsigned device) |
Stefan Reinauer | 14e2277 | 2010-04-27 06:56:47 +0000 | [diff] [blame] | 37 | { |
| 38 | pci_write_config32(dev, 0x40, |
Yinghai Lu | afd34e6 | 2006-02-16 17:22:19 +0000 | [diff] [blame] | 39 | ((device & 0xffff) << 16) | (vendor & 0xffff)); |
| 40 | } |
Uwe Hermann | c6a1062 | 2010-10-17 19:30:58 +0000 | [diff] [blame] | 41 | |
Yinghai Lu | afd34e6 | 2006-02-16 17:22:19 +0000 | [diff] [blame] | 42 | static struct pci_operations lops_pci = { |
| 43 | .set_subsystem = lpci_set_subsystem, |
| 44 | }; |
| 45 | |
| 46 | static struct device_operations usb_ops = { |
| 47 | .read_resources = pci_dev_read_resources, |
| 48 | .set_resources = pci_dev_set_resources, |
| 49 | .enable_resources = pci_dev_enable_resources, |
| 50 | .init = usb_init, |
| 51 | // .enable = bcm5785_enable, |
| 52 | .scan_bus = 0, |
| 53 | .ops_pci = &lops_pci, |
| 54 | }; |
| 55 | |
Stefan Reinauer | f1cf1f7 | 2007-10-24 09:08:58 +0000 | [diff] [blame] | 56 | static const struct pci_driver usb_driver __pci_driver = { |
Yinghai Lu | afd34e6 | 2006-02-16 17:22:19 +0000 | [diff] [blame] | 57 | .ops = &usb_ops, |
| 58 | .vendor = PCI_VENDOR_ID_SERVERWORKS, |
| 59 | .device = PCI_DEVICE_ID_SERVERWORKS_BCM5785_USB, |
| 60 | }; |