首页 > 代码库 > NFC时钟BBCLK2改为常供

NFC时钟BBCLK2改为常供

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改为常供