All of lore.kernel.org
 help / color / mirror / Atom feed
* [RESEND PATCH v2 0/4] ARM: davinci: remove the mach-specific aemif driver - part 1
@ 2018-04-17 10:29 ` Bartosz Golaszewski
  0 siblings, 0 replies; 36+ messages in thread
From: Bartosz Golaszewski @ 2018-04-17 10:29 UTC (permalink / raw)
  To: Sekhar Nori, Kevin Hilman, Russell King, Santosh Shilimkar
  Cc: linux-arm-kernel, linux-kernel, Bartosz Golaszewski

From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

This is 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.

First patch just uses a static string for the ti-aemif driver name.

The second adds 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 these patches get accepted, I'll prepere a follow-up moving all
other boards to the new platform driver.

This series applies on top of v8 of David Lechner's CCF series.

v1 -> v2:
- drop the first two patches, which are no longer needed with David's
  psc driver

Bartosz Golaszewski (4):
  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-da850-evm.c     |  93 +++++++-------
 arch/arm/mach-davinci/board-omapl138-hawk.c | 132 ++++++++++++++++++++
 drivers/memory/ti-aemif.c                   |  59 +++++----
 include/linux/platform_data/ti-aemif.h      |   9 ++
 4 files changed, 230 insertions(+), 63 deletions(-)

-- 
2.17.0

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [RESEND PATCH v2 0/4] ARM: davinci: remove the mach-specific aemif driver - part 1
@ 2018-04-17 10:29 ` Bartosz Golaszewski
  0 siblings, 0 replies; 36+ messages in thread
From: Bartosz Golaszewski @ 2018-04-17 10:29 UTC (permalink / raw)
  To: linux-arm-kernel

From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

This is 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.

First patch just uses a static string for the ti-aemif driver name.

The second adds 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 these patches get accepted, I'll prepere a follow-up moving all
other boards to the new platform driver.

This series applies on top of v8 of David Lechner's CCF series.

v1 -> v2:
- drop the first two patches, which are no longer needed with David's
  psc driver

Bartosz Golaszewski (4):
  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-da850-evm.c     |  93 +++++++-------
 arch/arm/mach-davinci/board-omapl138-hawk.c | 132 ++++++++++++++++++++
 drivers/memory/ti-aemif.c                   |  59 +++++----
 include/linux/platform_data/ti-aemif.h      |   9 ++
 4 files changed, 230 insertions(+), 63 deletions(-)

-- 
2.17.0

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [RESEND PATCH v2 1/4] memory: aemif: don't rely on kbuild for driver's name
  2018-04-17 10:29 ` Bartosz Golaszewski
@ 2018-04-17 10:29   ` Bartosz Golaszewski
  -1 siblings, 0 replies; 36+ messages in thread
From: Bartosz Golaszewski @ 2018-04-17 10:29 UTC (permalink / raw)
  To: Sekhar Nori, Kevin Hilman, Russell King, Santosh Shilimkar
  Cc: linux-arm-kernel, linux-kernel, Bartosz Golaszewski

From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

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

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
 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.17.0

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [RESEND PATCH v2 1/4] memory: aemif: don't rely on kbuild for driver's name
@ 2018-04-17 10:29   ` Bartosz Golaszewski
  0 siblings, 0 replies; 36+ messages in thread
From: Bartosz Golaszewski @ 2018-04-17 10:29 UTC (permalink / raw)
  To: linux-arm-kernel

From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

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

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
 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.17.0

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [RESEND PATCH v2 2/4] memory: aemif: add support for board files
  2018-04-17 10:29 ` Bartosz Golaszewski
@ 2018-04-17 10:29   ` Bartosz Golaszewski
  -1 siblings, 0 replies; 36+ messages in thread
From: Bartosz Golaszewski @ 2018-04-17 10:29 UTC (permalink / raw)
  To: Sekhar Nori, Kevin Hilman, Russell King, Santosh Shilimkar
  Cc: linux-arm-kernel, linux-kernel, Bartosz Golaszewski

From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

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 <bgolaszewski@baylibre.com>
---
 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.17.0

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [RESEND PATCH v2 2/4] memory: aemif: add support for board files
@ 2018-04-17 10:29   ` Bartosz Golaszewski
  0 siblings, 0 replies; 36+ messages in thread
From: Bartosz Golaszewski @ 2018-04-17 10:29 UTC (permalink / raw)
  To: linux-arm-kernel

From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

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 <bgolaszewski@baylibre.com>
---
 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.17.0

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [RESEND PATCH v2 3/4] ARM: davinci: add aemif & nand support to da850-lcdk in legacy mode
  2018-04-17 10:29 ` Bartosz Golaszewski
@ 2018-04-17 10:29   ` Bartosz Golaszewski
  -1 siblings, 0 replies; 36+ messages in thread
From: Bartosz Golaszewski @ 2018-04-17 10:29 UTC (permalink / raw)
  To: Sekhar Nori, Kevin Hilman, Russell King, Santosh Shilimkar
  Cc: linux-arm-kernel, linux-kernel, Bartosz Golaszewski

From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

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 <bgolaszewski@baylibre.com>
---
 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 6c997c59a3cd..9c3de56b54e4 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;
 
@@ -294,6 +422,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.17.0

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [RESEND PATCH v2 3/4] ARM: davinci: add aemif & nand support to da850-lcdk in legacy mode
@ 2018-04-17 10:29   ` Bartosz Golaszewski
  0 siblings, 0 replies; 36+ messages in thread
From: Bartosz Golaszewski @ 2018-04-17 10:29 UTC (permalink / raw)
  To: linux-arm-kernel

From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

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 <bgolaszewski@baylibre.com>
---
 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 6c997c59a3cd..9c3de56b54e4 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;
 
@@ -294,6 +422,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.17.0

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [RESEND PATCH v2 4/4] ARM: davinci: use aemif platform driver in legacy mode for da850-evm
  2018-04-17 10:29 ` Bartosz Golaszewski
