Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Alexandre Pereira da Silva and committed by
David Woodhouse
df63fe76 1c7b874d

+7 -4
+7 -4
drivers/mtd/nand/lpc32xx_slc.c
··· 192 192 uint32_t rhold; 193 193 uint32_t rsetup; 194 194 bool use_bbt; 195 - unsigned wp_gpio; 195 + int wp_gpio; 196 196 struct mtd_partition *parts; 197 197 unsigned num_parts; 198 198 }; ··· 295 295 */ 296 296 static 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 /* ··· 304 303 */ 305 304 static void lpc32xx_wp_disable(struct lpc32xx_nand_host *host) 306 305 { 307 - gpio_set_value(host->ncfg->wp_gpio, 1); 306 + if (gpio_is_valid(host->ncfg->wp_gpio)) 307 + gpio_set_value(host->ncfg->wp_gpio, 1); 308 308 } 309 309 310 310 /* ··· 821 819 dev_err(&pdev->dev, "Missing platform data\n"); 822 820 return -ENOENT; 823 821 } 824 - if (gpio_request(host->ncfg->wp_gpio, "NAND WP")) { 822 + if (gpio_is_valid(host->ncfg->wp_gpio) && 823 + gpio_request(host->ncfg->wp_gpio, "NAND WP")) { 825 824 dev_err(&pdev->dev, "GPIO not available\n"); 826 825 return -EBUSY; 827 826 }