ARM: at91/tc: fix clock source id for tc block > 1
Subsystems (2)
PATCH 1/1 ARM: at91/tc: fix clock source id for tc block > 1
This patch fixes wrong clock request for TC block 2.
The second block was using t0_clk, t1_clk and t2_clk clks instead of t3_clk, t4_clk and t5_clk clks.
--- drivers/misc/atmel_tclib.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-)
drivers/misc/atmel_tclib.c +16 -8
@@ -142,6 +142,8 @@ static int __init tc_probe(struct platform_device *pdev)struct atmel_tc *tc;struct clk *clk;int irq; +char clk_id[7 ]; +int clk_offset;if (!platform_get_resource (pdev,IORESOURCE_MEM ,0 ))return -EINVAL ;
@@ -156,25 +158,31 @@ static int __init tc_probe(struct platform_device *pdev) tc->pdev = pdev; - clk =clk_get (&pdev->dev,"t0_clk" ); -if (IS_ERR (clk)) { -kfree (tc); -return -EINVAL ; - } -/* Now take SoC information if available */ if (pdev->dev.of_node) {const struct of_device_id *match; match =of_match_node (atmel_tcb_dt_ids, pdev->dev.of_node);if (match) tc->tcb_config = match->data; + clk_offset =of_alias_get_id (tc->pdev->dev.of_node,"tcb" ); + }else + clk_offset = pdev->id; + clk_offset *=3 ; + +snprintf (clk_id,sizeof (clk_id),"t%d_clk" , clk_offset++); + clk =clk_get (&pdev->dev, clk_id); +if (IS_ERR (clk)) { +kfree (tc); +return -EINVAL ; } tc->clk[0 ] = clk; - tc->clk[1 ] =clk_get (&pdev->dev,"t1_clk" ); +snprintf (clk_id,sizeof (clk_id),"t%d_clk" , clk_offset++); + tc->clk[1 ] =clk_get (&pdev->dev, clk_id);if (IS_ERR (tc->clk[1 ])) tc->clk[1 ] = clk; - tc->clk[2 ] =clk_get (&pdev->dev,"t2_clk" ); +snprintf (clk_id,sizeof (clk_id),"t%d_clk" , clk_offset++); + tc->clk[2 ] =clk_get (&pdev->dev, clk_id);if (IS_ERR (tc->clk[2 ])) tc->clk[2 ] = clk;
Signature · 1 line
1.7.9.5
Quoted 4 lines · Boris BREZILLON
This patch fixes wrong clock request for TC block 2.
The second block was usingt0_clk,t1_clkandt2_clkclks instead oft3_clk,t4_clkandt5_clkclks.
this is intended as we have 3 clock per device
Best Regards,
J.
Quoted 67 lines
Signed-off-by Boris BREZILLON <[email protected]>--- drivers/misc/atmel_tclib.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-)drivers/misc/atmel_tclib.c +16
-8@@ -142,6 +142,8 @@ static int __init tc_probe(struct platform_device *pdev)struct atmel_tc *tc;struct clk *clk;int irq; +char clk_id[7 ]; +int clk_offset;if (!platform_get_resource (pdev,IORESOURCE_MEM ,0 ))return -EINVAL ;@@ -156,25 +158,31 @@ static int __init tc_probe(struct platform_device *pdev) tc->pdev = pdev; - clk =clk_get (&pdev->dev,"t0_clk" ); -if (IS_ERR (clk)) { -kfree (tc); -return -EINVAL ; - } -/* Now take SoC information if available */ if (pdev->dev.of_node) {const struct of_device_id *match; match =of_match_node (atmel_tcb_dt_ids, pdev->dev.of_node);if (match) tc->tcb_config = match->data; + clk_offset =of_alias_get_id (tc->pdev->dev.of_node,"tcb" ); + }else + clk_offset = pdev->id; + clk_offset *=3 ; + +snprintf (clk_id,sizeof (clk_id),"t%d_clk" , clk_offset++); + clk =clk_get (&pdev->dev, clk_id); +if (IS_ERR (clk)) { +kfree (tc); +return -EINVAL ; } tc->clk[0 ] = clk; - tc->clk[1 ] =clk_get (&pdev->dev,"t1_clk" ); +snprintf (clk_id,sizeof (clk_id),"t%d_clk" , clk_offset++); + tc->clk[1 ] =clk_get (&pdev->dev, clk_id);if (IS_ERR (tc->clk[1 ])) tc->clk[1 ] = clk; - tc->clk[2 ] =clk_get (&pdev->dev,"t2_clk" ); +snprintf (clk_id,sizeof (clk_id),"t%d_clk" , clk_offset++); + tc->clk[2 ] =clk_get (&pdev->dev, clk_id);if (IS_ERR (tc->clk[2 ])) tc->clk[2 ] = clk;Signature · 7 lines
1.7.9.5 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel at lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
On 04/03/2013 06:45 AM, Jean-Christophe PLAGNIOL-VILLARD :
Quoted 6 lines · Boris BREZILLON
Quoted 4 lines
This patch fixes wrong clock request for TC block 2.
The second block was usingt0_clk,t1_clkandt2_clkclks instead oft3_clk,t4_clkandt5_clkclks.this is intended as we have 3 clock per device
True.
Boris, did you hit an issue with former code that your patch is solving? What is the reason for this patch?
Thanks, best regards,
Quoted 67 lines
Quoted 66 lines
Signed-off-by Boris BREZILLON <[email protected]>--- drivers/misc/atmel_tclib.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-)drivers/misc/atmel_tclib.c +16
-8@@ -142,6 +142,8 @@ static int __init tc_probe(struct platform_device *pdev)struct atmel_tc *tc;struct clk *clk;int irq; +char clk_id[7 ]; +int clk_offset;if (!platform_get_resource (pdev,IORESOURCE_MEM ,0 ))return -EINVAL ;@@ -156,25 +158,31 @@ static int __init tc_probe(struct platform_device *pdev) tc->pdev = pdev; - clk =clk_get (&pdev->dev,"t0_clk" ); -if (IS_ERR (clk)) { -kfree (tc); -return -EINVAL ; - } -/* Now take SoC information if available */ if (pdev->dev.of_node) {const struct of_device_id *match; match =of_match_node (atmel_tcb_dt_ids, pdev->dev.of_node);if (match) tc->tcb_config = match->data; + clk_offset =of_alias_get_id (tc->pdev->dev.of_node,"tcb" ); + }else + clk_offset = pdev->id; + clk_offset *=3 ; + +snprintf (clk_id,sizeof (clk_id),"t%d_clk" , clk_offset++); + clk =clk_get (&pdev->dev, clk_id); +if (IS_ERR (clk)) { +kfree (tc); +return -EINVAL ; } tc->clk[0 ] = clk; - tc->clk[1 ] =clk_get (&pdev->dev,"t1_clk" ); +snprintf (clk_id,sizeof (clk_id),"t%d_clk" , clk_offset++); + tc->clk[1 ] =clk_get (&pdev->dev, clk_id);if (IS_ERR (tc->clk[1 ])) tc->clk[1 ] = clk; - tc->clk[2 ] =clk_get (&pdev->dev,"t2_clk" ); +snprintf (clk_id,sizeof (clk_id),"t%d_clk" , clk_offset++); + tc->clk[2 ] =clk_get (&pdev->dev, clk_id);if (IS_ERR (tc->clk[2 ])) tc->clk[2 ] = clk;Signature · 7 lines
1.7.9.5 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel at lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Signature · 1 line
Nicolas Ferre
Quoted 7 lines · Nicolas Ferre
On 04/03/2013 06:45 AM, Jean-Christophe PLAGNIOL-VILLARD :
Quoted 6 lines · Boris BREZILLON
Quoted 4 lines
This patch fixes wrong clock request for TC block 2.
The second block was usingt0_clk,t1_clkandt2_clkclks instead oft3_clk,t4_clkandt5_clkclks.this is intended as we have 3 clock per device
You're right.
Quoted 4 lines
True.
Boris, did you hit an issue with former code that your patch is solving? What is the reason for this patch?
I should have taken a closer look at the code before sending this patch. I mistook clk name for conid devid association.
As I am enabling the tc block 1 clocks in the bootstrap code, I thought this was the reason for these clocks to be enabled after the kernel boot.
But I tried to disable these clocks in the bootstrap and this works fine.
Sorry if I bothered you.
Best Regards,
Boris
Quoted 73 lines
Thanks, best regards,
Quoted 67 lines
Quoted 66 lines
Signed-off-by Boris BREZILLON <[email protected]>--- drivers/misc/atmel_tclib.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-)drivers/misc/atmel_tclib.c +16
-9@@ -142,6 +142,8 @@ static int __init tc_probe(struct platform_device *pdev)struct atmel_tc *tc;struct clk *clk;int irq; +char clk_id[7 ]; +int clk_offset;if (!platform_get_resource (pdev,IORESOURCE_MEM ,0 ))return -EINVAL ;@@ -156,25 +158,31 @@ static int __init tc_probe(struct platform_device *pdev) tc->pdev = pdev; - clk =clk_get (&pdev->dev,"t0_clk" ); -if (IS_ERR (clk)) { -kfree (tc); -return -EINVAL ; - } -/* Now take SoC information if available */ if (pdev->dev.of_node) {const struct of_device_id *match; match =of_match_node (atmel_tcb_dt_ids, pdev->dev.of_node);if (match) tc->tcb_config = match->data; + clk_offset =of_alias_get_id (tc->pdev->dev.of_node,"tcb" ); + }else + clk_offset = pdev->id; + clk_offset *=3 ; + +snprintf (clk_id,sizeof (clk_id),"t%d_clk" , clk_offset++); + clk =clk_get (&pdev->dev, clk_id); +if (IS_ERR (clk)) { +kfree (tc); +return -EINVAL ; } tc->clk[0 ] = clk; - tc->clk[1 ] =clk_get (&pdev->dev,"t1_clk" ); +snprintf (clk_id,sizeof (clk_id),"t%d_clk" , clk_offset++); + tc->clk[1 ] =clk_get (&pdev->dev, clk_id);if (IS_ERR (tc->clk[1 ])) tc->clk[1 ] = clk; - tc->clk[2 ] =clk_get (&pdev->dev,"t2_clk" ); +snprintf (clk_id,sizeof (clk_id),"t%d_clk" , clk_offset++); + tc->clk[2 ] =clk_get (&pdev->dev, clk_id);if (IS_ERR (tc->clk[2 ])) tc->clk[2 ] = clk; --1.7.9.5
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
On 04/03/2013 09:59 AM, Boris BREZILLON :
Quoted 16 lines · Nicolas Ferre
Quoted 7 lines
On 04/03/2013 06:45 AM, Jean-Christophe PLAGNIOL-VILLARD :
Quoted 6 lines · Boris BREZILLON
Quoted 4 lines
This patch fixes wrong clock request for TC block 2.
The second block was usingt0_clk,t1_clkandt2_clkclks instead oft3_clk,t4_clkandt5_clkclks.this is intended as we have 3 clock per device
You're right.
Quoted 4 lines
True.
Boris, did you hit an issue with former code that your patch is solving? What is the reason for this patch?I should have taken a closer look at the code before sending this patch. I mistook clk name for conid devid association.
Quoted 6 lines
As I am enabling the tc block 1 clocks in the bootstrap code, I thought this was the reason for these clocks to be enabled after the kernel boot.
But I tried to disable these clocks in the bootstrap and this works fine.
Sorry if I bothered you.
Not bothered at all Boris! This is exactly how I like to see the community working together.
Please feel free to send more and more patches about AT91: this is always valuable for us.
Best regards,
Quoted 74 lines
Quoted 71 lines
Quoted 69 lines
Quoted 68 lines
Signed-off-by Boris BREZILLON <[email protected]>--- drivers/misc/atmel_tclib.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-)drivers/misc/atmel_tclib.c +2
-0@@ -142,6 +142,8 @@ static int __init tc_probe(struct platform_device *pdev)struct atmel_tc *tc;struct clk *clk;int irq; +char clk_id[7 ]; +int clk_offset;if (!platform_get_resource (pdev,IORESOURCE_MEM ,0 ))return -EINVAL;drivers/misc/atmel_tclib.c +14
-8@@ -156,25 +158,31 @@ static int __init tc_probe(struct platform_device *pdev) tc->pdev = pdev; - clk =clk_get (&pdev->dev,"t0_clk" ); -if (IS_ERR (clk)) { -kfree (tc); -return -EINVAL ; - } -/* Now take SoC information if available */ if (pdev->dev.of_node) {const struct of_device_id *match; match =of_match_node (atmel_tcb_dt_ids, pdev->dev.of_node);if (match) tc->tcb_config = match->data; + clk_offset =of_alias_get_id (tc->pdev->dev.of_node,"tcb" ); + }else + clk_offset = pdev->id; + clk_offset *=3 ; + +snprintf (clk_id,sizeof (clk_id),"t%d_clk" , clk_offset++); + clk =clk_get (&pdev->dev, clk_id); +if (IS_ERR (clk)) { +kfree (tc); +return -EINVAL ; } tc->clk[0 ] = clk; - tc->clk[1 ] =clk_get (&pdev->dev,"t1_clk" ); +snprintf (clk_id,sizeof (clk_id),"t%d_clk" , clk_offset++); + tc->clk[1 ] =clk_get (&pdev->dev, clk_id);if (IS_ERR (tc->clk[1 ])) tc->clk[1 ] = clk; - tc->clk[2 ] =clk_get (&pdev->dev,"t2_clk" ); +snprintf (clk_id,sizeof (clk_id),"t%d_clk" , clk_offset++); + tc->clk[2 ] =clk_get (&pdev->dev, clk_id);if (IS_ERR (tc->clk[2 ])) tc->clk[2 ] = clk;Signature · 8 lines
-- 1.7.9.5 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel at lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Signature · 1 line
Nicolas Ferre