ARM: davinci: improve the nand clock lookup
Subsystems (5)
cover ARM: davinci: improve the nand clock lookup
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
Signature · 1 line
2.9.3
PATCH 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 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 1/2] memory: aemif: allow passing device lookup table as platform data
In reply to Bartosz GolaszewskiQuoted 4 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.
Quoted 8 lines
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.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]>
I did not really see any precedent to passing of_dev_auxdata as platform data, but the idea looks fine to me, so:
Thanks,
Sekhar
Re: [PATCH 1/2] memory: aemif: allow passing device lookup table as platform data
In reply to Bartosz GolaszewskiQuoted 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 5 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]>---
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