Commit df63fe76 authored by Alexandre Pereira da Silva's avatar Alexandre Pereira da Silva Committed by David Woodhouse
Browse files

mtd: lpc32xx_slc: Make wp gpio optional



This patch supports missing wp gpio.

Signed-off-by: default avatarAlexandre Pereira da Silva <aletes.xgr@gmail.com>
Signed-off-by: default avatarRoland Stigge <stigge@antcom.de>
Signed-off-by: default avatarArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
parent 1c7b874d
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -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,6 +295,7 @@ static int lpc32xx_nand_device_ready(struct mtd_info *mtd)
 */
static void lpc32xx_wp_enable(struct lpc32xx_nand_host *host)
{
	if (gpio_is_valid(host->ncfg->wp_gpio))
		gpio_set_value(host->ncfg->wp_gpio, 0);
}

@@ -303,6 +304,7 @@ static void lpc32xx_wp_enable(struct lpc32xx_nand_host *host)
 */
static void lpc32xx_wp_disable(struct lpc32xx_nand_host *host)
{
	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;
	}