linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/5] Enable Bluetooth functinality for WCN6750
@ 2021-05-06 17:33 Venkata Lakshmi Narayana Gubba
  2021-05-06 17:33 ` [PATCH v3 1/5] Bluetooth: hci_qca: Add support for QTI Bluetooth chip wcn6750 Venkata Lakshmi Narayana Gubba
                   ` (4 more replies)
  0 siblings, 5 replies; 16+ messages in thread
From: Venkata Lakshmi Narayana Gubba @ 2021-05-06 17:33 UTC (permalink / raw)
  To: marcel, johan.hedberg, devicetree
  Cc: mka, linux-kernel, linux-bluetooth, hemantg, linux-arm-msm,
	bgodavar, rjliao, hbandi, abhishekpandit,
	Venkata Lakshmi Narayana Gubba

These patches enables Bluetooth functinalties for new Qualcomm
Bluetooth SoC wcn6750.

Venkata Lakshmi Narayana Gubba (5):
  Bluetooth: hci_qca: Add support for QTI Bluetooth chip wcn6750
  Bluetooth: btqca: Add support for firmware image with mbn type for
    WCN6750
  Bluetooth: btqca: Moved extracting rom version info to common place
  dt-bindings: net: bluetooth: Convert Qualcomm BT binding to DT schema
  dt-bindings: net: bluetooth: Add device tree bindings for QTI chip
    wcn6750

 .../devicetree/bindings/net/qualcomm-bluetooth.txt |  69 --------
 .../bindings/net/qualcomm-bluetooth.yaml           | 182 +++++++++++++++++++++
 drivers/bluetooth/btqca.c                          |  91 ++++++++---
 drivers/bluetooth/btqca.h                          |  14 +-
 drivers/bluetooth/hci_qca.c                        | 114 ++++++++++---
 5 files changed, 354 insertions(+), 116 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
 create mode 100644 Documentation/devicetree/bindings/net/qualcomm-bluetooth.yaml

-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member 
of Code Aurora Forum, hosted by The Linux Foundation


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v3 1/5] Bluetooth: hci_qca: Add support for QTI Bluetooth chip wcn6750
  2021-05-06 17:33 [PATCH v3 0/5] Enable Bluetooth functinality for WCN6750 Venkata Lakshmi Narayana Gubba
@ 2021-05-06 17:33 ` Venkata Lakshmi Narayana Gubba
  2021-05-06 17:33 ` [PATCH v3 2/5] Bluetooth: btqca: Add support for firmware image with mbn type for WCN6750 Venkata Lakshmi Narayana Gubba
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 16+ messages in thread
From: Venkata Lakshmi Narayana Gubba @ 2021-05-06 17:33 UTC (permalink / raw)
  To: marcel, johan.hedberg, devicetree
  Cc: mka, linux-kernel, linux-bluetooth, hemantg, linux-arm-msm,
	bgodavar, rjliao, hbandi, abhishekpandit,
	Venkata Lakshmi Narayana Gubba

Added regulators,GPIOs and changes required to power on/off wcn6750.
Added support for firmware download for wcn6750.

Changes done in detail:
1. Added regulators and corresponding current values.
2. Added sw_ctrl GPIO pin which is output from BT SoC and indicates
   status of clock supply to BT SoC.
3. Added inline function to check if the SoC type is wcn6750.
4. Modified the function qca_wcn3990_init() to support wcn6750 and
   renamed it to qca_regulator_init().

Signed-off-by: Venkata Lakshmi Narayana Gubba <gubbaven@codeaurora.org>
---
 drivers/bluetooth/btqca.c   |  13 ++++-
 drivers/bluetooth/btqca.h   |  11 +++++
 drivers/bluetooth/hci_qca.c | 114 ++++++++++++++++++++++++++++++++++++--------
 3 files changed, 115 insertions(+), 23 deletions(-)

diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c
index 25114f0..fce808c 100644
--- a/drivers/bluetooth/btqca.c
+++ b/drivers/bluetooth/btqca.c
@@ -517,6 +517,11 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
 			    (soc_ver & 0x0000000f);
 		snprintf(config.fwname, sizeof(config.fwname),
 			 "qca/htbtfw%02x.tlv", rom_ver);
+	} else if (soc_type == QCA_WCN6750) {
+		rom_ver = ((soc_ver & 0x00000f00) >> 0x04) |
+			    (soc_ver & 0x0000000f);
+		snprintf(config.fwname, sizeof(config.fwname),
+			 "qca/msbtfw%02x.tlv", rom_ver);
 	} else {
 		snprintf(config.fwname, sizeof(config.fwname),
 			 "qca/rampatch_%08x.bin", soc_ver);
@@ -548,6 +553,9 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
 	else if (soc_type == QCA_QCA6390)
 		snprintf(config.fwname, sizeof(config.fwname),
 			 "qca/htnv%02x.bin", rom_ver);
+	else if (soc_type == QCA_WCN6750)
+		snprintf(config.fwname, sizeof(config.fwname),
+			 "qca/msnv%02x.bin", rom_ver);
 	else
 		snprintf(config.fwname, sizeof(config.fwname),
 			 "qca/nvm_%08x.bin", soc_ver);
@@ -564,13 +572,14 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
 			return err;
 	}
 
-	/* WCN399x supports the Microsoft vendor extension with 0xFD70 as the
+	/* WCN399x and WCN6750 supports the Microsoft vendor extension with 0xFD70 as the
 	 * VsMsftOpCode.
 	 */
 	switch (soc_type) {
 	case QCA_WCN3990:
 	case QCA_WCN3991:
 	case QCA_WCN3998:
+	case QCA_WCN6750:
 		hci_set_msft_opcode(hdev, 0xFD70);
 		break;
 	default:
@@ -584,7 +593,7 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
 		return err;
 	}
 
-	if (soc_type == QCA_WCN3991) {
+	if (soc_type == QCA_WCN3991 || soc_type == QCA_WCN6750) {
 		/* get fw build info */
 		err = qca_read_fw_build_info(hdev);
 		if (err < 0)
diff --git a/drivers/bluetooth/btqca.h b/drivers/bluetooth/btqca.h
index b19add7..dd82d2c 100644
--- a/drivers/bluetooth/btqca.h
+++ b/drivers/bluetooth/btqca.h
@@ -143,6 +143,7 @@ enum qca_btsoc_type {
 	QCA_WCN3998,
 	QCA_WCN3991,
 	QCA_QCA6390,
+	QCA_WCN6750
 };
 
 #if IS_ENABLED(CONFIG_BT_QCA)
@@ -160,6 +161,11 @@ static inline bool qca_is_wcn399x(enum qca_btsoc_type soc_type)
 	return soc_type == QCA_WCN3990 || soc_type == QCA_WCN3991 ||
 	       soc_type == QCA_WCN3998;
 }
+static inline bool qca_is_wcn6750(enum qca_btsoc_type soc_type)
+{
+	return soc_type == QCA_WCN6750;
+}
+
 #else
 
 static inline int qca_set_bdaddr_rome(struct hci_dev *hdev, const bdaddr_t *bdaddr)
@@ -192,6 +198,11 @@ static inline bool qca_is_wcn399x(enum qca_btsoc_type soc_type)
 	return false;
 }
 