@ 2018-04-17 10:29   ` Bartosz Golaszewski
  -1 siblings, 0 replies; 36+ messages in thread
From: Bartosz Golaszewski @ 2018-04-17 10:29 UTC (permalink / raw)
  To: Sekhar Nori, Kevin Hilman, Russell King, Santosh Shilimkar
  Cc: linux-arm-kernel, linux-kernel, Bartosz Golaszewski

From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

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

Note: the id of davinci_nand is changed to 0 in order to make it work
with the new common-clock framework based psc driver.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
 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 78a670aafea0..f1c2c8c8c4af 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		= 0,
+		.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.17.0

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [RESEND PATCH v2 4/4] ARM: davinci: use aemif platform driver in legacy mode for da850-evm
@ 2018-04-17 10:29   ` Bartosz Golaszewski
  0 siblings, 0 replies; 36+ messages in thread
From: Bartosz Golaszewski @ 2018-04-17 10:29 UTC (permalink / raw)
  To: linux-arm-kernel

From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

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

Note: the id of davinci_nand is changed to 0 in order to make it work
with the new common-clock framework based psc driver.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
 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 78a670aafea0..f1c2c8c8c4af 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		= 0,
+		.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.17.0

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* Re: [RESEND PATCH v2 0/4] ARM: davinci: remove the mach-specific aemif driver - part 1
  2018-04-17 10:29 ` Bartosz Golaszewski
@ 2018-04-17 10:53   ` Sekhar Nori
  -1 siblings, 0 replies; 36+ messages in thread
From: Sekhar Nori @ 2018-04-17 10:53 UTC (permalink / raw)
  To: Bartosz Golaszewski, Kevin Hilman, Russell King, Santosh Shilimkar
  Cc: linux-arm-kernel, linux-kernel, Bartosz Golaszewski

Hi Bartosz,

On Tuesday 17 April 2018 03:59 PM, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> 
> This is 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.
> 
> First patch just uses a static string for the ti-aemif driver name.
> 
> The second adds 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 these patches get accepted, I'll prepere a follow-up moving all
> other boards to the new platform driver.
> 
> This series applies on top of v8 of David Lechner's CCF series.

Are there any patches in the series that can safely be applied to v4.17-rc1?

Thanks,
Sekhar

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [RESEND PATCH v2 0/4] ARM: davinci: remove the mach-specific aemif driver - part 1
@ 2018-04-17 10:53   ` Sekhar Nori
  0 siblings, 0 replies; 36+ messages in thread
From: Sekhar Nori @ 2018-04-17 10:53 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Bartosz,

On Tuesday 17 April 2018 03:59 PM, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> 
> This is 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.
> 
> First patch just uses a static string for the ti-aemif driver name.
> 
> The second adds 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 these patches get accepted, I'll prepere a follow-up moving all
> other boards to the new platform driver.
> 
> This series applies on top of v8 of David Lechner's CCF series.

Are there any patches in the series that can safely be applied to v4.17-rc1?

Thanks,
Sekhar

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [RESEND PATCH v2 0/4] ARM: davinci: remove the mach-specific aemif driver - part 1
  2018-04-17 10:53   ` Sekhar Nori
@ 2018-04-17 12:36     ` Bartosz Golaszewski
  -1 siblings, 0 replies; 36+ messages in thread
From: Bartosz Golaszewski @ 2018-04-17 12:36 UTC (permalink / raw)
  To: Sekhar Nori
  Cc: Bartosz Golaszewski, Kevin Hilman, Russell King,
	Santosh Shilimkar, arm-soc, LKML

2018-04-17 12:53 GMT+02:00 Sekhar Nori <nsekhar@ti.com>:
> Hi Bartosz,
>
> On Tuesday 17 April 2018 03:59 PM, Bartosz Golaszewski wrote:
>> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>>
>> This is 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.
>>
>> First patch just uses a static string for the ti-aemif driver name.
>>
>> The second adds 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 these patches get accepted, I'll prepere a follow-up moving all
>> other boards to the new platform driver.
>>
>> This series applies on top of v8 of David Lechner's CCF series.
>
> Are there any patches in the series that can safely be applied to v4.17-rc1?
>
> Thanks,
> Sekhar

Hi Sekhar,

yes, all of them. They're not linked to David's work in any way.

Bart

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [RESEND PATCH v2 0/4] ARM: davinci: remove the mach-specific aemif driver - part 1
@ 2018-04-17 12:36     ` Bartosz Golaszewski
  0 siblings, 0 replies; 36+ messages in thread
From: Bartosz Golaszewski @ 2018-04-17 12:36 UTC (permalink / raw)
  To: linux-arm-kernel

2018-04-17 12:53 GMT+02:00 Sekhar Nori <nsekhar@ti.com>:
> Hi Bartosz,
>
> On Tuesday 17 April 2018 03:59 PM, Bartosz Golaszewski wrote:
>> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>>
>> This is 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.
>>
>> First patch just uses a static string for the ti-aemif driver name.
>>
>> The second adds 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 these patches get accepted, I'll prepere a follow-up moving all
>> other boards to the new platform driver.
>>
>> This series applies on top of v8 of David Lechner's CCF series.
>
> Are there any patches in the series that can safely be applied to v4.17-rc1?
>
> Thanks,
> Sekhar

Hi Sekhar,

yes, all of them. They're not linked to David's work in any way.

Bart

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [RESEND PATCH v2 0/4] ARM: davinci: remove the mach-specific aemif driver - part 1
  2018-04-17 12:36     ` Bartosz Golaszewski
@ 2018-04-17 12:41       ` Bartosz Golaszewski
  -1 siblings, 0 replies; 36+ messages in thread
From: Bartosz Golaszewski @ 2018-04-17 12:41 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Sekhar Nori, Kevin Hilman, Russell King, Santosh Shilimkar,
	arm-soc, LKML

