aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandre Pereira da Silva <aletes.xgr@gmail.com>2012-06-27 11:51:13 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2012-07-06 13:24:56 -0400
commitdf63fe7657d75424f58b41ac079ed8bc4b4676fb (patch)
tree6724489e5c00d99727d3535fc8948f39aeaa9eb1
parent1c7b874d33b463f7150b1ab4617f000af9b327fd (diff)
mtd: lpc32xx_slc: Make wp gpio optional
This patch supports missing wp gpio. Signed-off-by: Alexandre Pereira da Silva <aletes.xgr@gmail.com> Signed-off-by: Roland Stigge <stigge@antcom.de> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
-rw-r--r--drivers/mtd/nand/lpc32xx_slc.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/mtd/nand/lpc32xx_slc.c b/drivers/mtd/nand/lpc32xx_slc.c
index 1d837b92ac79..1577a9b0d0c2 100644
--- a/drivers/mtd/nand/lpc32xx_slc.c
+++ b/drivers/mtd/nand/lpc32xx_slc.c
@@ -192,7 +192,7 @@ struct lpc32xx_nand_cfg_slc {
192 uint32_t rhold; 192 uint32_t rhold;
193 uint32_t rsetup; 193 uint32_t rsetup;
194 bool use_bbt; 194 bool use_bbt;
195 unsigned wp_gpio; 195 int wp_gpio;
196 struct mtd_partition *parts; 196 struct mtd_partition *parts;
197 unsigned num_parts; 197 unsigned num_parts;
198}; 198};
@@ -295,7 +295,8 @@ static int lpc32xx_nand_device_ready(struct mtd_info *mtd)
295 */ 295 */
296static void lpc32xx_wp_enable(struct lpc32xx_nand_host *host) 296static void lpc32xx_wp_enable(struct lpc32xx_nand_host *host)
297{ 297{
298 gpio_set_value(host->ncfg->wp_gpio, 0); 298 if (gpio_is_valid(host->ncfg->wp_gpio))
299 gpio_set_value(host->ncfg->wp_gpio, 0);
299} 300}
300 301
301/* 302/*
@@ -303,7 +304,8 @@ static void lpc32xx_wp_enable(struct lpc32xx_nand_host *host)
303 */ 304 */
304static void lpc32xx_wp_disable(struct lpc32xx_nand_host *host) 305static void lpc32xx_wp_disable(struct lpc32xx_nand_host *host)
305{ 306{
306 gpio_set_value(host->ncfg->wp_gpio, 1); 307 if (gpio_is_valid(host->ncfg->wp_gpio))
308 gpio_set_value(host->ncfg->wp_gpio, 1);
307} 309}
308 310
309/* 311/*
@@ -819,7 +821,8 @@ static int __devinit lpc32xx_nand_probe(struct platform_device *pdev)
819 dev_err(&pdev->dev, "Missing platform data\n"); 821 dev_err(&pdev->dev, "Missing platform data\n");
820 return -ENOENT; 822 return -ENOENT;
821 } 823 }
822 if (gpio_request(host->ncfg->wp_gpio, "NAND WP")) { 824 if (gpio_is_valid(host->ncfg->wp_gpio) &&
825 gpio_request(host->ncfg->wp_gpio, "NAND WP")) {
823 dev_err(&pdev->dev, "GPIO not available\n"); 826 dev_err(&pdev->dev, "GPIO not available\n");
824 return -EBUSY; 827 return -EBUSY;
825 } 828 }