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


Groups > linux.kernel > #1550641 > unrolled thread

[PATCH 0/2] ARM: davinci: improve the nand clock lookup

Started byBartosz Golaszewski <bgolaszewski@baylibre.com>
First post2017-01-04 11:40 +0100
Last post2017-01-04 11:40 +0100
Articles 5 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/2] ARM: davinci: improve the nand clock lookup Bartosz Golaszewski <bgolaszewski@baylibre.com> - 2017-01-04 11:40 +0100
    [PATCH 1/2] memory: aemif: allow passing device lookup table as platform data Bartosz Golaszewski <bgolaszewski@baylibre.com> - 2017-01-04 11:40 +0100
      Re: [PATCH 1/2] memory: aemif: allow passing device lookup table as  platform data Sekhar Nori <nsekhar@ti.com> - 2017-01-10 12:30 +0100
      Re: [PATCH 1/2] memory: aemif: allow passing device lookup table as  platform data "santosh.shilimkar@oracle.com" <santosh.shilimkar@oracle.com> - 2017-01-12 19:00 +0100
    [PATCH 2/2] ARM: da850: add the nand dev_id to the clock lookup table Bartosz Golaszewski <bgolaszewski@baylibre.com> - 2017-01-04 11:40 +0100

#1550641 — [PATCH 0/2] ARM: davinci: improve the nand clock lookup

FromBartosz Golaszewski <bgolaszewski@baylibre.com>
Date2017-01-04 11:40 +0100
Subject[PATCH 0/2] ARM: davinci: improve the nand clock lookup
Message-ID<sVR97-3si-1@gated-at.bofh.it>
Hi Sekhar,

this is a follow-up to the series fixing the da850 clocks.

Instead of having a half-measure of leaving out the dev_id from the
clock lookup table, make the aemif driver capable of accessing it
over platform data.

Tested with da850-lcdk.

Bartosz Golaszewski (2):
  memory: aemif: allow passing device lookup table as platform data
  ARM: da850: add the nand dev_id to the clock lookup table

 arch/arm/mach-davinci/da850.c          | 10 +---------
 arch/arm/mach-davinci/da8xx-dt.c       | 12 +++++++++++-
 drivers/memory/ti-aemif.c              |  8 +++++++-
 include/linux/platform_data/ti-aemif.h | 23 +++++++++++++++++++++++
 4 files changed, 42 insertions(+), 11 deletions(-)
 create mode 100644 include/linux/platform_data/ti-aemif.h

-- 
2.9.3

[toc] | [next] | [standalone]


#1550643 — [PATCH 1/2] memory: aemif: allow passing device lookup table as platform data

FromBartosz Golaszewski <bgolaszewski@baylibre.com>
Date2017-01-04 11:40 +0100
Subject[PATCH 1/2] memory: aemif: allow passing device lookup table as platform data
Message-ID<sVR98-3si-9@gated-at.bofh.it>
In reply to#1550641
TI aemif driver creates its own subnodes of the device tree in order
to guarantee that all child devices are probed after the AEMIF timing
parameters are configured.

Some devices (e.g. da850) use struct of_dev_auxdata for clock lookup
but nodes created from within the aemif driver can't access the lookup
table.

Create a platform data structure that holds a pointer to
of_dev_auxdata so that we can use it with of_platform_populate().

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
 drivers/memory/ti-aemif.c              |  8 +++++++-
 include/linux/platform_data/ti-aemif.h | 23 +++++++++++++++++++++++
 2 files changed, 30 insertions(+), 1 deletion(-)
 create mode 100644 include/linux/platform_data/ti-aemif.h

diff --git a/drivers/memory/ti-aemif.c b/drivers/memory/ti-aemif.c
index a579a0f..22c1aee 100644
--- a/drivers/memory/ti-aemif.c
+++ b/drivers/memory/ti-aemif.c
@@ -20,6 +20,7 @@
 #include <linux/of.h>
 #include <linux/of_platform.h>
 #include <linux/platform_device.h>
+#include <linux/platform_data/ti-aemif.h>
 
 #define TA_SHIFT	2
 #define RHOLD_SHIFT	4
@@ -335,6 +336,8 @@ static int aemif_probe(struct platform_device *pdev)
 	struct device_node *np = dev->of_node;
 	struct device_node *child_np;
 	struct aemif_device *aemif;
