Commit 71b94e2e authored by Josh Wu's avatar Josh Wu Committed by David Woodhouse

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: default avatarJosh Wu <josh.wu@atmel.com>
Acked-by: default avatarHans-Christian Egtvedt <egtvedt@samfundet.no>
Signed-off-by: default avatarArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent d1cb556c
...@@ -1983,6 +1983,9 @@ at32_add_device_nand(unsigned int id, struct atmel_nand_data *data) ...@@ -1983,6 +1983,9 @@ at32_add_device_nand(unsigned int id, struct atmel_nand_data *data)
ARRAY_SIZE(smc_cs3_resource))) ARRAY_SIZE(smc_cs3_resource)))
goto fail; goto fail;
/* For at32ap7000, we use the reset workaround for nand driver */
data->need_reset_workaround = true;
if (platform_device_add_data(pdev, data, if (platform_device_add_data(pdev, data,
sizeof(struct atmel_nand_data))) sizeof(struct atmel_nand_data)))
goto fail; goto fail;
......
...@@ -1174,10 +1174,9 @@ static int atmel_nand_read_page(struct mtd_info *mtd, struct nand_chip *chip, ...@@ -1174,10 +1174,9 @@ static int atmel_nand_read_page(struct mtd_info *mtd, struct nand_chip *chip,
* Workaround: Reset the parity registers before reading the * Workaround: Reset the parity registers before reading the
* actual data. * actual data.
*/ */
if (cpu_is_at32ap7000()) {
struct atmel_nand_host *host = chip->priv; struct atmel_nand_host *host = chip->priv;
if (host->board.need_reset_workaround)
ecc_writel(host->ecc, CR, ATMEL_ECC_RST); ecc_writel(host->ecc, CR, ATMEL_ECC_RST);
}
/* read the page */ /* read the page */
chip->read_buf(mtd, p, eccsize); chip->read_buf(mtd, p, eccsize);
...@@ -1298,11 +1297,11 @@ static int atmel_nand_correct(struct mtd_info *mtd, u_char *dat, ...@@ -1298,11 +1297,11 @@ static int atmel_nand_correct(struct mtd_info *mtd, u_char *dat,
*/ */
static void atmel_nand_hwctl(struct mtd_info *mtd, int mode) static void atmel_nand_hwctl(struct mtd_info *mtd, int mode)
{ {
if (cpu_is_at32ap7000()) {
struct nand_chip *nand_chip = mtd->priv; struct nand_chip *nand_chip = mtd->priv;
struct atmel_nand_host *host = nand_chip->priv; struct atmel_nand_host *host = nand_chip->priv;
if (host->board.need_reset_workaround)
ecc_writel(host->ecc, CR, ATMEL_ECC_RST); ecc_writel(host->ecc, CR, ATMEL_ECC_RST);
}
} }
#if defined(CONFIG_OF) #if defined(CONFIG_OF)
......
...@@ -71,6 +71,9 @@ struct atmel_nand_data { ...@@ -71,6 +71,9 @@ struct atmel_nand_data {
u8 on_flash_bbt; /* bbt on flash */ u8 on_flash_bbt; /* bbt on flash */
struct mtd_partition *parts; struct mtd_partition *parts;
unsigned int num_parts; unsigned int num_parts;
/* default is false, only for at32ap7000 chip is true */
bool need_reset_workaround;
}; };
/* Serial */ /* Serial */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment