ARM: davinci: da850: Fix pwm name matching
Subsystems (3)
PATCH 1/1 ARM: davinci: da850: Fix pwm name matching
This fixes pwm name matching for DA850 familiy devices. When using device tree, the da850_auxdata_lookup[] table caused pwm devices to have the exact same name, which caused errors when trying to register the devices.
The names for clock matching in da850_clks[] also have to be updated to to exactly match in order for the clock lookup to work correctly.
---
Tested working on LEGO MINDSTORMS EV3.
arch/arm/mach-davinci/da850.c | 10 +++++++--- arch/arm/mach-davinci/da8xx-dt.c | 10 +++++----- 2 files changed, 12 insertions(+), 8 deletions(-)
arch/arm/mach-davinci/da850.c +7 -3
@@ -510,9 +510,13 @@ static struct clk_lookup da850_clks[] = {CLK ("vpif" ,NULL , &vpif_clk),CLK ("ahci_da850" ,NULL , &sata_clk),CLK ("davinci-rproc.0" ,NULL , &dsp_clk), -CLK ("ehrpwm" ,"fck" , &ehrpwm_clk), -CLK ("ehrpwm" ,"tbclk" , &ehrpwm_tbclk), -CLK ("ecap" ,"fck" , &ecap_clk), +CLK ("ehrpwm.0" ,"fck" , &ehrpwm_clk), +CLK ("ehrpwm.0" ,"tbclk" , &ehrpwm_tbclk), +CLK ("ehrpwm.1" ,"fck" , &ehrpwm_clk), +CLK ("ehrpwm.1" ,"tbclk" , &ehrpwm_tbclk), +CLK ("ecap.0" ,"fck" , &ecap_clk), +CLK ("ecap.1" ,"fck" , &ecap_clk), +CLK ("ecap.2" ,"fck" , &ecap_clk), CLK(NULL, NULL, NULL), };
arch/arm/mach-davinci/da8xx-dt.c +5 -5
@@ -23,11 +23,11 @@ static struct of_dev_auxdata da850_auxdata_lookup[] __initdata = {OF_DEV_AUXDATA ("ti,davinci-i2c" ,0x01e28000 ,"i2c_davinci.2" ,NULL ),OF_DEV_AUXDATA ("ti,davinci-wdt" ,0x01c21000 ,"davinci-wdt" ,NULL ),OF_DEV_AUXDATA ("ti,da830-mmc" ,0x01c40000 ,"da830-mmc.0" ,NULL ), -OF_DEV_AUXDATA ("ti,da850-ehrpwm" ,0x01f00000 ,"ehrpwm" ,NULL ), -OF_DEV_AUXDATA ("ti,da850-ehrpwm" ,0x01f02000 ,"ehrpwm" ,NULL ), -OF_DEV_AUXDATA ("ti,da850-ecap" ,0x01f06000 ,"ecap" ,NULL ), -OF_DEV_AUXDATA ("ti,da850-ecap" ,0x01f07000 ,"ecap" ,NULL ), -OF_DEV_AUXDATA ("ti,da850-ecap" ,0x01f08000 ,"ecap" ,NULL ), +OF_DEV_AUXDATA ("ti,da850-ehrpwm" ,0x01f00000 ,"ehrpwm.0" ,NULL ), +OF_DEV_AUXDATA ("ti,da850-ehrpwm" ,0x01f02000 ,"ehrpwm.1" ,NULL ), +OF_DEV_AUXDATA ("ti,da850-ecap" ,0x01f06000 ,"ecap.0" ,NULL ), +OF_DEV_AUXDATA ("ti,da850-ecap" ,0x01f07000 ,"ecap.1" ,NULL ), +OF_DEV_AUXDATA ("ti,da850-ecap" ,0x01f08000 ,"ecap.2" ,NULL ),OF_DEV_AUXDATA ("ti,da830-spi" ,0x01c41000 ,"spi_davinci.0" ,NULL ),OF_DEV_AUXDATA ("ti,da830-spi" ,0x01f0e000 ,"spi_davinci.1" ,NULL ), OF_DEV_AUXDATA("ns16550a", 0x01c42000, "serial8250.0", NULL),
Signature · 1 line
2.7.4
Quoted 8 lines · David Lechner
This fixes pwm name matching for DA850 familiy devices. When using device tree, the da850_auxdata_lookup[] table caused pwm devices to have the exact same name, which caused errors when trying to register the devices.
The names for clock matching in da850_clks[] also have to be updated to to exactly match in order for the clock lookup to work correctly.
Signed-off-by David Lechner <[email protected]>
Applied to "fixes" branch. Will send upstream after testing a bit and also waiting to see if anyone else has any comments.
Thanks,
Sekhar
Hi Sekhar,
Quoted 5 lines · Sekhar Nori
Quoted 4 lines · David Lechner
This fixes pwm name matching for DA850 familiy devices. When using device tree, the da850_auxdata_lookup[] table caused pwm devices to have the exact same name, which caused errors when trying to register the devices.
Quoted 7 lines
Quoted 4 lines
The names for clock matching in da850_clks[] also have to be updated to to exactly match in order for the clock lookup to work correctly.
Signed-off-by David Lechner <[email protected]>Applied to "fixes" branch. Will send upstream after testing a bit and also waiting to see if anyone else has any comments.
I'm not seeing a fixes branch in your tree. Did you push this out? Similarily, I didn't see the updates in v4.10/defconfig either.
Kevin
Quoted 12 lines · Kevin Hilman
Hi Sekhar,
Quoted 8 lines · Sekhar Nori
Quoted 7 lines · David Lechner
This fixes pwm name matching for DA850 familiy devices. When using device tree, the da850_auxdata_lookup[] table caused pwm devices to have the exact same name, which caused errors when trying to register the devices.
The names for clock matching in da850_clks[] also have to be updated to to exactly match in order for the clock lookup to work correctly.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Signed-off-by David Lechner <[email protected]>Applied to "fixes" branch. Will send upstream after testing a bit and also waiting to see if anyone else has any comments.
I'm not seeing a fixes branch in your tree. Did you push this out? Similarily, I didn't see the updates in v4.10/defconfig either.
Pushed now. Will push a merged master branch tomorrow after some testing.
Thanks,
Sekhar
Quoted 25 lines · David Lechner
This fixes pwm name matching for DA850 familiy devices. When using device tree, the da850_auxdata_lookup[] table caused pwm devices to have the exact same name, which caused errors when trying to register the devices.
The names for clock matching in da850_clks[] also have to be updated to to exactly match in order for the clock lookup to work correctly.
Signed-off-by David Lechner <[email protected]>---
Tested working on LEGO MINDSTORMS EV3.
arch/arm/mach-davinci/da850.c | 10 +++++++--- arch/arm/mach-davinci/da8xx-dt.c | 10 +++++----- 2 files changed, 12 insertions(+), 8 deletions(-)arch/arm/mach-davinci/da850.c +0
-0@@ -510,9 +510,13 @@ static struct clk_lookup da850_clks[] = {CLK ("vpif" ,NULL , &vpif_clk),CLK ("ahci_da850" ,NULL , &sata_clk), CLK("davinci-rproc.0", NULL, &dsp_clk),
arch/arm/mach-davinci/da850.c static struct clk_lookup da850_clks[] = { · line 519
Quoted 10 lines
arch/arm/mach-davinci/da850.c +7
-3-CLK ("ehrpwm" ,"fck" , &ehrpwm_clk), -CLK ("ehrpwm" ,"tbclk" , &ehrpwm_tbclk), - CLK("ecap", "fck", &ecap_clk), +CLK ("ehrpwm.0" ,"fck" , &ehrpwm_clk), +CLK ("ehrpwm.0" ,"tbclk" , &ehrpwm_tbclk), +CLK ("ehrpwm.1" ,"fck" , &ehrpwm_clk), +CLK ("ehrpwm.1" ,"tbclk" , &ehrpwm_tbclk), +CLK ("ecap.0" ,"fck" , &ecap_clk), +CLK ("ecap.1" ,"fck" , &ecap_clk), + CLK("ecap.2", "fck", &ecap_clk),
This has exposed a limitation of DaVinci clock framework. The struct clk are stored as a linked list themselves. So a node repeating in the table above will create a loop in the linked list. This is easily seen on the LCDK board. davinci_clk_disable_unused() never returns. PWMs are unused on that board.
There is no "simple" solution to this AFAICS. One solution is to separate the iterator from the clock hardware structure and use struct clk_hw available in struct clk_lookup.
Or move DaVinci to common clock framework. This is of course preferred but much more involved as all 6 supported SoCs have to be moved together.
Thanks,
Sekhar
Quoted 47 lines · Sekhar Nori
Quoted 25 lines · David Lechner
This fixes pwm name matching for DA850 familiy devices. When using device tree, the da850_auxdata_lookup[] table caused pwm devices to have the exact same name, which caused errors when trying to register the devices.
The names for clock matching in da850_clks[] also have to be updated to to exactly match in order for the clock lookup to work correctly.
Signed-off-by David Lechner <[email protected]>---
Tested working on LEGO MINDSTORMS EV3.
arch/arm/mach-davinci/da850.c | 10 +++++++--- arch/arm/mach-davinci/da8xx-dt.c | 10 +++++----- 2 files changed, 12 insertions(+), 8 deletions(-)arch/arm/mach-davinci/da850.c +0
-0@@ -510,9 +510,13 @@ static struct clk_lookup da850_clks[] = {CLK ("vpif" ,NULL , &vpif_clk),CLK ("ahci_da850" ,NULL , &sata_clk), CLK("davinci-rproc.0", NULL, &dsp_clk),arch/arm/mach-davinci/da850.c static struct clk_lookup da850_clks[] = { · line 519
Quoted 10 lines
arch/arm/mach-davinci/da850.c +7
-3-CLK ("ehrpwm" ,"fck" , &ehrpwm_clk), -CLK ("ehrpwm" ,"tbclk" , &ehrpwm_tbclk), - CLK("ecap", "fck", &ecap_clk), +CLK ("ehrpwm.0" ,"fck" , &ehrpwm_clk), +CLK ("ehrpwm.0" ,"tbclk" , &ehrpwm_tbclk), +CLK ("ehrpwm.1" ,"fck" , &ehrpwm_clk), +CLK ("ehrpwm.1" ,"tbclk" , &ehrpwm_tbclk), +CLK ("ecap.0" ,"fck" , &ecap_clk), +CLK ("ecap.1" ,"fck" , &ecap_clk), + CLK("ecap.2", "fck", &ecap_clk),This has exposed a limitation of DaVinci clock framework. The struct clk are stored as a linked list themselves. So a node repeating in the table above will create a loop in the linked list. This is easily seen on the LCDK board.
davinci_clk_disable_unused()never returns. PWMs are unused on that board.There is no "simple" solution to this AFAICS. One solution is to separate the iterator from the clock hardware structure and use struct
clk_hwavailable in structclk_lookup.
Quoted 7 lines
Or move DaVinci to common clock framework. This is of course preferred but much more involved as all 6 supported SoCs have to be moved together.
Thanks,
Sekhar
The simple solution for now could be to make child clocks for each of these that simply enable the parent clock. e.g. ehrpwm0_clk and ehpwm1_clk are children of ehrpwm_clk, etc.
Looking at da830.c, it looks like the solution was to make multiple clocks that use the same LPSC, but this does not seem right to me.
Quoted 54 lines · David Lechner
Quoted 53 lines · Sekhar Nori
Quoted 28 lines · David Lechner
This fixes pwm name matching for DA850 familiy devices. When using device
tree, the da850_auxdata_lookup[] table caused pwm devices to have the exact
same name, which caused errors when trying to register the devices.The names for clock matching in da850_clks[] also have to be updated to to exactly match in order for the clock lookup to work correctly.
Signed-off-by David Lechner <[email protected]>---
Tested working on LEGO MINDSTORMS EV3.
arch/arm/mach-davinci/da850.c | 10 +++++++--- arch/arm/mach-davinci/da8xx-dt.c | 10 +++++----- 2 files changed, 12 insertions(+), 8 deletions(-)arch/arm/mach-davinci/da850.c +0
-0@@ -510,9 +510,13 @@ static struct clk_lookup da850_clks[] = {CLK ("vpif" ,NULL , &vpif_clk),CLK ("ahci_da850" ,NULL , &sata_clk), CLK("davinci-rproc.0", NULL, &dsp_clk),arch/arm/mach-davinci/da850.c static struct clk_lookup da850_clks[] = { · line 519
Quoted 10 lines
arch/arm/mach-davinci/da850.c +7
-3-CLK ("ehrpwm" ,"fck" , &ehrpwm_clk), -CLK ("ehrpwm" ,"tbclk" , &ehrpwm_tbclk), - CLK("ecap", "fck", &ecap_clk), +CLK ("ehrpwm.0" ,"fck" , &ehrpwm_clk), +CLK ("ehrpwm.0" ,"tbclk" , &ehrpwm_tbclk), +CLK ("ehrpwm.1" ,"fck" , &ehrpwm_clk), +CLK ("ehrpwm.1" ,"tbclk" , &ehrpwm_tbclk), +CLK ("ecap.0" ,"fck" , &ecap_clk), +CLK ("ecap.1" ,"fck" , &ecap_clk), + CLK("ecap.2", "fck", &ecap_clk),This has exposed a limitation of DaVinci clock framework. The struct clk are stored as a linked list themselves. So a node repeating in the table above will create a loop in the linked list. This is easily seen on the LCDK board.
davinci_clk_disable_unused()never returns. PWMs are unused on that board.There is no "simple" solution to this AFAICS. One solution is to separate the iterator from the clock hardware structure and use struct
clk_hwavailable in structclk_lookup.Or move DaVinci to common clock framework. This is of course preferred but much more involved as all 6 supported SoCs have to be moved together.
Quoted 8 lines
Quoted 4 lines
Thanks,
SekharThe simple solution for now could be to make child clocks for each of these that simply enable the parent clock. e.g.
ehrpwm0_clkandehpwm1_clkare children ofehrpwm_clk, etc.
That sounds good. I saw the v2 patch you sent and it looks good. I noticed that aemif clock is repeated in da850.c too. That needs fixing.
Quoted 2 lines
Looking at
da830.c, it looks like the solution was to make multiple clocks that use the same LPSC, but this does not seem right to me.
The PWM clock definitions there are definitely wrong. It should be fixed. Looks like its been like that forever.
Thanks,
Sekhar
Quoted 60 lines · Sekhar Nori
Quoted 59 lines · David Lechner
Quoted 57 lines · Sekhar Nori
Quoted 28 lines · David Lechner
This fixes pwm name matching for DA850 familiy devices. When using device
tree, the da850_auxdata_lookup[] table caused pwm devices to have the exact
same name, which caused errors when trying to register the devices.The names for clock matching in da850_clks[] also have to be updated to to exactly match in order for the clock lookup to work correctly.
Signed-off-by David Lechner <[email protected]>---
Tested working on LEGO MINDSTORMS EV3.
arch/arm/mach-davinci/da850.c | 10 +++++++--- arch/arm/mach-davinci/da8xx-dt.c | 10 +++++----- 2 files changed, 12 insertions(+), 8 deletions(-)arch/arm/mach-davinci/da850.c +0
-0@@ -510,9 +510,13 @@ static struct clk_lookup da850_clks[] = {CLK ("vpif" ,NULL , &vpif_clk),CLK ("ahci_da850" ,NULL , &sata_clk), CLK("davinci-rproc.0", NULL, &dsp_clk),arch/arm/mach-davinci/da850.c static struct clk_lookup da850_clks[] = { · line 519
Quoted 10 lines
arch/arm/mach-davinci/da850.c +7
-3-CLK ("ehrpwm" ,"fck" , &ehrpwm_clk), -CLK ("ehrpwm" ,"tbclk" , &ehrpwm_tbclk), - CLK("ecap", "fck", &ecap_clk), +CLK ("ehrpwm.0" ,"fck" , &ehrpwm_clk), +CLK ("ehrpwm.0" ,"tbclk" , &ehrpwm_tbclk), +CLK ("ehrpwm.1" ,"fck" , &ehrpwm_clk), +CLK ("ehrpwm.1" ,"tbclk" , &ehrpwm_tbclk), +CLK ("ecap.0" ,"fck" , &ecap_clk), +CLK ("ecap.1" ,"fck" , &ecap_clk), + CLK("ecap.2", "fck", &ecap_clk),This has exposed a limitation of DaVinci clock framework. The struct clk are stored as a linked list themselves. So a node repeating in the table above will create a loop in the linked list. This is easily seen on the LCDK board.
davinci_clk_disable_unused()never returns. PWMs are unused on that board.There is no "simple" solution to this AFAICS. One solution is to separate the iterator from the clock hardware structure and use struct
clk_hwavailable in structclk_lookup.Or move DaVinci to common clock framework. This is of course preferred but much more involved as all 6 supported SoCs have to be moved together.
Thanks,
Sekhar
Quoted 6 lines
Quoted 3 lines
The simple solution for now could be to make child clocks for each of these that simply enable the parent clock. e.g.
ehrpwm0_clkandehpwm1_clkare children ofehrpwm_clk, etc.That sounds good. I saw the v2 patch you sent and it looks good. I noticed that aemif clock is repeated in
da850.ctoo. That needs fixing.
Same with emac clock.
Quoted 9 lines
Quoted 2 lines
Looking at
da830.c, it looks like the solution was to make multiple clocks that use the same LPSC, but this does not seem right to me.The PWM clock definitions there are definitely wrong. It should be fixed. Looks like its been like that forever.
Thanks,
Sekhar