X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fmtd%2Fnand%2Fat91_nand.c;h=0adb287027a249409062c5ba6a46cadc717f50a8;hb=7f268a2ba7c884a239713696238dd4207a57dd9a;hp=414ceaecdb3a2058bbba13def192553ed40ce29f;hpb=37b05b17985ecc43a33e2a8cbdaa220115de4703;p=linux-2.6-omap-h63xx.git diff --git a/drivers/mtd/nand/at91_nand.c b/drivers/mtd/nand/at91_nand.c index 414ceaecdb3..0adb287027a 100644 --- a/drivers/mtd/nand/at91_nand.c +++ b/drivers/mtd/nand/at91_nand.c @@ -93,6 +93,24 @@ struct at91_nand_host { void __iomem *ecc; }; +/* + * Enable NAND. + */ +static void at91_nand_enable(struct at91_nand_host *host) +{ + if (host->board->enable_pin) + at91_set_gpio_value(host->board->enable_pin, 0); +} + +/* + * Disable NAND. + */ +static void at91_nand_disable(struct at91_nand_host *host) +{ + if (host->board->enable_pin) + at91_set_gpio_value(host->board->enable_pin, 1); +} + /* * Hardware specific access to control-lines */ @@ -101,11 +119,11 @@ static void at91_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl) struct nand_chip *nand_chip = mtd->priv; struct at91_nand_host *host = nand_chip->priv; - if (host->board->enable_pin && (ctrl & NAND_CTRL_CHANGE)) { + if (ctrl & NAND_CTRL_CHANGE) { if (ctrl & NAND_NCE) - at91_set_gpio_value(host->board->enable_pin, 0); + at91_nand_enable(host); else - at91_set_gpio_value(host->board->enable_pin, 1); + at91_nand_disable(host); } if (cmd == NAND_CMD_NONE) return; @@ -127,24 +145,6 @@ static int at91_nand_device_ready(struct mtd_info *mtd) return at91_get_gpio_value(host->board->rdy_pin); } -/* - * Enable NAND. - */ -static void at91_nand_enable(struct at91_nand_host *host) -{ - if (host->board->enable_pin) - at91_set_gpio_value(host->board->enable_pin, 0); -} - -/* - * Disable NAND. - */ -static void at91_nand_disable(struct at91_nand_host *host) -{ - if (host->board->enable_pin) - at91_set_gpio_value(host->board->enable_pin, 1); -} - /* * write oob for small pages */