linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] memory: aemif: add support for machine code
@ 2018-04-19 15:12 Bartosz Golaszewski
  2018-04-19 15:12 ` [PATCH v2 1/2] memory: aemif: don't rely on kbuild for driver's name Bartosz Golaszewski
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Bartosz Golaszewski @ 2018-04-19 15:12 UTC (permalink / raw)
  To: Sekhar Nori, Kevin Hilman, Santosh Shilimkar
  Cc: linux-arm-kernel, linux-kernel, Bartosz Golaszewski

From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

This is a follow-up to the series that contained both changes to the
aemif driver and platform code. It contains only the driver changes.

As the first step in removing duplicate support for aemif from the
kernel we need to add support for board files to the aemif memory
driver.

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

The second adds support for board files to the aemif driver.

This series includes changes requested by Sekhar in his code review:
- made aemif the parent of each sub-device before registering it
- documented the new members in aemif_platform_data

v1 -> v2:
- actually iterate over abus entries instead of always accessing the
  first one

Bartosz Golaszewski (2):
  memory: aemif: don't rely on kbuild for driver's name
  memory: aemif: add support for board files

 drivers/memory/ti-aemif.c              | 60 +++++++++++++++++---------
 include/linux/platform_data/ti-aemif.h | 25 +++++++++++
 2 files changed, 64 insertions(+), 21 deletions(-)

-- 
2.17.0

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

* [PATCH v2 1/2] memory: aemif: don't rely on kbuild for driver's name
  2018-04-19 15:12 [PATCH v2 0/2] memory: aemif: add support for machine code Bartosz Golaszewski
@ 2018-04-19 15:12 ` Bartosz Golaszewski
  2018-04-19 15:12 ` [PATCH v2 2/2] memory: aemif: add support for board files Bartosz Golaszewski
  2018-04-20 17:24 ` [PATCH v2 0/2] memory: aemif: add support for machine code santosh.shilimkar
  2 siblings, 0 replies; 5+ messages in thread
From: Bartosz Golaszewski @ 2018-04-19 15:12 UTC (permalink / raw)
  To: Sekhar Nori, Kevin Hilman, 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] 5+ messages in thread

* [PATCH v2 2/2] memory: aemif: add support for board files
  2018-04-19 15:12 [PATCH v2 0/2] memory: aemif: add support for machine code Bartosz Golaszewski
  2018-04-19 15:12 ` [PATCH v2 1/2] memory: aemif: don't rely on kbuild for driver's name Bartosz Golaszewski
@ 2018-04-19 15:12 ` Bartosz Golaszewski
  2018-04-20 17:24 ` [PATCH v2 0/2] memory: aemif: add support for machine code santosh.shilimkar
  2 siblings, 0 replies; 5+ messages in thread
From: Bartosz Golaszewski @ 2018-04-19 15:12 UTC (permalink / raw)
  To: Sekhar Nori, Kevin Hilman, 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.

While extending the platform data struct, add kernel docs describing
its members.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
 drivers/memory/ti-aemif.c              | 58 +++++++++++++++++---------
 include/linux/platform_data/ti-aemif.h | 25 +++++++++++
 2 files changed, 63 insertions(+), 20 deletions(-)

diff --git a/drivers/memory/ti-aemif.c b/drivers/memory/ti-aemif.c
index 588e58d40d1b..31112f622b88 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[i].cs;
+			aemif_get_hw_params(pdev, i);
+		}
 	}
 
 	for (i = 0; i < aemif->num_cs; i++) {
@@ -394,14 +401,25 @@ 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++) {
+			pdata->sub_devices[i].dev.parent = dev;
+			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..e6407bafcbf8 100644
--- a/include/linux/platform_data/ti-aemif.h
+++ b/include/linux/platform_data/ti-aemif.h
@@ -16,8 +16,33 @@
 
 #include <linux/of_platform.h>
 
+/**
+ * struct aemif_abus_data - Async bus configuration parameters.
+ *
+ * @cs - Chip-select number.
+ */
+struct aemif_abus_data {
+	u32 cs;
+};
+
+/**
+ * struct aemif_platform_data - Data to set up the TI aemif driver.
+ *
+ * @dev_lookup: of_dev_auxdata passed to of_platform_populate() for aemif
+ *              subdevices.
+ * @cs_offset: Lowest allowed chip-select number.
+ * @abus_data: Array of async bus configuration entries.
+ * @num_abus_data: Number of abus entries.
+ * @sub_devices: Array of platform subdevices.
+ * @num_sub_devices: Number of subdevices.
+ */
 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] 5+ messages in thread

* Re: [PATCH v2 0/2] memory: aemif: add support for machine code
  2018-04-19 15:12 [PATCH v2 0/2] memory: aemif: add support for machine code Bartosz Golaszewski
  2018-04-19 15:12 ` [PATCH v2 1/2] memory: aemif: don't rely on kbuild for driver's name Bartosz Golaszewski
  2018-04-19 15:12 ` [PATCH v2 2/2] memory: aemif: add support for board files Bartosz Golaszewski
@ 2018-04-20 17:24 ` santosh.shilimkar
  2018-04-24  8:51   ` Sekhar Nori
  2 siblings, 1 reply; 5+ messages in thread
From: santosh.shilimkar @ 2018-04-20 17:24 UTC (permalink / raw)
  To: Bartosz Golaszewski, Sekhar Nori, Santosh Shilimkar
  Cc: Kevin Hilman, linux-arm-kernel, linux-kernel, Bartosz Golaszewski

On 4/19/18 8:12 AM, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> 
> This is a follow-up to the series that contained both changes to the
> aemif driver and platform code. It contains only the driver changes.
> 
> As the first step in removing duplicate support for aemif from the
> kernel we need to add support for board files to the aemif memory
> driver.
> 
> First patch just uses a static string for the ti-aemif driver name.
> 
> The second adds support for board files to the aemif driver.
> 
> This series includes changes requested by Sekhar in his code review:
> - made aemif the parent of each sub-device before registering it
> - documented the new members in aemif_platform_data
> 
> v1 -> v2:
> - actually iterate over abus entries instead of always accessing the
>    first one
> 
> Bartosz Golaszewski (2):
>    memory: aemif: don't rely on kbuild for driver's name
>    memory: aemif: add support for board files
> 
Applied. Should show up in next soon.

Sekhar, You can use below branch.

git://git.kernel.org/pub/scm/linux/kernel/git/ssantosh/linux-keystone.git 
  'for_4.18/soc-drivers'

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

* Re: [PATCH v2 0/2] memory: aemif: add support for machine code
  2018-04-20 17:24 ` [PATCH v2 0/2] memory: aemif: add support for machine code santosh.shilimkar
