dmtimer fclk regression in 4.16?
I think I've run across a regression in 4.16 that resulted from the TI clock infrastructure changes. A bisect pointed to [1] as the first breaking commit.
Our use-case is a pwm-dmtimer-omap using timer7, with timer7_fck parented by clkdiv32k_ick (aka timer_32k_ck aka l4_per_cm:clk:0138:0). Starting with 4.16 that parenting fails in omap_dm_timer_set_source(), called from pwm_omap_dmtimer_probe, at this check:
if (clk_hw_get_num_parents(__clk_get_hw(timer->fclk)) < 2) return 0;
because timer->fclk is "l4_per_cm:clk:0068:0", whose only possible parent is "timer7_fck".
It seemed to me that timer->fclk should instead be "timer7_fck" (which has the desired set of possible parents). I tried following the lead set in [2] and added "clocks" and "clock-names" properties on timer7. However, that resulted in omap_dm_timer_of_set_source(), called by omap_dm_timer_prepare(), failing when it tries to parent "timer7_fck" to itself.
The following change in omap_dm_timer_prepare() does seem to work:
- timer->fclk = clk_get(&timer->pdev->dev, "fck");
+ timer->fclk = clk_get_parent(clk_get(&timer->pdev->dev, "fck"));
but I'm very uncertain whether that's the right path.
Should omap_dm_timer know that the clock returned is actually a child of the clock it's interested in? Or should clk_get(<timerN>,"fck") be returning the timerN_fck in the first place? Or is the problem something else entirely?
As I'm not sure how these pieces are all intended to fit together, any pointers would be appreciated.
Thanks,
David Rivshin
[1] df54bfc5502a ("clk: ti: am33xx: add clkctrl clock data")
https://www.spinics.net/lists/linux-omap/msg139798.html
[2] 521f9e5e3f87 ("ARM: dts: am33xx: add fck under timers1/2")
https://www.spinics.net/lists/linux-omap/msg140605.html
Quoted 19 lines · David Rivshin
I think I've run across a regression in 4.16 that resulted from the TI clock infrastructure changes. A bisect pointed to [1] as the first breaking commit.
Our use-case is a pwm-dmtimer-omap using timer7, with
timer7_fckparented byclkdiv32k_ick(akatimer_32k_ckaka l4_per_cm:clk:0138:0). Starting with 4.16 that parenting fails inomap_dm_timer_set_source(), called frompwm_omap_dmtimer_probe, at this check:if (clk_hw_get_num_parents(__clk_get_hw(timer->fclk)) < 2) return 0;because
timer->fclkis "l4_per_cm:clk:0068:0", whose only possible parent is "timer7_fck".It seemed to me that
timer->fclkshould instead be "timer7_fck" (which has the desired set of possible parents). I tried following the lead set in [2] and added "clocks" and "clock-names" properties on timer7. However, that resulted inomap_dm_timer_of_set_source(), called byomap_dm_timer_prepare(), failing when it tries to parent "timer7_fck" to itself.The following change in
omap_dm_timer_prepare()does seem to work:
Review
Quoted 2 lines
(quoted diff) +1
-1- timer->fclk = clk_get(&timer->pdev->dev, "fck"); + timer->fclk = clk_get_parent(clk_get(&timer->pdev->dev, "fck"));
It seems omap_dm_timer_of_set_source() is actually completely broken and isn't doing anything useful. Neil, what was this function supposed to be doing, seeing you invented the initial patch for that (commit 31a7448f4fa8a528040e3df593e9781f55218183)?
-Tero
Quoted 8 lines
but I'm very uncertain whether that's the right path.
Shouldomap_dm_timerknow that the clock returned is actually a child of the clock it's interested in? Or shouldclk_get(<timerN>,"fck")be returning thetimerN_fckin the first place? Or is the problem something else entirely?As I'm not sure how these pieces are all intended to fit together, any pointers would be appreciated.
Quoted 8 lines
Thanks,
David Rivshin[1]
df54bfc5502a("clk: ti: am33xx: add clkctrl clock data")
https://www.spinics.net/lists/linux-omap/msg139798.html
[2]521f9e5e3f87("ARM: dts: am33xx: add fck under timers1/2")
https://www.spinics.net/lists/linux-omap/msg140605.html
--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
Hi,
Quoted 19 lines · Tero Kristo
Quoted 18 lines · David Rivshin
I think I've run across a regression in 4.16 that resulted from the TI clock infrastructure changes. A bisect pointed to [1] as the first breaking commit.
Our use-case is a pwm-dmtimer-omap using timer7, with
timer7_fckparented byclkdiv32k_ick(akatimer_32k_ckaka l4_per_cm:clk:0138:0). Starting with 4.16 that parenting fails inomap_dm_timer_set_source(), called frompwm_omap_dmtimer_probe, at this check:
if (clk_hw_get_num_parents(__clk_get_hw(timer->fclk)) < 2) return 0;
becausetimer->fclkis "l4_per_cm:clk:0068:0", whose only possible parent is "timer7_fck".It seemed to me that
timer->fclkshould instead be "timer7_fck" (which has the desired set of possible parents). I tried following the lead set in [2] and added "clocks" and "clock-names" properties on timer7. However, that resulted inomap_dm_timer_of_set_source(), called byomap_dm_timer_prepare(), failing when it tries to parent "timer7_fck" to itself.
Quoted 5 lines
Quoted 3 lines
The following change in
omap_dm_timer_prepare()does seem to work:
-timer->fclk=clk_get(&timer->pdev->dev, "fck");
+timer->fclk=clk_get_parent(clk_get(&timer->pdev->dev, "fck"));It seems
omap_dm_timer_of_set_source()is actually completely broken and isn't doing anything useful. Neil, what was this function supposed to be doing, seeing you invented the initial patch for that (commit31a7448f4fa8a528040e3df593e9781f55218183)?
The original change was supposed to set the timer source clock by using the clock defined in the DT, but it was made to work when the code was in arch/arm and the fck was not found from DT.
The omap_dm_timer_of_set_source() should be changed to get a specified clock name like "src":
parent = clk_get(&timer->pdev->dev, "src");
if (IS_ERR(parent))
return -ENODEV;
And the fck clock should be added to all timer nodes.
For example ed839c3664cb308144fe70a3a95813ab59a03dfb or 521f9e5e3f871cdac3ecd2a583d14d0472278053 only adds fck to timer1/2, the 7 timers should have the fck clock.
@David: chan you test the omap_dm_timer_of_set_source() change and in DT update the timer7 node with :
clocks = <&timer7_fck>, <&clkdiv32k_ck>;
clock-names = "fck", "src";
Thanks,
Neil
Quoted 22 lines
-Tero
Quoted 16 lines
but I'm very uncertain whether that's the right path.
Shouldomap_dm_timerknow that the clock returned is actually a child of the clock it's interested in? Or shouldclk_get(<timerN>,"fck")be returning thetimerN_fckin the first place? Or is the problem something else entirely?As I'm not sure how these pieces are all intended to fit together, any pointers would be appreciated.
Thanks,
David Rivshin[1]
df54bfc5502a("clk: ti: am33xx: add clkctrl clock data")
https://www.spinics.net/lists/linux-omap/msg139798.html
[2]521f9e5e3f87("ARM: dts: am33xx: add fck under timers1/2")
https://www.spinics.net/lists/linux-omap/msg140605.htmlSignature · 1 line
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
Quoted 37 lines · On Wed, 20 Jun 2018 09:11:19 +0200 Neil Armstrong <[email protected]>…
Hi,
Quoted 19 lines · Tero Kristo
Quoted 18 lines · David Rivshin
I think I've run across a regression in 4.16 that resulted from the TI clock infrastructure changes. A bisect pointed to [1] as the first breaking commit.
Our use-case is a pwm-dmtimer-omap using timer7, with
timer7_fckparented byclkdiv32k_ick(akatimer_32k_ckaka l4_per_cm:clk:0138:0). Starting with 4.16 that parenting fails inomap_dm_timer_set_source(), called frompwm_omap_dmtimer_probe, at this check:
if (clk_hw_get_num_parents(__clk_get_hw(timer->fclk)) < 2) return 0;
becausetimer->fclkis "l4_per_cm:clk:0068:0", whose only possible parent is "timer7_fck".It seemed to me that
timer->fclkshould instead be "timer7_fck" (which has the desired set of possible parents). I tried following the lead set in [2] and added "clocks" and "clock-names" properties on timer7. However, that resulted inomap_dm_timer_of_set_source(), called byomap_dm_timer_prepare(), failing when it tries to parent "timer7_fck" to itself.Quoted 5 lines
Quoted 3 lines
The following change in
omap_dm_timer_prepare()does seem to work:
-timer->fclk=clk_get(&timer->pdev->dev, "fck");
+timer->fclk=clk_get_parent(clk_get(&timer->pdev->dev, "fck"));It seems
omap_dm_timer_of_set_source()is actually completely broken and isn't doing anything useful. Neil, what was this function supposed to be doing, seeing you invented the initial patch for that (commit31a7448f4fa8a528040e3df593e9781f55218183)?The original change was supposed to set the timer source clock by using the clock defined in the DT, but it was made to work when the code was in
arch/armand the fck was not found from DT.The
omap_dm_timer_of_set_source()should be changed to get a specified clock name like "src":
parent =clk_get(&timer->pdev->dev, "src");
if (IS_ERR(parent))return -ENODEV;
Quoted 7 lines
And the fck clock should be added to all timer nodes.
For example
ed839c3664cb308144fe70a3a95813ab59a03dfbor521f9e5e3f871cdac3ecd2a583d14d0472278053only adds fck to timer1/2, the 7 timers should have the fck clock.@David: chan you test the
omap_dm_timer_of_set_source()change and in DT update the timer7 node with :
clocks = <&timer7_fck>, <&clkdiv32k_ck>;
clock-names = "fck", "src";
That didn't work as-is because clkdiv32k_ck isn't a direct parent of timer7_fck anymore. However, if I change it to
<&l4_per_clkctrl AM3_CLKDIV32K_CLKCTRL 0>
then all seems well.
Since pwm-dmtimer-omap sets the source clock explicitly anyways (based on the DT), using any of the parents of timer7_fck as the timer7 "src" clock works in my case.
Also, if I leave off the "src" clock entirely, then omap_dm_timer_prepare() defaults it to using that same clock:
rc = omap_dm_timer_of_set_source(timer); if (rc == -ENODEV) return omap_dm_timer_set_source(timer, OMAP_TIMER_SRC_32_KHZ);
and that also works for me.
Thanks,
David Rivshin
Quoted 27 lines
Thanks,
NeilQuoted 22 lines
-Tero
Quoted 16 lines
but I'm very uncertain whether that's the right path.
Shouldomap_dm_timerknow that the clock returned is actually a child of the clock it's interested in? Or shouldclk_get(<timerN>,"fck")be returning thetimerN_fckin the first place? Or is the problem something else entirely?As I'm not sure how these pieces are all intended to fit together, any pointers would be appreciated.
Thanks,
David Rivshin[1]
df54bfc5502a("clk: ti: am33xx: add clkctrl clock data")
https://www.spinics.net/lists/linux-omap/msg139798.html
[2]521f9e5e3f87("ARM: dts: am33xx: add fck under timers1/2")
https://www.spinics.net/lists/linux-omap/msg140605.htmlSignature · 1 line
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
Quoted 59 lines · On Wed, 20 Jun 2018 11:53:21 -0400 David Rivshin <[email protected]> wrote:
Quoted 37 lines · On Wed, 20 Jun 2018 09:11:19 +0200 Neil Armstrong <[email protected]>…
Hi,
Quoted 19 lines · Tero Kristo
Quoted 18 lines · David Rivshin
I think I've run across a regression in 4.16 that resulted from the TI clock infrastructure changes. A bisect pointed to [1] as the first breaking commit.
Our use-case is a pwm-dmtimer-omap using timer7, with
timer7_fckparented byclkdiv32k_ick(akatimer_32k_ckaka l4_per_cm:clk:0138:0). Starting with 4.16 that parenting fails inomap_dm_timer_set_source(), called frompwm_omap_dmtimer_probe, at this check:
if (clk_hw_get_num_parents(__clk_get_hw(timer->fclk)) < 2) return 0;
becausetimer->fclkis "l4_per_cm:clk:0068:0", whose only possible parent is "timer7_fck".It seemed to me that
timer->fclkshould instead be "timer7_fck" (which has the desired set of possible parents). I tried following the lead set in [2] and added "clocks" and "clock-names" properties on timer7. However, that resulted inomap_dm_timer_of_set_source(), called byomap_dm_timer_prepare(), failing when it tries to parent "timer7_fck" to itself.Quoted 5 lines
Quoted 3 lines
The following change in
omap_dm_timer_prepare()does seem to work:
-timer->fclk=clk_get(&timer->pdev->dev, "fck");
+timer->fclk=clk_get_parent(clk_get(&timer->pdev->dev, "fck"));It seems
omap_dm_timer_of_set_source()is actually completely broken and isn't doing anything useful. Neil, what was this function supposed to be doing, seeing you invented the initial patch for that (commit31a7448f4fa8a528040e3df593e9781f55218183)?The original change was supposed to set the timer source clock by using the clock defined in the DT, but it was made to work when the code was in
arch/armand the fck was not found from DT.The
omap_dm_timer_of_set_source()should be changed to get a specified clock name like "src":
parent =clk_get(&timer->pdev->dev, "src");
if (IS_ERR(parent))return -ENODEV;Quoted 7 lines
And the fck clock should be added to all timer nodes.
For example
ed839c3664cb308144fe70a3a95813ab59a03dfbor521f9e5e3f871cdac3ecd2a583d14d0472278053only adds fck to timer1/2, the 7 timers should have the fck clock.@David: chan you test the
omap_dm_timer_of_set_source()change and in DT update the timer7 node with :
clocks = <&timer7_fck>, <&clkdiv32k_ck>;
clock-names = "fck", "src";That didn't work as-is because
clkdiv32k_ckisn't a direct parent oftimer7_fckanymore. However, if I change it to<&l4_per_clkctrl AM3_CLKDIV32K_CLKCTRL 0>then all seems well.
Since pwm-dmtimer-omap sets the source clock explicitly anyways (based on the DT), using any of the parents of
timer7_fckas the timer7 "src" clock works in my case.Also, if I leave off the "src" clock entirely, then
omap_dm_timer_prepare()defaults it to using that same clock:
Quoted 8 lines
rc = omap_dm_timer_of_set_source(timer); if (rc == -ENODEV) return omap_dm_timer_set_source(timer, OMAP_TIMER_SRC_32_KHZ);and that also works for me.
Thanks,
David Rivshin
Hi Neil,
Are you planning on submitting a patch with this fix? Or would you prefer I spun one up? One concern I have is that while I use an am335x and feel fairly confident on those DT changes, I'm not so confident about what changes would be needed for other SoC's devicetrees.
Quoted 28 lines
Quoted 27 lines
Thanks,
NeilQuoted 22 lines
-Tero
Quoted 16 lines
but I'm very uncertain whether that's the right path.
Shouldomap_dm_timerknow that the clock returned is actually a child of the clock it's interested in? Or shouldclk_get(<timerN>,"fck")be returning thetimerN_fckin the first place? Or is the problem something else entirely?As I'm not sure how these pieces are all intended to fit together, any pointers would be appreciated.
Thanks,
David Rivshin[1]
df54bfc5502a("clk: ti: am33xx: add clkctrl clock data")
https://www.spinics.net/lists/linux-omap/msg139798.html
[2]521f9e5e3f87("ARM: dts: am33xx: add fck under timers1/2")
https://www.spinics.net/lists/linux-omap/msg140605.htmlSignature · 1 line
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
Quoted 4 lines · David Rivshin
On Wed, 20 Jun 2018 11:53:21 -0400
David Rivshin <[email protected]> wrote:
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines · On Wed, 20 Jun 2018 09:11:19 +0200 Neil Armstrong <[email protected]>…
Hi,
Quoted 2 lines · Tero Kristo
Quoted 1 line · David Rivshin
I think I've run across a regression in 4.16 that resulted from th=
e TI clock
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
infrastructure changes. A bisect pointed to [1] as the first break=
ing commit.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Our use-case is a pwm-dmtimer-omap using timer7, with
timer7_fckp=
arented
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
by
clkdiv32k_ick(akatimer_32k_ckaka l4_per_cm:clk:0138:0). Star=
ting with
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
4.16 that parenting fails in
omap_dm_timer_set_source(), called fr=
om
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
pwm_omap_dmtimer_probe, at this check:if (clk_hw_get_num_parents(__clk_get_hw(timer->fclk)) < 2) return 0;because
timer->fclkis "l4_per_cm:clk:0068:0", whose only possible=
parent
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
is "
timer7_fck".It seemed to me that
timer->fclkshould instead be "timer7_fck" (w=
hich has
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
the desired set of possible parents). I tried following the lead s=
et in [2]
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
and added "clocks" and "clock-names" properties on timer7. However=
, that
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
resulted in
omap_dm_timer_of_set_source(), called by omap_dm_timer=
_prepare(),
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Review
Quoted 5 lines
failing when it tries to parent "
timer7_fck" to itself.The following change in
omap_dm_timer_prepare()does seem to work:(quoted diff) +1
-1- timer->fclk =3D clk_get(&timer->pdev->dev, "fck"); + timer->fclk =3D clk_get_parent(clk_get(&timer->pdev->dev,=
"fck"));
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
It seems
omap_dm_timer_of_set_source()is actually completely broke=
n and isn't doing anything useful. Neil, what was this function supposed to=
be doing, seeing you invented the initial patch for that (commit 31a7448f4=fa8a528040e3df593e9781f55218183)?
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
The original change was supposed to set the timer source clock by usi=
ng the clock defined in the DT, but
Quoted 1 line
Quoted 1 line
Quoted 1 line
it was made to work when the code was in
arch/armand the fck was not=
found from DT.
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
The
omap_dm_timer_of_set_source()should be changed to get a specifie=
d clock name like "src":
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
parent =3D
clk_get(&timer->pdev->dev, "src");
if (IS_ERR(parent))return -ENODEV;And the fck clock should be added to all timer nodes.
For example
ed839c3664cb308144fe70a3a95813ab59a03dfbor 521f9e5e3f871=
cdac3ecd2a583d14d0472278053 only adds fck to timer1/2, the 7 timers should = have the fck clock.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
@David: chan you test the
omap_dm_timer_of_set_source()change and in=
DT update the timer7 node with :
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
clocks =3D <
&timer7_fck>, <&clkdiv32k_ck>;
clock-names =3D "fck", "src";That didn't work as-is because
clkdiv32k_ckisn't a direct parent oftimer7_fckanymore. However, if I change it to<&l4_per_clkctrl AM3_CLKDIV32K_CLKCTRL 0>then all seems well.
Quoted 5 lines
Quoted 5 lines
Since pwm-dmtimer-omap sets the source clock explicitly anyways (based on the DT), using any of the parents of
timer7_fckas the timer7 "src" clock works in my case.Also, if I leave off the "src" clock entirely, then omap_dm_timer_prepa=
re()
Quoted 4 lines
Quoted 4 lines
defaults it to using that same clock:
rc =3D omap_dm_timer_of_set_source(timer); if (rc =3D=3D -ENODEV) return omap_dm_timer_set_source(timer, OMAP_TIMER_SRC_32_=
KHZ);
Quoted 6 lines
Quoted 5 lines
and that also works for me.
Thanks,
David Rivshin
Quoted 6 lines
Hi Neil,
Are you planning on submitting a patch with this fix? Or would you prefer I spun one up? One concern I have is that while I use an am335x and feel fairly confident on those DT changes, I'm not so confident about what changes would be needed for other SoC's devicetrees.
I use the dmtimer to run a PWM on the backlight of a device I have on both an OMAP35xx and OMAP36/37. If someone wants to CC me on the patch, I can test it my boards.
adam
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Thanks,
NeilQuoted 5 lines
-Tero
Quoted 2 lines
but I'm very uncertain whether that's the right path. Should
omap_dm_timerknow that the clock returned is actually a ch=
ild of the
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
clock it's interested in? Or should
clk_get(<timerN>,"fck")be ret=
urning the
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
timerN_fckin the first place? Or is the problem something else en=
tirely?
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
As I'm not sure how these pieces are all intended to fit together,=
any
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
pointers would be appreciated.
Thanks,
David Rivshin
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
[1]
df54bfc5502a("clk: ti: am33xx: add clkctrl clock data")
https://www.spinics.net/lists/linux-omap/msg139798.html
[2]521f9e5e3f87("ARM: dts: am33xx: add fck under timers1/2")
https://www.spinics.net/lists/linux-omap/msg140605.html--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-t=
unnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
Quoted 6 lines
Quoted 2 lines
Quoted 1 line
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 75 lines · Adam Ford
Quoted 74 lines · David Rivshin
Quoted 59 lines · On Wed, 20 Jun 2018 11:53:21 -0400 David Rivshin <[email protected]> wrote:
Quoted 37 lines · On Wed, 20 Jun 2018 09:11:19 +0200 Neil Armstrong <[email protected]>…
Hi,
Quoted 19 lines · Tero Kristo
Quoted 18 lines · David Rivshin
I think I've run across a regression in 4.16 that resulted from the TI clock infrastructure changes. A bisect pointed to [1] as the first breaking commit.
Our use-case is a pwm-dmtimer-omap using timer7, with
timer7_fckparented byclkdiv32k_ick(akatimer_32k_ckaka l4_per_cm:clk:0138:0). Starting with 4.16 that parenting fails inomap_dm_timer_set_source(), called frompwm_omap_dmtimer_probe, at this check:if (clk_hw_get_num_parents(__clk_get_hw(timer->fclk)) < 2) return 0;because
timer->fclkis "l4_per_cm:clk:0068:0", whose only possible parent is "timer7_fck".It seemed to me that
timer->fclkshould instead be "timer7_fck" (which has the desired set of possible parents). I tried following the lead set in [2] and added "clocks" and "clock-names" properties on timer7. However, that resulted inomap_dm_timer_of_set_source(), called byomap_dm_timer_prepare(), failing when it tries to parent "timer7_fck" to itself.Quoted 5 lines
Review
Quoted 3 lines
The following change in
omap_dm_timer_prepare()does seem to work:(quoted diff) +1
-1- timer->fclk = clk_get(&timer->pdev->dev, "fck"); + timer->fclk = clk_get_parent(clk_get(&timer->pdev->dev, "fck"));It seems
omap_dm_timer_of_set_source()is actually completely broken and isn't doing anything useful. Neil, what was this function supposed to be doing, seeing you invented the initial patch for that (commit31a7448f4fa8a528040e3df593e9781f55218183)?The original change was supposed to set the timer source clock by using the clock defined in the DT, but it was made to work when the code was in
arch/armand the fck was not found from DT.The
omap_dm_timer_of_set_source()should be changed to get a specified clock name like "src":
parent =clk_get(&timer->pdev->dev, "src");
if (IS_ERR(parent))return -ENODEV;Quoted 7 lines
And the fck clock should be added to all timer nodes.
For example
ed839c3664cb308144fe70a3a95813ab59a03dfbor521f9e5e3f871cdac3ecd2a583d14d0472278053only adds fck to timer1/2, the 7 timers should have the fck clock.@David: chan you test the
omap_dm_timer_of_set_source()change and in DT update the timer7 node with :
clocks = <&timer7_fck>, <&clkdiv32k_ck>;
clock-names = "fck", "src";That didn't work as-is because
clkdiv32k_ckisn't a direct parent oftimer7_fckanymore. However, if I change it to<&l4_per_clkctrl AM3_CLKDIV32K_CLKCTRL 0>then all seems well.
Since pwm-dmtimer-omap sets the source clock explicitly anyways (based on the DT), using any of the parents of
timer7_fckas the timer7 "src" clock works in my case.Also, if I leave off the "src" clock entirely, then
omap_dm_timer_prepare()defaults it to using that same clock:Quoted 8 lines
rc = omap_dm_timer_of_set_source(timer); if (rc == -ENODEV) return omap_dm_timer_set_source(timer, OMAP_TIMER_SRC_32_KHZ);and that also works for me.
Thanks,
David RivshinHi Neil,
Quoted 8 lines
Quoted 4 lines
Are you planning on submitting a patch with this fix? Or would you prefer I spun one up? One concern I have is that while I use an am335x and feel fairly confident on those DT changes, I'm not so confident about what changes would be needed for other SoC's devicetrees.
I use the dmtimer to run a PWM on the backlight of a device I have on both an OMAP35xx and OMAP36/37. If someone wants to CC me on the patch, I can test it my boards.
Hi,
I can send a patch, but I'll need you test to make sure it still works.
Neil
Quoted 36 lines
adam
Quoted 34 lines
Quoted 26 lines
Quoted 26 lines
Thanks,
NeilQuoted 20 lines
-Tero
Quoted 16 lines
but I'm very uncertain whether that's the right path.
Shouldomap_dm_timerknow that the clock returned is actually a child of the clock it's interested in? Or shouldclk_get(<timerN>,"fck")be returning thetimerN_fckin the first place? Or is the problem something else entirely?As I'm not sure how these pieces are all intended to fit together, any pointers would be appreciated.
Thanks,
David Rivshin[1]
df54bfc5502a("clk: ti: am33xx: add clkctrl clock data")
https://www.spinics.net/lists/linux-omap/msg139798.html
[2]521f9e5e3f87("ARM: dts: am33xx: add fck under timers1/2")
https://www.spinics.net/lists/linux-omap/msg140605.htmlQuoted 4 lines
Quoted 3 lines
Quoted 2 lines
--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 81 lines · On Mon, 16 Jul 2018 19:03:29 +0200 Neil Armstrong <[email protected]>…
Quoted 80 lines · Adam Ford
Quoted 78 lines · David Rivshin
Quoted 59 lines · On Wed, 20 Jun 2018 11:53:21 -0400 David Rivshin <[email protected]> wrote:
Quoted 37 lines · On Wed, 20 Jun 2018 09:11:19 +0200 Neil Armstrong <[email protected]>…
Hi,
Quoted 19 lines · Tero Kristo
Quoted 18 lines · David Rivshin
I think I've run across a regression in 4.16 that resulted from the TI clock infrastructure changes. A bisect pointed to [1] as the first breaking commit.
Our use-case is a pwm-dmtimer-omap using timer7, with
timer7_fckparented byclkdiv32k_ick(akatimer_32k_ckaka l4_per_cm:clk:0138:0). Starting with 4.16 that parenting fails inomap_dm_timer_set_source(), called frompwm_omap_dmtimer_probe, at this check:if (clk_hw_get_num_parents(__clk_get_hw(timer->fclk)) < 2) return 0;because
timer->fclkis "l4_per_cm:clk:0068:0", whose only possible parent is "timer7_fck".It seemed to me that
timer->fclkshould instead be "timer7_fck" (which has the desired set of possible parents). I tried following the lead set in [2] and added "clocks" and "clock-names" properties on timer7. However, that resulted inomap_dm_timer_of_set_source(), called byomap_dm_timer_prepare(), failing when it tries to parent "timer7_fck" to itself.Quoted 5 lines
Review
Quoted 3 lines
The following change in
omap_dm_timer_prepare()does seem to work:(quoted diff) +1
-1- timer->fclk = clk_get(&timer->pdev->dev, "fck"); + timer->fclk = clk_get_parent(clk_get(&timer->pdev->dev, "fck"));It seems
omap_dm_timer_of_set_source()is actually completely broken and isn't doing anything useful. Neil, what was this function supposed to be doing, seeing you invented the initial patch for that (commit31a7448f4fa8a528040e3df593e9781f55218183)?The original change was supposed to set the timer source clock by using the clock defined in the DT, but it was made to work when the code was in
arch/armand the fck was not found from DT.The
omap_dm_timer_of_set_source()should be changed to get a specified clock name like "src":
parent =clk_get(&timer->pdev->dev, "src");
if (IS_ERR(parent))return -ENODEV;Quoted 7 lines
And the fck clock should be added to all timer nodes.
For example
ed839c3664cb308144fe70a3a95813ab59a03dfbor521f9e5e3f871cdac3ecd2a583d14d0472278053only adds fck to timer1/2, the 7 timers should have the fck clock.@David: chan you test the
omap_dm_timer_of_set_source()change and in DT update the timer7 node with :
clocks = <&timer7_fck>, <&clkdiv32k_ck>;
clock-names = "fck", "src";That didn't work as-is because
clkdiv32k_ckisn't a direct parent oftimer7_fckanymore. However, if I change it to<&l4_per_clkctrl AM3_CLKDIV32K_CLKCTRL 0>then all seems well.
Since pwm-dmtimer-omap sets the source clock explicitly anyways (based on the DT), using any of the parents of
timer7_fckas the timer7 "src" clock works in my case.Also, if I leave off the "src" clock entirely, then
omap_dm_timer_prepare()defaults it to using that same clock:Quoted 8 lines
rc = omap_dm_timer_of_set_source(timer); if (rc == -ENODEV) return omap_dm_timer_set_source(timer, OMAP_TIMER_SRC_32_KHZ);and that also works for me.
Thanks,
David RivshinHi Neil,
Are you planning on submitting a patch with this fix? Or would you prefer I spun one up? One concern I have is that while I use an am335x and feel fairly confident on those DT changes, I'm not so confident about what changes would be needed for other SoC's devicetrees.
Quoted 7 lines
Quoted 3 lines
I use the dmtimer to run a PWM on the backlight of a device I have on both an OMAP35xx and OMAP36/37. If someone wants to CC me on the patch, I can test it my boards.
Hi,
I can send a patch, but I'll need you test to make sure it still works.
No problem, I can definitely test on my board. Please CC me as well so I don't miss it.
Thanks,
David Rivshin
Quoted 40 lines
Neil
Quoted 36 lines
adam
Quoted 34 lines
Quoted 26 lines
Quoted 26 lines
Thanks,
NeilQuoted 20 lines
-Tero
Quoted 16 lines
but I'm very uncertain whether that's the right path.
Shouldomap_dm_timerknow that the clock returned is actually a child of the clock it's interested in? Or shouldclk_get(<timerN>,"fck")be returning thetimerN_fckin the first place? Or is the problem something else entirely?As I'm not sure how these pieces are all intended to fit together, any pointers would be appreciated.
Thanks,
David Rivshin[1]
df54bfc5502a("clk: ti: am33xx: add clkctrl clock data")
https://www.spinics.net/lists/linux-omap/msg139798.html
[2]521f9e5e3f87("ARM: dts: am33xx: add fck under timers1/2")
https://www.spinics.net/lists/linux-omap/msg140605.htmlQuoted 4 lines
Quoted 3 lines
Quoted 2 lines
--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html