Merge "cnss2: Add code to support multiple device attaches via sub nodes" into wlan-platform.lnx.1.0

Bu işleme şunda yer alıyor:
CNSS_WLAN Service
2022-05-02 06:31:01 -07:00
işlemeyi yapan: Gerrit - the friendly Code Review server
işleme 1e3aa26d53
3 değiştirilmiş dosya ile 103 ekleme ve 2 silme

Dosyayı Görüntüle

@@ -3692,6 +3692,7 @@ static const struct platform_device_id cnss_platform_id_table[] = {
{ .name = "qca6390", .driver_data = QCA6390_DEVICE_ID, }, { .name = "qca6390", .driver_data = QCA6390_DEVICE_ID, },
{ .name = "qca6490", .driver_data = QCA6490_DEVICE_ID, }, { .name = "qca6490", .driver_data = QCA6490_DEVICE_ID, },
{ .name = "kiwi", .driver_data = KIWI_DEVICE_ID, }, { .name = "kiwi", .driver_data = KIWI_DEVICE_ID, },
{ .name = "qcaconv", .driver_data = 0, },
{ }, { },
}; };
@@ -3711,6 +3712,9 @@ static const struct of_device_id cnss_of_match_table[] = {
{ {
.compatible = "qcom,cnss-kiwi", .compatible = "qcom,cnss-kiwi",
.data = (void *)&cnss_platform_id_table[4]}, .data = (void *)&cnss_platform_id_table[4]},
{
.compatible = "qcom,cnss-qca-converged",
.data = (void *)&cnss_platform_id_table[5]},
{ }, { },
}; };
MODULE_DEVICE_TABLE(of, cnss_of_match_table); MODULE_DEVICE_TABLE(of, cnss_of_match_table);
@@ -3722,6 +3726,67 @@ cnss_use_nv_mac(struct cnss_plat_data *plat_priv)
"use-nv-mac"); "use-nv-mac");
} }
static int cnss_get_dev_cfg_node(struct cnss_plat_data *plat_priv)
{
struct device_node *child;
u32 id, i;
int id_n, ret;
int wlan_sw_ctrl_gpio = plat_priv->pinctrl_info.wlan_sw_ctrl_gpio;
u8 gpio_value;
if (!plat_priv->is_converged_dt)
return 0;
gpio_value = gpio_get_value(wlan_sw_ctrl_gpio);
cnss_pr_dbg("Value of WLAN_SW_CTRL GPIO: %d\n", gpio_value);
for_each_available_child_of_node(plat_priv->plat_dev->dev.of_node,
child) {
if (strcmp(child->name, "chip_cfg"))
continue;
id_n = of_property_count_u32_elems(child, "supported-ids");
if (id_n <= 0) {
cnss_pr_err("Device id is NOT set\n");
return -EINVAL;
}
for (i = 0; i < id_n; i++) {
ret = of_property_read_u32_index(child,
"supported-ids",
i, &id);
if (ret) {
cnss_pr_err("Failed to read supported ids\n");
return -EINVAL;
}
if (gpio_value && id == QCA6490_DEVICE_ID) {
plat_priv->plat_dev->dev.of_node = child;
plat_priv->device_id = QCA6490_DEVICE_ID;
cnss_pr_dbg("got node[%s@%d] for device[0x%x]\n",
child->name, i, id);
return 0;
} else if (!gpio_value && id == KIWI_DEVICE_ID) {
plat_priv->plat_dev->dev.of_node = child;
plat_priv->device_id = KIWI_DEVICE_ID;
cnss_pr_dbg("got node[%s@%d] for device[0x%x]\n",
child->name, i, id);
return 0;
}
}
}
return -EINVAL;
}
static inline bool
cnss_is_converged_dt(struct cnss_plat_data *plat_priv)
{
return of_property_read_bool(plat_priv->plat_dev->dev.of_node,
"qcom,converged-dt");
}
static int cnss_probe(struct platform_device *plat_dev) static int cnss_probe(struct platform_device *plat_dev)
{ {
int ret = 0; int ret = 0;
@@ -3754,10 +3819,20 @@ static int cnss_probe(struct platform_device *plat_dev)
plat_priv->plat_dev = plat_dev; plat_priv->plat_dev = plat_dev;
plat_priv->device_id = device_id->driver_data; plat_priv->device_id = device_id->driver_data;
plat_priv->bus_type = cnss_get_bus_type(plat_priv->device_id); plat_priv->is_converged_dt = cnss_is_converged_dt(plat_priv);
plat_priv->use_nv_mac = cnss_use_nv_mac(plat_priv);
plat_priv->use_fw_path_with_prefix = plat_priv->use_fw_path_with_prefix =
cnss_use_fw_path_with_prefix(plat_priv); cnss_use_fw_path_with_prefix(plat_priv);
cnss_get_wlan_sw_ctrl(plat_priv);
ret = cnss_get_dev_cfg_node(plat_priv);
if (ret) {
cnss_pr_err("Failed to get device cfg node, err = %d\n", ret);
goto reset_plat_dev;
}
plat_priv->bus_type = cnss_get_bus_type(plat_priv->device_id);
plat_priv->use_nv_mac = cnss_use_nv_mac(plat_priv);
cnss_set_plat_priv(plat_dev, plat_priv); cnss_set_plat_priv(plat_dev, plat_priv);
platform_set_drvdata(plat_dev, plat_priv); platform_set_drvdata(plat_dev, plat_priv);
INIT_LIST_HEAD(&plat_priv->vreg_list); INIT_LIST_HEAD(&plat_priv->vreg_list);
@@ -3862,6 +3937,7 @@ free_res:
cnss_put_resources(plat_priv); cnss_put_resources(plat_priv);
reset_ctx: reset_ctx:
platform_set_drvdata(plat_dev, NULL); platform_set_drvdata(plat_dev, NULL);
reset_plat_dev:
cnss_set_plat_priv(plat_dev, NULL); cnss_set_plat_priv(plat_dev, NULL);
out: out:
return ret; return ret;

Dosyayı Görüntüle

@@ -111,6 +111,7 @@ struct cnss_pinctrl_info {
struct pinctrl_state *wlan_en_sleep; struct pinctrl_state *wlan_en_sleep;
int bt_en_gpio; int bt_en_gpio;
int xo_clk_gpio; /*qca6490 only */ int xo_clk_gpio; /*qca6490 only */
int wlan_sw_ctrl_gpio;
}; };
#if IS_ENABLED(CONFIG_MSM_SUBSYSTEM_RESTART) #if IS_ENABLED(CONFIG_MSM_SUBSYSTEM_RESTART)
@@ -536,6 +537,7 @@ struct cnss_plat_data {
const char *vreg_ol_cpr, *vreg_ipa; const char *vreg_ol_cpr, *vreg_ipa;
bool adsp_pc_enabled; bool adsp_pc_enabled;
u64 feature_list; u64 feature_list;
u32 is_converged_dt;
}; };
#if IS_ENABLED(CONFIG_ARCH_QCOM) #if IS_ENABLED(CONFIG_ARCH_QCOM)
@@ -577,6 +579,7 @@ void cnss_put_clk(struct cnss_plat_data *plat_priv);
int cnss_vreg_unvote_type(struct cnss_plat_data *plat_priv, int cnss_vreg_unvote_type(struct cnss_plat_data *plat_priv,
enum cnss_vreg_type type); enum cnss_vreg_type type);
int cnss_get_pinctrl(struct cnss_plat_data *plat_priv); int cnss_get_pinctrl(struct cnss_plat_data *plat_priv);
int cnss_get_wlan_sw_ctrl(struct cnss_plat_data *plat_priv);
int cnss_power_on_device(struct cnss_plat_data *plat_priv); int cnss_power_on_device(struct cnss_plat_data *plat_priv);
void cnss_power_off_device(struct cnss_plat_data *plat_priv); void cnss_power_off_device(struct cnss_plat_data *plat_priv);
bool cnss_is_device_powered_on(struct cnss_plat_data *plat_priv); bool cnss_is_device_powered_on(struct cnss_plat_data *plat_priv);

