* [PATCH 1/3] ARM: ux500: Add device nodes for TCDM and TCPM memory locations @ 2013-03-25 15:02 Lee Jones 2013-03-25 15:02 ` [PATCH 2/3] mfd: db8500-prcmu: Fetch the PRCMU TCDM base address from Device Tree Lee Jones 2013-03-25 15:02 ` [PATCH 3/3] mfd: db8500-prcmu: Fetch the PRCMU TCPM " Lee Jones 0 siblings, 2 replies; 13+ messages in thread From: Lee Jones @ 2013-03-25 15:02 UTC (permalink / raw) To: linux-arm-kernel The PRCMU requires the Tightly Coupled Memory (TCM) locations in order to function correctly. A recent move to send the base addresses though the PRCMU platform device resource instead of defines found in <mach/*>, means that dbx500 devices can no longer boot successfully. These new nodes will allow the PRCMU to extract the base memory locations from Device Tree instead. Signed-off-by: Lee Jones <lee.jones@linaro.org> --- arch/arm/boot/dts/snowball.dts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/arm/boot/dts/snowball.dts b/arch/arm/boot/dts/snowball.dts index d3ec32f..6195ffa 100644 --- a/arch/arm/boot/dts/snowball.dts +++ b/arch/arm/boot/dts/snowball.dts @@ -126,6 +126,14 @@ }; }; + prcmu-tcpm-per4 at 801b0000 { + reg = <0x801b0000 0x1000>; + }; + + prcmu-tcdm-per4 at 801b8000 { + reg = <0x801b8000 0x1000>; + }; + external-bus at 50000000 { status = "okay"; -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 2/3] mfd: db8500-prcmu: Fetch the PRCMU TCDM base address from Device Tree 2013-03-25 15:02 [PATCH 1/3] ARM: ux500: Add device nodes for TCDM and TCPM memory locations Lee Jones @ 2013-03-25 15:02 ` Lee Jones 2013-03-25 15:32 ` Lee Jones 2013-03-25 15:40 ` Arnd Bergmann 2013-03-25 15:02 ` [PATCH 3/3] mfd: db8500-prcmu: Fetch the PRCMU TCPM " Lee Jones 1 sibling, 2 replies; 13+ messages in thread From: Lee Jones @ 2013-03-25 15:02 UTC (permalink / raw) To: linux-arm-kernel A recent move to send the base addresses though the PRCMU platform device resource instead of defines found in <mach/*>, means that dbx500 devices can no longer boot successfully when booting with Device Tree enabled. This patch ensures the addresses are obtained correctly from DT. Signed-off-by: Lee Jones <lee.jones@linaro.org> --- drivers/mfd/db8500-prcmu.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/drivers/mfd/db8500-prcmu.c b/drivers/mfd/db8500-prcmu.c index 21f261b..8602bf8 100644 --- a/drivers/mfd/db8500-prcmu.c +++ b/drivers/mfd/db8500-prcmu.c @@ -17,6 +17,8 @@ #include <linux/err.h> #include <linux/spinlock.h> #include <linux/io.h> +#include <linux/of.h> +#include <linux/of_address.h> #include <linux/slab.h> #include <linux/mutex.h> #include <linux/completion.h> @@ -2790,19 +2792,29 @@ static int db8500_irq_init(struct device_node *np) } static void dbx500_fw_version_init(struct platform_device *pdev, - u32 version_offset) + u32 version_offset, + struct device_node *np) { + struct device_node *tcpm_np; struct resource *res; - void __iomem *tcpm_base; + void __iomem *tcpm_base = NULL; res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "prcmu-tcpm"); if (!res) { - dev_err(&pdev->dev, - "Error: no prcmu tcpm memory region provided\n"); - return; - } - tcpm_base = ioremap(res->start, resource_size(res)); + if (np) { + tcpm_np = of_find_node_by_name(np->parent, + "prcmu-tcpm-per4"); + if (!tcpm_np) { + dev_err(&pdev->dev, + "no prcmu tcpm mem region provided\n"); + return; + } + tcpm_base = of_iomap(tcpm_np, 0); + } + } else + tcpm_base = ioremap(res->start, resource_size(res)); + if (tcpm_base != NULL) { u32 version; @@ -3154,7 +3166,7 @@ static int db8500_prcmu_probe(struct platform_device *pdev) init_prcm_registers(); - dbx500_fw_version_init(pdev, pdata->version_offset); + dbx500_fw_version_init(pdev, pdata->version_offset, np); res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "prcmu-tcdm"); if (!res) { dev_err(&pdev->dev, "no prcmu tcdm region provided\n"); -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 2/3] mfd: db8500-prcmu: Fetch the PRCMU TCDM base address from Device Tree 2013-03-25 15:02 ` [PATCH 2/3] mfd: db8500-prcmu: Fetch the PRCMU TCDM base address from Device Tree Lee Jones @ 2013-03-25 15:32 ` Lee Jones 2013-03-25 15:40 ` Arnd Bergmann 1 sibling, 0 replies; 13+ messages in thread From: Lee Jones @ 2013-03-25 15:32 UTC (permalink / raw) To: linux-arm-kernel Sam, and this one, sorry. > A recent move to send the base addresses though the PRCMU platform > device resource instead of defines found in <mach/*>, means that dbx500 > devices can no longer boot successfully when booting with Device Tree > enabled. This patch ensures the addresses are obtained correctly from > DT. > > Signed-off-by: Lee Jones <lee.jones@linaro.org> > --- > drivers/mfd/db8500-prcmu.c | 28 ++++++++++++++++++++-------- > 1 file changed, 20 insertions(+), 8 deletions(-) > > diff --git a/drivers/mfd/db8500-prcmu.c b/drivers/mfd/db8500-prcmu.c > index 21f261b..8602bf8 100644 > --- a/drivers/mfd/db8500-prcmu.c > +++ b/drivers/mfd/db8500-prcmu.c > @@ -17,6 +17,8 @@ > #include <linux/err.h> > #include <linux/spinlock.h> > #include <linux/io.h> > +#include <linux/of.h> > +#include <linux/of_address.h> > #include <linux/slab.h> > #include <linux/mutex.h> > #include <linux/completion.h> > @@ -2790,19 +2792,29 @@ static int db8500_irq_init(struct device_node *np) > } > > static void dbx500_fw_version_init(struct platform_device *pdev, > - u32 version_offset) > + u32 version_offset, > + struct device_node *np) > { > + struct device_node *tcpm_np; > struct resource *res; > - void __iomem *tcpm_base; > + void __iomem *tcpm_base = NULL; > > res = platform_get_resource_byname(pdev, IORESOURCE_MEM, > "prcmu-tcpm"); > if (!res) { > - dev_err(&pdev->dev, > - "Error: no prcmu tcpm memory region provided\n"); > - return; > - } > - tcpm_base = ioremap(res->start, resource_size(res)); > + if (np) { > + tcpm_np = of_find_node_by_name(np->parent, > + "prcmu-tcpm-per4"); > + if (!tcpm_np) { > + dev_err(&pdev->dev, > + "no prcmu tcpm mem region provided\n"); > + return; > + } > + tcpm_base = of_iomap(tcpm_np, 0); > + } > + } else > + tcpm_base = ioremap(res->start, resource_size(res)); > + > if (tcpm_base != NULL) { > u32 version; > > @@ -3154,7 +3166,7 @@ static int db8500_prcmu_probe(struct platform_device *pdev) > > init_prcm_registers(); > > - dbx500_fw_version_init(pdev, pdata->version_offset); > + dbx500_fw_version_init(pdev, pdata->version_offset, np); > res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "prcmu-tcdm"); > if (!res) { > dev_err(&pdev->dev, "no prcmu tcdm region provided\n"); -- Lee Jones Linaro ST-Ericsson Landing Team Lead Linaro.org ? Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 2/3] mfd: db8500-prcmu: Fetch the PRCMU TCDM base address from Device Tree 2013-03-25 15:02 ` [PATCH 2/3] mfd: db8500-prcmu: Fetch the PRCMU TCDM base address from Device Tree Lee Jones 2013-03-25 15:32 ` Lee Jones @ 2013-03-25 15:40 ` Arnd Bergmann 2013-03-25 16:46 ` Lee Jones 1 sibling, 1 reply; 13+ messages in thread From: Arnd Bergmann @ 2013-03-25 15:40 UTC (permalink / raw) To: linux-arm-kernel On Monday 25 March 2013, Lee Jones wrote: > res = platform_get_resource_byname(pdev, IORESOURCE_MEM, > "prcmu-tcpm"); > if (!res) { > - dev_err(&pdev->dev, > - "Error: no prcmu tcpm memory region provided\n"); > - return; > - } > - tcpm_base = ioremap(res->start, resource_size(res)); > + if (np) { > + tcpm_np = of_find_node_by_name(np->parent, > + "prcmu-tcpm-per4"); > + if (!tcpm_np) { > + dev_err(&pdev->dev, > + "no prcmu tcpm mem region provided\n"); > + return; > + } > + tcpm_base = of_iomap(tcpm_np, 0); > + } > + } else > + tcpm_base = ioremap(res->start, resource_size(res)); > + Why don't you just add these extra registers to the prcmu node itself like diff --git a/arch/arm/boot/dts/dbx5x0.dtsi b/arch/arm/boot/dts/dbx5x0.dtsi index 9de9309..6ee6c31 100644 --- a/arch/arm/boot/dts/dbx5x0.dtsi +++ b/arch/arm/boot/dts/dbx5x0.dtsi @@ -191,8 +191,8 @@ prcmu: prcmu at 80157000 { compatible = "stericsson,db8500-prcmu"; - reg = <0x80157000 0x1000>; - reg-names = "prcmu"; + reg = <0x80157000 0x1000>, <0x801b0000 0x1000>, <0x801b8000 0x1000>; + reg-names = "prcmu", "prcmu-tcpm", "prcmu-tcdm-per4"; interrupts = <0 47 0x4>; #address-cells = <1>; #size-cells = <1>; and document those in the prcmu binding? That would keep the code simpler and the same for both cases. Arnd ^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 2/3] mfd: db8500-prcmu: Fetch the PRCMU TCDM base address from Device Tree 2013-03-25 15:40 ` Arnd Bergmann @ 2013-03-25 16:46 ` Lee Jones 2013-03-25 21:32 ` Linus Walleij 0 siblings, 1 reply; 13+ messages in thread From: Lee Jones @ 2013-03-25 16:46 UTC (permalink / raw) To: linux-arm-kernel > > res = platform_get_resource_byname(pdev, IORESOURCE_MEM, > > "prcmu-tcpm"); > > if (!res) { > > - dev_err(&pdev->dev, > > - "Error: no prcmu tcpm memory region provided\n"); > > - return; > > - } > > - tcpm_base = ioremap(res->start, resource_size(res)); > > + if (np) { > > + tcpm_np = of_find_node_by_name(np->parent, > > + "prcmu-tcpm-per4"); > > + if (!tcpm_np) { > > + dev_err(&pdev->dev, > > + "no prcmu tcpm mem region provided\n"); > > + return; > > + } > > + tcpm_base = of_iomap(tcpm_np, 0); > > + } > > + } else > > + tcpm_base = ioremap(res->start, resource_size(res)); > > + > > Why don't you just add these extra registers to the prcmu node itself like > > diff --git a/arch/arm/boot/dts/dbx5x0.dtsi b/arch/arm/boot/dts/dbx5x0.dtsi > index 9de9309..6ee6c31 100644 > --- a/arch/arm/boot/dts/dbx5x0.dtsi > +++ b/arch/arm/boot/dts/dbx5x0.dtsi > @@ -191,8 +191,8 @@ > > prcmu: prcmu at 80157000 { > compatible = "stericsson,db8500-prcmu"; > - reg = <0x80157000 0x1000>; > - reg-names = "prcmu"; > + reg = <0x80157000 0x1000>, <0x801b0000 0x1000>, <0x801b8000 0x1000>; > + reg-names = "prcmu", "prcmu-tcpm", "prcmu-tcdm-per4"; > interrupts = <0 47 0x4>; > #address-cells = <1>; > #size-cells = <1>; > > > and document those in the prcmu binding? > > That would keep the code simpler and the same for both cases. I'm not sure you can. These addresses differ from platform to platform, so I'd need to provide the base PRCMU address in dbx5x0.dtsi, then the other two in the dts files. Can you do that? -- Lee Jones Linaro ST-Ericsson Landing Team Lead Linaro.org ? Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 2/3] mfd: db8500-prcmu: Fetch the PRCMU TCDM base address from Device Tree 2013-03-25 16:46 ` Lee Jones @ 2013-03-25 21:32 ` Linus Walleij 2013-03-26 8:17 ` Lee Jones 0 siblings, 1 reply; 13+ messages in thread From: Linus Walleij @ 2013-03-25 21:32 UTC (permalink / raw) To: linux-arm-kernel On Mon, Mar 25, 2013 at 5:46 PM, Lee Jones <lee.jones@linaro.org> wrote: >> > res = platform_get_resource_byname(pdev, IORESOURCE_MEM, >> > "prcmu-tcpm"); >> > if (!res) { >> > - dev_err(&pdev->dev, >> > - "Error: no prcmu tcpm memory region provided\n"); >> > - return; >> > - } >> > - tcpm_base = ioremap(res->start, resource_size(res)); >> > + if (np) { >> > + tcpm_np = of_find_node_by_name(np->parent, >> > + "prcmu-tcpm-per4"); >> > + if (!tcpm_np) { >> > + dev_err(&pdev->dev, >> > + "no prcmu tcpm mem region provided\n"); >> > + return; >> > + } >> > + tcpm_base = of_iomap(tcpm_np, 0); >> > + } >> > + } else >> > + tcpm_base = ioremap(res->start, resource_size(res)); >> > + >> >> Why don't you just add these extra registers to the prcmu node itself like >> >> diff --git a/arch/arm/boot/dts/dbx5x0.dtsi b/arch/arm/boot/dts/dbx5x0.dtsi >> index 9de9309..6ee6c31 100644 >> --- a/arch/arm/boot/dts/dbx5x0.dtsi >> +++ b/arch/arm/boot/dts/dbx5x0.dtsi >> @@ -191,8 +191,8 @@ >> >> prcmu: prcmu at 80157000 { >> compatible = "stericsson,db8500-prcmu"; >> - reg = <0x80157000 0x1000>; >> - reg-names = "prcmu"; >> + reg = <0x80157000 0x1000>, <0x801b0000 0x1000>, <0x801b8000 0x1000>; >> + reg-names = "prcmu", "prcmu-tcpm", "prcmu-tcdm-per4"; >> interrupts = <0 47 0x4>; >> #address-cells = <1>; >> #size-cells = <1>; >> >> >> and document those in the prcmu binding? >> >> That would keep the code simpler and the same for both cases. > > I'm not sure you can. These addresses differ from platform to > platform, so I'd need to provide the base PRCMU address in > dbx5x0.dtsi, then the other two in the dts files. Can you do that? Better ask on devicetree-discuss. What it reflects are differences between SoC:s, so I think the right solution is to split it in a three-layer cake: dbx5x0.dtsi -> included by db8500.dtsi -> included by snowball/hrefv60plus.dts dbx5x0.dtsi -> included by dbx540.dtsi -> included by ccu9540/ccu8540.dts Here you may insert the reg property into the node at the db8500.dtsi or dbx540.dtsi layer. If you prefer I can cook a patch... Yours, Linus Walleij ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 2/3] mfd: db8500-prcmu: Fetch the PRCMU TCDM base address from Device Tree 2013-03-25 21:32 ` Linus Walleij @ 2013-03-26 8:17 ` Lee Jones 2013-03-26 9:11 ` Linus Walleij 0 siblings, 1 reply; 13+ messages in thread From: Lee Jones @ 2013-03-26 8:17 UTC (permalink / raw) To: linux-arm-kernel On Mon, 25 Mar 2013, Linus Walleij wrote: > On Mon, Mar 25, 2013 at 5:46 PM, Lee Jones <lee.jones@linaro.org> wrote: > > >> > res = platform_get_resource_byname(pdev, IORESOURCE_MEM, > >> > "prcmu-tcpm"); > >> > if (!res) { > >> > - dev_err(&pdev->dev, > >> > - "Error: no prcmu tcpm memory region provided\n"); > >> > - return; > >> > - } > >> > - tcpm_base = ioremap(res->start, resource_size(res)); > >> > + if (np) { > >> > + tcpm_np = of_find_node_by_name(np->parent, > >> > + "prcmu-tcpm-per4"); > >> > + if (!tcpm_np) { > >> > + dev_err(&pdev->dev, > >> > + "no prcmu tcpm mem region provided\n"); > >> > + return; > >> > + } > >> > + tcpm_base = of_iomap(tcpm_np, 0); > >> > + } > >> > + } else > >> > + tcpm_base = ioremap(res->start, resource_size(res)); > >> > + > >> > >> Why don't you just add these extra registers to the prcmu node itself like > >> > >> diff --git a/arch/arm/boot/dts/dbx5x0.dtsi b/arch/arm/boot/dts/dbx5x0.dtsi > >> index 9de9309..6ee6c31 100644 > >> --- a/arch/arm/boot/dts/dbx5x0.dtsi > >> +++ b/arch/arm/boot/dts/dbx5x0.dtsi > >> @@ -191,8 +191,8 @@ > >> > >> prcmu: prcmu at 80157000 { > >> compatible = "stericsson,db8500-prcmu"; > >> - reg = <0x80157000 0x1000>; > >> - reg-names = "prcmu"; > >> + reg = <0x80157000 0x1000>, <0x801b0000 0x1000>, <0x801b8000 0x1000>; > >> + reg-names = "prcmu", "prcmu-tcpm", "prcmu-tcdm-per4"; > >> interrupts = <0 47 0x4>; > >> #address-cells = <1>; > >> #size-cells = <1>; > >> > >> > >> and document those in the prcmu binding? > >> > >> That would keep the code simpler and the same for both cases. > > > > I'm not sure you can. These addresses differ from platform to > > platform, so I'd need to provide the base PRCMU address in > > dbx5x0.dtsi, then the other two in the dts files. Can you do that? > > Better ask on devicetree-discuss. > > What it reflects are differences between SoC:s, so I think the > right solution is to split it in a three-layer cake: > > dbx5x0.dtsi -> included by > db8500.dtsi -> included by > snowball/hrefv60plus.dts > > dbx5x0.dtsi -> included by > dbx540.dtsi -> included by > ccu9540/ccu8540.dts > > Here you may insert the reg property into the node at the > db8500.dtsi or dbx540.dtsi layer. It's easy done, if that's the right way. > If you prefer I can cook a patch... ... and I'm fine to do it. [5 mins later] Hmm... it appears that in STE's kernel, the same address is used for all SoCs: #define U8500_PRCMU_TCDM_BASE (U8500_PER4_BASE + 0x68000) However, in Mainline there is another definition: #define U9540_PRCMU_TCDM_BASE (U8500_PER4_BASE + 0x6A000) ... which doesn't seem to be in use anywhere - even for the u9540. What's the deal big-man? -- Lee Jones Linaro ST-Ericsson Landing Team Lead Linaro.org ? Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 2/3] mfd: db8500-prcmu: Fetch the PRCMU TCDM base address from Device Tree 2013-03-26 8:17 ` Lee Jones @ 2013-03-26 9:11 ` Linus Walleij 2013-03-26 9:48 ` Lee Jones 0 siblings, 1 reply; 13+ messages in thread From: Linus Walleij @ 2013-03-26 9:11 UTC (permalink / raw) To: linux-arm-kernel On Tue, Mar 26, 2013 at 9:17 AM, Lee Jones <lee.jones@linaro.org> wrote: > On Mon, 25 Mar 2013, Linus Walleij wrote: >> On Mon, Mar 25, 2013 at 5:46 PM, Lee Jones <lee.jones@linaro.org> wrote: >> >> >> > res = platform_get_resource_byname(pdev, IORESOURCE_MEM, >> >> > "prcmu-tcpm"); >> >> > if (!res) { >> >> > - dev_err(&pdev->dev, >> >> > - "Error: no prcmu tcpm memory region provided\n"); >> >> > - return; >> >> > - } >> >> > - tcpm_base = ioremap(res->start, resource_size(res)); >> >> > + if (np) { >> >> > + tcpm_np = of_find_node_by_name(np->parent, >> >> > + "prcmu-tcpm-per4"); >> >> > + if (!tcpm_np) { >> >> > + dev_err(&pdev->dev, >> >> > + "no prcmu tcpm mem region provided\n"); >> >> > + return; >> >> > + } >> >> > + tcpm_base = of_iomap(tcpm_np, 0); >> >> > + } >> >> > + } else >> >> > + tcpm_base = ioremap(res->start, resource_size(res)); >> >> > + >> >> >> >> Why don't you just add these extra registers to the prcmu node itself like >> >> >> >> diff --git a/arch/arm/boot/dts/dbx5x0.dtsi b/arch/arm/boot/dts/dbx5x0.dtsi >> >> index 9de9309..6ee6c31 100644 >> >> --- a/arch/arm/boot/dts/dbx5x0.dtsi >> >> +++ b/arch/arm/boot/dts/dbx5x0.dtsi >> >> @@ -191,8 +191,8 @@ >> >> >> >> prcmu: prcmu at 80157000 { >> >> compatible = "stericsson,db8500-prcmu"; >> >> - reg = <0x80157000 0x1000>; >> >> - reg-names = "prcmu"; >> >> + reg = <0x80157000 0x1000>, <0x801b0000 0x1000>, <0x801b8000 0x1000>; >> >> + reg-names = "prcmu", "prcmu-tcpm", "prcmu-tcdm-per4"; >> >> interrupts = <0 47 0x4>; >> >> #address-cells = <1>; >> >> #size-cells = <1>; >> >> >> >> >> >> and document those in the prcmu binding? >> >> >> >> That would keep the code simpler and the same for both cases. >> > >> > I'm not sure you can. These addresses differ from platform to >> > platform, so I'd need to provide the base PRCMU address in >> > dbx5x0.dtsi, then the other two in the dts files. Can you do that? >> >> Better ask on devicetree-discuss. >> >> What it reflects are differences between SoC:s, so I think the >> right solution is to split it in a three-layer cake: >> >> dbx5x0.dtsi -> included by >> db8500.dtsi -> included by >> snowball/hrefv60plus.dts >> >> dbx5x0.dtsi -> included by >> dbx540.dtsi -> included by >> ccu9540/ccu8540.dts >> >> Here you may insert the reg property into the node at the >> db8500.dtsi or dbx540.dtsi layer. > > It's easy done, if that's the right way. > >> If you prefer I can cook a patch... > > ... and I'm fine to do it. > > [5 mins later] > > Hmm... it appears that in STE's kernel, the same address is used for > all SoCs: > > #define U8500_PRCMU_TCDM_BASE (U8500_PER4_BASE + 0x68000) Yes that's correct... > However, in Mainline there is another definition: > > #define U9540_PRCMU_TCDM_BASE (U8500_PER4_BASE + 0x6A000) > > ... which doesn't seem to be in use anywhere - even for the u9540. > > What's the deal big-man? Probably there was another address at some point in some FPGA or early silicon and it now needs fixing. So you should be able to use the same thing on all ASICs, put one single value in the dbx5x0.dtsi *and* fix this bug at the same time, good! Yours, Linus Walleij ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 2/3] mfd: db8500-prcmu: Fetch the PRCMU TCDM base address from Device Tree 2013-03-26 9:11 ` Linus Walleij @ 2013-03-26 9:48 ` Lee Jones 2013-03-26 10:00 ` Arnd Bergmann 0 siblings, 1 reply; 13+ messages in thread From: Lee Jones @ 2013-03-26 9:48 UTC (permalink / raw) To: linux-arm-kernel On Tue, 26 Mar 2013, Linus Walleij wrote: > On Tue, Mar 26, 2013 at 9:17 AM, Lee Jones <lee.jones@linaro.org> wrote: > > On Mon, 25 Mar 2013, Linus Walleij wrote: > >> On Mon, Mar 25, 2013 at 5:46 PM, Lee Jones <lee.jones@linaro.org> wrote: > >> > >> >> > res = platform_get_resource_byname(pdev, IORESOURCE_MEM, > >> >> > "prcmu-tcpm"); > >> >> > if (!res) { > >> >> > - dev_err(&pdev->dev, > >> >> > - "Error: no prcmu tcpm memory region provided\n"); > >> >> > - return; > >> >> > - } > >> >> > - tcpm_base = ioremap(res->start, resource_size(res)); > >> >> > + if (np) { > >> >> > + tcpm_np = of_find_node_by_name(np->parent, > >> >> > + "prcmu-tcpm-per4"); > >> >> > + if (!tcpm_np) { > >> >> > + dev_err(&pdev->dev, > >> >> > + "no prcmu tcpm mem region provided\n"); > >> >> > + return; > >> >> > + } > >> >> > + tcpm_base = of_iomap(tcpm_np, 0); > >> >> > + } > >> >> > + } else > >> >> > + tcpm_base = ioremap(res->start, resource_size(res)); > >> >> > + > >> >> > >> >> Why don't you just add these extra registers to the prcmu node itself like > >> >> > >> >> diff --git a/arch/arm/boot/dts/dbx5x0.dtsi b/arch/arm/boot/dts/dbx5x0.dtsi > >> >> index 9de9309..6ee6c31 100644 > >> >> --- a/arch/arm/boot/dts/dbx5x0.dtsi > >> >> +++ b/arch/arm/boot/dts/dbx5x0.dtsi > >> >> @@ -191,8 +191,8 @@ > >> >> > >> >> prcmu: prcmu at 80157000 { > >> >> compatible = "stericsson,db8500-prcmu"; > >> >> - reg = <0x80157000 0x1000>; > >> >> - reg-names = "prcmu"; > >> >> + reg = <0x80157000 0x1000>, <0x801b0000 0x1000>, <0x801b8000 0x1000>; > >> >> + reg-names = "prcmu", "prcmu-tcpm", "prcmu-tcdm-per4"; > >> >> interrupts = <0 47 0x4>; > >> >> #address-cells = <1>; > >> >> #size-cells = <1>; > >> >> > >> >> > >> >> and document those in the prcmu binding? > >> >> > >> >> That would keep the code simpler and the same for both cases. > >> > > >> > I'm not sure you can. These addresses differ from platform to > >> > platform, so I'd need to provide the base PRCMU address in > >> > dbx5x0.dtsi, then the other two in the dts files. Can you do that? > >> > >> Better ask on devicetree-discuss. > >> > >> What it reflects are differences between SoC:s, so I think the > >> right solution is to split it in a three-layer cake: > >> > >> dbx5x0.dtsi -> included by > >> db8500.dtsi -> included by > >> snowball/hrefv60plus.dts > >> > >> dbx5x0.dtsi -> included by > >> dbx540.dtsi -> included by > >> ccu9540/ccu8540.dts > >> > >> Here you may insert the reg property into the node at the > >> db8500.dtsi or dbx540.dtsi layer. > > > > It's easy done, if that's the right way. > > > >> If you prefer I can cook a patch... > > > > ... and I'm fine to do it. > > > > [5 mins later] > > > > Hmm... it appears that in STE's kernel, the same address is used for > > all SoCs: > > > > #define U8500_PRCMU_TCDM_BASE (U8500_PER4_BASE + 0x68000) > > Yes that's correct... > > > However, in Mainline there is another definition: > > > > #define U9540_PRCMU_TCDM_BASE (U8500_PER4_BASE + 0x6A000) > > > > ... which doesn't seem to be in use anywhere - even for the u9540. > > > > What's the deal big-man? > > Probably there was another address at some point in some FPGA or > early silicon and it now needs fixing. > > So you should be able to use the same thing on all ASICs, put one > single value in the dbx5x0.dtsi *and* fix this bug at the same time, > good! Bit for information for you. I have confirmed that the address locations are the same for all SoCs are the same. However, the size of the TCDM changes from 4k on the db8500 to 12k on the db8540. Is there a way we can increase the size for the db8540 without creating an entire new DTS file? Seems overkill. -- Lee Jones Linaro ST-Ericsson Landing Team Lead Linaro.org ? Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 2/3] mfd: db8500-prcmu: Fetch the PRCMU TCDM base address from Device Tree 2013-03-26 9:48 ` Lee Jones @ 2013-03-26 10:00 ` Arnd Bergmann 2013-03-26 10:19 ` Lee Jones 0 siblings, 1 reply; 13+ messages in thread From: Arnd Bergmann @ 2013-03-26 10:00 UTC (permalink / raw) To: linux-arm-kernel On Tuesday 26 March 2013, Lee Jones wrote: > Bit for information for you. > > I have confirmed that the address locations are the same for > all SoCs are the same. However, the size of the TCDM changes from 4k > on the db8500 to 12k on the db8540. > > Is there a way we can increase the size for the db8540 without > creating an entire new DTS file? Seems overkill. You can always override a property by setting it again, like soc { prcmu: db8500-prcmu at abcd0000 { reg = <0xabcd0000 0x1000>; }; }; ... &prcmu { reg = <0xabcd0000 0x3000>; } Arnd ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 2/3] mfd: db8500-prcmu: Fetch the PRCMU TCDM base address from Device Tree 2013-03-26 10:00 ` Arnd Bergmann @ 2013-03-26 10:19 ` Lee Jones 0 siblings, 0 replies; 13+ messages in thread From: Lee Jones @ 2013-03-26 10:19 UTC (permalink / raw) To: linux-arm-kernel On Tue, 26 Mar 2013, Arnd Bergmann wrote: > On Tuesday 26 March 2013, Lee Jones wrote: > > Bit for information for you. > > > > I have confirmed that the address locations are the same for > > all SoCs are the same. However, the size of the TCDM changes from 4k > > on the db8500 to 12k on the db8540. > > > > Is there a way we can increase the size for the db8540 without > > creating an entire new DTS file? Seems overkill. > > You can always override a property by setting it again, like > > soc { > prcmu: db8500-prcmu at abcd0000 { > reg = <0xabcd0000 0x1000>; > }; > }; > > ... > > > &prcmu { > reg = <0xabcd0000 0x3000>; > } Perfect, thanks. -- Lee Jones Linaro ST-Ericsson Landing Team Lead Linaro.org ? Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 3/3] mfd: db8500-prcmu: Fetch the PRCMU TCPM base address from Device Tree 2013-03-25 15:02 [PATCH 1/3] ARM: ux500: Add device nodes for TCDM and TCPM memory locations Lee Jones 2013-03-25 15:02 ` [PATCH 2/3] mfd: db8500-prcmu: Fetch the PRCMU TCDM base address from Device Tree Lee Jones @ 2013-03-25 15:02 ` Lee Jones 2013-03-25 15:31 ` Lee Jones 1 sibling, 1 reply; 13+ messages in thread From: Lee Jones @ 2013-03-25 15:02 UTC (permalink / raw) To: linux-arm-kernel A recent move to send the base addresses though the PRCMU platform device resource instead of defines found in <mach/*>, means that dbx500 devices can no longer boot successfully when booting with Device Tree enabled. This patch ensures the addresses are obtained correctly from DT instead. Signed-off-by: Lee Jones <lee.jones@linaro.org> --- drivers/mfd/db8500-prcmu.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/drivers/mfd/db8500-prcmu.c b/drivers/mfd/db8500-prcmu.c index 8602bf8..a998edc 100644 --- a/drivers/mfd/db8500-prcmu.c +++ b/drivers/mfd/db8500-prcmu.c @@ -3159,8 +3159,9 @@ static void db8500_prcmu_update_cpufreq(void) */ static int db8500_prcmu_probe(struct platform_device *pdev) { - struct device_node *np = pdev->dev.of_node; struct prcmu_pdata *pdata = dev_get_platdata(&pdev->dev); + struct device_node *np = pdev->dev.of_node; + struct device_node *tcdm_np; int irq = 0, err = 0, i; struct resource *res; @@ -3169,11 +3170,19 @@ static int db8500_prcmu_probe(struct platform_device *pdev) dbx500_fw_version_init(pdev, pdata->version_offset, np); res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "prcmu-tcdm"); if (!res) { - dev_err(&pdev->dev, "no prcmu tcdm region provided\n"); - return -ENOENT; - } - tcdm_base = devm_ioremap(&pdev->dev, res->start, - resource_size(res)); + if (np) { + tcdm_np = of_find_node_by_name(np->parent, + "prcmu-tcdm-per4"); + if (!tcdm_np) { + dev_err(&pdev->dev, + "no prcmu tcdm region provided\n"); + return -ENOENT; + } + tcdm_base = of_iomap(tcdm_np, 0); + } + } else + tcdm_base = devm_ioremap(&pdev->dev, res->start, + resource_size(res)); /* Clean up the mailbox interrupts after pre-kernel code. */ writel(ALL_MBOX_BITS, PRCM_ARM_IT1_CLR); -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 3/3] mfd: db8500-prcmu: Fetch the PRCMU TCPM base address from Device Tree 2013-03-25 15:02 ` [PATCH 3/3] mfd: db8500-prcmu: Fetch the PRCMU TCPM " Lee Jones @ 2013-03-25 15:31 ` Lee Jones 0 siblings, 0 replies; 13+ messages in thread From: Lee Jones @ 2013-03-25 15:31 UTC (permalink / raw) To: linux-arm-kernel Sorry Sam, looks like I missed you on this one. > A recent move to send the base addresses though the PRCMU platform > device resource instead of defines found in <mach/*>, means that dbx500 > devices can no longer boot successfully when booting with Device Tree > enabled. This patch ensures the addresses are obtained correctly from > DT instead. > > Signed-off-by: Lee Jones <lee.jones@linaro.org> > --- > drivers/mfd/db8500-prcmu.c | 21 +++++++++++++++------ > 1 file changed, 15 insertions(+), 6 deletions(-) > > diff --git a/drivers/mfd/db8500-prcmu.c b/drivers/mfd/db8500-prcmu.c > index 8602bf8..a998edc 100644 > --- a/drivers/mfd/db8500-prcmu.c > +++ b/drivers/mfd/db8500-prcmu.c > @@ -3159,8 +3159,9 @@ static void db8500_prcmu_update_cpufreq(void) > */ > static int db8500_prcmu_probe(struct platform_device *pdev) > { > - struct device_node *np = pdev->dev.of_node; > struct prcmu_pdata *pdata = dev_get_platdata(&pdev->dev); > + struct device_node *np = pdev->dev.of_node; > + struct device_node *tcdm_np; > int irq = 0, err = 0, i; > struct resource *res; > > @@ -3169,11 +3170,19 @@ static int db8500_prcmu_probe(struct platform_device *pdev) > dbx500_fw_version_init(pdev, pdata->version_offset, np); > res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "prcmu-tcdm"); > if (!res) { > - dev_err(&pdev->dev, "no prcmu tcdm region provided\n"); > - return -ENOENT; > - } > - tcdm_base = devm_ioremap(&pdev->dev, res->start, > - resource_size(res)); > + if (np) { > + tcdm_np = of_find_node_by_name(np->parent, > + "prcmu-tcdm-per4"); > + if (!tcdm_np) { > + dev_err(&pdev->dev, > + "no prcmu tcdm region provided\n"); > + return -ENOENT; > + } > + tcdm_base = of_iomap(tcdm_np, 0); > + } > + } else > + tcdm_base = devm_ioremap(&pdev->dev, res->start, > + resource_size(res)); > > /* Clean up the mailbox interrupts after pre-kernel code. */ > writel(ALL_MBOX_BITS, PRCM_ARM_IT1_CLR); -- Lee Jones Linaro ST-Ericsson Landing Team Lead Linaro.org ? Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2013-03-26 10:19 UTC | newest] Thread overview: 13+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-03-25 15:02 [PATCH 1/3] ARM: ux500: Add device nodes for TCDM and TCPM memory locations Lee Jones 2013-03-25 15:02 ` [PATCH 2/3] mfd: db8500-prcmu: Fetch the PRCMU TCDM base address from Device Tree Lee Jones 2013-03-25 15:32 ` Lee Jones 2013-03-25 15:40 ` Arnd Bergmann 2013-03-25 16:46 ` Lee Jones 2013-03-25 21:32 ` Linus Walleij 2013-03-26 8:17 ` Lee Jones 2013-03-26 9:11 ` Linus Walleij 2013-03-26 9:48 ` Lee Jones 2013-03-26 10:00 ` Arnd Bergmann 2013-03-26 10:19 ` Lee Jones 2013-03-25 15:02 ` [PATCH 3/3] mfd: db8500-prcmu: Fetch the PRCMU TCPM " Lee Jones 2013-03-25 15:31 ` Lee Jones
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).