2018-04-17 14:36 GMT+02:00 Bartosz Golaszewski <bgolaszewski@baylibre.com>:
> 2018-04-17 12:53 GMT+02:00 Sekhar Nori <nsekhar@ti.com>:
>> Hi Bartosz,
>>
>> On Tuesday 17 April 2018 03:59 PM, Bartosz Golaszewski wrote:
>>> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>>>
>>> This is 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.
>>>
>>> First patch just uses a static string for the ti-aemif driver name.
>>>
>>> The second adds 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 these patches get accepted, I'll prepere a follow-up moving all
>>> other boards to the new platform driver.
>>>
>>> This series applies on top of v8 of David Lechner's CCF series.
>>
>> Are there any patches in the series that can safely be applied to v4.17-rc1?
>>
>> Thanks,
>> Sekhar
>
> Hi Sekhar,
>
> yes, all of them. They're not linked to David's work in any way.
>
> Bart

Oops, -ETOOFAST, I rebased it on top of David's v9, let me check how
it works with mainline - it should be mostly fine.

Bart

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [RESEND PATCH v2 0/4] ARM: davinci: remove the mach-specific aemif driver - part 1
@ 2018-04-17 12:41       ` Bartosz Golaszewski
  0 siblings, 0 replies; 36+ messages in thread
From: Bartosz Golaszewski @ 2018-04-17 12:41 UTC (permalink / raw)
  To: linux-arm-kernel

2018-04-17 14:36 GMT+02:00 Bartosz Golaszewski <bgolaszewski@baylibre.com>:
> 2018-04-17 12:53 GMT+02:00 Sekhar Nori <nsekhar@ti.com>:
>> Hi Bartosz,
>>
>> On Tuesday 17 April 2018 03:59 PM, Bartosz Golaszewski wrote:
>>> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>>>
>>> This is 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.
>>>
>>> First patch just uses a static string for the ti-aemif driver name.
>>>
>>> The second adds 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 these patches get accepted, I'll prepere a follow-up moving all
>>> other boards to the new platform driver.
>>>
>>> This series applies on top of v8 of David Lechner's CCF series.
>>
>> Are there any patches in the series that can safely be applied to v4.17-rc1?
>>
>> Thanks,
>> Sekhar
>
> Hi Sekhar,
>
> yes, all of them. They're not linked to David's work in any way.
>
> Bart

Oops, -ETOOFAST, I rebased it on top of David's v9, let me check how
it works with mainline - it should be mostly fine.

Bart

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [RESEND PATCH v2 2/4] memory: aemif: add support for board files
  2018-04-17 10:29   ` Bartosz Golaszewski
@ 2018-04-17 13:57     ` Sekhar Nori
  -1 siblings, 0 replies; 36+ messages in thread
From: Sekhar Nori @ 2018-04-17 13:57 UTC (permalink / raw)
  To: Bartosz Golaszewski, Kevin Hilman, Russell King, Santosh Shilimkar
  Cc: linux-arm-kernel, linux-kernel, Bartosz Golaszewski

On Tuesday 17 April 2018 03:59 PM, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> 
> 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 <bgolaszewski@baylibre.com>
> ---
>  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

> @@ -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]);

Before doing this can we make aemif device the parent of the sub_device?

> +			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;

It will be nice to add documentation for these members.

Thanks,
Sekhar

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [RESEND PATCH v2 2/4] memory: aemif: add support for board files
@ 2018-04-17 13:57     ` Sekhar Nori
  0 siblings, 0 replies; 36+ messages in thread
From: Sekhar Nori @ 2018-04-17 13:57 UTC (permalink / raw)
  To: linux-arm-kernel

On Tuesday 17 April 2018 03:59 PM, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> 
> 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 <bgolaszewski@baylibre.com>
> ---
>  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

> @@ -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]);

Before doing this can we make aemif device the parent of the sub_device?

> +			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;

It will be nice to add documentation for these members.

Thanks,
Sekhar

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [RESEND PATCH v2 0/4] ARM: davinci: remove the mach-specific aemif driver - part 1
  2018-04-17 12:41       ` Bartosz Golaszewski
@ 2018-04-17 13:59         ` Bartosz Golaszewski
  -1 siblings, 0 replies; 36+ messages in thread
From: Bartosz Golaszewski @ 2018-04-17 13:59 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Sekhar Nori, Kevin Hilman, Russell King, Santosh Shilimkar,
	arm-soc, LKML

2018-04-17 14:41 GMT+02:00 Bartosz Golaszewski <brgl@bgdev.pl>:
> 2018-04-17 14:36 GMT+02:00 Bartosz Golaszewski <bgolaszewski@baylibre.com>:
>> 2018-04-17 12:53 GMT+02:00 Sekhar Nori <nsekhar@ti.com>:
>>> Hi Bartosz,
>>>
>>> On Tuesday 17 April 2018 03:59 PM, Bartosz Golaszewski wrote:
>>>> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>>>>
>>>> This is 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.
>>>>
>>>> First patch just uses a static string for the ti-aemif driver name.
>>>>
>>>> The second adds 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 these patches get accepted, I'll prepere a follow-up moving all
>>>> other boards to the new platform driver.
>>>>
>>>> This series applies on top of v8 of David Lechner's CCF series.
>>>
>>> Are there any patches in the series that can safely be applied to v4.17-rc1?
>>>
>>> Thanks,
>>> Sekhar
>>
>> Hi Sekhar,
>>
>> yes, all of them. They're not linked to David's work in any way.
>>
>> Bart
>
> Oops, -ETOOFAST, I rebased it on top of David's v9, let me check how
> it works with mainline - it should be mostly fine.
>
> Bart

Ok, so the patches apply and build nicely on top of v4.17-rc1, but
they only actually work with David's v9 branch. On the other hand nand
doesn't work with mainline now anyway so I assume it's safe to apply
them and wait for David's patches to be merged.

