* [PATCH v2 1/2] can + ARM i.MX53: use 24 MHz clock parent on i.MX53
@ 2013-11-25 21:15 Marc Kleine-Budde
2013-11-25 21:15 ` [PATCH v2 1/2] can: flexcan: use correct clock as base for bit rate calculation Marc Kleine-Budde
` (2 more replies)
0 siblings, 3 replies; 12+ messages in thread
From: Marc Kleine-Budde @ 2013-11-25 21:15 UTC (permalink / raw)
To: linux-arm-kernel
Hello,
this series first fixes a bug in the flexcan driver, using the wrong clock for
the bit rate calculcation. The next patch switches the peripheral clock on
i.MX53 to lp_apm, which has a rate of 24 MHz. This is optimal for the CIA
recommended bit rates.
Tested on TQ's mba53 and mba6x [1].
Who is taking the series? Due to Lucas' patch:
0a5b8df clk: imx5: introduce DT includes for clock provider
this series does not yet apply to my upstream (net-next/mastet).
Marc
[1] On i.MX6 the following patch is needed (which is already in Shawn's
for-next):
9b3d423 ARM: i.MX6q: fix the wrong parent of can_root clock
changes since v1:
* move switch to 24 MHz clock to mx53_clocks_init
(tnx Alexander)
^ permalink raw reply [flat|nested] 12+ messages in thread* [PATCH v2 1/2] can: flexcan: use correct clock as base for bit rate calculation 2013-11-25 21:15 [PATCH v2 1/2] can + ARM i.MX53: use 24 MHz clock parent on i.MX53 Marc Kleine-Budde @ 2013-11-25 21:15 ` Marc Kleine-Budde 2013-11-26 8:27 ` Marc Kleine-Budde 2013-11-25 21:15 ` [PATCH v2 2/2] ARM i.MX5: set CAN peripheral clock to 24 MHz parent Marc Kleine-Budde 2013-11-26 4:53 ` [PATCH v2 1/2] can + ARM i.MX53: use 24 MHz clock parent on i.MX53 Shawn Guo 2 siblings, 1 reply; 12+ messages in thread From: Marc Kleine-Budde @ 2013-11-25 21:15 UTC (permalink / raw) To: linux-arm-kernel The flexcan IP core uses the peripheral clock ("per") as basic clock for the bit timing calculation. However the driver uses the the wrong clock ("ipg"). This leads to wrong bit rates if the rates on both clock are different. This patch fixes the problem by using the correct clock for the bit rate calculation. Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> --- drivers/net/can/flexcan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c index ae08cf1..aaed97b 100644 --- a/drivers/net/can/flexcan.c +++ b/drivers/net/can/flexcan.c @@ -1020,13 +1020,13 @@ static int flexcan_probe(struct platform_device *pdev) dev_err(&pdev->dev, "no ipg clock defined\n"); return PTR_ERR(clk_ipg); } - clock_freq = clk_get_rate(clk_ipg); clk_per = devm_clk_get(&pdev->dev, "per"); if (IS_ERR(clk_per)) { dev_err(&pdev->dev, "no per clock defined\n"); return PTR_ERR(clk_per); } + clock_freq = clk_get_rate(clk_per); } mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); -- 1.8.4.2 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v2 1/2] can: flexcan: use correct clock as base for bit rate calculation 2013-11-25 21:15 ` [PATCH v2 1/2] can: flexcan: use correct clock as base for bit rate calculation Marc Kleine-Budde @ 2013-11-26 8:27 ` Marc Kleine-Budde 2013-11-26 8:35 ` Marc Kleine-Budde 0 siblings, 1 reply; 12+ messages in thread From: Marc Kleine-Budde @ 2013-11-26 8:27 UTC (permalink / raw) To: linux-arm-kernel On 11/25/2013 10:15 PM, Marc Kleine-Budde wrote: > The flexcan IP core uses the peripheral clock ("per") as basic clock for the > bit timing calculation. However the driver uses the the wrong clock ("ipg"). > This leads to wrong bit rates if the rates on both clock are different. > > This patch fixes the problem by using the correct clock for the bit rate > calculation. > > Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Acked-by: Marc Kleine-Budde <mkl@pengutronix.de> -- Pengutronix e.K. | Marc Kleine-Budde | Industrial Linux Solutions | Phone: +49-231-2826-924 | Vertretung West/Dortmund | Fax: +49-5121-206917-5555 | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de | -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 259 bytes Desc: OpenPGP digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20131126/7364b510/attachment.sig> ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v2 1/2] can: flexcan: use correct clock as base for bit rate calculation 2013-11-26 8:27 ` Marc Kleine-Budde @ 2013-11-26 8:35 ` Marc Kleine-Budde 0 siblings, 0 replies; 12+ messages in thread From: Marc Kleine-Budde @ 2013-11-26 8:35 UTC (permalink / raw) To: linux-arm-kernel On 11/26/2013 09:27 AM, Marc Kleine-Budde wrote: > On 11/25/2013 10:15 PM, Marc Kleine-Budde wrote: >> The flexcan IP core uses the peripheral clock ("per") as basic clock for the >> bit timing calculation. However the driver uses the the wrong clock ("ipg"). >> This leads to wrong bit rates if the rates on both clock are different. >> >> This patch fixes the problem by using the correct clock for the bit rate >> calculation. >> >> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> > Acked-by: Marc Kleine-Budde <mkl@pengutronix.de> If you take the patch, please add: Cc: linux-stable <stable@vger.kernel.org> Marc -- Pengutronix e.K. | Marc Kleine-Budde | Industrial Linux Solutions | Phone: +49-231-2826-924 | Vertretung West/Dortmund | Fax: +49-5121-206917-5555 | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de | -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 259 bytes Desc: OpenPGP digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20131126/5b10d1fc/attachment.sig> ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v2 2/2] ARM i.MX5: set CAN peripheral clock to 24 MHz parent 2013-11-25 21:15 [PATCH v2 1/2] can + ARM i.MX53: use 24 MHz clock parent on i.MX53 Marc Kleine-Budde 2013-11-25 21:15 ` [PATCH v2 1/2] can: flexcan: use correct clock as base for bit rate calculation Marc Kleine-Budde @ 2013-11-25 21:15 ` Marc Kleine-Budde 2013-11-26 4:53 ` [PATCH v2 1/2] can + ARM i.MX53: use 24 MHz clock parent on i.MX53 Shawn Guo 2 siblings, 0 replies; 12+ messages in thread From: Marc Kleine-Budde @ 2013-11-25 21:15 UTC (permalink / raw) To: linux-arm-kernel This patch sets the parent of CAN peripheral clock (a.k.a. CPI clock) to the lp_apm clock, which has a rate of 24 MHz. In the CAN world a base clock with multiple of 8 MHz is suited best for all CIA recommented bit rates. Without this patch the CAN peripheral clock on i.MX53 has a rate of 66.666 MHz which produces quite large bit rate errors. Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> --- arch/arm/mach-imx/clk-imx51-imx53.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm/mach-imx/clk-imx51-imx53.c b/arch/arm/mach-imx/clk-imx51-imx53.c index e349fd5..dff5ca9 100644 --- a/arch/arm/mach-imx/clk-imx51-imx53.c +++ b/arch/arm/mach-imx/clk-imx51-imx53.c @@ -584,6 +584,9 @@ static void __init mx53_clocks_init(struct device_node *np) clk_set_rate(clk[IMX5_CLK_ESDHC_A_PODF], 200000000); clk_set_rate(clk[IMX5_CLK_ESDHC_B_PODF], 200000000); + /* move can bus clk to 24MHz */ + clk_set_parent(clk[IMX5_CLK_CAN_SEL], clk[IMX5_CLK_LP_APM]); + clk_prepare_enable(clk[IMX5_CLK_IIM_GATE]); imx_print_silicon_rev("i.MX53", mx53_revision()); clk_disable_unprepare(clk[IMX5_CLK_IIM_GATE]); -- 1.8.4.2 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v2 1/2] can + ARM i.MX53: use 24 MHz clock parent on i.MX53 2013-11-25 21:15 [PATCH v2 1/2] can + ARM i.MX53: use 24 MHz clock parent on i.MX53 Marc Kleine-Budde 2013-11-25 21:15 ` [PATCH v2 1/2] can: flexcan: use correct clock as base for bit rate calculation Marc Kleine-Budde 2013-11-25 21:15 ` [PATCH v2 2/2] ARM i.MX5: set CAN peripheral clock to 24 MHz parent Marc Kleine-Budde @ 2013-11-26 4:53 ` Shawn Guo 2013-11-26 8:26 ` Marc Kleine-Budde 2 siblings, 1 reply; 12+ messages in thread From: Shawn Guo @ 2013-11-26 4:53 UTC (permalink / raw) To: linux-arm-kernel On Mon, Nov 25, 2013 at 10:15:19PM +0100, Marc Kleine-Budde wrote: > Hello, > > this series first fixes a bug in the flexcan driver, using the wrong clock for > the bit rate calculcation. The next patch switches the peripheral clock on > i.MX53 to lp_apm, which has a rate of 24 MHz. This is optimal for the CIA > recommended bit rates. > > Tested on TQ's mba53 and mba6x [1]. > > Who is taking the series? Due to Lucas' patch: > > 0a5b8df clk: imx5: introduce DT includes for clock provider > > this series does not yet apply to my upstream (net-next/mastet). If the clock setting in flexcan driver is already broken, it shouldn't matter to have two patches go different tree? Otherwise, I can have both go via IMX tree with your ACK on the first one? > > Marc > > [1] On i.MX6 the following patch is needed (which is already in Shawn's > for-next): > > 9b3d423 ARM: i.MX6q: fix the wrong parent of can_root clock This one already hits mainline. Shawn > > changes since v1: > * move switch to 24 MHz clock to mx53_clocks_init > (tnx Alexander) > > ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v2 1/2] can + ARM i.MX53: use 24 MHz clock parent on i.MX53 2013-11-26 4:53 ` [PATCH v2 1/2] can + ARM i.MX53: use 24 MHz clock parent on i.MX53 Shawn Guo @ 2013-11-26 8:26 ` Marc Kleine-Budde 2013-11-26 14:33 ` Shawn Guo 0 siblings, 1 reply; 12+ messages in thread From: Marc Kleine-Budde @ 2013-11-26 8:26 UTC (permalink / raw) To: linux-arm-kernel On 11/26/2013 05:53 AM, Shawn Guo wrote: >> this series first fixes a bug in the flexcan driver, using the wrong clock for >> the bit rate calculcation. The next patch switches the peripheral clock on >> i.MX53 to lp_apm, which has a rate of 24 MHz. This is optimal for the CIA >> recommended bit rates. >> >> Tested on TQ's mba53 and mba6x [1]. >> >> Who is taking the series? Due to Lucas' patch: >> >> 0a5b8df clk: imx5: introduce DT includes for clock provider >> >> this series does not yet apply to my upstream (net-next/mastet). > > If the clock setting in flexcan driver is already broken, it shouldn't > matter to have two patches go different tree? Otherwise, I can have > both go via IMX tree with your ACK on the first one? The problem is, that the wrong clock is being used. An all i.mx, but not on imx6, both clocks are the same, the bug doesn't show up. So before we can use the 24 MHz clock on mx53, we have to fix the driver. Feel free to add my Acked-by to the first patch and take it via your tree. >> [1] On i.MX6 the following patch is needed (which is already in Shawn's >> for-next): >> >> 9b3d423 ARM: i.MX6q: fix the wrong parent of can_root clock > > This one already hits mainline. But not net-next/master, which is my upstream. Marc -- Pengutronix e.K. | Marc Kleine-Budde | Industrial Linux Solutions | Phone: +49-231-2826-924 | Vertretung West/Dortmund | Fax: +49-5121-206917-5555 | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de | -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 259 bytes Desc: OpenPGP digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20131126/99d84532/attachment.sig> ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v2 1/2] can + ARM i.MX53: use 24 MHz clock parent on i.MX53 2013-11-26 8:26 ` Marc Kleine-Budde @ 2013-11-26 14:33 ` Shawn Guo 2013-11-26 14:35 ` Marc Kleine-Budde 2013-12-03 10:54 ` Marc Kleine-Budde 0 siblings, 2 replies; 12+ messages in thread From: Shawn Guo @ 2013-11-26 14:33 UTC (permalink / raw) To: linux-arm-kernel On Tue, Nov 26, 2013 at 09:26:40AM +0100, Marc Kleine-Budde wrote: > The problem is, that the wrong clock is being used. An all i.mx, but not > on imx6, both clocks are the same, the bug doesn't show up. So before we > can use the 24 MHz clock on mx53, we have to fix the driver. So it sounds like a more appropriate merging path would be that, you send the driver fix right away to mainline via net tree with v3.13-rc series, and I rebase IMX tree on the -rc that has the fix, and then apply the DTS patch. Shawn ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v2 1/2] can + ARM i.MX53: use 24 MHz clock parent on i.MX53 2013-11-26 14:33 ` Shawn Guo @ 2013-11-26 14:35 ` Marc Kleine-Budde 2013-12-03 10:54 ` Marc Kleine-Budde 1 sibling, 0 replies; 12+ messages in thread From: Marc Kleine-Budde @ 2013-11-26 14:35 UTC (permalink / raw) To: linux-arm-kernel On 11/26/2013 03:33 PM, Shawn Guo wrote: > On Tue, Nov 26, 2013 at 09:26:40AM +0100, Marc Kleine-Budde wrote: >> The problem is, that the wrong clock is being used. An all i.mx, but not >> on imx6, both clocks are the same, the bug doesn't show up. So before we >> can use the 24 MHz clock on mx53, we have to fix the driver. > > So it sounds like a more appropriate merging path would be that, > you send the driver fix right away to mainline via net tree with > v3.13-rc series, and I rebase IMX tree on the -rc that has the fix, > and then apply the DTS patch. ^^^ Clocktree not Devicetree :) Okay, fine with me. Marc -- Pengutronix e.K. | Marc Kleine-Budde | Industrial Linux Solutions | Phone: +49-231-2826-924 | Vertretung West/Dortmund | Fax: +49-5121-206917-5555 | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de | -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 259 bytes Desc: OpenPGP digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20131126/bd077ba2/attachment.sig> ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v2 1/2] can + ARM i.MX53: use 24 MHz clock parent on i.MX53 2013-11-26 14:33 ` Shawn Guo 2013-11-26 14:35 ` Marc Kleine-Budde @ 2013-12-03 10:54 ` Marc Kleine-Budde 2013-12-03 11:46 ` Shawn Guo 2013-12-09 5:59 ` Shawn Guo 1 sibling, 2 replies; 12+ messages in thread From: Marc Kleine-Budde @ 2013-12-03 10:54 UTC (permalink / raw) To: linux-arm-kernel Hello Shawn, On 11/26/2013 03:33 PM, Shawn Guo wrote: > On Tue, Nov 26, 2013 at 09:26:40AM +0100, Marc Kleine-Budde wrote: >> The problem is, that the wrong clock is being used. An all i.mx, but not >> on imx6, both clocks are the same, the bug doesn't show up. So before we >> can use the 24 MHz clock on mx53, we have to fix the driver. > > So it sounds like a more appropriate merging path would be that, > you send the driver fix right away to mainline via net tree with > v3.13-rc series, and I rebase IMX tree on the -rc that has the fix, > and then apply the DTS patch. The patch is now in Linus master: 1a3e517 can: flexcan: use correct clock as base for bit rate calculation So it should be in the v3.13-rc3. Marc -- Pengutronix e.K. | Marc Kleine-Budde | Industrial Linux Solutions | Phone: +49-231-2826-924 | Vertretung West/Dortmund | Fax: +49-5121-206917-5555 | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de | -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 259 bytes Desc: OpenPGP digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20131203/53fa4558/attachment.sig> ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v2 1/2] can + ARM i.MX53: use 24 MHz clock parent on i.MX53 2013-12-03 10:54 ` Marc Kleine-Budde @ 2013-12-03 11:46 ` Shawn Guo 2013-12-09 5:59 ` Shawn Guo 1 sibling, 0 replies; 12+ messages in thread From: Shawn Guo @ 2013-12-03 11:46 UTC (permalink / raw) To: linux-arm-kernel On Tue, Dec 03, 2013 at 11:54:35AM +0100, Marc Kleine-Budde wrote: > Hello Shawn, > > On 11/26/2013 03:33 PM, Shawn Guo wrote: > > On Tue, Nov 26, 2013 at 09:26:40AM +0100, Marc Kleine-Budde wrote: > >> The problem is, that the wrong clock is being used. An all i.mx, but not > >> on imx6, both clocks are the same, the bug doesn't show up. So before we > >> can use the 24 MHz clock on mx53, we have to fix the driver. > > > > So it sounds like a more appropriate merging path would be that, > > you send the driver fix right away to mainline via net tree with > > v3.13-rc series, and I rebase IMX tree on the -rc that has the fix, > > and then apply the DTS patch. > > The patch is now in Linus master: > 1a3e517 can: flexcan: use correct clock as base for bit rate calculation Great. > > So it should be in the v3.13-rc3. Ok, I will rebase my branch on v3.13-rc3 once it comes out. But please ping me again if I forget to. Thanks. Shawn ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v2 1/2] can + ARM i.MX53: use 24 MHz clock parent on i.MX53 2013-12-03 10:54 ` Marc Kleine-Budde 2013-12-03 11:46 ` Shawn Guo @ 2013-12-09 5:59 ` Shawn Guo 1 sibling, 0 replies; 12+ messages in thread From: Shawn Guo @ 2013-12-09 5:59 UTC (permalink / raw) To: linux-arm-kernel On Tue, Dec 03, 2013 at 11:54:35AM +0100, Marc Kleine-Budde wrote: > Hello Shawn, > > On 11/26/2013 03:33 PM, Shawn Guo wrote: > > On Tue, Nov 26, 2013 at 09:26:40AM +0100, Marc Kleine-Budde wrote: > >> The problem is, that the wrong clock is being used. An all i.mx, but not > >> on imx6, both clocks are the same, the bug doesn't show up. So before we > >> can use the 24 MHz clock on mx53, we have to fix the driver. > > > > So it sounds like a more appropriate merging path would be that, > > you send the driver fix right away to mainline via net tree with > > v3.13-rc series, and I rebase IMX tree on the -rc that has the fix, > > and then apply the DTS patch. > > The patch is now in Linus master: > 1a3e517 can: flexcan: use correct clock as base for bit rate calculation > > So it should be in the v3.13-rc3. Ok, v3.13-rc3 is out and the clock patch is applied. Shawn ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2013-12-09 5:59 UTC | newest] Thread overview: 12+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-11-25 21:15 [PATCH v2 1/2] can + ARM i.MX53: use 24 MHz clock parent on i.MX53 Marc Kleine-Budde 2013-11-25 21:15 ` [PATCH v2 1/2] can: flexcan: use correct clock as base for bit rate calculation Marc Kleine-Budde 2013-11-26 8:27 ` Marc Kleine-Budde 2013-11-26 8:35 ` Marc Kleine-Budde 2013-11-25 21:15 ` [PATCH v2 2/2] ARM i.MX5: set CAN peripheral clock to 24 MHz parent Marc Kleine-Budde 2013-11-26 4:53 ` [PATCH v2 1/2] can + ARM i.MX53: use 24 MHz clock parent on i.MX53 Shawn Guo 2013-11-26 8:26 ` Marc Kleine-Budde 2013-11-26 14:33 ` Shawn Guo 2013-11-26 14:35 ` Marc Kleine-Budde 2013-12-03 10:54 ` Marc Kleine-Budde 2013-12-03 11:46 ` Shawn Guo 2013-12-09 5:59 ` Shawn Guo
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).