Author: mraudsepp
Date: 2009-02-09 17:10:58 +0100 (Mon, 09 Feb 2009)
New Revision: 1125

Modified:
   coreboot-v3/southbridge/amd/cs5536/cs5536.c
Log:
cs5536: Fix NAND Flash setup.

A NAND device may never be mapped above 0xEFFFFFFF, as these addresses never 
reach
the NAND controller. Only NAND controller, as the only DIVIL component that is
allowed to be memory mapped, is affected - other Geode LX and CS5536 peripherals
(that are separate GLIU devices outside DIVIL component) can use addresses above
that limit (see in-code comment for details).

In combination with a new VSA2 version 1.02 or newer, this makes NAND flash
finally work in coreboot v3.

Signed-off-by: Mart Raudsepp <[email protected]>
Signed-off-by: Anti Sullin <[email protected]>
Acked-by: Ronald G. Minnich <[email protected]>

Modified: coreboot-v3/southbridge/amd/cs5536/cs5536.c
===================================================================
--- coreboot-v3/southbridge/amd/cs5536/cs5536.c 2009-02-09 13:40:10 UTC (rev 
1124)
+++ coreboot-v3/southbridge/amd/cs5536/cs5536.c 2009-02-09 16:10:58 UTC (rev 
1125)
@@ -114,6 +114,26 @@
        }
 }
 
+static void nand_read_resources(struct device *dev)
+{
+       pci_dev_read_resources(dev);
+
+       /* All memory accesses in the range of 0xF0000000 - 0xFFFFFFFF routed to
+        * Diverse Integration Logic (DIVIL) get always sent to the device 
inside
+        * DIVIL as set in DIVIL_BALL_OPTS PRI_BOOT_LOC and SEC_BOOT_LOC bits
+        * (see CS5536 data book chapter 6.6.2.10 DIVIL_BALL_OPTS PRI_BOOT_LOC
+        * description).
+        * The virtual PCI address limit test gives us a false upper limit of
+        * 0xFFFFFFFF for this device, but we do not want NAND Flash to be using
+        * memory addresses 0xF0000000 and above as those accesses would end up
+        * somewhere else instead. Therefore if VSA2 gave us a MMIO resource for
+        * NAND Flash, patch this (fixed) resources higher bound to 0xEFFFFFFF.
+        */
+       if ((dev->resources >= 1) && (dev->resource[0].flags & IORESOURCE_MEM) 
&&
+               (dev->resource[0].limit > 0xefffffff))
+               dev->resource[0].limit = 0xefffffff;
+}
+
 /**
  * Power button setup.
  *
@@ -737,7 +757,7 @@
        .constructor             = default_device_constructor,
        .phase2_fixup            = nand_phase2,
        .phase3_scan             = 0,
-       .phase4_read_resources   = pci_dev_read_resources,
+       .phase4_read_resources   = nand_read_resources,
        .phase4_set_resources    = pci_set_resources,
        .phase5_enable_resources = pci_dev_enable_resources,
        .phase6_init             = 0, /* No Option ROMs */


--
coreboot mailing list: [email protected]
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to