net: wifi: clk: rk3308: Add external clock instead of crystal vibration

Change-Id: Iadc3c1976fe09060308cca9bde11f4fab5fd47e2
Signed-off-by: xiaoyao <xiaoyao@rock-chips.com>
This commit is contained in:
xiaoyao
2018-07-26 18:09:41 +08:00
committed by Tao Huang
parent 41ff4d6b62
commit b906edb495
2 changed files with 25 additions and 0 deletions

View File

@@ -5,6 +5,7 @@
#include <linux/types.h>
#include <linux/init.h>
#include <linux/device.h>
#include <linux/clk.h>
struct rksdmmc_iomux {
char *name; //set the MACRO of gpio
@@ -42,6 +43,7 @@ struct rksdmmc_gpio_wifi_moudle {
struct rksdmmc_gpio ANTSEL3; //pin6--ANTSEL3
struct rksdmmc_gpio GPS_LAN; //pin33--GPS_LAN
struct regmap *grf;
struct clk *ext_clk;
};
enum {

View File

@@ -597,6 +597,7 @@ static int wlan_platdata_parse_dt(struct device *dev,
u32 value;
int gpio,ret;
enum of_gpio_flags flags;
u32 ext_clk_value = 0;
if (!node)
return -ENODEV;
@@ -677,6 +678,28 @@ static int wlan_platdata_parse_dt(struct device *dev,
} else data->wifi_int_b.io = -1;
}
data->ext_clk = devm_clk_get(dev, "clk_wifi");
if (IS_ERR(data->ext_clk)) {
LOG("%s: The ref_wifi_clk not found !\n", __func__);
} else {
of_property_read_u32(node, "ref-clock-frequency",
&ext_clk_value);
if (ext_clk_value > 0) {
ret = clk_set_rate(data->ext_clk, ext_clk_value);
if (ret)
LOG("%s: set ref clk error!\n", __func__);
ret = clk_prepare_enable(data->ext_clk);
if (ret)
LOG("%s: enable ref clk error!\n", __func__);
/* WIFI clock (REF_CLKOUT) output enable.
* 1'b0: drive disable
* 1'b1: output enable
*/
if (of_machine_is_compatible("rockchip,rk3308"))
regmap_write(data->grf, 0x0314, 0x00020002);
}
}
return 0;
}
#endif //CONFIG_OF