linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: hci_qca: Load customized NVM based on the device property
@ 2019-04-04  6:37 Rocky Liao
  2019-04-04  6:56 ` Balakrishna Godavarthi
  2019-04-04  9:08 ` [PATCH v2 1/2] " Rocky Liao
  0 siblings, 2 replies; 34+ messages in thread
From: Rocky Liao @ 2019-04-04  6:37 UTC (permalink / raw)
  To: marcel, johan.hedberg
  Cc: mka, linux-kernel, linux-bluetooth, linux-arm-msm, bgodavar, Rocky Liao

QCA BTSOC nvm is a customized file and different vendor/platoform may want
to have different BTSOC configuration via this file (e.g. Configure SCO over
PCM or I2S, Setting Tx power, etc.) This patch will allow vendors to download
different nvm file by reading a device property as the nvm file name postfix.

Signed-off-by: Rocky Liao <rjliao@codeaurora.org>
---
 drivers/bluetooth/btqca.c   | 13 +++++++++----
 drivers/bluetooth/btqca.h   |  4 ++--
 drivers/bluetooth/hci_qca.c | 18 +++++++++++++++++-
 3 files changed, 28 insertions(+), 7 deletions(-)

diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c
index 6122685..81e42f3 100644
--- a/drivers/bluetooth/btqca.c
+++ b/drivers/bluetooth/btqca.c
@@ -332,7 +332,7 @@ int qca_set_bdaddr_rome(struct hci_dev *hdev, const bdaddr_t *bdaddr)
 EXPORT_SYMBOL_GPL(qca_set_bdaddr_rome);
 
 int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
-		   enum qca_btsoc_type soc_type, u32 soc_ver)
+		   enum qca_btsoc_type soc_type, u32 soc_ver, const char *nvm_postfix)
 {
 	struct rome_config config;
 	int err;
@@ -368,9 +368,14 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
 	if (soc_type == QCA_WCN3990)
 		snprintf(config.fwname, sizeof(config.fwname),
 			 "qca/crnv%02x.bin", rom_ver);
-	else
-		snprintf(config.fwname, sizeof(config.fwname),
-			 "qca/nvm_%08x.bin", soc_ver);
+	else {
+		if (NULL == nvm_postfix)
+			snprintf(config.fwname, sizeof(config.fwname),
+				 "qca/nvm_%08x.bin", soc_ver);
+		else
+			snprintf(config.fwname, sizeof(config.fwname),
+				 "qca/nvm_%08x_%s.bin", soc_ver, nvm_postfix);
+	}
 
 	err = qca_download_firmware(hdev, &config);
 	if (err < 0) {
diff --git a/drivers/bluetooth/btqca.h b/drivers/bluetooth/btqca.h
index 6fdc25d..60a868f 100644
--- a/drivers/bluetooth/btqca.h
+++ b/drivers/bluetooth/btqca.h
@@ -139,7 +139,7 @@ enum qca_btsoc_type {
 
 int qca_set_bdaddr_rome(struct hci_dev *hdev, const bdaddr_t *bdaddr);
 int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
-		   enum qca_btsoc_type soc_type, u32 soc_ver);
+		   enum qca_btsoc_type soc_type, u32 soc_ver, const char *nvm_postfix);
 int qca_read_soc_version(struct hci_dev *hdev, u32 *soc_version);
 int qca_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr);
 #else
@@ -150,7 +150,7 @@ static inline int qca_set_bdaddr_rome(struct hci_dev *hdev, const bdaddr_t *bdad
 }
 
 static inline int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
-				 enum qca_btsoc_type soc_type, u32 soc_ver)
+				 enum qca_btsoc_type soc_type, u32 soc_ver, const char *nvm_postfix)
 {
 	return -EOPNOTSUPP;
 }
diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index 4ea995d..f495f3b 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -164,6 +164,7 @@ struct qca_serdev {
 	struct hci_uart	 serdev_hu;
 	struct gpio_desc *bt_en;
 	struct clk	 *susclk;
+	const char   *nvm_postfix;
 	enum qca_btsoc_type btsoc_type;
 	struct qca_power *bt_power;
 	u32 init_speed;
@@ -189,6 +190,17 @@ static enum qca_btsoc_type qca_soc_type(struct hci_uart *hu)
 	return soc_type;
 }
 
+static const char *qca_get_nvm_postfix(struct hci_uart *hu)
+{
+	if (hu->serdev) {
+		struct qca_serdev *qsd = serdev_device_get_drvdata(hu->serdev);
+
+		return qsd->nvm_postfix;
+	} else {
+		return NULL;
+	}
+}
+
 static void __serial_clock_on(struct tty_struct *tty)
 {
 	/* TODO: Some chipset requires to enable UART clock on client
@@ -1191,6 +1203,7 @@ static int qca_setup(struct hci_uart *hu)
 	struct qca_data *qca = hu->priv;
 	unsigned int speed, qca_baudrate = QCA_BAUDRATE_115200;
 	enum qca_btsoc_type soc_type = qca_soc_type(hu);
+	const char *nvm_postfix = qca_get_nvm_postfix(hu);
 	int ret;
 	int soc_ver = 0;
 
@@ -1241,7 +1254,7 @@ static int qca_setup(struct hci_uart *hu)
 
 	bt_dev_info(hdev, "QCA controller version 0x%08x", soc_ver);
 	/* Setup patch / NVM configurations */
-	ret = qca_uart_setup(hdev, qca_baudrate, soc_type, soc_ver);
+	ret = qca_uart_setup(hdev, qca_baudrate, soc_type, soc_ver, nvm_postfix);
 	if (!ret) {
 		set_bit(STATE_IN_BAND_SLEEP_ENABLED, &qca->flags);
 		qca_debugfs_init(hdev);
@@ -1462,6 +1475,9 @@ static int qca_serdev_probe(struct serdev_device *serdev)
 			return PTR_ERR(qcadev->bt_en);
 		}
 
+		device_property_read_string(&serdev->dev, "nvm-postfix",
+					 &qcadev->nvm_postfix);
+
 		qcadev->susclk = devm_clk_get(&serdev->dev, NULL);
 		if (IS_ERR(qcadev->susclk)) {
 			dev_err(&serdev->dev, "failed to acquire clk\n");
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project


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

* Re: [PATCH] Bluetooth: hci_qca: Load customized NVM based on the device property
  2019-04-04  6:37 [PATCH] Bluetooth: hci_qca: Load customized NVM based on the device property Rocky Liao
@ 2019-04-04  6:56 ` Balakrishna Godavarthi
  2019-04-04  9:08 ` [PATCH v2 1/2] " Rocky Liao
  1 sibling, 0 replies; 34+ messages in thread
From: Balakrishna Godavarthi @ 2019-04-04  6:56 UTC (permalink / raw)
  To: Rocky Liao
  Cc: marcel, johan.hedberg, mka, linux-kernel, linux-bluetooth,
	linux-arm-msm, hemantg

Hi Rocky,

On 2019-04-04 12:07, Rocky Liao wrote:
> QCA BTSOC nvm is a customized file and different vendor/platoform may 
> want
> to have different BTSOC configuration via this file (e.g. Configure SCO 
> over
> PCM or I2S, Setting Tx power, etc.) This patch will allow vendors to 
> download
> different nvm file by reading a device property as the nvm file name 
> postfix.
> 

[Bala]: add the property which your reading to the documentation file.
         "Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt"

> Signed-off-by: Rocky Liao <rjliao@codeaurora.org>
> ---
>  drivers/bluetooth/btqca.c   | 13 +++++++++----
>  drivers/bluetooth/btqca.h   |  4 ++--
>  drivers/bluetooth/hci_qca.c | 18 +++++++++++++++++-
>  3 files changed, 28 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c
> index 6122685..81e42f3 100644
> --- a/drivers/bluetooth/btqca.c
> +++ b/drivers/bluetooth/btqca.c
> @@ -332,7 +332,7 @@ int qca_set_bdaddr_rome(struct hci_dev *hdev,
> const bdaddr_t *bdaddr)
>  EXPORT_SYMBOL_GPL(qca_set_bdaddr_rome);
> 
>  int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
> -		   enum qca_btsoc_type soc_type, u32 soc_ver)
> +		   enum qca_btsoc_type soc_type, u32 soc_ver, const char 
> *nvm_postfix)
>  {
>  	struct rome_config config;
>  	int err;
> @@ -368,9 +368,14 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t 
> baudrate,
>  	if (soc_type == QCA_WCN3990)
>  		snprintf(config.fwname, sizeof(config.fwname),
>  			 "qca/crnv%02x.bin", rom_ver);
> -	else
> -		snprintf(config.fwname, sizeof(config.fwname),
> -			 "qca/nvm_%08x.bin", soc_ver);
> +	else {
> +		if (NULL == nvm_postfix)
[Bala]:
        something like this is more readable.
                 if (nvm_postfix)
                     append the nvm postfix string.
                 else
                     go with an default name.

> +			snprintf(config.fwname, sizeof(config.fwname),
> +				 "qca/nvm_%08x.bin", soc_ver);
> +		else
> +			snprintf(config.fwname, sizeof(config.fwname),
> +				 "qca/nvm_%08x_%s.bin", soc_ver, nvm_postfix);
> +	}
> 
>  	err = qca_download_firmware(hdev, &config);
>  	if (err < 0) {
> diff --git a/drivers/bluetooth/btqca.h b/drivers/bluetooth/btqca.h
> index 6fdc25d..60a868f 100644
> --- a/drivers/bluetooth/btqca.h
> +++ b/drivers/bluetooth/btqca.h
> @@ -139,7 +139,7 @@ enum qca_btsoc_type {
> 
>  int qca_set_bdaddr_rome(struct hci_dev *hdev, const bdaddr_t *bdaddr);
>  int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
> -		   enum qca_btsoc_type soc_type, u32 soc_ver);
> +		   enum qca_btsoc_type soc_type, u32 soc_ver, const char 
> *nvm_postfix);
>  int qca_read_soc_version(struct hci_dev *hdev, u32 *soc_version);
>  int qca_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr);
>  #else
> @@ -150,7 +150,7 @@ static inline int qca_set_bdaddr_rome(struct
> hci_dev *hdev, const bdaddr_t *bdad
>  }
> 
>  static inline int qca_uart_setup(struct hci_dev *hdev, uint8_t 
> baudrate,
> -				 enum qca_btsoc_type soc_type, u32 soc_ver)
> +				 enum qca_btsoc_type soc_type, u32 soc_ver, const char 
> *nvm_postfix)
>  {
>  	return -EOPNOTSUPP;
>  }
> diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
> index 4ea995d..f495f3b 100644
> --- a/drivers/bluetooth/hci_qca.c
> +++ b/drivers/bluetooth/hci_qca.c
> @@ -164,6 +164,7 @@ struct qca_serdev {
>  	struct hci_uart	 serdev_hu;
>  	struct gpio_desc *bt_en;
>  	struct clk	 *susclk;
> +	const char   *nvm_postfix;

[Bala]: nit: add the entry at last is preferred.

>  	enum qca_btsoc_type btsoc_type;
>  	struct qca_power *bt_power;
>  	u32 init_speed;
> @@ -189,6 +190,17 @@ static enum qca_btsoc_type qca_soc_type(struct
> hci_uart *hu)
>  	return soc_type;
>  }
> 
> +static const char *qca_get_nvm_postfix(struct hci_uart *hu)
> +{
> +	if (hu->serdev) {
> +		struct qca_serdev *qsd = serdev_device_get_drvdata(hu->serdev);
> +
> +		return qsd->nvm_postfix;
> +	} else {
> +		return NULL;
> +	}
> +}
> +
>  static void __serial_clock_on(struct tty_struct *tty)
>  {
>  	/* TODO: Some chipset requires to enable UART clock on client
> @@ -1191,6 +1203,7 @@ static int qca_setup(struct hci_uart *hu)
>  	struct qca_data *qca = hu->priv;
>  	unsigned int speed, qca_baudrate = QCA_BAUDRATE_115200;
>  	enum qca_btsoc_type soc_type = qca_soc_type(hu);
> +	const char *nvm_postfix = qca_get_nvm_postfix(hu);
>  	int ret;
>  	int soc_ver = 0;
> 
> @@ -1241,7 +1254,7 @@ static int qca_setup(struct hci_uart *hu)
> 
>  	bt_dev_info(hdev, "QCA controller version 0x%08x", soc_ver);
>  	/* Setup patch / NVM configurations */
> -	ret = qca_uart_setup(hdev, qca_baudrate, soc_type, soc_ver);
> +	ret = qca_uart_setup(hdev, qca_baudrate, soc_type, soc_ver, 
> nvm_postfix);
>  	if (!ret) {
>  		set_bit(STATE_IN_BAND_SLEEP_ENABLED, &qca->flags);
>  		qca_debugfs_init(hdev);
> @@ -1462,6 +1475,9 @@ static int qca_serdev_probe(struct serdev_device 
> *serdev)
>  			return PTR_ERR(qcadev->bt_en);
>  		}
> 
> +		device_property_read_string(&serdev->dev, "nvm-postfix",
> +					 &qcadev->nvm_postfix);
> +
>  		qcadev->susclk = devm_clk_get(&serdev->dev, NULL);
>  		if (IS_ERR(qcadev->susclk)) {
>  			dev_err(&serdev->dev, "failed to acquire clk\n");

-- 
Regards
Balakrishna.

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

* [PATCH v2 1/2] Bluetooth: hci_qca: Load customized NVM based on the device property
  2019-04-04  6:37 [PATCH] Bluetooth: hci_qca: Load customized NVM based on the device property Rocky Liao
  2019-04-04  6:56 ` Balakrishna Godavarthi
@ 2019-04-04  9:08 ` Rocky Liao
  2019-04-04  9:08   ` [PATCH v2 2/2] dt-bindings: net: bluetooth: Add device property nvm-postfix for QCA6174 Rocky Liao
                     ` (2 more replies)
  1 sibling, 3 replies; 34+ messages in thread
From: Rocky Liao @ 2019-04-04  9:08 UTC (permalink / raw)
  To: marcel, johan.hedberg
  Cc: mka, linux-kernel, linux-bluetooth, linux-arm-msm, bgodavar, Rocky Liao

QCA BTSOC nvm is a customized file and different vendor/platoform may want
to have different BTSOC configuration via this file (e.g. Configure SCO
over PCM or I2S, Setting Tx power, etc.) This patch will allow vendors to
download different nvm file by reading a device property "nvm-postfix" as
the nvm file name postfix.

Signed-off-by: Rocky Liao <rjliao@codeaurora.org>
---
Changes in v2:
  * added the property to the document file
    Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
  * fixed coding style warnings
  * moved the nvm-postfix to the last entry of the qca_serdev
---
 drivers/bluetooth/btqca.c   | 14 ++++++++++----
 drivers/bluetooth/btqca.h   |  6 ++++--
 drivers/bluetooth/hci_qca.c | 19 ++++++++++++++++++-
 3 files changed, 32 insertions(+), 7 deletions(-)

diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c
index 6122685..4e89286 100644
--- a/drivers/bluetooth/btqca.c
+++ b/drivers/bluetooth/btqca.c
@@ -332,7 +332,8 @@ int qca_set_bdaddr_rome(struct hci_dev *hdev, const bdaddr_t *bdaddr)
 EXPORT_SYMBOL_GPL(qca_set_bdaddr_rome);
 
 int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
-		   enum qca_btsoc_type soc_type, u32 soc_ver)
+		   enum qca_btsoc_type soc_type, u32 soc_ver,
+		   const char *nvm_postfix)
 {
 	struct rome_config config;
 	int err;
@@ -368,9 +369,14 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
 	if (soc_type == QCA_WCN3990)
 		snprintf(config.fwname, sizeof(config.fwname),
 			 "qca/crnv%02x.bin", rom_ver);
-	else
-		snprintf(config.fwname, sizeof(config.fwname),
-			 "qca/nvm_%08x.bin", soc_ver);
+	else {
+		if (nvm_postfix)
+			snprintf(config.fwname, sizeof(config.fwname),
+				 "qca/nvm_%08x_%s.bin", soc_ver, nvm_postfix);
+		else
+			snprintf(config.fwname, sizeof(config.fwname),
+				 "qca/nvm_%08x.bin", soc_ver);
+	}
 
 	err = qca_download_firmware(hdev, &config);
 	if (err < 0) {
diff --git a/drivers/bluetooth/btqca.h b/drivers/bluetooth/btqca.h
index 6fdc25d..0dd6cd0 100644
--- a/drivers/bluetooth/btqca.h
+++ b/drivers/bluetooth/btqca.h
@@ -139,7 +139,8 @@ enum qca_btsoc_type {
 
 int qca_set_bdaddr_rome(struct hci_dev *hdev, const bdaddr_t *bdaddr);
 int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
-		   enum qca_btsoc_type soc_type, u32 soc_ver);
+		   enum qca_btsoc_type soc_type, u32 soc_ver,
+		   const char *nvm_postfix);
 int qca_read_soc_version(struct hci_dev *hdev, u32 *soc_version);
 int qca_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr);
 #else