Thanks,
Bartosz

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [RESEND PATCH v2 0/4] ARM: davinci: remove the mach-specific aemif driver - part 1
@ 2018-04-17 13:59         ` Bartosz Golaszewski
  0 siblings, 0 replies; 36+ messages in thread
From: Bartosz Golaszewski @ 2018-04-17 13:59 UTC (permalink / raw)
  To: linux-arm-kernel

2018-04-17 14:41 GMT+02:00 Bartosz Golaszewski <brgl@bgdev.pl>:
> 2018-04-17 14:36 GMT+02:00 Bartosz Golaszewski <bgolaszewski@baylibre.com>:
>> 2018-04-17 12:53 GMT+02:00 Sekhar Nori <nsekhar@ti.com>:
>>> Hi Bartosz,
>>>
>>> On Tuesday 17 April 2018 03:59 PM, Bartosz Golaszewski wrote:
>>>> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>>>>
>>>> This is 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.
>>>>
>>>> First patch just uses a static string for the ti-aemif driver name.
>>>>
>>>> The second adds 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 these patches get accepted, I'll prepere a follow-up moving all
>>>> other boards to the new platform driver.
>>>>
>>>> This series applies on top of v8 of David Lechner's CCF series.
>>>
>>> Are there any patches in the series that can safely be applied to v4.17-rc1?
>>>
>>> Thanks,
>>> Sekhar
>>
>> Hi Sekhar,
>>
>> yes, all of them. They're not linked to David's work in any way.
>>
>> Bart
>
> Oops, -ETOOFAST, I rebased it on top of David's v9, let me check how
> it works with mainline - it should be mostly fine.
>
> Bart

Ok, so the patches apply and build nicely on top of v4.17-rc1, but
they only actually work with David's v9 branch. On the other hand nand
doesn't work with mainline now anyway so I assume it's safe to apply
them and wait for David's patches to be merged.

Thanks,
Bartosz

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [RESEND PATCH v2 3/4] ARM: davinci: add aemif & nand support to da850-lcdk in legacy mode
  2018-04-17 10:29   ` Bartosz Golaszewski
@ 2018-04-17 14:09     ` Sekhar Nori
  -1 siblings, 0 replies; 36+ messages in thread
From: Sekhar Nori @ 2018-04-17 14:09 UTC (permalink / raw)
  To: Bartosz Golaszewski, Kevin Hilman, Russell King, Santosh Shilimkar
  Cc: linux-arm-kernel, linux-kernel, Bartosz Golaszewski

On Tuesday 17 April 2018 03:59 PM, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> 
> We now have support for aemif & nand from board files. As an example
> add support for nand to da850-lcdk in legacy mode.

Hawkboard is a separate board of its own, although closely related to
LCDK. Lets refer to it as hawkboard itself, instead of "LCDK in legacy
mode". So:

ARM: davinci: omapl138-hawk: ...

> 
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> ---
>  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 6c997c59a3cd..9c3de56b54e4 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,

Can you make it 512K as it is in da850-lcdk.dts ?

> +		.mask_flags	= MTD_WRITEABLE,
> +	},
> +	{
> +		.name		= "free space",
> +		.offset		= MTDPART_OFS_APPEND,
> +		.size		= MTDPART_SIZ_FULL,
> +		.mask_flags	= 0,
> +	},
> +};

> +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,

Is there a reason for .id to be set to 1 here? Ideally it should be -1,
I think since there is a single NAND on the board.

Note that I sent a patch dropping AEMIF clock acquisition from DaVinci
NAND driver.

> +		.dev		= {
> +			.platform_data	= &omapl138_hawk_nandflash_data,
> +		},
> +		.resource	= omapl138_hawk_nandflash_resource,
> +		.num_resources	= ARRAY_SIZE(omapl138_hawk_nandflash_resource),
> +		.id		= 0,

This should have resulted in a double init warning?

Thanks,
Sekhar

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [RESEND PATCH v2 3/4] ARM: davinci: add aemif & nand support to da850-lcdk in legacy mode
@ 2018-04-17 14:09     ` Sekhar Nori
  0 siblings, 0 replies; 36+ messages in thread
From: Sekhar Nori @ 2018-04-17 14:09 UTC (permalink / raw)
  To: linux-arm-kernel

On Tuesday 17 April 2018 03:59 PM, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> 
> We now have support for aemif & nand from board files. As an example
> add support for nand to da850-lcdk in legacy mode.

Hawkboard is a separate board of its own, although closely related to
LCDK. Lets refer to it as hawkboard itself, instead of "LCDK in legacy
mode". So:

ARM: davinci: omapl138-hawk: ...

> 
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> ---
>  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 6c997c59a3cd..9c3de56b54e4 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,

Can you make it 512K as it is in da850-lcdk.dts ?

> +		.mask_flags	= MTD_WRITEABLE,
> +	},
> +	{
> +		.name		= "free space",
> +		.offset		= MTDPART_OFS_APPEND,
> +		.size		= MTDPART_SIZ_FULL,
> +		.mask_flags	= 0,
> +	},
> +};

> +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,

Is there a reason for .id to be set to 1 here? Ideally it should be -1,
I think since there is a single NAND on the board.

Note that I sent a patch dropping AEMIF clock acquisition from DaVinci
NAND driver.

> +		.dev		= {
> +			.platform_data	= &omapl138_hawk_nandflash_data,
> +		},
> +		.resource	= omapl138_hawk_nandflash_resource,
> +		.num_resources	= ARRAY_SIZE(omapl138_hawk_nandflash_resource),
> +		.id		= 0,

This should have resulted in a double init warning?

Thanks,
Sekhar

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [RESEND PATCH v2 4/4] ARM: davinci: use aemif platform driver in legacy mode for da850-evm
  2018-04-17 10:29   ` Bartosz Golaszewski
@ 2018-04-17 14:12     ` Sekhar Nori
  -1 siblings, 0 replies; 36+ messages in thread
