This is a follow up of initial submission of a series consisted of 6 changes, 3 of which have been already applied or reworkeed.
V2 changelog: [PATCH 1/6] ARM: OMAP1: ams-delta: add GPIO lookup tables - already in mainline, commit 68e62a15a914 [PATCH 2/6] Input: ams_delta_serio: use GPIO lookup table - reworked and submitted as a series, already in linux-omap, commit 68e62a15a914 ("ARM: OMAP1: ams-delta: drop GPIO lookup table for serio device") followed by 9 more [PATCH 3/6] ASoC: ams_delta: use GPIO lookup table - already in mainline, commit d65777d1a2cd [PATCH 4/6] fbdev: omapfb: lcd_ams_delta: use GPIO lookup table - resubmitting as [PATCH v2 1/3 v2] v2: Remove problematic error code conversion no longer needed if used on top of commit d08605a64e67 ("ARM: OMAP1: ams-delta: move late devices back to init_machine") and commit 8853daf3b4ac ("gpiolib: Defer on non-DT find_chip_by_name() failure") already in linux-next [PATCH 5/6] mtd: rawnand: ams-delta: use GPIO lookup table - resubmitting as [PATCH v2 2/3 v4] v2: Fix handling of devm_gpiod_get_optional() return values - thanks to Andy Shevchenko. v3: Remove problematic error code conversion no longer needed if used on top of commit d08605a64e67 ("ARM: OMAP1: ams-delta: move late devices back to init_machine") and commit 8853daf3b4ac ("gpiolib: Defer on non-DT find_chip_by_name() failure") already in linux-next - thanks to Boris Brezillon v4: fix style issue - thanks to Boris Brezillon [PATCH 6/6] ARM: OMAP1: ams-delta: make board header file local to mach-omap1 - resending as [PATCH v2 3/3]
Dependency on commit 8853daf3b4ac ("gpiolib: Defer on non-DT find_chip_by_name() failure") is not critical - it is not needed for clean build or run, it only prevents from potential future changes to driver initializaton order during device_initcall.
I'm submitting the three patches in series because the last one depends on the other two.
Thanks, Janusz
Now as Amstrad Delta board - the only user of this driver - provides GPIO lookup tables, switch from GPIO numbers to GPIO descriptors and use the table to locate required GPIO pins.
Declare static variables for storing GPIO descriptors and replace gpio_ function calls with their gpiod_ equivalents. Move GPIO lookup to the driver probe function so device initialization can be deferred instead of aborted if a GPIO pin is not yet available.
Pin naming used by the driver should be followed while respective GPIO lookup table is initialized by a board init code.
Cc: Bartlomiej Zolnierkiewicz b.zolnierkie@samsung.com Signed-off-by: Janusz Krzysztofik jmkrzyszt@gmail.com --- Changelog: v2: Remove problematic error code conversion no longer needed if used on top of commit d08605a64e67 ("ARM: OMAP1: ams-delta: move late devices back to init_machine") already in linux-omap and commit 8853daf3b4ac ("gpiolib: Defer on non-DT find_chip_by_name() failure") already in linux-next
Dependency on commit 8853daf3b4ac ("gpiolib: Defer on non-DT find_chip_by_name() failure") is not critical for clean build or run, it only prevents from unexpected future changes to driver initialization order durin device_initall.
drivers/video/fbdev/omap/lcd_ams_delta.c | 55 +++++++++++++------------------- 1 file changed, 22 insertions(+), 33 deletions(-)
diff --git a/drivers/video/fbdev/omap/lcd_ams_delta.c b/drivers/video/fbdev/omap/lcd_ams_delta.c index e8c748a0dfe2..cddbd00cbf9f 100644 --- a/drivers/video/fbdev/omap/lcd_ams_delta.c +++ b/drivers/video/fbdev/omap/lcd_ams_delta.c @@ -24,11 +24,10 @@ #include <linux/platform_device.h> #include <linux/io.h> #include <linux/delay.h> +#include <linux/gpio/consumer.h> #include <linux/lcd.h> -#include <linux/gpio.h>
#include <mach/hardware.h> -#include <mach/board-ams-delta.h>
#include "omapfb.h"
@@ -41,6 +40,8 @@ /* LCD class device section */
static int ams_delta_lcd; +static struct gpio_desc *gpiod_vblen; +static struct gpio_desc *gpiod_ndisp;
static int ams_delta_lcd_set_power(struct lcd_device *dev, int power) { @@ -99,41 +100,17 @@ static struct lcd_ops ams_delta_lcd_ops = {
/* omapfb panel section */
-static const struct gpio _gpios[] = { - { - .gpio = AMS_DELTA_GPIO_PIN_LCD_VBLEN, - .flags = GPIOF_OUT_INIT_LOW, - .label = "lcd_vblen", - }, - { - .gpio = AMS_DELTA_GPIO_PIN_LCD_NDISP, - .flags = GPIOF_OUT_INIT_LOW, - .label = "lcd_ndisp", - }, -}; - -static int ams_delta_panel_init(struct lcd_panel *panel, - struct omapfb_device *fbdev) -{ - return gpio_request_array(_gpios, ARRAY_SIZE(_gpios)); -} - -static void ams_delta_panel_cleanup(struct lcd_panel *panel) -{ - gpio_free_array(_gpios, ARRAY_SIZE(_gpios)); -} - static int ams_delta_panel_enable(struct lcd_panel *panel) { - gpio_set_value(AMS_DELTA_GPIO_PIN_LCD_NDISP, 1); - gpio_set_value(AMS_DELTA_GPIO_PIN_LCD_VBLEN, 1); + gpiod_set_value(gpiod_ndisp, 1); + gpiod_set_value(gpiod_vblen, 1); return 0; }
static void ams_delta_panel_disable(struct lcd_panel *panel) { - gpio_set_value(AMS_DELTA_GPIO_PIN_LCD_VBLEN, 0); - gpio_set_value(AMS_DELTA_GPIO_PIN_LCD_NDISP, 0); + gpiod_set_value(gpiod_vblen, 0); + gpiod_set_value(gpiod_ndisp, 0); }
static struct lcd_panel ams_delta_panel = { @@ -154,8 +131,6 @@ static struct lcd_panel ams_delta_panel = { .pcd = 0, .acb = 37,
- .init = ams_delta_panel_init, - .cleanup = ams_delta_panel_cleanup, .enable = ams_delta_panel_enable, .disable = ams_delta_panel_disable, }; @@ -166,9 +141,23 @@ static struct lcd_panel ams_delta_panel = { static int ams_delta_panel_probe(struct platform_device *pdev) { struct lcd_device *lcd_device = NULL; -#ifdef CONFIG_LCD_CLASS_DEVICE int ret;
+ gpiod_vblen = devm_gpiod_get(&pdev->dev, "vblen", GPIOD_OUT_LOW); + if (IS_ERR(gpiod_vblen)) { + ret = PTR_ERR(gpiod_vblen); + dev_err(&pdev->dev, "VBLEN GPIO request failed (%d)\n", ret); + return ret; + } + + gpiod_ndisp = devm_gpiod_get(&pdev->dev, "ndisp", GPIOD_OUT_LOW); + if (IS_ERR(gpiod_ndisp)) { + ret = PTR_ERR(gpiod_ndisp); + dev_err(&pdev->dev, "NDISP GPIO request failed (%d)\n", ret); + return ret; + } + +#ifdef CONFIG_LCD_CLASS_DEVICE lcd_device = lcd_device_register("omapfb", &pdev->dev, NULL, &ams_delta_lcd_ops);
Now as Amstrad Delta board - the only user of this driver - provides GPIO lookup tables, switch from GPIO numbers to GPIO descriptors and use the table to locate required GPIO pins.
Declare static variables for storing GPIO descriptors and replace gpio_ function calls with their gpiod_ equivalents.
Pin naming used by the driver should be followed while respective GPIO lookup table is initialized by a board init code.
Signed-off-by: Janusz Krzysztofik jmkrzyszt@gmail.com Acked-by: Boris Brezillon boris.brezillon@bootlin.com --- Changelog: v2: Fix handling of devm_gpiod_get_optional() return values - thanks to Andy Shevchenko v3: Remove problematic error code conversion, no longer needed if used on top of commit d08605a64e67 ("ARM: OMAP1: ams-delta: move late devices back to init_machine") already in linux-omap and commit 8853daf3b4ac ("gpiolib: Defer on non-DT find_chip_by_name() failure") already in linux-next - thanks to Boris Brezillon v4: Fix style issue - thanks to Boris Brezillon
Dependency on commit 8853daf3b4ac ("gpiolib: Defer on non-DT find_chip_by_name() failure") is not critical for clean build or run, it only prevents from unexpected future changes to driver initialization order during device_initall.
drivers/mtd/nand/raw/ams-delta.c | 126 +++++++++++++++++++++------------------ 1 file changed, 67 insertions(+), 59 deletions(-)
diff --git a/drivers/mtd/nand/raw/ams-delta.c b/drivers/mtd/nand/raw/ams-delta.c index 37a3cc21c7bc..2a8872ebd14a 100644 --- a/drivers/mtd/nand/raw/ams-delta.c +++ b/drivers/mtd/nand/raw/ams-delta.c @@ -20,23 +20,28 @@ #include <linux/slab.h> #include <linux/module.h> #include <linux/delay.h> +#include <linux/gpio/consumer.h> #include <linux/mtd/mtd.h> #include <linux/mtd/rawnand.h> #include <linux/mtd/partitions.h> -#include <linux/gpio.h> #include <linux/platform_data/gpio-omap.h>
#include <asm/io.h> #include <asm/sizes.h>
-#include <mach/board-ams-delta.h> - #include <mach/hardware.h>
/* * MTD structure for E3 (Delta) */ static struct mtd_info *ams_delta_mtd = NULL; +static struct gpio_desc *gpiod_rdy; +static struct gpio_desc *gpiod_nce; +static struct gpio_desc *gpiod_nre; +static struct gpio_desc *gpiod_nwp; +static struct gpio_desc *gpiod_nwe; +static struct gpio_desc *gpiod_ale; +static struct gpio_desc *gpiod_cle;
/* * Define partitions for flash devices @@ -70,9 +75,9 @@ static void ams_delta_write_byte(struct mtd_info *mtd, u_char byte)
writew(0, io_base + OMAP_MPUIO_IO_CNTL); writew(byte, this->IO_ADDR_W); - gpio_set_value(AMS_DELTA_GPIO_PIN_NAND_NWE, 0); + gpiod_set_value(gpiod_nwe, 0); ndelay(40); - gpio_set_value(AMS_DELTA_GPIO_PIN_NAND_NWE, 1); + gpiod_set_value(gpiod_nwe, 1); }
static u_char ams_delta_read_byte(struct mtd_info *mtd) @@ -81,11 +86,11 @@ static u_char ams_delta_read_byte(struct mtd_info *mtd) struct nand_chip *this = mtd_to_nand(mtd); void __iomem *io_base = (void __iomem *)nand_get_controller_data(this);
- gpio_set_value(AMS_DELTA_GPIO_PIN_NAND_NRE, 0); + gpiod_set_value(gpiod_nre, 0); ndelay(40); writew(~0, io_base + OMAP_MPUIO_IO_CNTL); res = readw(this->IO_ADDR_R); - gpio_set_value(AMS_DELTA_GPIO_PIN_NAND_NRE, 1); + gpiod_set_value(gpiod_nre, 1);
return res; } @@ -120,12 +125,9 @@ static void ams_delta_hwcontrol(struct mtd_info *mtd, int cmd, {
if (ctrl & NAND_CTRL_CHANGE) { - gpio_set_value(AMS_DELTA_GPIO_PIN_NAND_NCE, - (ctrl & NAND_NCE) == 0); - gpio_set_value(AMS_DELTA_GPIO_PIN_NAND_CLE, - (ctrl & NAND_CLE) != 0); - gpio_set_value(AMS_DELTA_GPIO_PIN_NAND_ALE, - (ctrl & NAND_ALE) != 0); + gpiod_set_value(gpiod_nce, !(ctrl & NAND_NCE)); + gpiod_set_value(gpiod_cle, !!(ctrl & NAND_CLE)); + gpiod_set_value(gpiod_ale, !!(ctrl & NAND_ALE)); }
if (cmd != NAND_CMD_NONE) @@ -134,41 +136,9 @@ static void ams_delta_hwcontrol(struct mtd_info *mtd, int cmd,
static int ams_delta_nand_ready(struct mtd_info *mtd) { - return gpio_get_value(AMS_DELTA_GPIO_PIN_NAND_RB); + return gpiod_get_value(gpiod_rdy); }
-static const struct gpio _mandatory_gpio[] = { - { - .gpio = AMS_DELTA_GPIO_PIN_NAND_NCE, - .flags = GPIOF_OUT_INIT_HIGH, - .label = "nand_nce", - }, - { - .gpio = AMS_DELTA_GPIO_PIN_NAND_NRE, - .flags = GPIOF_OUT_INIT_HIGH, - .label = "nand_nre", - }, - { - .gpio = AMS_DELTA_GPIO_PIN_NAND_NWP, - .flags = GPIOF_OUT_INIT_HIGH, - .label = "nand_nwp", - }, - { - .gpio = AMS_DELTA_GPIO_PIN_NAND_NWE, - .flags = GPIOF_OUT_INIT_HIGH, - .label = "nand_nwe", - }, - { - .gpio = AMS_DELTA_GPIO_PIN_NAND_ALE, - .flags = GPIOF_OUT_INIT_LOW, - .label = "nand_ale", - }, - { - .gpio = AMS_DELTA_GPIO_PIN_NAND_CLE, - .flags = GPIOF_OUT_INIT_LOW, - .label = "nand_cle", - }, -};
/* * Main initialization routine @@ -216,12 +186,17 @@ static int ams_delta_init(struct platform_device *pdev) this->write_buf = ams_delta_write_buf; this->read_buf = ams_delta_read_buf; this->cmd_ctrl = ams_delta_hwcontrol; - if (gpio_request(AMS_DELTA_GPIO_PIN_NAND_RB, "nand_rdy") == 0) { - this->dev_ready = ams_delta_nand_ready; - } else { - this->dev_ready = NULL; - pr_notice("Couldn't request gpio for Delta NAND ready.\n"); + + gpiod_rdy = devm_gpiod_get_optional(&pdev->dev, "rdy", GPIOD_IN); + if (IS_ERR(gpiod_rdy)) { + err = PTR_ERR(gpiod_rdy); + dev_warn(&pdev->dev, "RDY GPIO request failed (%d)\n", err); + goto out_mtd; } + + if (gpiod_rdy) + this->dev_ready = ams_delta_nand_ready; + /* 25 us command delay time */ this->chip_delay = 30; this->ecc.mode = NAND_ECC_SOFT; @@ -230,9 +205,47 @@ static int ams_delta_init(struct platform_device *pdev) platform_set_drvdata(pdev, io_base);
/* Set chip enabled, but */ - err = gpio_request_array(_mandatory_gpio, ARRAY_SIZE(_mandatory_gpio)); - if (err) - goto out_gpio; + gpiod_nwp = devm_gpiod_get(&pdev->dev, "nwp", GPIOD_OUT_HIGH); + if (IS_ERR(gpiod_nwp)) { + err = PTR_ERR(gpiod_nwp); + dev_err(&pdev->dev, "NWP GPIO request failed (%d)\n", err); + goto out_mtd; + } + + gpiod_nce = devm_gpiod_get(&pdev->dev, "nce", GPIOD_OUT_HIGH); + if (IS_ERR(gpiod_nce)) { + err = PTR_ERR(gpiod_nce); + dev_err(&pdev->dev, "NCE GPIO request failed (%d)\n", err); + goto out_mtd; + } + + gpiod_nre = devm_gpiod_get(&pdev->dev, "nre", GPIOD_OUT_HIGH); + if (IS_ERR(gpiod_nre)) { + err = PTR_ERR(gpiod_nre); + dev_err(&pdev->dev, "NRE GPIO request failed (%d)\n", err); + goto out_mtd; + } + + gpiod_nwe = devm_gpiod_get(&pdev->dev, "nwe", GPIOD_OUT_HIGH); + if (IS_ERR(gpiod_nwe)) { + err = PTR_ERR(gpiod_nwe); + dev_err(&pdev->dev, "NWE GPIO request failed (%d)\n", err); + goto out_mtd; + } + + gpiod_ale = devm_gpiod_get(&pdev->dev, "ale", GPIOD_OUT_LOW); + if (IS_ERR(gpiod_ale)) { + err = PTR_ERR(gpiod_ale); + dev_err(&pdev->dev, "ALE GPIO request failed (%d)\n", err); + goto out_mtd; + } + + gpiod_cle = devm_gpiod_get(&pdev->dev, "cle", GPIOD_OUT_LOW); + if (IS_ERR(gpiod_cle)) { + err = PTR_ERR(gpiod_cle); + dev_err(&pdev->dev, "CLE GPIO request failed (%d)\n", err); + goto out_mtd; + }
/* Scan to find existence of the device */ err = nand_scan(ams_delta_mtd, 1); @@ -246,9 +259,6 @@ static int ams_delta_init(struct platform_device *pdev) goto out;
out_mtd: - gpio_free_array(_mandatory_gpio, ARRAY_SIZE(_mandatory_gpio)); -out_gpio: - gpio_free(AMS_DELTA_GPIO_PIN_NAND_RB); iounmap(io_base); out_free: kfree(this); @@ -266,8 +276,6 @@ static int ams_delta_cleanup(struct platform_device *pdev) /* Release resources, unregister device */ nand_release(ams_delta_mtd);
- gpio_free_array(_mandatory_gpio, ARRAY_SIZE(_mandatory_gpio)); - gpio_free(AMS_DELTA_GPIO_PIN_NAND_RB); iounmap(io_base);
/* Free the MTD device structure */
Hi Janusz, Tony
Janusz Krzysztofik jmkrzyszt@gmail.com wrote on Wed, 18 Jul 2018 01:14:47 +0200:
Now as Amstrad Delta board - the only user of this driver - provides GPIO lookup tables, switch from GPIO numbers to GPIO descriptors and use the table to locate required GPIO pins.
Declare static variables for storing GPIO descriptors and replace gpio_ function calls with their gpiod_ equivalents.
Pin naming used by the driver should be followed while respective GPIO lookup table is initialized by a board init code.
Signed-off-by: Janusz Krzysztofik jmkrzyszt@gmail.com Acked-by: Boris Brezillon boris.brezillon@bootlin.com
Acked-by: Miquel Raynal miquel.raynal@bootlin.com
As suggested by Boris, we expect this series to go through the OMAP tree so we'll need an immutable tag, there are more changes on this driver coming in.
Thanks! Miquèl
* Miquel Raynal miquel.raynal@bootlin.com [180718 07:24]:
Hi Janusz, Tony
Janusz Krzysztofik jmkrzyszt@gmail.com wrote on Wed, 18 Jul 2018 01:14:47 +0200:
Now as Amstrad Delta board - the only user of this driver - provides GPIO lookup tables, switch from GPIO numbers to GPIO descriptors and use the table to locate required GPIO pins.
Declare static variables for storing GPIO descriptors and replace gpio_ function calls with their gpiod_ equivalents.
Pin naming used by the driver should be followed while respective GPIO lookup table is initialized by a board init code.
Signed-off-by: Janusz Krzysztofik jmkrzyszt@gmail.com Acked-by: Boris Brezillon boris.brezillon@bootlin.com
Acked-by: Miquel Raynal miquel.raynal@bootlin.com
As suggested by Boris, we expect this series to go through the OMAP tree so we'll need an immutable tag, there are more changes on this driver coming in.
Let's wait for v4.19-rc1 to clear the dependencies. I'm not applying new patches at this point only dealing with the pending pull requests I have.
Regards,
Tony
Now as board header file is no longer included by drivers, move it to the root directory of mach-omap1.
Signed-off-by: Janusz Krzysztofik jmkrzyszt@gmail.com --- Depends on patches 1/3 and 2/3 of the series.
arch/arm/mach-omap1/ams-delta-fiq-handler.S | 2 +- arch/arm/mach-omap1/ams-delta-fiq.c | 3 +-- arch/arm/mach-omap1/board-ams-delta.c | 2 +- arch/arm/mach-omap1/{include/mach => }/board-ams-delta.h | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) rename arch/arm/mach-omap1/{include/mach => }/board-ams-delta.h (98%)
diff --git a/arch/arm/mach-omap1/ams-delta-fiq-handler.S b/arch/arm/mach-omap1/ams-delta-fiq-handler.S index ddc27638ba2a..2e2a17364dc9 100644 --- a/arch/arm/mach-omap1/ams-delta-fiq-handler.S +++ b/arch/arm/mach-omap1/ams-delta-fiq-handler.S @@ -17,9 +17,9 @@ #include <linux/platform_data/ams-delta-fiq.h>
#include <asm/assembler.h> -#include <mach/board-ams-delta.h>
#include "ams-delta-fiq.h" +#include "board-ams-delta.h" #include "iomap.h" #include "soc.h"
diff --git a/arch/arm/mach-omap1/ams-delta-fiq.c b/arch/arm/mach-omap1/ams-delta-fiq.c index b0dc7ddf5877..14c3d3f5255e 100644 --- a/arch/arm/mach-omap1/ams-delta-fiq.c +++ b/arch/arm/mach-omap1/ams-delta-fiq.c @@ -22,11 +22,10 @@ #include <linux/platform_data/ams-delta-fiq.h> #include <linux/platform_device.h>
-#include <mach/board-ams-delta.h> - #include <asm/fiq.h>
#include "ams-delta-fiq.h" +#include "board-ams-delta.h"
static struct fiq_handler fh = { .name = "ams-delta-fiq" diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c index dd28d2614d7f..34cb63ff45b3 100644 --- a/arch/arm/mach-omap1/board-ams-delta.c +++ b/arch/arm/mach-omap1/board-ams-delta.c @@ -36,7 +36,6 @@ #include <asm/mach/arch.h> #include <asm/mach/map.h>
-#include <mach/board-ams-delta.h> #include <linux/platform_data/keypad-omap.h> #include <mach/mux.h>
@@ -45,6 +44,7 @@ #include <mach/usb.h>
#include "ams-delta-fiq.h" +#include "board-ams-delta.h" #include "iomap.h" #include "common.h"
diff --git a/arch/arm/mach-omap1/include/mach/board-ams-delta.h b/arch/arm/mach-omap1/board-ams-delta.h similarity index 98% rename from arch/arm/mach-omap1/include/mach/board-ams-delta.h rename to arch/arm/mach-omap1/board-ams-delta.h index ad6f865d1f16..1fbada29431a 100644 --- a/arch/arm/mach-omap1/include/mach/board-ams-delta.h +++ b/arch/arm/mach-omap1/board-ams-delta.h @@ -1,5 +1,5 @@ /* - * arch/arm/plat-omap/include/mach/board-ams-delta.h + * arch/arm/mach-omap1/board-ams-delta.h * * Copyright (C) 2006 Jonathan McDowell noodles@earth.li *
Hi Janusz,
On mer., juil. 18 2018, Janusz Krzysztofik jmkrzyszt@gmail.com wrote:
This is a follow up of initial submission of a series consisted of 6 changes, 3 of which have been already applied or reworkeed.
V2 changelog: [PATCH 1/6] ARM: OMAP1: ams-delta: add GPIO lookup tables
- already in mainline, commit 68e62a15a914
[PATCH 2/6] Input: ams_delta_serio: use GPIO lookup table
- reworked and submitted as a series, already in linux-omap, commit 68e62a15a914 ("ARM: OMAP1: ams-delta: drop GPIO lookup table for serio device") followed by 9 more
[PATCH 3/6] ASoC: ams_delta: use GPIO lookup table
- already in mainline, commit d65777d1a2cd
[PATCH 4/6] fbdev: omapfb: lcd_ams_delta: use GPIO lookup table
- resubmitting as [PATCH v2 1/3 v2]
v2: Remove problematic error code conversion no longer needed if used on top of commit d08605a64e67 ("ARM: OMAP1: ams-delta: move late devices back to init_machine") and commit 8853daf3b4ac ("gpiolib: Defer on non-DT find_chip_by_name() failure") already in linux-next [PATCH 5/6] mtd: rawnand: ams-delta: use GPIO lookup table
- resubmitting as [PATCH v2 2/3 v4]
v2: Fix handling of devm_gpiod_get_optional() return values - thanks to Andy Shevchenko. v3: Remove problematic error code conversion no longer needed if used on top of commit d08605a64e67 ("ARM: OMAP1: ams-delta: move late devices back to init_machine") and commit 8853daf3b4ac ("gpiolib: Defer on non-DT find_chip_by_name() failure") already in linux-next - thanks to Boris Brezillon v4: fix style issue - thanks to Boris Brezillon [PATCH 6/6] ARM: OMAP1: ams-delta: make board header file local to mach-omap1
- resending as [PATCH v2 3/3]
Dependency on commit 8853daf3b4ac ("gpiolib: Defer on non-DT find_chip_by_name() failure") is not critical - it is not needed for clean build or run, it only prevents from potential future changes to driver initializaton order during device_initcall.
I'm submitting the three patches in series because the last one depends on the other two.
I think that being in CC in this series is a mistake as I don't see anything related what I have done in this series.
Gregory
Thanks, Janusz
This is a follow up of initial submission of a series consisted of 6 changes, 3 of which have been already applied or reworkeed.
Janusz Krzysztofik (3): video: fbdev: omapfb: lcd_ams_delta: use GPIO lookup table mtd: rawnand: ams-delta: use GPIO lookup table ARM: OMAP1: ams-delta: make board header file local to mach-omap1
I'm submitting the three patches in series because the last one depends on the other two.
Tony, please set up an immutable tag for this series to be used by MTD as there are more changes on Amstrad Delta NAND driver coming in.
Thanks, Janusz
Changelog: v3: - rebased on top of v4.19-rc1 - added Acked-by: received from Miquel
v2: [PATCH 1/6] ARM: OMAP1: ams-delta: add GPIO lookup tables - already in mainline, commit 68e62a15a914 [PATCH 2/6] Input: ams_delta_serio: use GPIO lookup table - reworked and submitted as a series, already in linux-omap, commit 68e62a15a914 ("ARM: OMAP1: ams-delta: drop GPIO lookup table for serio device") followed by 9 more [PATCH 3/6] ASoC: ams_delta: use GPIO lookup table - already in mainline, commit d65777d1a2cd [PATCH 4/6] fbdev: omapfb: lcd_ams_delta: use GPIO lookup table - resubmitting as [PATCH v2 1/3 v2] v2: Remove problematic error code conversion no longer needed if used on top of commit d08605a64e67 ("ARM: OMAP1: ams-delta: move late devices back to init_machine") and commit 8853daf3b4ac ("gpiolib: Defer on non-DT find_chip_by_name() failure") already in linux-next [PATCH 5/6] mtd: rawnand: ams-delta: use GPIO lookup table - resubmitting as [PATCH v2 2/3 v4] v2: Fix handling of devm_gpiod_get_optional() return values - thanks to Andy Shevchenko. v3: Remove problematic error code conversion no longer needed if used on top of commit d08605a64e67 ("ARM: OMAP1: ams-delta: move late devices back to init_machine") and commit 8853daf3b4ac ("gpiolib: Defer on non-DT find_chip_by_name() failure") already in linux-next - thanks to Boris Brezillon v4: fix style issue - thanks to Boris Brezillon [PATCH 6/6] ARM: OMAP1: ams-delta: make board header file local to mach-omap1 - resending as [PATCH v2 3/3]
All dependencies mentioned in v2 changelog are satisfied in v4.19-rc1.
diffstat: arch/arm/mach-omap1/ams-delta-fiq-handler.S | 2 arch/arm/mach-omap1/ams-delta-fiq.c | 3 arch/arm/mach-omap1/board-ams-delta.c | 2 arch/arm/mach-omap1/board-ams-delta.h | 2 drivers/mtd/nand/raw/ams-delta.c | 126 ++++++++++++++-------------- drivers/video/fbdev/omap/lcd_ams_delta.c | 55 ++++-------- 6 files changed, 93 insertions(+), 97 deletions(-)
Now as Amstrad Delta board - the only user of this driver - provides GPIO lookup tables, switch from GPIO numbers to GPIO descriptors and use the table to locate required GPIO pins.
Declare static variables for storing GPIO descriptors and replace gpio_ function calls with their gpiod_ equivalents. Move GPIO lookup to the driver probe function so device initialization can be deferred instead of aborted if a GPIO pin is not yet available.
Pin naming used by the driver should be followed while respective GPIO lookup table is initialized by a board init code.
Cc: Bartlomiej Zolnierkiewicz b.zolnierkie@samsung.com Signed-off-by: Janusz Krzysztofik jmkrzyszt@gmail.com --- drivers/video/fbdev/omap/lcd_ams_delta.c | 55 +++++++++++++------------------- 1 file changed, 22 insertions(+), 33 deletions(-)
diff --git a/drivers/video/fbdev/omap/lcd_ams_delta.c b/drivers/video/fbdev/omap/lcd_ams_delta.c index e8c748a0dfe2..cddbd00cbf9f 100644 --- a/drivers/video/fbdev/omap/lcd_ams_delta.c +++ b/drivers/video/fbdev/omap/lcd_ams_delta.c @@ -24,11 +24,10 @@ #include <linux/platform_device.h> #include <linux/io.h> #include <linux/delay.h> +#include <linux/gpio/consumer.h> #include <linux/lcd.h> -#include <linux/gpio.h>
#include <mach/hardware.h> -#include <mach/board-ams-delta.h>
#include "omapfb.h"
@@ -41,6 +40,8 @@ /* LCD class device section */
static int ams_delta_lcd; +static struct gpio_desc *gpiod_vblen; +static struct gpio_desc *gpiod_ndisp;
static int ams_delta_lcd_set_power(struct lcd_device *dev, int power) { @@ -99,41 +100,17 @@ static struct lcd_ops ams_delta_lcd_ops = {
/* omapfb panel section */
-static const struct gpio _gpios[] = { - { - .gpio = AMS_DELTA_GPIO_PIN_LCD_VBLEN, - .flags = GPIOF_OUT_INIT_LOW, - .label = "lcd_vblen", - }, - { - .gpio = AMS_DELTA_GPIO_PIN_LCD_NDISP, - .flags = GPIOF_OUT_INIT_LOW, - .label = "lcd_ndisp", - }, -}; - -static int ams_delta_panel_init(struct lcd_panel *panel, - struct omapfb_device *fbdev) -{ - return gpio_request_array(_gpios, ARRAY_SIZE(_gpios)); -} - -static void ams_delta_panel_cleanup(struct lcd_panel *panel) -{ - gpio_free_array(_gpios, ARRAY_SIZE(_gpios)); -} - static int ams_delta_panel_enable(struct lcd_panel *panel) { - gpio_set_value(AMS_DELTA_GPIO_PIN_LCD_NDISP, 1); - gpio_set_value(AMS_DELTA_GPIO_PIN_LCD_VBLEN, 1); + gpiod_set_value(gpiod_ndisp, 1); + gpiod_set_value(gpiod_vblen, 1); return 0; }
static void ams_delta_panel_disable(struct lcd_panel *panel) { - gpio_set_value(AMS_DELTA_GPIO_PIN_LCD_VBLEN, 0); - gpio_set_value(AMS_DELTA_GPIO_PIN_LCD_NDISP, 0); + gpiod_set_value(gpiod_vblen, 0); + gpiod_set_value(gpiod_ndisp, 0); }
static struct lcd_panel ams_delta_panel = { @@ -154,8 +131,6 @@ static struct lcd_panel ams_delta_panel = { .pcd = 0, .acb = 37,
- .init = ams_delta_panel_init, - .cleanup = ams_delta_panel_cleanup, .enable = ams_delta_panel_enable, .disable = ams_delta_panel_disable, }; @@ -166,9 +141,23 @@ static struct lcd_panel ams_delta_panel = { static int ams_delta_panel_probe(struct platform_device *pdev) { struct lcd_device *lcd_device = NULL; -#ifdef CONFIG_LCD_CLASS_DEVICE int ret;
+ gpiod_vblen = devm_gpiod_get(&pdev->dev, "vblen", GPIOD_OUT_LOW); + if (IS_ERR(gpiod_vblen)) { + ret = PTR_ERR(gpiod_vblen); + dev_err(&pdev->dev, "VBLEN GPIO request failed (%d)\n", ret); + return ret; + } + + gpiod_ndisp = devm_gpiod_get(&pdev->dev, "ndisp", GPIOD_OUT_LOW); + if (IS_ERR(gpiod_ndisp)) { + ret = PTR_ERR(gpiod_ndisp); + dev_err(&pdev->dev, "NDISP GPIO request failed (%d)\n", ret); + return ret; + } + +#ifdef CONFIG_LCD_CLASS_DEVICE lcd_device = lcd_device_register("omapfb", &pdev->dev, NULL, &ams_delta_lcd_ops);
On Mon, Sep 10, 2018 at 12:55 AM Janusz Krzysztofik jmkrzyszt@gmail.com wrote:
Now as Amstrad Delta board - the only user of this driver - provides GPIO lookup tables, switch from GPIO numbers to GPIO descriptors and use the table to locate required GPIO pins.
Declare static variables for storing GPIO descriptors and replace gpio_ function calls with their gpiod_ equivalents. Move GPIO lookup to the driver probe function so device initialization can be deferred instead of aborted if a GPIO pin is not yet available.
Pin naming used by the driver should be followed while respective GPIO lookup table is initialized by a board init code.
Cc: Bartlomiej Zolnierkiewicz b.zolnierkie@samsung.com Signed-off-by: Janusz Krzysztofik jmkrzyszt@gmail.com
Good work as usual: Reviewed-by: Linus Walleij linus.walleij@linaro.org
FWIW I think the entire drivers/video/fbdev/omap/* could be pretty easy to migrate to DRM if you compare the simple drivers/gpu/drm/pl111 or drivers/gpu/drm/tve200 drivers. Just inspiration! :)
Yours, Linus Walleij
Now as Amstrad Delta board - the only user of this driver - provides GPIO lookup tables, switch from GPIO numbers to GPIO descriptors and use the table to locate required GPIO pins.
Declare static variables for storing GPIO descriptors and replace gpio_ function calls with their gpiod_ equivalents. Move GPIO lookup to the driver probe function so device initialization can be deferred instead of aborted if a GPIO pin is not yet available.
Pin naming used by the driver should be followed while respective GPIO lookup table is initialized by a board init code.
Signed-off-by: Janusz Krzysztofik jmkrzyszt@gmail.com Reviewed-by: Linus Walleij linus.walleij@linaro.org --- Changelog: v4: - added Reviewed-by: Linus Walleij - resubmitted as a standalone patch for inclusion via fbdev tree again
v3: - rebased on top of v4.19-rc1 with all dependencies mentioned in v2 changelog satisfied
v2/v2: - resubmitted in a series as [PATCH v2 1/3 v2] for inclusion via omap tree
v2: - removed problematic error code conversion no longer needed if used on top of commit d08605a64e67 ("ARM: OMAP1: ams-delta: move late devices back to init_machine") and commit 8853daf3b4ac ("gpiolib: Defer on non-DT find_chip_by_name() failure") already in linux-next - resubmitted as a standalone patch for inclusion via fbdev tree
Ininally submitted in a series as [PATCH 4/6]
drivers/video/fbdev/omap/lcd_ams_delta.c | 55 +++++++++++++------------------- 1 file changed, 22 insertions(+), 33 deletions(-)
diff --git a/drivers/video/fbdev/omap/lcd_ams_delta.c b/drivers/video/fbdev/omap/lcd_ams_delta.c index e8c748a0dfe2..cddbd00cbf9f 100644 --- a/drivers/video/fbdev/omap/lcd_ams_delta.c +++ b/drivers/video/fbdev/omap/lcd_ams_delta.c @@ -24,11 +24,10 @@ #include <linux/platform_device.h> #include <linux/io.h> #include <linux/delay.h> +#include <linux/gpio/consumer.h> #include <linux/lcd.h> -#include <linux/gpio.h>
#include <mach/hardware.h> -#include <mach/board-ams-delta.h>
#include "omapfb.h"
@@ -41,6 +40,8 @@ /* LCD class device section */
static int ams_delta_lcd; +static struct gpio_desc *gpiod_vblen; +static struct gpio_desc *gpiod_ndisp;
static int ams_delta_lcd_set_power(struct lcd_device *dev, int power) { @@ -99,41 +100,17 @@ static struct lcd_ops ams_delta_lcd_ops = {
/* omapfb panel section */
-static const struct gpio _gpios[] = { - { - .gpio = AMS_DELTA_GPIO_PIN_LCD_VBLEN, - .flags = GPIOF_OUT_INIT_LOW, - .label = "lcd_vblen", - }, - { - .gpio = AMS_DELTA_GPIO_PIN_LCD_NDISP, - .flags = GPIOF_OUT_INIT_LOW, - .label = "lcd_ndisp", - }, -}; - -static int ams_delta_panel_init(struct lcd_panel *panel, - struct omapfb_device *fbdev) -{ - return gpio_request_array(_gpios, ARRAY_SIZE(_gpios)); -} - -static void ams_delta_panel_cleanup(struct lcd_panel *panel) -{ - gpio_free_array(_gpios, ARRAY_SIZE(_gpios)); -} - static int ams_delta_panel_enable(struct lcd_panel *panel) { - gpio_set_value(AMS_DELTA_GPIO_PIN_LCD_NDISP, 1); - gpio_set_value(AMS_DELTA_GPIO_PIN_LCD_VBLEN, 1); + gpiod_set_value(gpiod_ndisp, 1); + gpiod_set_value(gpiod_vblen, 1); return 0; }
static void ams_delta_panel_disable(struct lcd_panel *panel) { - gpio_set_value(AMS_DELTA_GPIO_PIN_LCD_VBLEN, 0); - gpio_set_value(AMS_DELTA_GPIO_PIN_LCD_NDISP, 0); + gpiod_set_value(gpiod_vblen, 0); + gpiod_set_value(gpiod_ndisp, 0); }
static struct lcd_panel ams_delta_panel = { @@ -154,8 +131,6 @@ static struct lcd_panel ams_delta_panel = { .pcd = 0, .acb = 37,
- .init = ams_delta_panel_init, - .cleanup = ams_delta_panel_cleanup, .enable = ams_delta_panel_enable, .disable = ams_delta_panel_disable, }; @@ -166,9 +141,23 @@ static struct lcd_panel ams_delta_panel = { static int ams_delta_panel_probe(struct platform_device *pdev) { struct lcd_device *lcd_device = NULL; -#ifdef CONFIG_LCD_CLASS_DEVICE int ret;
+ gpiod_vblen = devm_gpiod_get(&pdev->dev, "vblen", GPIOD_OUT_LOW); + if (IS_ERR(gpiod_vblen)) { + ret = PTR_ERR(gpiod_vblen); + dev_err(&pdev->dev, "VBLEN GPIO request failed (%d)\n", ret); + return ret; + } + + gpiod_ndisp = devm_gpiod_get(&pdev->dev, "ndisp", GPIOD_OUT_LOW); + if (IS_ERR(gpiod_ndisp)) { + ret = PTR_ERR(gpiod_ndisp); + dev_err(&pdev->dev, "NDISP GPIO request failed (%d)\n", ret); + return ret; + } + +#ifdef CONFIG_LCD_CLASS_DEVICE lcd_device = lcd_device_register("omapfb", &pdev->dev, NULL, &ams_delta_lcd_ops);
On 10/03/2018 03:03 PM, Janusz Krzysztofik wrote:
Now as Amstrad Delta board - the only user of this driver - provides GPIO lookup tables, switch from GPIO numbers to GPIO descriptors and use the table to locate required GPIO pins.
Declare static variables for storing GPIO descriptors and replace gpio_ function calls with their gpiod_ equivalents. Move GPIO lookup to the driver probe function so device initialization can be deferred instead of aborted if a GPIO pin is not yet available.
Pin naming used by the driver should be followed while respective GPIO lookup table is initialized by a board init code.
Signed-off-by: Janusz Krzysztofik jmkrzyszt@gmail.com Reviewed-by: Linus Walleij linus.walleij@linaro.org
Patch queued for 4.20, thanks.
Best regards, -- Bartlomiej Zolnierkiewicz Samsung R&D Institute Poland Samsung Electronics
Now as Amstrad Delta board - the only user of this driver - provides GPIO lookup tables, switch from GPIO numbers to GPIO descriptors and use the table to locate required GPIO pins.
Declare static variables for storing GPIO descriptors and replace gpio_ function calls with their gpiod_ equivalents.
Pin naming used by the driver should be followed while respective GPIO lookup table is initialized by a board init code.
Signed-off-by: Janusz Krzysztofik jmkrzyszt@gmail.com Acked-by: Boris Brezillon boris.brezillon@bootlin.com Acked-by: Miquel Raynal miquel.raynal@bootlin.com --- drivers/mtd/nand/raw/ams-delta.c | 126 +++++++++++++++++++++------------------ 1 file changed, 67 insertions(+), 59 deletions(-)
diff --git a/drivers/mtd/nand/raw/ams-delta.c b/drivers/mtd/nand/raw/ams-delta.c index 37a3cc21c7bc..2a8872ebd14a 100644 --- a/drivers/mtd/nand/raw/ams-delta.c +++ b/drivers/mtd/nand/raw/ams-delta.c @@ -20,23 +20,28 @@ #include <linux/slab.h> #include <linux/module.h> #include <linux/delay.h> +#include <linux/gpio/consumer.h> #include <linux/mtd/mtd.h> #include <linux/mtd/rawnand.h> #include <linux/mtd/partitions.h> -#include <linux/gpio.h> #include <linux/platform_data/gpio-omap.h>
#include <asm/io.h> #include <asm/sizes.h>
-#include <mach/board-ams-delta.h> - #include <mach/hardware.h>
/* * MTD structure for E3 (Delta) */ static struct mtd_info *ams_delta_mtd = NULL; +static struct gpio_desc *gpiod_rdy; +static struct gpio_desc *gpiod_nce; +static struct gpio_desc *gpiod_nre; +static struct gpio_desc *gpiod_nwp; +static struct gpio_desc *gpiod_nwe; +static struct gpio_desc *gpiod_ale; +static struct gpio_desc *gpiod_cle;
/* * Define partitions for flash devices @@ -70,9 +75,9 @@ static void ams_delta_write_byte(struct mtd_info *mtd, u_char byte)
writew(0, io_base + OMAP_MPUIO_IO_CNTL); writew(byte, this->IO_ADDR_W); - gpio_set_value(AMS_DELTA_GPIO_PIN_NAND_NWE, 0); + gpiod_set_value(gpiod_nwe, 0); ndelay(40); - gpio_set_value(AMS_DELTA_GPIO_PIN_NAND_NWE, 1); + gpiod_set_value(gpiod_nwe, 1); }
static u_char ams_delta_read_byte(struct mtd_info *mtd) @@ -81,11 +86,11 @@ static u_char ams_delta_read_byte(struct mtd_info *mtd) struct nand_chip *this = mtd_to_nand(mtd); void __iomem *io_base = (void __iomem *)nand_get_controller_data(this);
- gpio_set_value(AMS_DELTA_GPIO_PIN_NAND_NRE, 0); + gpiod_set_value(gpiod_nre, 0); ndelay(40); writew(~0, io_base + OMAP_MPUIO_IO_CNTL); res = readw(this->IO_ADDR_R); - gpio_set_value(AMS_DELTA_GPIO_PIN_NAND_NRE, 1); + gpiod_set_value(gpiod_nre, 1);
return res; } @@ -120,12 +125,9 @@ static void ams_delta_hwcontrol(struct mtd_info *mtd, int cmd, {
if (ctrl & NAND_CTRL_CHANGE) { - gpio_set_value(AMS_DELTA_GPIO_PIN_NAND_NCE, - (ctrl & NAND_NCE) == 0); - gpio_set_value(AMS_DELTA_GPIO_PIN_NAND_CLE, - (ctrl & NAND_CLE) != 0); - gpio_set_value(AMS_DELTA_GPIO_PIN_NAND_ALE, - (ctrl & NAND_ALE) != 0); + gpiod_set_value(gpiod_nce, !(ctrl & NAND_NCE)); + gpiod_set_value(gpiod_cle, !!(ctrl & NAND_CLE)); + gpiod_set_value(gpiod_ale, !!(ctrl & NAND_ALE)); }
if (cmd != NAND_CMD_NONE) @@ -134,41 +136,9 @@ static void ams_delta_hwcontrol(struct mtd_info *mtd, int cmd,
static int ams_delta_nand_ready(struct mtd_info *mtd) { - return gpio_get_value(AMS_DELTA_GPIO_PIN_NAND_RB); + return gpiod_get_value(gpiod_rdy); }
-static const struct gpio _mandatory_gpio[] = { - { - .gpio = AMS_DELTA_GPIO_PIN_NAND_NCE, - .flags = GPIOF_OUT_INIT_HIGH, - .label = "nand_nce", - }, - { - .gpio = AMS_DELTA_GPIO_PIN_NAND_NRE, - .flags = GPIOF_OUT_INIT_HIGH, - .label = "nand_nre", - }, - { - .gpio = AMS_DELTA_GPIO_PIN_NAND_NWP, - .flags = GPIOF_OUT_INIT_HIGH, - .label = "nand_nwp", - }, - { - .gpio = AMS_DELTA_GPIO_PIN_NAND_NWE, - .flags = GPIOF_OUT_INIT_HIGH, - .label = "nand_nwe", - }, - { - .gpio = AMS_DELTA_GPIO_PIN_NAND_ALE, - .flags = GPIOF_OUT_INIT_LOW, - .label = "nand_ale", - }, - { - .gpio = AMS_DELTA_GPIO_PIN_NAND_CLE, - .flags = GPIOF_OUT_INIT_LOW, - .label = "nand_cle", - }, -};
/* * Main initialization routine @@ -216,12 +186,17 @@ static int ams_delta_init(struct platform_device *pdev) this->write_buf = ams_delta_write_buf; this->read_buf = ams_delta_read_buf; this->cmd_ctrl = ams_delta_hwcontrol; - if (gpio_request(AMS_DELTA_GPIO_PIN_NAND_RB, "nand_rdy") == 0) { - this->dev_ready = ams_delta_nand_ready; - } else { - this->dev_ready = NULL; - pr_notice("Couldn't request gpio for Delta NAND ready.\n"); + + gpiod_rdy = devm_gpiod_get_optional(&pdev->dev, "rdy", GPIOD_IN); + if (IS_ERR(gpiod_rdy)) { + err = PTR_ERR(gpiod_rdy); + dev_warn(&pdev->dev, "RDY GPIO request failed (%d)\n", err); + goto out_mtd; } + + if (gpiod_rdy) + this->dev_ready = ams_delta_nand_ready; + /* 25 us command delay time */ this->chip_delay = 30; this->ecc.mode = NAND_ECC_SOFT; @@ -230,9 +205,47 @@ static int ams_delta_init(struct platform_device *pdev) platform_set_drvdata(pdev, io_base);
/* Set chip enabled, but */ - err = gpio_request_array(_mandatory_gpio, ARRAY_SIZE(_mandatory_gpio)); - if (err) - goto out_gpio; + gpiod_nwp = devm_gpiod_get(&pdev->dev, "nwp", GPIOD_OUT_HIGH); + if (IS_ERR(gpiod_nwp)) { + err = PTR_ERR(gpiod_nwp); + dev_err(&pdev->dev, "NWP GPIO request failed (%d)\n", err); + goto out_mtd; + } + + gpiod_nce = devm_gpiod_get(&pdev->dev, "nce", GPIOD_OUT_HIGH); + if (IS_ERR(gpiod_nce)) { + err = PTR_ERR(gpiod_nce); + dev_err(&pdev->dev, "NCE GPIO request failed (%d)\n", err); + goto out_mtd; + } + + gpiod_nre = devm_gpiod_get(&pdev->dev, "nre", GPIOD_OUT_HIGH); + if (IS_ERR(gpiod_nre)) { + err = PTR_ERR(gpiod_nre); + dev_err(&pdev->dev, "NRE GPIO request failed (%d)\n", err); + goto out_mtd; + } + + gpiod_nwe = devm_gpiod_get(&pdev->dev, "nwe", GPIOD_OUT_HIGH); + if (IS_ERR(gpiod_nwe)) { + err = PTR_ERR(gpiod_nwe); + dev_err(&pdev->dev, "NWE GPIO request failed (%d)\n", err); + goto out_mtd; + } + + gpiod_ale = devm_gpiod_get(&pdev->dev, "ale", GPIOD_OUT_LOW); + if (IS_ERR(gpiod_ale)) { + err = PTR_ERR(gpiod_ale); + dev_err(&pdev->dev, "ALE GPIO request failed (%d)\n", err); + goto out_mtd; + } + + gpiod_cle = devm_gpiod_get(&pdev->dev, "cle", GPIOD_OUT_LOW); + if (IS_ERR(gpiod_cle)) { + err = PTR_ERR(gpiod_cle); + dev_err(&pdev->dev, "CLE GPIO request failed (%d)\n", err); + goto out_mtd; + }
/* Scan to find existence of the device */ err = nand_scan(ams_delta_mtd, 1); @@ -246,9 +259,6 @@ static int ams_delta_init(struct platform_device *pdev) goto out;
out_mtd: - gpio_free_array(_mandatory_gpio, ARRAY_SIZE(_mandatory_gpio)); -out_gpio: - gpio_free(AMS_DELTA_GPIO_PIN_NAND_RB); iounmap(io_base); out_free: kfree(this); @@ -266,8 +276,6 @@ static int ams_delta_cleanup(struct platform_device *pdev) /* Release resources, unregister device */ nand_release(ams_delta_mtd);
- gpio_free_array(_mandatory_gpio, ARRAY_SIZE(_mandatory_gpio)); - gpio_free(AMS_DELTA_GPIO_PIN_NAND_RB); iounmap(io_base);
/* Free the MTD device structure */
Now as board header file is no longer included by drivers, move it to the root directory of mach-omap1.
Signed-off-by: Janusz Krzysztofik jmkrzyszt@gmail.com --- arch/arm/mach-omap1/ams-delta-fiq-handler.S | 2 +- arch/arm/mach-omap1/ams-delta-fiq.c | 3 +-- arch/arm/mach-omap1/board-ams-delta.c | 2 +- arch/arm/mach-omap1/{include/mach => }/board-ams-delta.h | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) rename arch/arm/mach-omap1/{include/mach => }/board-ams-delta.h (98%)
diff --git a/arch/arm/mach-omap1/ams-delta-fiq-handler.S b/arch/arm/mach-omap1/ams-delta-fiq-handler.S index ddc27638ba2a..2e2a17364dc9 100644 --- a/arch/arm/mach-omap1/ams-delta-fiq-handler.S +++ b/arch/arm/mach-omap1/ams-delta-fiq-handler.S @@ -17,9 +17,9 @@ #include <linux/platform_data/ams-delta-fiq.h>
#include <asm/assembler.h> -#include <mach/board-ams-delta.h>
#include "ams-delta-fiq.h" +#include "board-ams-delta.h" #include "iomap.h" #include "soc.h"
diff --git a/arch/arm/mach-omap1/ams-delta-fiq.c b/arch/arm/mach-omap1/ams-delta-fiq.c index b0dc7ddf5877..14c3d3f5255e 100644 --- a/arch/arm/mach-omap1/ams-delta-fiq.c +++ b/arch/arm/mach-omap1/ams-delta-fiq.c @@ -22,11 +22,10 @@ #include <linux/platform_data/ams-delta-fiq.h> #include <linux/platform_device.h>
-#include <mach/board-ams-delta.h> - #include <asm/fiq.h>
#include "ams-delta-fiq.h" +#include "board-ams-delta.h"
static struct fiq_handler fh = { .name = "ams-delta-fiq" diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c index dd28d2614d7f..34cb63ff45b3 100644 --- a/arch/arm/mach-omap1/board-ams-delta.c +++ b/arch/arm/mach-omap1/board-ams-delta.c @@ -36,7 +36,6 @@ #include <asm/mach/arch.h> #include <asm/mach/map.h>
-#include <mach/board-ams-delta.h> #include <linux/platform_data/keypad-omap.h> #include <mach/mux.h>
@@ -45,6 +44,7 @@ #include <mach/usb.h>
#include "ams-delta-fiq.h" +#include "board-ams-delta.h" #include "iomap.h" #include "common.h"
diff --git a/arch/arm/mach-omap1/include/mach/board-ams-delta.h b/arch/arm/mach-omap1/board-ams-delta.h similarity index 98% rename from arch/arm/mach-omap1/include/mach/board-ams-delta.h rename to arch/arm/mach-omap1/board-ams-delta.h index ad6f865d1f16..1fbada29431a 100644 --- a/arch/arm/mach-omap1/include/mach/board-ams-delta.h +++ b/arch/arm/mach-omap1/board-ams-delta.h @@ -1,5 +1,5 @@ /* - * arch/arm/plat-omap/include/mach/board-ams-delta.h + * arch/arm/mach-omap1/board-ams-delta.h * * Copyright (C) 2006 Jonathan McDowell noodles@earth.li *
On Monday, September 10, 2018 12:56:02 AM CEST Janusz Krzysztofik wrote:
This is a follow up of initial submission of a series consisted of 6 changes, 3 of which have been already applied or reworkeed.
Janusz Krzysztofik (3): video: fbdev: omapfb: lcd_ams_delta: use GPIO lookup table mtd: rawnand: ams-delta: use GPIO lookup table
Hi Tony,
Please ignore this patch. It may no longer be possible to merged it cleanly with nand/next tree. I'll exclude it from the series, rebase on top of nand/ next and submit via linux-mtd.
That shouldn't affect the two remaining patches of the series which should still apply and merge cleanly, but I can resend them renumbered if you wish.
Thanks, Janusz
ARM: OMAP1: ams-delta: make board header file local to mach-omap1
I'm submitting the three patches in series because the last one depends on the other two.
Tony, please set up an immutable tag for this series to be used by MTD as there are more changes on Amstrad Delta NAND driver coming in.
Thanks, Janusz
Changelog: v3:
- rebased on top of v4.19-rc1
- added Acked-by: received from Miquel
v2: [PATCH 1/6] ARM: OMAP1: ams-delta: add GPIO lookup tables
- already in mainline, commit 68e62a15a914
[PATCH 2/6] Input: ams_delta_serio: use GPIO lookup table
- reworked and submitted as a series, already in linux-omap, commit 68e62a15a914 ("ARM: OMAP1: ams-delta: drop GPIO lookup table for serio device") followed by 9 more
[PATCH 3/6] ASoC: ams_delta: use GPIO lookup table
- already in mainline, commit d65777d1a2cd
[PATCH 4/6] fbdev: omapfb: lcd_ams_delta: use GPIO lookup table
- resubmitting as [PATCH v2 1/3 v2]
v2: Remove problematic error code conversion no longer needed if used on top of commit d08605a64e67 ("ARM: OMAP1: ams-delta: move late devices back to init_machine") and commit 8853daf3b4ac ("gpiolib: Defer on non-DT find_chip_by_name() failure") already in linux-next [PATCH 5/6] mtd: rawnand: ams-delta: use GPIO lookup table
- resubmitting as [PATCH v2 2/3 v4]
v2: Fix handling of devm_gpiod_get_optional() return values - thanks to Andy Shevchenko. v3: Remove problematic error code conversion no longer needed if used on top of commit d08605a64e67 ("ARM: OMAP1: ams-delta: move late devices back to init_machine") and commit 8853daf3b4ac ("gpiolib: Defer on non-DT find_chip_by_name() failure") already in linux-next - thanks to Boris Brezillon v4: fix style issue - thanks to Boris Brezillon [PATCH 6/6] ARM: OMAP1: ams-delta: make board header file local to mach-omap1
- resending as [PATCH v2 3/3]
All dependencies mentioned in v2 changelog are satisfied in v4.19-rc1.
diffstat: arch/arm/mach-omap1/ams-delta-fiq-handler.S | 2 arch/arm/mach-omap1/ams-delta-fiq.c | 3 arch/arm/mach-omap1/board-ams-delta.c | 2 arch/arm/mach-omap1/board-ams-delta.h | 2 drivers/mtd/nand/raw/ams-delta.c | 126 +++++++++++++
+--------------
drivers/video/fbdev/omap/lcd_ams_delta.c | 55 ++++-------- 6 files changed, 93 insertions(+), 97 deletions(-)
* Janusz Krzysztofik jmkrzyszt@gmail.com [180919 18:13]:
On Monday, September 10, 2018 12:56:02 AM CEST Janusz Krzysztofik wrote:
This is a follow up of initial submission of a series consisted of 6 changes, 3 of which have been already applied or reworkeed.
Janusz Krzysztofik (3): video: fbdev: omapfb: lcd_ams_delta: use GPIO lookup table mtd: rawnand: ams-delta: use GPIO lookup table
Hi Tony,
Please ignore this patch. It may no longer be possible to merged it cleanly with nand/next tree. I'll exclude it from the series, rebase on top of nand/ next and submit via linux-mtd.
OK sounds good to me.
That shouldn't affect the two remaining patches of the series which should still apply and merge cleanly, but I can resend them renumbered if you wish.
Up to the mtd and fb folks as far as I'm concerned :)
Regards,
Tony
dri-devel@lists.freedesktop.org