c35d7c90c26d36685e39f7040e84170ddbdc7ae8
[openwrt/openwrt.git] / target / linux / imx6 / patches-3.10 / 0061-can-flexcan-use-correct-clock-as-base-for-bit-rate-c.patch
1 From 1a3e5173f5e72cbf7f0c8927b33082e361c16d72 Mon Sep 17 00:00:00 2001
2 From: Marc Kleine-Budde <mkl@pengutronix.de>
3 Date: Mon, 25 Nov 2013 22:15:20 +0100
4 Subject: [PATCH] can: flexcan: use correct clock as base for bit rate
5 calculation
6
7 The flexcan IP core uses the peripheral clock ("per") as basic clock for the
8 bit timing calculation. However the driver uses the the wrong clock ("ipg").
9 This leads to wrong bit rates if the rates on both clock are different.
10
11 This patch fixes the problem by using the correct clock for the bit rate
12 calculation.
13
14 Cc: linux-stable <stable@vger.kernel.org>
15 Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
16 ---
17 drivers/net/can/flexcan.c | 2 +-
18 1 file changed, 1 insertion(+), 1 deletion(-)
19
20 --- a/drivers/net/can/flexcan.c
21 +++ b/drivers/net/can/flexcan.c
22 @@ -1025,7 +1025,6 @@ static int flexcan_probe(struct platform
23 err = PTR_ERR(clk_ipg);
24 goto failed_clock;
25 }
26 - clock_freq = clk_get_rate(clk_ipg);
27
28 clk_per = devm_clk_get(&pdev->dev, "per");
29 if (IS_ERR(clk_per)) {
30 @@ -1033,6 +1032,7 @@ static int flexcan_probe(struct platform
31 err = PTR_ERR(clk_per);
32 goto failed_clock;
33 }
34 + clock_freq = clk_get_rate(clk_per);
35 }
36
37 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);