From d7048f10ca3629bb19a8bacca29afc2854232c88 Mon Sep 17 00:00:00 2001 From: Mart Raudsepp Date: Mon, 9 Feb 2009 16:10:58 +0000 Subject: [PATCH] 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 Signed-off-by: Anti Sullin Acked-by: Ronald G. Minnich git-svn-id: svn://coreboot.org/repository/coreboot-v3@1125 f3766cd6-281f-0410-b1cd-43a5c92072e9 --- southbridge/amd/cs5536/cs5536.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/southbridge/amd/cs5536/cs5536.c b/southbridge/amd/cs5536/cs5536.c index 729cb7ee7f..5437937f8a 100644 --- a/southbridge/amd/cs5536/cs5536.c +++ b/southbridge/amd/cs5536/cs5536.c @@ -114,6 +114,26 @@ static void nand_phase2(struct device *dev) } } +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 @@ struct device_operations cs5536_nand = { .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 */