mtd: nand: gpio: Convert to use GPIO descriptors
There is exactly one board in the kernel that defines platform data for the GPIO NAND driver. Use the feature to provide a lookup table for the GPIOs in the board file so we can convert the driver as a whole to just use GPIO descriptors. After this we can cut the use of <linux/of_gpio.h> and use the GPIO descriptor management from <linux/gpio/consumer.h> alone to grab and use the GPIOs used in the driver. I also created a local struct device *dev in the probe() function because I was getting annoyed with all the &pdev->dev dereferencing. Cc: arm@kernel.org Cc: Mike Rapoport <rppt@linux.vnet.ibm.com> Cc: Frans Klaver <fransklaver@gmail.com> Cc: Gerhard Sittig <gsi@denx.de> Cc: Jamie Iles <jamie.iles@oracle.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Marek Vasut <marek.vasut@gmail.com> Acked-by: Jamie Iles <jamie.iles@oracle.com> Acked-by: Olof Johansson <olof@lixom.net> Acked-by: Robert Jarzmik <robert.jarzmik@free.fr> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
This commit is contained in:

committed by
Boris Brezillon

parent
e8901f3ab5
commit
f3d0d8d938
@@ -14,7 +14,7 @@
|
||||
#include <linux/mtd/partitions.h>
|
||||
#include <linux/mtd/physmap.h>
|
||||
#include <linux/mtd/nand-gpio.h>
|
||||
|
||||
#include <linux/gpio/machine.h>
|
||||
#include <linux/spi/spi.h>
|
||||
#include <linux/spi/pxa2xx_spi.h>
|
||||
|
||||
@@ -176,6 +176,17 @@ static inline void cmx255_init_nor(void) {}
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_MTD_NAND_GPIO) || defined(CONFIG_MTD_NAND_GPIO_MODULE)
|
||||
|
||||
static struct gpiod_lookup_table cmx255_nand_gpiod_table = {
|
||||
.dev_id = "gpio-nand",
|
||||
.table = {
|
||||
GPIO_LOOKUP("gpio-pxa", GPIO_NAND_CS, "nce", GPIO_ACTIVE_HIGH),
|
||||
GPIO_LOOKUP("gpio-pxa", GPIO_NAND_CLE, "cle", GPIO_ACTIVE_HIGH),
|
||||
GPIO_LOOKUP("gpio-pxa", GPIO_NAND_ALE, "ale", GPIO_ACTIVE_HIGH),
|
||||
GPIO_LOOKUP("gpio-pxa", GPIO_NAND_RB, "rdy", GPIO_ACTIVE_HIGH),
|
||||
},
|
||||
};
|
||||
|
||||
static struct resource cmx255_nand_resource[] = {
|
||||
[0] = {
|
||||
.start = PXA_CS1_PHYS,
|
||||
@@ -198,11 +209,6 @@ static struct mtd_partition cmx255_nand_parts[] = {
|
||||
};
|
||||
|
||||
static struct gpio_nand_platdata cmx255_nand_platdata = {
|
||||
.gpio_nce = GPIO_NAND_CS,
|
||||
.gpio_cle = GPIO_NAND_CLE,
|
||||
.gpio_ale = GPIO_NAND_ALE,
|
||||
.gpio_rdy = GPIO_NAND_RB,
|
||||
.gpio_nwp = -1,
|
||||
.parts = cmx255_nand_parts,
|
||||
.num_parts = ARRAY_SIZE(cmx255_nand_parts),
|
||||
.chip_delay = 25,
|
||||
@@ -220,6 +226,7 @@ static struct platform_device cmx255_nand = {
|
||||
|
||||
static void __init cmx255_init_nand(void)
|
||||
{
|
||||
gpiod_add_lookup_table(&cmx255_nand_gpiod_table);
|
||||
platform_device_register(&cmx255_nand);
|
||||
}
|
||||
#else
|
||||
|
Reference in New Issue
Block a user