2018-02-16 19:19:10

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH 0/6] ARM: davinci: remove the mach-specific aemif driver - part 1

From: Bartosz Golaszewski <[email protected]>

Hi Sekhar,

while waiting for David's updated series I prepared the first part of
changes required to remove duplicate aemif support from mach-davinci.

I actually noticed that one of my previous changes from 2017 broke nand
in legacy mode - the clock lookup no longer works. This series addresses
it as well.

The first two patches fix the issue introduced in commit d8e22fb4ccac
("ARM: da850: add the nand dev_id to the clock lookup table").

Next two add support for board files to the aemif driver.

Last two add nand support to da850-lcdk in legacy mode and make
da850-evm use the platform driver instead of the mach-specific one.

If this series gets accepted, I'll prepere a follow-up moving all
other boards to the new platform driver.

Bartosz Golaszewski (6):
nand: davinci: rename the platform driver
ARM: davinci: update the nand driver names
memory: aemif: don't rely on kbuild for driver's name
memory: aemif: add support for board files
ARM: davinci: add aemif & nand support to da850-lcdk in legacy mode
ARM: davinci: use aemif platform driver in legacy mode for da850-evm

arch/arm/mach-davinci/board-da830-evm.c | 2 +-
arch/arm/mach-davinci/board-da850-evm.c | 93 +++++++++++---------
arch/arm/mach-davinci/board-dm355-evm.c | 2 +-
arch/arm/mach-davinci/board-dm355-leopard.c | 2 +-
arch/arm/mach-davinci/board-dm365-evm.c | 2 +-
arch/arm/mach-davinci/board-dm644x-evm.c | 2 +-
arch/arm/mach-davinci/board-dm646x-evm.c | 2 +-
arch/arm/mach-davinci/board-mityomapl138.c | 2 +-
arch/arm/mach-davinci/board-neuros-osd2.c | 2 +-
arch/arm/mach-davinci/board-omapl138-hawk.c | 132 ++++++++++++++++++++++++++++
arch/arm/mach-davinci/board-sffsdr.c | 2 +-
drivers/memory/ti-aemif.c | 59 ++++++++-----
drivers/mtd/nand/davinci_nand.c | 2 +-
include/linux/platform_data/ti-aemif.h | 9 ++
14 files changed, 240 insertions(+), 73 deletions(-)

--
2.16.1



2018-02-16 19:18:46

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH 1/6] nand: davinci: rename the platform driver

From: Bartosz Golaszewski <[email protected]>

Commit d8e22fb4ccac ("ARM: da850: add the nand dev_id to the clock
lookup table") broke the nand support in board file mode for
da850-based boards. Instead of reverting it and breaking the DT users
in the process (due to clock lookup), rename the driver to match the
clock table before renaming the users.

Fixes: d8e22fb4ccac ("ARM: da850: add the nand dev_id to the clock lookup table")
Signed-off-by: Bartosz Golaszewski <[email protected]>
---
drivers/mtd/nand/davinci_nand.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/davinci_nand.c b/drivers/mtd/nand/davinci_nand.c
index ccc8c43abcff..4fb143bf1872 100644
--- a/drivers/mtd/nand/davinci_nand.c
+++ b/drivers/mtd/nand/davinci_nand.c
@@ -865,7 +865,7 @@ static struct platform_driver nand_davinci_driver = {
.probe = nand_davinci_probe,
.remove = nand_davinci_remove,
.driver = {
- .name = "davinci_nand",
+ .name = "davinci-nand",
.of_match_table = of_match_ptr(davinci_nand_of_match),
},
};
--
2.16.1


2018-02-16 19:18:53

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH 6/6] ARM: davinci: use aemif platform driver in legacy mode for da850-evm

From: Bartosz Golaszewski <[email protected]>

We now support board files in aemif. Use the platform driver instead
of the handcrafted API in da850-evm.

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
arch/arm/mach-davinci/board-da850-evm.c | 93 ++++++++++++++++++---------------
1 file changed, 51 insertions(+), 42 deletions(-)

diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index 828194045a2b..88e1d00a1f56 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -33,6 +33,7 @@
#include <linux/platform_data/gpio-davinci.h>
#include <linux/platform_data/mtd-davinci.h>
#include <linux/platform_data/mtd-davinci-aemif.h>
+#include <linux/platform_data/ti-aemif.h>
#include <linux/platform_data/spi-davinci.h>
#include <linux/platform_data/uio_pruss.h>
#include <linux/regulator/machine.h>
@@ -185,16 +186,6 @@ static struct resource da850_evm_norflash_resource[] = {
},
};

-static struct platform_device da850_evm_norflash_device = {
- .name = "physmap-flash",
- .id = 0,
- .dev = {
- .platform_data = &da850_evm_norflash_data,
- },
- .num_resources = 1,
- .resource = da850_evm_norflash_resource,
-};
-
/* DA850/OMAP-L138 EVM includes a 512 MByte large-page NAND flash
* (128K blocks). It may be used instead of the (default) SPI flash
* to boot, using TI's tools to install the secondary boot loader
@@ -265,37 +256,58 @@ static struct resource da850_evm_nandflash_resource[] = {
},
};

-static struct platform_device da850_evm_nandflash_device = {
- .name = "davinci-nand",
- .id = 1,
- .dev = {
- .platform_data = &da850_evm_nandflash_data,
- },
- .num_resources = ARRAY_SIZE(da850_evm_nandflash_resource),
- .resource = da850_evm_nandflash_resource,
+static struct resource da850_evm_aemif_resource[] = {
+ {
+ .start = DA8XX_AEMIF_CTL_BASE,
+ .end = DA8XX_AEMIF_CTL_BASE + SZ_32K,
+ .flags = IORESOURCE_MEM,
+ }
};

-static struct platform_device *da850_evm_devices[] = {
- &da850_evm_nandflash_device,
- &da850_evm_norflash_device,
+static struct aemif_abus_data da850_evm_aemif_abus_data[] = {
+ {
+ .cs = 3,
+ }
};

-#define DA8XX_AEMIF_CE2CFG_OFFSET 0x10
-#define DA8XX_AEMIF_ASIZE_16BIT 0x1
-
-static void __init da850_evm_init_nor(void)
-{
- void __iomem *aemif_addr;
-
- aemif_addr = ioremap(DA8XX_AEMIF_CTL_BASE, SZ_32K);
+static struct platform_device da850_evm_aemif_devices[] = {
+ {
+ .name = "davinci-nand",
+ .id = 1,
+ .dev = {
+ .platform_data = &da850_evm_nandflash_data,
+ },
+ .num_resources = ARRAY_SIZE(da850_evm_nandflash_resource),
+ .resource = da850_evm_nandflash_resource,
+ },
+ {
+ .name = "physmap-flash",
+ .id = 0,
+ .dev = {
+ .platform_data = &da850_evm_norflash_data,
+ },
+ .num_resources = 1,
+ .resource = da850_evm_norflash_resource,
+ }
+};

- /* Configure data bus width of CS2 to 16 bit */
- writel(readl(aemif_addr + DA8XX_AEMIF_CE2CFG_OFFSET) |
- DA8XX_AEMIF_ASIZE_16BIT,
- aemif_addr + DA8XX_AEMIF_CE2CFG_OFFSET);
+static struct aemif_platform_data da850_evm_aemif_pdata = {
+ .cs_offset = 2,
+ .abus_data = da850_evm_aemif_abus_data,
+ .num_abus_data = ARRAY_SIZE(da850_evm_aemif_abus_data),
+ .sub_devices = da850_evm_aemif_devices,
+ .num_sub_devices = ARRAY_SIZE(da850_evm_aemif_devices),
+};

- iounmap(aemif_addr);
-}
+static struct platform_device da850_evm_aemif_device = {
+ .name = "ti-aemif",
+ .dev = {
+ .platform_data = &da850_evm_aemif_pdata,
+ },
+ .resource = da850_evm_aemif_resource,
+ .num_resources = ARRAY_SIZE(da850_evm_aemif_resource),
+ .id = -1,
+};

static const short da850_evm_nand_pins[] = {
DA850_EMA_D_0, DA850_EMA_D_1, DA850_EMA_D_2, DA850_EMA_D_3,
@@ -338,13 +350,10 @@ static inline void da850_evm_setup_nor_nand(void)
pr_warn("%s: NOR mux setup failed: %d\n",
__func__, ret);

- da850_evm_init_nor();
-
- platform_add_devices(da850_evm_devices,
- ARRAY_SIZE(da850_evm_devices));
-
- if (davinci_aemif_setup(&da850_evm_nandflash_device))
- pr_warn("%s: Cannot configure AEMIF.\n", __func__);
+ ret = platform_device_register(&da850_evm_aemif_device);
+ if (ret)
+ pr_warn("%s: registering aemif failed: %d\n",
+ __func__, ret);
}
}

--
2.16.1


2018-02-16 19:19:00

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH 2/6] ARM: davinci: update the nand driver names

From: Bartosz Golaszewski <[email protected]>

