Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5ee35580 authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "dts: sa8155: add qca6390 support in converged wlan dt node"

parents 906c8bd4 590cfd18
Loading
Loading
Loading
Loading
+43 −0
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@ Required properties:
  - compatible: "qcom,cnss" for QCA6174 device
                "qcom,cnss-qca6290" for QCA6290 device
                "qcom,cnss-qca6390" for QCA6390 device
                "qcom,cnss-qca-converged" for converged QCA devices
  - wlan-en-gpio: WLAN_EN GPIO signal specified by the chip specifications
  - vdd-wlan-supply: phandle to the regulator device tree node
  - pinctrl-names: Names corresponding to the numbered pinctrl states
@@ -63,6 +64,24 @@ Optional properties:
                       specifications, should be drived depending on products.
  - cnss-daemon-support: Boolean property to decide whether cnss_daemon
                         userspace QMI client is supported.
  - qcom,converged-dt: Boolean property to decide whether it supports multiple
                       chips.
  - qcom,bus-type: U32 property to specify the bus type, is required when
                   'qcom,converged-dt' being present.
  - wlan_vregs: String array to decide which vregs are required, is required
                when 'qcom,converged-dt' being present.
  - <supply-name>-supply: phandle to the regulator device tree node.
                          optional "supply-name" is "vdd-wlan-rfa".
  - qcom,<supply-name>-info: Specifies configuration for supply. Should be
                             specified in <min_uV max_uV load_uA delay_us>.

List of chip specific sub nodes:
  - chip_cfg@X: represent chip specific configurations
    Each sub node has the following required properties:
       - wlan_vregs: String array to decide which vregs are required, property
                     being present but no values means no additional vregs.
       - supported-ids: U32 array to decide which device ids are supported by
                        sub node.

Example:

@@ -82,3 +101,27 @@ Example:
        qcom,mhi = <&mhi_wlan>;
        qcom,cap-tsf-gpio = <&tlmm 126 1>;
    };

    qcom,cnss-qca-converged {
        compatible = "qcom,cnss-qca-converged";
        qcom,converged-dt;
        qcom,bus-type=<0>;

        vdd-wlan-ctrl1-supply = <&vreg_conn_pa>;
        vdd-wlan-ctrl2-supply = <&vreg_conn_1p8>;
        vdd-wlan-supply = <&vreg_wlan>;
        wlan_vregs = "vdd-wlan-ctrl1", "vdd-wlan-ctrl2";
        qcom,vdd-wlan-ctrl1-info = <0 0 0 0>;
        qcom,vdd-wlan-ctrl2-info = <0 0 0 0>;
        wlan-en-gpio = <&tlmm 169 0>;
        pinctrl-names = "wlan_en_active", "wlan_en_sleep";
        pinctrl-0 = <&cnss_wlan_en_active>;
        pinctrl-1 = <&cnss_wlan_en_sleep>;
        qcom,wlan-rc-num = <0>;

        chip_cfg@1 {
                supported-ids = <0x003e>;
                wlan_vregs = "vdd-wlan";
                qcom,vdd-wlan-info = <0 0 0 10>;
        };
    };