@@ -150,7 +151,8 @@ static inline int qca_set_bdaddr_rome(struct hci_dev *hdev, const bdaddr_t *bdad
 }
 
 static inline int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
-				 enum qca_btsoc_type soc_type, u32 soc_ver)
+				 enum qca_btsoc_type soc_type, u32 soc_ver,
+				 const char *nvm_postfix)
 {
 	return -EOPNOTSUPP;
 }
diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index 4ea995d..560e880 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -168,6 +168,7 @@ struct qca_serdev {
 	struct qca_power *bt_power;
 	u32 init_speed;
 	u32 oper_speed;
+	const char *nvm_postfix;
 };
 
 static int qca_power_setup(struct hci_uart *hu, bool on);
@@ -189,6 +190,17 @@ static enum qca_btsoc_type qca_soc_type(struct hci_uart *hu)
 	return soc_type;
 }
 
+static const char *qca_get_nvm_postfix(struct hci_uart *hu)
+{
+	if (hu->serdev) {
+		struct qca_serdev *qsd = serdev_device_get_drvdata(hu->serdev);
+
+		return qsd->nvm_postfix;
+	} else {
+		return NULL;
+	}
+}
+
 static void __serial_clock_on(struct tty_struct *tty)
 {
 	/* TODO: Some chipset requires to enable UART clock on client
@@ -1191,6 +1203,7 @@ static int qca_setup(struct hci_uart *hu)
 	struct qca_data *qca = hu->priv;
 	unsigned int speed, qca_baudrate = QCA_BAUDRATE_115200;
 	enum qca_btsoc_type soc_type = qca_soc_type(hu);
+	const char *nvm_postfix = qca_get_nvm_postfix(hu);
 	int ret;
 	int soc_ver = 0;
 
@@ -1241,7 +1254,8 @@ static int qca_setup(struct hci_uart *hu)
 
 	bt_dev_info(hdev, "QCA controller version 0x%08x", soc_ver);
 	/* Setup patch / NVM configurations */
-	ret = qca_uart_setup(hdev, qca_baudrate, soc_type, soc_ver);
+	ret = qca_uart_setup(hdev, qca_baudrate, soc_type, soc_ver,
+			nvm_postfix);
 	if (!ret) {
 		set_bit(STATE_IN_BAND_SLEEP_ENABLED, &qca->flags);
 		qca_debugfs_init(hdev);
@@ -1462,6 +1476,9 @@ static int qca_serdev_probe(struct serdev_device *serdev)
 			return PTR_ERR(qcadev->bt_en);
 		}
 
+		device_property_read_string(&serdev->dev, "nvm-postfix",
+					 &qcadev->nvm_postfix);
+
 		qcadev->susclk = devm_clk_get(&serdev->dev, NULL);
 		if (IS_ERR(qcadev->susclk)) {
 			dev_err(&serdev->dev, "failed to acquire clk\n");
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project


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

* [PATCH v2 2/2] dt-bindings: net: bluetooth: Add device property nvm-postfix for QCA6174
  2019-04-04  9:08 ` [PATCH v2 1/2] " Rocky Liao
@ 2019-04-04  9:08   ` Rocky Liao
  2019-04-04 12:32     ` Marc Gonzalez
  2019-04-10  9:27     ` [PATCH v3 2/2] dt-bindings: net: bluetooth: Add device property firmware-name " Rocky Liao
  2019-04-04  9:59   ` [PATCH v2 1/2] Bluetooth: hci_qca: Load customized NVM based on the device property Balakrishna Godavarthi
  2019-04-10  9:27   ` [PATCH v3 " Rocky Liao
  2 siblings, 2 replies; 34+ messages in thread
From: Rocky Liao @ 2019-04-04  9:08 UTC (permalink / raw)
  To: marcel, johan.hedberg
  Cc: mka, linux-kernel, linux-bluetooth, linux-arm-msm, bgodavar, Rocky Liao

This patchs patch adds an optional device property nvm-postfix to allow the
driver to load customized nvm file based on this property

Signed-off-by: Rocky Liao <rjliao@codeaurora.org>
---
Changes in v2:
  * added the property to the document file
    Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
  * fixed coding style warnings
  * moved the nvm-postfix to the last entry of the qca_serdev
---
 Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt b/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
index 824c0e2..70cda4b 100644
--- a/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
+++ b/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
@@ -16,6 +16,7 @@ Optional properties for compatible string qcom,qca6174-bt:
 
  - enable-gpios: gpio specifier used to enable chip
  - clocks: clock provided to the controller (SUSCLK_32KHZ)
+ - nvm-postfix: nvm file postfix to load customized nvm file
 
 Required properties for compatible string qcom,wcn3990-bt:
 
@@ -39,6 +40,7 @@ serial@7570000 {
 
 		enable-gpios = <&pm8994_gpios 19 GPIO_ACTIVE_HIGH>;
 		clocks = <&divclk4>;
+		nvm-postfix = "i2s";
 	};
 };
 
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project


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

* Re: [PATCH v2 1/2] Bluetooth: hci_qca: Load customized NVM based on the device property
  2019-04-04  9:08 ` [PATCH v2 1/2] " Rocky Liao
  2019-04-04  9:08   ` [PATCH v2 2/2] dt-bindings: net: bluetooth: Add device property nvm-postfix for QCA6174 Rocky Liao
@ 2019-04-04  9:59   ` Balakrishna Godavarthi
  2019-04-10  9:27   ` [PATCH v3 " Rocky Liao
  2 siblings, 0 replies; 34+ messages in thread
From: Balakrishna Godavarthi @ 2019-04-04  9:59 UTC (permalink / raw)
  To: Rocky Liao
  Cc: marcel, johan.hedberg, mka, linux-kernel, linux-bluetooth,
	linux-arm-msm, hemantg

Hi Rocky,

On 2019-04-04 14:38, Rocky Liao wrote:
> QCA BTSOC nvm is a customized file and different vendor/platoform may 
> want
> to have different BTSOC configuration via this file (e.g. Configure SCO
> over PCM or I2S, Setting Tx power, etc.) This patch will allow vendors 
> to
> download different nvm file by reading a device property "nvm-postfix" 
> as
> the nvm file name postfix.
> 
> Signed-off-by: Rocky Liao <rjliao@codeaurora.org>
> ---
> Changes in v2:
>   * added the property to the document file
>     Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
>   * fixed coding style warnings
>   * moved the nvm-postfix to the last entry of the qca_serdev
> ---
>  drivers/bluetooth/btqca.c   | 14 ++++++++++----
>  drivers/bluetooth/btqca.h   |  6 ++++--
>  drivers/bluetooth/hci_qca.c | 19 ++++++++++++++++++-
>  3 files changed, 32 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c
> index 6122685..4e89286 100644
> --- a/drivers/bluetooth/btqca.c
> +++ b/drivers/bluetooth/btqca.c
> @@ -332,7 +332,8 @@ int qca_set_bdaddr_rome(struct hci_dev *hdev,
> const bdaddr_t *bdaddr)
>  EXPORT_SYMBOL_GPL(qca_set_bdaddr_rome);
> 
>  int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
> -		   enum qca_btsoc_type soc_type, u32 soc_ver)
> +		   enum qca_btsoc_type soc_type, u32 soc_ver,
> +		   const char *nvm_postfix)
>  {
>  	struct rome_config config;
>  	int err;
> @@ -368,9 +369,14 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t 
> baudrate,
>  	if (soc_type == QCA_WCN3990)
>  		snprintf(config.fwname, sizeof(config.fwname),
>  			 "qca/crnv%02x.bin", rom_ver);
> -	else
> -		snprintf(config.fwname, sizeof(config.fwname),
> -			 "qca/nvm_%08x.bin", soc_ver);
> +	else {
> +		if (nvm_postfix)
> +			snprintf(config.fwname, sizeof(config.fwname),
> +				 "qca/nvm_%08x_%s.bin", soc_ver, nvm_postfix);
> +		else
> +			snprintf(config.fwname, sizeof(config.fwname),
> +				 "qca/nvm_%08x.bin", soc_ver);
> +	}
> 
>  	err = qca_download_firmware(hdev, &config);
>  	if (err < 0) {
> diff --git a/drivers/bluetooth/btqca.h b/drivers/bluetooth/btqca.h
> index 6fdc25d..0dd6cd0 100644
> --- a/drivers/bluetooth/btqca.h
> +++ b/drivers/bluetooth/btqca.h
> @@ -139,7 +139,8 @@ enum qca_btsoc_type {
> 
>  int qca_set_bdaddr_rome(struct hci_dev *hdev, const bdaddr_t *bdaddr);
>  int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
> -		   enum qca_btsoc_type soc_type, u32 soc_ver);
> +		   enum qca_btsoc_type soc_type, u32 soc_ver,
> +		   const char *nvm_postfix);
>  int qca_read_soc_version(struct hci_dev *hdev, u32 *soc_version);
>  int qca_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr);
>  #else
> @@ -150,7 +151,8 @@ static inline int qca_set_bdaddr_rome(struct
> hci_dev *hdev, const bdaddr_t *bdad
>  }
> 
>  static inline int qca_uart_setup(struct hci_dev *hdev, uint8_t 
> baudrate,
> -				 enum qca_btsoc_type soc_type, u32 soc_ver)
> +				 enum qca_btsoc_type soc_type, u32 soc_ver,
> +				 const char *nvm_postfix)
>  {
>  	return -EOPNOTSUPP;
>  }
> diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
> index 4ea995d..560e880 100644
> --- a/drivers/bluetooth/hci_qca.c
> +++ b/drivers/bluetooth/hci_qca.c
> @@ -168,6 +168,7 @@ struct qca_serdev {
>  	struct qca_power *bt_power;
>  	u32 init_speed;
>  	u32 oper_speed;
> +	const char *nvm_postfix;

[Bala]: I guess your trying to the read the type of communication for 
SCO.
         so i would recommend to change this to variable name to 
sco_com_type or might be to the use understandable name.
         just an suggestion. Don't respin right away wait for other 
comments too :)

>  };
> 
>  static int qca_power_setup(struct hci_uart *hu, bool on);
> @@ -189,6 +190,17 @@ static enum qca_btsoc_type qca_soc_type(struct
> hci_uart *hu)
>  	return soc_type;
>  }
> 
> +static const char *qca_get_nvm_postfix(struct hci_uart *hu)
> +{
> +	if (hu->serdev) {
> +		struct qca_serdev *qsd = serdev_device_get_drvdata(hu->serdev);
> +
> +		return qsd->nvm_postfix;
> +	} else {
> +		return NULL;
> +	}
> +}
> +
>  static void __serial_clock_on(struct tty_struct *tty)
>  {
>  	/* TODO: Some chipset requires to enable UART clock on client
> @@ -1191,6 +1203,7 @@ static int qca_setup(struct hci_uart *hu)
>  	struct qca_data *qca = hu->priv;
>  	unsigned int speed, qca_baudrate = QCA_BAUDRATE_115200;
>  	enum qca_btsoc_type soc_type = qca_soc_type(hu);
> +	const char *nvm_postfix = qca_get_nvm_postfix(hu);
>  	int ret;
>  	int soc_ver = 0;
> 
> @@ -1241,7 +1254,8 @@ static int qca_setup(struct hci_uart *hu)
> 
>  	bt_dev_info(hdev, "QCA controller version 0x%08x", soc_ver);
>  	/* Setup patch / NVM configurations */
> -	ret = qca_uart_setup(hdev, qca_baudrate, soc_type, soc_ver);
> +	ret = qca_uart_setup(hdev, qca_baudrate, soc_type, soc_ver,
> +			nvm_postfix);
>  	if (!ret) {
>  		set_bit(STATE_IN_BAND_SLEEP_ENABLED, &qca->flags);
>  		qca_debugfs_init(hdev);
> @@ -1462,6 +1476,9 @@ static int qca_serdev_probe(struct serdev_device 
> *serdev)
>  			return PTR_ERR(qcadev->bt_en);
>  		}
> 
> +		device_property_read_string(&serdev->dev, "nvm-postfix",
> +					 &qcadev->nvm_postfix);
> +
>  		qcadev->susclk = devm_clk_get(&serdev->dev, NULL);
>  		if (IS_ERR(qcadev->susclk)) {
>  			dev_err(&serdev->dev, "failed to acquire clk\n");

-- 
Regards
Balakrishna.

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

* Re: [PATCH v2 2/2] dt-bindings: net: bluetooth: Add device property nvm-postfix for QCA6174
  2019-04-04  9:08   ` [PATCH v2 2/2] dt-bindings: net: bluetooth: Add device property nvm-postfix for QCA6174 Rocky Liao
@ 2019-04-04 12:32     ` Marc Gonzalez
  2019-04-09 10:15       ` Rocky Liao
  2019-04-09 13:54       ` Rob Herring
  2019-04-10  9:27     ` [PATCH v3 2/2] dt-bindings: net: bluetooth: Add device property firmware-name " Rocky Liao
  1 sibling, 2 replies; 34+ messages in thread
From: Marc Gonzalez @ 2019-04-04 12:32 UTC (permalink / raw)
  To: Rocky Liao, marcel, johan.hedberg
  Cc: Matthias Kaehlcke, LKML, linux-bluetooth, MSM, bgodavar, Rob Herring

+robh

On 04/04/2019 11:08, Rocky Liao wrote:

> This patchs patch adds an optional device property nvm-postfix to allow the
> driver to load customized nvm file based on this property

While text /before/ is indeed called a "prefix", text /after/ is not a "postfix",
but a "suffix".


>  Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt b/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
> index 824c0e2..70cda4b 100644
> --- a/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
> +++ b/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
> @@ -16,6 +16,7 @@ Optional properties for compatible string qcom,qca6174-bt:
>  
>   - enable-gpios: gpio specifier used to enable chip
>   - clocks: clock provided to the controller (SUSCLK_32KHZ)
> + - nvm-postfix: nvm file postfix to load customized nvm file

The device tree is supposed to describe hardware.

The name of which file to load can hardly be considered part of the HW.

Possible solutions:
1) derive the file name from the compatible string
2) pass the name as a module parameter
3) something else


> @@ -39,6 +40,7 @@ serial@7570000 {
>  
>  		enable-gpios = <&pm8994_gpios 19 GPIO_ACTIVE_HIGH>;
>  		clocks = <&divclk4>;
> +		nvm-postfix = "i2s";
>  	};
>  };

If one provides the entire suffix, including the underscore, then you can
simplify the code:

	snprintf(config.fwname, sizeof(config.fwname), "qca/nvm_%08x%s.bin", soc_ver, suffix ? suffix : "");

Regards.

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

* Re: [PATCH v2 2/2] dt-bindings: net: bluetooth: Add device property nvm-postfix for QCA6174
  2019-04-04 12:32     ` Marc Gonzalez
@ 2019-04-09 10:15       ` Rocky Liao
  2019-04-09 14:03         ` Rob Herring
  2019-04-09 13:54       ` Rob Herring
  1 sibling, 1 reply; 34+ messages in thread
From: Rocky Liao @ 2019-04-09 10:15 UTC (permalink / raw)
  To: Marc Gonzalez
  Cc: marcel, johan.hedberg, Matthias Kaehlcke, LKML, linux-bluetooth,
	MSM, bgodavar, Rob Herring

On 2019-04-04 20:32, Marc Gonzalez wrote:
> +robh
> 
> On 04/04/2019 11:08, Rocky Liao wrote:
> 
>> This patchs patch adds an optional device property nvm-postfix to 
>> allow the
>> driver to load customized nvm file based on this property
> 
> While text /before/ is indeed called a "prefix", text /after/ is not a
> "postfix",
> but a "suffix".
> 
> 
>>  Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt | 2 ++
>>  1 file changed, 2 insertions(+)
>> 
>> diff --git 
>> a/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt 
>> b/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
>> index 824c0e2..70cda4b 100644
>> --- a/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
>> +++ b/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
>> @@ -16,6 +16,7 @@ Optional properties for compatible string 
>> qcom,qca6174-bt:
>> 
>>   - enable-gpios: gpio specifier used to enable chip
>>   - clocks: clock provided to the controller (SUSCLK_32KHZ)
>> + - nvm-postfix: nvm file postfix to load customized nvm file
> 
> The device tree is supposed to describe hardware.
> 
> The name of which file to load can hardly be considered part of the HW.
> 
> Possible solutions:
> 1) derive the file name from the compatible string
> 2) pass the name as a module parameter
> 3) something else
> 
> 
>> @@ -39,6 +40,7 @@ serial@7570000 {
>> 
>>  		enable-gpios = <&pm8994_gpios 19 GPIO_ACTIVE_HIGH>;
>>  		clocks = <&divclk4>;
>> +		nvm-postfix = "i2s";
>>  	};
>>  };
> 
> If one provides the entire suffix, including the underscore, then you 
> can
> simplify the code:
> 
> 	snprintf(config.fwname, sizeof(config.fwname), "qca/nvm_%08x%s.bin",
> soc_ver, suffix ? suffix : "");
> 
> Regards
.
Hi Marc,

The major purpose for that property is about the BT audio bus type, can 
it be considered as part of the HW? If yes maybe we can use a property 
name "audio-bus" to reflect that.

If not then I will adopt the solution 1 to add a new compatible string 
"{ .compatible = "qcom,qca6174-bt-i2s" }" and load specific nvm for this 
compatible string, please feel free to let me know if any other 
concerns.

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora 
Forum,
a Linux Foundation Collaborative Project

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

* Re: [PATCH v2 2/2] dt-bindings: net: bluetooth: Add device property nvm-postfix for QCA6174
  2019-04-04 12:32     ` Marc Gonzalez
  2019-04-09 10:15       ` Rocky Liao
@ 2019-04-09 13:54       ` Rob Herring
  1 sibling, 0 replies; 34+ messages in thread
From: Rob Herring @ 2019-04-09 13:54 UTC (permalink / raw)
  To: Marc Gonzalez
  Cc: Rocky Liao, Marcel Holtmann, Johan Hedberg, Matthias Kaehlcke,
	LKML, open list:BLUETOOTH DRIVERS, MSM, Balakrishna Godavarthi

On Thu, Apr 4, 2019 at 7:32 AM Marc Gonzalez <marc.w.gonzalez@free.fr> wrote:
>
> +robh
>
> On 04/04/2019 11:08, Rocky Liao wrote:
>
> > This patchs patch adds an optional device property nvm-postfix to allow the
> > driver to load customized nvm file based on this property
>
> While text /before/ is indeed called a "prefix", text /after/ is not a "postfix",
> but a "suffix".
>
>
> >  Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt b/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
> > index 824c0e2..70cda4b 100644
> > --- a/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
> > +++ b/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
> > @@ -16,6 +16,7 @@ Optional properties for compatible string qcom,qca6174-bt:
> >
> >   - enable-gpios: gpio specifier used to enable chip
> >   - clocks: clock provided to the controller (SUSCLK_32KHZ)
> > + - nvm-postfix: nvm file postfix to load customized nvm file
>
> The device tree is supposed to describe hardware.
>
> The name of which file to load can hardly be considered part of the HW.
>
> Possible solutions:
> 1) derive the file name from the compatible string
> 2) pass the name as a module parameter
> 3) something else