From: Sekhar Nori @ 2018-04-17 14:12 UTC (permalink / raw)
  To: Bartosz Golaszewski, Kevin Hilman, Russell King, Santosh Shilimkar
  Cc: linux-arm-kernel, linux-kernel, Bartosz Golaszewski

On Tuesday 17 April 2018 03:59 PM, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> 
> We now support board files in aemif. Use the platform driver instead
> of the handcrafted API in da850-evm.
> 
> Note: the id of davinci_nand is changed to 0 in order to make it work
> with the new common-clock framework based psc driver.

Is this now needed after applying my patch dropping clock acquisition
from DaVinci NAND driver?

> 
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>

Thanks,
Sekhar

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [RESEND PATCH v2 4/4] ARM: davinci: use aemif platform driver in legacy mode for da850-evm
@ 2018-04-17 14:12     ` Sekhar Nori
  0 siblings, 0 replies; 36+ messages in thread
From: Sekhar Nori @ 2018-04-17 14:12 UTC (permalink / raw)
  To: linux-arm-kernel

On Tuesday 17 April 2018 03:59 PM, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> 
> We now support board files in aemif. Use the platform driver instead
> of the handcrafted API in da850-evm.
> 
> Note: the id of davinci_nand is changed to 0 in order to make it work
> with the new common-clock framework based psc driver.

Is this now needed after applying my patch dropping clock acquisition
from DaVinci NAND driver?

> 
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>

Thanks,
Sekhar

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [RESEND PATCH v2 0/4] ARM: davinci: remove the mach-specific aemif driver - part 1
  2018-04-17 12:36     ` Bartosz Golaszewski
@ 2018-04-17 17:29       ` Santosh Shilimkar
  -1 siblings, 0 replies; 36+ messages in thread
From: Santosh Shilimkar @ 2018-04-17 17:29 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Sekhar Nori, Bartosz Golaszewski, Kevin Hilman, Russell King,
	Santosh Shilimkar, arm-soc, LKML

On 4/17/2018 5:36 AM, Bartosz Golaszewski wrote:
> 2018-04-17 12:53 GMT+02:00 Sekhar Nori <nsekhar@ti.com>:
>> Hi Bartosz,

[...]

>>> This series applies on top of v8 of David Lechner's CCF series.
>>
>> Are there any patches in the series that can safely be applied to v4.17-rc1?

> 
> Hi Sekhar,
> 
> yes, all of them. They're not linked to David's work in any way.
> 
Please separate the driver/emif/* patches from the series. These
are not fixes so they are not rcx candidates. But will queue them
up for next merge window. Thanks !!

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [RESEND PATCH v2 0/4] ARM: davinci: remove the mach-specific aemif driver - part 1
@ 2018-04-17 17:29       ` Santosh Shilimkar
  0 siblings, 0 replies; 36+ messages in thread
From: Santosh Shilimkar @ 2018-04-17 17:29 UTC (permalink / raw)
  To: linux-arm-kernel

On 4/17/2018 5:36 AM, Bartosz Golaszewski wrote:
> 2018-04-17 12:53 GMT+02:00 Sekhar Nori <nsekhar@ti.com>:
>> Hi Bartosz,

[...]

>>> This series applies on top of v8 of David Lechner's CCF series.
>>
>> Are there any patches in the series that can safely be applied to v4.17-rc1?

