From: oharboe at B. <oh...@ma...> - 2009-08-18 12:18:19
|
Author: oharboe Date: 2009-08-18 12:18:18 +0200 (Tue, 18 Aug 2009) New Revision: 2585 Modified: trunk/src/flash/davinci_nand.c Log: Piotr Ziecik <ko...@se...> Due to errors in chipselect management in davinci_nand driver OpenOCD was able to access only to chips attached to first EMIF chipselect. This patch fixes chipselect management code and allows OpenOCD to access to NAND devices attached to any EMIF CS line. Modified: trunk/src/flash/davinci_nand.c =================================================================== --- trunk/src/flash/davinci_nand.c 2009-08-16 12:08:35 UTC (rev 2584) +++ trunk/src/flash/davinci_nand.c 2009-08-18 10:18:18 UTC (rev 2585) @@ -365,7 +365,7 @@ struct davinci_nand *info = nand->controller_priv; target_t *target = info->target; const uint32_t fcr_addr = info->aemif + NANDFCR; - const uint32_t ecc1_addr = info->aemif + NANDFECC + info->chipsel; + const uint32_t ecc1_addr = info->aemif + NANDFECC + (4 * info->chipsel); uint32_t fcr, ecc1; /* Write contiguous ECC bytes starting at specified offset. @@ -676,11 +676,11 @@ || aemif == 0x01e10000 /* dm335, dm355 */ || aemif == 0x01d10000 /* dm365 */ ) { - if (chip < 0x0200000 || chip >= 0x0a000000) { + if (chip < 0x02000000 || chip >= 0x0a000000) { LOG_ERROR("NAND address %08lx out of range?", chip); goto fail; } - chipsel = (chip - 0x02000000) >> 21; + chipsel = (chip - 0x02000000) >> 25; } else { LOG_ERROR("unrecognized AEMIF controller address %08lx", aemif); goto fail; |