Or use the 'firmware-name' property to define the full firmware filename.

Rob

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

* Re: [PATCH v2 2/2] dt-bindings: net: bluetooth: Add device property nvm-postfix for QCA6174
  2019-04-09 10:15       ` Rocky Liao
@ 2019-04-09 14:03         ` Rob Herring
  2019-04-09 14:48           ` Rocky Liao
  0 siblings, 1 reply; 34+ messages in thread
From: Rob Herring @ 2019-04-09 14:03 UTC (permalink / raw)
  To: Rocky Liao
  Cc: Marc Gonzalez, Marcel Holtmann, Johan Hedberg, Matthias Kaehlcke,
	LKML, open list:BLUETOOTH DRIVERS, MSM, Balakrishna Godavarthi

On Tue, Apr 9, 2019 at 5:15 AM Rocky Liao <rjliao@codeaurora.org> wrote:
>
> On 2019-04-04 20:32, Marc Gonzalez wrote:
> > +robh
> >
> > On 04/04/2019 11:08, Rocky Liao wrote:
> >
> >> This patchs patch adds an optional device property nvm-postfix to
> >> allow the
> >> driver to load customized nvm file based on this property
> >
> > While text /before/ is indeed called a "prefix", text /after/ is not a
> > "postfix",
> > but a "suffix".
> >
> >
> >>  Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt | 2 ++
> >>  1 file changed, 2 insertions(+)
> >>
> >> diff --git
> >> a/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
> >> b/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
> >> index 824c0e2..70cda4b 100644
> >> --- a/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
> >> +++ b/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
> >> @@ -16,6 +16,7 @@ Optional properties for compatible string
> >> qcom,qca6174-bt:
> >>
> >>   - enable-gpios: gpio specifier used to enable chip
> >>   - clocks: clock provided to the controller (SUSCLK_32KHZ)
> >> + - nvm-postfix: nvm file postfix to load customized nvm file
> >
> > The device tree is supposed to describe hardware.
> >
> > The name of which file to load can hardly be considered part of the HW.
> >
> > Possible solutions:
> > 1) derive the file name from the compatible string
> > 2) pass the name as a module parameter
> > 3) something else
> >
> >
> >> @@ -39,6 +40,7 @@ serial@7570000 {
> >>
> >>              enable-gpios = <&pm8994_gpios 19 GPIO_ACTIVE_HIGH>;
> >>              clocks = <&divclk4>;
> >> +            nvm-postfix = "i2s";
> >>      };
> >>  };
> >
> > If one provides the entire suffix, including the underscore, then you
> > can
> > simplify the code:
> >
> >       snprintf(config.fwname, sizeof(config.fwname), "qca/nvm_%08x%s.bin",
> > soc_ver, suffix ? suffix : "");
> >
> > Regards
> .
> Hi Marc,
>
> The major purpose for that property is about the BT audio bus type, can
> it be considered as part of the HW? If yes maybe we can use a property
> name "audio-bus" to reflect that.
>
> If not then I will adopt the solution 1 to add a new compatible string
> "{ .compatible = "qcom,qca6174-bt-i2s" }" and load specific nvm for this
> compatible string, please feel free to let me know if any other
> concerns.

I don't think the suggestion was to add the nvm string to the
compatible, but rather compatible strings serve as a map key. Having
board specific firmware files for wifi/bt is pretty common, but
parameters for 'i2s' is a bit strange. So a better explanation of what
parameters this contains would help. How/when does it vary, for
example?

Also, if it is only a handful of parameters, making them DT properties
is preferred.

Rob

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

* Re: [PATCH v2 2/2] dt-bindings: net: bluetooth: Add device property nvm-postfix for QCA6174
  2019-04-09 14:03         ` Rob Herring
@ 2019-04-09 14:48           ` Rocky Liao
  0 siblings, 0 replies; 34+ messages in thread
From: Rocky Liao @ 2019-04-09 14:48 UTC (permalink / raw)
  To: Rob Herring
  Cc: Marc Gonzalez, Marcel Holtmann, Johan Hedberg, Matthias Kaehlcke,
	LKML, open list:BLUETOOTH DRIVERS, MSM, Balakrishna Godavarthi

On 2019-04-09 22:03, Rob Herring wrote:
> On Tue, Apr 9, 2019 at 5:15 AM Rocky Liao <rjliao@codeaurora.org> 
> wrote:
>> 
>> On 2019-04-04 20:32, Marc Gonzalez wrote:
>> > +robh
>> >
>> > On 04/04/2019 11:08, Rocky Liao wrote:
>> >
>> >> This patchs patch adds an optional device property nvm-postfix to
>> >> allow the
>> >> driver to load customized nvm file based on this property
>> >
>> > While text /before/ is indeed called a "prefix", text /after/ is not a
>> > "postfix",
>> > but a "suffix".
>> >
>> >
>> >>  Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt | 2 ++
>> >>  1 file changed, 2 insertions(+)
>> >>
>> >> diff --git
>> >> a/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
>> >> b/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
>> >> index 824c0e2..70cda4b 100644
>> >> --- a/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
>> >> +++ b/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
>> >> @@ -16,6 +16,7 @@ Optional properties for compatible string
>> >> qcom,qca6174-bt:
>> >>
>> >>   - enable-gpios: gpio specifier used to enable chip
>> >>   - clocks: clock provided to the controller (SUSCLK_32KHZ)
>> >> + - nvm-postfix: nvm file postfix to load customized nvm file
>> >
>> > The device tree is supposed to describe hardware.
>> >
>> > The name of which file to load can hardly be considered part of the HW.
>> >
>> > Possible solutions:
>> > 1) derive the file name from the compatible string
>> > 2) pass the name as a module parameter
>> > 3) something else
>> >
>> >
>> >> @@ -39,6 +40,7 @@ serial@7570000 {
>> >>
>> >>              enable-gpios = <&pm8994_gpios 19 GPIO_ACTIVE_HIGH>;
>> >>              clocks = <&divclk4>;
>> >> +            nvm-postfix = "i2s";
>> >>      };
>> >>  };
>> >
>> > If one provides the entire suffix, including the underscore, then you
>> > can
>> > simplify the code:
>> >
>> >       snprintf(config.fwname, sizeof(config.fwname), "qca/nvm_%08x%s.bin",
>> > soc_ver, suffix ? suffix : "");
>> >
>> > Regards
>> .
>> Hi Marc,
>> 
>> The major purpose for that property is about the BT audio bus type, 
>> can
>> it be considered as part of the HW? If yes maybe we can use a property
>> name "audio-bus" to reflect that.
>> 
>> If not then I will adopt the solution 1 to add a new compatible string
>> "{ .compatible = "qcom,qca6174-bt-i2s" }" and load specific nvm for 
>> this
>> compatible string, please feel free to let me know if any other
>> concerns.
> 
> I don't think the suggestion was to add the nvm string to the
> compatible, but rather compatible strings serve as a map key. Having
> board specific firmware files for wifi/bt is pretty common, but
> parameters for 'i2s' is a bit strange. So a better explanation of what
> parameters this contains would help. How/when does it vary, for
> example?
> 
> Also, if it is only a handful of parameters, making them DT properties
> is preferred.
> 
> Rob

Ok, I prefer to go with adding a device property "firmware-name" with 
full firmware name as you suggested in previous comment.
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora 
Forum,
a Linux Foundation Collaborative Project

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

* [PATCH v3 1/2] Bluetooth: hci_qca: Load customized NVM based on the device property
  2019-04-04  9:08 ` [PATCH v2 1/2] " Rocky Liao
  2019-04-04  9:08   ` [PATCH v2 2/2] dt-bindings: net: bluetooth: Add device property nvm-postfix for QCA6174 Rocky Liao
  2019-04-04  9:59   ` [PATCH v2 1/2] Bluetooth: hci_qca: Load customized NVM based on the device property Balakrishna Godavarthi
@ 2019-04-10  9:27   ` Rocky Liao
  2019-05-12  3:19     ` [PATCH v4 " Rocky Liao
  2 siblings, 1 reply; 34+ messages in thread
From: Rocky Liao @ 2019-04-10  9:27 UTC (permalink / raw)
  To: robh+dt, mark.rutland, marcel, johan.hedberg, thierry.escande
  Cc: netdev, devicetree, linux-kernel, linux-bluetooth, linux-arm-msm,
	bgodavar, Rocky Liao

QCA BTSOC NVM is a customized firmware file and different vendors may
want to have different BTSOC configuration (e.g. Configure SCO over PCM
or I2S, Setting Tx power, etc.) via this file. This patch will allow
vendors to download different NVM firmware file by reading a device
property "firmware-name".

Signed-off-by: Rocky Liao <rjliao@codeaurora.org>
---
Changes in v3:
  * added firmware-name instead of nvm-postfix to specify full firmware name
---
 drivers/bluetooth/btqca.c   | 14 ++++++++++----
 drivers/bluetooth/btqca.h   |  6 ++++--
 drivers/bluetooth/hci_qca.c | 19 ++++++++++++++++++-
 3 files changed, 32 insertions(+), 7 deletions(-)

diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c
index 6122685..645a893 100644
--- a/drivers/bluetooth/btqca.c
+++ b/drivers/bluetooth/btqca.c
@@ -332,7 +332,8 @@ int qca_set_bdaddr_rome(struct hci_dev *hdev, const bdaddr_t *bdaddr)
 EXPORT_SYMBOL_GPL(qca_set_bdaddr_rome);
 
 int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
-		   enum qca_btsoc_type soc_type, u32 soc_ver)
+		   enum qca_btsoc_type soc_type, u32 soc_ver,
+		   const char *firmware_name)
 {
 	struct rome_config config;
 	int err;
@@ -368,9 +369,14 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
 	if (soc_type == QCA_WCN3990)
 		snprintf(config.fwname, sizeof(config.fwname),
 			 "qca/crnv%02x.bin", rom_ver);
-	else
-		snprintf(config.fwname, sizeof(config.fwname),
-			 "qca/nvm_%08x.bin", soc_ver);
+	else {
+		if (firmware_name)
+			snprintf(config.fwname, sizeof(config.fwname),
+				 "qca/%s", firmware_name);
+		else
+			snprintf(config.fwname, sizeof(config.fwname),
+				 "qca/nvm_%08x.bin", soc_ver);
+	}
 
 	err = qca_download_firmware(hdev, &config);
 	if (err < 0) {
diff --git a/drivers/bluetooth/btqca.h b/drivers/bluetooth/btqca.h
index 6fdc25d..41dc806 100644
--- a/drivers/bluetooth/btqca.h
+++ b/drivers/bluetooth/btqca.h
@@ -139,7 +139,8 @@ enum qca_btsoc_type {
 
 int qca_set_bdaddr_rome(struct hci_dev *hdev, const bdaddr_t *bdaddr);
 int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
-		   enum qca_btsoc_type soc_type, u32 soc_ver);
+		   enum qca_btsoc_type soc_type, u32 soc_ver,
+		   const char *firmware_name);
 int qca_read_soc_version(struct hci_dev *hdev, u32 *soc_version);
 int qca_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr);
 #else
@@ -150,7 +151,8 @@ static inline int qca_set_bdaddr_rome(struct hci_dev *hdev, const bdaddr_t *bdad
 }
 
 static inline int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
-				 enum qca_btsoc_type soc_type, u32 soc_ver)
+				 enum qca_btsoc_type soc_type, u32 soc_ver,
+				 const char *firmware_name)
 {
 	return -EOPNOTSUPP;
 }
diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index 4ea995d..9b8d4d7 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -168,6 +168,7 @@ struct qca_serdev {
 	struct qca_power *bt_power;
 	u32 init_speed;
 	u32 oper_speed;
+	const char *firmware_name;
 };
 
 static int qca_power_setup(struct hci_uart *hu, bool on);
@@ -189,6 +190,17 @@ static enum qca_btsoc_type qca_soc_type(struct hci_uart *hu)
 	return soc_type;
 }
 
