blob: 0d3ba9ea2c2fbec7905810cf671d588e78dfe77d [file] [log] [blame]
zbao246e84b2012-07-13 18:47:03 +08001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2010 Advanced Micro Devices, Inc.
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#include <console/console.h>
21#include <device/device.h>
22#include <device/pci.h>
23#include <device/pci_ids.h>
24#include <device/pci_ops.h>
25#include <usbdebug.h>
26#include <arch/io.h>
27#include "hudson.h"
28
29static struct pci_operations lops_pci = {
30 .set_subsystem = pci_dev_set_subsystem,
31};
32
33static void usb_init(struct device *dev)
34{
35}
36
37static void usb_set_resources(struct device *dev)
38{
39#if CONFIG_USBDEBUG
40 struct resource *res;
41 u32 base;
42 u32 old_debug;
43
44 old_debug = get_ehci_debug();
45 set_ehci_debug(0);
46#endif
47 pci_dev_set_resources(dev);
48
49#if CONFIG_USBDEBUG
50 res = find_resource(dev, 0x10);
51 set_ehci_debug(old_debug);
52 if (!res)
53 return;
54 base = res->base;
55 set_ehci_base(base);
56 report_resource_stored(dev, res, "");
57#endif
58
59}
60
61static struct device_operations usb_ops = {
62 .read_resources = pci_dev_read_resources,
63 .set_resources = usb_set_resources, /* pci_dev_set_resources, */
64 .enable_resources = pci_dev_enable_resources,
65 .init = usb_init,
66 .scan_bus = 0,
67 .ops_pci = &lops_pci,
68};
69
70static const struct pci_driver usb_0_driver __pci_driver = {
71 .ops = &usb_ops,
72 .vendor = PCI_VENDOR_ID_AMD,
73 .device = PCI_DEVICE_ID_ATI_SB900_USB_18_0,
74};
75static const struct pci_driver usb_1_driver __pci_driver = {
76 .ops = &usb_ops,
77 .vendor = PCI_VENDOR_ID_AMD,
78 .device = PCI_DEVICE_ID_ATI_SB900_USB_18_2,
79};
80
81/* the pci id of usb ctrl 0 and 1 are the same. */
82/*
83 * static const struct pci_driver usb_3_driver __pci_driver = {
84 * .ops = &usb_ops,
85 * .vendor = PCI_VENDOR_ID_AMD,
86 * .device = PCI_DEVICE_ID_ATI_HUDSON_USB_19_0,
87 * };
88 * static const struct pci_driver usb_4_driver __pci_driver = {
89 * .ops = &usb_ops,
90 * .vendor = PCI_VENDOR_ID_AMD,
91 * .device = PCI_DEVICE_ID_ATI_HUDSON_USB_19_1,
92 * };
93 */
94
95static const struct pci_driver usb_4_driver __pci_driver = {
96 .ops = &usb_ops,
97 .vendor = PCI_VENDOR_ID_AMD,
98 .device = PCI_DEVICE_ID_ATI_SB900_USB_20_5,
99};
100
101/*
102static struct device_operations usb_ops2 = {
103 .read_resources = pci_dev_read_resources,
104 .set_resources = usb_set_resources,
105 .enable_resources = pci_dev_enable_resources,
106 .init = usb_init2,
107 .scan_bus = 0,
108 .ops_pci = &lops_pci,
109};
110*/
111/*
112static const struct pci_driver usb_5_driver __pci_driver = {
113 .ops = &usb_ops2,
114 .vendor = PCI_VENDOR_ID_AMD,
115 .device = PCI_DEVICE_ID_ATI_HUDSON_USB_18_2,
116};
117*/
118/*
119 * static const struct pci_driver usb_5_driver __pci_driver = {
120 * .ops = &usb_ops2,
121 * .vendor = PCI_VENDOR_ID_AMD,
122 * .device = PCI_DEVICE_ID_ATI_HUDSON_USB_19_2,
123 * };
124 */