Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1564436

[PATCH v2 11/14] mtd: nand: jz4740: Let the pinctrl driver configure the pins

From Paul Cercueil <paul@crapouillou.net>
Newsgroups linux.kernel
Subject [PATCH v2 11/14] mtd: nand: jz4740: Let the pinctrl driver configure the pins
Date 2017-01-22 16:00 +0100
Message-ID <t2rMD-20U-49@gated-at.bofh.it> (permalink)
References <t1iV4-Qv-5@gated-at.bofh.it> <t2rMB-20U-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Before, this NAND driver would set itself the configuration of the
chip-select pins for the various NAND banks.

Now that the JZ4740 and similar SoCs have a pinctrl driver, we rely on
the pins being properly configured before the driver probes.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 drivers/mtd/nand/jz4740_nand.c | 23 +----------------------
 1 file changed, 1 insertion(+), 22 deletions(-)

v2: No changes

diff --git a/drivers/mtd/nand/jz4740_nand.c b/drivers/mtd/nand/jz4740_nand.c
index 5551c36adbdf..0d06a1f07d82 100644
--- a/drivers/mtd/nand/jz4740_nand.c
+++ b/drivers/mtd/nand/jz4740_nand.c
@@ -25,7 +25,6 @@
 
 #include <linux/gpio.h>
 
-#include <asm/mach-jz4740/gpio.h>
 #include <asm/mach-jz4740/jz4740_nand.h>
 
 #define JZ_REG_NAND_CTRL	0x50
@@ -310,34 +309,20 @@ static int jz_nand_detect_bank(struct platform_device *pdev,
 			       uint8_t *nand_dev_id)
 {
 	int ret;
-	int gpio;
-	char gpio_name[9];
 	char res_name[6];
 	uint32_t ctrl;
 	struct nand_chip *chip = &nand->chip;
 	struct mtd_info *mtd = nand_to_mtd(chip);
 
-	/* Request GPIO port. */
-	gpio = JZ_GPIO_MEM_CS0 + bank - 1;
-	sprintf(gpio_name, "NAND CS%d", bank);
-	ret = gpio_request(gpio, gpio_name);
-	if (ret) {
-		dev_warn(&pdev->dev,
-			"Failed to request %s gpio %d: %d\n",
-			gpio_name, gpio, ret);
-		goto notfound_gpio;
-	}
-
 	/* Request I/O resource. */
 	sprintf(res_name, "bank%d", bank);
 	ret = jz_nand_ioremap_resource(pdev, res_name,
 					&nand->bank_mem[bank - 1],
 					&nand->bank_base[bank - 1]);
 	if (ret)
-		goto notfound_resource;
+		return ret;
 
 	/* Enable chip in bank. */
-	jz_gpio_set_function(gpio, JZ_GPIO_FUNC_MEM_CS0);
 	ctrl = readl(nand->base + JZ_REG_NAND_CTRL);
 	ctrl |= JZ_NAND_CTRL_ENABLE_CHIP(bank - 1);
 	writel(ctrl, nand->base + JZ_REG_NAND_CTRL);
@@ -377,12 +362,8 @@ static int jz_nand_detect_bank(struct platform_device *pdev,
 	dev_info(&pdev->dev, "No chip found on bank %i\n", bank);
 	ctrl &= ~(JZ_NAND_CTRL_ENABLE_CHIP(bank - 1));
 	writel(ctrl, nand->base + JZ_REG_NAND_CTRL);
-	jz_gpio_set_function(gpio, JZ_GPIO_FUNC_NONE);
 	jz_nand_iounmap_resource(nand->bank_mem[bank - 1],
 				 nand->bank_base[bank - 1]);
-notfound_resource:
-	gpio_free(gpio);
-notfound_gpio:
 	return ret;
 }
 
@@ -503,7 +484,6 @@ static int jz_nand_probe(struct platform_device *pdev)
 err_unclaim_banks:
 	while (chipnr--) {
 		unsigned char bank = nand->banks[chipnr];
-		gpio_free(JZ_GPIO_MEM_CS0 + bank - 1);
 		jz_nand_iounmap_resource(nand->bank_mem[bank - 1],
 					 nand->bank_base[bank - 1]);
 	}
@@ -530,7 +510,6 @@ static int jz_nand_remove(struct platform_device *pdev)
 		if (bank != 0) {
 			jz_nand_iounmap_resource(nand->bank_mem[bank - 1],
 						 nand->bank_base[bank - 1]);
-			gpio_free(JZ_GPIO_MEM_CS0 + bank - 1);
 		}
 	}
 
