3 #include <arch/ioapic.h>
4 #include <device/device.h>
5 #include <device/pci.h>
6 #include <device/pci_ops.h>
7 #include <device/pci_ids.h>
8 #include <console/console.h>
11 static void nvram_on(struct device *dev)
14 volatile char *flash = (volatile unsigned char *)0xFFFc0000;
15 unsigned char id1, id2;
19 /* Enable writes to flash at top of memory */
20 pci_write_config8(dev, 0x52, 0xee);
22 /* Set positive decode on ROM */
23 /* Also, there is no apparent reason to turn off the devoce on the */
26 reg = pci_read_config8(dev, 0x5b);
27 reg |= 1 << 5; /* ROM Decode */
28 reg |= 1 << 3; /* Primary IDE decode */
29 reg |= 1 << 4; /* Secondary IDE decode */
31 pci_write_config8(dev, 0x5b, reg);
33 #if 0 // just to test if the flash is accessible!
34 *(flash + 0x555) = 0xaa;
35 *(flash + 0x2aa) = 0x55;
36 *(flash + 0x555) = 0x90;
38 id1 = *(volatile unsigned char *) flash;
39 id2 = *(volatile unsigned char *) (flash + 1);
43 printk(BIOS_DEBUG, "Flash device: MFGID %02x, DEVID %02x\n", id1, id2);
48 static void southbridge_init(struct device *dev)
50 printk(BIOS_SPEW, "cs5535: %s\n", __func__);
55 static void dump_south(struct device *dev)
59 for(i=0; i<256; i+=16) {
60 printk(BIOS_DEBUG, "0x%02x: ", i);
62 printk(BIOS_DEBUG, "%02x ", pci_read_config8(dev, i+j));
63 printk(BIOS_DEBUG, "\n");
68 static void southbridge_enable(struct device *dev)
70 printk(BIOS_SPEW, "%s: dev is %p\n", __func__, dev);
73 static void cs5535_read_resources(device_t dev)
77 pci_dev_read_resources(dev);
79 res = new_resource(dev, 1);
82 res->limit = 0xffffUL;
83 res->flags = IORESOURCE_IO | IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
85 res = new_resource(dev, 3); /* IOAPIC */
86 res->base = IO_APIC_ADDR;
87 res->size = 0x00001000;
88 res->flags = IORESOURCE_MEM | IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
91 static struct device_operations southbridge_ops = {
92 .read_resources = cs5535_read_resources,
93 .set_resources = pci_dev_set_resources,
94 .enable_resources = pci_dev_enable_resources,
95 .init = southbridge_init,
96 .enable = southbridge_enable,
97 .scan_bus = scan_static_bus,
100 static const struct pci_driver cs5535_pci_driver __pci_driver = {
101 .ops = &southbridge_ops,
102 .vendor = PCI_VENDOR_ID_NS,
103 .device = PCI_DEVICE_ID_NS_CS5535
106 struct chip_operations southbridge_amd_cs5535_ops = {
107 CHIP_NAME("AMD Geode CS5535 Southbridge")
108 /* This is only called when this device is listed in the
109 * static device tree.
111 .enable_dev = southbridge_enable,