]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
can: flexcan: use be32_to_cpup to handle the value of dt entry
authorHui Wang <jason77.wang@gmail.com>
Wed, 27 Jun 2012 08:19:18 +0000 (16:19 +0800)
committerBen Hutchings <ben@decadent.org.uk>
Wed, 4 Jul 2012 04:44:32 +0000 (05:44 +0100)
commit 85f2f834e85517307f13e30e630a5fc86f757cb5 upstream.

The freescale arm i.MX series platform can support this driver, and
usually the arm cpu works in the little endian mode by default, while
device tree entry value is stored in big endian format, we should use
be32_to_cpup() to handle them, after modification, it can work well
both on the le cpu and be cpu.

Cc: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Hui Wang <jason77.wang@gmail.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/net/can/flexcan.c

index e02337953f41b93b3c8f8e300e26adef196ef6f6..e59d006e98e123d8631c6f9bf3c1a0780153bd7a 100644 (file)
@@ -933,12 +933,12 @@ static int __devinit flexcan_probe(struct platform_device *pdev)
        u32 clock_freq = 0;
 
        if (pdev->dev.of_node) {
-               const u32 *clock_freq_p;
+               const __be32 *clock_freq_p;
 
                clock_freq_p = of_get_property(pdev->dev.of_node,
                                                "clock-frequency", NULL);
                if (clock_freq_p)
-                       clock_freq = *clock_freq_p;
+                       clock_freq = be32_to_cpup(clock_freq_p);
        }
 
        if (!clock_freq) {