Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mtd: atmel_nand: replace cpu_is_at32ap7000() with a nand platform data

The nand driver use cpu_is_at32ap7000() macro for a workaround. For the
multi-platform support, we will remove this cpu_is_xxx() macro.

This patch adds a boolean variable need_reset_workaround in structure
atmel_nand_data. Using this variable we can remove cpu_is_at32ap7000() macro.

Hans-Christian: Feel free to push this through the mtd tree, if they won't
accept it I'm working on getting my workflow up on the linux-avr32.git tree.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
Acked-by: Hans-Christian Egtvedt <egtvedt@samfundet.no>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>

authored by

Josh Wu and committed by
David Woodhouse
71b94e2e d1cb556c

+12 -7
+3
arch/avr32/mach-at32ap/at32ap700x.c
··· 1983 1983 ARRAY_SIZE(smc_cs3_resource))) 1984 1984 goto fail; 1985 1985 1986 + /* For at32ap7000, we use the reset workaround for nand driver */ 1987 + data->need_reset_workaround = true; 1988 + 1986 1989 if (platform_device_add_data(pdev, data, 1987 1990 sizeof(struct atmel_nand_data))) 1988 1991 goto fail;
+6 -7
drivers/mtd/nand/atmel_nand.c
··· 1174 1174 * Workaround: Reset the parity registers before reading the 1175 1175 * actual data. 1176 1176 */ 1177 - if (cpu_is_at32ap7000()) { 1178 - struct atmel_nand_host *host = chip->priv; 1177 + struct atmel_nand_host *host = chip->priv; 1178 + if (host->board.need_reset_workaround) 1179 1179 ecc_writel(host->ecc, CR, ATMEL_ECC_RST); 1180 - } 1181 1180 1182 1181 /* read the page */ 1183 1182 chip->read_buf(mtd, p, eccsize); ··· 1297 1298 */ 1298 1299 static void atmel_nand_hwctl(struct mtd_info *mtd, int mode) 1299 1300 { 1300 - if (cpu_is_at32ap7000()) { 1301 - struct nand_chip *nand_chip = mtd->priv; 1302 - struct atmel_nand_host *host = nand_chip->priv; 1301 + struct nand_chip *nand_chip = mtd->priv; 1302 + struct atmel_nand_host *host = nand_chip->priv; 1303 + 1304 + if (host->board.need_reset_workaround) 1303 1305 ecc_writel(host->ecc, CR, ATMEL_ECC_RST); 1304 - } 1305 1306 } 1306 1307 1307 1308 #if defined(CONFIG_OF)
+3
include/linux/platform_data/atmel.h
··· 71 71 u8 on_flash_bbt; /* bbt on flash */ 72 72 struct mtd_partition *parts; 73 73 unsigned int num_parts; 74 + 75 + /* default is false, only for at32ap7000 chip is true */ 76 + bool need_reset_workaround; 74 77 }; 75 78 76 79 /* Serial */