blob: fa73b2f1aa362f025c392360173e3a8a52bc6802 [file] [log] [blame]
Yinghai Luafd34e62006-02-16 17:22:19 +00001/*
Uwe Hermannc6a10622010-10-17 19:30:58 +00002 * 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 Luafd34e62006-02-16 17:22:19 +000015 */
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
24static 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
36static void lpci_set_subsystem(device_t dev, unsigned vendor, unsigned device)
Stefan Reinauer14e22772010-04-27 06:56:47 +000037{
38 pci_write_config32(dev, 0x40,
Yinghai Luafd34e62006-02-16 17:22:19 +000039 ((device & 0xffff) << 16) | (vendor & 0xffff));
40}
Uwe Hermannc6a10622010-10-17 19:30:58 +000041
Yinghai Luafd34e62006-02-16 17:22:19 +000042static struct pci_operations lops_pci = {
43 .set_subsystem = lpci_set_subsystem,
44};
45
46static 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 Reinauerf1cf1f72007-10-24 09:08:58 +000056static const struct pci_driver usb_driver __pci_driver = {
Yinghai Luafd34e62006-02-16 17:22:19 +000057 .ops = &usb_ops,
58 .vendor = PCI_VENDOR_ID_SERVERWORKS,
59 .device = PCI_DEVICE_ID_SERVERWORKS_BCM5785_USB,
60};