2554fd0c5e1c9f8518df64bab70c003fe5ca229b
[coreboot.git] / src / southbridge / amd / amd8111 / amd8111_smbus.c
1 /*
2  * (C) 2004 Linux Networx
3  */
4 #include <console/console.h>
5 #include <device/device.h>
6 #include <device/pci.h>
7 #include <device/pci_ids.h>
8 #include <device/pci_ops.h>
9 #include <device/smbus.h>
10 #include <arch/io.h>
11 #include "amd8111.h"
12
13
14 static void lpci_set_subsystem(device_t dev, unsigned vendor, unsigned device)
15 {
16         pci_write_config32(dev, 0x44, 
17                 ((device & 0xffff) << 16) | (vendor & 0xffff));
18 }
19
20 static struct smbus_bus_operations lops_smbus_bus = {
21         /* I haven't seen the 2.0 SMBUS controller used yet. */
22 };
23 static struct pci_operations lops_pci = {
24         .set_subsystem = lpci_set_subsystem,
25 };
26 static struct device_operations smbus_ops = {
27         .read_resources   = pci_dev_read_resources,
28         .set_resources    = pci_dev_set_resources,
29         .enable_resources = pci_dev_enable_resources,
30         .init             = 0,
31         .scan_bus         = scan_static_bus,
32         .enable           = amd8111_enable,
33         .ops_pci          = &lops_pci,
34         .ops_smbus_bus    = &lops_smbus_bus,
35 };
36
37 static const struct pci_driver smbus_driver __pci_driver = {
38         .ops = &smbus_ops,
39         .vendor = PCI_VENDOR_ID_AMD,
40         .device = PCI_DEVICE_ID_AMD_8111_SMB,
41 };