ARM: davinci: improve the nand clock lookup
Subsystems (5)
cover ARM: davinci: improve the nand clock lookup
Hi Greg,
Santosh acked patch 1/2, but suggested that it go through your tree. Can you pick it up for 4.11?
Sekhar, will you pick up patch 2/2 for the davinci tree or should it go together with 1/2?
---------
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
Signature · 1 line
2.9.3
PATCH RESEND 1/2 memory: aemif: allow passing device lookup table as platform data
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().
--- 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
drivers/memory/ti-aemif.c +7 -1
@@ -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; }
include/linux/platform_data/ti-aemif.h new file +23 -0
@@ -0,0 +1,23 @@ +/* +* TI DaVinci AEMIF platform glue. +* +* Copyright (C) 2017 BayLibre SAS +* +* Author: +* Bartosz Golaszewski <[email protected]> +* +* 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__ */
Signature · 1 line
2.9.3
PATCH RESEND 2/2 ARM: da850: add the nand dev_id to the clock lookup table
In reply to Bartosz GolaszewskiThe 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.
--- arch/arm/mach-davinci/da850.c | 10 +--------- arch/arm/mach-davinci/da8xx-dt.c | 12 +++++++++++- 2 files changed, 12 insertions(+), 10 deletions(-)
arch/arm/mach-davinci/da850.c +1 -9
@@ -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),
arch/arm/mach-davinci/da8xx-dt.c +11 -1
@@ -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),
Signature · 1 line
2.9.3
Re: [PATCH RESEND 1/2] memory: aemif: allow passing device lookup table as platform data
In reply to Bartosz GolaszewskiHi Greg,
Quoted 8 lines · Bartosz Golaszewski
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_auxdatafor clock lookup but nodes created from within the aemif driver can't access the lookup table.
Quoted 7 lines
Create a platform data structure that holds a pointer to
of_dev_auxdataso that we can use it withof_platform_populate().Signed-off-by Bartosz Golaszewski <[email protected]>Acked-by Sekhar Nori <[email protected]>---
Can you please take this one patch via your driver core ?
Regards,
Santosh
Sekhar Nori
AppliedRe: [PATCH RESEND 2/2] ARM: da850: add the nand dev_id to the clock lookup table
In reply to Bartosz GolaszewskiQuoted 7 lines · Bartosz Golaszewski
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 <[email protected]>
Applied to v4.11/soc
Thanks,
Sekhar
Re: [PATCH RESEND 2/2] ARM: da850: add the nand dev_id to the clock lookup table
Quoted 10 lines · Sekhar Nori
Quoted 7 lines · Bartosz Golaszewski
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 <[email protected]>Applied to v4.11/soc
I forgot that this has a build dependency with 1/2. Instead of creating a dependency with Greg's tree, I think I will send it for v4.12. This is a clean-up and does not add a new feature from a user's perspective so I hope thats okay.
Thanks,
Sekhar
Re: [PATCH RESEND 2/2] ARM: da850: add the nand dev_id to the clock lookup table
2017-01-23 16:17 GMT+01:00 Sekhar Nori <[email protected]>:
Quoted 12 lines · Sekhar Nori
Quoted 10 lines · Bartosz Golaszewski
Quoted 7 lines
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 <[email protected]>Applied to v4.11/soc
Quoted 7 lines
I forgot that this has a build dependency with 1/2. Instead of creating a dependency with Greg's tree, I think I will send it for v4.12. This is a clean-up and does not add a new feature from a user's perspective so I hope thats okay.
Thanks,
Sekhar
Hi Sekhar,
Greg picked up both patches - 1/2 is already in char-misc-next[1].
Thanks,
Bartosz
Re: [PATCH RESEND 2/2] ARM: da850: add the nand dev_id to the clock lookup table
Quoted 18 lines · Bartosz Golaszewski
2017-01-23 16:17 GMT+01:00 Sekhar Nori <[email protected]>:
Quoted 17 lines · Sekhar Nori
Quoted 10 lines · Bartosz Golaszewski
Quoted 7 lines
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 <[email protected]>Applied to v4.11/soc
I forgot that this has a build dependency with 1/2. Instead of creating a dependency with Greg's tree, I think I will send it for v4.12. This is a clean-up and does not add a new feature from a user's perspective so I hope thats okay.
Quoted 6 lines
Quoted 2 lines
Thanks,
SekharHi Sekhar,
Greg picked up both patches - 1/2 is already in char-misc-next[1].
Alright. I did not notice any merge conflicts between this and what I plan to queue so I guess we are okay.
Thanks
Sekhar