aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Wu <josh.wu@atmel.com>2013-05-09 03:34:54 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2013-08-05 15:55:42 -0400
commit71b94e2e866aa35f40945d9e820fc3214b792d1f (patch)
tree2747eb61ceeeda751671eaa3c1513eac0d386e19
parentd1cb556c3feb238f11dc47f8fa56df7880022908 (diff)
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>
-rw-r--r--arch/avr32/mach-at32ap/at32ap700x.c3
-rw-r--r--drivers/mtd/nand/atmel_nand.c13
-rw-r--r--include/linux/platform_data/atmel.h3
3 files changed, 12 insertions, 7 deletions
diff --git a/arch/avr32/mach-at32ap/at32ap700x.c b/arch/avr32/mach-at32ap/at32ap700x.c
index 7f8759a8a92a..a68f3cf7c3c1 100644
--- a/arch/avr32/mach-at32ap/at32ap700x.c
+++ b/arch/avr32/mach-at32ap/at32ap700x.c
@@ -1983,6 +1983,9 @@ at32_add_device_nand(unsigned int id, struct atmel_nand_data *data)
1983 ARRAY_SIZE(smc_cs3_resource))) 1983 ARRAY_SIZE(smc_cs3_resource)))
1984 goto fail; 1984 goto fail;
1985 1985
1986 /* For at32ap7000, we use the reset workaround for nand driver */
1987 data->need_reset_workaround = true;
1988
1986 if (platform_device_add_data(pdev, data, 1989 if (platform_device_add_data(pdev, data,
1987 sizeof(struct atmel_nand_data))) 1990 sizeof(struct atmel_nand_data)))
1988 goto fail; 1991 goto fail;
diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c
index 2d23d2929438..7bf912b5b969 100644
--- a/drivers/mtd/nand/atmel_nand.c
+++ b/drivers/mtd/nand/atmel_nand.c
@@ -1174,10 +1174,9 @@ static int atmel_nand_read_page(struct mtd_info *mtd, struct nand_chip *chip,
1174 * Workaround: Reset the parity registers before reading the 1174 * Workaround: Reset the parity registers before reading the
1175 * actual data. 1175 * actual data.
1176 */ 1176 */
1177 if (cpu_is_at32ap7000()) { 1177 struct atmel_nand_host *host = chip->priv;
1178 struct atmel_nand_host *host = chip->priv; 1178 if (host->board.need_reset_workaround)
1179 ecc_writel(host->ecc, CR, ATMEL_ECC_RST); 1179 ecc_writel(host->ecc, CR, ATMEL_ECC_RST);
1180 }
1181 1180
1182 /* read the page */ 1181 /* read the page */
1183 chip->read_buf(mtd, p, eccsize); 1182 chip->read_buf(mtd, p, eccsize);
@@ -1298,11 +1297,11 @@ static int atmel_nand_correct(struct mtd_info *mtd, u_char *dat,
1298 */ 1297 */
1299static void atmel_nand_hwctl(struct mtd_info *mtd, int mode) 1298static void atmel_nand_hwctl(struct mtd_info *mtd, int mode)
1300{ 1299{
1301 if (cpu_is_at32ap7000()) { 1300 struct nand_chip *nand_chip = mtd->priv;
1302 struct nand_chip *nand_chip = mtd->priv; 1301 struct atmel_nand_host *host = nand_chip->priv;
1303 struct atmel_nand_host *host = nand_chip->priv; 1302
1303 if (host->board.need_reset_workaround)
1304 ecc_writel(host->ecc, CR, ATMEL_ECC_RST); 1304 ecc_writel(host->ecc, CR, ATMEL_ECC_RST);
1305 }
1306} 1305}
1307 1306
1308#if defined(CONFIG_OF) 1307#if defined(CONFIG_OF)
diff --git a/include/linux/platform_data/atmel.h b/include/linux/platform_data/atmel.h
index 6a293b7fff3b..59f558d9b81e 100644
--- a/include/linux/platform_data/atmel.h
+++ b/include/linux/platform_data/atmel.h
@@ -71,6 +71,9 @@ struct atmel_nand_data {
71 u8 on_flash_bbt; /* bbt on flash */ 71 u8 on_flash_bbt; /* bbt on flash */
72 struct mtd_partition *parts; 72 struct mtd_partition *parts;
73 unsigned int num_parts; 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 /* Serial */ 79 /* Serial */