Thread (7 messages) flat view 7 messages, 4 authors, 2012-07-18
STALE5166d

[PATCH] can: flexcan: add 2nd clock to support imx53 and newer

From: Lothar Waßmann <hidden>
Date: 2012-07-18 09:05:23
Also in: linux-can

Hi,

Marc Kleine-Budde writes:
On 07/18/2012 04:12 AM, Hui Wang wrote:
quoted
Marc Kleine-Budde wrote:
quoted
From: Steffen Trumtrar <redacted>

This patch add support for a second clock to the flexcan driver. On
modern
freescale ARM cores like the imx53 and imx6q two clocks ("ipg" and "per")
must be enabled in order to access the CAN core.
-        clock_freq = clk_get_rate(clk);
     }
 
     mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -1039,7 +1052,8 @@ static int __devinit flexcan_probe(struct
platform_device *pdev)
         CAN_CTRLMODE_BERR_REPORTING;
     priv->base = base;
     priv->dev = dev;
-    priv->clk = clk;
+    priv->clk_ipg = clk_ipg;
+    priv->clk_per = clk_per;
     priv->pdata = pdev->dev.platform_data;
     priv->devtype_data = devtype_data;
 
@@ -1067,9 +1081,11 @@ static int __devinit flexcan_probe(struct
platform_device *pdev)
  failed_map:
     release_mem_region(mem->start, mem_size);
  failed_get:
-    if (clk)
-        clk_put(clk);
  failed_clock:
+    if (clk_per)
  
Use if (!IS_ERR(clk_per))
Yes, good catch.

Is it allowed to call clk_put with a NULL pointer? Both clocks can be
NULL, if the frequency is defined via the device tree, this is case for
powerpc.
This has been discussed here already several times. Everything
returned by clk_get() that does not satisfy the IS_ERR() check, is a
valid clk cookie and can be used for the clk API calls.


Lothar Wa?mann
-- 
___________________________________________________________

Ka-Ro electronics GmbH | Pascalstra?e 22 | D - 52076 Aachen
Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10
Gesch?ftsf?hrer: Matthias Kaussen
Handelsregistereintrag: Amtsgericht Aachen, HRB 4996

www.karo-electronics.de | info at karo-electronics.de
___________________________________________________________
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help