码迷,mamicode.com
首页 > 其他好文 > 详细

NFC时钟BBCLK2改为常供

时间:2017-04-05 20:35:15      阅读:1286      评论:0      收藏:0      [点我收藏+]

标签:static   disable   fail   for   suspend   ping   nfc   parse   dex   

diff --git a/arch/arm/boot/dts/qcom/msm8976-qrd.dtsi b/arch/arm/boot/dts/qcom/msm8976-qrd.dtsi
index 6433ca5..edf3b66 100644
--- a/arch/arm/boot/dts/qcom/msm8976-qrd.dtsi
+++ b/arch/arm/boot/dts/qcom/msm8976-qrd.dtsi
@@ -40,7 +40,8 @@
                pinctrl-names = "nfc_active", "nfc_suspend";
                pinctrl-0 = <&nfc_int_active &nfc_disable_active>;
                pinctrl-1 = <&nfc_int_suspend &nfc_disable_suspend>;
-               clocks = <&clock_gcc clk_bb_clk2_pin>;
+               //clocks = <&clock_gcc clk_bb_clk2_pin>;
+               clocks = <&clock_gcc clk_bb_clk2>;
                clock-names = "ref_clk";
        };
        /*
diff --git a/drivers/nfc/nq-nci.c b/drivers/nfc/nq-nci.c
index 407f5df..f782e5f 100644
--- a/drivers/nfc/nq-nci.c
+++ b/drivers/nfc/nq-nci.c
@@ -26,6 +26,7 @@
 #include "nq-nci.h"
 #include <linux/dma-mapping.h>
 #include <linux/dmapool.h>
+#include <linux/clk.h>
 #ifdef CONFIG_COMPAT
 #include <linux/compat.h>
 #endif
@@ -36,6 +37,9 @@ struct nqx_platform_data {
        unsigned int clkreq_gpio;
        unsigned int firm_gpio;
        const char *clk_src_name;
+
+        /*CLK control*/
+        struct clk              *s_clk;
 };

 static struct of_device_id msm_match_table[] = {
@@ -412,11 +416,27 @@ static int nfc_parse_dt(struct device *dev, struct nqx_platform_data *pdata)
        }
 
        r = of_property_read_string(np, "qcom,clk-src", &pdata->clk_src_name);
+       if (r)
+               return -EINVAL;
 
        pdata->clkreq_gpio = of_get_named_gpio(np, "qcom,nq-clkreq", 0);
 
-       if (r)
-               return -EINVAL;
+        /*constant clock*/
+        if (!strcmp(pdata->clk_src_name, "BBCLK2"))
+        {
+            pdata->s_clk = clk_get(dev, "ref_clk");
+        }
+        if (pdata->s_clk == NULL)
+        {
+            dev_err(dev, "%s: failed to get clk.\n", __func__);
+            return -ENOMEM;
+        }
+        r = clk_prepare_enable(pdata->s_clk);
+        if(r){
+            dev_err(dev, "%s: failed to enable clk.\n", __func__);
+            return -ENOMEM;
+        }
+
        return r;
 }

NFC时钟BBCLK2改为常供

标签:static   disable   fail   for   suspend   ping   nfc   parse   dex   

原文地址:http://www.cnblogs.com/steadfast/p/6670158.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!