diff --git a/include/linux/rfkill-wlan.h b/include/linux/rfkill-wlan.h index 92f9522bef74..2cead6d09a15 100644 --- a/include/linux/rfkill-wlan.h +++ b/include/linux/rfkill-wlan.h @@ -5,6 +5,7 @@ #include #include #include +#include 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 { diff --git a/net/rfkill/rfkill-wlan.c b/net/rfkill/rfkill-wlan.c index f8ee30532b8c..7c1e3da3383a 100644 --- a/net/rfkill/rfkill-wlan.c +++ b/net/rfkill/rfkill-wlan.c @@ -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