+static inline bool qca_is_wcn6750(enum qca_btsoc_type soc_type)
+{
+	return false;
+}
+
 static inline int qca_send_pre_shutdown_cmd(struct hci_dev *hdev)
 {
 	return -EOPNOTSUPP;
diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index 0a00569..0d7a1c5 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -218,6 +218,7 @@ struct qca_power {
 struct qca_serdev {
 	struct hci_uart	 serdev_hu;
 	struct gpio_desc *bt_en;
+	struct gpio_desc *sw_ctrl;
 	struct clk	 *susclk;
 	enum qca_btsoc_type btsoc_type;
 	struct qca_power *bt_power;
@@ -604,7 +605,8 @@ static int qca_open(struct hci_uart *hu)
 	if (hu->serdev) {
 		qcadev = serdev_device_get_drvdata(hu->serdev);
 
-		if (qca_is_wcn399x(qcadev->btsoc_type))
+		if (qca_is_wcn399x(qcadev->btsoc_type) ||
+		    qca_is_wcn6750(qcadev->btsoc_type))
 			hu->init_speed = qcadev->init_speed;
 
 		if (qcadev->oper_speed)
@@ -1308,7 +1310,8 @@ static int qca_set_baudrate(struct hci_dev *hdev, uint8_t baudrate)
 		      msecs_to_jiffies(CMD_TRANS_TIMEOUT_MS));
 
 	/* Give the controller time to process the request */
-	if (qca_is_wcn399x(qca_soc_type(hu)))
+	if (qca_is_wcn399x(qca_soc_type(hu)) ||
+	    qca_is_wcn6750(qca_soc_type(hu)))
 		usleep_range(1000, 10000);
 	else
 		msleep(300);
@@ -1384,7 +1387,8 @@ static unsigned int qca_get_speed(struct hci_uart *hu,
 
 static int qca_check_speeds(struct hci_uart *hu)
 {
-	if (qca_is_wcn399x(qca_soc_type(hu))) {
+	if (qca_is_wcn399x(qca_soc_type(hu)) ||
+	    qca_is_wcn6750(qca_soc_type(hu))) {
 		if (!qca_get_speed(hu, QCA_INIT_SPEED) &&
 		    !qca_get_speed(hu, QCA_OPER_SPEED))
 			return -EINVAL;
@@ -1417,7 +1421,8 @@ static int qca_set_speed(struct hci_uart *hu, enum qca_speed_type speed_type)
 		/* Disable flow control for wcn3990 to deassert RTS while
 		 * changing the baudrate of chip and host.
 		 */
-		if (qca_is_wcn399x(soc_type))
+		if (qca_is_wcn399x(soc_type) ||
+		    qca_is_wcn6750(soc_type))
 			hci_uart_set_flow_control(hu, true);
 
 		if (soc_type == QCA_WCN3990) {
@@ -1434,7 +1439,8 @@ static int qca_set_speed(struct hci_uart *hu, enum qca_speed_type speed_type)
 		host_set_baudrate(hu, speed);
 
 error:
-		if (qca_is_wcn399x(soc_type))
+		if (qca_is_wcn399x(soc_type) ||
+		    qca_is_wcn6750(soc_type))
 			hci_uart_set_flow_control(hu, false);
 
 		if (soc_type == QCA_WCN3990) {
@@ -1585,10 +1591,12 @@ static bool qca_prevent_wake(struct hci_dev *hdev)
 	return !wakeup;
 }
 
-static int qca_wcn3990_init(struct hci_uart *hu)
+static int qca_regulator_init(struct hci_uart *hu)
 {
+	enum qca_btsoc_type soc_type = qca_soc_type(hu);
 	struct qca_serdev *qcadev;
 	int ret;
+	bool sw_ctrl_state;
 
 	/* Check for vregs status, may be hci down has turned
 	 * off the voltage regulator.
@@ -1607,16 +1615,33 @@ static int qca_wcn3990_init(struct hci_uart *hu)
 		}
 	}
 
-	/* Forcefully enable wcn3990 to enter in to boot mode. */
-	host_set_baudrate(hu, 2400);
-	ret = qca_send_power_pulse(hu, false);
-	if (ret)
-		return ret;
+	if (qca_is_wcn399x(soc_type)) {
+		/* Forcefully enable wcn399x to enter in to boot mode. */
+		host_set_baudrate(hu, 2400);
+		ret = qca_send_power_pulse(hu, false);
+		if (ret)
+			return ret;
+	}
+
+	/* For wcn6750 need to enable gpio bt_en */
+	if (qcadev->bt_en) {
+		gpiod_set_value_cansleep(qcadev->bt_en, 0);
+		msleep(50);
+		gpiod_set_value_cansleep(qcadev->bt_en, 1);
+		msleep(50);
+		if (qcadev->sw_ctrl) {
+			sw_ctrl_state = gpiod_get_value_cansleep(qcadev->sw_ctrl);
+			bt_dev_dbg(hu->hdev, "SW_CTRL is %d", sw_ctrl_state);
+		}
+	}
 
 	qca_set_speed(hu, QCA_INIT_SPEED);
-	ret = qca_send_power_pulse(hu, true);
-	if (ret)
-		return ret;
+
+	if (qca_is_wcn399x(soc_type)) {
+		ret = qca_send_power_pulse(hu, true);
+		if (ret)
+			return ret;
+	}
 
 	/* Now the device is in ready state to communicate with host.
 	 * To sync host with device we need to reopen port.
@@ -1649,8 +1674,9 @@ static int qca_power_on(struct hci_dev *hdev)
 	if (!hu->serdev)
 		return 0;
 
-	if (qca_is_wcn399x(soc_type)) {
-		ret = qca_wcn3990_init(hu);
+	if (qca_is_wcn399x(soc_type) ||
+	    qca_is_wcn6750(soc_type)) {
+		ret = qca_regulator_init(hu);
 	} else {
 		qcadev = serdev_device_get_drvdata(hu->serdev);
 		if (qcadev->bt_en) {
@@ -1689,7 +1715,8 @@ static int qca_setup(struct hci_uart *hu)
 	set_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks);
 
 	bt_dev_info(hdev, "setting up %s",
-		qca_is_wcn399x(soc_type) ? "wcn399x" : "ROME/QCA6390");
+		qca_is_wcn399x(soc_type) ? "wcn399x" :
+		(soc_type == QCA_WCN6750) ? "wcn6750" : "ROME/QCA6390");
 
 	qca->memdump_state = QCA_MEMDUMP_IDLE;
 
@@ -1700,7 +1727,8 @@ static int qca_setup(struct hci_uart *hu)
 
 	clear_bit(QCA_SSR_TRIGGERED, &qca->flags);
 
-	if (qca_is_wcn399x(soc_type)) {
+	if (qca_is_wcn399x(soc_type) ||
+	    qca_is_wcn6750(soc_type)) {
 		set_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks);
 
 		ret = qca_read_soc_version(hdev, &ver, soc_type);
@@ -1720,7 +1748,8 @@ static int qca_setup(struct hci_uart *hu)
 		qca_baudrate = qca_get_baudrate_value(speed);
 	}
 
-	if (!qca_is_wcn399x(soc_type)) {
+	if (!(qca_is_wcn399x(soc_type) ||
+	     qca_is_wcn6750(soc_type))) {
 		/* Get QCA version information */
 		ret = qca_read_soc_version(hdev, &ver, soc_type);
 		if (ret)
@@ -1828,12 +1857,30 @@ static const struct qca_device_data qca_soc_data_qca6390 = {
 	.num_vregs = 0,
 };
 
+static const struct qca_device_data qca_soc_data_wcn6750 = {
+	.soc_type = QCA_WCN6750,
+	.vregs = (struct qca_vreg []) {
+		{ "vddio", 5000 },
+		{ "vddaon", 26000 },
+		{ "vddbtcxmx", 126000 },
+		{ "vddrfacmn", 12500 },
+		{ "vddrfa0p8", 102000 },
+		{ "vddrfa1p7", 302000 },
+		{ "vddrfa1p2", 257000 },
+		{ "vddrfa2p2", 1700000 },
+		{ "vddasd", 200 },
+	},
+	.num_vregs = 9,
+	.capabilities = QCA_CAP_WIDEBAND_SPEECH | QCA_CAP_VALID_LE_STATES,
+};
+
 static void qca_power_shutdown(struct hci_uart *hu)
 {
 	struct qca_serdev *qcadev;
 	struct qca_data *qca = hu->priv;
 	unsigned long flags;
 	enum qca_btsoc_type soc_type = qca_soc_type(hu);
+	bool sw_ctrl_state;
 
 	qcadev = serdev_device_get_drvdata(hu->serdev);
 
@@ -1856,6 +1903,14 @@ static void qca_power_shutdown(struct hci_uart *hu)
 		host_set_baudrate(hu, 2400);
 		qca_send_power_pulse(hu, false);
 		qca_regulator_disable(qcadev);
+	} else if (soc_type == QCA_WCN6750) {
+		gpiod_set_value_cansleep(qcadev->bt_en, 0);
+		msleep(100);
+		qca_regulator_disable(qcadev);
+		if (qcadev->sw_ctrl) {
+			sw_ctrl_state = gpiod_get_value_cansleep(qcadev->sw_ctrl);
+			bt_dev_dbg(hu->hdev, "SW_CTRL is %d", sw_ctrl_state);
+		}
 	} else if (qcadev->bt_en) {
 		gpiod_set_value_cansleep(qcadev->bt_en, 0);
 	}
@@ -1978,7 +2033,9 @@ static int qca_serdev_probe(struct serdev_device *serdev)
 	if (!qcadev->oper_speed)
 		BT_DBG("UART will pick default operating speed");
 
-	if (data && qca_is_wcn399x(data->soc_type)) {
+	if (data &&
+	    (qca_is_wcn399x(data->soc_type) ||
+	    qca_is_wcn6750(data->soc_type))) {
 		qcadev->btsoc_type = data->soc_type;
 		qcadev->bt_power = devm_kzalloc(&serdev->dev,
 						sizeof(struct qca_power),
@@ -1996,6 +2053,18 @@ static int qca_serdev_probe(struct serdev_device *serdev)
 
 		qcadev->bt_power->vregs_on = false;
 
+		qcadev->bt_en = devm_gpiod_get_optional(&serdev->dev, "enable",
+					       GPIOD_OUT_LOW);
+		if (!qcadev->bt_en && data->soc_type == QCA_WCN6750) {
+			dev_err(&serdev->dev, "failed to acquire BT_EN gpio\n");
+			power_ctrl_enabled = false;
+		}
+
+		qcadev->sw_ctrl = devm_gpiod_get_optional(&serdev->dev, "swctrl",
+					       GPIOD_IN);
+		if (!qcadev->sw_ctrl && data->soc_type == QCA_WCN6750)
+			dev_warn(&serdev->dev, "failed to acquire SW_CTRL gpio\n");
+
 		qcadev->susclk = devm_clk_get_optional(&serdev->dev, NULL);
 		if (IS_ERR(qcadev->susclk)) {
 			dev_err(&serdev->dev, "failed to acquire clk\n");
@@ -2068,7 +2137,9 @@ static void qca_serdev_remove(struct serdev_device *serdev)
 	struct qca_serdev *qcadev = serdev_device_get_drvdata(serdev);
 	struct qca_power *power = qcadev->bt_power;
 
-	if (qca_is_wcn399x(qcadev->btsoc_type) && power->vregs_on)
+	if ((qca_is_wcn399x(qcadev->btsoc_type) ||
+	     qca_is_wcn6750(qcadev->btsoc_type)) &&
+	     power->vregs_on)
 		qca_power_shutdown(&qcadev->serdev_hu);
 	else if (qcadev->susclk)
 		clk_disable_unprepare(qcadev->susclk);
@@ -2244,6 +2315,7 @@ static const struct of_device_id qca_bluetooth_of_match[] = {
 	{ .compatible = "qcom,wcn3990-bt", .data = &qca_soc_data_wcn3990},
 	{ .compatible = "qcom,wcn3991-bt", .data = &qca_soc_data_wcn3991},
 	{ .compatible = "qcom,wcn3998-bt", .data = &qca_soc_data_wcn3998},
+	{ .compatible = "qcom,wcn6750-bt", .data = &qca_soc_data_wcn6750},
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, qca_bluetooth_of_match);
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member 
of Code Aurora Forum, hosted by The Linux Foundation


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v3 2/5] Bluetooth: btqca: Add support for firmware image with mbn type for WCN6750
  2021-05-06 17:33 [PATCH v3 0/5] Enable Bluetooth functinality for WCN6750 Venkata Lakshmi Narayana Gubba
  2021-05-06 17:33 ` [PATCH v3 1/5] Bluetooth: hci_qca: Add support for QTI Bluetooth chip wcn6750 Venkata Lakshmi Narayana Gubba
@ 2021-05-06 17:33 ` Venkata Lakshmi Narayana Gubba
  2021-05-07  7:00   ` Marcel Holtmann
  2021-05-06 17:33 ` [PATCH v3 3/5] Bluetooth: btqca: Moved extracting rom version info to common place Venkata Lakshmi Narayana Gubba
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 16+ messages in thread
From: Venkata Lakshmi Narayana Gubba @ 2021-05-06 17:33 UTC (permalink / raw)
  To: marcel, johan.hedberg, devicetree
  Cc: mka, linux-kernel, linux-bluetooth, hemantg, linux-arm-msm,
	bgodavar, rjliao, hbandi, abhishekpandit,
	Venkata Lakshmi Narayana Gubba

1. Added support to download firmware image with mbn type for wcn6750
   as it supports mbn type image.
2. If mbn type image is not present then check for tlv type image.
3. Added debug logs for mbn type image.

Signed-off-by: Venkata Lakshmi Narayana Gubba <gubbaven@codeaurora.org>
---
 drivers/bluetooth/btqca.c | 69 +++++++++++++++++++++++++++++++++++------------
 drivers/bluetooth/btqca.h |  3 ++-
 2 files changed, 54 insertions(+), 18 deletions(-)

diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c
index fce808c..320c555 100644
--- a/drivers/bluetooth/btqca.c
+++ b/drivers/bluetooth/btqca.c
@@ -182,7 +182,8 @@ int qca_send_pre_shutdown_cmd(struct hci_dev *hdev)
 }
 EXPORT_SYMBOL_GPL(qca_send_pre_shutdown_cmd);
 
-static void qca_tlv_check_data(struct qca_fw_config *config,
+static void qca_tlv_check_data(struct hci_dev *hdev,
+			       struct qca_fw_config *config,
 		const struct firmware *fw, enum qca_btsoc_type soc_type)
 {
 	const u8 *data;
@@ -194,19 +195,21 @@ static void qca_tlv_check_data(struct qca_fw_config *config,
 	struct tlv_type_nvm *tlv_nvm;
 	uint8_t nvm_baud_rate = config->user_baud_rate;
 
-	tlv = (struct tlv_type_hdr *)fw->data;
-
-	type_len = le32_to_cpu(tlv->type_len);
-	length = (type_len >> 8) & 0x00ffffff;
-
-	BT_DBG("TLV Type\t\t : 0x%x", type_len & 0x000000ff);
-	BT_DBG("Length\t\t : %d bytes", length);
-
 	config->dnld_mode = QCA_SKIP_EVT_NONE;
 	config->dnld_type = QCA_SKIP_EVT_NONE;
 
 	switch (config->type) {
+	case ELF_TYPE_PATCH:
+		config->dnld_mode = QCA_SKIP_EVT_VSE_CC;
+		config->dnld_type = QCA_SKIP_EVT_VSE_CC;
+
+		bt_dev_dbg(hdev, "File Class        : 0x%x", fw->data[4]);
+		bt_dev_dbg(hdev, "Data Encoding     : 0x%x", fw->data[5]);
+		bt_dev_dbg(hdev, "File version      : 0x%x", fw->data[6]);
+		break;
 	case TLV_TYPE_PATCH:
+		tlv = (struct tlv_type_hdr *)fw->data;
+		type_len = le32_to_cpu(tlv->type_len);
 		tlv_patch = (struct tlv_type_patch *)tlv->data;
 
 		/* For Rome version 1.1 to 3.1, all segment commands
@@ -218,6 +221,7 @@ static void qca_tlv_check_data(struct qca_fw_config *config,
 		config->dnld_mode = tlv_patch->download_mode;
 		config->dnld_type = config->dnld_mode;
 
+		BT_DBG("TLV Type\t\t : 0x%x", type_len & 0x000000ff);
 		BT_DBG("Total Length           : %d bytes",
 		       le32_to_cpu(tlv_patch->total_size));
 		BT_DBG("Patch Data Length      : %d bytes",
@@ -243,6 +247,14 @@ static void qca_tlv_check_data(struct qca_fw_config *config,
 		break;
 
 	case TLV_TYPE_NVM:
+		tlv = (struct tlv_type_hdr *)fw->data;
+
+		type_len = le32_to_cpu(tlv->type_len);
+		length = (type_len >> 8) & 0x00ffffff;
+
+		BT_DBG("TLV Type\t\t : 0x%x", type_len & 0x000000ff);
+		BT_DBG("Length\t\t : %d bytes", length);
+
 		idx = 0;
 		data = tlv->data;
 		while (idx < length) {
@@ -387,7 +399,8 @@ static int qca_inject_cmd_complete_event(struct hci_dev *hdev)
 
 static int qca_download_firmware(struct hci_dev *hdev,
 				 struct qca_fw_config *config,
-				 enum qca_btsoc_type soc_type)
+				 enum qca_btsoc_type soc_type,
+				 u8 rom_ver)
 {
 	const struct firmware *fw;
 	const u8 *segment;
@@ -397,12 +410,30 @@ static int qca_download_firmware(struct hci_dev *hdev,
 
 	ret = request_firmware(&fw, config->fwname, &hdev->dev);
 	if (ret) {
-		bt_dev_err(hdev, "QCA Failed to request file: %s (%d)",
-			   config->fwname, ret);
-		return ret;
+		/* For WCN6750, if mbn file is not present then check for
+		 * tlv file.
+		 */
+		if (soc_type == QCA_WCN6750 && config->type == ELF_TYPE_PATCH) {
+			bt_dev_dbg(hdev, "QCA Failed to request file: %s (%d)",
+				   config->fwname, ret);
+			config->type = TLV_TYPE_PATCH;
+			snprintf(config->fwname, sizeof(config->fwname),
+				 "qca/msbtfw%02x.tlv", rom_ver);
+			bt_dev_info(hdev, "QCA Downloading %s", config->fwname);
+			ret = request_firmware(&fw, config->fwname, &hdev->dev);
+			if (ret) {
+				bt_dev_err(hdev, "QCA Failed to request file: %s (%d)",
+					   config->fwname, ret);
+				return ret;
+			}
+		} else {
+			bt_dev_err(hdev, "QCA Failed to request file: %s (%d)",
+				   config->fwname, ret);
+			return ret;
+		}
 	}
 
-	qca_tlv_check_data(config, fw, soc_type);
+	qca_tlv_check_data(hdev, config, fw, soc_type);
 
 	segment = fw->data;
 	remain = fw->size;
@@ -520,14 +551,18 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
 	} else if (soc_type == QCA_WCN6750) {
 		rom_ver = ((soc_ver & 0x00000f00) >> 0x04) |
 			    (soc_ver & 0x0000000f);
+		/* Choose mbn file by default.If mbn file is not found
+		 * then choose tlv file
+		 */
+		config.type = ELF_TYPE_PATCH;
 		snprintf(config.fwname, sizeof(config.fwname),
-			 "qca/msbtfw%02x.tlv", rom_ver);
+			 "qca/msbtfw%02x.mbn", rom_ver);
 	} else {
 		snprintf(config.fwname, sizeof(config.fwname),
 			 "qca/rampatch_%08x.bin", soc_ver);
 	}
 
-	err = qca_download_firmware(hdev, &config, soc_type);
+	err = qca_download_firmware(hdev, &config, soc_type, rom_ver);
 	if (err < 0) {
 		bt_dev_err(hdev, "QCA Failed to download patch (%d)", err);
 		return err;
@@ -560,7 +595,7 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
 		snprintf(config.fwname, sizeof(config.fwname),
 			 "qca/nvm_%08x.bin", soc_ver);
 
-	err = qca_download_firmware(hdev, &config, soc_type);
+	err = qca_download_firmware(hdev, &config, soc_type, rom_ver);
 	if (err < 0) {
 		bt_dev_err(hdev, "QCA Failed to download NVM (%d)", err);
 		return err;
diff --git a/drivers/bluetooth/btqca.h b/drivers/bluetooth/btqca.h
index dd82d2c..5a5e699 100644
--- a/drivers/bluetooth/btqca.h
+++ b/drivers/bluetooth/btqca.h
@@ -80,7 +80,8 @@ enum qca_tlv_dnld_mode {
 
 enum qca_tlv_type {
 	TLV_TYPE_PATCH = 1,
-	TLV_TYPE_NVM
+	TLV_TYPE_NVM,
+	ELF_TYPE_PATCH
 };
 
 struct qca_fw_config {
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member 
of Code Aurora Forum, hosted by The Linux Foundation


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v3 3/5] Bluetooth: btqca: Moved extracting rom version info to common place
  2021-05-06 17:33 [PATCH v3 0/5] Enable Bluetooth functinality for WCN6750 Venkata Lakshmi Narayana Gubba
  2021-05-06 17:33 ` [PATCH v3 1/5] Bluetooth: hci_qca: Add support for QTI Bluetooth chip wcn6750 Venkata Lakshmi Narayana Gubba
  2021-05-06 17:33 ` [PATCH v3 2/5] Bluetooth: btqca: Add support for firmware image with mbn type for WCN6750 Venkata Lakshmi Narayana Gubba
@ 2021-05-06 17:33 ` Venkata Lakshmi Narayana Gubba
  2021-05-07  7:53   ` Marcel Holtmann
  2021-05-06 17:33 ` [PATCH v3 4/5] dt-bindings: net: bluetooth: Convert Qualcomm BT binding to DT schema Venkata Lakshmi Narayana Gubba
  2021-05-06 17:33 ` [PATCH v3 5/5] dt-bindings: net: bluetooth: Add device tree bindings for QTI chip wcn6750 Venkata Lakshmi Narayana Gubba
  4 siblings, 1 reply; 16+ messages in thread
From: Venkata Lakshmi Narayana Gubba @ 2021-05-06 17:33 UTC (permalink / raw)
  To: marcel, johan.hedberg, devicetree
  Cc: mka, linux-kernel, linux-bluetooth, hemantg, linux-arm-msm,
	bgodavar, rjliao, hbandi, abhishekpandit,
	Venkata Lakshmi Narayana Gubba

Moved extracting rom version info to common place as this code is
common in all if else ladder in qca_uart_setup.

Signed-off-by: Venkata Lakshmi Narayana Gubba <gubbaven@codeaurora.org>
---
 drivers/bluetooth/btqca.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c
index 320c555..658fd8e4 100644
--- a/drivers/bluetooth/btqca.c
+++ b/drivers/bluetooth/btqca.c
@@ -533,24 +533,21 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
 
 	config.user_baud_rate = baudrate;
 
+	/* Firmware files to download are based on ROM version.
+	 * ROM version is derived from last two bytes of soc_ver.
+	 */
+	rom_ver = ((soc_ver & 0x00000f00) >> 0x04) |
+		    (soc_ver & 0x0000000f);
+
 	/* Download rampatch file */
 	config.type = TLV_TYPE_PATCH;
 	if (qca_is_wcn399x(soc_type)) {
-		/* Firmware files to download are based on ROM version.
-		 * ROM version is derived from last two bytes of soc_ver.
-		 */
-		rom_ver = ((soc_ver & 0x00000f00) >> 0x04) |
-			    (soc_ver & 0x0000000f);
 		snprintf(config.fwname, sizeof(config.fwname),
 			 "qca/crbtfw%02x.tlv", rom_ver);
 	} else if (soc_type == QCA_QCA6390) {
-		rom_ver = ((soc_ver & 0x00000f00) >> 0x04) |
-			    (soc_ver & 0x0000000f);
 		snprintf(config.fwname, sizeof(config.fwname),
 			 "qca/htbtfw%02x.tlv", rom_ver);
 	} else if (soc_type == QCA_WCN6750) {
-		rom_ver = ((soc_ver & 0x00000f00) >> 0x04) |
-			    (soc_ver & 0x0000000f);
 		/* Choose mbn file by default.If mbn file is not found
 		 * then choose tlv file
 		 */
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member 
of Code Aurora Forum, hosted by The Linux Foundation


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v3 4/5] dt-bindings: net: bluetooth: Convert Qualcomm BT binding to DT schema
  2021-05-06 17:33 [PATCH v3 0/5] Enable Bluetooth functinality for WCN6750 Venkata Lakshmi Narayana Gubba
                   ` (2 preceding siblings ...)
  2021-05-06 17:33 ` [PATCH v3 3/5] Bluetooth: btqca: Moved extracting rom version info to common place Venkata Lakshmi Narayana Gubba
@ 2021-05-06 17:33 ` Venkata Lakshmi Narayana Gubba
  2021-05-07  1:17   ` Rob Herring
  2021-05-06 17:33 ` [PATCH v3 5/5] dt-bindings: net: bluetooth: Add device tree bindings for QTI chip wcn6750 Venkata Lakshmi Narayana Gubba
  4 siblings, 1 reply; 16+ messages in thread
From: Venkata Lakshmi Narayana Gubba @ 2021-05-06 17:33 UTC (permalink / raw)
  To: marcel, johan.hedberg, devicetree
  Cc: mka, linux-kernel, linux-bluetooth, hemantg, linux-arm-msm,
	bgodavar, rjliao, hbandi, abhishekpandit,
	Venkata Lakshmi Narayana Gubba

Converted Qualcomm Bluetooth binidings to DT schema.

Signed-off-by: Venkata Lakshmi Narayana Gubba <gubbaven@codeaurora.org>
---
 .../devicetree/bindings/net/qualcomm-bluetooth.txt |  69 -------------
 .../bindings/net/qualcomm-bluetooth.yaml           | 111 +++++++++++++++++++++
 2 files changed, 111 insertions(+), 69 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
 create mode 100644 Documentation/devicetree/bindings/net/qualcomm-bluetooth.yaml

diff --git a/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt b/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
deleted file mode 100644
index 709ca6d..0000000
--- a/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
+++ /dev/null
@@ -1,69 +0,0 @@
-Qualcomm Bluetooth Chips
----------------------
-
-This documents the binding structure and common properties for serial
-attached Qualcomm devices.
-
-Serial attached Qualcomm devices shall be a child node of the host UART
-device the slave device is attached to.
-
-Required properties:
- - compatible: should contain one of the following:
-   * "qcom,qca6174-bt"
-   * "qcom,qca9377-bt"
-   * "qcom,wcn3990-bt"
-   * "qcom,wcn3991-bt"
-   * "qcom,wcn3998-bt"
-   * "qcom,qca6390-bt"
-
-Optional properties for compatible string qcom,qca6174-bt:
-
- - enable-gpios: gpio specifier used to enable chip
- - clocks: clock provided to the controller (SUSCLK_32KHZ)
- - firmware-name: specify the name of nvm firmware to load
-
-Optional properties for compatible string qcom,qca9377-bt:
-
- - max-speed: see Documentation/devicetree/bindings/serial/serial.yaml
-
-Required properties for compatible string qcom,wcn399x-bt:
-
- - vddio-supply: VDD_IO supply regulator handle.
- - vddxo-supply: VDD_XO supply regulator handle.
- - vddrf-supply: VDD_RF supply regulator handle.
- - vddch0-supply: VDD_CH0 supply regulator handle.
-
-Optional properties for compatible string qcom,wcn399x-bt:
-
- - max-speed: see Documentation/devicetree/bindings/serial/serial.yaml
- - firmware-name: specify the name of nvm firmware to load
- - clocks: clock provided to the controller
-
-Examples:
-
-serial@7570000 {
-	label = "BT-UART";
-	status = "okay";
-
-	bluetooth {
-		compatible = "qcom,qca6174-bt";
-
-		enable-gpios = <&pm8994_gpios 19 GPIO_ACTIVE_HIGH>;
-		clocks = <&divclk4>;
-		firmware-name = "nvm_00440302.bin";
-	};
-};
-
-serial@898000 {
-	bluetooth {
-		compatible = "qcom,wcn3990-bt";
-
-		vddio-supply = <&vreg_s4a_1p8>;
-		vddxo-supply = <&vreg_l7a_1p8>;
-		vddrf-supply = <&vreg_l17a_1p3>;
-		vddch0-supply = <&vreg_l25a_3p3>;
-		max-speed = <3200000>;
-		firmware-name = "crnv21.bin";
-		clocks = <&rpmhcc RPMH_RF_CLK2>;
-	};
-};
diff --git a/Documentation/devicetree/bindings/net/qualcomm-bluetooth.yaml b/Documentation/devicetree/bindings/net/qualcomm-bluetooth.yaml
new file mode 100644
index 0000000..3f3ec4d
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/qualcomm-bluetooth.yaml
@@ -0,0 +1,111 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/qualcomm-bluetooth.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm Bluetooth Chips
+
+maintainers:
+  - Marcel Holtmann <marcel@holtmann.org>
+
+description:
+  This binding describes Qualcomm UART-attached bluetooth chips.
+
+properties:
+  compatible:
+    enum:
+      - qcom,qca6174-bt
+      - qcom,qca9377-bt
+      - qcom,wcn3990-bt
+      - qcom,wcn3991-bt
+      - qcom,wcn3998-bt
+      - qcom,qca6390-bt
+
+  enable-gpios:
+    maxItems: 1
+    description: gpio specifier used to enable chip
+
+  clocks:
+    maxItems: 1
+    description: clock provided to the controller (SUSCLK_32KHZ)
+
+  vddio-supply:
+    description: VDD_IO supply regulator handle
+
+  vddxo-supply:
+    description: VDD_XO supply regulator handle
+
+  vddrf-supply:
+    description: VDD_RF supply regulator handle
+
+  vddch0-supply:
+    description: VDD_CH0 supply regulator handle
+
+  max-speed:
+    description: see Documentation/devicetree/bindings/serial/serial.yaml
+
+  firmware-name:
+    description: specify the name of nvm firmware to load
+
+  local-bd-address:
+    description: see Documentation/devicetree/bindings/net/bluetooth.txt
+
+
+required:
+  - compatible
+
+additionalProperties: false
+
+allOf:
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - qcom,qca6174-bt
+    then:
+      required:
+        - enable-gpios
+        - clocks
+
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - qcom,wcn3990-bt
+              - qcom,wcn3991-bt
+              - qcom,wcn3998-bt
+    then:
+      required:
+        - vddio-supply
+        - vddxo-supply
+        - vddrf-supply
+        - vddch0-supply
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+    serial {
+
+        bluetooth {
+            compatible = "qcom,qca6174-bt";
+            enable-gpios = <&pm8994_gpios 19 GPIO_ACTIVE_HIGH>;
+            clocks = <&divclk4>;
+            firmware-name = "nvm_00440302.bin";
+        };
+    };
+  - |
+    serial {
+
+        bluetooth {
+            compatible = "qcom,wcn3990-bt";
+            vddio-supply = <&vreg_s4a_1p8>;
+            vddxo-supply = <&vreg_l7a_1p8>;
+            vddrf-supply = <&vreg_l17a_1p3>;
+            vddch0-supply = <&vreg_l25a_3p3>;
+            max-speed = <3200000>;
+            firmware-name = "crnv21.bin";
+        };
+    };
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member 
of Code Aurora Forum, hosted by The Linux Foundation


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v3 5/5] dt-bindings: net: bluetooth: Add device tree bindings for QTI chip wcn6750
  2021-05-06 17:33 [PATCH v3 0/5] Enable Bluetooth functinality for WCN6750 Venkata Lakshmi Narayana Gubba
                   ` (3 preceding siblings ...)
  2021-05-06 17:33 ` [PATCH v3 4/5] dt-bindings: net: bluetooth: Convert Qualcomm BT binding to DT schema Venkata Lakshmi Narayana Gubba
@ 2021-05-06 17:33 ` Venkata Lakshmi Narayana Gubba
  2021-05-07  1:19   ` Rob Herring
  4 siblings, 1 reply; 16+ messages in thread
From: Venkata Lakshmi Narayana Gubba @ 2021-05-06 17:33 UTC (permalink / raw)
  To: marcel, johan.hedberg, devicetree
  Cc: mka, linux-kernel, linux-bluetooth, hemantg, linux-arm-msm,
	bgodavar, rjliao, hbandi, abhishekpandit,
	Venkata Lakshmi Narayana Gubba

This patch enables regulators and gpios for the Qualcomm Bluetooth wcn6750
controller.

Signed-off-by: Venkata Lakshmi Narayana Gubba <gubbaven@codeaurora.org>
---
 .../bindings/net/qualcomm-bluetooth.yaml           | 71 ++++++++++++++++++++++
 1 file changed, 71 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/qualcomm-bluetooth.yaml b/Documentation/devicetree/bindings/net/qualcomm-bluetooth.yaml
index 3f3ec4d..0a90335 100644
--- a/Documentation/devicetree/bindings/net/qualcomm-bluetooth.yaml
+++ b/Documentation/devicetree/bindings/net/qualcomm-bluetooth.yaml
@@ -21,11 +21,17 @@ properties:
       - qcom,wcn3991-bt
       - qcom,wcn3998-bt
       - qcom,qca6390-bt
+      - qcom,wcn6750-bt
 
   enable-gpios:
     maxItems: 1
     description: gpio specifier used to enable chip
 
+  swctrl-gpios:
+    maxItems: 1
+    description: gpio specifier is used to find status
+                 of clock supply to SoC
+
   clocks:
     maxItems: 1
     description: clock provided to the controller (SUSCLK_32KHZ)
@@ -42,6 +48,30 @@ properties:
   vddch0-supply:
     description: VDD_CH0 supply regulator handle
 
+  vddaon-supply:
+    description: VDD_AON supply regulator handle
+
+  vddbtcxmx-supply:
+    description: VDD_BT_CXMX supply regulator handle
+
+  vddrfacmn-supply:
+    description: VDD_RFA_CMN supply regulator handle
+
+  vddrfa0p8-supply:
+    description: VDD_RFA_0P8 suppply regulator handle
+
+  vddrfa1p7-supply:
+    description: VDD_RFA_1P7 supply regulator handle
+
+  vddrfa1p2-supply:
+    description: VDD_RFA_1P2 supply regulator handle
+
+  vddrfa2p2-supply:
+    description: VDD_RFA_2P2 supply regulator handle
+
+  vddasd-supply:
+    description: VDD_ASD supply regulator handle
+
   max-speed:
     description: see Documentation/devicetree/bindings/serial/serial.yaml
 
@@ -84,6 +114,25 @@ allOf:
         - vddrf-supply
         - vddch0-supply
 
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - qcom,wcn6750-bt
+    then:
+      required:
+        - enable-gpios
+        - swctrl-gpios
+        - vddio-supply
+        - vddaon-supply
+        - vddbtcxmx-supply
+        - vddrfacmn-supply
+        - vddrfa0p8-supply
+        - vddrfa1p7-supply
+        - vddrfa1p2-supply
+        - vddasd-supply
+
 examples:
   - |
     #include <dt-bindings/gpio/gpio.h>
@@ -109,3 +158,25 @@ examples:
             firmware-name = "crnv21.bin";
         };
     };
+  - |
+    serial {
+
+        bluetooth {
+            compatible = "qcom,wcn6750-bt";
+            pinctrl-names = "default";
+            pinctrl-0 = <&bt_en_default>;
+            enable-gpios = <&tlmm 85 GPIO_ACTIVE_HIGH>;
+            swctrl-gpios = <&tlmm 86 GPIO_ACTIVE_HIGH>;
+            vddio-supply = <&vreg_l19b_1p8>;
+            vddaon-supply = <&vreg_s7b_0p9>;
+            vddbtcxmx-supply = <&vreg_s7b_0p9>;
+            vddrfacmn-supply = <&vreg_s7b_0p9>;
+            vddrfa0p8-supply = <&vreg_s7b_0p9>;
+            vddrfa1p7-supply = <&vreg_s1b_1p8>;
+            vddrfa1p2-supply = <&vreg_s8b_1p2>;
+            vddrfa2p2-supply = <&vreg_s1c_2p2>;
+            vddasd-supply = <&vreg_l11c_2p8>;
+            max-speed = <3200000>;
+            firmware-name = "msnv11.bin";
+        };
+    };
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member 
of Code Aurora Forum, hosted by The Linux Foundation


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH v3 4/5] dt-bindings: net: bluetooth: Convert Qualcomm BT binding to DT schema
  2021-05-06 17:33 ` [PATCH v3 4/5] dt-bindings: net: bluetooth: Convert Qualcomm BT binding to DT schema Venkata Lakshmi Narayana Gubba
@ 2021-05-07  1:17   ` Rob Herring
  2021-05-07  6:55     ` Marcel Holtmann
  0 siblings, 1 reply; 16+ messages in thread
From: Rob Herring @ 2021-05-07  1:17 UTC (permalink / raw)
  To: Venkata Lakshmi Narayana Gubba
  Cc: marcel, johan.hedberg, devicetree, mka, linux-kernel,
	linux-bluetooth, hemantg, linux-arm-msm, bgodavar, rjliao,
	hbandi, abhishekpandit

On Thu, May 06, 2021 at 11:03:11PM +0530, Venkata Lakshmi Narayana Gubba wrote:
> Converted Qualcomm Bluetooth binidings to DT schema.
> 
> Signed-off-by: Venkata Lakshmi Narayana Gubba <gubbaven@codeaurora.org>
> ---
>  .../devicetree/bindings/net/qualcomm-bluetooth.txt |  69 -------------
>  .../bindings/net/qualcomm-bluetooth.yaml           | 111 +++++++++++++++++++++
>  2 files changed, 111 insertions(+), 69 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
>  create mode 100644 Documentation/devicetree/bindings/net/qualcomm-bluetooth.yaml


> diff --git a/Documentation/devicetree/bindings/net/qualcomm-bluetooth.yaml b/Documentation/devicetree/bindings/net/qualcomm-bluetooth.yaml
> new file mode 100644
> index 0000000..3f3ec4d
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/net/qualcomm-bluetooth.yaml
> @@ -0,0 +1,111 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/net/qualcomm-bluetooth.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Qualcomm Bluetooth Chips
> +
> +maintainers:
> +  - Marcel Holtmann <marcel@holtmann.org>

This should be someone who cares about Qcom BT.

Otherwise,

Reviewed-by: Rob Herring <robh@kernel.org>

> +
> +description:
> +  This binding describes Qualcomm UART-attached bluetooth chips.
> +
> +properties:
> +  compatible:
> +    enum:
> +      - qcom,qca6174-bt
> +      - qcom,qca9377-bt
> +      - qcom,wcn3990-bt
> +      - qcom,wcn3991-bt
> +      - qcom,wcn3998-bt
> +      - qcom,qca6390-bt
> +
> +  enable-gpios:
> +    maxItems: 1
> +    description: gpio specifier used to enable chip
> +
> +  clocks:
> +    maxItems: 1
> +    description: clock provided to the controller (SUSCLK_32KHZ)
> +
> +  vddio-supply:
> +    description: VDD_IO supply regulator handle
> +
> +  vddxo-supply:
> +    description: VDD_XO supply regulator handle
> +
> +  vddrf-supply:
> +    description: VDD_RF supply regulator handle
> +
> +  vddch0-supply:
> +    description: VDD_CH0 supply regulator handle
> +
> +  max-speed:
> +    description: see Documentation/devicetree/bindings/serial/serial.yaml
> +
> +  firmware-name:
> +    description: specify the name of nvm firmware to load
> +
> +  local-bd-address:
> +    description: see Documentation/devicetree/bindings/net/bluetooth.txt
> +
> +
> +required:
> +  - compatible
> +
> +additionalProperties: false
> +
> +allOf:
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            enum:
> +              - qcom,qca6174-bt
> +    then:
> +      required:
> +        - enable-gpios
> +        - clocks
> +
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            enum:
> +              - qcom,wcn3990-bt
> +              - qcom,wcn3991-bt
> +              - qcom,wcn3998-bt
> +    then:
> +      required:
> +        - vddio-supply
> +        - vddxo-supply
> +        - vddrf-supply
> +        - vddch0-supply
> +
> +examples:
> +  - |
> +    #include <dt-bindings/gpio/gpio.h>
> +    serial {
> +
> +        bluetooth {
> +            compatible = "qcom,qca6174-bt";
> +            enable-gpios = <&pm8994_gpios 19 GPIO_ACTIVE_HIGH>;
> +            clocks = <&divclk4>;
> +            firmware-name = "nvm_00440302.bin";
> +        };
> +    };
> +  - |
> +    serial {
> +
> +        bluetooth {
> +            compatible = "qcom,wcn3990-bt";
> +            vddio-supply = <&vreg_s4a_1p8>;
> +            vddxo-supply = <&vreg_l7a_1p8>;
> +            vddrf-supply = <&vreg_l17a_1p3>;
> +            vddch0-supply = <&vreg_l25a_3p3>;
> +            max-speed = <3200000>;
> +            firmware-name = "crnv21.bin";
> +        };
> +    };
> -- 
> QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member 
> of Code Aurora Forum, hosted by The Linux Foundation
> 

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v3 5/5] dt-bindings: net: bluetooth: Add device tree bindings for QTI chip wcn6750
  2021-05-06 17:33 ` [PATCH v3 5/5] dt-bindings: net: bluetooth: Add device tree bindings for QTI chip wcn6750 Venkata Lakshmi Narayana Gubba
@ 2021-05-07  1:19   ` Rob Herring
  0 siblings, 0 replies; 16+ messages in thread
From: Rob Herring @ 2021-05-07  1:19 UTC (permalink / raw)
  To: Venkata Lakshmi Narayana Gubba
  Cc: rjliao, abhishekpandit, hbandi, bgodavar, devicetree,
	johan.hedberg, linux-bluetooth, marcel, mka, hemantg,
	linux-kernel, linux-arm-msm

On Thu, 06 May 2021 23:03:12 +0530, Venkata Lakshmi Narayana Gubba wrote:
> This patch enables regulators and gpios for the Qualcomm Bluetooth wcn6750
> controller.
> 
> Signed-off-by: Venkata Lakshmi Narayana Gubba <gubbaven@codeaurora.org>
> ---
>  .../bindings/net/qualcomm-bluetooth.yaml           | 71 ++++++++++++++++++++++
>  1 file changed, 71 insertions(+)
> 

Reviewed-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v3 4/5] dt-bindings: net: bluetooth: Convert Qualcomm BT binding to DT schema
  2021-05-07  1:17   ` Rob Herring
@ 2021-05-07  6:55     ` Marcel Holtmann
  2021-05-07 17:19       ` Rob Herring
  0 siblings, 1 reply; 16+ messages in thread
From: Marcel Holtmann @ 2021-05-07  6:55 UTC (permalink / raw)
  To: Rob Herring
  Cc: Venkata Lakshmi Narayana Gubba, Johan Hedberg, devicetree,
	Matthias Kaehlcke, open list, Bluetooth Kernel Mailing List,
	Hemantg, MSM, bgodavar, rjliao, hbandi, abhishekpandit

Hi Venkata,

>> Converted Qualcomm Bluetooth binidings to DT schema.
>> 
>> Signed-off-by: Venkata Lakshmi Narayana Gubba <gubbaven@codeaurora.org>
>> ---
>> .../devicetree/bindings/net/qualcomm-bluetooth.txt |  69 -------------
>> .../bindings/net/qualcomm-bluetooth.yaml           | 111 +++++++++++++++++++++
>> 2 files changed, 111 insertions(+), 69 deletions(-)
>> delete mode 100644 Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
>> create mode 100644 Documentation/devicetree/bindings/net/qualcomm-bluetooth.yaml
> 
> 
>> diff --git a/Documentation/devicetree/bindings/net/qualcomm-bluetooth.yaml b/Documentation/devicetree/bindings/net/qualcomm-bluetooth.yaml
>> new file mode 100644
>> index 0000000..3f3ec4d
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/net/qualcomm-bluetooth.yaml
>> @@ -0,0 +1,111 @@
>> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
>> +%YAML 1.2
>> +---
>> +$id: http://devicetree.org/schemas/net/qualcomm-bluetooth.yaml#
>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>> +
>> +title: Qualcomm Bluetooth Chips
>> +
>> +maintainers:
>> +  - Marcel Holtmann <marcel@holtmann.org>
> 
> This should be someone who cares about Qcom BT.

yes, please, assign this to someone that knows the hardware.

Rob, can we leave this out for now if there is no dedicated person?

Regards

Marcel


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v3 2/5] Bluetooth: btqca: Add support for firmware image with mbn type for WCN6750
  2021-05-06 17:33 ` [PATCH v3 2/5] Bluetooth: btqca: Add support for firmware image with mbn type for WCN6750 Venkata Lakshmi Narayana Gubba
@ 2021-05-07  7:00   ` Marcel Holtmann
  2021-05-10 17:16     ` gubbaven
  0 siblings, 1 reply; 16+ messages in thread
From: Marcel Holtmann @ 2021-05-07  7:00 UTC (permalink / raw)
  To: Venkata Lakshmi Narayana Gubba
  Cc: Johan Hedberg, devicetree, mka, linux-kernel, linux-bluetooth,
	hemantg, linux-arm-msm, bgodavar, rjliao, hbandi, abhishekpandit

Hi Venkata,

> 1. Added support to download firmware image with mbn type for wcn6750
>   as it supports mbn type image.
> 2. If mbn type image is not present then check for tlv type image.
> 3. Added debug logs for mbn type image.
> 
> Signed-off-by: Venkata Lakshmi Narayana Gubba <gubbaven@codeaurora.org>
> ---
> drivers/bluetooth/btqca.c | 69 +++++++++++++++++++++++++++++++++++------------
> drivers/bluetooth/btqca.h |  3 ++-
> 2 files changed, 54 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c
> index fce808c..320c555 100644
> --- a/drivers/bluetooth/btqca.c
> +++ b/drivers/bluetooth/btqca.c
> @@ -182,7 +182,8 @@ int qca_send_pre_shutdown_cmd(struct hci_dev *hdev)
> }
> EXPORT_SYMBOL_GPL(qca_send_pre_shutdown_cmd);
> 
> -static void qca_tlv_check_data(struct qca_fw_config *config,
> +static void qca_tlv_check_data(struct hci_dev *hdev,
> +			       struct qca_fw_config *config,
> 		const struct firmware *fw, enum qca_btsoc_type soc_type)
> {
> 	const u8 *data;
> @@ -194,19 +195,21 @@ static void qca_tlv_check_data(struct qca_fw_config *config,
> 	struct tlv_type_nvm *tlv_nvm;
> 	uint8_t nvm_baud_rate = config->user_baud_rate;
> 
> -	tlv = (struct tlv_type_hdr *)fw->data;
> -
> -	type_len = le32_to_cpu(tlv->type_len);
> -	length = (type_len >> 8) & 0x00ffffff;
> -
> -	BT_DBG("TLV Type\t\t : 0x%x", type_len & 0x000000ff);
> -	BT_DBG("Length\t\t : %d bytes", length);
> -
> 	config->dnld_mode = QCA_SKIP_EVT_NONE;
> 	config->dnld_type = QCA_SKIP_EVT_NONE;
> 
> 	switch (config->type) {
> +	case ELF_TYPE_PATCH:
> +		config->dnld_mode = QCA_SKIP_EVT_VSE_CC;
> +		config->dnld_type = QCA_SKIP_EVT_VSE_CC;
> +
> +		bt_dev_dbg(hdev, "File Class        : 0x%x", fw->data[4]);
> +		bt_dev_dbg(hdev, "Data Encoding     : 0x%x", fw->data[5]);
> +		bt_dev_dbg(hdev, "File version      : 0x%x", fw->data[6]);
> +		break;
> 	case TLV_TYPE_PATCH:
> +		tlv = (struct tlv_type_hdr *)fw->data;

Is this casting always necessary.

> +		type_len = le32_to_cpu(tlv->type_len);
> 		tlv_patch = (struct tlv_type_patch *)tlv->data;
> 
> 		/* For Rome version 1.1 to 3.1, all segment commands
> @@ -218,6 +221,7 @@ static void qca_tlv_check_data(struct qca_fw_config *config,
> 		config->dnld_mode = tlv_patch->download_mode;
> 		config->dnld_type = config->dnld_mode;
> 
> +		BT_DBG("TLV Type\t\t : 0x%x", type_len & 0x000000ff);
> 		BT_DBG("Total Length           : %d bytes",
> 		       le32_to_cpu(tlv_patch->total_size));
> 		BT_DBG("Patch Data Length      : %d bytes",
> @@ -243,6 +247,14 @@ static void qca_tlv_check_data(struct qca_fw_config *config,
> 		break;
> 
> 	case TLV_TYPE_NVM:
> +		tlv = (struct tlv_type_hdr *)fw->data;
> +
> +		type_len = le32_to_cpu(tlv->type_len);
> +		length = (type_len >> 8) & 0x00ffffff;
> +
> +		BT_DBG("TLV Type\t\t : 0x%x", type_len & 0x000000ff);
> +		BT_DBG("Length\t\t : %d bytes", length);
> +
> 		idx = 0;
> 		data = tlv->data;
> 		while (idx < length) {
> @@ -387,7 +399,8 @@ static int qca_inject_cmd_complete_event(struct hci_dev *hdev)
> 
> static int qca_download_firmware(struct hci_dev *hdev,
> 				 struct qca_fw_config *config,
> -				 enum qca_btsoc_type soc_type)
> +				 enum qca_btsoc_type soc_type,
> +				 u8 rom_ver)
> {
> 	const struct firmware *fw;
> 	const u8 *segment;
> @@ -397,12 +410,30 @@ static int qca_download_firmware(struct hci_dev *hdev,
> 
> 	ret = request_firmware(&fw, config->fwname, &hdev->dev);
> 	if (ret) {
> -		bt_dev_err(hdev, "QCA Failed to request file: %s (%d)",
> -			   config->fwname, ret);
> -		return ret;
> +		/* For WCN6750, if mbn file is not present then check for
> +		 * tlv file.
> +		 */
> +		if (soc_type == QCA_WCN6750 && config->type == ELF_TYPE_PATCH) {
> +			bt_dev_dbg(hdev, "QCA Failed to request file: %s (%d)",
> +				   config->fwname, ret);
> +			config->type = TLV_TYPE_PATCH;
> +			snprintf(config->fwname, sizeof(config->fwname),
> +				 "qca/msbtfw%02x.tlv", rom_ver);
> +			bt_dev_info(hdev, "QCA Downloading %s", config->fwname);
> +			ret = request_firmware(&fw, config->fwname, &hdev->dev);
> +			if (ret) {
> +				bt_dev_err(hdev, "QCA Failed to request file: %s (%d)",
> +					   config->fwname, ret);
> +				return ret;
> +			}
> +		} else {
> +			bt_dev_err(hdev, "QCA Failed to request file: %s (%d)",
> +				   config->fwname, ret);
> +			return ret;
> +		}
> 	}
> 
> -	qca_tlv_check_data(config, fw, soc_type);
> +	qca_tlv_check_data(hdev, config, fw, soc_type);
> 
> 	segment = fw->data;
> 	remain = fw->size;
> @@ -520,14 +551,18 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
> 	} else if (soc_type == QCA_WCN6750) {
> 		rom_ver = ((soc_ver & 0x00000f00) >> 0x04) |
> 			    (soc_ver & 0x0000000f);
> +		/* Choose mbn file by default.If mbn file is not found
> +		 * then choose tlv file
> +		 */
> +		config.type = ELF_TYPE_PATCH;
> 		snprintf(config.fwname, sizeof(config.fwname),
> -			 "qca/msbtfw%02x.tlv", rom_ver);
> +			 "qca/msbtfw%02x.mbn", rom_ver);
> 	} else {
> 		snprintf(config.fwname, sizeof(config.fwname),
> 			 "qca/rampatch_%08x.bin", soc_ver);
> 	}
> 
> -	err = qca_download_firmware(hdev, &config, soc_type);
> +	err = qca_download_firmware(hdev, &config, soc_type, rom_ver);
> 	if (err < 0) {
> 		bt_dev_err(hdev, "QCA Failed to download patch (%d)", err);
> 		return err;
> @@ -560,7 +595,7 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
> 		snprintf(config.fwname, sizeof(config.fwname),
> 			 "qca/nvm_%08x.bin", soc_ver);
> 
> -	err = qca_download_firmware(hdev, &config, soc_type);
> +	err = qca_download_firmware(hdev, &config, soc_type, rom_ver);
> 	if (err < 0) {
> 		bt_dev_err(hdev, "QCA Failed to download NVM (%d)", err);
> 		return err;
> diff --git a/drivers/bluetooth/btqca.h b/drivers/bluetooth/btqca.h
> index dd82d2c..5a5e699 100644
> --- a/drivers/bluetooth/btqca.h
> +++ b/drivers/bluetooth/btqca.h
> @@ -80,7 +80,8 @@ enum qca_tlv_dnld_mode {
> 
> enum qca_tlv_type {
> 	TLV_TYPE_PATCH = 1,
> -	TLV_TYPE_NVM
> +	TLV_TYPE_NVM,
> +	ELF_TYPE_PATCH
> };

If you end the enum in a , then future diffs only show a single line of addition. So please ELF_TYPE_PATCH,.

Regards

Marcel


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v3 3/5] Bluetooth: btqca: Moved extracting rom version info to common place
  2021-05-06 17:33 ` [PATCH v3 3/5] Bluetooth: btqca: Moved extracting rom version info to common place Venkata Lakshmi Narayana Gubba
@ 2021-05-07  7:53   ` Marcel Holtmann
  2021-05-10 17:09     ` gubbaven
  0 siblings, 1 reply; 16+ messages in thread
From: Marcel Holtmann @ 2021-05-07  7:53 UTC (permalink / raw)
  To: Venkata Lakshmi Narayana Gubba
  Cc: Johan Hedberg, devicetree, Matthias Kaehlcke, open list,
	Bluetooth Kernel Mailing List, Hemantg, MSM,
	Balakrishna Godavarthi, Rocky Liao, hbandi, abhishekpandit

Hi Venkata,

> Moved extracting rom version info to common place as this code is
> common in all if else ladder in qca_uart_setup.
> 
> Signed-off-by: Venkata Lakshmi Narayana Gubba <gubbaven@codeaurora.org>
> ---
> drivers/bluetooth/btqca.c | 15 ++++++---------
> 1 file changed, 6 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c
> index 320c555..658fd8e4 100644
> --- a/drivers/bluetooth/btqca.c
> +++ b/drivers/bluetooth/btqca.c
> @@ -533,24 +533,21 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
> 
> 	config.user_baud_rate = baudrate;
> 
> +	/* Firmware files to download are based on ROM version.
> +	 * ROM version is derived from last two bytes of soc_ver.
> +	 */
> +	rom_ver = ((soc_ver & 0x00000f00) >> 0x04) |
> +		    (soc_ver & 0x0000000f);
> +

please try to align this properly.

Regards

Marcel


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v3 4/5] dt-bindings: net: bluetooth: Convert Qualcomm BT binding to DT schema
  2021-05-07  6:55     ` Marcel Holtmann
@ 2021-05-07 17:19       ` Rob Herring
  2021-05-13 15:21         ` Marcel Holtmann
  0 siblings, 1 reply; 16+ messages in thread
From: Rob Herring @ 2021-05-07 17:19 UTC (permalink / raw)
  To: Marcel Holtmann
  Cc: Venkata Lakshmi Narayana Gubba, Johan Hedberg, devicetree,
	Matthias Kaehlcke, open list, Bluetooth Kernel Mailing List,
	Hemantg, MSM, Balakrishna Godavarthi, Rocky Liao, hbandi,
	Abhishek Pandit-Subedi

On Fri, May 7, 2021 at 1:55 AM Marcel Holtmann <marcel@holtmann.org> wrote:
>
> Hi Venkata,
>
> >> Converted Qualcomm Bluetooth binidings to DT schema.
> >>
> >> Signed-off-by: Venkata Lakshmi Narayana Gubba <gubbaven@codeaurora.org>
> >> ---
> >> .../devicetree/bindings/net/qualcomm-bluetooth.txt |  69 -------------
> >> .../bindings/net/qualcomm-bluetooth.yaml           | 111 +++++++++++++++++++++
> >> 2 files changed, 111 insertions(+), 69 deletions(-)
> >> delete mode 100644 Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
> >> create mode 100644 Documentation/devicetree/bindings/net/qualcomm-bluetooth.yaml
> >
> >
> >> diff --git a/Documentation/devicetree/bindings/net/qualcomm-bluetooth.yaml b/Documentation/devicetree/bindings/net/qualcomm-bluetooth.yaml
> >> new file mode 100644
> >> index 0000000..3f3ec4d
> >> --- /dev/null
> >> +++ b/Documentation/devicetree/bindings/net/qualcomm-bluetooth.yaml
> >> @@ -0,0 +1,111 @@
> >> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> >> +%YAML 1.2
> >> +---
> >> +$id: http://devicetree.org/schemas/net/qualcomm-bluetooth.yaml#
> >> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> >> +
> >> +title: Qualcomm Bluetooth Chips
> >> +
> >> +maintainers:
> >> +  - Marcel Holtmann <marcel@holtmann.org>
> >
> > This should be someone who cares about Qcom BT.
>
> yes, please, assign this to someone that knows the hardware.
>
> Rob, can we leave this out for now if there is no dedicated person?

No, it's required. It can be me if it comes to that. However, if no
one can be bothered to step up, then we should just remove it perhaps.
QCom is a big company, I'm sure they can find some name.

Rob

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v3 3/5] Bluetooth: btqca: Moved extracting rom version info to common place
  2021-05-07  7:53   ` Marcel Holtmann
@ 2021-05-10 17:09     ` gubbaven
  0 siblings, 0 replies; 16+ messages in thread
From: gubbaven @ 2021-05-10 17:09 UTC (permalink / raw)
  To: Marcel Holtmann
  Cc: Johan Hedberg, devicetree, Matthias Kaehlcke, open list,
	Bluetooth Kernel Mailing List, Hemantg, MSM,
	Balakrishna Godavarthi, Rocky Liao, hbandi, abhishekpandit

Hi Marcel,
On 2021-05-07 13:23, Marcel Holtmann wrote:
> Hi Venkata,
> 
>> Moved extracting rom version info to common place as this code is
>> common in all if else ladder in qca_uart_setup.
>> 
>> Signed-off-by: Venkata Lakshmi Narayana Gubba 
>> <gubbaven@codeaurora.org>
>> ---
>> drivers/bluetooth/btqca.c | 15 ++++++---------
>> 1 file changed, 6 insertions(+), 9 deletions(-)
>> 
>> diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c
>> index 320c555..658fd8e4 100644
>> --- a/drivers/bluetooth/btqca.c
>> +++ b/drivers/bluetooth/btqca.c
>> @@ -533,24 +533,21 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t 
>> baudrate,
>> 
>> 	config.user_baud_rate = baudrate;
>> 
>> +	/* Firmware files to download are based on ROM version.
>> +	 * ROM version is derived from last two bytes of soc_ver.
>> +	 */
>> +	rom_ver = ((soc_ver & 0x00000f00) >> 0x04) |
>> +		    (soc_ver & 0x0000000f);
>> +
> 
> please try to align this properly.
> 
[Venkata]:
Sure, I will update in next patchset.
> Regards
> 
> Marcel

Regards,
Lakshmi Narayana.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v3 2/5] Bluetooth: btqca: Add support for firmware image with mbn type for WCN6750
  2021-05-07  7:00   ` Marcel Holtmann
@ 2021-05-10 17:16     ` gubbaven
  0 siblings, 0 replies; 16+ messages in thread
From: gubbaven @ 2021-05-10 17:16 UTC (permalink / raw)
  To: Marcel Holtmann
  Cc: Johan Hedberg, devicetree, mka, linux-kernel, linux-bluetooth,
	hemantg, linux-arm-msm, bgodavar, rjliao, hbandi, abhishekpandit

Hi Marcel,
On 2021-05-07 12:30, Marcel Holtmann wrote:
> Hi Venkata,
> 
>> 1. Added support to download firmware image with mbn type for wcn6750
>>   as it supports mbn type image.
>> 2. If mbn type image is not present then check for tlv type image.
>> 3. Added debug logs for mbn type image.
>> 
>> Signed-off-by: Venkata Lakshmi Narayana Gubba 
>> <gubbaven@codeaurora.org>
>> ---
>> drivers/bluetooth/btqca.c | 69 
>> +++++++++++++++++++++++++++++++++++------------
>> drivers/bluetooth/btqca.h |  3 ++-
>> 2 files changed, 54 insertions(+), 18 deletions(-)
>> 
>> diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c
>> index fce808c..320c555 100644
>> --- a/drivers/bluetooth/btqca.c
>> +++ b/drivers/bluetooth/btqca.c
>> @@ -182,7 +182,8 @@ int qca_send_pre_shutdown_cmd(struct hci_dev 
>> *hdev)
>> }
>> EXPORT_SYMBOL_GPL(qca_send_pre_shutdown_cmd);
>> 
>> -static void qca_tlv_check_data(struct qca_fw_config *config,
>> +static void qca_tlv_check_data(struct hci_dev *hdev,
>> +			       struct qca_fw_config *config,
>> 		const struct firmware *fw, enum qca_btsoc_type soc_type)
>> {
>> 	const u8 *data;
>> @@ -194,19 +195,21 @@ static void qca_tlv_check_data(struct 
>> qca_fw_config *config,
>> 	struct tlv_type_nvm *tlv_nvm;
>> 	uint8_t nvm_baud_rate = config->user_baud_rate;
>> 
>> -	tlv = (struct tlv_type_hdr *)fw->data;
>> -
>> -	type_len = le32_to_cpu(tlv->type_len);
>> -	length = (type_len >> 8) & 0x00ffffff;
>> -
>> -	BT_DBG("TLV Type\t\t : 0x%x", type_len & 0x000000ff);
>> -	BT_DBG("Length\t\t : %d bytes", length);
>> -
>> 	config->dnld_mode = QCA_SKIP_EVT_NONE;
>> 	config->dnld_type = QCA_SKIP_EVT_NONE;
>> 
>> 	switch (config->type) {
>> +	case ELF_TYPE_PATCH:
>> +		config->dnld_mode = QCA_SKIP_EVT_VSE_CC;
>> +		config->dnld_type = QCA_SKIP_EVT_VSE_CC;
>> +
>> +		bt_dev_dbg(hdev, "File Class        : 0x%x", fw->data[4]);
>> +		bt_dev_dbg(hdev, "Data Encoding     : 0x%x", fw->data[5]);
>> +		bt_dev_dbg(hdev, "File version      : 0x%x", fw->data[6]);
>> +		break;
>> 	case TLV_TYPE_PATCH:
>> +		tlv = (struct tlv_type_hdr *)fw->data;
> 
> Is this casting always necessary.
> 
[Venkata]:
I see that this casting is required.
>> +		type_len = le32_to_cpu(tlv->type_len);
>> 		tlv_patch = (struct tlv_type_patch *)tlv->data;
>> 
>> 		/* For Rome version 1.1 to 3.1, all segment commands
>> @@ -218,6 +221,7 @@ static void qca_tlv_check_data(struct 
>> qca_fw_config *config,
>> 		config->dnld_mode = tlv_patch->download_mode;
>> 		config->dnld_type = config->dnld_mode;
>> 
>> +		BT_DBG("TLV Type\t\t : 0x%x", type_len & 0x000000ff);
>> 		BT_DBG("Total Length           : %d bytes",
>> 		       le32_to_cpu(tlv_patch->total_size));
>> 		BT_DBG("Patch Data Length      : %d bytes",
>> @@ -243,6 +247,14 @@ static void qca_tlv_check_data(struct 
>> qca_fw_config *config,
>> 		break;
>> 
>> 	case TLV_TYPE_NVM:
>> +		tlv = (struct tlv_type_hdr *)fw->data;
>> +
>> +		type_len = le32_to_cpu(tlv->type_len);
>> +		length = (type_len >> 8) & 0x00ffffff;
>> +
>> +		BT_DBG("TLV Type\t\t : 0x%x", type_len & 0x000000ff);
>> +		BT_DBG("Length\t\t : %d bytes", length);
>> +
>> 		idx = 0;
>> 		data = tlv->data;
>> 		while (idx < length) {
>> @@ -387,7 +399,8 @@ static int qca_inject_cmd_complete_event(struct 
>> hci_dev *hdev)
>> 
>> static int qca_download_firmware(struct hci_dev *hdev,
>> 				 struct qca_fw_config *config,
>> -				 enum qca_btsoc_type soc_type)
>> +				 enum qca_btsoc_type soc_type,
>> +				 u8 rom_ver)
>> {
>> 	const struct firmware *fw;
>> 	const u8 *segment;
>> @@ -397,12 +410,30 @@ static int qca_download_firmware(struct hci_dev 
>> *hdev,
>> 
>> 	ret = request_firmware(&fw, config->fwname, &hdev->dev);
>> 	if (ret) {
>> -		bt_dev_err(hdev, "QCA Failed to request file: %s (%d)",
>> -			   config->fwname, ret);
>> -		return ret;
>> +		/* For WCN6750, if mbn file is not present then check for
>> +		 * tlv file.
>> +		 */
>> +		if (soc_type == QCA_WCN6750 && config->type == ELF_TYPE_PATCH) {
>> +			bt_dev_dbg(hdev, "QCA Failed to request file: %s (%d)",
>> +				   config->fwname, ret);
>> +			config->type = TLV_TYPE_PATCH;
>> +			snprintf(config->fwname, sizeof(config->fwname),
>> +				 "qca/msbtfw%02x.tlv", rom_ver);
>> +			bt_dev_info(hdev, "QCA Downloading %s", config->fwname);
>> +			ret = request_firmware(&fw, config->fwname, &hdev->dev);
>> +			if (ret) {
>> +				bt_dev_err(hdev, "QCA Failed to request file: %s (%d)",
>> +					   config->fwname, ret);
>> +				return ret;
>> +			}
>> +		} else {
>> +			bt_dev_err(hdev, "QCA Failed to request file: %s (%d)",
>> +				   config->fwname, ret);
>> +			return ret;
>> +		}
>> 	}
>> 
>> -	qca_tlv_check_data(config, fw, soc_type);
>> +	qca_tlv_check_data(hdev, config, fw, soc_type);
>> 
>> 	segment = fw->data;
>> 	remain = fw->size;
>> @@ -520,14 +551,18 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t 
>> baudrate,
>> 	} else if (soc_type == QCA_WCN6750) {
>> 		rom_ver = ((soc_ver & 0x00000f00) >> 0x04) |
>> 			    (soc_ver & 0x0000000f);
>> +		/* Choose mbn file by default.If mbn file is not found
>> +		 * then choose tlv file
>> +		 */
>> +		config.type = ELF_TYPE_PATCH;
>> 		snprintf(config.fwname, sizeof(config.fwname),
>> -			 "qca/msbtfw%02x.tlv", rom_ver);
>> +			 "qca/msbtfw%02x.mbn", rom_ver);
>> 	} else {
>> 		snprintf(config.fwname, sizeof(config.fwname),
>> 			 "qca/rampatch_%08x.bin", soc_ver);
>> 	}
>> 
>> -	err = qca_download_firmware(hdev, &config, soc_type);
>> +	err = qca_download_firmware(hdev, &config, soc_type, rom_ver);
>> 	if (err < 0) {
>> 		bt_dev_err(hdev, "QCA Failed to download patch (%d)", err);
>> 		return err;
>> @@ -560,7 +595,7 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t 
>> baudrate,
>> 		snprintf(config.fwname, sizeof(config.fwname),
>> 			 "qca/nvm_%08x.bin", soc_ver);
>> 
>> -	err = qca_download_firmware(hdev, &config, soc_type);
>> +	err = qca_download_firmware(hdev, &config, soc_type, rom_ver);
>> 	if (err < 0) {
>> 		bt_dev_err(hdev, "QCA Failed to download NVM (%d)", err);
>> 		return err;
>> diff --git a/drivers/bluetooth/btqca.h b/drivers/bluetooth/btqca.h
>> index dd82d2c..5a5e699 100644
>> --- a/drivers/bluetooth/btqca.h
>> +++ b/drivers/bluetooth/btqca.h
>> @@ -80,7 +80,8 @@ enum qca_tlv_dnld_mode {
>> 
>> enum qca_tlv_type {
>> 	TLV_TYPE_PATCH = 1,
>> -	TLV_TYPE_NVM
>> +	TLV_TYPE_NVM,
>> +	ELF_TYPE_PATCH
>> };
> 
> If you end the enum in a , then future diffs only show a single line
> of addition. So please ELF_TYPE_PATCH,.
> 
[Venkata]:
Sure, I will update in next patchset.
> Regards
> 
> Marcel
Regards,
Lakshmi Narayana.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v3 4/5] dt-bindings: net: bluetooth: Convert Qualcomm BT binding to DT schema
  2021-05-07 17:19       ` Rob Herring
@ 2021-05-13 15:21         ` Marcel Holtmann
  2021-05-18 16:30           ` gubbaven
  0 siblings, 1 reply; 16+ messages in thread
From: Marcel Holtmann @ 2021-05-13 15:21 UTC (permalink / raw)
  To: Rob Herring
  Cc: Venkata Lakshmi Narayana Gubba, Johan Hedberg, devicetree,
	Matthias Kaehlcke, open list, Bluetooth Kernel Mailing List,
	Hemantg, MSM, Balakrishna Godavarthi, Rocky Liao, hbandi,
	Abhishek Pandit-Subedi

Hi Rob,

>>>> Converted Qualcomm Bluetooth binidings to DT schema.
>>>> 
>>>> Signed-off-by: Venkata Lakshmi Narayana Gubba <gubbaven@codeaurora.org>
>>>> ---
>>>> .../devicetree/bindings/net/qualcomm-bluetooth.txt |  69 -------------
>>>> .../bindings/net/qualcomm-bluetooth.yaml           | 111 +++++++++++++++++++++
>>>> 2 files changed, 111 insertions(+), 69 deletions(-)
>>>> delete mode 100644 Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
>>>> create mode 100644 Documentation/devicetree/bindings/net/qualcomm-bluetooth.yaml
>>> 
>>> 
>>>> diff --git a/Documentation/devicetree/bindings/net/qualcomm-bluetooth.yaml b/Documentation/devicetree/bindings/net/qualcomm-bluetooth.yaml
>>>> new file mode 100644
>>>> index 0000000..3f3ec4d
>>>> --- /dev/null
>>>> +++ b/Documentation/devicetree/bindings/net/qualcomm-bluetooth.yaml
>>>> @@ -0,0 +1,111 @@
>>>> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
>>>> +%YAML 1.2
>>>> +---
>>>> +$id: http://devicetree.org/schemas/net/qualcomm-bluetooth.yaml#
>>>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>>>> +
>>>> +title: Qualcomm Bluetooth Chips
>>>> +
>>>> +maintainers:
>>>> +  - Marcel Holtmann <marcel@holtmann.org>
>>> 
>>> This should be someone who cares about Qcom BT.
>> 
>> yes, please, assign this to someone that knows the hardware.
>> 
>> Rob, can we leave this out for now if there is no dedicated person?
> 
> No, it's required. It can be me if it comes to that. However, if no
> one can be bothered to step up, then we should just remove it perhaps.
> QCom is a big company, I'm sure they can find some name.

I hope so as well since my name is clearly the wrong one there. I have too little knowledge about that hardware and the platforms it is used in.

Regards

Marcel


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v3 4/5] dt-bindings: net: bluetooth: Convert Qualcomm BT binding to DT schema
  2021-05-13 15:21         ` Marcel Holtmann
@ 2021-05-18 16:30           ` gubbaven
  0 siblings, 0 replies; 16+ messages in thread
From: gubbaven @ 2021-05-18 16:30 UTC (permalink / raw)
  To: Marcel Holtmann
  Cc: Rob Herring, Johan Hedberg, devicetree, Matthias Kaehlcke,
	open list, Bluetooth Kernel Mailing List, Hemantg, MSM,
	Balakrishna Godavarthi, Rocky Liao, hbandi,
	Abhishek Pandit-Subedi

Hi Marcel and Rob,

On 2021-05-13 20:51, Marcel Holtmann wrote:
> Hi Rob,
> 
>>>>> Converted Qualcomm Bluetooth binidings to DT schema.
>>>>> 
>>>>> Signed-off-by: Venkata Lakshmi Narayana Gubba 
>>>>> <gubbaven@codeaurora.org>
>>>>> ---
>>>>> .../devicetree/bindings/net/qualcomm-bluetooth.txt |  69 
>>>>> -------------
>>>>> .../bindings/net/qualcomm-bluetooth.yaml           | 111 
>>>>> +++++++++++++++++++++
>>>>> 2 files changed, 111 insertions(+), 69 deletions(-)
>>>>> delete mode 100644 
>>>>> Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
>>>>> create mode 100644 
>>>>> Documentation/devicetree/bindings/net/qualcomm-bluetooth.yaml
>>>> 
>>>> 
>>>>> diff --git 
>>>>> a/Documentation/devicetree/bindings/net/qualcomm-bluetooth.yaml 
>>>>> b/Documentation/devicetree/bindings/net/qualcomm-bluetooth.yaml
>>>>> new file mode 100644
>>>>> index 0000000..3f3ec4d
>>>>> --- /dev/null
>>>>> +++ b/Documentation/devicetree/bindings/net/qualcomm-bluetooth.yaml
>>>>> @@ -0,0 +1,111 @@
>>>>> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
>>>>> +%YAML 1.2
>>>>> +---
>>>>> +$id: http://devicetree.org/schemas/net/qualcomm-bluetooth.yaml#
>>>>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>>>>> +
>>>>> +title: Qualcomm Bluetooth Chips
>>>>> +
>>>>> +maintainers:
>>>>> +  - Marcel Holtmann <marcel@holtmann.org>
>>>> 
>>>> This should be someone who cares about Qcom BT.
>>> 
>>> yes, please, assign this to someone that knows the hardware.
>>> 
>>> Rob, can we leave this out for now if there is no dedicated person?
>> 
>> No, it's required. It can be me if it comes to that. However, if no
>> one can be bothered to step up, then we should just remove it perhaps.
>> QCom is a big company, I'm sure they can find some name.
> 
> I hope so as well since my name is clearly the wrong one there. I have
> too little knowledge about that hardware and the platforms it is used
> in.
> 
[Venkata]:
I will update maintainers names in next patchset.
> Regards
> 
> Marcel

Regards,
Venkata.

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2021-05-18 16:31 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-06 17:33 [PATCH v3 0/5] Enable Bluetooth functinality for WCN6750 Venkata Lakshmi Narayana Gubba
2021-05-06 17:33 ` [PATCH v3 1/5] Bluetooth: hci_qca: Add support for QTI Bluetooth chip wcn6750 Venkata Lakshmi Narayana Gubba
2021-05-06 17:33 ` [PATCH v3 2/5] Bluetooth: btqca: Add support for firmware image with mbn type for WCN6750 Venkata Lakshmi Narayana Gubba
2021-05-07  7:00   ` Marcel Holtmann
2021-05-10 17:16     ` gubbaven
2021-05-06 17:33 ` [PATCH v3 3/5] Bluetooth: btqca: Moved extracting rom version info to common place Venkata Lakshmi Narayana Gubba
2021-05-07  7:53   ` Marcel Holtmann
2021-05-10 17:09     ` gubbaven
2021-05-06 17:33 ` [PATCH v3 4/5] dt-bindings: net: bluetooth: Convert Qualcomm BT binding to DT schema Venkata Lakshmi Narayana Gubba
2021-05-07  1:17   ` Rob Herring
2021-05-07  6:55     ` Marcel Holtmann
2021-05-07 17:19       ` Rob Herring
2021-05-13 15:21         ` Marcel Holtmann
2021-05-18 16:30           ` gubbaven
2021-05-06 17:33 ` [PATCH v3 5/5] dt-bindings: net: bluetooth: Add device tree bindings for QTI chip wcn6750 Venkata Lakshmi Narayana Gubba
2021-05-07  1:19   ` Rob Herring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).