Since commit d8e22fb4ccac ("ARM: da850: add the nand dev_id to the clock
lookup table") we can no longer correctly lookup the nand clock when
booting in legacy mode. Said commit added a dev_id to the nand clock
which must match and it doesn't correspond with the device name which
is "davinci_nand" instead of "davinci-nand".

The driver name has been changed. Update the board files.

Fixes: d8e22fb4ccac ("ARM: da850: add the nand dev_id to the clock lookup table")
Signed-off-by: Bartosz Golaszewski <[email protected]>
---
arch/arm/mach-davinci/board-da830-evm.c | 2 +-
arch/arm/mach-davinci/board-da850-evm.c | 2 +-
arch/arm/mach-davinci/board-dm355-evm.c | 2 +-
arch/arm/mach-davinci/board-dm355-leopard.c | 2 +-
arch/arm/mach-davinci/board-dm365-evm.c | 2 +-
arch/arm/mach-davinci/board-dm644x-evm.c | 2 +-
arch/arm/mach-davinci/board-dm646x-evm.c | 2 +-
arch/arm/mach-davinci/board-mityomapl138.c | 2 +-
arch/arm/mach-davinci/board-neuros-osd2.c | 2 +-
arch/arm/mach-davinci/board-sffsdr.c | 2 +-
10 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/arch/arm/mach-davinci/board-da830-evm.c b/arch/arm/mach-davinci/board-da830-evm.c
index f673cd7a6766..f8838c7b174b 100644
--- a/arch/arm/mach-davinci/board-da830-evm.c
+++ b/arch/arm/mach-davinci/board-da830-evm.c
@@ -348,7 +348,7 @@ static struct resource da830_evm_nand_resources[] = {
};

static struct platform_device da830_evm_nand_device = {
- .name = "davinci_nand",
+ .name = "davinci-nand",
.id = 1,
.dev = {
.platform_data = &da830_evm_nand_pdata,
diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index d898a94f6eae..828194045a2b 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -266,7 +266,7 @@ static struct resource da850_evm_nandflash_resource[] = {
};

static struct platform_device da850_evm_nandflash_device = {
- .name = "davinci_nand",
+ .name = "davinci-nand",
.id = 1,
.dev = {
.platform_data = &da850_evm_nandflash_data,
diff --git a/arch/arm/mach-davinci/board-dm355-evm.c b/arch/arm/mach-davinci/board-dm355-evm.c
index e457f299cd44..58ca7f56e112 100644
--- a/arch/arm/mach-davinci/board-dm355-evm.c
+++ b/arch/arm/mach-davinci/board-dm355-evm.c
@@ -98,7 +98,7 @@ static struct resource davinci_nand_resources[] = {
};

static struct platform_device davinci_nand_device = {
- .name = "davinci_nand",
+ .name = "davinci-nand",
.id = 0,

.num_resources = ARRAY_SIZE(davinci_nand_resources),
diff --git a/arch/arm/mach-davinci/board-dm355-leopard.c b/arch/arm/mach-davinci/board-dm355-leopard.c
index be997243447b..196238117f9a 100644
--- a/arch/arm/mach-davinci/board-dm355-leopard.c
+++ b/arch/arm/mach-davinci/board-dm355-leopard.c
@@ -93,7 +93,7 @@ static struct resource davinci_nand_resources[] = {
};

static struct platform_device davinci_nand_device = {
- .name = "davinci_nand",
+ .name = "davinci-nand",
.id = 0,

.num_resources = ARRAY_SIZE(davinci_nand_resources),
diff --git a/arch/arm/mach-davinci/board-dm365-evm.c b/arch/arm/mach-davinci/board-dm365-evm.c
index e75741fb2c1d..563d66df480b 100644
--- a/arch/arm/mach-davinci/board-dm365-evm.c
+++ b/arch/arm/mach-davinci/board-dm365-evm.c
@@ -159,7 +159,7 @@ static struct resource davinci_nand_resources[] = {
};

static struct platform_device davinci_nand_device = {
- .name = "davinci_nand",
+ .name = "davinci-nand",
.id = 0,
.num_resources = ARRAY_SIZE(davinci_nand_resources),
.resource = davinci_nand_resources,
diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c b/arch/arm/mach-davinci/board-dm644x-evm.c
index 85e6fb33b1ee..e42ae2163c75 100644
--- a/arch/arm/mach-davinci/board-dm644x-evm.c
+++ b/arch/arm/mach-davinci/board-dm644x-evm.c
@@ -173,7 +173,7 @@ static struct resource davinci_evm_nandflash_resource[] = {
};

static struct platform_device davinci_evm_nandflash_device = {
- .name = "davinci_nand",
+ .name = "davinci-nand",
.id = 0,
.dev = {
.platform_data = &davinci_evm_nandflash_data,
diff --git a/arch/arm/mach-davinci/board-dm646x-evm.c b/arch/arm/mach-davinci/board-dm646x-evm.c
index cb0a41e83582..614dd211e6fc 100644
--- a/arch/arm/mach-davinci/board-dm646x-evm.c
+++ b/arch/arm/mach-davinci/board-dm646x-evm.c
@@ -108,7 +108,7 @@ static struct resource davinci_nand_resources[] = {
};

static struct platform_device davinci_nand_device = {
- .name = "davinci_nand",
+ .name = "davinci-nand",
.id = 0,

.num_resources = ARRAY_SIZE(davinci_nand_resources),
diff --git a/arch/arm/mach-davinci/board-mityomapl138.c b/arch/arm/mach-davinci/board-mityomapl138.c
index b73ce7bae81f..bf3659a21897 100644
--- a/arch/arm/mach-davinci/board-mityomapl138.c
+++ b/arch/arm/mach-davinci/board-mityomapl138.c
@@ -422,7 +422,7 @@ static struct resource mityomapl138_nandflash_resource[] = {
};

static struct platform_device mityomapl138_nandflash_device = {
- .name = "davinci_nand",
+ .name = "davinci-nand",
.id = 1,
.dev = {
.platform_data = &mityomapl138_nandflash_data,
diff --git a/arch/arm/mach-davinci/board-neuros-osd2.c b/arch/arm/mach-davinci/board-neuros-osd2.c
index 4da210a1a110..04132494a7c9 100644
--- a/arch/arm/mach-davinci/board-neuros-osd2.c
+++ b/arch/arm/mach-davinci/board-neuros-osd2.c
@@ -107,7 +107,7 @@ static struct resource davinci_ntosd2_nandflash_resource[] = {
};

static struct platform_device davinci_ntosd2_nandflash_device = {
- .name = "davinci_nand",
+ .name = "davinci-nand",
.id = 0,
.dev = {
.platform_data = &davinci_ntosd2_nandflash_data,
diff --git a/arch/arm/mach-davinci/board-sffsdr.c b/arch/arm/mach-davinci/board-sffsdr.c
index d85accf7f760..c8569c8aa6e3 100644
--- a/arch/arm/mach-davinci/board-sffsdr.c
+++ b/arch/arm/mach-davinci/board-sffsdr.c
@@ -83,7 +83,7 @@ static struct resource davinci_sffsdr_nandflash_resource[] = {
};

static struct platform_device davinci_sffsdr_nandflash_device = {
- .name = "davinci_nand", /* Name of driver */
+ .name = "davinci-nand", /* Name of driver */
.id = 0,
.dev = {
.platform_data = &davinci_sffsdr_nandflash_data,
--
2.16.1


2018-02-16 19:19:20

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH 4/6] memory: aemif: add support for board files

From: Bartosz Golaszewski <[email protected]>

Currently aemif is supported in two places separately. By the platform
driver in drivers/memory and by a hand crafted driver in mach-davinci.

We want to drop the latter but also keep the legacy mode. Add support
for board files to the aemif driver.

The new structure in platform data currently only contains the chip
select number, since currently existing users don't require anything
else, but it can be extended in the future.

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
drivers/memory/ti-aemif.c | 57 ++++++++++++++++++++++------------
include/linux/platform_data/ti-aemif.h | 9 ++++++
2 files changed, 46 insertions(+), 20 deletions(-)

diff --git a/drivers/memory/ti-aemif.c b/drivers/memory/ti-aemif.c
index 588e58d40d1b..27d2b076f465 100644
--- a/drivers/memory/ti-aemif.c
+++ b/drivers/memory/ti-aemif.c
@@ -339,9 +339,6 @@ static int aemif_probe(struct platform_device *pdev)
struct aemif_platform_data *pdata;
struct of_dev_auxdata *dev_lookup;

- if (np == NULL)
- return 0;
-
aemif = devm_kzalloc(dev, sizeof(*aemif), GFP_KERNEL);
if (!aemif)
return -ENOMEM;
@@ -363,8 +360,10 @@ static int aemif_probe(struct platform_device *pdev)

aemif->clk_rate = clk_get_rate(aemif->clk) / MSEC_PER_SEC;

- if (of_device_is_compatible(np, "ti,da850-aemif"))
+ if (np && of_device_is_compatible(np, "ti,da850-aemif"))
aemif->cs_offset = 2;
+ else if (pdata)
+ aemif->cs_offset = pdata->cs_offset;

res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
aemif->base = devm_ioremap_resource(dev, res);
@@ -373,15 +372,23 @@ static int aemif_probe(struct platform_device *pdev)
goto error;
}

- /*
- * For every controller device node, there is a cs device node that
- * describe the bus configuration parameters. This functions iterate
- * over these nodes and update the cs data array.
- */
- for_each_available_child_of_node(np, child_np) {
- ret = of_aemif_parse_abus_config(pdev, child_np);
- if (ret < 0)
- goto error;
+ if (np) {
+ /*
+ * For every controller device node, there is a cs device node
+ * that describe the bus configuration parameters. This
+ * functions iterate over these nodes and update the cs data
+ * array.
+ */
+ for_each_available_child_of_node(np, child_np) {
+ ret = of_aemif_parse_abus_config(pdev, child_np);
+ if (ret < 0)
+ goto error;
+ }
+ } else if (pdata && pdata->num_abus_data > 0) {
+ for (i = 0; i < pdata->num_abus_data; i++, aemif->num_cs++) {
+ aemif->cs_data[i].cs = pdata->abus_data->cs;
+ aemif_get_hw_params(pdev, i);
+ }
}

for (i = 0; i < aemif->num_cs; i++) {
@@ -394,14 +401,24 @@ static int aemif_probe(struct platform_device *pdev)
}

/*
- * Create a child devices explicitly from here to
- * guarantee that the child will be probed after the AEMIF timing
- * parameters are set.
+ * Create a child devices explicitly from here to guarantee that the
+ * child will be probed after the AEMIF timing parameters are set.
*/
- for_each_available_child_of_node(np, child_np) {
- ret = of_platform_populate(child_np, NULL, dev_lookup, dev);
- if (ret < 0)
- goto error;
+ if (np) {
+ for_each_available_child_of_node(np, child_np) {
+ ret = of_platform_populate(child_np, NULL,
+ dev_lookup, dev);
+ if (ret < 0)
+ goto error;
+ }
+ } else {
+ for (i = 0; i < pdata->num_sub_devices; i++) {
+ ret = platform_device_register(&pdata->sub_devices[i]);
+ if (ret) {
+ dev_warn(dev, "Error register sub device %s\n",
+ pdata->sub_devices[i].name);
+ }
+ }
}

return 0;
diff --git a/include/linux/platform_data/ti-aemif.h b/include/linux/platform_data/ti-aemif.h
index ac72e115093c..dfe8901128c9 100644
--- a/include/linux/platform_data/ti-aemif.h
+++ b/include/linux/platform_data/ti-aemif.h
@@ -16,8 +16,17 @@

#include <linux/of_platform.h>

+struct aemif_abus_data {
+ u32 cs;
+};
+
struct aemif_platform_data {
struct of_dev_auxdata *dev_lookup;
+ u32 cs_offset;
+ struct aemif_abus_data *abus_data;
+ size_t num_abus_data;
+ struct platform_device *sub_devices;
+ size_t num_sub_devices;
};

#endif /* __TI_DAVINCI_AEMIF_DATA_H__ */
--
2.16.1


2018-02-16 19:19:29

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH 5/6] ARM: davinci: add aemif & nand support to da850-lcdk in legacy mode

From: Bartosz Golaszewski <[email protected]>

We now have support for aemif & nand from board files. As an example
add support for nand to da850-lcdk in legacy mode.

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
arch/arm/mach-davinci/board-omapl138-hawk.c | 132 ++++++++++++++++++++++++++++
1 file changed, 132 insertions(+)

diff --git a/arch/arm/mach-davinci/board-omapl138-hawk.c b/arch/arm/mach-davinci/board-omapl138-hawk.c
index a3e78074be70..6a4f2c1d460d 100644
--- a/arch/arm/mach-davinci/board-omapl138-hawk.c
+++ b/arch/arm/mach-davinci/board-omapl138-hawk.c
@@ -16,6 +16,11 @@
#include <linux/gpio.h>
#include <linux/gpio/machine.h>
#include <linux/platform_data/gpio-davinci.h>
+#include <linux/platform_data/ti-aemif.h>
+#include <linux/mtd/rawnand.h>
+#include <linux/mtd/partitions.h>
+#include <linux/platform_data/mtd-davinci.h>
+#include <linux/platform_data/mtd-davinci-aemif.h>
#include <linux/regulator/machine.h>

#include <asm/mach-types.h>
@@ -162,6 +167,129 @@ static __init void omapl138_hawk_mmc_init(void)
gpiod_remove_lookup_table(&mmc_gpios_table);
}

+static struct mtd_partition omapl138_hawk_nandflash_partition[] = {
+ {
+ .name = "u-boot env",
+ .offset = 0,
+ .size = SZ_128K,
+ .mask_flags = MTD_WRITEABLE,
+ },
+ {
+ .name = "u-boot",
+ .offset = MTDPART_OFS_APPEND,
+ .size = SZ_128K,
+ .mask_flags = MTD_WRITEABLE,
+ },
+ {
+ .name = "free space",
+ .offset = MTDPART_OFS_APPEND,
+ .size = MTDPART_SIZ_FULL,
+ .mask_flags = 0,
+ },
+};
+
+static struct davinci_aemif_timing omapl138_hawk_nandflash_timing = {
+ .wsetup = 24,
+ .wstrobe = 21,
+ .whold = 14,
+ .rsetup = 19,
+ .rstrobe = 50,
+ .rhold = 0,
+ .ta = 20,
+};
+
+static struct davinci_nand_pdata omapl138_hawk_nandflash_data = {
+ .parts = omapl138_hawk_nandflash_partition,
+ .nr_parts = ARRAY_SIZE(omapl138_hawk_nandflash_partition),
+ .ecc_mode = NAND_ECC_HW,
+ .ecc_bits = 4,
+ .bbt_options = NAND_BBT_USE_FLASH,
+ .options = NAND_BUSWIDTH_16,
+ .timing = &omapl138_hawk_nandflash_timing,
+ .mask_chipsel = 0,
+ .mask_ale = 0,
+ .mask_cle = 0,
+};
+
+static struct resource omapl138_hawk_nandflash_resource[] = {
+ {
+ .start = DA8XX_AEMIF_CS3_BASE,
+ .end = DA8XX_AEMIF_CS3_BASE + SZ_32M,
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = DA8XX_AEMIF_CTL_BASE,
+ .end = DA8XX_AEMIF_CTL_BASE + SZ_32K,
+ .flags = IORESOURCE_MEM,
+ },
+};
+
+static struct resource omapl138_hawk_aemif_resource[] = {
+ {
+ .start = DA8XX_AEMIF_CTL_BASE,
+ .end = DA8XX_AEMIF_CTL_BASE + SZ_32K,
+ .flags = IORESOURCE_MEM,
+ }
+};
+
+static struct aemif_abus_data omapl138_hawk_aemif_abus_data[] = {
+ {
+ .cs = 3,
+ }
+};
+
+static struct platform_device omapl138_hawk_aemif_devices[] = {
+ {
+ .name = "davinci-nand",
+ .id = 1,
+ .dev = {
+ .platform_data = &omapl138_hawk_nandflash_data,
+ },
+ .resource = omapl138_hawk_nandflash_resource,
+ .num_resources = ARRAY_SIZE(omapl138_hawk_nandflash_resource),
+ .id = 0,
+ }
+};
+
+static struct aemif_platform_data omapl138_hawk_aemif_pdata = {
+ .cs_offset = 2,
+ .abus_data = omapl138_hawk_aemif_abus_data,
+ .num_abus_data = ARRAY_SIZE(omapl138_hawk_aemif_abus_data),
+ .sub_devices = omapl138_hawk_aemif_devices,
+ .num_sub_devices = ARRAY_SIZE(omapl138_hawk_aemif_devices),
+};
+
+static struct platform_device omapl138_hawk_aemif_device = {
+ .name = "ti-aemif",
+ .dev = {
+ .platform_data = &omapl138_hawk_aemif_pdata,
+ },
+ .resource = omapl138_hawk_aemif_resource,
+ .num_resources = ARRAY_SIZE(omapl138_hawk_aemif_resource),
+ .id = -1,
+};
+
+static const short omapl138_hawk_nand_pins[] = {
+ DA850_EMA_WAIT_1, DA850_NEMA_OE, DA850_NEMA_WE, DA850_NEMA_CS_3,
+ DA850_EMA_D_0, DA850_EMA_D_1, DA850_EMA_D_2, DA850_EMA_D_3,
+ DA850_EMA_D_4, DA850_EMA_D_5, DA850_EMA_D_6, DA850_EMA_D_7,
+ DA850_EMA_D_8, DA850_EMA_D_9, DA850_EMA_D_10, DA850_EMA_D_11,
+ DA850_EMA_D_12, DA850_EMA_D_13, DA850_EMA_D_14, DA850_EMA_D_15,
+ DA850_EMA_A_1, DA850_EMA_A_2,
+ -1
+};
+
+static int omapl138_hawk_register_aemif(void)
+{
+ int ret;
+
+ ret = davinci_cfg_reg_list(omapl138_hawk_nand_pins);
+ if (ret)
+ pr_warn("%s: NAND mux setup failed: %d\n", __func__, ret);
+
+ return platform_device_register(&omapl138_hawk_aemif_device);
+}
+
static irqreturn_t omapl138_hawk_usb_ocic_irq(int irq, void *dev_id);
static da8xx_ocic_handler_t hawk_usb_ocic_handler;

@@ -301,6 +429,10 @@ static __init void omapl138_hawk_init(void)

omapl138_hawk_usb_init();

+ ret = omapl138_hawk_register_aemif();
+ if (ret)
+ pr_warn("%s: aemif registration failed: %d\n", __func__, ret);
+
ret = da8xx_register_watchdog();
if (ret)
pr_warn("%s: watchdog registration failed: %d\n",
--
2.16.1


2018-02-16 19:20:08

by Bartosz Golaszewski

[permalink] [raw]
Subject: [PATCH 3/6] memory: aemif: don't rely on kbuild for driver's name

From: Bartosz Golaszewski <[email protected]>

We want to use aemif from board files. Use a static name in the
driver's code.

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
drivers/memory/ti-aemif.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/memory/ti-aemif.c b/drivers/memory/ti-aemif.c
index 2744b1b91b57..588e58d40d1b 100644
--- a/drivers/memory/ti-aemif.c
+++ b/drivers/memory/ti-aemif.c
@@ -422,7 +422,7 @@ static struct platform_driver aemif_driver = {
.probe = aemif_probe,
.remove = aemif_remove,
.driver = {
- .name = KBUILD_MODNAME,
+ .name = "ti-aemif",
.of_match_table = of_match_ptr(aemif_of_match),
},
};
--
2.16.1


2018-02-16 19:23:11

by Boris Brezillon

[permalink] [raw]
Subject: Re: [PATCH 2/6] ARM: davinci: update the nand driver names

On Fri, 16 Feb 2018 17:47:08 +0100
Bartosz Golaszewski <[email protected]> wrote:

> From: Bartosz Golaszewski <[email protected]>
>
> Since commit d8e22fb4ccac ("ARM: da850: add the nand dev_id to the clock
> lookup table") we can no longer correctly lookup the nand clock when
> booting in legacy mode. Said commit added a dev_id to the nand clock
> which must match and it doesn't correspond with the device name which
> is "davinci_nand" instead of "davinci-nand".
>
> The driver name has been changed. Update the board files.

Should be squashed in patch 1, otherwise your patch series is not
bisectable.

>
> Fixes: d8e22fb4ccac ("ARM: da850: add the nand dev_id to the clock lookup table")
> Signed-off-by: Bartosz Golaszewski <[email protected]>
> ---
> arch/arm/mach-davinci/board-da830-evm.c | 2 +-
> arch/arm/mach-davinci/board-da850-evm.c | 2 +-
> arch/arm/mach-davinci/board-dm355-evm.c | 2 +-
> arch/arm/mach-davinci/board-dm355-leopard.c | 2 +-
> arch/arm/mach-davinci/board-dm365-evm.c | 2 +-
> arch/arm/mach-davinci/board-dm644x-evm.c | 2 +-
> arch/arm/mach-davinci/board-dm646x-evm.c | 2 +-
> arch/arm/mach-davinci/board-mityomapl138.c | 2 +-
> arch/arm/mach-davinci/board-neuros-osd2.c | 2 +-
> arch/arm/mach-davinci/board-sffsdr.c | 2 +-
> 10 files changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/arch/arm/mach-davinci/board-da830-evm.c b/arch/arm/mach-davinci/board-da830-evm.c
> index f673cd7a6766..f8838c7b174b 100644
> --- a/arch/arm/mach-davinci/board-da830-evm.c
> +++ b/arch/arm/mach-davinci/board-da830-evm.c
> @@ -348,7 +348,7 @@ static struct resource da830_evm_nand_resources[] = {
> };
>
> static struct platform_device da830_evm_nand_device = {
> - .name = "davinci_nand",
> + .name = "davinci-nand",
> .id = 1,
> .dev = {
> .platform_data = &da830_evm_nand_pdata,
> diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
> index d898a94f6eae..828194045a2b 100644
> --- a/arch/arm/mach-davinci/board-da850-evm.c
> +++ b/arch/arm/mach-davinci/board-da850-evm.c
> @@ -266,7 +266,7 @@ static struct resource da850_evm_nandflash_resource[] = {
> };
>
> static struct platform_device da850_evm_nandflash_device = {
> - .name = "davinci_nand",
> + .name = "davinci-nand",
> .id = 1,
> .dev = {
> .platform_data = &da850_evm_nandflash_data,
> diff --git a/arch/arm/mach-davinci/board-dm355-evm.c b/arch/arm/mach-davinci/board-dm355-evm.c
> index e457f299cd44..58ca7f56e112 100644
> --- a/arch/arm/mach-davinci/board-dm355-evm.c
> +++ b/arch/arm/mach-davinci/board-dm355-evm.c
> @@ -98,7 +98,7 @@ static struct resource davinci_nand_resources[] = {
> };
>
> static struct platform_device davinci_nand_device = {
> - .name = "davinci_nand",
> + .name = "davinci-nand",
> .id = 0,
>
> .num_resources = ARRAY_SIZE(davinci_nand_resources),
> diff --git a/arch/arm/mach-davinci/board-dm355-leopard.c b/arch/arm/mach-davinci/board-dm355-leopard.c
> index be997243447b..196238117f9a 100644
> --- a/arch/arm/mach-davinci/board-dm355-leopard.c
> +++ b/arch/arm/mach-davinci/board-dm355-leopard.c
> @@ -93,7 +93,7 @@ static struct resource davinci_nand_resources[] = {
> };
>
> static struct platform_device davinci_nand_device = {
> - .name = "davinci_nand",
> + .name = "davinci-nand",
> .id = 0,
>
> .num_resources = ARRAY_SIZE(davinci_nand_resources),
> diff --git a/arch/arm/mach-davinci/board-dm365-evm.c b/arch/arm/mach-davinci/board-dm365-evm.c
> index e75741fb2c1d..563d66df480b 100644
> --- a/arch/arm/mach-davinci/board-dm365-evm.c
> +++ b/arch/arm/mach-davinci/board-dm365-evm.c
> @@ -159,7 +159,7 @@ static struct resource davinci_nand_resources[] = {
> };
>
> static struct platform_device davinci_nand_device = {
> - .name = "davinci_nand",
> + .name = "davinci-nand",
> .id = 0,
> .num_resources = ARRAY_SIZE(davinci_nand_resources),
> .resource = davinci_nand_resources,
> diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c b/arch/arm/mach-davinci/board-dm644x-evm.c
> index 85e6fb33b1ee..e42ae2163c75 100644
> --- a/arch/arm/mach-davinci/board-dm644x-evm.c
> +++ b/arch/arm/mach-davinci/board-dm644x-evm.c
> @@ -173,7 +173,7 @@ static struct resource davinci_evm_nandflash_resource[] = {
> };
>
> static struct platform_device davinci_evm_nandflash_device = {
> - .name = "davinci_nand",
> + .name = "davinci-nand",
> .id = 0,
> .dev = {
> .platform_data = &davinci_evm_nandflash_data,
> diff --git a/arch/arm/mach-davinci/board-dm646x-evm.c b/arch/arm/mach-davinci/board-dm646x-evm.c
> index cb0a41e83582..614dd211e6fc 100644
> --- a/arch/arm/mach-davinci/board-dm646x-evm.c
> +++ b/arch/arm/mach-davinci/board-dm646x-evm.c
> @@ -108,7 +108,7 @@ static struct resource davinci_nand_resources[] = {
> };
>
> static struct platform_device davinci_nand_device = {
> - .name = "davinci_nand",
> + .name = "davinci-nand",
> .id = 0,
>
> .num_resources = ARRAY_SIZE(davinci_nand_resources),
> diff --git a/arch/arm/mach-davinci/board-mityomapl138.c b/arch/arm/mach-davinci/board-mityomapl138.c
> index b73ce7bae81f..bf3659a21897 100644
> --- a/arch/arm/mach-davinci/board-mityomapl138.c
> +++ b/arch/arm/mach-davinci/board-mityomapl138.c
> @@ -422,7 +422,7 @@ static struct resource mityomapl138_nandflash_resource[] = {
> };
>
> static struct platform_device mityomapl138_nandflash_device = {
> - .name = "davinci_nand",
> + .name = "davinci-nand",
> .id = 1,
> .dev = {
> .platform_data = &mityomapl138_nandflash_data,
> diff --git a/arch/arm/mach-davinci/board-neuros-osd2.c b/arch/arm/mach-davinci/board-neuros-osd2.c
> index 4da210a1a110..04132494a7c9 100644
> --- a/arch/arm/mach-davinci/board-neuros-osd2.c
> +++ b/arch/arm/mach-davinci/board-neuros-osd2.c
> @@ -107,7 +107,7 @@ static struct resource davinci_ntosd2_nandflash_resource[] = {
> };
>
> static struct platform_device davinci_ntosd2_nandflash_device = {
> - .name = "davinci_nand",
> + .name = "davinci-nand",
> .id = 0,
> .dev = {
> .platform_data = &davinci_ntosd2_nandflash_data,
> diff --git a/arch/arm/mach-davinci/board-sffsdr.c b/arch/arm/mach-davinci/board-sffsdr.c
> index d85accf7f760..c8569c8aa6e3 100644
> --- a/arch/arm/mach-davinci/board-sffsdr.c
> +++ b/arch/arm/mach-davinci/board-sffsdr.c
> @@ -83,7 +83,7 @@ static struct resource davinci_sffsdr_nandflash_resource[] = {
> };
>
> static struct platform_device davinci_sffsdr_nandflash_device = {
> - .name = "davinci_nand", /* Name of driver */
> + .name = "davinci-nand", /* Name of driver */
> .id = 0,
> .dev = {
> .platform_data = &davinci_sffsdr_nandflash_data,



--
Boris Brezillon, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
http://bootlin.com

2018-02-16 19:24:32

by Boris Brezillon

[permalink] [raw]
Subject: Re: [PATCH 1/6] nand: davinci: rename the platform driver

Hi Bartosz

Prefix should be "mtd: nand: davinci:"

On Fri, 16 Feb 2018 17:47:07 +0100
Bartosz Golaszewski <[email protected]> wrote:

> From: Bartosz Golaszewski <[email protected]>
>
> Commit d8e22fb4ccac ("ARM: da850: add the nand dev_id to the clock
> lookup table") broke the nand support in board file mode for
> da850-based boards. Instead of reverting it and breaking the DT users
> in the process (due to clock lookup), rename the driver to match the
> clock table before renaming the users.
>
> Fixes: d8e22fb4ccac ("ARM: da850: add the nand dev_id to the clock lookup table")

You probably want Cc: <[email protected]> here.

> Signed-off-by: Bartosz Golaszewski <[email protected]>
> ---
> drivers/mtd/nand/davinci_nand.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mtd/nand/davinci_nand.c b/drivers/mtd/nand/davinci_nand.c
> index ccc8c43abcff..4fb143bf1872 100644
> --- a/drivers/mtd/nand/davinci_nand.c
> +++ b/drivers/mtd/nand/davinci_nand.c
> @@ -865,7 +865,7 @@ static struct platform_driver nand_davinci_driver = {
> .probe = nand_davinci_probe,
> .remove = nand_davinci_remove,
> .driver = {
> - .name = "davinci_nand",
> + .name = "davinci-nand",

And by doing that you're breaking C board files which are using the
name with an underscore.

> .of_match_table = of_match_ptr(davinci_nand_of_match),
> },
> };

Regards,

Boris

--
Boris Brezillon, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
http://bootlin.com

2018-02-16 19:24:51

by Boris Brezillon

[permalink] [raw]
Subject: Re: [PATCH 2/6] ARM: davinci: update the nand driver names

On Fri, 16 Feb 2018 19:33:07 +0100
Boris Brezillon <[email protected]> wrote:

> On Fri, 16 Feb 2018 17:47:08 +0100
> Bartosz Golaszewski <[email protected]> wrote:
>
> > From: Bartosz Golaszewski <[email protected]>
> >
> > Since commit d8e22fb4ccac ("ARM: da850: add the nand dev_id to the clock
> > lookup table") we can no longer correctly lookup the nand clock when
> > booting in legacy mode. Said commit added a dev_id to the nand clock
> > which must match and it doesn't correspond with the device name which
> > is "davinci_nand" instead of "davinci-nand".
> >
> > The driver name has been changed. Update the board files.
>
> Should be squashed in patch 1, otherwise your patch series is not
> bisectable.
>

Okay, after reading the commit message a second time it seems
bisectability is already broken anyway :-).

> >
> > Fixes: d8e22fb4ccac ("ARM: da850: add the nand dev_id to the clock lookup table")
> > Signed-off-by: Bartosz Golaszewski <[email protected]>
> > ---
> > arch/arm/mach-davinci/board-da830-evm.c | 2 +-
> > arch/arm/mach-davinci/board-da850-evm.c | 2 +-
> > arch/arm/mach-davinci/board-dm355-evm.c | 2 +-
> > arch/arm/mach-davinci/board-dm355-leopard.c | 2 +-
> > arch/arm/mach-davinci/board-dm365-evm.c | 2 +-
> > arch/arm/mach-davinci/board-dm644x-evm.c | 2 +-
> > arch/arm/mach-davinci/board-dm646x-evm.c | 2 +-
> > arch/arm/mach-davinci/board-mityomapl138.c | 2 +-
> > arch/arm/mach-davinci/board-neuros-osd2.c | 2 +-
> > arch/arm/mach-davinci/board-sffsdr.c | 2 +-
> > 10 files changed, 10 insertions(+), 10 deletions(-)
> >
> > diff --git a/arch/arm/mach-davinci/board-da830-evm.c b/arch/arm/mach-davinci/board-da830-evm.c
> > index f673cd7a6766..f8838c7b174b 100644
> > --- a/arch/arm/mach-davinci/board-da830-evm.c
> > +++ b/arch/arm/mach-davinci/board-da830-evm.c
> > @@ -348,7 +348,7 @@ static struct resource da830_evm_nand_resources[] = {
> > };
> >
> > static struct platform_device da830_evm_nand_device = {
> > - .name = "davinci_nand",
> > + .name = "davinci-nand",
> > .id = 1,
> > .dev = {
> > .platform_data = &da830_evm_nand_pdata,
> > diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
> > index d898a94f6eae..828194045a2b 100644
> > --- a/arch/arm/mach-davinci/board-da850-evm.c
> > +++ b/arch/arm/mach-davinci/board-da850-evm.c
> > @@ -266,7 +266,7 @@ static struct resource da850_evm_nandflash_resource[] = {
> > };
> >
> > static struct platform_device da850_evm_nandflash_device = {
> > - .name = "davinci_nand",
> > + .name = "davinci-nand",
> > .id = 1,
> > .dev = {
> > .platform_data = &da850_evm_nandflash_data,
> > diff --git a/arch/arm/mach-davinci/board-dm355-evm.c b/arch/arm/mach-davinci/board-dm355-evm.c
> > index e457f299cd44..58ca7f56e112 100644
> > --- a/arch/arm/mach-davinci/board-dm355-evm.c
> > +++ b/arch/arm/mach-davinci/board-dm355-evm.c
> > @@ -98,7 +98,7 @@ static struct resource davinci_nand_resources[] = {
> > };
> >
> > static struct platform_device davinci_nand_device = {
> > - .name = "davinci_nand",
> > + .name = "davinci-nand",
> > .id = 0,
> >
> > .num_resources = ARRAY_SIZE(davinci_nand_resources),
> > diff --git a/arch/arm/mach-davinci/board-dm355-leopard.c b/arch/arm/mach-davinci/board-dm355-leopard.c
> > index be997243447b..196238117f9a 100644
> > --- a/arch/arm/mach-davinci/board-dm355-leopard.c
> > +++ b/arch/arm/mach-davinci/board-dm355-leopard.c
> > @@ -93,7 +93,7 @@ static struct resource davinci_nand_resources[] = {
> > };
> >
> > static struct platform_device davinci_nand_device = {
> > - .name = "davinci_nand",
> > + .name = "davinci-nand",
> > .id = 0,
> >
> > .num_resources = ARRAY_SIZE(davinci_nand_resources),
> > diff --git a/arch/arm/mach-davinci/board-dm365-evm.c b/arch/arm/mach-davinci/board-dm365-evm.c
> > index e75741fb2c1d..563d66df480b 100644
> > --- a/arch/arm/mach-davinci/board-dm365-evm.c
> > +++ b/arch/arm/mach-davinci/board-dm365-evm.c
> > @@ -159,7 +159,7 @@ static struct resource davinci_nand_resources[] = {
> > };
> >
> > static struct platform_device davinci_nand_device = {
> > - .name = "davinci_nand",
> > + .name = "davinci-nand",
> > .id = 0,
> > .num_resources = ARRAY_SIZE(davinci_nand_resources),
> > .resource = davinci_nand_resources,
> > diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c b/arch/arm/mach-davinci/board-dm644x-evm.c
> > index 85e6fb33b1ee..e42ae2163c75 100644
> > --- a/arch/arm/mach-davinci/board-dm644x-evm.c
> > +++ b/arch/arm/mach-davinci/board-dm644x-evm.c
> > @@ -173,7 +173,7 @@ static struct resource davinci_evm_nandflash_resource[] = {
> > };
> >
> > static struct platform_device davinci_evm_nandflash_device = {
> > - .name = "davinci_nand",
> > + .name = "davinci-nand",
> > .id = 0,
> > .dev = {
> > .platform_data = &davinci_evm_nandflash_data,
> > diff --git a/arch/arm/mach-davinci/board-dm646x-evm.c b/arch/arm/mach-davinci/board-dm646x-evm.c
> > index cb0a41e83582..614dd211e6fc 100644
> > --- a/arch/arm/mach-davinci/board-dm646x-evm.c
> > +++ b/arch/arm/mach-davinci/board-dm646x-evm.c
> > @@ -108,7 +108,7 @@ static struct resource davinci_nand_resources[] = {
> > };
> >
> > static struct platform_device davinci_nand_device = {
> > - .name = "davinci_nand",
> > + .name = "davinci-nand",
> > .id = 0,
> >
> > .num_resources = ARRAY_SIZE(davinci_nand_resources),
> > diff --git a/arch/arm/mach-davinci/board-mityomapl138.c b/arch/arm/mach-davinci/board-mityomapl138.c
> > index b73ce7bae81f..bf3659a21897 100644
> > --- a/arch/arm/mach-davinci/board-mityomapl138.c
> > +++ b/arch/arm/mach-davinci/board-mityomapl138.c
> > @@ -422,7 +422,7 @@ static struct resource mityomapl138_nandflash_resource[] = {
> > };
> >
> > static struct platform_device mityomapl138_nandflash_device = {
> > - .name = "davinci_nand",
> > + .name = "davinci-nand",
> > .id = 1,
> > .dev = {
> > .platform_data = &mityomapl138_nandflash_data,
> > diff --git a/arch/arm/mach-davinci/board-neuros-osd2.c b/arch/arm/mach-davinci/board-neuros-osd2.c
> > index 4da210a1a110..04132494a7c9 100644
> > --- a/arch/arm/mach-davinci/board-neuros-osd2.c
> > +++ b/arch/arm/mach-davinci/board-neuros-osd2.c
> > @@ -107,7 +107,7 @@ static struct resource davinci_ntosd2_nandflash_resource[] = {
> > };
> >
> > static struct platform_device davinci_ntosd2_nandflash_device = {
> > - .name = "davinci_nand",
> > + .name = "davinci-nand",
> > .id = 0,
> > .dev = {
> > .platform_data = &davinci_ntosd2_nandflash_data,
> > diff --git a/arch/arm/mach-davinci/board-sffsdr.c b/arch/arm/mach-davinci/board-sffsdr.c
> > index d85accf7f760..c8569c8aa6e3 100644
> > --- a/arch/arm/mach-davinci/board-sffsdr.c
> > +++ b/arch/arm/mach-davinci/board-sffsdr.c
> > @@ -83,7 +83,7 @@ static struct resource davinci_sffsdr_nandflash_resource[] = {
> > };
> >
> > static struct platform_device davinci_sffsdr_nandflash_device = {
> > - .name = "davinci_nand", /* Name of driver */
> > + .name = "davinci-nand", /* Name of driver */
> > .id = 0,
> > .dev = {
> > .platform_data = &davinci_sffsdr_nandflash_data,
>
>
>



--
Boris Brezillon, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
http://bootlin.com

2018-02-16 19:25:04

by David Lechner

[permalink] [raw]
Subject: Re: [PATCH 2/6] ARM: davinci: update the nand driver names

On 02/16/2018 10:47 AM, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <[email protected]>
>
> Since commit d8e22fb4ccac ("ARM: da850: add the nand dev_id to the clock
> lookup table") we can no longer correctly lookup the nand clock when
> booting in legacy mode. Said commit added a dev_id to the nand clock
> which must match and it doesn't correspond with the device name which
> is "davinci_nand" instead of "davinci-nand".
>
> The driver name has been changed. Update the board files.
>
> Fixes: d8e22fb4ccac ("ARM: da850: add the nand dev_id to the clock lookup table")
> Signed-off-by: Bartosz Golaszewski <[email protected]>
> ---
> arch/arm/mach-davinci/board-da830-evm.c | 2 +-
> arch/arm/mach-davinci/board-da850-evm.c | 2 +-
> arch/arm/mach-davinci/board-dm355-evm.c | 2 +-
> arch/arm/mach-davinci/board-dm355-leopard.c | 2 +-
> arch/arm/mach-davinci/board-dm365-evm.c | 2 +-
> arch/arm/mach-davinci/board-dm644x-evm.c | 2 +-
> arch/arm/mach-davinci/board-dm646x-evm.c | 2 +-
> arch/arm/mach-davinci/board-mityomapl138.c | 2 +-
> arch/arm/mach-davinci/board-neuros-osd2.c | 2 +-
> arch/arm/mach-davinci/board-sffsdr.c | 2 +-
> 10 files changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/arch/arm/mach-davinci/board-da830-evm.c b/arch/arm/mach-davinci/board-da830-evm.c
> index f673cd7a6766..f8838c7b174b 100644
> --- a/arch/arm/mach-davinci/board-da830-evm.c
> +++ b/arch/arm/mach-davinci/board-da830-evm.c
> @@ -348,7 +348,7 @@ static struct resource da830_evm_nand_resources[] = {
> };
>
> static struct platform_device da830_evm_nand_device = {
> - .name = "davinci_nand",
> + .name = "davinci-nand",
> .id = 1,
> .dev = {
> .platform_data = &da830_evm_nand_pdata,
> diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
> index d898a94f6eae..828194045a2b 100644
> --- a/arch/arm/mach-davinci/board-da850-evm.c
> +++ b/arch/arm/mach-davinci/board-da850-evm.c
> @@ -266,7 +266,7 @@ static struct resource da850_evm_nandflash_resource[] = {
> };
>
> static struct platform_device da850_evm_nandflash_device = {
> - .name = "davinci_nand",
> + .name = "davinci-nand",
> .id = 1,

The clock lookup uses id == 0 ("davinci-nand.0"), so this is probably
still broken unless you also change the id.

> .dev = {
> .platform_data = &da850_evm_nandflash_data,
> diff --git a/arch/arm/mach-davinci/board-dm355-evm.c b/arch/arm/mach-davinci/board-dm355-evm.c
> index e457f299cd44..58ca7f56e112 100644
> --- a/arch/arm/mach-davinci/board-dm355-evm.c
> +++ b/arch/arm/mach-davinci/board-dm355-evm.c
> @@ -98,7 +98,7 @@ static struct resource davinci_nand_resources[] = {
> };
>
> static struct platform_device davinci_nand_device = {
> - .name = "davinci_nand",
> + .name = "davinci-nand",
> .id = 0,
>
> .num_resources = ARRAY_SIZE(davinci_nand_resources),
> diff --git a/arch/arm/mach-davinci/board-dm355-leopard.c b/arch/arm/mach-davinci/board-dm355-leopard.c
> index be997243447b..196238117f9a 100644
> --- a/arch/arm/mach-davinci/board-dm355-leopard.c
> +++ b/arch/arm/mach-davinci/board-dm355-leopard.c
> @@ -93,7 +93,7 @@ static struct resource davinci_nand_resources[] = {
> };
>
> static struct platform_device davinci_nand_device = {
> - .name = "davinci_nand",
> + .name = "davinci-nand",
> .id = 0,
>
> .num_resources = ARRAY_SIZE(davinci_nand_resources),
> diff --git a/arch/arm/mach-davinci/board-dm365-evm.c b/arch/arm/mach-davinci/board-dm365-evm.c
> index e75741fb2c1d..563d66df480b 100644
> --- a/arch/arm/mach-davinci/board-dm365-evm.c
> +++ b/arch/arm/mach-davinci/board-dm365-evm.c
> @@ -159,7 +159,7 @@ static struct resource davinci_nand_resources[] = {
> };
>
> static struct platform_device davinci_nand_device = {
> - .name = "davinci_nand",
> + .name = "davinci-nand",
> .id = 0,
> .num_resources = ARRAY_SIZE(davinci_nand_resources),
> .resource = davinci_nand_resources,
> diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c b/arch/arm/mach-davinci/board-dm644x-evm.c
> index 85e6fb33b1ee..e42ae2163c75 100644
> --- a/arch/arm/mach-davinci/board-dm644x-evm.c
> +++ b/arch/arm/mach-davinci/board-dm644x-evm.c
> @@ -173,7 +173,7 @@ static struct resource davinci_evm_nandflash_resource[] = {
> };
>
> static struct platform_device davinci_evm_nandflash_device = {
> - .name = "davinci_nand",
> + .name = "davinci-nand",
> .id = 0,
> .dev = {
> .platform_data = &davinci_evm_nandflash_data,
> diff --git a/arch/arm/mach-davinci/board-dm646x-evm.c b/arch/arm/mach-davinci/board-dm646x-evm.c
> index cb0a41e83582..614dd211e6fc 100644
> --- a/arch/arm/mach-davinci/board-dm646x-evm.c
> +++ b/arch/arm/mach-davinci/board-dm646x-evm.c
> @@ -108,7 +108,7 @@ static struct resource davinci_nand_resources[] = {
> };
>
> static struct platform_device davinci_nand_device = {
> - .name = "davinci_nand",
> + .name = "davinci-nand",
> .id = 0,
>
> .num_resources = ARRAY_SIZE(davinci_nand_resources),
> diff --git a/arch/arm/mach-davinci/board-mityomapl138.c b/arch/arm/mach-davinci/board-mityomapl138.c
> index b73ce7bae81f..bf3659a21897 100644
> --- a/arch/arm/mach-davinci/board-mityomapl138.c
> +++ b/arch/arm/mach-davinci/board-mityomapl138.c
> @@ -422,7 +422,7 @@ static struct resource mityomapl138_nandflash_resource[] = {
> };
>
> static struct platform_device mityomapl138_nandflash_device = {
> - .name = "davinci_nand",
> + .name = "davinci-nand",
> .id = 1,

Same here, id probably needs to be 0.

> .dev = {
> .platform_data = &mityomapl138_nandflash_data,
> diff --git a/arch/arm/mach-davinci/board-neuros-osd2.c b/arch/arm/mach-davinci/board-neuros-osd2.c
> index 4da210a1a110..04132494a7c9 100644
> --- a/arch/arm/mach-davinci/board-neuros-osd2.c
> +++ b/arch/arm/mach-davinci/board-neuros-osd2.c
> @@ -107,7 +107,7 @@ static struct resource davinci_ntosd2_nandflash_resource[] = {
> };
>
> static struct platform_device davinci_ntosd2_nandflash_device = {
> - .name = "davinci_nand",
> + .name = "davinci-nand",
> .id = 0,
> .dev = {
> .platform_data = &davinci_ntosd2_nandflash_data,
> diff --git a/arch/arm/mach-davinci/board-sffsdr.c b/arch/arm/mach-davinci/board-sffsdr.c
> index d85accf7f760..c8569c8aa6e3 100644
> --- a/arch/arm/mach-davinci/board-sffsdr.c
> +++ b/arch/arm/mach-davinci/board-sffsdr.c
> @@ -83,7 +83,7 @@ static struct resource davinci_sffsdr_nandflash_resource[] = {
> };
>
> static struct platform_device davinci_sffsdr_nandflash_device = {
> - .name = "davinci_nand", /* Name of driver */
> + .name = "davinci-nand", /* Name of driver */
> .id = 0,
> .dev = {
> .platform_data = &davinci_sffsdr_nandflash_data,
>


Getting out of scope of this patch, but...

If there is only one nand device per board, then the id should probably
be -1 instead of 0 for all of these boards.


2018-02-16 19:25:37

by Boris Brezillon

[permalink] [raw]
Subject: Re: [PATCH 2/6] ARM: davinci: update the nand driver names

On Fri, 16 Feb 2018 13:14:14 -0600
David Lechner <[email protected]> wrote:

> On 02/16/2018 10:47 AM, Bartosz Golaszewski wrote:
> > From: Bartosz Golaszewski <[email protected]>
> >
> > Since commit d8e22fb4ccac ("ARM: da850: add the nand dev_id to the clock
> > lookup table") we can no longer correctly lookup the nand clock when
> > booting in legacy mode. Said commit added a dev_id to the nand clock
> > which must match and it doesn't correspond with the device name which
> > is "davinci_nand" instead of "davinci-nand".
> >
> > The driver name has been changed. Update the board files.
> >
> > Fixes: d8e22fb4ccac ("ARM: da850: add the nand dev_id to the clock lookup table")
> > Signed-off-by: Bartosz Golaszewski <[email protected]>
> > ---
> > arch/arm/mach-davinci/board-da830-evm.c | 2 +-
> > arch/arm/mach-davinci/board-da850-evm.c | 2 +-
> > arch/arm/mach-davinci/board-dm355-evm.c | 2 +-
> > arch/arm/mach-davinci/board-dm355-leopard.c | 2 +-
> > arch/arm/mach-davinci/board-dm365-evm.c | 2 +-
> > arch/arm/mach-davinci/board-dm644x-evm.c | 2 +-
> > arch/arm/mach-davinci/board-dm646x-evm.c | 2 +-
> > arch/arm/mach-davinci/board-mityomapl138.c | 2 +-
> > arch/arm/mach-davinci/board-neuros-osd2.c | 2 +-
> > arch/arm/mach-davinci/board-sffsdr.c | 2 +-
> > 10 files changed, 10 insertions(+), 10 deletions(-)
> >
> > diff --git a/arch/arm/mach-davinci/board-da830-evm.c b/arch/arm/mach-davinci/board-da830-evm.c
> > index f673cd7a6766..f8838c7b174b 100644
> > --- a/arch/arm/mach-davinci/board-da830-evm.c
> > +++ b/arch/arm/mach-davinci/board-da830-evm.c
> > @@ -348,7 +348,7 @@ static struct resource da830_evm_nand_resources[] = {
> > };
> >
> > static struct platform_device da830_evm_nand_device = {
> > - .name = "davinci_nand",
> > + .name = "davinci-nand",
> > .id = 1,
> > .dev = {
> > .platform_data = &da830_evm_nand_pdata,
> > diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
> > index d898a94f6eae..828194045a2b 100644
> > --- a/arch/arm/mach-davinci/board-da850-evm.c
> > +++ b/arch/arm/mach-davinci/board-da850-evm.c
> > @@ -266,7 +266,7 @@ static struct resource da850_evm_nandflash_resource[] = {
> > };
> >
> > static struct platform_device da850_evm_nandflash_device = {
> > - .name = "davinci_nand",
> > + .name = "davinci-nand",
> > .id = 1,
>
> The clock lookup uses id == 0 ("davinci-nand.0"), so this is probably
> still broken unless you also change the id.
>
> > .dev = {
> > .platform_data = &da850_evm_nandflash_data,
> > diff --git a/arch/arm/mach-davinci/board-dm355-evm.c b/arch/arm/mach-davinci/board-dm355-evm.c
> > index e457f299cd44..58ca7f56e112 100644
> > --- a/arch/arm/mach-davinci/board-dm355-evm.c
> > +++ b/arch/arm/mach-davinci/board-dm355-evm.c
> > @@ -98,7 +98,7 @@ static struct resource davinci_nand_resources[] = {
> > };
> >
> > static struct platform_device davinci_nand_device = {
> > - .name = "davinci_nand",
> > + .name = "davinci-nand",
> > .id = 0,
> >
> > .num_resources = ARRAY_SIZE(davinci_nand_resources),
> > diff --git a/arch/arm/mach-davinci/board-dm355-leopard.c b/arch/arm/mach-davinci/board-dm355-leopard.c
> > index be997243447b..196238117f9a 100644
> > --- a/arch/arm/mach-davinci/board-dm355-leopard.c
> > +++ b/arch/arm/mach-davinci/board-dm355-leopard.c
> > @@ -93,7 +93,7 @@ static struct resource davinci_nand_resources[] = {
> > };
> >
> > static struct platform_device davinci_nand_device = {
> > - .name = "davinci_nand",
> > + .name = "davinci-nand",
> > .id = 0,
> >
> > .num_resources = ARRAY_SIZE(davinci_nand_resources),
> > diff --git a/arch/arm/mach-davinci/board-dm365-evm.c b/arch/arm/mach-davinci/board-dm365-evm.c
> > index e75741fb2c1d..563d66df480b 100644
> > --- a/arch/arm/mach-davinci/board-dm365-evm.c
> > +++ b/arch/arm/mach-davinci/board-dm365-evm.c
> > @@ -159,7 +159,7 @@ static struct resource davinci_nand_resources[] = {
> > };
> >
> > static struct platform_device davinci_nand_device = {
> > - .name = "davinci_nand",
> > + .name = "davinci-nand",
> > .id = 0,
> > .num_resources = ARRAY_SIZE(davinci_nand_resources),
> > .resource = davinci_nand_resources,
> > diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c b/arch/arm/mach-davinci/board-dm644x-evm.c
> > index 85e6fb33b1ee..e42ae2163c75 100644
> > --- a/arch/arm/mach-davinci/board-dm644x-evm.c
> > +++ b/arch/arm/mach-davinci/board-dm644x-evm.c
> > @@ -173,7 +173,7 @@ static struct resource davinci_evm_nandflash_resource[] = {
> > };
> >
> > static struct platform_device davinci_evm_nandflash_device = {
> > - .name = "davinci_nand",
> > + .name = "davinci-nand",
> > .id = 0,
> > .dev = {
> > .platform_data = &davinci_evm_nandflash_data,
> > diff --git a/arch/arm/mach-davinci/board-dm646x-evm.c b/arch/arm/mach-davinci/board-dm646x-evm.c
> > index cb0a41e83582..614dd211e6fc 100644
> > --- a/arch/arm/mach-davinci/board-dm646x-evm.c
> > +++ b/arch/arm/mach-davinci/board-dm646x-evm.c
> > @@ -108,7 +108,7 @@ static struct resource davinci_nand_resources[] = {
> > };
> >
> > static struct platform_device davinci_nand_device = {
> > - .name = "davinci_nand",
> > + .name = "davinci-nand",
> > .id = 0,
> >
> > .num_resources = ARRAY_SIZE(davinci_nand_resources),
> > diff --git a/arch/arm/mach-davinci/board-mityomapl138.c b/arch/arm/mach-davinci/board-mityomapl138.c
> > index b73ce7bae81f..bf3659a21897 100644
> > --- a/arch/arm/mach-davinci/board-mityomapl138.c
> > +++ b/arch/arm/mach-davinci/board-mityomapl138.c
> > @@ -422,7 +422,7 @@ static struct resource mityomapl138_nandflash_resource[] = {
> > };
> >
> > static struct platform_device mityomapl138_nandflash_device = {
> > - .name = "davinci_nand",
> > + .name = "davinci-nand",
> > .id = 1,
>
> Same here, id probably needs to be 0.
>
> > .dev = {
> > .platform_data = &mityomapl138_nandflash_data,
> > diff --git a/arch/arm/mach-davinci/board-neuros-osd2.c b/arch/arm/mach-davinci/board-neuros-osd2.c
> > index 4da210a1a110..04132494a7c9 100644
> > --- a/arch/arm/mach-davinci/board-neuros-osd2.c
> > +++ b/arch/arm/mach-davinci/board-neuros-osd2.c
> > @@ -107,7 +107,7 @@ static struct resource davinci_ntosd2_nandflash_resource[] = {
> > };
> >
> > static struct platform_device davinci_ntosd2_nandflash_device = {
> > - .name = "davinci_nand",
> > + .name = "davinci-nand",
> > .id = 0,
> > .dev = {
> > .platform_data = &davinci_ntosd2_nandflash_data,
> > diff --git a/arch/arm/mach-davinci/board-sffsdr.c b/arch/arm/mach-davinci/board-sffsdr.c
> > index d85accf7f760..c8569c8aa6e3 100644
> > --- a/arch/arm/mach-davinci/board-sffsdr.c
> > +++ b/arch/arm/mach-davinci/board-sffsdr.c
> > @@ -83,7 +83,7 @@ static struct resource davinci_sffsdr_nandflash_resource[] = {
> > };
> >
> > static struct platform_device davinci_sffsdr_nandflash_device = {
> > - .name = "davinci_nand", /* Name of driver */
> > + .name = "davinci-nand", /* Name of driver */
> > .id = 0,
> > .dev = {
> > .platform_data = &davinci_sffsdr_nandflash_data,
> >
>
>
> Getting out of scope of this patch, but...
>
> If there is only one nand device per board, then the id should probably
> be -1 instead of 0 for all of these boards.
>

Note that doing that is also breaking mtdparts users, because the
mtdparts definition expected by the kernel would become
mtdparts=davinci-nand:<part-layout> instead of
mtdparts=davinci_nand.0:<part-layout>.


--
Boris Brezillon, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
http://bootlin.com

2018-02-16 19:26:44

by David Lechner

[permalink] [raw]
Subject: Re: [PATCH 1/6] nand: davinci: rename the platform driver

On 02/16/2018 01:19 PM, Boris Brezillon wrote:
> On Fri, 16 Feb 2018 17:47:07 +0100
> Bartosz Golaszewski <[email protected]> wrote:
>
>> From: Bartosz Golaszewski <[email protected]>
>>
>> Commit d8e22fb4ccac ("ARM: da850: add the nand dev_id to the clock
>> lookup table") broke the nand support in board file mode for
>> da850-based boards. Instead of reverting it and breaking the DT users
>> in the process (due to clock lookup), rename the driver to match the
>> clock table before renaming the users.
>>
>> Fixes: d8e22fb4ccac ("ARM: da850: add the nand dev_id to the clock lookup table")
>> Signed-off-by: Bartosz Golaszewski <[email protected]>
>> ---
>> drivers/mtd/nand/davinci_nand.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/mtd/nand/davinci_nand.c b/drivers/mtd/nand/davinci_nand.c
>> index ccc8c43abcff..4fb143bf1872 100644
>> --- a/drivers/mtd/nand/davinci_nand.c
>> +++ b/drivers/mtd/nand/davinci_nand.c
>> @@ -865,7 +865,7 @@ static struct platform_driver nand_davinci_driver = {
>> .probe = nand_davinci_probe,
>> .remove = nand_davinci_remove,
>> .driver = {
>> - .name = "davinci_nand",
>> + .name = "davinci-nand",
>
> Another side-effect of this change you should be aware of: by doing
> that you also break all users that were defining partitions through the
> cmdline using mtdparts=davinci_nand.0:<part-layout>.
>
> Not sure this is a good idea ;-).

Also, once we move to the common clock framework, the AUXDATA that causes
the DT clock lookup breakage you are trying to avoid will go away, so that
won't be a reason for changing this either.



2018-02-16 19:38:01

by Boris Brezillon

[permalink] [raw]
Subject: Re: [PATCH 1/6] nand: davinci: rename the platform driver

On Fri, 16 Feb 2018 17:47:07 +0100
Bartosz Golaszewski <[email protected]> wrote:

> From: Bartosz Golaszewski <[email protected]>
>
> Commit d8e22fb4ccac ("ARM: da850: add the nand dev_id to the clock
> lookup table") broke the nand support in board file mode for
> da850-based boards. Instead of reverting it and breaking the DT users
> in the process (due to clock lookup), rename the driver to match the
> clock table before renaming the users.
>
> Fixes: d8e22fb4ccac ("ARM: da850: add the nand dev_id to the clock lookup table")
> Signed-off-by: Bartosz Golaszewski <[email protected]>
> ---
> drivers/mtd/nand/davinci_nand.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mtd/nand/davinci_nand.c b/drivers/mtd/nand/davinci_nand.c
> index ccc8c43abcff..4fb143bf1872 100644
> --- a/drivers/mtd/nand/davinci_nand.c
> +++ b/drivers/mtd/nand/davinci_nand.c
> @@ -865,7 +865,7 @@ static struct platform_driver nand_davinci_driver = {
> .probe = nand_davinci_probe,
> .remove = nand_davinci_remove,
> .driver = {
> - .name = "davinci_nand",
> + .name = "davinci-nand",

Another side-effect of this change you should be aware of: by doing
that you also break all users that were defining partitions through the
cmdline using mtdparts=davinci_nand.0:<part-layout>.

Not sure this is a good idea ;-).

> .of_match_table = of_match_ptr(davinci_nand_of_match),
> },
> };



--
Boris Brezillon, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
http://bootlin.com

2018-02-19 10:56:43

by Bartosz Golaszewski

[permalink] [raw]
Subject: Re: [PATCH 1/6] nand: davinci: rename the platform driver

2018-02-16 20:22 GMT+01:00 David Lechner <[email protected]>:
> On 02/16/2018 01:19 PM, Boris Brezillon wrote:
>>
>> On Fri, 16 Feb 2018 17:47:07 +0100
>> Bartosz Golaszewski <[email protected]> wrote:
>>
>>> From: Bartosz Golaszewski <[email protected]>
>>>
>>> Commit d8e22fb4ccac ("ARM: da850: add the nand dev_id to the clock
>>> lookup table") broke the nand support in board file mode for
>>> da850-based boards. Instead of reverting it and breaking the DT users
>>> in the process (due to clock lookup), rename the driver to match the
>>> clock table before renaming the users.
>>>
>>> Fixes: d8e22fb4ccac ("ARM: da850: add the nand dev_id to the clock lookup
>>> table")
>>> Signed-off-by: Bartosz Golaszewski <[email protected]>
>>> ---
>>> drivers/mtd/nand/davinci_nand.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/mtd/nand/davinci_nand.c
>>> b/drivers/mtd/nand/davinci_nand.c
>>> index ccc8c43abcff..4fb143bf1872 100644
>>> --- a/drivers/mtd/nand/davinci_nand.c
>>> +++ b/drivers/mtd/nand/davinci_nand.c
>>> @@ -865,7 +865,7 @@ static struct platform_driver nand_davinci_driver = {
>>> .probe = nand_davinci_probe,
>>> .remove = nand_davinci_remove,
>>> .driver = {
>>> - .name = "davinci_nand",
>>> + .name = "davinci-nand",
>>
>>
>> Another side-effect of this change you should be aware of: by doing
>> that you also break all users that were defining partitions through the
>> cmdline using mtdparts=davinci_nand.0:<part-layout>.
>>
>> Not sure this is a good idea ;-).
>
>
> Also, once we move to the common clock framework, the AUXDATA that causes
> the DT clock lookup breakage you are trying to avoid will go away, so that
> won't be a reason for changing this either.
>
>

Ok, let's wait for v7 of your series then and reiterate this one.

Best regards,
Bartosz Golaszewski