+160 −22
Original line number Diff line number Diff line
@@ -736,22 +736,17 @@
		};
	};

	cnss_pcie: qcom,cnss {
		compatible = "qcom,cnss";
		wlan-en-gpio = <&tlmm 169 0>;
		vdd-wlan-supply = <&vreg_wlan>;
		vdd-wlan-ctrl1-supply = <&vreg_conn_pa>;
		vdd-wlan-ctrl2-supply = <&vreg_conn_1p8>;
		reg = <0x10000000 0x10000000>,
			<0x20000000 0x10000>;
		reg-names = "smmu_iova_base", "smmu_iova_ipa";
		qcom,notify-modem-status;
		pinctrl-names = "wlan_en_active", "wlan_en_sleep";
		pinctrl-0 = <&cnss_wlan_en_active>;
		pinctrl-1 = <&cnss_wlan_en_sleep>;
		qcom,wlan-rc-num = <0>;
		qcom,wlan-ramdump-dynamic = <0x200000>;
	qcom,cnss-qca6390@a0000000 {
		status = "disabled";
	};

	qcom,cnss-qca-converged {
		compatible = "qcom,cnss-qca-converged";

		qcom,converged-dt;
		qcom,wlan-rc-num = <0>;
		qcom,bus-type=<0>;
		qcom,notify-modem-status;
		qcom,msm-bus,name = "msm-cnss";
		qcom,msm-bus,num-cases = <4>;
		qcom,msm-bus,num-paths = <2>;
@@ -763,7 +758,150 @@
			<45 512 98572 655360>, <1 512 98572 1600000>,
			/* Upto 800 Mbps */
			<45 512 207108 1146880>, <1 512 207108 3124992>;

		#address-cells=<1>;
		#size-cells=<1>;
		ranges = <0x10000000 0x10000000 0x10000000>,
		      <0x20000000 0x20000000 0x10000>,
		      <0xa0000000 0xa0000000 0x10000000>,
		      <0xb0000000 0xb0000000 0x10000>;

		vdd-wlan-ctrl1-supply = <&vreg_conn_pa>;
		vdd-wlan-ctrl2-supply = <&vreg_conn_1p8>;
		vdd-wlan-supply = <&vreg_wlan>;
		vdd-wlan-aon-supply = <&pm8150_1_s6>;
		vdd-wlan-rfa1-supply = <&pm8150_2_s4>;
		vdd-wlan-rfa2-supply = <&pm8150_2_s5>;
		vdd-wlan-rfa3-supply = <&pm8150_2_l15>;

		wlan_vregs = "vdd-wlan-ctrl1", "vdd-wlan-ctrl2";
		qcom,vdd-wlan-ctrl1-info = <0 0 0 0>;
		qcom,vdd-wlan-ctrl2-info = <0 0 0 0>;
		wlan-en-gpio = <&tlmm 169 0>;
		pinctrl-names = "wlan_en_active", "wlan_en_sleep";
		pinctrl-0 = <&cnss_wlan_en_active>;
		pinctrl-1 = <&cnss_wlan_en_sleep>;

		chip_cfg@0 {
			reg = <0x10000000 0x10000000>,
			    <0x20000000 0x10000>;
			reg-names = "smmu_iova_base", "smmu_iova_ipa";

			supported-ids = <0x003e>;
			wlan_vregs = "vdd-wlan";
			qcom,vdd-wlan-info = <0 0 0 10>;

			qcom,smmu-s1-enable;
			qcom,wlan-ramdump-dynamic = <0x200000>;
		};

		chip_cfg@1 {
			reg = <0xa0000000 0x10000000>,
			    <0xb0000000 0x10000>;
			reg-names = "smmu_iova_base", "smmu_iova_ipa";

			supported-ids = <0x1101>;
			wlan_vregs = "vdd-wlan-aon", "vdd-wlan-rfa1",
				   "vdd-wlan-rfa2", "vdd-wlan-rfa3";
			qcom,vdd-wlan-aon-info = <1055000 1055000 0 0>;
			qcom,vdd-wlan-rfa1-info = <1350000 1350000 0 0>;
			qcom,vdd-wlan-rfa2-info = <2040000 2040000 0 0>;
			qcom,vdd-wlan-rfa3-info = <1900000 1900000 0 0>;

			qcom,wlan-ramdump-dynamic = <0x400000>;
			mhi,max-channels = <30>;
			mhi,timeout = <10000>;

			mhi_channels {
				mhi_chan@0 {
					reg = <0>;
					label = "LOOPBACK";
					mhi,num-elements = <32>;
					mhi,event-ring = <1>;
					mhi,chan-dir = <1>;
					mhi,data-type = <0>;
					mhi,doorbell-mode = <2>;
					mhi,ee = <0x14>;
				};

				mhi_chan@1 {
					reg = <1>;
					label = "LOOPBACK";
					mhi,num-elements = <32>;
					mhi,event-ring = <1>;
					mhi,chan-dir = <2>;
					mhi,data-type = <0>;
					mhi,doorbell-mode = <2>;
					mhi,ee = <0x14>;
				};

				mhi_chan@4 {
					reg = <4>;
					label = "DIAG";
					mhi,num-elements = <32>;
					mhi,event-ring = <1>;
					mhi,chan-dir = <1>;
					mhi,data-type = <0>;
					mhi,doorbell-mode = <2>;
					mhi,ee = <0x14>;
				};

				mhi_chan@5 {
					reg = <5>;
					label = "DIAG";
					mhi,num-elements = <32>;
					mhi,event-ring = <1>;
					mhi,chan-dir = <2>;
					mhi,data-type = <0>;
					mhi,doorbell-mode = <2>;
					mhi,ee = <0x14>;
				};

				mhi_chan@20 {
					reg = <20>;
					label = "IPCR";
					mhi,num-elements = <32>;
					mhi,event-ring = <1>;
					mhi,chan-dir = <1>;
					mhi,data-type = <1>;
					mhi,doorbell-mode = <2>;
					mhi,ee = <0x14>;
					mhi,auto-start;
				};

				mhi_chan@21 {
					reg = <21>;
					label = "IPCR";
					mhi,num-elements = <32>;
					mhi,event-ring = <1>;
					mhi,chan-dir = <2>;
					mhi,data-type = <0>;
					mhi,doorbell-mode = <2>;
					mhi,ee = <0x14>;
					mhi,auto-queue;
					mhi,auto-start;
				};
			};

			mhi_events {
				mhi_event@0 {
					mhi,num-elements = <32>;
					mhi,intmod = <1>;
					mhi,msi = <1>;
					mhi,priority = <1>;
					mhi,brstmode = <2>;
					mhi,data-type = <1>;
				};

				mhi_event@1 {
					mhi,num-elements = <256>;
					mhi,intmod = <1>;
					mhi,msi = <2>;
					mhi,priority = <1>;
					mhi,brstmode = <2>;
				};
			};
		};
	};
};

