mtd: lpc32xx_slc: Make wp gpio optional
Linux-MTD Mailing List
linux-mtd at lists.infradead.org
Fri Jul 6 13:59:08 EDT 2012
Gitweb: http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=df63fe7657d75424f58b41ac079ed8bc4b4676fb
Commit: df63fe7657d75424f58b41ac079ed8bc4b4676fb
Parent: 1c7b874d33b463f7150b1ab4617f000af9b327fd
Author: Alexandre Pereira da Silva <aletes.xgr at gmail.com>
AuthorDate: Wed Jun 27 17:51:13 2012 +0200
Committer: David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Fri Jul 6 18:24:56 2012 +0100
mtd: lpc32xx_slc: Make wp gpio optional
This patch supports missing wp gpio.
Signed-off-by: Alexandre Pereira da Silva <aletes.xgr at gmail.com>
Signed-off-by: Roland Stigge <stigge at antcom.de>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy at linux.intel.com>
---
drivers/mtd/nand/lpc32xx_slc.c | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/mtd/nand/lpc32xx_slc.c b/drivers/mtd/nand/lpc32xx_slc.c
index 1d837b9..1577a9b 100644
--- a/drivers/mtd/nand/lpc32xx_slc.c
+++ b/drivers/mtd/nand/lpc32xx_slc.c
@@ -192,7 +192,7 @@ struct lpc32xx_nand_cfg_slc {
uint32_t rhold;
uint32_t rsetup;
bool use_bbt;
- unsigned wp_gpio;
+ int wp_gpio;
struct mtd_partition *parts;
unsigned num_parts;
};
@@ -295,7 +295,8 @@ static int lpc32xx_nand_device_ready(struct mtd_info *mtd)
*/
static void lpc32xx_wp_enable(struct lpc32xx_nand_host *host)
{
- gpio_set_value(host->ncfg->wp_gpio, 0);
+ if (gpio_is_valid(host->ncfg->wp_gpio))
+ gpio_set_value(host->ncfg->wp_gpio, 0);
}
/*
@@ -303,7 +304,8 @@ static void lpc32xx_wp_enable(struct lpc32xx_nand_host *host)
*/
static void lpc32xx_wp_disable(struct lpc32xx_nand_host *host)
{
- gpio_set_value(host->ncfg->wp_gpio, 1);
+ if (gpio_is_valid(host->ncfg->wp_gpio))
+ gpio_set_value(host->ncfg->wp_gpio, 1);
}
/*
@@ -819,7 +821,8 @@ static int __devinit lpc32xx_nand_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "Missing platform data\n");
return -ENOENT;
}
- if (gpio_request(host->ncfg->wp_gpio, "NAND WP")) {
+ if (gpio_is_valid(host->ncfg->wp_gpio) &&
+ gpio_request(host->ncfg->wp_gpio, "NAND WP")) {
dev_err(&pdev->dev, "GPIO not available\n");
return -EBUSY;
}
More information about the linux-mtd-cvs
mailing list