+static const char *qca_get_firmware_name(struct hci_uart *hu)
+{
+	if (hu->serdev) {
+		struct qca_serdev *qsd = serdev_device_get_drvdata(hu->serdev);
+
+		return qsd->firmware_name;
+	} else {
+		return NULL;
+	}
+}
+
 static void __serial_clock_on(struct tty_struct *tty)
 {
 	/* TODO: Some chipset requires to enable UART clock on client
@@ -1191,6 +1203,7 @@ static int qca_setup(struct hci_uart *hu)
 	struct qca_data *qca = hu->priv;
 	unsigned int speed, qca_baudrate = QCA_BAUDRATE_115200;
 	enum qca_btsoc_type soc_type = qca_soc_type(hu);
+	const char *firmware_name = qca_get_firmware_name(hu);
 	int ret;
 	int soc_ver = 0;
 
@@ -1241,7 +1254,8 @@ static int qca_setup(struct hci_uart *hu)
 
 	bt_dev_info(hdev, "QCA controller version 0x%08x", soc_ver);
 	/* Setup patch / NVM configurations */
-	ret = qca_uart_setup(hdev, qca_baudrate, soc_type, soc_ver);
+	ret = qca_uart_setup(hdev, qca_baudrate, soc_type, soc_ver,
+			firmware_name);
 	if (!ret) {
 		set_bit(STATE_IN_BAND_SLEEP_ENABLED, &qca->flags);
 		qca_debugfs_init(hdev);
@@ -1462,6 +1476,9 @@ static int qca_serdev_probe(struct serdev_device *serdev)
 			return PTR_ERR(qcadev->bt_en);
 		}
 
+		device_property_read_string(&serdev->dev, "firmware-name",
+					 &qcadev->firmware_name);
+
 		qcadev->susclk = devm_clk_get(&serdev->dev, NULL);
 		if (IS_ERR(qcadev->susclk)) {
 			dev_err(&serdev->dev, "failed to acquire clk\n");
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project


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

* [PATCH v3 2/2] dt-bindings: net: bluetooth: Add device property firmware-name for QCA6174
  2019-04-04  9:08   ` [PATCH v2 2/2] dt-bindings: net: bluetooth: Add device property nvm-postfix for QCA6174 Rocky Liao
  2019-04-04 12:32     ` Marc Gonzalez
@ 2019-04-10  9:27     ` Rocky Liao
  2019-04-23 17:06       ` Marcel Holtmann
                         ` (2 more replies)
  1 sibling, 3 replies; 34+ messages in thread
From: Rocky Liao @ 2019-04-10  9:27 UTC (permalink / raw)
  To: robh+dt, mark.rutland, marcel, johan.hedberg, thierry.escande
  Cc: netdev, devicetree, linux-kernel, linux-bluetooth, linux-arm-msm,
	bgodavar, Rocky Liao

This patch adds an optional device property "firmware-name" to allow the
driver to load customized nvm firmware file based on this property.

Signed-off-by: Rocky Liao <rjliao@codeaurora.org>
---
Changes in v3:
  * added firmware-name instead of nvm-postfix to specify full firmware name
---
 Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt b/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
index 824c0e2..2bcea50 100644
--- a/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
+++ b/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
@@ -16,6 +16,7 @@ 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
 
 Required properties for compatible string qcom,wcn3990-bt:
 
@@ -39,6 +40,7 @@ serial@7570000 {
 
 		enable-gpios = <&pm8994_gpios 19 GPIO_ACTIVE_HIGH>;
 		clocks = <&divclk4>;
+		firmware-name = "nvm_00440302.bin";
 	};
 };
 
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project


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

* Re: [PATCH v3 2/2] dt-bindings: net: bluetooth: Add device property firmware-name for QCA6174
  2019-04-10  9:27     ` [PATCH v3 2/2] dt-bindings: net: bluetooth: Add device property firmware-name " Rocky Liao
@ 2019-04-23 17:06       ` Marcel Holtmann
  2019-04-24  6:19         ` Rocky Liao
  2019-04-26 20:50       ` Rob Herring
  2019-05-12  3:19       ` [PATCH v4 " Rocky Liao
  2 siblings, 1 reply; 34+ messages in thread
From: Marcel Holtmann @ 2019-04-23 17:06 UTC (permalink / raw)
  To: Rocky Liao
  Cc: Rob Herring, Mark Rutland, Johan Hedberg, thierry.escande,
	netdev, devicetree, linux-kernel, linux-bluetooth, linux-arm-msm,
	bgodavar

Hi Rocky,

> This patch adds an optional device property "firmware-name" to allow the
> driver to load customized nvm firmware file based on this property.
> 
> Signed-off-by: Rocky Liao <rjliao@codeaurora.org>
> ---
> Changes in v3:
>  * added firmware-name instead of nvm-postfix to specify full firmware name
> ---
> Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt | 2 ++
> 1 file changed, 2 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt b/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
> index 824c0e2..2bcea50 100644
> --- a/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
> +++ b/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
> @@ -16,6 +16,7 @@ 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
> 
> Required properties for compatible string qcom,wcn3990-bt:
> 
> @@ -39,6 +40,7 @@ serial@7570000 {
> 
> 		enable-gpios = <&pm8994_gpios 19 GPIO_ACTIVE_HIGH>;
> 		clocks = <&divclk4>;
> +		firmware-name = "nvm_00440302.bin";
> 	};

and how is this a firmware-name property. Wouldn’t this be more like nvm-file or something along these lines. This really needs to be cleared with Rob to pick the right property name.

Regards

Marcel


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

* Re: [PATCH v3 2/2] dt-bindings: net: bluetooth: Add device property firmware-name for QCA6174
  2019-04-23 17:06       ` Marcel Holtmann
@ 2019-04-24  6:19         ` Rocky Liao
  2019-04-26 17:45           ` Rob Herring
  0 siblings, 1 reply; 34+ messages in thread
From: Rocky Liao @ 2019-04-24  6:19 UTC (permalink / raw)
  To: Marcel Holtmann
  Cc: Rob Herring, Mark Rutland, Johan Hedberg, thierry.escande,
	netdev, devicetree, linux-kernel, linux-bluetooth, linux-arm-msm,
	bgodavar

On 2019-04-24 01:06, Marcel Holtmann wrote:
> Hi Rocky,
> 
>> This patch adds an optional device property "firmware-name" to allow 
>> the
>> driver to load customized nvm firmware file based on this property.
>> 
>> Signed-off-by: Rocky Liao <rjliao@codeaurora.org>
>> ---
>> Changes in v3:
>>  * added firmware-name instead of nvm-postfix to specify full firmware 
>> name
>> ---
>> Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt | 2 ++
>> 1 file changed, 2 insertions(+)
>> 
>> diff --git 
>> a/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt 
>> b/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
>> index 824c0e2..2bcea50 100644
>> --- a/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
>> +++ b/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
>> @@ -16,6 +16,7 @@ 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
>> 
>> Required properties for compatible string qcom,wcn3990-bt:
>> 
>> @@ -39,6 +40,7 @@ serial@7570000 {
>> 
>> 		enable-gpios = <&pm8994_gpios 19 GPIO_ACTIVE_HIGH>;
>> 		clocks = <&divclk4>;
>> +		firmware-name = "nvm_00440302.bin";
>> 	};
> 
> and how is this a firmware-name property. Wouldn’t this be more like
> nvm-file or something along these lines. This really needs to be
> cleared with Rob to pick the right property name.
> 
> Regards
> 
> Marcel

Hi Rob,

Are you OK to use a property name "nvm-file" or "firmware-nvm-file"? 
Actually we have two firmware files, one is the patch file which is 
common to all of the products, the other is the nvm file which is 
customized. Using a "nvm-file" or "firmware-nvm-file" property name 
would be more clear.

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora 
Forum,
a Linux Foundation Collaborative Project

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

* Re: [PATCH v3 2/2] dt-bindings: net: bluetooth: Add device property firmware-name for QCA6174
  2019-04-24  6:19         ` Rocky Liao
@ 2019-04-26 17:45           ` Rob Herring
  2019-04-27  5:59             ` Marcel Holtmann
  0 siblings, 1 reply; 34+ messages in thread
From: Rob Herring @ 2019-04-26 17:45 UTC (permalink / raw)
  To: Rocky Liao
  Cc: Marcel Holtmann, Mark Rutland, Johan Hedberg, Thierry Escande,
	netdev, devicetree, linux-kernel, open list:BLUETOOTH DRIVERS,
	linux-arm-msm, Balakrishna Godavarthi

On Wed, Apr 24, 2019 at 1:19 AM Rocky Liao <rjliao@codeaurora.org> wrote:
>
> On 2019-04-24 01:06, Marcel Holtmann wrote:
> > Hi Rocky,
> >
> >> This patch adds an optional device property "firmware-name" to allow
> >> the
> >> driver to load customized nvm firmware file based on this property.
> >>
> >> Signed-off-by: Rocky Liao <rjliao@codeaurora.org>
> >> ---
> >> Changes in v3:
> >>  * added firmware-name instead of nvm-postfix to specify full firmware
> >> name
> >> ---
> >> Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt | 2 ++
> >> 1 file changed, 2 insertions(+)
> >>
> >> diff --git
> >> a/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
> >> b/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
> >> index 824c0e2..2bcea50 100644
> >> --- a/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
> >> +++ b/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
> >> @@ -16,6 +16,7 @@ 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
> >>
> >> Required properties for compatible string qcom,wcn3990-bt:
> >>
> >> @@ -39,6 +40,7 @@ serial@7570000 {
> >>
> >>              enable-gpios = <&pm8994_gpios 19 GPIO_ACTIVE_HIGH>;
> >>              clocks = <&divclk4>;
> >> +            firmware-name = "nvm_00440302.bin";
> >>      };
> >
> > and how is this a firmware-name property. Wouldn’t this be more like
> > nvm-file or something along these lines. This really needs to be
> > cleared with Rob to pick the right property name.
> >
> > Regards
> >
> > Marcel
>
> Hi Rob,
>
> Are you OK to use a property name "nvm-file" or "firmware-nvm-file"?
> Actually we have two firmware files, one is the patch file which is
> common to all of the products, the other is the nvm file which is
> customized. Using a "nvm-file" or "firmware-nvm-file" property name
> would be more clear.

'firmware-name' is the standard name for specifying firmware file names.

Rob

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

* Re: [PATCH v3 2/2] dt-bindings: net: bluetooth: Add device property firmware-name for QCA6174
  2019-04-10  9:27     ` [PATCH v3 2/2] dt-bindings: net: bluetooth: Add device property firmware-name " Rocky Liao
  2019-04-23 17:06       ` Marcel Holtmann
@ 2019-04-26 20:50       ` Rob Herring
  2019-05-12  3:19       ` [PATCH v4 " Rocky Liao
  2 siblings, 0 replies; 34+ messages in thread
From: Rob Herring @ 2019-04-26 20:50 UTC (permalink / raw)
  To: Rocky Liao
  Cc: robh+dt, mark.rutland, marcel, johan.hedberg, thierry.escande,
	netdev, devicetree, linux-kernel, linux-bluetooth, linux-arm-msm,
	bgodavar, Rocky Liao

On Wed, 10 Apr 2019 17:27:56 +0800, Rocky Liao wrote:
> This patch adds an optional device property "firmware-name" to allow the
> driver to load customized nvm firmware file based on this property.
> 
> Signed-off-by: Rocky Liao <rjliao@codeaurora.org>
> ---
> Changes in v3:
>   * added firmware-name instead of nvm-postfix to specify full firmware name
> ---
>  Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt | 2 ++
>  1 file changed, 2 insertions(+)
> 

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

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

* Re: [PATCH v3 2/2] dt-bindings: net: bluetooth: Add device property firmware-name for QCA6174
  2019-04-26 17:45           ` Rob Herring
@ 2019-04-27  5:59             ` Marcel Holtmann
  2019-05-03  7:56               ` Rocky Liao
  0 siblings, 1 reply; 34+ messages in thread
From: Marcel Holtmann @ 2019-04-27  5:59 UTC (permalink / raw)
  To: Rob Herring
  Cc: Rocky Liao, Mark Rutland, Johan Hedberg, Thierry Escande, netdev,
	devicetree, linux-kernel, open list:BLUETOOTH DRIVERS,
	linux-arm-msm, Balakrishna Godavarthi

Hi Rob,

>>>> This patch adds an optional device property "firmware-name" to allow
>>>> the
>>>> driver to load customized nvm firmware file based on this property.
>>>> 
>>>> Signed-off-by: Rocky Liao <rjliao@codeaurora.org>
>>>> ---
>>>> Changes in v3:
>>>> * added firmware-name instead of nvm-postfix to specify full firmware
>>>> name
>>>> ---
>>>> Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt | 2 ++
>>>> 1 file changed, 2 insertions(+)
>>>> 
>>>> diff --git
>>>> a/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
>>>> b/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
>>>> index 824c0e2..2bcea50 100644
>>>> --- a/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
>>>> +++ b/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
>>>> @@ -16,6 +16,7 @@ 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
>>>> 
>>>> Required properties for compatible string qcom,wcn3990-bt:
>>>> 
>>>> @@ -39,6 +40,7 @@ serial@7570000 {
>>>> 
>>>>             enable-gpios = <&pm8994_gpios 19 GPIO_ACTIVE_HIGH>;
>>>>             clocks = <&divclk4>;
>>>> +            firmware-name = "nvm_00440302.bin";
>>>>     };
>>> 
>>> and how is this a firmware-name property. Wouldn’t this be more like
>>> nvm-file or something along these lines. This really needs to be
>>> cleared with Rob to pick the right property name.
>>> 
>>> Regards
>>> 
>>> Marcel
>> 
>> Hi Rob,
>> 
>> Are you OK to use a property name "nvm-file" or "firmware-nvm-file"?
>> Actually we have two firmware files, one is the patch file which is
>> common to all of the products, the other is the nvm file which is
>> customized. Using a "nvm-file" or "firmware-nvm-file" property name
>> would be more clear.
> 
> 'firmware-name' is the standard name for specifying firmware file names.

but it is not a firmware file, it is a NVM file. What happens if in the future they need a firmware file and a NVM file?

Regards

Marcel


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

* Re: [PATCH v3 2/2] dt-bindings: net: bluetooth: Add device property firmware-name for QCA6174
  2019-04-27  5:59             ` Marcel Holtmann
@ 2019-05-03  7:56               ` Rocky Liao
  2019-05-05 17:32                 ` Marcel Holtmann
  0 siblings, 1 reply; 34+ messages in thread
From: Rocky Liao @ 2019-05-03  7:56 UTC (permalink / raw)
  To: Marcel Holtmann
  Cc: Rob Herring, Mark Rutland, Johan Hedberg, Thierry Escande,
	netdev, devicetree, linux-kernel, open list:BLUETOOTH DRIVERS,
	linux-arm-msm, Balakrishna Godavarthi, linux-bluetooth-owner

Hi Marcel,

On 2019-04-27 13:59, Marcel Holtmann wrote:
> Hi Rob,
> 
>>>>> This patch adds an optional device property "firmware-name" to 
>>>>> allow
>>>>> the
>>>>> driver to load customized nvm firmware file based on this property.
>>>>> 
>>>>> Signed-off-by: Rocky Liao <rjliao@codeaurora.org>
>>>>> ---
>>>>> Changes in v3:
>>>>> * added firmware-name instead of nvm-postfix to specify full 
>>>>> firmware
>>>>> name
>>>>> ---
>>>>> Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt | 2 ++
>>>>> 1 file changed, 2 insertions(+)
>>>>> 
>>>>> diff --git
>>>>> a/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
>>>>> b/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
>>>>> index 824c0e2..2bcea50 100644
>>>>> --- a/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
>>>>> +++ b/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
>>>>> @@ -16,6 +16,7 @@ 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
>>>>> 
>>>>> Required properties for compatible string qcom,wcn3990-bt:
>>>>> 
>>>>> @@ -39,6 +40,7 @@ serial@7570000 {
>>>>> 
>>>>>             enable-gpios = <&pm8994_gpios 19 GPIO_ACTIVE_HIGH>;
>>>>>             clocks = <&divclk4>;
>>>>> +            firmware-name = "nvm_00440302.bin";
>>>>>     };
>>>> 
>>>> and how is this a firmware-name property. Wouldn’t this be more like
>>>> nvm-file or something along these lines. This really needs to be
>>>> cleared with Rob to pick the right property name.
>>>> 
>>>> Regards
>>>> 
>>>> Marcel
>>> 
>>> Hi Rob,
>>> 
>>> Are you OK to use a property name "nvm-file" or "firmware-nvm-file"?
>>> Actually we have two firmware files, one is the patch file which is
>>> common to all of the products, the other is the nvm file which is
>>> customized. Using a "nvm-file" or "firmware-nvm-file" property name
>>> would be more clear.
>> 
>> 'firmware-name' is the standard name for specifying firmware file 
>> names.
> 
> but it is not a firmware file, it is a NVM file. What happens if in
> the future they need a firmware file and a NVM file?
> 
> Regards
> 
> Marcel

We won't need to specify a rampatch firmware file in future as it's a 
same file for all the boards with same chip, only the NVM firmware file 
may have board differences. NVM file is also one of the firmware files 
so I think it should be OK to use "firmware-name" property to specify 
it.

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora 
Forum,
a Linux Foundation Collaborative Project

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

* Re: [PATCH v3 2/2] dt-bindings: net: bluetooth: Add device property firmware-name for QCA6174
  2019-05-03  7:56               ` Rocky Liao
@ 2019-05-05 17:32                 ` Marcel Holtmann
  0 siblings, 0 replies; 34+ messages in thread
From: Marcel Holtmann @ 2019-05-05 17:32 UTC (permalink / raw)
  To: Rocky Liao
  Cc: Rob Herring, Mark Rutland, Johan Hedberg, Thierry Escande,
	netdev, devicetree, linux-kernel, open list:BLUETOOTH DRIVERS,
	linux-arm-msm, Balakrishna Godavarthi, linux-bluetooth-owner

Hi Rocky,

>>>>>> This patch adds an optional device property "firmware-name" to allow
>>>>>> the
>>>>>> driver to load customized nvm firmware file based on this property.
>>>>>> Signed-off-by: Rocky Liao <rjliao@codeaurora.org>
>>>>>> ---
>>>>>> Changes in v3:
>>>>>> * added firmware-name instead of nvm-postfix to specify full firmware
>>>>>> name
>>>>>> ---
>>>>>> Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt | 2 ++
>>>>>> 1 file changed, 2 insertions(+)
>>>>>> diff --git
>>>>>> a/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
>>>>>> b/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
>>>>>> index 824c0e2..2bcea50 100644
>>>>>> --- a/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
>>>>>> +++ b/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
>>>>>> @@ -16,6 +16,7 @@ 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
>>>>>> Required properties for compatible string qcom,wcn3990-bt:
>>>>>> @@ -39,6 +40,7 @@ serial@7570000 {
>>>>>>            enable-gpios = <&pm8994_gpios 19 GPIO_ACTIVE_HIGH>;
>>>>>>            clocks = <&divclk4>;
>>>>>> +            firmware-name = "nvm_00440302.bin";
>>>>>>    };
>>>>> and how is this a firmware-name property. Wouldn’t this be more like
>>>>> nvm-file or something along these lines. This really needs to be
>>>>> cleared with Rob to pick the right property name.
>>>>> Regards
>>>>> Marcel
>>>> Hi Rob,
>>>> Are you OK to use a property name "nvm-file" or "firmware-nvm-file"?
>>>> Actually we have two firmware files, one is the patch file which is
>>>> common to all of the products, the other is the nvm file which is
>>>> customized. Using a "nvm-file" or "firmware-nvm-file" property name
>>>> would be more clear.
>>> 'firmware-name' is the standard name for specifying firmware file names.
>> but it is not a firmware file, it is a NVM file. What happens if in
>> the future they need a firmware file and a NVM file?
>> Regards
>> Marcel
> 
> We won't need to specify a rampatch firmware file in future as it's a same file for all the boards with same chip, only the NVM firmware file may have board differences. NVM file is also one of the firmware files so I think it should be OK to use "firmware-name" property to specify it.

ok then, but I need patches that apply cleanly against bluetooth-next.

Regards

Marcel


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

* [PATCH v4 1/2] Bluetooth: hci_qca: Load customized NVM based on the device property
  2019-04-10  9:27   ` [PATCH v3 " Rocky Liao
@ 2019-05-12  3:19     ` Rocky Liao
  2019-05-15  5:32       ` Balakrishna Godavarthi
  2019-05-15 11:19       ` [PATCH v5 " Rocky Liao
  0 siblings, 2 replies; 34+ messages in thread
From: Rocky Liao @ 2019-05-12  3:19 UTC (permalink / raw)
  To: robh+dt, mark.rutland, marcel, johan.hedberg, thierry.escande
  Cc: netdev, devicetree, linux-kernel, linux-bluetooth, linux-arm-msm,
	bgodavar, Rocky Liao

QCA BTSOC NVM is a customized firmware file and different vendors may
want to have different BTSOC configuration (e.g. Configure SCO over PCM
or I2S, Setting Tx power, etc.) via this file. This patch will allow
vendors to download different NVM firmware file by reading a device
property "firmware-name".

Signed-off-by: Rocky Liao <rjliao@codeaurora.org>
---
Changes in v4:
  * rebased the code base and merge with latest code
---
 drivers/bluetooth/btqca.c   | 14 ++++++++++----
 drivers/bluetooth/btqca.h   |  6 ++++--
 drivers/bluetooth/hci_qca.c | 19 ++++++++++++++++++-
 3 files changed, 32 insertions(+), 7 deletions(-)

diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c
index cc12eec..0ea690a 100644
--- a/drivers/bluetooth/btqca.c
+++ b/drivers/bluetooth/btqca.c
@@ -332,7 +332,8 @@ int qca_set_bdaddr_rome(struct hci_dev *hdev, const bdaddr_t *bdaddr)
 EXPORT_SYMBOL_GPL(qca_set_bdaddr_rome);
 
 int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
-		   enum qca_btsoc_type soc_type, u32 soc_ver)
+		   enum qca_btsoc_type soc_type, u32 soc_ver,
+		   const char *firmware_name)
 {
 	struct rome_config config;
 	int err;
@@ -368,9 +369,14 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
 	if (qca_is_wcn399x(soc_type))
 		snprintf(config.fwname, sizeof(config.fwname),
 			 "qca/crnv%02x.bin", rom_ver);
-	else
-		snprintf(config.fwname, sizeof(config.fwname),
-			 "qca/nvm_%08x.bin", soc_ver);
+	else {
+		if (firmware_name)
+			snprintf(config.fwname, sizeof(config.fwname),
+				 "qca/%s", firmware_name);
+		else
+			snprintf(config.fwname, sizeof(config.fwname),
+				 "qca/nvm_%08x.bin", soc_ver);
+	}
 
 	err = qca_download_firmware(hdev, &config);
 	if (err < 0) {
diff --git a/drivers/bluetooth/btqca.h b/drivers/bluetooth/btqca.h
index 4c4fe2b..8c037bb 100644
--- a/drivers/bluetooth/btqca.h
+++ b/drivers/bluetooth/btqca.h
@@ -140,7 +140,8 @@ enum qca_btsoc_type {
 
 int qca_set_bdaddr_rome(struct hci_dev *hdev, const bdaddr_t *bdaddr);
 int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
-		   enum qca_btsoc_type soc_type, u32 soc_ver);
+		   enum qca_btsoc_type soc_type, u32 soc_ver,
+		   const char *firmware_name);
 int qca_read_soc_version(struct hci_dev *hdev, u32 *soc_version);
 int qca_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr);
 static inline bool qca_is_wcn399x(enum qca_btsoc_type soc_type)
@@ -155,7 +156,8 @@ static inline int qca_set_bdaddr_rome(struct hci_dev *hdev, const bdaddr_t *bdad
 }
 
 static inline int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
-				 enum qca_btsoc_type soc_type, u32 soc_ver)
+				 enum qca_btsoc_type soc_type, u32 soc_ver,
+				 const char *firmware_name)
 {
 	return -EOPNOTSUPP;
 }
diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index 57322c4..9590602 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -169,6 +169,7 @@ struct qca_serdev {
 	struct qca_power *bt_power;
 	u32 init_speed;
 	u32 oper_speed;
+	const char *firmware_name;
 };
 
 static int qca_power_setup(struct hci_uart *hu, bool on);
@@ -190,6 +191,17 @@ static enum qca_btsoc_type qca_soc_type(struct hci_uart *hu)
 	return soc_type;
 }
 