@ 2018-04-24  8:51   ` Sekhar Nori
  0 siblings, 0 replies; 5+ messages in thread
From: Sekhar Nori @ 2018-04-24  8:51 UTC (permalink / raw)
  To: santosh.shilimkar, Bartosz Golaszewski, Santosh Shilimkar
  Cc: Kevin Hilman, linux-arm-kernel, linux-kernel, Bartosz Golaszewski

On Friday 20 April 2018 10:54 PM, santosh.shilimkar@oracle.com wrote:
> On 4/19/18 8:12 AM, Bartosz Golaszewski wrote:
>> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>>
>> This is a follow-up to the series that contained both changes to the
>> aemif driver and platform code. It contains only the driver changes.
>>
>> As the first step in removing duplicate support for aemif from the
>> kernel we need to add support for board files to the aemif memory
>> driver.
>>
>> First patch just uses a static string for the ti-aemif driver name.
>>
>> The second adds support for board files to the aemif driver.
>>
>> This series includes changes requested by Sekhar in his code review:
>> - made aemif the parent of each sub-device before registering it
>> - documented the new members in aemif_platform_data
>>
>> v1 -> v2:
>> - actually iterate over abus entries instead of always accessing the
>>    first one
>>
>> Bartosz Golaszewski (2):
>>    memory: aemif: don't rely on kbuild for driver's name
>>    memory: aemif: add support for board files
>>
> Applied. Should show up in next soon.
> 
> Sekhar, You can use below branch.
> 
> git://git.kernel.org/pub/scm/linux/kernel/git/ssantosh/linux-keystone.git  'for_4.18/soc-drivers'

Thanks Santosh!

Regards,
Sekhar

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

end of thread, other threads:[~2018-04-24  8:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-19 15:12 [PATCH v2 0/2] memory: aemif: add support for machine code Bartosz Golaszewski
2018-04-19 15:12 ` [PATCH v2 1/2] memory: aemif: don't rely on kbuild for driver's name Bartosz Golaszewski
2018-04-19 15:12 ` [PATCH v2 2/2] memory: aemif: add support for board files Bartosz Golaszewski
2018-04-20 17:24 ` [PATCH v2 0/2] memory: aemif: add support for machine code santosh.shilimkar
2018-04-24  8:51   ` Sekhar Nori

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).