Dosyayı Görüntüle

@@ -65,6 +65,7 @@ static struct cnss_clk_cfg cnss_clk_list[] = {
#define WLAN_EN_GPIO "wlan-en-gpio" #define WLAN_EN_GPIO "wlan-en-gpio"
#define BT_EN_GPIO "qcom,bt-en-gpio" #define BT_EN_GPIO "qcom,bt-en-gpio"
#define XO_CLK_GPIO "qcom,xo-clk-gpio" #define XO_CLK_GPIO "qcom,xo-clk-gpio"
#define WLAN_SW_CTRL_GPIO "qcom,wlan-sw-ctrl-gpio"
#define WLAN_EN_ACTIVE "wlan_en_active" #define WLAN_EN_ACTIVE "wlan_en_active"
#define WLAN_EN_SLEEP "wlan_en_sleep" #define WLAN_EN_SLEEP "wlan_en_sleep"
@@ -789,6 +790,27 @@ out:
return ret; return ret;
} }
int cnss_get_wlan_sw_ctrl(struct cnss_plat_data *plat_priv)
{
struct device *dev;
struct cnss_pinctrl_info *pinctrl_info;
dev = &plat_priv->plat_dev->dev;
pinctrl_info = &plat_priv->pinctrl_info;
if (of_find_property(dev->of_node, WLAN_SW_CTRL_GPIO, NULL)) {
pinctrl_info->wlan_sw_ctrl_gpio = of_get_named_gpio(dev->of_node,
WLAN_SW_CTRL_GPIO,
0);
cnss_pr_dbg("WLAN Switch control GPIO: %d\n",
pinctrl_info->wlan_sw_ctrl_gpio);
} else {
pinctrl_info->wlan_sw_ctrl_gpio = -EINVAL;
}
return 0;
}
#define CNSS_XO_CLK_RETRY_COUNT_MAX 5 #define CNSS_XO_CLK_RETRY_COUNT_MAX 5
static void cnss_set_xo_clk_gpio_state(struct cnss_plat_data *plat_priv, static void cnss_set_xo_clk_gpio_state(struct cnss_plat_data *plat_priv,
bool enable) bool enable)