82263e8ec55eb1838c7f3ab8892860ccfc7bfa7b
[coreboot.git] / src / southbridge / broadcom / bcm5785 / bcm5785_ide.c
1 /*
2  * Copyright  2005 AMD
3  *  by yinghai.lu@amd.com
4  */
5
6 #include <console/console.h>
7 #include <device/device.h>
8 #include <device/pci.h>
9 #include <device/pci_ids.h>
10 #include <device/pci_ops.h>
11 #include "bcm5785.h"
12
13 static void bcm5785_ide_read_resources(device_t dev)
14 {
15         struct resource *res;
16         unsigned long index;
17
18         /* Get the normal pci resources of this device */
19         pci_dev_read_resources(dev);
20
21         /* BAR */
22         pci_get_resource(dev, 0x64);
23
24         compact_resources(dev);
25 }
26
27 static void ide_init(struct device *dev)
28 {
29         uint16_t word;
30
31
32 }
33
34 static void lpci_set_subsystem(device_t dev, unsigned vendor, unsigned device)
35 {
36         pci_write_config32(dev, 0x40,
37                 ((device & 0xffff) << 16) | (vendor & 0xffff));
38 }
39 static struct pci_operations lops_pci = {
40         .set_subsystem = lpci_set_subsystem,
41 };
42
43 static struct device_operations ide_ops  = {
44         .read_resources   = bcm5785_ide_read_resources,
45         .set_resources    = pci_dev_set_resources,
46         .enable_resources = pci_dev_enable_resources,
47         .init             = ide_init,
48         .scan_bus         = 0,
49 //      .enable           = bcm5785_enable,
50         .ops_pci          = &lops_pci,
51 };
52
53 static const struct pci_driver ide_driver __pci_driver = {
54         .ops    = &ide_ops,
55         .vendor = PCI_VENDOR_ID_SERVERWORKS,
56         .device = PCI_DEVICE_ID_SERVERWORKS_BCM5785_IDE,
57 };
58