+26 −6
Original line number Diff line number Diff line
/* Copyright (c) 2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -28,17 +28,37 @@ enum cnss_dev_bus_type cnss_get_dev_bus_type(struct device *dev)
		return CNSS_BUS_NONE;
}

enum cnss_dev_bus_type cnss_get_bus_type(unsigned long device_id)
enum cnss_dev_bus_type cnss_get_bus_type(struct cnss_plat_data *plat_priv)
{
	switch (device_id) {
	int ret;
	struct device *dev;
	u32 bus_type = CNSS_BUS_NONE;

	if (plat_priv->is_converged_dt) {
		dev = &plat_priv->plat_dev->dev;
		ret = of_property_read_u32(dev->of_node, "qcom,bus-type",
					   &bus_type);
		if (!ret)
			cnss_pr_dbg("Got bus type[%u] from dt\n", bus_type);
		else
			cnss_pr_err("No bus type for converged dt\n");

		return bus_type;
	}

	/* Get bus type according to device id if it's not converged DT */
	switch (plat_priv->device_id) {
	case QCA6174_DEVICE_ID:
	case QCA6290_DEVICE_ID:
	case QCA6390_DEVICE_ID:
		return CNSS_BUS_PCI;
		bus_type = CNSS_BUS_PCI;
		break;
	default:
		cnss_pr_err("Unknown device_id: 0x%lx\n", device_id);
		return CNSS_BUS_NONE;
		cnss_pr_err("Unknown device: 0x%lx\n", plat_priv->device_id);
		break;
	}

	return bus_type;
}

