From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lubomir Rintel Date: Tue, 17 Nov 2020 22:00:00 +0100 Subject: [PATCH RFC 02/20] mtd: Allow building nand_spl_simple w/o SPL_NAND_ECC In-Reply-To: <20201117210018.751469-1-lkundrak@v3.sk> References: <20201117210018.751469-1-lkundrak@v3.sk> Message-ID: <20201117210018.751469-3-lkundrak@v3.sk> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de The Skytone Alpha 400 boards don't use ECC. It's probably and oversignt and certainly a bad idea, nevertheless enforcing ECC on existing boards would break boot. Sigh. Signed-off-by: Lubomir Rintel --- drivers/mtd/nand/raw/nand_spl_simple.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/nand/raw/nand_spl_simple.c b/drivers/mtd/nand/raw/nand_spl_simple.c index 09e053541a9..ea5bcaf3982 100644 --- a/drivers/mtd/nand/raw/nand_spl_simple.c +++ b/drivers/mtd/nand/raw/nand_spl_simple.c @@ -9,14 +9,16 @@ #include #include -static int nand_ecc_pos[] = CONFIG_SYS_NAND_ECCPOS; static struct mtd_info *mtd; static struct nand_chip nand_chip; +#if IS_ENABLED(CONFIG_SPL_NAND_ECC) +static int nand_ecc_pos[] = CONFIG_SYS_NAND_ECCPOS; + #define ECCSTEPS (CONFIG_SYS_NAND_PAGE_SIZE / \ CONFIG_SYS_NAND_ECCSIZE) #define ECCTOTAL (ECCSTEPS * CONFIG_SYS_NAND_ECCBYTES) - +#endif #if (CONFIG_SYS_NAND_PAGE_SIZE <= 512) /* @@ -166,7 +168,7 @@ static int nand_read_page(int block, int page, uchar *dst) return 0; } -#else +#elif IS_ENABLED(CONFIG_SPL_NAND_ECC) static int nand_read_page(int block, int page, void *dst) { struct nand_chip *this = mtd_to_nand(mtd); @@ -206,6 +208,16 @@ static int nand_read_page(int block, int page, void *dst) return 0; } +#else +static int nand_read_page(int block, int page, void *dst) +{ + struct nand_chip *this = mtd_to_nand(mtd); + + nand_command(block, page, 0, NAND_CMD_READ0); + this->read_buf(mtd, dst, CONFIG_SYS_NAND_PAGE_SIZE); + + return 0; +} #endif /* nand_init() - initialize data to make nand usable by SPL */ -- 2.28.0