19ff3703c903351e8a63a1c51735fc4425e2ac63
[coreboot.git] / src / southbridge / broadcom / bcm5780 / bcm5780_nic.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
12
13 static void nic_init(struct device *dev)
14 {
15
16 #if CONFIG_PCI_ROM_RUN == 1
17         pci_dev_init(dev);// it will init option rom
18 #endif
19
20 }
21
22 static void lpci_set_subsystem(device_t dev, unsigned vendor, unsigned device)
23 {
24         pci_write_config32(dev, 0x40,
25                 ((device & 0xffff) << 16) | (vendor & 0xffff));
26 }
27
28 static struct pci_operations lops_pci = {
29         .set_subsystem = lpci_set_subsystem,
30 };
31
32 static struct device_operations nic_ops  = {
33         .read_resources   = pci_dev_read_resources,
34         .set_resources    = pci_dev_set_resources,
35         .enable_resources = pci_dev_enable_resources,
36         .init             = nic_init,
37         .scan_bus         = 0,
38         .ops_pci          = &lops_pci,
39 };
40 static const struct pci_driver nic_driver __pci_driver = {
41         .ops    = &nic_ops,
42         .vendor = PCI_VENDOR_ID_BROADCOM,
43         .device = PCI_DEVICE_ID_BROADCOM_BCM5780_NIC,
44 };
45 static const struct pci_driver nic1_driver __pci_driver = {
46         .ops    = &nic_ops,
47         .vendor = PCI_VENDOR_ID_BROADCOM,
48         .device = PCI_DEVICE_ID_BROADCOM_BCM5780_NIC1,
49 };