+static const char *qca_get_firmware_name(struct hci_uart *hu)
+{
+	if (hu->serdev) {
+		struct qca_serdev *qsd = serdev_device_get_drvdata(hu->serdev);
+
+		return qsd->firmware_name;
+	} else {
+		return NULL;
+	}
+}
+
 static void __serial_clock_on(struct tty_struct *tty)
 {
 	/* TODO: Some chipset requires to enable UART clock on client
@@ -1195,6 +1207,7 @@ static int qca_setup(struct hci_uart *hu)
 	struct qca_data *qca = hu->priv;
 	unsigned int speed, qca_baudrate = QCA_BAUDRATE_115200;
 	enum qca_btsoc_type soc_type = qca_soc_type(hu);
+	const char *firmware_name = qca_get_firmware_name(hu);
 	int ret;
 	int soc_ver = 0;
 
@@ -1245,7 +1258,8 @@ static int qca_setup(struct hci_uart *hu)
 
 	bt_dev_info(hdev, "QCA controller version 0x%08x", soc_ver);
 	/* Setup patch / NVM configurations */
-	ret = qca_uart_setup(hdev, qca_baudrate, soc_type, soc_ver);
+	ret = qca_uart_setup(hdev, qca_baudrate, soc_type, soc_ver,
+			firmware_name);
 	if (!ret) {
 		set_bit(QCA_IBS_ENABLED, &qca->flags);
 		qca_debugfs_init(hdev);
@@ -1477,6 +1491,9 @@ static int qca_serdev_probe(struct serdev_device *serdev)
 			return PTR_ERR(qcadev->bt_en);
 		}
 
+		device_property_read_string(&serdev->dev, "firmware-name",
+					 &qcadev->firmware_name);
+
 		qcadev->susclk = devm_clk_get(&serdev->dev, NULL);
 		if (IS_ERR(qcadev->susclk)) {
 			dev_err(&serdev->dev, "failed to acquire clk\n");
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project


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

* [PATCH v4 2/2] dt-bindings: net: bluetooth: Add device property firmware-name for QCA6174
  2019-04-10  9:27     ` [PATCH v3 2/2] dt-bindings: net: bluetooth: Add device property firmware-name " Rocky Liao
  2019-04-23 17:06       ` Marcel Holtmann
  2019-04-26 20:50       ` Rob Herring
@ 2019-05-12  3:19       ` Rocky Liao
  2019-05-13 15:31         ` Rob Herring
  2019-05-15 11:20         ` [PATCH v5 " Rocky Liao
  2 siblings, 2 replies; 34+ messages in thread
From: Rocky Liao @ 2019-05-12  3:19 UTC (permalink / raw)
  To: robh+dt, mark.rutland, marcel, johan.hedberg, thierry.escande
  Cc: netdev, devicetree, linux-kernel, linux-bluetooth, linux-arm-msm,
	bgodavar, Rocky Liao

This patch adds an optional device property "firmware-name" to allow the
driver to load customized nvm firmware file based on this property.

Signed-off-by: Rocky Liao <rjliao@codeaurora.org>
---
Changes in v4:
  * rebased the code base and merge with latest code
---
 Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt b/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
index 7ef6118..7a3eda7 100644
--- a/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
+++ b/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
@@ -17,6 +17,7 @@ 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
 
 Required properties for compatible string qcom,wcn399x-bt:
 
@@ -40,6 +41,7 @@ serial@7570000 {
 
 		enable-gpios = <&pm8994_gpios 19 GPIO_ACTIVE_HIGH>;
 		clocks = <&divclk4>;
+		firmware-name = "nvm_00440302.bin";
 	};
 };
 
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project


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

* Re: [PATCH v4 2/2] dt-bindings: net: bluetooth: Add device property firmware-name for QCA6174
  2019-05-12  3:19       ` [PATCH v4 " Rocky Liao
@ 2019-05-13 15:31         ` Rob Herring
  2019-05-15 11:20         ` [PATCH v5 " Rocky Liao
  1 sibling, 0 replies; 34+ messages in thread
From: Rob Herring @ 2019-05-13 15:31 UTC (permalink / raw)
  To: Rocky Liao
  Cc: robh+dt, mark.rutland, marcel, johan.hedberg, thierry.escande,
	netdev, devicetree, linux-kernel, linux-bluetooth, linux-arm-msm,
	bgodavar, Rocky Liao

On Sun, 12 May 2019 11:19:45 +0800, Rocky Liao wrote:
> This patch adds an optional device property "firmware-name" to allow the
> driver to load customized nvm firmware file based on this property.
> 
> Signed-off-by: Rocky Liao <rjliao@codeaurora.org>
> ---
> Changes in v4:
>   * rebased the code base and merge with latest code
> ---
>  Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt | 2 ++
>  1 file changed, 2 insertions(+)
> 

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

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

* Re: [PATCH v4 1/2] Bluetooth: hci_qca: Load customized NVM based on the device property
  2019-05-12  3:19     ` [PATCH v4 " Rocky Liao
@ 2019-05-15  5:32       ` Balakrishna Godavarthi
  2019-05-15  8:30         ` Rocky Liao
  2019-05-15 11:19       ` [PATCH v5 " Rocky Liao
  1 sibling, 1 reply; 34+ messages in thread
From: Balakrishna Godavarthi @ 2019-05-15  5:32 UTC (permalink / raw)
  To: Rocky Liao
  Cc: robh+dt, mark.rutland, marcel, johan.hedberg, thierry.escande,
	netdev, devicetree, linux-kernel, linux-bluetooth, linux-arm-msm,
	hemtang

Hi Rocky,

On 2019-05-12 08:49, Rocky Liao wrote:
> QCA BTSOC NVM is a customized firmware file and different vendors may
> want to have different BTSOC configuration (e.g. Configure SCO over PCM
> or I2S, Setting Tx power, etc.) via this file. This patch will allow
> vendors to download different NVM firmware file by reading a device
> property "firmware-name".
> 
> Signed-off-by: Rocky Liao <rjliao@codeaurora.org>
> ---
> Changes in v4:
>   * rebased the code base and merge with latest code
> ---
>  drivers/bluetooth/btqca.c   | 14 ++++++++++----
>  drivers/bluetooth/btqca.h   |  6 ++++--
>  drivers/bluetooth/hci_qca.c | 19 ++++++++++++++++++-
>  3 files changed, 32 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c
> index cc12eec..0ea690a 100644
> --- a/drivers/bluetooth/btqca.c
> +++ b/drivers/bluetooth/btqca.c
> @@ -332,7 +332,8 @@ int qca_set_bdaddr_rome(struct hci_dev *hdev,
> const bdaddr_t *bdaddr)
>  EXPORT_SYMBOL_GPL(qca_set_bdaddr_rome);
> 
>  int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
> -		   enum qca_btsoc_type soc_type, u32 soc_ver)
> +		   enum qca_btsoc_type soc_type, u32 soc_ver,
> +		   const char *firmware_name)
>  {
>  	struct rome_config config;
>  	int err;
> @@ -368,9 +369,14 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t 
> baudrate,
>  	if (qca_is_wcn399x(soc_type))
>  		snprintf(config.fwname, sizeof(config.fwname),
>  			 "qca/crnv%02x.bin", rom_ver);
> -	else
> -		snprintf(config.fwname, sizeof(config.fwname),
> -			 "qca/nvm_%08x.bin", soc_ver);
> +	else {
> +		if (firmware_name)
> +			snprintf(config.fwname, sizeof(config.fwname),
> +				 "qca/%s", firmware_name);
> +		else
> +			snprintf(config.fwname, sizeof(config.fwname),
> +				 "qca/nvm_%08x.bin", soc_ver);
> +	}
> 
[Bala]: Can you make this change  applicable to the wcn399x series chip 
sets too.

        something like this

        if (qca_is_wcn399x(soc_type) && !firmware_name)
          snprintf(config.fwname, sizeof(config.fwname),
               "qca/crnv%02x.bin", rom_ver);
       elseif (firmware_name)
          snprintf(config.fwname, sizeof(config.fwname),
             "qca/%s", firmware_name);
       else
         snprintf(config.fwname, sizeof(config.fwname),
               "qca/nvm_%08x.bin", soc_ver);


>  	err = qca_download_firmware(hdev, &config);
>  	if (err < 0) {
> diff --git a/drivers/bluetooth/btqca.h b/drivers/bluetooth/btqca.h
> index 4c4fe2b..8c037bb 100644
> --- a/drivers/bluetooth/btqca.h
> +++ b/drivers/bluetooth/btqca.h
> @@ -140,7 +140,8 @@ enum qca_btsoc_type {
> 
>  int qca_set_bdaddr_rome(struct hci_dev *hdev, const bdaddr_t *bdaddr);
>  int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
> -		   enum qca_btsoc_type soc_type, u32 soc_ver);
> +		   enum qca_btsoc_type soc_type, u32 soc_ver,
> +		   const char *firmware_name);
>  int qca_read_soc_version(struct hci_dev *hdev, u32 *soc_version);
>  int qca_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr);
>  static inline bool qca_is_wcn399x(enum qca_btsoc_type soc_type)
> @@ -155,7 +156,8 @@ static inline int qca_set_bdaddr_rome(struct
> hci_dev *hdev, const bdaddr_t *bdad
>  }
> 
>  static inline int qca_uart_setup(struct hci_dev *hdev, uint8_t 
> baudrate,
> -				 enum qca_btsoc_type soc_type, u32 soc_ver)
> +				 enum qca_btsoc_type soc_type, u32 soc_ver,
> +				 const char *firmware_name)
>  {
>  	return -EOPNOTSUPP;
>  }
> diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
> index 57322c4..9590602 100644
> --- a/drivers/bluetooth/hci_qca.c
> +++ b/drivers/bluetooth/hci_qca.c
> @@ -169,6 +169,7 @@ struct qca_serdev {
>  	struct qca_power *bt_power;
>  	u32 init_speed;
>  	u32 oper_speed;
> +	const char *firmware_name;
>  };
> 
>  static int qca_power_setup(struct hci_uart *hu, bool on);
> @@ -190,6 +191,17 @@ static enum qca_btsoc_type qca_soc_type(struct
> hci_uart *hu)
>  	return soc_type;
>  }
> 
> +static const char *qca_get_firmware_name(struct hci_uart *hu)
> +{
> +	if (hu->serdev) {
> +		struct qca_serdev *qsd = serdev_device_get_drvdata(hu->serdev);
> +
> +		return qsd->firmware_name;
> +	} else {
> +		return NULL;
> +	}
> +}
> +
>  static void __serial_clock_on(struct tty_struct *tty)
>  {
>  	/* TODO: Some chipset requires to enable UART clock on client
> @@ -1195,6 +1207,7 @@ static int qca_setup(struct hci_uart *hu)
>  	struct qca_data *qca = hu->priv;
>  	unsigned int speed, qca_baudrate = QCA_BAUDRATE_115200;
>  	enum qca_btsoc_type soc_type = qca_soc_type(hu);
> +	const char *firmware_name = qca_get_firmware_name(hu);
>  	int ret;
>  	int soc_ver = 0;
> 
> @@ -1245,7 +1258,8 @@ static int qca_setup(struct hci_uart *hu)
> 
>  	bt_dev_info(hdev, "QCA controller version 0x%08x", soc_ver);
>  	/* Setup patch / NVM configurations */
> -	ret = qca_uart_setup(hdev, qca_baudrate, soc_type, soc_ver);
> +	ret = qca_uart_setup(hdev, qca_baudrate, soc_type, soc_ver,
> +			firmware_name);
>  	if (!ret) {
>  		set_bit(QCA_IBS_ENABLED, &qca->flags);
>  		qca_debugfs_init(hdev);
> @@ -1477,6 +1491,9 @@ static int qca_serdev_probe(struct serdev_device 
> *serdev)
>  			return PTR_ERR(qcadev->bt_en);
>  		}
> 
> +		device_property_read_string(&serdev->dev, "firmware-name",
> +					 &qcadev->firmware_name);
> +
>  		qcadev->susclk = devm_clk_get(&serdev->dev, NULL);
>  		if (IS_ERR(qcadev->susclk)) {
>  			dev_err(&serdev->dev, "failed to acquire clk\n");

-- 
Regards
Balakrishna.

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

* Re: [PATCH v4 1/2] Bluetooth: hci_qca: Load customized NVM based on the device property
  2019-05-15  5:32       ` Balakrishna Godavarthi
@ 2019-05-15  8:30         ` Rocky Liao
  0 siblings, 0 replies; 34+ messages in thread
From: Rocky Liao @ 2019-05-15  8:30 UTC (permalink / raw)
  To: Balakrishna Godavarthi
  Cc: robh+dt, mark.rutland, marcel, johan.hedberg, thierry.escande,
	netdev, devicetree, linux-kernel, linux-bluetooth, linux-arm-msm,
	hemtang, linux-bluetooth-owner

Hi Bala,

On 2019-05-15 13:32, Balakrishna Godavarthi wrote:
> Hi Rocky,
> 
> On 2019-05-12 08:49, Rocky Liao wrote:
>> QCA BTSOC NVM is a customized firmware file and different vendors may
>> want to have different BTSOC configuration (e.g. Configure SCO over 
>> PCM
>> or I2S, Setting Tx power, etc.) via this file. This patch will allow
>> vendors to download different NVM firmware file by reading a device
>> property "firmware-name".
>> 
>> Signed-off-by: Rocky Liao <rjliao@codeaurora.org>
>> ---
>> Changes in v4:
>>   * rebased the code base and merge with latest code
>> ---
>>  drivers/bluetooth/btqca.c   | 14 ++++++++++----
>>  drivers/bluetooth/btqca.h   |  6 ++++--
>>  drivers/bluetooth/hci_qca.c | 19 ++++++++++++++++++-
>>  3 files changed, 32 insertions(+), 7 deletions(-)
>> 
>> diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c
>> index cc12eec..0ea690a 100644
>> --- a/drivers/bluetooth/btqca.c
>> +++ b/drivers/bluetooth/btqca.c
>> @@ -332,7 +332,8 @@ int qca_set_bdaddr_rome(struct hci_dev *hdev,
>> const bdaddr_t *bdaddr)
>>  EXPORT_SYMBOL_GPL(qca_set_bdaddr_rome);
>> 
>>  int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
>> -		   enum qca_btsoc_type soc_type, u32 soc_ver)
>> +		   enum qca_btsoc_type soc_type, u32 soc_ver,
>> +		   const char *firmware_name)
>>  {
>>  	struct rome_config config;
>>  	int err;
>> @@ -368,9 +369,14 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t 
>> baudrate,
>>  	if (qca_is_wcn399x(soc_type))
>>  		snprintf(config.fwname, sizeof(config.fwname),
>>  			 "qca/crnv%02x.bin", rom_ver);
>> -	else
>> -		snprintf(config.fwname, sizeof(config.fwname),
>> -			 "qca/nvm_%08x.bin", soc_ver);
>> +	else {
>> +		if (firmware_name)
>> +			snprintf(config.fwname, sizeof(config.fwname),
>> +				 "qca/%s", firmware_name);
>> +		else
>> +			snprintf(config.fwname, sizeof(config.fwname),
>> +				 "qca/nvm_%08x.bin", soc_ver);
>> +	}
>> 
> [Bala]: Can you make this change  applicable to the wcn399x series
> chip sets too.
> 
>        something like this
> 
>        if (qca_is_wcn399x(soc_type) && !firmware_name)
>          snprintf(config.fwname, sizeof(config.fwname),
>               "qca/crnv%02x.bin", rom_ver);
>       elseif (firmware_name)
>          snprintf(config.fwname, sizeof(config.fwname),
>             "qca/%s", firmware_name);
>       else
>         snprintf(config.fwname, sizeof(config.fwname),
>               "qca/nvm_%08x.bin", soc_ver);
> 
> 
>>  	err = qca_download_firmware(hdev, &config);
>>  	if (err < 0) {
>> diff --git a/drivers/bluetooth/btqca.h b/drivers/bluetooth/btqca.h
>> index 4c4fe2b..8c037bb 100644
>> --- a/drivers/bluetooth/btqca.h
>> +++ b/drivers/bluetooth/btqca.h
>> @@ -140,7 +140,8 @@ enum qca_btsoc_type {
>> 
>>  int qca_set_bdaddr_rome(struct hci_dev *hdev, const bdaddr_t 
>> *bdaddr);
>>  int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
>> -		   enum qca_btsoc_type soc_type, u32 soc_ver);
>> +		   enum qca_btsoc_type soc_type, u32 soc_ver,
>> +		   const char *firmware_name);
>>  int qca_read_soc_version(struct hci_dev *hdev, u32 *soc_version);
>>  int qca_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr);
>>  static inline bool qca_is_wcn399x(enum qca_btsoc_type soc_type)
>> @@ -155,7 +156,8 @@ static inline int qca_set_bdaddr_rome(struct
>> hci_dev *hdev, const bdaddr_t *bdad
>>  }
>> 
>>  static inline int qca_uart_setup(struct hci_dev *hdev, uint8_t 
>> baudrate,
>> -				 enum qca_btsoc_type soc_type, u32 soc_ver)
>> +				 enum qca_btsoc_type soc_type, u32 soc_ver,
>> +				 const char *firmware_name)
>>  {
>>  	return -EOPNOTSUPP;
>>  }
>> diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
>> index 57322c4..9590602 100644
>> --- a/drivers/bluetooth/hci_qca.c
>> +++ b/drivers/bluetooth/hci_qca.c
>> @@ -169,6 +169,7 @@ struct qca_serdev {
>>  	struct qca_power *bt_power;
>>  	u32 init_speed;
>>  	u32 oper_speed;
>> +	const char *firmware_name;
>>  };
>> 
>>  static int qca_power_setup(struct hci_uart *hu, bool on);
>> @@ -190,6 +191,17 @@ static enum qca_btsoc_type qca_soc_type(struct
>> hci_uart *hu)
>>  	return soc_type;
>>  }
>> 
>> +static const char *qca_get_firmware_name(struct hci_uart *hu)
>> +{
>> +	if (hu->serdev) {
>> +		struct qca_serdev *qsd = serdev_device_get_drvdata(hu->serdev);
>> +
>> +		return qsd->firmware_name;
>> +	} else {
>> +		return NULL;
>> +	}
>> +}
>> +
>>  static void __serial_clock_on(struct tty_struct *tty)
>>  {
>>  	/* TODO: Some chipset requires to enable UART clock on client
>> @@ -1195,6 +1207,7 @@ static int qca_setup(struct hci_uart *hu)
>>  	struct qca_data *qca = hu->priv;
>>  	unsigned int speed, qca_baudrate = QCA_BAUDRATE_115200;
>>  	enum qca_btsoc_type soc_type = qca_soc_type(hu);
>> +	const char *firmware_name = qca_get_firmware_name(hu);
>>  	int ret;
>>  	int soc_ver = 0;
>> 
>> @@ -1245,7 +1258,8 @@ static int qca_setup(struct hci_uart *hu)
>> 
>>  	bt_dev_info(hdev, "QCA controller version 0x%08x", soc_ver);
>>  	/* Setup patch / NVM configurations */
>> -	ret = qca_uart_setup(hdev, qca_baudrate, soc_type, soc_ver);
>> +	ret = qca_uart_setup(hdev, qca_baudrate, soc_type, soc_ver,
>> +			firmware_name);
>>  	if (!ret) {
>>  		set_bit(QCA_IBS_ENABLED, &qca->flags);
>>  		qca_debugfs_init(hdev);
>> @@ -1477,6 +1491,9 @@ static int qca_serdev_probe(struct serdev_device 
>> *serdev)
>>  			return PTR_ERR(qcadev->bt_en);
>>  		}
>> 
>> +		device_property_read_string(&serdev->dev, "firmware-name",
>> +					 &qcadev->firmware_name);
>> +
>>  		qcadev->susclk = devm_clk_get(&serdev->dev, NULL);
>>  		if (IS_ERR(qcadev->susclk)) {
>>  			dev_err(&serdev->dev, "failed to acquire clk\n");

OK, will make the change and send out the updated version soon.

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora 
Forum,
a Linux Foundation Collaborative Project

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

* [PATCH v5 1/2] Bluetooth: hci_qca: Load customized NVM based on the device property
  2019-05-12  3:19     ` [PATCH v4 " Rocky Liao
  2019-05-15  5:32       ` Balakrishna Godavarthi
@ 2019-05-15 11:19       ` Rocky Liao
  2019-05-17  2:43         ` Balakrishna Godavarthi
  2019-06-06  9:40         ` [PATCH v6 " Rocky Liao
  1 sibling, 2 replies; 34+ messages in thread
From: Rocky Liao @ 2019-05-15 11:19 UTC (permalink / raw)
  To: robh+dt, mark.rutland, marcel, johan.hedberg, thierry.escande
  Cc: netdev, devicetree, linux-kernel, linux-bluetooth, linux-arm-msm,
	bgodavar, c-hbandi, Rocky Liao

QCA BTSOC NVM is a customized firmware file and different vendors may
want to have different BTSOC configuration (e.g. Configure SCO over PCM
or I2S, Setting Tx power, etc.) via this file. This patch will allow
vendors to download different NVM firmware file by reading a device
property "firmware-name".

Signed-off-by: Rocky Liao <rjliao@codeaurora.org>
---
Changes in v5:
  * Made the change applicable to the wcn399x series chip sets
---
 drivers/bluetooth/btqca.c   |  8 ++++++--
 drivers/bluetooth/btqca.h   |  6 ++++--
 drivers/bluetooth/hci_qca.c | 19 ++++++++++++++++++-
 3 files changed, 28 insertions(+), 5 deletions(-)

diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c
index cc12eec..a78b80e 100644
--- a/drivers/bluetooth/btqca.c
+++ b/drivers/bluetooth/btqca.c
@@ -332,7 +332,8 @@ int qca_set_bdaddr_rome(struct hci_dev *hdev, const bdaddr_t *bdaddr)
 EXPORT_SYMBOL_GPL(qca_set_bdaddr_rome);
 
 int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
-		   enum qca_btsoc_type soc_type, u32 soc_ver)
+		   enum qca_btsoc_type soc_type, u32 soc_ver,
+		   const char *firmware_name)
 {
 	struct rome_config config;
 	int err;
@@ -365,7 +366,10 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
 
 	/* Download NVM configuration */
 	config.type = TLV_TYPE_NVM;
-	if (qca_is_wcn399x(soc_type))
+	if (firmware_name)
+		snprintf(config.fwname, sizeof(config.fwname),
+			 "qca/%s", firmware_name);
+	else if (qca_is_wcn399x(soc_type))
 		snprintf(config.fwname, sizeof(config.fwname),
 			 "qca/crnv%02x.bin", rom_ver);
 	else
diff --git a/drivers/bluetooth/btqca.h b/drivers/bluetooth/btqca.h
index 4c4fe2b..8c037bb 100644
--- a/drivers/bluetooth/btqca.h
+++ b/drivers/bluetooth/btqca.h
@@ -140,7 +140,8 @@ enum qca_btsoc_type {
 
 int qca_set_bdaddr_rome(struct hci_dev *hdev, const bdaddr_t *bdaddr);
 int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
-		   enum qca_btsoc_type soc_type, u32 soc_ver);
+		   enum qca_btsoc_type soc_type, u32 soc_ver,
+		   const char *firmware_name);
 int qca_read_soc_version(struct hci_dev *hdev, u32 *soc_version);
 int qca_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr);
 static inline bool qca_is_wcn399x(enum qca_btsoc_type soc_type)
@@ -155,7 +156,8 @@ static inline int qca_set_bdaddr_rome(struct hci_dev *hdev, const bdaddr_t *bdad
 }
 
 static inline int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
-				 enum qca_btsoc_type soc_type, u32 soc_ver)
+				 enum qca_btsoc_type soc_type, u32 soc_ver,
+				 const char *firmware_name)
 {
 	return -EOPNOTSUPP;
 }
diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index 57322c4..9590602 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -169,6 +169,7 @@ struct qca_serdev {
 	struct qca_power *bt_power;
 	u32 init_speed;
 	u32 oper_speed;
+	const char *firmware_name;
 };
 
 static int qca_power_setup(struct hci_uart *hu, bool on);
@@ -190,6 +191,17 @@ static enum qca_btsoc_type qca_soc_type(struct hci_uart *hu)
 	return soc_type;
 }
 
+static const char *qca_get_firmware_name(struct hci_uart *hu)
+{
+	if (hu->serdev) {
+		struct qca_serdev *qsd = serdev_device_get_drvdata(hu->serdev);
+
+		return qsd->firmware_name;
+	} else {
+		return NULL;
+	}
+}
+
 static void __serial_clock_on(struct tty_struct *tty)
 {
 	/* TODO: Some chipset requires to enable UART clock on client
@@ -1195,6 +1207,7 @@ static int qca_setup(struct hci_uart *hu)
 	struct qca_data *qca = hu->priv;
 	unsigned int speed, qca_baudrate = QCA_BAUDRATE_115200;
 	enum qca_btsoc_type soc_type = qca_soc_type(hu);
+	const char *firmware_name = qca_get_firmware_name(hu);
 	int ret;
 	int soc_ver = 0;
 
@@ -1245,7 +1258,8 @@ static int qca_setup(struct hci_uart *hu)
 
 	bt_dev_info(hdev, "QCA controller version 0x%08x", soc_ver);
 	/* Setup patch / NVM configurations */
-	ret = qca_uart_setup(hdev, qca_baudrate, soc_type, soc_ver);
+	ret = qca_uart_setup(hdev, qca_baudrate, soc_type, soc_ver,
+			firmware_name);
 	if (!ret) {
 		set_bit(QCA_IBS_ENABLED, &qca->flags);
 		qca_debugfs_init(hdev);
@@ -1477,6 +1491,9 @@ static int qca_serdev_probe(struct serdev_device *serdev)
 			return PTR_ERR(qcadev->bt_en);
 		}
 
+		device_property_read_string(&serdev->dev, "firmware-name",
+					 &qcadev->firmware_name);
+
 		qcadev->susclk = devm_clk_get(&serdev->dev, NULL);
 		if (IS_ERR(qcadev->susclk)) {
 			dev_err(&serdev->dev, "failed to acquire clk\n");
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project


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

* [PATCH v5 2/2] dt-bindings: net: bluetooth: Add device property firmware-name for QCA6174
  2019-05-12  3:19       ` [PATCH v4 " Rocky Liao
  2019-05-13 15:31         ` Rob Herring
@ 2019-05-15 11:20         ` Rocky Liao
  2019-06-06  9:40           ` [PATCH v6 " Rocky Liao
  1 sibling, 1 reply; 34+ messages in thread
From: Rocky Liao @ 2019-05-15 11:20 UTC (permalink / raw)
  To: robh+dt, mark.rutland, marcel, johan.hedberg, thierry.escande
  Cc: netdev, devicetree, linux-kernel, linux-bluetooth, linux-arm-msm,
	bgodavar, c-hbandi, Rocky Liao

This patch adds an optional device property "firmware-name" to allow the
driver to load customized nvm firmware file based on this property.

Signed-off-by: Rocky Liao <rjliao@codeaurora.org>
Reviewed-by: Rob Herring <robh@kernel.org>
---
Changes in v5:
  * Made the change applicable to the wcn399x series chip sets
---
 Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt b/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
index 7ef6118..68b67d9 100644
--- a/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
+++ b/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
@@ -17,6 +17,7 @@ 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
 
 Required properties for compatible string qcom,wcn399x-bt:
 
@@ -28,6 +29,7 @@ Required properties for compatible string qcom,wcn399x-bt:
 Optional properties for compatible string qcom,wcn399x-bt:
 
  - max-speed: see Documentation/devicetree/bindings/serial/slave-device.txt
+ - firmware-name: specify the name of nvm firmware to load
 
 Examples:
 
@@ -40,6 +42,7 @@ serial@7570000 {
 
 		enable-gpios = <&pm8994_gpios 19 GPIO_ACTIVE_HIGH>;
 		clocks = <&divclk4>;
+		firmware-name = "nvm_00440302.bin";
 	};
 };
 
@@ -52,5 +55,6 @@ serial@898000 {
 		vddrf-supply = <&vreg_l17a_1p3>;
 		vddch0-supply = <&vreg_l25a_3p3>;
 		max-speed = <3200000>;
+		firmware-name = "crnv21.bin";
 	};
 };
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project


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

* Re: [PATCH v5 1/2] Bluetooth: hci_qca: Load customized NVM based on the device property
  2019-05-15 11:19       ` [PATCH v5 " Rocky Liao
@ 2019-05-17  2:43         ` Balakrishna Godavarthi
  2019-05-17  4:26           ` Harish Bandi
  2019-06-06  9:40         ` [PATCH v6 " Rocky Liao
  1 sibling, 1 reply; 34+ messages in thread
From: Balakrishna Godavarthi @ 2019-05-17  2:43 UTC (permalink / raw)
  To: Rocky Liao
  Cc: robh+dt, mark.rutland, marcel, johan.hedberg, thierry.escande,
	netdev, devicetree, linux-kernel, linux-bluetooth, linux-arm-msm,
	c-hbandi, Hemantg

Hi Rocky,

On 2019-05-15 16:49, Rocky Liao wrote:
> QCA BTSOC NVM is a customized firmware file and different vendors may
> want to have different BTSOC configuration (e.g. Configure SCO over PCM
> or I2S, Setting Tx power, etc.) via this file. This patch will allow
> vendors to download different NVM firmware file by reading a device
> property "firmware-name".
> 
> Signed-off-by: Rocky Liao <rjliao@codeaurora.org>
> ---
> Changes in v5:
>   * Made the change applicable to the wcn399x series chip sets
> ---
>  drivers/bluetooth/btqca.c   |  8 ++++++--
>  drivers/bluetooth/btqca.h   |  6 ++++--
>  drivers/bluetooth/hci_qca.c | 19 ++++++++++++++++++-
>  3 files changed, 28 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c
> index cc12eec..a78b80e 100644
> --- a/drivers/bluetooth/btqca.c
> +++ b/drivers/bluetooth/btqca.c
> @@ -332,7 +332,8 @@ int qca_set_bdaddr_rome(struct hci_dev *hdev,
> const bdaddr_t *bdaddr)
>  EXPORT_SYMBOL_GPL(qca_set_bdaddr_rome);
> 
>  int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
> -		   enum qca_btsoc_type soc_type, u32 soc_ver)
> +		   enum qca_btsoc_type soc_type, u32 soc_ver,
> +		   const char *firmware_name)
>  {
>  	struct rome_config config;
>  	int err;
> @@ -365,7 +366,10 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t 
> baudrate,
> 
>  	/* Download NVM configuration */
>  	config.type = TLV_TYPE_NVM;
> -	if (qca_is_wcn399x(soc_type))
> +	if (firmware_name)
> +		snprintf(config.fwname, sizeof(config.fwname),
> +			 "qca/%s", firmware_name);
> +	else if (qca_is_wcn399x(soc_type))
>  		snprintf(config.fwname, sizeof(config.fwname),
>  			 "qca/crnv%02x.bin", rom_ver);
>  	else
> diff --git a/drivers/bluetooth/btqca.h b/drivers/bluetooth/btqca.h
> index 4c4fe2b..8c037bb 100644
> --- a/drivers/bluetooth/btqca.h
> +++ b/drivers/bluetooth/btqca.h
> @@ -140,7 +140,8 @@ enum qca_btsoc_type {
> 
>  int qca_set_bdaddr_rome(struct hci_dev *hdev, const bdaddr_t *bdaddr);
>  int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
> -		   enum qca_btsoc_type soc_type, u32 soc_ver);
> +		   enum qca_btsoc_type soc_type, u32 soc_ver,
> +		   const char *firmware_name);
>  int qca_read_soc_version(struct hci_dev *hdev, u32 *soc_version);
>  int qca_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr);
>  static inline bool qca_is_wcn399x(enum qca_btsoc_type soc_type)
> @@ -155,7 +156,8 @@ static inline int qca_set_bdaddr_rome(struct
> hci_dev *hdev, const bdaddr_t *bdad
>  }
> 
>  static inline int qca_uart_setup(struct hci_dev *hdev, uint8_t 
> baudrate,
> -				 enum qca_btsoc_type soc_type, u32 soc_ver)
> +				 enum qca_btsoc_type soc_type, u32 soc_ver,
> +				 const char *firmware_name)
>  {
>  	return -EOPNOTSUPP;
>  }
> diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
> index 57322c4..9590602 100644
> --- a/drivers/bluetooth/hci_qca.c
> +++ b/drivers/bluetooth/hci_qca.c
> @@ -169,6 +169,7 @@ struct qca_serdev {
>  	struct qca_power *bt_power;
>  	u32 init_speed;
>  	u32 oper_speed;
> +	const char *firmware_name;
>  };
> 
>  static int qca_power_setup(struct hci_uart *hu, bool on);
> @@ -190,6 +191,17 @@ static enum qca_btsoc_type qca_soc_type(struct
> hci_uart *hu)
>  	return soc_type;
>  }
> 
> +static const char *qca_get_firmware_name(struct hci_uart *hu)
> +{
> +	if (hu->serdev) {
> +		struct qca_serdev *qsd = serdev_device_get_drvdata(hu->serdev);
> +
> +		return qsd->firmware_name;
> +	} else {
> +		return NULL;
> +	}
> +}
> +
>  static void __serial_clock_on(struct tty_struct *tty)
>  {
>  	/* TODO: Some chipset requires to enable UART clock on client
> @@ -1195,6 +1207,7 @@ static int qca_setup(struct hci_uart *hu)
>  	struct qca_data *qca = hu->priv;
>  	unsigned int speed, qca_baudrate = QCA_BAUDRATE_115200;
>  	enum qca_btsoc_type soc_type = qca_soc_type(hu);
> +	const char *firmware_name = qca_get_firmware_name(hu);
>  	int ret;
>  	int soc_ver = 0;
> 
> @@ -1245,7 +1258,8 @@ static int qca_setup(struct hci_uart *hu)
> 
>  	bt_dev_info(hdev, "QCA controller version 0x%08x", soc_ver);
>  	/* Setup patch / NVM configurations */
> -	ret = qca_uart_setup(hdev, qca_baudrate, soc_type, soc_ver);
> +	ret = qca_uart_setup(hdev, qca_baudrate, soc_type, soc_ver,
> +			firmware_name);
>  	if (!ret) {
>  		set_bit(QCA_IBS_ENABLED, &qca->flags);
>  		qca_debugfs_init(hdev);
> @@ -1477,6 +1491,9 @@ static int qca_serdev_probe(struct serdev_device 
> *serdev)
>  			return PTR_ERR(qcadev->bt_en);
>  		}
> 
> +		device_property_read_string(&serdev->dev, "firmware-name",
> +					 &qcadev->firmware_name);
> +
>  		qcadev->susclk = devm_clk_get(&serdev->dev, NULL);
>  		if (IS_ERR(qcadev->susclk)) {
>  			dev_err(&serdev->dev, "failed to acquire clk\n");

Thanks for doing it for wcn399x series too.

Change look fine to me.

Reviewed-by: Balakrishna Godavarthi <bgodavar@codeaurora.org>
-- 
Regards
Balakrishna.

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

* Re: [PATCH v5 1/2] Bluetooth: hci_qca: Load customized NVM based on the device property
  2019-05-17  2:43         ` Balakrishna Godavarthi
@ 2019-05-17  4:26           ` Harish Bandi
  0 siblings, 0 replies; 34+ messages in thread
From: Harish Bandi @ 2019-05-17  4:26 UTC (permalink / raw)
  To: Balakrishna Godavarthi
  Cc: Rocky Liao, robh+dt, mark.rutland, marcel, johan.hedberg,
	thierry.escande, netdev, devicetree, linux-kernel,
	linux-bluetooth, linux-arm-msm, Hemantg, linux-bluetooth-owner

On 2019-05-17 08:13, Balakrishna Godavarthi wrote:
> Hi Rocky,
> 
> On 2019-05-15 16:49, Rocky Liao wrote:
>> QCA BTSOC NVM is a customized firmware file and different vendors may
>> want to have different BTSOC configuration (e.g. Configure SCO over 
>> PCM
>> or I2S, Setting Tx power, etc.) via this file. This patch will allow
>> vendors to download different NVM firmware file by reading a device
>> property "firmware-name".
>> 
>> Signed-off-by: Rocky Liao <rjliao@codeaurora.org>
>> ---
>> Changes in v5:
>>   * Made the change applicable to the wcn399x series chip sets
>> ---
>>  drivers/bluetooth/btqca.c   |  8 ++++++--
>>  drivers/bluetooth/btqca.h   |  6 ++++--
>>  drivers/bluetooth/hci_qca.c | 19 ++++++++++++++++++-
>>  3 files changed, 28 insertions(+), 5 deletions(-)
>> 
>> diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c
>> index cc12eec..a78b80e 100644
>> --- a/drivers/bluetooth/btqca.c
>> +++ b/drivers/bluetooth/btqca.c
>> @@ -332,7 +332,8 @@ int qca_set_bdaddr_rome(struct hci_dev *hdev,
>> const bdaddr_t *bdaddr)
>>  EXPORT_SYMBOL_GPL(qca_set_bdaddr_rome);
>> 
>>  int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
>> -		   enum qca_btsoc_type soc_type, u32 soc_ver)
>> +		   enum qca_btsoc_type soc_type, u32 soc_ver,
>> +		   const char *firmware_name)
>>  {
>>  	struct rome_config config;
>>  	int err;
>> @@ -365,7 +366,10 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t 
>> baudrate,
>> 
>>  	/* Download NVM configuration */
>>  	config.type = TLV_TYPE_NVM;
>> -	if (qca_is_wcn399x(soc_type))
>> +	if (firmware_name)
>> +		snprintf(config.fwname, sizeof(config.fwname),
>> +			 "qca/%s", firmware_name);
>> +	else if (qca_is_wcn399x(soc_type))
>>  		snprintf(config.fwname, sizeof(config.fwname),
>>  			 "qca/crnv%02x.bin", rom_ver);
>>  	else
>> diff --git a/drivers/bluetooth/btqca.h b/drivers/bluetooth/btqca.h
>> index 4c4fe2b..8c037bb 100644
>> --- a/drivers/bluetooth/btqca.h
>> +++ b/drivers/bluetooth/btqca.h
>> @@ -140,7 +140,8 @@ enum qca_btsoc_type {
>> 
>>  int qca_set_bdaddr_rome(struct hci_dev *hdev, const bdaddr_t 
>> *bdaddr);
>>  int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
>> -		   enum qca_btsoc_type soc_type, u32 soc_ver);
>> +		   enum qca_btsoc_type soc_type, u32 soc_ver,
>> +		   const char *firmware_name);
>>  int qca_read_soc_version(struct hci_dev *hdev, u32 *soc_version);
>>  int qca_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr);
>>  static inline bool qca_is_wcn399x(enum qca_btsoc_type soc_type)
>> @@ -155,7 +156,8 @@ static inline int qca_set_bdaddr_rome(struct
>> hci_dev *hdev, const bdaddr_t *bdad
>>  }
>> 
>>  static inline int qca_uart_setup(struct hci_dev *hdev, uint8_t 
>> baudrate,
>> -				 enum qca_btsoc_type soc_type, u32 soc_ver)
>> +				 enum qca_btsoc_type soc_type, u32 soc_ver,
>> +				 const char *firmware_name)
>>  {
>>  	return -EOPNOTSUPP;
>>  }
>> diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
>> index 57322c4..9590602 100644
>> --- a/drivers/bluetooth/hci_qca.c
>> +++ b/drivers/bluetooth/hci_qca.c
>> @@ -169,6 +169,7 @@ struct qca_serdev {
>>  	struct qca_power *bt_power;
>>  	u32 init_speed;
>>  	u32 oper_speed;
>> +	const char *firmware_name;
>>  };
>> 
>>  static int qca_power_setup(struct hci_uart *hu, bool on);
>> @@ -190,6 +191,17 @@ static enum qca_btsoc_type qca_soc_type(struct
>> hci_uart *hu)
>>  	return soc_type;
>>  }
>> 
>> +static const char *qca_get_firmware_name(struct hci_uart *hu)
>> +{
>> +	if (hu->serdev) {
>> +		struct qca_serdev *qsd = serdev_device_get_drvdata(hu->serdev);
>> +
>> +		return qsd->firmware_name;
>> +	} else {
>> +		return NULL;
>> +	}
>> +}
>> +
>>  static void __serial_clock_on(struct tty_struct *tty)
>>  {
>>  	/* TODO: Some chipset requires to enable UART clock on client
>> @@ -1195,6 +1207,7 @@ static int qca_setup(struct hci_uart *hu)
>>  	struct qca_data *qca = hu->priv;
>>  	unsigned int speed, qca_baudrate = QCA_BAUDRATE_115200;
>>  	enum qca_btsoc_type soc_type = qca_soc_type(hu);
>> +	const char *firmware_name = qca_get_firmware_name(hu);
>>  	int ret;
>>  	int soc_ver = 0;
>> 
>> @@ -1245,7 +1258,8 @@ static int qca_setup(struct hci_uart *hu)
>> 
>>  	bt_dev_info(hdev, "QCA controller version 0x%08x", soc_ver);
>>  	/* Setup patch / NVM configurations */
>> -	ret = qca_uart_setup(hdev, qca_baudrate, soc_type, soc_ver);
>> +	ret = qca_uart_setup(hdev, qca_baudrate, soc_type, soc_ver,
>> +			firmware_name);
>>  	if (!ret) {
>>  		set_bit(QCA_IBS_ENABLED, &qca->flags);
>>  		qca_debugfs_init(hdev);
>> @@ -1477,6 +1491,9 @@ static int qca_serdev_probe(struct serdev_device 
>> *serdev)
>>  			return PTR_ERR(qcadev->bt_en);
>>  		}
>> 
>> +		device_property_read_string(&serdev->dev, "firmware-name",
>> +					 &qcadev->firmware_name);
>> +
>>  		qcadev->susclk = devm_clk_get(&serdev->dev, NULL);
>>  		if (IS_ERR(qcadev->susclk)) {
>>  			dev_err(&serdev->dev, "failed to acquire clk\n");
> 
> Thanks for doing it for wcn399x series too.
> 
> Change look fine to me.
> 
> Reviewed-by: Balakrishna Godavarthi <bgodavar@codeaurora.org>

Tested for WCN3998.

Tested-by: Harish Bandi <c-hbandi@codeaurora.org>

Thanks,
Harish

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

* [PATCH v6 1/2] Bluetooth: hci_qca: Load customized NVM based on the device property
  2019-05-15 11:19       ` [PATCH v5 " Rocky Liao
  2019-05-17  2:43         ` Balakrishna Godavarthi
@ 2019-06-06  9:40         ` Rocky Liao
  2019-06-06 12:02           ` Harish Bandi
  2019-07-06 10:51           ` Marcel Holtmann
  1 sibling, 2 replies; 34+ messages in thread
From: Rocky Liao @ 2019-06-06  9:40 UTC (permalink / raw)
  To: robh+dt, mark.rutland, marcel, johan.hedberg, thierry.escande
  Cc: netdev, devicetree, linux-kernel, linux-bluetooth, linux-arm-msm,
	bgodavar, c-hbandi, Rocky Liao

QCA BTSOC NVM is a customized firmware file and different vendors may
want to have different BTSOC configuration (e.g. Configure SCO over PCM
or I2S, Setting Tx power, etc.) via this file. This patch will allow
vendors to download different NVM firmware file by reading a device
property "firmware-name".

Signed-off-by: Rocky Liao <rjliao@codeaurora.org>
---
Changes in v6:
  * Added read firmware-name property for both QCA6174 and WCN399X
---
 drivers/bluetooth/btqca.c   |  8 ++++++--
 drivers/bluetooth/btqca.h   |  6 ++++--
 drivers/bluetooth/hci_qca.c | 18 +++++++++++++++++-
 3 files changed, 27 insertions(+), 5 deletions(-)

diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c
index cc12eec..a78b80e 100644
--- a/drivers/bluetooth/btqca.c
+++ b/drivers/bluetooth/btqca.c
@@ -332,7 +332,8 @@ int qca_set_bdaddr_rome(struct hci_dev *hdev, const bdaddr_t *bdaddr)
 EXPORT_SYMBOL_GPL(qca_set_bdaddr_rome);
 
 int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
-		   enum qca_btsoc_type soc_type, u32 soc_ver)
+		   enum qca_btsoc_type soc_type, u32 soc_ver,
+		   const char *firmware_name)
 {
 	struct rome_config config;
 	int err;
@@ -365,7 +366,10 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
 
 	/* Download NVM configuration */
 	config.type = TLV_TYPE_NVM;
-	if (qca_is_wcn399x(soc_type))
+	if (firmware_name)
+		snprintf(config.fwname, sizeof(config.fwname),
+			 "qca/%s", firmware_name);
+	else if (qca_is_wcn399x(soc_type))
 		snprintf(config.fwname, sizeof(config.fwname),
 			 "qca/crnv%02x.bin", rom_ver);
 	else
diff --git a/drivers/bluetooth/btqca.h b/drivers/bluetooth/btqca.h
index 4c4fe2b..8c037bb 100644
--- a/drivers/bluetooth/btqca.h
+++ b/drivers/bluetooth/btqca.h
@@ -140,7 +140,8 @@ enum qca_btsoc_type {
 
 int qca_set_bdaddr_rome(struct hci_dev *hdev, const bdaddr_t *bdaddr);
 int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
-		   enum qca_btsoc_type soc_type, u32 soc_ver);
+		   enum qca_btsoc_type soc_type, u32 soc_ver,
+		   const char *firmware_name);
 int qca_read_soc_version(struct hci_dev *hdev, u32 *soc_version);
 int qca_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr);
 static inline bool qca_is_wcn399x(enum qca_btsoc_type soc_type)
@@ -155,7 +156,8 @@ static inline int qca_set_bdaddr_rome(struct hci_dev *hdev, const bdaddr_t *bdad
 }
 
 static inline int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
-				 enum qca_btsoc_type soc_type, u32 soc_ver)
+				 enum qca_btsoc_type soc_type, u32 soc_ver,
+				 const char *firmware_name)
 {
 	return -EOPNOTSUPP;
 }
diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index 57322c4..05ee0a1 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -169,6 +169,7 @@ struct qca_serdev {
 	struct qca_power *bt_power;
 	u32 init_speed;
 	u32 oper_speed;
+	const char *firmware_name;
 };
 
 static int qca_power_setup(struct hci_uart *hu, bool on);
@@ -190,6 +191,17 @@ static enum qca_btsoc_type qca_soc_type(struct hci_uart *hu)
 	return soc_type;
 }
 
+static const char *qca_get_firmware_name(struct hci_uart *hu)
+{
+	if (hu->serdev) {
+		struct qca_serdev *qsd = serdev_device_get_drvdata(hu->serdev);
+
+		return qsd->firmware_name;
+	} else {
+		return NULL;
+	}
+}
+
 static void __serial_clock_on(struct tty_struct *tty)
 {
 	/* TODO: Some chipset requires to enable UART clock on client
@@ -1195,6 +1207,7 @@ static int qca_setup(struct hci_uart *hu)
 	struct qca_data *qca = hu->priv;
 	unsigned int speed, qca_baudrate = QCA_BAUDRATE_115200;
 	enum qca_btsoc_type soc_type = qca_soc_type(hu);
+	const char *firmware_name = qca_get_firmware_name(hu);
 	int ret;
 	int soc_ver = 0;
 
@@ -1245,7 +1258,8 @@ static int qca_setup(struct hci_uart *hu)
 
 	bt_dev_info(hdev, "QCA controller version 0x%08x", soc_ver);
 	/* Setup patch / NVM configurations */
-	ret = qca_uart_setup(hdev, qca_baudrate, soc_type, soc_ver);
+	ret = qca_uart_setup(hdev, qca_baudrate, soc_type, soc_ver,
+			firmware_name);
 	if (!ret) {
 		set_bit(QCA_IBS_ENABLED, &qca->flags);
 		qca_debugfs_init(hdev);
@@ -1439,6 +1453,8 @@ static int qca_serdev_probe(struct serdev_device *serdev)
 	qcadev->serdev_hu.serdev = serdev;
 	data = of_device_get_match_data(&serdev->dev);
 	serdev_device_set_drvdata(serdev, qcadev);
+	device_property_read_string(&serdev->dev, "firmware-name",
+					 &qcadev->firmware_name);
 	if (data && qca_is_wcn399x(data->soc_type)) {
 		qcadev->btsoc_type = data->soc_type;
 		qcadev->bt_power = devm_kzalloc(&serdev->dev,
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project


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

* [PATCH v6 2/2] dt-bindings: net: bluetooth: Add device property firmware-name for QCA6174
  2019-05-15 11:20         ` [PATCH v5 " Rocky Liao
@ 2019-06-06  9:40           ` Rocky Liao
  2019-06-11 22:01             ` Rob Herring
  2019-07-06 10:56             ` Marcel Holtmann
  0 siblings, 2 replies; 34+ messages in thread
From: Rocky Liao @ 2019-06-06  9:40 UTC (permalink / raw)
  To: robh+dt, mark.rutland, marcel, johan.hedberg, thierry.escande
  Cc: netdev, devicetree, linux-kernel, linux-bluetooth, linux-arm-msm,
	bgodavar, c-hbandi, Rocky Liao

This patch adds an optional device property "firmware-name" to allow the
driver to load customized nvm firmware file based on this property.

Signed-off-by: Rocky Liao <rjliao@codeaurora.org>
---
Changes in v6:
  * Added read firmware-name property for both QCA6174 and WCN399X
---
 Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt b/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
index 7ef6118..68b67d9 100644
--- a/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
+++ b/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
@@ -17,6 +17,7 @@ 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
 
 Required properties for compatible string qcom,wcn399x-bt:
 
@@ -28,6 +29,7 @@ Required properties for compatible string qcom,wcn399x-bt:
 Optional properties for compatible string qcom,wcn399x-bt:
 
  - max-speed: see Documentation/devicetree/bindings/serial/slave-device.txt
+ - firmware-name: specify the name of nvm firmware to load
 
 Examples:
 
@@ -40,6 +42,7 @@ serial@7570000 {
 
 		enable-gpios = <&pm8994_gpios 19 GPIO_ACTIVE_HIGH>;
 		clocks = <&divclk4>;
+		firmware-name = "nvm_00440302.bin";
 	};
 };
 
@@ -52,5 +55,6 @@ serial@898000 {
 		vddrf-supply = <&vreg_l17a_1p3>;
 		vddch0-supply = <&vreg_l25a_3p3>;
 		max-speed = <3200000>;
+		firmware-name = "crnv21.bin";
 	};
 };
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project


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

* Re: [PATCH v6 1/2] Bluetooth: hci_qca: Load customized NVM based on the device property
  2019-06-06  9:40         ` [PATCH v6 " Rocky Liao
@ 2019-06-06 12:02           ` Harish Bandi
  2019-07-06 10:51           ` Marcel Holtmann
  1 sibling, 0 replies; 34+ messages in thread
From: Harish Bandi @ 2019-06-06 12:02 UTC (permalink / raw)
  To: Rocky Liao
  Cc: robh+dt, mark.rutland, marcel, johan.hedberg, thierry.escande,
	netdev, devicetree, linux-kernel, linux-bluetooth, linux-arm-msm,
	bgodavar, linux-bluetooth-owner

On 2019-06-06 15:10, Rocky Liao wrote:
> QCA BTSOC NVM is a customized firmware file and different vendors may
> want to have different BTSOC configuration (e.g. Configure SCO over PCM
> or I2S, Setting Tx power, etc.) via this file. This patch will allow
> vendors to download different NVM firmware file by reading a device
> property "firmware-name".
> 
> Signed-off-by: Rocky Liao <rjliao@codeaurora.org>
> ---
> Changes in v6:
>   * Added read firmware-name property for both QCA6174 and WCN399X
> ---
>  drivers/bluetooth/btqca.c   |  8 ++++++--
>  drivers/bluetooth/btqca.h   |  6 ++++--
>  drivers/bluetooth/hci_qca.c | 18 +++++++++++++++++-
>  3 files changed, 27 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c
> index cc12eec..a78b80e 100644
> --- a/drivers/bluetooth/btqca.c
> +++ b/drivers/bluetooth/btqca.c
> @@ -332,7 +332,8 @@ int qca_set_bdaddr_rome(struct hci_dev *hdev,
> const bdaddr_t *bdaddr)
>  EXPORT_SYMBOL_GPL(qca_set_bdaddr_rome);
> 
>  int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
> -		   enum qca_btsoc_type soc_type, u32 soc_ver)
> +		   enum qca_btsoc_type soc_type, u32 soc_ver,
> +		   const char *firmware_name)
>  {
>  	struct rome_config config;
>  	int err;
> @@ -365,7 +366,10 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t 
> baudrate,
> 
>  	/* Download NVM configuration */
>  	config.type = TLV_TYPE_NVM;
> -	if (qca_is_wcn399x(soc_type))
> +	if (firmware_name)
> +		snprintf(config.fwname, sizeof(config.fwname),
> +			 "qca/%s", firmware_name);
> +	else if (qca_is_wcn399x(soc_type))
>  		snprintf(config.fwname, sizeof(config.fwname),
>  			 "qca/crnv%02x.bin", rom_ver);
>  	else
> diff --git a/drivers/bluetooth/btqca.h b/drivers/bluetooth/btqca.h
> index 4c4fe2b..8c037bb 100644
> --- a/drivers/bluetooth/btqca.h
> +++ b/drivers/bluetooth/btqca.h
> @@ -140,7 +140,8 @@ enum qca_btsoc_type {
> 
>  int qca_set_bdaddr_rome(struct hci_dev *hdev, const bdaddr_t *bdaddr);
>  int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
> -		   enum qca_btsoc_type soc_type, u32 soc_ver);
> +		   enum qca_btsoc_type soc_type, u32 soc_ver,
> +		   const char *firmware_name);
>  int qca_read_soc_version(struct hci_dev *hdev, u32 *soc_version);
>  int qca_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr);
>  static inline bool qca_is_wcn399x(enum qca_btsoc_type soc_type)
> @@ -155,7 +156,8 @@ static inline int qca_set_bdaddr_rome(struct
> hci_dev *hdev, const bdaddr_t *bdad
>  }
> 
>  static inline int qca_uart_setup(struct hci_dev *hdev, uint8_t 
> baudrate,
> -				 enum qca_btsoc_type soc_type, u32 soc_ver)
> +				 enum qca_btsoc_type soc_type, u32 soc_ver,
> +				 const char *firmware_name)
>  {
>  	return -EOPNOTSUPP;
>  }
> diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
> index 57322c4..05ee0a1 100644
> --- a/drivers/bluetooth/hci_qca.c
> +++ b/drivers/bluetooth/hci_qca.c
> @@ -169,6 +169,7 @@ struct qca_serdev {
>  	struct qca_power *bt_power;
>  	u32 init_speed;
>  	u32 oper_speed;
> +	const char *firmware_name;
>  };
> 
>  static int qca_power_setup(struct hci_uart *hu, bool on);
> @@ -190,6 +191,17 @@ static enum qca_btsoc_type qca_soc_type(struct
> hci_uart *hu)
>  	return soc_type;
>  }
> 
> +static const char *qca_get_firmware_name(struct hci_uart *hu)
> +{
> +	if (hu->serdev) {
> +		struct qca_serdev *qsd = serdev_device_get_drvdata(hu->serdev);
> +
> +		return qsd->firmware_name;
> +	} else {
> +		return NULL;
> +	}
> +}
> +
>  static void __serial_clock_on(struct tty_struct *tty)
>  {
>  	/* TODO: Some chipset requires to enable UART clock on client
> @@ -1195,6 +1207,7 @@ static int qca_setup(struct hci_uart *hu)
>  	struct qca_data *qca = hu->priv;
>  	unsigned int speed, qca_baudrate = QCA_BAUDRATE_115200;
>  	enum qca_btsoc_type soc_type = qca_soc_type(hu);
> +	const char *firmware_name = qca_get_firmware_name(hu);
>  	int ret;
>  	int soc_ver = 0;
> 
> @@ -1245,7 +1258,8 @@ static int qca_setup(struct hci_uart *hu)
> 
>  	bt_dev_info(hdev, "QCA controller version 0x%08x", soc_ver);
>  	/* Setup patch / NVM configurations */
> -	ret = qca_uart_setup(hdev, qca_baudrate, soc_type, soc_ver);
> +	ret = qca_uart_setup(hdev, qca_baudrate, soc_type, soc_ver,
> +			firmware_name);
>  	if (!ret) {
>  		set_bit(QCA_IBS_ENABLED, &qca->flags);
>  		qca_debugfs_init(hdev);
> @@ -1439,6 +1453,8 @@ static int qca_serdev_probe(struct serdev_device 
> *serdev)
>  	qcadev->serdev_hu.serdev = serdev;
>  	data = of_device_get_match_data(&serdev->dev);
>  	serdev_device_set_drvdata(serdev, qcadev);
> +	device_property_read_string(&serdev->dev, "firmware-name",
> +					 &qcadev->firmware_name);
>  	if (data && qca_is_wcn399x(data->soc_type)) {
>  		qcadev->btsoc_type = data->soc_type;
>  		qcadev->bt_power = devm_kzalloc(&serdev->dev,
Tested for WCN3998.

Tested-by: Harish Bandi <c-hbandi@codeaurora.org>

Thanks,
Harish

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

* Re: [PATCH v6 2/2] dt-bindings: net: bluetooth: Add device property firmware-name for QCA6174
  2019-06-06  9:40           ` [PATCH v6 " Rocky Liao
@ 2019-06-11 22:01             ` Rob Herring
  2019-07-06 10:56             ` Marcel Holtmann
  1 sibling, 0 replies; 34+ messages in thread
From: Rob Herring @ 2019-06-11 22:01 UTC (permalink / raw)
  To: Rocky Liao
  Cc: mark.rutland, marcel, johan.hedberg, thierry.escande, netdev,
	devicetree, linux-kernel, linux-bluetooth, linux-arm-msm,
	bgodavar, c-hbandi

On Thu, Jun 06, 2019 at 05:40:55PM +0800, Rocky Liao wrote:
> This patch adds an optional device property "firmware-name" to allow the
> driver to load customized nvm firmware file based on this property.
> 
> Signed-off-by: Rocky Liao <rjliao@codeaurora.org>
> ---
> Changes in v6:
>   * Added read firmware-name property for both QCA6174 and WCN399X
> ---
>  Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt | 4 ++++
>  1 file changed, 4 insertions(+)

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

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

* Re: [PATCH v6 1/2] Bluetooth: hci_qca: Load customized NVM based on the device property
  2019-06-06  9:40         ` [PATCH v6 " Rocky Liao
  2019-06-06 12:02           ` Harish Bandi
@ 2019-07-06 10:51           ` Marcel Holtmann
  1 sibling, 0 replies; 34+ messages in thread
From: Marcel Holtmann @ 2019-07-06 10:51 UTC (permalink / raw)
  To: Rocky Liao
  Cc: robh+dt, mark.rutland, Johan Hedberg, thierry.escande, netdev,
	devicetree, linux-kernel, linux-bluetooth, linux-arm-msm,
	bgodavar, c-hbandi

Hi Rocky,

> QCA BTSOC NVM is a customized firmware file and different vendors may
> want to have different BTSOC configuration (e.g. Configure SCO over PCM
> or I2S, Setting Tx power, etc.) via this file. This patch will allow
> vendors to download different NVM firmware file by reading a device
> property "firmware-name".
> 
> Signed-off-by: Rocky Liao <rjliao@codeaurora.org>
> ---
> Changes in v6:
>  * Added read firmware-name property for both QCA6174 and WCN399X
> ---
> drivers/bluetooth/btqca.c   |  8 ++++++--
> drivers/bluetooth/btqca.h   |  6 ++++--
> drivers/bluetooth/hci_qca.c | 18 +++++++++++++++++-
> 3 files changed, 27 insertions(+), 5 deletions(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel


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

* Re: [PATCH v6 2/2] dt-bindings: net: bluetooth: Add device property firmware-name for QCA6174
  2019-06-06  9:40           ` [PATCH v6 " Rocky Liao
  2019-06-11 22:01             ` Rob Herring
@ 2019-07-06 10:56             ` Marcel Holtmann
  1 sibling, 0 replies; 34+ messages in thread
From: Marcel Holtmann @ 2019-07-06 10:56 UTC (permalink / raw)
  To: Rocky Liao
  Cc: robh+dt, mark.rutland, Johan Hedberg, thierry.escande, netdev,
	devicetree, linux-kernel, linux-bluetooth, linux-arm-msm,
	bgodavar, c-hbandi

Hi Rocky,

> This patch adds an optional device property "firmware-name" to allow the
> driver to load customized nvm firmware file based on this property.
> 
> Signed-off-by: Rocky Liao <rjliao@codeaurora.org>
> ---
> Changes in v6:
>  * Added read firmware-name property for both QCA6174 and WCN399X
> ---
> Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt | 4 ++++
> 1 file changed, 4 insertions(+)

patch has been applied to bluetooth-next tree.

Regards

Marcel


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

end of thread, other threads:[~2019-07-06 10:56 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-04  6:37 [PATCH] Bluetooth: hci_qca: Load customized NVM based on the device property Rocky Liao
2019-04-04  6:56 ` Balakrishna Godavarthi
2019-04-04  9:08 ` [PATCH v2 1/2] " Rocky Liao
2019-04-04  9:08   ` [PATCH v2 2/2] dt-bindings: net: bluetooth: Add device property nvm-postfix for QCA6174 Rocky Liao
2019-04-04 12:32     ` Marc Gonzalez
2019-04-09 10:15       ` Rocky Liao
2019-04-09 14:03         ` Rob Herring
2019-04-09 14:48           ` Rocky Liao
2019-04-09 13:54       ` Rob Herring
2019-04-10  9:27     ` [PATCH v3 2/2] dt-bindings: net: bluetooth: Add device property firmware-name " Rocky Liao
2019-04-23 17:06       ` Marcel Holtmann
2019-04-24  6:19         ` Rocky Liao
2019-04-26 17:45           ` Rob Herring
2019-04-27  5:59             ` Marcel Holtmann
2019-05-03  7:56               ` Rocky Liao
2019-05-05 17:32                 ` Marcel Holtmann
2019-04-26 20:50       ` Rob Herring
2019-05-12  3:19       ` [PATCH v4 " Rocky Liao
2019-05-13 15:31         ` Rob Herring
2019-05-15 11:20         ` [PATCH v5 " Rocky Liao
2019-06-06  9:40           ` [PATCH v6 " Rocky Liao
2019-06-11 22:01             ` Rob Herring
2019-07-06 10:56             ` Marcel Holtmann
2019-04-04  9:59   ` [PATCH v2 1/2] Bluetooth: hci_qca: Load customized NVM based on the device property Balakrishna Godavarthi
2019-04-10  9:27   ` [PATCH v3 " Rocky Liao
2019-05-12  3:19     ` [PATCH v4 " Rocky Liao
2019-05-15  5:32       ` Balakrishna Godavarthi
2019-05-15  8:30         ` Rocky Liao
2019-05-15 11:19       ` [PATCH v5 " Rocky Liao
2019-05-17  2:43         ` Balakrishna Godavarthi
2019-05-17  4:26           ` Harish Bandi
2019-06-06  9:40         ` [PATCH v6 " Rocky Liao
2019-06-06 12:02           ` Harish Bandi
2019-07-06 10:51           ` Marcel Holtmann

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).