3 #include <device/device.h>
4 #include <device/pci.h>
5 #include <device/pci_ops.h>
6 #include <device/pci_ids.h>
7 #include <console/console.h>
10 static void nvram_on(struct device *dev)
13 volatile char *flash = (volatile unsigned char *)0xFFFc0000;
14 unsigned char id1, id2;
18 /* Enable writes to flash at top of memory */
19 pci_write_config8(dev, 0x52, 0xee);
21 /* Set positive decode on ROM */
22 /* Also, there is no apparent reason to turn off the devoce on the */
25 reg = pci_read_config8(dev, 0x5b);
26 reg |= 1 << 5; /* ROM Decode */
27 reg |= 1 << 3; /* Primary IDE decode */
28 reg |= 1 << 4; /* Secondary IDE decode */
30 pci_write_config8(dev, 0x5b, reg);
32 #if 0 // just to test if the flash is accessible!
33 *(flash + 0x555) = 0xaa;
34 *(flash + 0x2aa) = 0x55;
35 *(flash + 0x555) = 0x90;
37 id1 = *(volatile unsigned char *) flash;
38 id2 = *(volatile unsigned char *) (flash + 1);
42 printk(BIOS_DEBUG, "Flash device: MFGID %02x, DEVID %02x\n", id1, id2);
47 static void southbridge_init(struct device *dev)
49 printk(BIOS_SPEW, "cs5535: %s\n", __func__);
54 static void dump_south(struct device *dev)
58 for(i=0; i<256; i+=16) {
59 printk(BIOS_DEBUG, "0x%02x: ", i);
61 printk(BIOS_DEBUG, "%02x ", pci_read_config8(dev, i+j));
62 printk(BIOS_DEBUG, "\n");
67 static void southbridge_enable(struct device *dev)
69 printk(BIOS_SPEW, "%s: dev is %p\n", __func__, dev);
72 static void cs5535_read_resources(device_t dev)
76 pci_dev_read_resources(dev);
78 res = new_resource(dev, 1);
81 res->limit = 0xffffUL;
82 res->flags = IORESOURCE_IO | IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
84 res = new_resource(dev, 3); /* IOAPIC */
85 res->base = 0xfec00000;
86 res->size = 0x00001000;
87 res->flags = IORESOURCE_MEM | IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
90 static struct device_operations southbridge_ops = {
91 .read_resources = cs5535_read_resources,
92 .set_resources = pci_dev_set_resources,
93 .enable_resources = pci_dev_enable_resources,
94 .init = southbridge_init,
95 .enable = southbridge_enable,
96 .scan_bus = scan_static_bus,
99 static const struct pci_driver cs5535_pci_driver __pci_driver = {
100 .ops = &southbridge_ops,
101 .vendor = PCI_VENDOR_ID_NS,
102 .device = PCI_DEVICE_ID_NS_CS5535
105 struct chip_operations southbridge_amd_cs5535_ops = {
106 CHIP_NAME("AMD Geode CS5535 Southbridge")
107 /* This is only called when this device is listed in the
108 * static device tree.
110 .enable_dev = southbridge_enable,