+	struct aemif_platform_data *pdata;
+	struct of_dev_auxdata *dev_lookup;
 
 	if (np == NULL)
 		return 0;
@@ -343,6 +346,9 @@ static int aemif_probe(struct platform_device *pdev)
 	if (!aemif)
 		return -ENOMEM;
 
+	pdata = dev_get_platdata(&pdev->dev);
+	dev_lookup = pdata ? pdata->dev_lookup : NULL;
+
 	platform_set_drvdata(pdev, aemif);
 
 	aemif->clk = devm_clk_get(dev, NULL);
@@ -390,7 +396,7 @@ static int aemif_probe(struct platform_device *pdev)
 	 * parameters are set.
 	 */
 	for_each_available_child_of_node(np, child_np) {
-		ret = of_platform_populate(child_np, NULL, NULL, dev);
+		ret = of_platform_populate(child_np, NULL, dev_lookup, dev);
 		if (ret < 0)
 			goto error;
 	}
diff --git a/include/linux/platform_data/ti-aemif.h b/include/linux/platform_data/ti-aemif.h
new file mode 100644
index 0000000..ac72e11
--- /dev/null
+++ b/include/linux/platform_data/ti-aemif.h
@@ -0,0 +1,23 @@
+/*
+ * TI DaVinci AEMIF platform glue.
+ *
+ * Copyright (C) 2017 BayLibre SAS
+ *
+ * Author:
+ *   Bartosz Golaszewski <bgolaszewski@baylibre.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef __TI_DAVINCI_AEMIF_DATA_H__
+#define __TI_DAVINCI_AEMIF_DATA_H__
+
+#include <linux/of_platform.h>
+
+struct aemif_platform_data {
+	struct of_dev_auxdata *dev_lookup;
+};
+
+#endif /* __TI_DAVINCI_AEMIF_DATA_H__ */
-- 
2.9.3

[toc] | [prev] | [next] | [standalone]


#1555167 — Re: [PATCH 1/2] memory: aemif: allow passing device lookup table as platform data

FromSekhar Nori <nsekhar@ti.com>
Date2017-01-10 12:30 +0100
SubjectRe: [PATCH 1/2] memory: aemif: allow passing device lookup table as platform data
Message-ID<sY2MO-Gw-17@gated-at.bofh.it>
In reply to#1550643
On Wednesday 04 January 2017 04:06 PM, Bartosz Golaszewski wrote:
> TI aemif driver creates its own subnodes of the device tree in order
> to guarantee that all child devices are probed after the AEMIF timing
> parameters are configured.
> 
> Some devices (e.g. da850) use struct of_dev_auxdata for clock lookup
> but nodes created from within the aemif driver can't access the lookup
> table.
> 
> Create a platform data structure that holds a pointer to
> of_dev_auxdata so that we can use it with of_platform_populate().
> 
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>

I did not really see any precedent to passing of_dev_auxdata as platform
data, but the idea looks fine to me, so:

Acked-by: Sekhar Nori <nsekhar@ti.com>

Thanks,
Sekhar

[toc] | [prev] | [next] | [standalone]


#1557676 — Re: [PATCH 1/2] memory: aemif: allow passing device lookup table as platform data

