Bluetooth: hci_qca: Load customized NVM based on the device property
Subsystems (6)
PATCH 1/1 Bluetooth: hci_qca: Load customized NVM based on the device property
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.
--- drivers/bluetooth/btqca.c | 13 +++++++++---- drivers/bluetooth/btqca.h | 4 ++-- drivers/bluetooth/hci_qca.c | 18 +++++++++++++++++- 3 files changed, 28 insertions(+), 7 deletions(-)
drivers/bluetooth/btqca.c +9 -4
@@ -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 ) {
drivers/bluetooth/btqca.h +2 -2
@@ -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 ; }
drivers/bluetooth/hci_qca.c +17 -1
@@ -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" );
Signature · 1 line
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
Hi Rocky,
Quoted 5 lines · 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.
[Bala]: add the property which your reading to the documentation file.
"Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt"
Quoted 23 lines
Signed-off-by Rocky Liao <[email protected]>--- drivers/bluetooth/btqca.c | 13 +++++++++---- drivers/bluetooth/btqca.h | 4 ++-- drivers/bluetooth/hci_qca.c | 18 +++++++++++++++++- 3 files changed, 28 insertions(+), 7 deletions(-)drivers/bluetooth/btqca.c +1
-1@@ -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) {drivers/bluetooth/btqca.c +0
-0struct rome_config config;int err;
drivers/bluetooth/btqca.c int qca_uart_setup(struct hci_dev *hdev, uint8_t · line 373
Quoted 9 lines
drivers/bluetooth/btqca.c +2
-3@@ -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.
Quoted 40 lines
drivers/bluetooth/btqca.c +6
-0+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);drivers/bluetooth/btqca.c +0
-0if (err <0 ) {drivers/bluetooth/btqca.h +1
-1@@ -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
drivers/bluetooth/btqca.h +0
-0@@ -150,7 +150,7 @@ static inline int qca_set_bdaddr_rome(struct
hci_dev*hdev, constbdaddr_t*bdad
}static inline int qca_uart_setup(struct
hci_dev*hdev,uint8_t
baudrate,drivers/bluetooth/btqca.h +1
-1- enum qca_btsoc_type soc_type, u32 soc_ver) + enum qca_btsoc_type soc_type, u32 soc_ver, const char
*nvm_postfix)
{drivers/bluetooth/btqca.h +0
-0return -EOPNOTSUPP ; }drivers/bluetooth/hci_qca.c +0
-0
drivers/bluetooth/hci_qca.c struct qca_serdev { · line 167
Quoted 4 lines
drivers/bluetooth/hci_qca.c +1
-0@@ -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.
Quoted 51 lines
drivers/bluetooth/hci_qca.c +11
-0enum 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) {drivers/bluetooth/hci_qca.c +2
-1/* 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);drivers/bluetooth/hci_qca.c +3
-0qca_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");
Signature · 2 lines
Regards Balakrishna.
PATCH v2 1/2 Bluetooth: hci_qca: Load customized NVM based on the device property
In reply to Rocky LiaoQCA 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.
---
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(-)
drivers/bluetooth/btqca.c +10 -4
@@ -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 ) {
drivers/bluetooth/btqca.h +4 -2
@@ -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 ; }
drivers/bluetooth/hci_qca.c +18 -1
@@ -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" );
Signature · 1 line
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH v2 2/2 dt-bindings: net: bluetooth: Add device property nvm-postfix for QCA6174
This patchs patch adds an optional device property nvm-postfix to allow the driver to load customized nvm file based on this property
---
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(+)
Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt +2 -0
@@ -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"; }; };
Signature · 1 line
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
Hi Rocky,
Quoted 84 lines · 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 <[email protected]>---
Changes in v2:
* added the property to the document fileDocumentation/devicetree/bindings/net/qualcomm-bluetooth.txt
* fixed coding style warnings
* moved the nvm-postfix to the last entry of theqca_serdev--- drivers/bluetooth/btqca.c | 14 ++++++++++---- drivers/bluetooth/btqca.h | 6 ++++-- drivers/bluetooth/hci_qca.c | 19 ++++++++++++++++++- 3 files changed, 32 insertions(+), 7 deletions(-)drivers/bluetooth/btqca.c +2
-1@@ -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;drivers/bluetooth/btqca.c +8
-3int 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);drivers/bluetooth/btqca.c +0
-0if (err <0 ) {drivers/bluetooth/btqca.h +2
-1@@ -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, constbdaddr_t*bdad
}static inline int qca_uart_setup(struct
hci_dev*hdev,uint8_t
baudrate,drivers/bluetooth/btqca.h +2
-1- enum qca_btsoc_type soc_type, u32 soc_ver) + enum qca_btsoc_type soc_type, u32 soc_ver, + const char *nvm_postfix) { return -EOPNOTSUPP; }drivers/bluetooth/hci_qca.c +0
-0
drivers/bluetooth/hci_qca.c struct qca_serdev { · line 171
Quoted 4 lines
drivers/bluetooth/hci_qca.c +1
-0@@ -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 tosco_com_type or might be to the use understandable name.
just an suggestion. Don't respin right away wait for other
comments too :)
Quoted 51 lines
drivers/bluetooth/hci_qca.c +11
-0};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) {drivers/bluetooth/hci_qca.c +6
-1/* 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");
Signature · 2 lines
Regards Balakrishna.
Re: [PATCH v2 2/2] dt-bindings: net: bluetooth: Add device property nvm-postfix for QCA6174
In reply to Rocky Liao+robh
Quoted 2 lines · 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
While text /before/ is indeed called a "prefix", text /after/ is not a "postfix", but a "suffix".
Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt Optional properties for compatible string qcom,qca6174-bt: · line 19
Quoted 12 lines
Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt | 2 ++ 1 file changed, 2 insertions(+)Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt +1
-0@@ -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
Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt serial@7570000 { · line 45
Quoted 7 lines
Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt +1
-0@@ -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.
Re: [PATCH v2 2/2] dt-bindings: net: bluetooth: Add device property nvm-postfix for QCA6174
Quoted 47 lines · Marc Gonzalez
+robh
Quoted 2 lines · 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
While text /before/ is indeed called a "prefix", text /after/ is not a "postfix",
but a "suffix".Quoted 10 lines
Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt | 2 ++ 1 file changed, 2 insertions(+)Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt +0
-0@@ -16,6 +16,7 @@ Optional properties for compatible stringqcom,qca6174-bt:
Quoted 3 lines
- 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 fileThe 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 elseDocumentation/devicetree/bindings/net/qualcomm-bluetooth.txt serial@7570000 { · line 45
Quoted 7 lines
Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt +1
-0@@ -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:
Quoted 4 lines
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.
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
Re: [PATCH v2 2/2] dt-bindings: net: bluetooth: Add device property nvm-postfix for QCA6174
In reply to Marc GonzalezQuoted 27 lines · Marc Gonzalez
+robh
Quoted 2 lines · 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
While text /before/ is indeed called a "prefix", text /after/ is not a "postfix", but a "suffix".
Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt Optional properties for compatible string qcom,qca6174-bt: · line 19
Quoted 12 lines
Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt | 2 ++ 1 file changed, 2 insertions(+)Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt +1
-0@@ -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 fileThe device tree is supposed to describe hardware.
Quoted 6 lines
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
Re: [PATCH v2 2/2] dt-bindings: net: bluetooth: Add device property nvm-postfix for QCA6174
In reply to Rocky LiaoQuoted 60 lines · Rocky Liao
Quoted 51 lines · Marc Gonzalez
+robh
Quoted 3 lines · Rocky Liao
This patchs patch adds an optional device property nvm-postfix to allow the
driver to load customized nvm file based on this propertyWhile text /before/ is indeed called a "prefix", text /after/ is not a "postfix",
but a "suffix".Quoted 12 lines
Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt | 2 ++ 1 file changed, 2 insertions(+)diff --git
a/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txtb/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txtindex 824c0e2..70cda4b 100644Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt +0
-0@@ -16,6 +16,7 @@ Optional properties for compatible stringqcom,qca6174-bt:
Quoted 3 lines
- 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 fileThe 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 elseDocumentation/devicetree/bindings/net/qualcomm-bluetooth.txt serial@7570000 { · line 45
Quoted 7 lines
Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt +1
-0@@ -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:Quoted 4 lines
snprintf(config.fwname, sizeof(config.fwname), "qca/nvm_%08x%s.bin",
soc_ver, suffix ? suffix : "");Regards
.
Hi Marc,
Quoted 8 lines
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
Re: [PATCH v2 2/2] dt-bindings: net: bluetooth: Add device property nvm-postfix for QCA6174
Quoted 77 lines · Rob Herring
Quoted 60 lines · Rocky Liao
Quoted 51 lines · Marc Gonzalez
+robh
Quoted 3 lines · Rocky Liao
This patchs patch adds an optional device property nvm-postfix to allow the
driver to load customized nvm file based on this propertyWhile text /before/ is indeed called a "prefix", text /after/ is not a "postfix",
but a "suffix".Quoted 12 lines
Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt | 2 ++ 1 file changed, 2 insertions(+)diff --git
a/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txtb/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txtindex 824c0e2..70cda4b 100644Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt +0
-0@@ -16,6 +16,7 @@ Optional properties for compatible stringqcom,qca6174-bt:
Quoted 3 lines
- 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 fileThe 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 elseDocumentation/devicetree/bindings/net/qualcomm-bluetooth.txt serial@7570000 { · line 45
Quoted 7 lines
Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt +1
-0@@ -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:Quoted 4 lines
snprintf(config.fwname, sizeof(config.fwname), "qca/nvm_%08x%s.bin",
soc_ver, suffix ? suffix : "");Regards
.
Hi Marc,Quoted 8 lines
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?
Quoted 4 lines
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
PATCH v3 1/2 Bluetooth: hci_qca: Load customized NVM based on the device property
In reply to Rocky LiaoQCA 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".
---
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(-)
drivers/bluetooth/btqca.c +10 -4
@@ -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 ) {
drivers/bluetooth/btqca.h +4 -2
@@ -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 ; }
drivers/bluetooth/hci_qca.c +18 -1
@@ -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" );
Signature · 1 line
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH v3 2/2 dt-bindings: net: bluetooth: Add device property firmware-name for QCA6174
In reply to Rocky LiaoThis patch adds an optional device property "firmware-name" to allow the driver to load customized nvm firmware file based on this property.
---
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(+)
Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt +2 -0
@@ -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"; }; };
Signature · 1 line
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
Marcel Holtmann
maintainerRe: [PATCH v3 2/2] dt-bindings: net: bluetooth: Add device property firmware-name for QCA6174
Hi Rocky,
Quoted 24 lines
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 <[email protected]>---
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(+)Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt +1
-0@@ -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 loadRequired properties for compatible string qcom,wcn3990-bt:
Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt serial@7570000 { · line 44
Quoted 5 lines
Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt +1
-0@@ -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
Re: [PATCH v3 2/2] dt-bindings: net: bluetooth: Add device property firmware-name for QCA6174
Quoted 38 lines · Marcel Holtmann
Hi Rocky,
Quoted 26 lines
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 <[email protected]>---
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(+)Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt +0
-0@@ -16,6 +16,7 @@ Optional properties for compatible stringqcom,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 loadRequired properties for compatible string qcom,wcn3990-bt:
Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt serial@7570000 { · line 44
Quoted 5 lines
Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt +1
-0@@ -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.
Quoted 3 lines
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.
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
Re: [PATCH v3 2/2] dt-bindings: net: bluetooth: Add device property firmware-name for QCA6174
Quoted 47 lines · Rocky Liao
Quoted 41 lines · Marcel Holtmann
Hi Rocky,
Quoted 29 lines
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 <[email protected]>---
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.txtb/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txtindex 824c0e2..2bcea50 100644Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt +0
-0@@ -16,6 +16,7 @@ Optional properties for compatible stringqcom,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 loadRequired properties for compatible string qcom,wcn3990-bt:
Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt serial@7570000 { · line 44
Quoted 5 lines
Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt +1
-0@@ -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.
Quoted 3 lines
Regards
Marcel
Quoted 7 lines
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
Re: [PATCH v3 2/2] dt-bindings: net: bluetooth: Add device property firmware-name for QCA6174
In reply to Rocky LiaoQuoted 11 lines · 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 <[email protected]>---
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(+)
Marcel Holtmann
maintainerRe: [PATCH v3 2/2] dt-bindings: net: bluetooth: Add device property firmware-name for QCA6174
In reply to Rob HerringHi Rob,
Quoted 45 lines
Quoted 45 lines
Quoted 39 lines
Quoted 29 lines
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 <[email protected]>---
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.txtb/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txtindex 824c0e2..2bcea50 100644Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt +0
-0@@ -16,6 +16,7 @@ Optional properties for compatible stringqcom,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 loadRequired properties for compatible string qcom,wcn3990-bt:
Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt serial@7570000 { · line 44
Quoted 5 lines
Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt +1
-0@@ -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.
Quoted 3 lines
Regards
Marcel
Hi Rob,
Quoted 7 lines
Quoted 5 lines
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
Re: [PATCH v3 2/2] dt-bindings: net: bluetooth: Add device property firmware-name for QCA6174
Hi Marcel,
Quoted 53 lines · Marcel Holtmann
Hi Rob,
Quoted 51 lines
Quoted 50 lines
Quoted 39 lines
Quoted 29 lines
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 <[email protected]>---
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.txtb/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txtindex 824c0e2..2bcea50 100644Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt +0
-0@@ -16,6 +16,7 @@ Optional properties for compatible stringqcom,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 loadRequired properties for compatible string qcom,wcn3990-bt:
Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt serial@7570000 { · line 44
Quoted 5 lines
Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt +1
-0@@ -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.
Quoted 3 lines
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.
Quoted 8 lines
Quoted 1 line
'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.
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
Marcel Holtmann
maintainerRe: [PATCH v3 2/2] dt-bindings: net: bluetooth: Add device property firmware-name for QCA6174
Hi Rocky,
Quoted 39 lines
Quoted 39 lines
Quoted 39 lines
Quoted 39 lines
Quoted 25 lines
Quoted 25 lines
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 <[email protected]>---
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.txtb/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txtindex 824c0e2..2bcea50 100644Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt +0
-0@@ -16,6 +16,7 @@ Optional properties for compatible stringqcom,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:Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt +0
-0@@ -39,6 +40,7 @@ serial@7570000 { enable-gpios = <&pm8994_gpios 19 GPIO_ACTIVE_HIGH>;Quoted 8 lines
Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt serial@7570000 { · line 44
Quoted 3 lines
Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt +1
-0clocks = <&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
MarcelHi 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.
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
'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
MarcelWe 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
PATCH v4 1/2 Bluetooth: hci_qca: Load customized NVM based on the device property
In reply to Rocky LiaoQCA 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".
---
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(-)
drivers/bluetooth/btqca.c +10 -4
@@ -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 ) {
drivers/bluetooth/btqca.h +4 -2
@@ -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 ; }
drivers/bluetooth/hci_qca.c +18 -1
@@ -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" );
Signature · 1 line
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH v4 2/2 dt-bindings: net: bluetooth: Add device property firmware-name for QCA6174
In reply to Rocky LiaoThis patch adds an optional device property "firmware-name" to allow the driver to load customized nvm firmware file based on this property.
---
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(+)
Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt +2 -0
@@ -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"; }; };
Signature · 1 line
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
Re: [PATCH v4 2/2] dt-bindings: net: bluetooth: Add device property firmware-name for QCA6174
Quoted 11 lines · 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 <[email protected]>---
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(+)
Hi Rocky,
Quoted 38 lines · 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 <[email protected]>---
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(-)drivers/bluetooth/btqca.c +2
-1@@ -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;drivers/bluetooth/btqca.c +0
-2int 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),
drivers/bluetooth/btqca.c int qca_uart_setup(struct hci_dev *hdev, uint8_t · line 381
Quoted 10 lines
drivers/bluetooth/btqca.c +8
-1- "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);Quoted 88 lines
drivers/bluetooth/btqca.c +0
-0err =qca_download_firmware (hdev, &config);drivers/bluetooth/btqca.c +0
-0if (err <0 ) {drivers/bluetooth/btqca.h +2
-1@@ -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, constbdaddr_t*bdad
}static inline int qca_uart_setup(struct
hci_dev*hdev,uint8_t
baudrate,drivers/bluetooth/btqca.h +2
-1- enum qca_btsoc_type soc_type, u32 soc_ver) + enum qca_btsoc_type soc_type, u32 soc_ver, + const char *firmware_name) { return -EOPNOTSUPP; }drivers/bluetooth/hci_qca.c +12
-0@@ -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) {drivers/bluetooth/hci_qca.c +6
-1/* 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");
Signature · 2 lines
Regards Balakrishna.
Hi Bala,
Quoted 150 lines · Balakrishna Godavarthi
Hi Rocky,
Quoted 38 lines · 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 <[email protected]>---
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(-)drivers/bluetooth/btqca.c +2
-1@@ -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;drivers/bluetooth/btqca.c +0
-2int 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),drivers/bluetooth/btqca.c int qca_uart_setup(struct hci_dev *hdev, uint8_t · line 381
Quoted 10 lines
drivers/bluetooth/btqca.c +8
-1- "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);Quoted 83 lines
drivers/bluetooth/btqca.c +0
-0err =qca_download_firmware (hdev, &config);drivers/bluetooth/btqca.c +0
-0if (err <0 ) {drivers/bluetooth/btqca.h +2
-1@@ -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)drivers/bluetooth/btqca.h +0
-0@@ -155,7 +156,8 @@ static inline int qca_set_bdaddr_rome(struct
hci_dev*hdev, constbdaddr_t*bdad
}static inline int qca_uart_setup(struct
hci_dev*hdev,uint8_t
baudrate,drivers/bluetooth/btqca.h +2
-1- enum qca_btsoc_type soc_type, u32 soc_ver) + enum qca_btsoc_type soc_type, u32 soc_ver, + const char *firmware_name) { return -EOPNOTSUPP; }drivers/bluetooth/hci_qca.c +12
-0@@ -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) {drivers/bluetooth/hci_qca.c +3
-1/* 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); }
Quoted 6 lines
Quoted 6 lines
drivers/bluetooth/hci_qca.c +3
-0+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.
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH v5 1/2 Bluetooth: hci_qca: Load customized NVM based on the device property
In reply to Rocky LiaoQCA 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".
---
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(-)
drivers/bluetooth/btqca.c +6 -2
@@ -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
drivers/bluetooth/btqca.h +4 -2
@@ -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 ; }
drivers/bluetooth/hci_qca.c +18 -1
@@ -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" );
Signature · 1 line
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH v5 2/2 dt-bindings: net: bluetooth: Add device property firmware-name for QCA6174
In reply to Rocky LiaoThis patch adds an optional device property "firmware-name" to allow the driver to load customized nvm firmware file based on this property.
---
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(+)
Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt +4 -0
@@ -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"; }; };
Signature · 1 line
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
Hi Rocky,
Quoted 129 lines · 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 <[email protected]>---
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(-)drivers/bluetooth/btqca.c +2
-1@@ -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;drivers/bluetooth/btqca.c +4
-1int 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);drivers/bluetooth/btqca.c +0
-0else drivers/bluetooth/btqca.h +2
-1@@ -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, constbdaddr_t*bdad
}static inline int qca_uart_setup(struct
hci_dev*hdev,uint8_t
baudrate,drivers/bluetooth/btqca.h +2
-1- enum qca_btsoc_type soc_type, u32 soc_ver) + enum qca_btsoc_type soc_type, u32 soc_ver, + const char *firmware_name) { return -EOPNOTSUPP; }drivers/bluetooth/hci_qca.c +12
-0@@ -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) {drivers/bluetooth/hci_qca.c +6
-1/* 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)) {
Quoted 1 line
dev_err(&serdev->dev, "failed to acquire clk\n");
Thanks for doing it for wcn399x series too.
Change look fine to me.
Signature · 2 lines
Regards Balakrishna.
Harish Bandi
Tested-byQuoted 137 lines · Balakrishna Godavarthi
Hi Rocky,
Quoted 130 lines · 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 <[email protected]>---
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(-)drivers/bluetooth/btqca.c +2
-1@@ -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;drivers/bluetooth/btqca.c +4
-1int 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);drivers/bluetooth/btqca.c +0
-0else drivers/bluetooth/btqca.h +2
-1@@ -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)drivers/bluetooth/btqca.h +0
-0@@ -155,7 +156,8 @@ static inline int qca_set_bdaddr_rome(struct
hci_dev*hdev, constbdaddr_t*bdad
}static inline int qca_uart_setup(struct
hci_dev*hdev,uint8_t
baudrate,drivers/bluetooth/btqca.h +2
-1- enum qca_btsoc_type soc_type, u32 soc_ver) + enum qca_btsoc_type soc_type, u32 soc_ver, + const char *firmware_name) { return -EOPNOTSUPP; }drivers/bluetooth/hci_qca.c +12
-0@@ -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) {drivers/bluetooth/hci_qca.c +6
-1/* 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)) {Quoted 1 line
dev_err(&serdev->dev, "failed to acquire clk\n");Thanks for doing it for wcn399x series too.
Quoted 3 lines
Change look fine to me.
Reviewed-by Balakrishna Godavarthi <[email protected]>
Tested for WCN3998.
Thanks,
Harish
PATCH v6 1/2 Bluetooth: hci_qca: Load customized NVM based on the device property
In reply to Rocky LiaoQCA 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".
---
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(-)
drivers/bluetooth/btqca.c +6 -2
@@ -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
drivers/bluetooth/btqca.h +4 -2
@@ -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 ; }
drivers/bluetooth/hci_qca.c +17 -1
@@ -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,
Signature · 1 line
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH v6 2/2 dt-bindings: net: bluetooth: Add device property firmware-name for QCA6174
In reply to Rocky LiaoThis patch adds an optional device property "firmware-name" to allow the driver to load customized nvm firmware file based on this property.
---
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(+)
Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt +4 -0
@@ -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"; }; };
Signature · 1 line
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
Quoted 128 lines · 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 <[email protected]>---
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(-)drivers/bluetooth/btqca.c +2
-1@@ -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;drivers/bluetooth/btqca.c +4
-1int 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);drivers/bluetooth/btqca.c +0
-0else drivers/bluetooth/btqca.h +2
-1@@ -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, constbdaddr_t*bdad
}static inline int qca_uart_setup(struct
hci_dev*hdev,uint8_t
baudrate,drivers/bluetooth/btqca.h +2
-1- enum qca_btsoc_type soc_type, u32 soc_ver) + enum qca_btsoc_type soc_type, u32 soc_ver, + const char *firmware_name) { return -EOPNOTSUPP; }drivers/bluetooth/hci_qca.c +12
-0@@ -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) {drivers/bluetooth/hci_qca.c +5
-1/* 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;
Quoted 1 line
qcadev->bt_power= devm_kzalloc(&serdev->dev,
Tested for WCN3998.
Thanks,
Harish
Re: [PATCH v6 2/2] dt-bindings: net: bluetooth: Add device property firmware-name for QCA6174
In reply to Rocky LiaoQuoted 10 lines · 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 <[email protected]>---
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(+)
Marcel Holtmann
maintainerHi Rocky,
Quoted 7 lines
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 <[email protected]>
Quoted 8 lines
---
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
Marcel Holtmann
maintainerRe: [PATCH v6 2/2] dt-bindings: net: bluetooth: Add device property firmware-name for QCA6174
In reply to Rocky LiaoHi Rocky,
Quoted 10 lines
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 <[email protected]>---
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