-- 
2.11.0

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/13] Ingenic JZ4740 / JZ4780 pinctrl driver Paul Cercueil <paul@crapouillou.net> - 2017-01-18 00:20 +0100
  [PATCH 04/13] MIPS: ingenic: Enable pinctrl for all ingenic SoCs Paul Cercueil <paul@crapouillou.net> - 2017-01-18 00:20 +0100
  [PATCH 10/13] mtd: nand: jz4740: Let the pinctrl driver configure the pins Paul Cercueil <paul@crapouillou.net> - 2017-01-18 00:20 +0100
    Re: [PATCH 10/13] mtd: nand: jz4740: Let the pinctrl driver  configure the pins Boris Brezillon <boris.brezillon@free-electrons.com> - 2017-01-27 18:40 +0100
  [PATCH 11/13] fbdev: jz4740-fb: Let the pinctrl driver configure the pins Paul Cercueil <paul@crapouillou.net> - 2017-01-18 00:20 +0100
  [PATCH 08/13] MIPS: JZ4780: CI20: Add pinctrl configuration for several drivers Paul Cercueil <paul@crapouillou.net> - 2017-01-18 00:20 +0100
  [PATCH 07/13] MIPS: JZ4740: Qi LB60: Add pinctrl configuration for several drivers Paul Cercueil <paul@crapouillou.net> - 2017-01-18 00:20 +0100
  [PATCH 03/13] pinctrl-jz4780: add a pinctrl driver for the Ingenic jz4780 SoC Paul Cercueil <paul@crapouillou.net> - 2017-01-18 00:20 +0100
  [PATCH 02/13] pinctrl-jz4740: add a pinctrl driver for the Ingenic jz4740 SoC Paul Cercueil <paul@crapouillou.net> - 2017-01-18 00:20 +0100
    Re: [PATCH 02/13] pinctrl-jz4740: add a pinctrl driver for the  Ingenic jz4740 SoC Linus Walleij <linus.walleij@linaro.org> - 2017-01-18 11:20 +0100
  [PATCH 13/13] MIPS: jz4740: Remove custom GPIO code Paul Cercueil <paul@crapouillou.net> - 2017-01-18 00:20 +0100
    Re: [PATCH 13/13] MIPS: jz4740: Remove custom GPIO code Thierry Reding <thierry.reding@gmail.com> - 2017-01-18 08:30 +0100
      Re: [PATCH 13/13] MIPS: jz4740: Remove custom GPIO code Paul Cercueil <paul@crapouillou.net> - 2017-01-19 12:30 +0100
    Re: [PATCH 13/13] MIPS: jz4740: Remove custom GPIO code Linus Walleij <linus.walleij@linaro.org> - 2017-01-19 10:10 +0100
      Re: [PATCH 13/13] MIPS: jz4740: Remove custom GPIO code Paul Cercueil <paul@crapouillou.net> - 2017-01-20 11:10 +0100
  [PATCH 05/13] MIPS: jz4740: DTS: Add node for the jz4740-pinctrl driver Paul Cercueil <paul@crapouillou.net> - 2017-01-18 00:20 +0100
    Re: [PATCH 05/13] MIPS: jz4740: DTS: Add node for the jz4740-pinctrl driver Linus Walleij <linus.walleij@linaro.org> - 2017-01-19 01:10 +0100
  [PATCH 09/13] mmc: jz4740: Let the pinctrl driver configure the pins Paul Cercueil <paul@crapouillou.net> - 2017-01-18 00:20 +0100
    Re: [PATCH 09/13] mmc: jz4740: Let the pinctrl driver configure the pins Ulf Hansson <ulf.hansson@linaro.org> - 2017-01-19 12:00 +0100
      Re: [PATCH 09/13] mmc: jz4740: Let the pinctrl driver configure the  pins Paul Cercueil <paul@crapouillou.net> - 2017-01-20 13:00 +0100
  Re: [PATCH 00/13] Ingenic JZ4740 / JZ4780 pinctrl driver Thierry Reding <thierry.reding@gmail.com> - 2017-01-18 08:20 +0100
    Re: [PATCH 00/13] Ingenic JZ4740 / JZ4780 pinctrl driver Paul Cercueil <paul@crapouillou.net> - 2017-01-19 12:20 +0100
      Re: [PATCH 00/13] Ingenic JZ4740 / JZ4780 pinctrl driver Linus Walleij <linus.walleij@linaro.org> - 2017-01-20 09:50 +0100
        Re: [PATCH 00/13] Ingenic JZ4740 / JZ4780 pinctrl driver Paul Cercueil <paul@crapouillou.net> - 2017-01-20 11:20 +0100
      [PATCH v2 09/14] MIPS: JZ4780: CI20: Add pinctrl configuration for several drivers Paul Cercueil <paul@crapouillou.net> - 2017-01-22 16:00 +0100
      [PATCH v2 10/14] mmc: jz4740: Let the pinctrl driver configure the pins Paul Cercueil <paul@crapouillou.net> - 2017-01-22 16:00 +0100
        Re: [PATCH v2 10/14] mmc: jz4740: Let the pinctrl driver configure  the pins Ulf Hansson <ulf.hansson@linaro.org> - 2017-01-23 11:50 +0100
      [PATCH v2 04/14] GPIO: Add gpio-ingenic driver Paul Cercueil <paul@crapouillou.net> - 2017-01-22 16:00 +0100
        [PATCH] GPIO: fix semicolon.cocci warnings kbuild test robot <lkp@intel.com> - 2017-01-22 19:00 +0100
        Re: [PATCH v2 04/14] GPIO: Add gpio-ingenic driver kbuild test robot <lkp@intel.com> - 2017-01-22 19:00 +0100
      [PATCH v2 06/14] MIPS: jz4740: DTS: Add nodes for ingenic pinctrl and gpio drivers Paul Cercueil <paul@crapouillou.net> - 2017-01-22 16:00 +0100
      [PATCH v2 03/14] pinctrl-ingenic: add a pinctrl driver for the Ingenic jz47xx SoCs Paul Cercueil <paul@crapouillou.net> - 2017-01-22 16:00 +0100
      [PATCH v2 08/14] MIPS: JZ4740: Qi LB60: Add pinctrl configuration for several drivers Paul Cercueil <paul@crapouillou.net> - 2017-01-22 16:00 +0100
      [PATCH v2 13/14] pwm: jz4740: Let the pinctrl driver configure the pins Paul Cercueil <paul@crapouillou.net> - 2017-01-22 16:00 +0100
      [PATCH v2 01/14] Documentation: dt/bindings: Document pinctrl-ingenic Paul Cercueil <paul@crapouillou.net> - 2017-01-22 16:00 +0100
        Re: [PATCH v2 01/14] Documentation: dt/bindings: Document pinctrl-ingenic Linus Walleij <linus.walleij@linaro.org> - 2017-01-27 13:00 +0100
          Re: [PATCH v2 01/14] Documentation: dt/bindings: Document  pinctrl-ingenic Paul Cercueil <paul@crapouillou.net> - 2017-01-27 16:40 +0100
      [PATCH v2 05/14] MIPS: ingenic: Enable pinctrl for all ingenic SoCs Paul Cercueil <paul@crapouillou.net> - 2017-01-22 16:00 +0100
      [PATCH v2 07/14] MIPS: jz4780: DTS: Add nodes for ingenic pinctrl and gpio drivers Paul Cercueil <paul@crapouillou.net> - 2017-01-22 16:00 +0100
      [PATCH v2 00/14] Ingenic JZ4740 / JZ4780 pinctrl driver Paul Cercueil <paul@crapouillou.net> - 2017-01-22 16:00 +0100
        [PATCH v2 14/14] MIPS: jz4740: Remove custom GPIO code Paul Cercueil <paul@crapouillou.net> - 2017-01-22 16:00 +0100
        [PATCH v2 02/14] Documentation: dt/bindings: Document pinctrl-gpio Paul Cercueil <paul@crapouillou.net> - 2017-01-22 16:00 +0100
        [PATCH v2 11/14] mtd: nand: jz4740: Let the pinctrl driver configure the pins Paul Cercueil <paul@crapouillou.net> - 2017-01-22 16:00 +0100
        [PATCH v2 12/14] fbdev: jz4740-fb: Let the pinctrl driver configure the pins Paul Cercueil <paul@crapouillou.net> - 2017-01-22 16:00 +0100
      [PATCH v3 00/14] Ingenic JZ4740 / JZ4780 pinctrl driver Paul Cercueil <paul@crapouillou.net> - 2017-01-25 20:00 +0100
        [PATCH v3 06/14] MIPS: jz4740: DTS: Add nodes for ingenic pinctrl and gpio drivers Paul Cercueil <paul@crapouillou.net> - 2017-01-25 20:00 +0100
        [PATCH v3 01/14] Documentation: dt/bindings: Document pinctrl-ingenic Paul Cercueil <paul@crapouillou.net> - 2017-01-25 20:00 +0100
        [PATCH v3 09/14] MIPS: JZ4780: CI20: Add pinctrl configuration for several drivers Paul Cercueil <paul@crapouillou.net> - 2017-01-25 20:00 +0100
        [PATCH v3 14/14] MIPS: jz4740: Remove custom GPIO code Paul Cercueil <paul@crapouillou.net> - 2017-01-25 20:00 +0100
        [PATCH v3 07/14] MIPS: jz4780: DTS: Add nodes for ingenic pinctrl and gpio drivers Paul Cercueil <paul@crapouillou.net> - 2017-01-25 20:00 +0100
        [PATCH v3 11/14] mtd: nand: jz4740: Let the pinctrl driver configure the pins Paul Cercueil <paul@crapouillou.net> - 2017-01-25 20:00 +0100
        [PATCH v3 05/14] MIPS: ingenic: Enable pinctrl for all ingenic SoCs Paul Cercueil <paul@crapouillou.net> - 2017-01-25 20:00 +0100
        [PATCH v3 08/14] MIPS: JZ4740: Qi LB60: Add pinctrl configuration for several drivers Paul Cercueil <paul@crapouillou.net> - 2017-01-25 20:00 +0100
        [PATCH v3 13/14] pwm: jz4740: Let the pinctrl driver configure the pins Paul Cercueil <paul@crapouillou.net> - 2017-01-25 20:00 +0100
        [PATCH v3 02/14] Documentation: dt/bindings: Document pinctrl-gpio Paul Cercueil <paul@crapouillou.net> - 2017-01-25 20:00 +0100
        [PATCH v3 10/14] mmc: jz4740: Let the pinctrl driver configure the pins Paul Cercueil <paul@crapouillou.net> - 2017-01-25 20:00 +0100
          Re: [PATCH v3 10/14] mmc: jz4740: Let the pinctrl driver configure  the pins kbuild test robot <lkp@intel.com> - 2017-01-26 07:20 +0100
            Re: [PATCH v3 10/14] mmc: jz4740: Let the pinctrl driver configure  the pins Paul Cercueil <paul@crapouillou.net> - 2017-01-26 11:20 +0100
        [PATCH v3 04/14] GPIO: Add gpio-ingenic driver Paul Cercueil <paul@crapouillou.net> - 2017-01-25 20:00 +0100
        [PATCH v3 12/14] fbdev: jz4740-fb: Let the pinctrl driver configure the pins Paul Cercueil <paul@crapouillou.net> - 2017-01-25 20:00 +0100
          Re: [PATCH v3 12/14] fbdev: jz4740-fb: Let the pinctrl driver  configure the pins Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> - 2017-01-30 17:50 +0100
        [PATCH v3 03/14] pinctrl-ingenic: add a pinctrl driver for the Ingenic jz47xx SoCs Paul Cercueil <paul@crapouillou.net> - 2017-01-25 20:00 +0100
  Re: [PATCH 00/13] Ingenic JZ4740 / JZ4780 pinctrl driver Linus Walleij <linus.walleij@linaro.org> - 2017-01-19 07:50 +0100

csiph-web