From"santosh.shilimkar@oracle.com" <santosh.shilimkar@oracle.com>
Date2017-01-12 19:00 +0100
SubjectRe: [PATCH 1/2] memory: aemif: allow passing device lookup table as platform data
Message-ID<sYRPk-6SY-41@gated-at.bofh.it>
In reply to#1550643
On 1/4/17 2:36 AM, Bartosz Golaszewski wrote:
> TI aemif driver creates its own subnodes of the device tree in order
> to guarantee that all child devices are probed after the AEMIF timing
> parameters are configured.
>
> Some devices (e.g. da850) use struct of_dev_auxdata for clock lookup
> but nodes created from within the aemif driver can't access the lookup
> table.
>
> Create a platform data structure that holds a pointer to
> of_dev_auxdata so that we can use it with of_platform_populate().
>
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> ---
Patch looks fine to me. Did I miss PATCH 2/2 ?
drivers/memory/* patches has been queue via Greg KH tree. Please
repost your series with acks and copy Greg. I will request Greg
to queue these changes via his tree.

Regards,
Santosh

[toc] | [prev] | [next] | [standalone]


#1550648 — [PATCH 2/2] ARM: da850: add the nand dev_id to the clock lookup table

FromBartosz Golaszewski <bgolaszewski@baylibre.com>
Date2017-01-04 11:40 +0100
Subject[PATCH 2/2] ARM: da850: add the nand dev_id to the clock lookup table
Message-ID<sVR98-3si-25@gated-at.bofh.it>
In reply to#1550641
The aemif driver can now access struct of_dev_auxdata (using platform
data).

Add the device id to the clock lookup table for the nand clock and
create a separate lookup table for aemif subnodes.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
 arch/arm/mach-davinci/da850.c    | 10 +---------
 arch/arm/mach-davinci/da8xx-dt.c | 12 +++++++++++-
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
index 55f6e11..7475f02 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -557,15 +557,7 @@ static struct clk_lookup da850_clks[] = {
 	CLK("da830-mmc.0",	NULL,		&mmcsd0_clk),
 	CLK("da830-mmc.1",	NULL,		&mmcsd1_clk),
 	CLK("ti-aemif",		NULL,		&aemif_clk),
-	/*
-	 * The only user of this clock is davinci_nand and it get's it through
-	 * con_id. The nand node itself is created from within the aemif
-	 * driver to guarantee that it's probed after the aemif timing
-	 * parameters are configured. of_dev_auxdata is not accessible from
-	 * the aemif driver and can't be passed to of_platform_populate(). For
-	 * that reason we're leaving the dev_id here as NULL.
-	 */
-	CLK(NULL,		"aemif",	&aemif_nand_clk),
+	CLK("davinci-nand.0",	"aemif",	&aemif_nand_clk),
 	CLK("ohci-da8xx",	"usb11",	&usb11_clk),
 	CLK("musb-da8xx",	"usb20",	&usb20_clk),
 	CLK("spi_davinci.0",	NULL,		&spi0_clk),
diff --git a/arch/arm/mach-davinci/da8xx-dt.c b/arch/arm/mach-davinci/da8xx-dt.c
index 9ee44da..06205fe 100644
--- a/arch/arm/mach-davinci/da8xx-dt.c
+++ b/arch/arm/mach-davinci/da8xx-dt.c
@@ -11,6 +11,7 @@
 #include <linux/of_irq.h>
 #include <linux/of_platform.h>
 #include <linux/irqdomain.h>
+#include <linux/platform_data/ti-aemif.h>
 
 #include <asm/mach/arch.h>
 
@@ -18,6 +19,15 @@
 #include "cp_intc.h"
 #include <mach/da8xx.h>
 
+static struct of_dev_auxdata da850_aemif_auxdata_lookup[] = {
+	OF_DEV_AUXDATA("ti,davinci-nand", 0x62000000, "davinci-nand.0", NULL),
+	{}
+};
+
+static struct aemif_platform_data aemif_data = {
+	.dev_lookup = da850_aemif_auxdata_lookup,
+};
+
 static struct of_dev_auxdata da850_auxdata_lookup[] __initdata = {
 	OF_DEV_AUXDATA("ti,davinci-i2c", 0x01c22000, "i2c_davinci.1", NULL),
 	OF_DEV_AUXDATA("ti,davinci-i2c", 0x01e28000, "i2c_davinci.2", NULL),
@@ -37,7 +47,7 @@ static struct of_dev_auxdata da850_auxdata_lookup[] __initdata = {
 	OF_DEV_AUXDATA("ti,davinci-dm6467-emac", 0x01e20000, "davinci_emac.1",
 		       NULL),
 	OF_DEV_AUXDATA("ti,da830-mcasp-audio", 0x01d00000, "davinci-mcasp.0", NULL),
-	OF_DEV_AUXDATA("ti,da850-aemif", 0x68000000, "ti-aemif", NULL),
+	OF_DEV_AUXDATA("ti,da850-aemif", 0x68000000, "ti-aemif", &aemif_data),
 	OF_DEV_AUXDATA("ti,da850-tilcdc", 0x01e13000, "da8xx_lcdc.0", NULL),
 	OF_DEV_AUXDATA("ti,da830-ohci", 0x01e25000, "ohci-da8xx", NULL),
 	OF_DEV_AUXDATA("ti,da830-musb", 0x01e00000, "musb-da8xx", NULL),
-- 
2.9.3

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web