Eric Biederman | dbec2d4 | 2004-10-21 10:44:08 +0000 | [diff] [blame] | 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> |
Eric Biederman | dbec2d4 | 2004-10-21 10:44:08 +0000 | [diff] [blame] | 9 | #include <device/smbus.h> |
Eric Biederman | 5268557 | 2003-05-19 19:16:21 +0000 | [diff] [blame] | 10 | #include <arch/io.h> |
Eric Biederman | dbec2d4 | 2004-10-21 10:44:08 +0000 | [diff] [blame] | 11 | #include "amd8111.h" |
Eric Biederman | 5268557 | 2003-05-19 19:16:21 +0000 | [diff] [blame] | 12 | |
Eric Biederman | 5268557 | 2003-05-19 19:16:21 +0000 | [diff] [blame] | 13 | |
Eric Biederman | dbec2d4 | 2004-10-21 10:44:08 +0000 | [diff] [blame] | 14 | static void lpci_set_subsystem(device_t dev, unsigned vendor, unsigned device) |
Eric Biederman | 5268557 | 2003-05-19 19:16:21 +0000 | [diff] [blame] | 15 | { |
Stefan Reinauer | 14e2277 | 2010-04-27 06:56:47 +0000 | [diff] [blame] | 16 | pci_write_config32(dev, 0x44, |
Eric Biederman | dbec2d4 | 2004-10-21 10:44:08 +0000 | [diff] [blame] | 17 | ((device & 0xffff) << 16) | (vendor & 0xffff)); |
Eric Biederman | 5268557 | 2003-05-19 19:16:21 +0000 | [diff] [blame] | 18 | } |
| 19 | |
Eric Biederman | dbec2d4 | 2004-10-21 10:44:08 +0000 | [diff] [blame] | 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, |
Kyösti Mälkki | d0e212c | 2015-02-26 20:47:47 +0200 | [diff] [blame] | 31 | .scan_bus = scan_smbus, |
Eric Biederman | dbec2d4 | 2004-10-21 10:44:08 +0000 | [diff] [blame] | 32 | .enable = amd8111_enable, |
| 33 | .ops_pci = &lops_pci, |
| 34 | .ops_smbus_bus = &lops_smbus_bus, |
| 35 | }; |
Eric Biederman | 5268557 | 2003-05-19 19:16:21 +0000 | [diff] [blame] | 36 | |
Stefan Reinauer | f1cf1f7 | 2007-10-24 09:08:58 +0000 | [diff] [blame] | 37 | static const struct pci_driver smbus_driver __pci_driver = { |
Eric Biederman | dbec2d4 | 2004-10-21 10:44:08 +0000 | [diff] [blame] | 38 | .ops = &smbus_ops, |
| 39 | .vendor = PCI_VENDOR_ID_AMD, |
| 40 | .device = PCI_DEVICE_ID_AMD_8111_SMB, |
| 41 | }; |