> 
> Hi Sekhar,
> 
> yes, all of them. They're not linked to David's work in any way.
> 
Please separate the driver/emif/* patches from the series. These
are not fixes so they are not rcx candidates. But will queue them
up for next merge window. Thanks !!

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [RESEND PATCH v2 0/4] ARM: davinci: remove the mach-specific aemif driver - part 1
  2018-04-17 17:29       ` Santosh Shilimkar
@ 2018-04-18  8:17         ` Sekhar Nori
  -1 siblings, 0 replies; 36+ messages in thread
From: Sekhar Nori @ 2018-04-18  8:17 UTC (permalink / raw)
  To: Santosh Shilimkar, Bartosz Golaszewski
  Cc: Bartosz Golaszewski, Kevin Hilman, Russell King,
	Santosh Shilimkar, arm-soc, LKML

On Tuesday 17 April 2018 10:59 PM, Santosh Shilimkar wrote:
> On 4/17/2018 5:36 AM, Bartosz Golaszewski wrote:
>> 2018-04-17 12:53 GMT+02:00 Sekhar Nori <nsekhar@ti.com>:
>>> Hi Bartosz,
> 
> [...]
> 
>>>> This series applies on top of v8 of David Lechner's CCF series.
>>>
>>> Are there any patches in the series that can safely be applied to
>>> v4.17-rc1?
> 
>>
>> Hi Sekhar,
>>
>> yes, all of them. They're not linked to David's work in any way.
>>
> Please separate the driver/emif/* patches from the series. These
> are not fixes so they are not rcx candidates. But will queue them
> up for next merge window. Thanks !!

Thanks Santosh! Can you please queue the drivers/emif/ patches on an
immutable branch based off v4.17-rc1 which I can then merge to queue the
platform patches?

Thanks,
Sekhar

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [RESEND PATCH v2 0/4] ARM: davinci: remove the mach-specific aemif driver - part 1
@ 2018-04-18  8:17         ` Sekhar Nori
  0 siblings, 0 replies; 36+ messages in thread
From: Sekhar Nori @ 2018-04-18  8:17 UTC (permalink / raw)
  To: linux-arm-kernel

On Tuesday 17 April 2018 10:59 PM, Santosh Shilimkar wrote:
> On 4/17/2018 5:36 AM, Bartosz Golaszewski wrote:
>> 2018-04-17 12:53 GMT+02:00 Sekhar Nori <nsekhar@ti.com>:
>>> Hi Bartosz,
> 
> [...]
> 
>>>> This series applies on top of v8 of David Lechner's CCF series.
>>>
>>> Are there any patches in the series that can safely be applied to
>>> v4.17-rc1?
> 
>>
>> Hi Sekhar,
>>
>> yes, all of them. They're not linked to David's work in any way.
>>
> Please separate the driver/emif/* patches from the series. These
> are not fixes so they are not rcx candidates. But will queue them
> up for next merge window. Thanks !!

Thanks Santosh! Can you please queue the drivers/emif/ patches on an
immutable branch based off v4.17-rc1 which I can then merge to queue the
platform patches?

Thanks,
Sekhar

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [RESEND PATCH v2 0/4] ARM: davinci: remove the mach-specific aemif driver - part 1
  2018-04-18  8:17         ` Sekhar Nori
@ 2018-04-18 17:15           ` Santosh Shilimkar
  -1 siblings, 0 replies; 36+ messages in thread
From: Santosh Shilimkar @ 2018-04-18 17:15 UTC (permalink / raw)
  To: Sekhar Nori, Bartosz Golaszewski
  Cc: Bartosz Golaszewski, Kevin Hilman, Russell King,
	Santosh Shilimkar, arm-soc, LKML

On 4/18/2018 1:17 AM, Sekhar Nori wrote:
> On Tuesday 17 April 2018 10:59 PM, Santosh Shilimkar wrote:
>> On 4/17/2018 5:36 AM, Bartosz Golaszewski wrote:
>>> 2018-04-17 12:53 GMT+02:00 Sekhar Nori <nsekhar@ti.com>:
>>>> Hi Bartosz,
>>
>> [...]
>>
>>>>> This series applies on top of v8 of David Lechner's CCF series.
>>>>
>>>> Are there any patches in the series that can safely be applied to
>>>> v4.17-rc1?
>>
>>>
>>> Hi Sekhar,
>>>
>>> yes, all of them. They're not linked to David's work in any way.
>>>
>> Please separate the driver/emif/* patches from the series. These
>> are not fixes so they are not rcx candidates. But will queue them
>> up for next merge window. Thanks !!
> 
> Thanks Santosh! Can you please queue the drivers/emif/ patches on an
> immutable branch based off v4.17-rc1 which I can then merge to queue the
> platform patches?
> 
Sure. Will send a note once I get to it.

Regards,
Santosh

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [RESEND PATCH v2 0/4] ARM: davinci: remove the mach-specific aemif driver - part 1
@ 2018-04-18 17:15           ` Santosh Shilimkar
  0 siblings, 0 replies; 36+ messages in thread
From: Santosh Shilimkar @ 2018-04-18 17:15 UTC (permalink / raw)
  To: linux-arm-kernel

On 4/18/2018 1:17 AM, Sekhar Nori wrote:
> On Tuesday 17 April 2018 10:59 PM, Santosh Shilimkar wrote:
>> On 4/17/2018 5:36 AM, Bartosz Golaszewski wrote:
>>> 2018-04-17 12:53 GMT+02:00 Sekhar Nori <nsekhar@ti.com>:
>>>> Hi Bartosz,
>>
>> [...]
>>
>>>>> This series applies on top of v8 of David Lechner's CCF series.
>>>>
>>>> Are there any patches in the series that can safely be applied to
>>>> v4.17-rc1?
>>
>>>
>>> Hi Sekhar,
>>>
>>> yes, all of them. They're not linked to David's work in any way.
>>>
>> Please separate the driver/emif/* patches from the series. These
>> are not fixes so they are not rcx candidates. But will queue them
>> up for next merge window. Thanks !!
> 
> Thanks Santosh! Can you please queue the drivers/emif/ patches on an
> immutable branch based off v4.17-rc1 which I can then merge to queue the
> platform patches?
> 
Sure. Will send a note once I get to it.

Regards,
Santosh

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [RESEND PATCH v2 3/4] ARM: davinci: add aemif & nand support to da850-lcdk in legacy mode
  2018-04-17 14:09     ` Sekhar Nori
@ 2018-04-25  9:14       ` Bartosz Golaszewski
  -1 siblings, 0 replies; 36+ messages in thread
From: Bartosz Golaszewski @ 2018-04-25  9:14 UTC (permalink / raw)
  To: Sekhar Nori
  Cc: Kevin Hilman, Russell King, Santosh Shilimkar, Linux ARM,
	Linux Kernel Mailing List, Bartosz Golaszewski

2018-04-17 16:09 GMT+02:00 Sekhar Nori <nsekhar@ti.com>:
> On Tuesday 17 April 2018 03:59 PM, Bartosz Golaszewski wrote:
>> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>>
>> We now have support for aemif & nand from board files. As an example
>> add support for nand to da850-lcdk in legacy mode.
>
> Hawkboard is a separate board of its own, although closely related to
> LCDK. Lets refer to it as hawkboard itself, instead of "LCDK in legacy
> mode". So:
>
> ARM: davinci: omapl138-hawk: ...
>
>>
>> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>> ---
>>  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 6c997c59a3cd..9c3de56b54e4 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,
>
> Can you make it 512K as it is in da850-lcdk.dts ?
>
>> +             .mask_flags     = MTD_WRITEABLE,
>> +     },
>> +     {
>> +             .name           = "free space",
>> +             .offset         = MTDPART_OFS_APPEND,
>> +             .size           = MTDPART_SIZ_FULL,
>> +             .mask_flags     = 0,
>> +     },
>> +};
>
>> +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,
>
> Is there a reason for .id to be set to 1 here? Ideally it should be -1,
> I think since there is a single NAND on the board.
>

The davinci nand driver uses pdev->id as the chipselect number. I
guess this should be in the platform data. I'll send a patch for that.

> Note that I sent a patch dropping AEMIF clock acquisition from DaVinci
> NAND driver.
>
>> +             .dev            = {
>> +                     .platform_data  = &omapl138_hawk_nandflash_data,
>> +             },
>> +             .resource       = omapl138_hawk_nandflash_resource,
>> +             .num_resources  = ARRAY_SIZE(omapl138_hawk_nandflash_resource),
>> +             .id             = 0,
>
> This should have resulted in a double init warning?
>

It should, strange it didn't - at least for me.

Thanks,
Bart

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [RESEND PATCH v2 3/4] ARM: davinci: add aemif & nand support to da850-lcdk in legacy mode
@ 2018-04-25  9:14       ` Bartosz Golaszewski
  0 siblings, 0 replies; 36+ messages in thread
From: Bartosz Golaszewski @ 2018-04-25  9:14 UTC (permalink / raw)
  To: linux-arm-kernel

2018-04-17 16:09 GMT+02:00 Sekhar Nori <nsekhar@ti.com>:
> On Tuesday 17 April 2018 03:59 PM, Bartosz Golaszewski wrote:
>> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>>
>> We now have support for aemif & nand from board files. As an example
>> add support for nand to da850-lcdk in legacy mode.
>
> Hawkboard is a separate board of its own, although closely related to
> LCDK. Lets refer to it as hawkboard itself, instead of "LCDK in legacy
> mode". So:
>
> ARM: davinci: omapl138-hawk: ...
>
>>
>> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>> ---
>>  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 6c997c59a3cd..9c3de56b54e4 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,
>
> Can you make it 512K as it is in da850-lcdk.dts ?
>
>> +             .mask_flags     = MTD_WRITEABLE,
>> +     },
>> +     {
>> +             .name           = "free space",
>> +             .offset         = MTDPART_OFS_APPEND,
>> +             .size           = MTDPART_SIZ_FULL,
>> +             .mask_flags     = 0,
>> +     },
>> +};
>
>> +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,
>
> Is there a reason for .id to be set to 1 here? Ideally it should be -1,
> I think since there is a single NAND on the board.
>

The davinci nand driver uses pdev->id as the chipselect number. I
guess this should be in the platform data. I'll send a patch for that.

> Note that I sent a patch dropping AEMIF clock acquisition from DaVinci
> NAND driver.
>
>> +             .dev            = {
>> +                     .platform_data  = &omapl138_hawk_nandflash_data,
>> +             },
>> +             .resource       = omapl138_hawk_nandflash_resource,
>> +             .num_resources  = ARRAY_SIZE(omapl138_hawk_nandflash_resource),
>> +             .id             = 0,
>
> This should have resulted in a double init warning?
>

It should, strange it didn't - at least for me.

Thanks,
Bart

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [RESEND PATCH v2 3/4] ARM: davinci: add aemif & nand support to da850-lcdk in legacy mode
  2018-04-25  9:14       ` Bartosz Golaszewski
@ 2018-04-25  9:20         ` Sekhar Nori
  -1 siblings, 0 replies; 36+ messages in thread
From: Sekhar Nori @ 2018-04-25  9:20 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Kevin Hilman, Russell King, Santosh Shilimkar, Linux ARM,
	Linux Kernel Mailing List, Bartosz Golaszewski

On Wednesday 25 April 2018 02:44 PM, Bartosz Golaszewski wrote:
> 2018-04-17 16:09 GMT+02:00 Sekhar Nori <nsekhar@ti.com>:
>> On Tuesday 17 April 2018 03:59 PM, Bartosz Golaszewski wrote:
>>> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>>>
>>> We now have support for aemif & nand from board files. As an example
>>> add support for nand to da850-lcdk in legacy mode.
>>
>> Hawkboard is a separate board of its own, although closely related to
>> LCDK. Lets refer to it as hawkboard itself, instead of "LCDK in legacy
>> mode". So:
>>
>> ARM: davinci: omapl138-hawk: ...
>>
>>>
>>> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>>> ---
>>>  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 6c997c59a3cd..9c3de56b54e4 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,
>>
>> Can you make it 512K as it is in da850-lcdk.dts ?
>>
>>> +             .mask_flags     = MTD_WRITEABLE,
>>> +     },
>>> +     {
>>> +             .name           = "free space",
>>> +             .offset         = MTDPART_OFS_APPEND,
>>> +             .size           = MTDPART_SIZ_FULL,
>>> +             .mask_flags     = 0,
>>> +     },
>>> +};
>>
>>> +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,
>>
>> Is there a reason for .id to be set to 1 here? Ideally it should be -1,
>> I think since there is a single NAND on the board.
>>
> 
> The davinci nand driver uses pdev->id as the chipselect number. I
> guess this should be in the platform data. I'll send a patch for that.

I remember that now. No need to change that, I think. Just a comment
here would suffice.

Thanks,
Sekhar

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [RESEND PATCH v2 3/4] ARM: davinci: add aemif & nand support to da850-lcdk in legacy mode
@ 2018-04-25  9:20         ` Sekhar Nori
  0 siblings, 0 replies; 36+ messages in thread
From: Sekhar Nori @ 2018-04-25  9:20 UTC (permalink / raw)
  To: linux-arm-kernel

On Wednesday 25 April 2018 02:44 PM, Bartosz Golaszewski wrote:
> 2018-04-17 16:09 GMT+02:00 Sekhar Nori <nsekhar@ti.com>:
>> On Tuesday 17 April 2018 03:59 PM, Bartosz Golaszewski wrote:
>>> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>>>
>>> We now have support for aemif & nand from board files. As an example
>>> add support for nand to da850-lcdk in legacy mode.
>>
>> Hawkboard is a separate board of its own, although closely related to
>> LCDK. Lets refer to it as hawkboard itself, instead of "LCDK in legacy
>> mode". So:
>>
>> ARM: davinci: omapl138-hawk: ...
>>
>>>
>>> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>>> ---
>>>  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 6c997c59a3cd..9c3de56b54e4 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,
>>
>> Can you make it 512K as it is in da850-lcdk.dts ?
>>
>>> +             .mask_flags     = MTD_WRITEABLE,
>>> +     },
>>> +     {
>>> +             .name           = "free space",
>>> +             .offset         = MTDPART_OFS_APPEND,
>>> +             .size           = MTDPART_SIZ_FULL,
>>> +             .mask_flags     = 0,
>>> +     },
>>> +};
>>
>>> +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,
>>
>> Is there a reason for .id to be set to 1 here? Ideally it should be -1,
>> I think since there is a single NAND on the board.
>>
> 
> The davinci nand driver uses pdev->id as the chipselect number. I
> guess this should be in the platform data. I'll send a patch for that.

I remember that now. No need to change that, I think. Just a comment
here would suffice.

Thanks,
Sekhar

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [RESEND PATCH v2 4/4] ARM: davinci: use aemif platform driver in legacy mode for da850-evm
  2018-04-17 14:12     ` Sekhar Nori
@ 2018-04-25  9:26       ` Bartosz Golaszewski
  -1 siblings, 0 replies; 36+ messages in thread
From: Bartosz Golaszewski @ 2018-04-25  9:26 UTC (permalink / raw)
  To: Sekhar Nori
  Cc: Kevin Hilman, Russell King, Santosh Shilimkar, Linux ARM,
	Linux Kernel Mailing List, Bartosz Golaszewski

2018-04-17 16:12 GMT+02:00 Sekhar Nori <nsekhar@ti.com>:
> On Tuesday 17 April 2018 03:59 PM, Bartosz Golaszewski wrote:
>> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>>
>> We now support board files in aemif. Use the platform driver instead
>> of the handcrafted API in da850-evm.
>>
>> Note: the id of davinci_nand is changed to 0 in order to make it work
>> with the new common-clock framework based psc driver.
>
> Is this now needed after applying my patch dropping clock acquisition
> from DaVinci NAND driver?
>

Now that I realized that pdev->id matters for the driver as well, I'm
thinking this may have broken the support. Unfortunately we don't have
the nand extension for da850-evm to test it. I'll revert it to the
previous value.

Bart

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [RESEND PATCH v2 4/4] ARM: davinci: use aemif platform driver in legacy mode for da850-evm
@ 2018-04-25  9:26       ` Bartosz Golaszewski
  0 siblings, 0 replies; 36+ messages in thread
From: Bartosz Golaszewski @ 2018-04-25  9:26 UTC (permalink / raw)
  To: linux-arm-kernel

2018-04-17 16:12 GMT+02:00 Sekhar Nori <nsekhar@ti.com>:
> On Tuesday 17 April 2018 03:59 PM, Bartosz Golaszewski wrote:
>> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>>
>> We now support board files in aemif. Use the platform driver instead
>> of the handcrafted API in da850-evm.
>>
>> Note: the id of davinci_nand is changed to 0 in order to make it work
>> with the new common-clock framework based psc driver.
>
> Is this now needed after applying my patch dropping clock acquisition
> from DaVinci NAND driver?
>

Now that I realized that pdev->id matters for the driver as well, I'm
thinking this may have broken the support. Unfortunately we don't have
the nand extension for da850-evm to test it. I'll revert it to the
previous value.

Bart

^ permalink raw reply	[flat|nested] 36+ messages in thread

end of thread, other threads:[~2018-04-25  9:26 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-17 10:29 [RESEND PATCH v2 0/4] ARM: davinci: remove the mach-specific aemif driver - part 1 Bartosz Golaszewski
2018-04-17 10:29 ` Bartosz Golaszewski
2018-04-17 10:29 ` [RESEND PATCH v2 1/4] memory: aemif: don't rely on kbuild for driver's name Bartosz Golaszewski
2018-04-17 10:29   ` Bartosz Golaszewski
2018-04-17 10:29 ` [RESEND PATCH v2 2/4] memory: aemif: add support for board files Bartosz Golaszewski
2018-04-17 10:29   ` Bartosz Golaszewski
2018-04-17 13:57   ` Sekhar Nori
2018-04-17 13:57     ` Sekhar Nori
2018-04-17 10:29 ` [RESEND PATCH v2 3/4] ARM: davinci: add aemif & nand support to da850-lcdk in legacy mode Bartosz Golaszewski
2018-04-17 10:29   ` Bartosz Golaszewski
2018-04-17 14:09   ` Sekhar Nori
2018-04-17 14:09     ` Sekhar Nori
2018-04-25  9:14     ` Bartosz Golaszewski
2018-04-25  9:14       ` Bartosz Golaszewski
2018-04-25  9:20       ` Sekhar Nori
2018-04-25  9:20         ` Sekhar Nori
2018-04-17 10:29 ` [RESEND PATCH v2 4/4] ARM: davinci: use aemif platform driver in legacy mode for da850-evm Bartosz Golaszewski
2018-04-17 10:29   ` Bartosz Golaszewski
2018-04-17 14:12   ` Sekhar Nori
2018-04-17 14:12     ` Sekhar Nori
2018-04-25  9:26     ` Bartosz Golaszewski
2018-04-25  9:26       ` Bartosz Golaszewski
2018-04-17 10:53 ` [RESEND PATCH v2 0/4] ARM: davinci: remove the mach-specific aemif driver - part 1 Sekhar Nori
2018-04-17 10:53   ` Sekhar Nori
2018-04-17 12:36   ` Bartosz Golaszewski
2018-04-17 12:36     ` Bartosz Golaszewski
2018-04-17 12:41     ` Bartosz Golaszewski
2018-04-17 12:41       ` Bartosz Golaszewski
2018-04-17 13:59       ` Bartosz Golaszewski
2018-04-17 13:59         ` Bartosz Golaszewski
2018-04-17 17:29     ` Santosh Shilimkar
2018-04-17 17:29       ` Santosh Shilimkar
2018-04-18  8:17       ` Sekhar Nori
2018-04-18  8:17         ` Sekhar Nori
2018-04-18 17:15         ` Santosh Shilimkar
2018-04-18 17:15           ` Santosh Shilimkar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.