void *cnss_bus_dev_to_bus_priv(struct device *dev)
+2 −2
Original line number Diff line number Diff line
/* Copyright (c) 2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -26,7 +26,7 @@
#define QCA6390_DEVICE_ID		0x1101

enum cnss_dev_bus_type cnss_get_dev_bus_type(struct device *dev);
enum cnss_dev_bus_type cnss_get_bus_type(unsigned long device_id);
enum cnss_dev_bus_type cnss_get_bus_type(struct cnss_plat_data *plat_priv);
void *cnss_bus_dev_to_bus_priv(struct device *dev);
struct cnss_plat_data *cnss_bus_dev_to_plat_priv(struct device *dev);
int cnss_bus_init(struct cnss_plat_data *plat_priv);
+61 −6
Original line number Diff line number Diff line
@@ -642,6 +642,8 @@ static int cnss_get_resources(struct cnss_plat_data *plat_priv)

static void cnss_put_resources(struct cnss_plat_data *plat_priv)
{
	cnss_put_pinctrl(plat_priv);
	cnss_put_vreg(plat_priv);
}

static int cnss_modem_notifier_nb(struct notifier_block *nb,
@@ -759,7 +761,7 @@ static int cnss_subsys_powerup(const struct subsys_desc *subsys_desc)
	}

	if (!plat_priv->driver_state) {
		cnss_pr_dbg("Powerup is ignored\n");
		cnss_pr_dbg("subsys powerup is ignored\n");
		return 0;
	}

@@ -783,7 +785,7 @@ static int cnss_subsys_shutdown(const struct subsys_desc *subsys_desc,
	}

	if (!plat_priv->driver_state) {
		cnss_pr_dbg("shutdown is ignored\n");
		cnss_pr_dbg("subsys shutdown is ignored\n");
		return 0;
	}

@@ -1293,7 +1295,8 @@ static int cnss_register_ramdump_v1(struct cnss_plat_data *plat_priv)
	subsys_info = &plat_priv->subsys_info;
	ramdump_info = &plat_priv->ramdump_info;

	if (of_property_read_u32(dev->of_node, "qcom,wlan-ramdump-dynamic",
	if (of_property_read_u32(plat_priv->dev_node,
				 "qcom,wlan-ramdump-dynamic",
				 &ramdump_size) == 0) {
		ramdump_info->ramdump_va =
			dma_alloc_coherent(dev, ramdump_size,
@@ -1358,14 +1361,14 @@ static int cnss_register_ramdump_v2(struct cnss_plat_data *plat_priv)
	struct cnss_ramdump_info_v2 *info_v2;
	struct cnss_dump_data *dump_data;
	struct msm_dump_entry dump_entry;
	struct device *dev = &plat_priv->plat_dev->dev;
	u32 ramdump_size = 0;

	subsys_info = &plat_priv->subsys_info;
	info_v2 = &plat_priv->ramdump_info_v2;
	dump_data = &info_v2->dump_data;

	if (of_property_read_u32(dev->of_node, "qcom,wlan-ramdump-dynamic",
	if (of_property_read_u32(plat_priv->dev_node,
				 "qcom,wlan-ramdump-dynamic",
				 &ramdump_size) == 0)
		info_v2->ramdump_size = ramdump_size;

@@ -1625,6 +1628,7 @@ static const struct platform_device_id cnss_platform_id_table[] = {
	{ .name = "qca6174", .driver_data = QCA6174_DEVICE_ID, },
	{ .name = "qca6290", .driver_data = QCA6290_DEVICE_ID, },
	{ .name = "qca6390", .driver_data = QCA6390_DEVICE_ID, },
	{ .name = "qcaconv", .driver_data = 0},
};

static const struct of_device_id cnss_of_match_table[] = {
@@ -1637,10 +1641,55 @@ static const struct of_device_id cnss_of_match_table[] = {
	{
		.compatible = "qcom,cnss-qca6390",
		.data = (void *)&cnss_platform_id_table[2]},
	{
		.compatible = "qcom,cnss-qca-converged",
		.data = (void *)&cnss_platform_id_table[3]},
	{ },
};
MODULE_DEVICE_TABLE(of, cnss_of_match_table);

struct cnss_fw_path {
	unsigned long device_id;
	const char path[CNSS_FW_PATH_MAX_LEN];
};

static const struct cnss_fw_path cnss_fw_path_table[] = {
	{ QCA6174_DEVICE_ID, "qca6174/" },
	{ QCA6290_DEVICE_ID, "qca6290/" },
	{ QCA6390_DEVICE_ID, "qca6390/" },
	{ 0, "" }
};

const char *cnss_get_fw_path(struct cnss_plat_data *plat_priv)
{
	const struct cnss_fw_path *fw_path;
	const char *path;
	int size = ARRAY_SIZE(cnss_fw_path_table);

	if (!plat_priv->is_converged_dt) {
		path = cnss_fw_path_table[size - 1].path;
	} else {
		fw_path = cnss_fw_path_table;
		while (fw_path->device_id &&
		       fw_path->device_id != plat_priv->device_id) {
			fw_path++;
		}

		path = fw_path->path;
	}

	cnss_pr_dbg("get firmware path[%s] for device[0x%lx]\n",
		    path, plat_priv->device_id);
	return path;
}

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)
{
	int ret = 0;
@@ -1671,10 +1720,16 @@ static int cnss_probe(struct platform_device *plat_dev)
	}

	plat_priv->plat_dev = plat_dev;
	plat_priv->dev_node = NULL;
	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);
	cnss_pr_dbg("Probing platform driver from %s DT\n",
		    plat_priv->is_converged_dt ? "converged" : "single");

	plat_priv->bus_type = cnss_get_bus_type(plat_priv);
	cnss_set_plat_priv(plat_dev, plat_priv);
	platform_set_drvdata(plat_dev, plat_priv);
	INIT_LIST_HEAD(&plat_priv->vreg_list);

	cnss_init_control_params(plat_priv);

Loading