Message ID | 1385414121-21493-2-git-send-email-mkl@pengutronix.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
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>
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
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);
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(-)