ath10k: Use bdf calibration variant for snoc targets
PATCH 1/1 ath10k: Use bdf calibration variant for snoc targets
Board Data File (BDF) is loaded upon driver boot-up procedure. The right board data file is identified using bus and qmi-board-id.
The problem, however, can occur when the (default) board data file cannot fulfill with the vendor requirements and it is necessary to use a different board data file.
Add the support to get the variant field from DTSI and use tht information to load the vendor specific BDF.
The device tree requires addition strings to define the variant name
wifi@a000000 {
status = "okay";
qcom,ath10k-calibration-variant = "xyz-v2";
};
wifi@a800000 {
status = "okay";
qcom,ath10k-calibration-variant = "xyz-v1";
};This would create the boarddata identifiers for the board-2.bin search
* bus=snoc,qmi-board-id=16,qmi-chip-id=0,variant=xyz-v1
* bus=snoc,qmi-board-id=17,qmi-chip-id=0,variant=xyz-v2
Tested-on: WCN3990 hw1.0 SNOC WLAN.HL.3.1-01040-QCAHLSWMTPLZ-1
--- drivers/net/wireless/ath/ath10k/core.c | 18 +++++++++++++----- drivers/net/wireless/ath/ath10k/core.h | 2 ++ drivers/net/wireless/ath/ath10k/qmi.c | 8 ++++++++ 3 files changed, 23 insertions(+), 5 deletions(-)
drivers/net/wireless/ath/ath10k/core.c +13 -5
@@ -1024,7 +1024,7 @@ static int ath10k_core_check_smbios(struct ath10k *ar)return 0 ; } -static int ath10k_core_check_dt (struct ath10k *ar) +int ath10k_core_check_dt (struct ath10k *ar) {struct device_node *node;const char *variant =NULL ;
@@ -1045,6 +1045,7 @@ static int ath10k_core_check_dt(struct ath10k *ar)return 0 ; } +EXPORT_SYMBOL (ath10k_core_check_dt);static int ath10k_download_fw (struct ath10k *ar) {
@@ -1439,10 +1440,17 @@ static int ath10k_core_create_board_name(struct ath10k *ar, char *name, }if (ar->id.qmi_ids_valid) { -scnprintf (name, name_len, -"bus=%s,qmi-board-id=%x" , -ath10k_bus_str (ar->hif.bus), - ar->id.qmi_board_id); +if (with_variant && ar->id.bdf_ext[0 ] !='\0' ) +scnprintf (name, name_len, +"bus=%s,qmi-board-id=%x,qmi-chip-id=%x%s" , +ath10k_bus_str (ar->hif.bus), + ar->id.qmi_board_id, ar->id.qmi_chip_id, + variant); +else +scnprintf (name, name_len, +"bus=%s,qmi-board-id=%x" , +ath10k_bus_str (ar->hif.bus), + ar->id.qmi_board_id); goto out; }
drivers/net/wireless/ath/ath10k/core.h +2 -0
@@ -1056,6 +1056,7 @@ struct ath10k {bool bmi_ids_valid;bool qmi_ids_valid;u32 qmi_board_id; +u32 qmi_chip_id;u8 bmi_board_id;u8 bmi_eboard_id;u8 bmi_chip_id;
@@ -1295,6 +1296,7 @@ int ath10k_core_register(struct ath10k *ar, const struct ath10k_bus_params *bus_params);void ath10k_core_unregister (struct ath10k *ar);int ath10k_core_fetch_board_file (struct ath10k *ar,int bd_ie_type); +int ath10k_core_check_dt (struct ath10k *ar);void ath10k_core_free_board_files (struct ath10k *ar);#endif /* _CORE_H_ */
drivers/net/wireless/ath/ath10k/qmi.c +8 -0
@@ -576,6 +576,8 @@ static int ath10k_qmi_cap_send_sync_msg(struct ath10k_qmi *qmi)if (resp->chip_info_valid) { qmi->chip_info.chip_id = resp->chip_info.chip_id; qmi->chip_info.chip_family = resp->chip_info.chip_family; + }else { + qmi->chip_info.chip_id =0xFF ; }if (resp->board_info_valid)
@@ -817,12 +819,18 @@ static void ath10k_qmi_event_server_arrive(struct ath10k_qmi *qmi)static int ath10k_qmi_fetch_board_file (struct ath10k_qmi *qmi) {struct ath10k *ar = qmi->ar; +int ret; ar->hif.bus =ATH10K_BUS_SNOC ; ar->id.qmi_ids_valid = true; ar->id.qmi_board_id = qmi->board_info.board_id; + ar->id.qmi_chip_id = qmi->chip_info.chip_id; ar->hw_params.fw.dir =WCN3990_HW_1_0_FW_DIR ; + ret =ath10k_core_check_dt (ar); +if (ret) +ath10k_dbg (ar,ATH10K_DBG_QMI ,"DT bdf variant name not set.\n" ); +return ath10k_core_fetch_board_file (qmi->ar,ATH10K_BD_IE_BOARD ); }
Signature · 1 line
2.7.4
Quoted 22 lines · Rakesh Pillai
Board Data File (BDF) is loaded upon driver boot-up procedure. The right board data file is identified using bus and qmi-board-id.
The problem, however, can occur when the (default) board data file cannot fulfill with the vendor requirements and it is necessary to use a different board data file.
Add the support to get the variant field from DTSI and use tht information to load the vendor specific BDF.
The device tree requires addition strings to define the variant name
wifi@a000000 { status = "okay"; qcom,ath10k-calibration-variant = "xyz-v2"; }; wifi@a800000 { status = "okay"; qcom,ath10k-calibration-variant = "xyz-v1"; };
Quoted 4 lines
This would create the boarddata identifiers for the board-2.bin search
* bus=snoc,qmi-board-id=16,qmi-chip-id=0,variant=xyz-v1
* bus=snoc,qmi-board-id=17,qmi-chip-id=0,variant=xyz-v2
You mention nothing about qmi-chip-id in the commit log. Please document what it is and also give some examples what kind of values there can be.
drivers/net/wireless/ath/ath10k/qmi.c static int ath10k_qmi_cap_send_sync_msg(struct ath10k_qmi *qmi) · line 581
Quoted 9 lines
drivers/net/wireless/ath/ath10k/qmi.c +2
-0@@ -576,6 +576,8 @@ static int ath10k_qmi_cap_send_sync_msg(struct ath10k_qmi *qmi)if (resp->chip_info_valid) { qmi->chip_info.chip_id = resp->chip_info.chip_id; qmi->chip_info.chip_family = resp->chip_info.chip_family; + }else { + qmi->chip_info.chip_id =0xFF ; }
So you hard code chip_id to 0xff if it's not valid. Is it 100% guaranteed that there never will be a chip id with 0xff?
drivers/net/wireless/ath/ath10k/qmi.c static void ath10k_qmi_event_server_arrive(struct ath10k_qmi *qmi) · line 827
Quoted 12 lines
drivers/net/wireless/ath/ath10k/qmi.c +2
-0if (resp->board_info_valid)@@ -817,12 +819,18 @@ static void ath10k_qmi_event_server_arrive(struct ath10k_qmi *qmi)static int ath10k_qmi_fetch_board_file (struct ath10k_qmi *qmi) {struct ath10k *ar = qmi->ar; +int ret; ar->hif.bus =ATH10K_BUS_SNOC ; ar->id.qmi_ids_valid = true; ar->id.qmi_board_id = qmi->board_info.board_id; + ar->id.qmi_chip_id = qmi->chip_info.chip_id;
To me a safer, and cleaner, option would be to have ar->id.qmi_chip_id_valid, and only add qmi-chip-id=%x to the board id if qmi_chip_id_valid is true. That way there's not this magic 0xff value hardcoded anywhere.
Signature · 6 lines
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
Hi Kalle,
Quoted 32 lines
-----Original Message-----
From: Kalle Valo <[email protected]>
Sent: Wednesday, September 2, 2020 2:17 PM
To: Rakesh Pillai <[email protected]>
Cc: [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH] ath10k: Use bdf calibration variant for snoc targetsQuoted 22 lines · Rakesh Pillai
Board Data File (BDF) is loaded upon driver boot-up procedure. The right board data file is identified using bus and qmi-board-id.
The problem, however, can occur when the (default) board data file cannot fulfill with the vendor requirements and it is necessary to use a different board data file.
Add the support to get the variant field from DTSI and use tht information to load the vendor specific BDF.
The device tree requires addition strings to define the variant name
wifi@a000000 { status = "okay"; qcom,ath10k-calibration-variant = "xyz-v2"; }; wifi@a800000 { status = "okay"; qcom,ath10k-calibration-variant = "xyz-v1"; };
Quoted 7 lines
Quoted 4 lines
This would create the boarddata identifiers for the board-2.bin search
* bus=snoc,qmi-board-id=16,qmi-chip-id=0,variant=xyz-v1
* bus=snoc,qmi-board-id=17,qmi-chip-id=0,variant=xyz-v2You mention nothing about qmi-chip-id in the commit log. Please document what it is and also give some examples what kind of values there can be.
Let me add a bit more details about the chip-id and send v2 for this change.
Quoted 5 lines
drivers/net/wireless/ath/ath10k/qmi.c static int ath10k_qmi_cap_send_sync_msg(struct
Quoted 4 lines
drivers/net/wireless/ath/ath10k/qmi.c +0
-0@@ -576,6 +576,8 @@ static int ath10k_qmi_cap_send_sync_msg(struct
ath10k_qmi*qmi)
Quoted 9 lines
drivers/net/wireless/ath/ath10k/qmi.c static int ath10k_qmi_cap_send_sync_msg(struct ath10k_qmi *qmi) · line 581
Quoted 6 lines
drivers/net/wireless/ath/ath10k/qmi.c +2
-0if (resp->chip_info_valid) { qmi->chip_info.chip_id = resp->chip_info.chip_id; qmi->chip_info.chip_family = resp->chip_info.chip_family; + }else { + qmi->chip_info.chip_id =0xFF ; }So you hard code
chip_idto0xffif it's not valid. Is it 100% guaranteed that there never will be a chip id with0xff?
0x0 and 0xff are invalid chip id and are are not used.
If the chip_id read fails, we fallback to the default board data. 0xff is used to go to the default board data (Also this is in alignment with the current implementation of board_id)
Does that make sense ?
Quoted 20 lines
drivers/net/wireless/ath/ath10k/qmi.c static void
Quoted 4 lines
drivers/net/wireless/ath/ath10k/qmi.c +0
-0if (resp->board_info_valid)@@ -817,12 +819,18 @@ static void
ath10k_qmi_event_server_arrive(struct ath10k_qmi *qmi)drivers/net/wireless/ath/ath10k/qmi.c static void ath10k_qmi_event_server_arrive(struct ath10k_qmi *qmi) · line 827
Quoted 9 lines
drivers/net/wireless/ath/ath10k/qmi.c +2
-0static int ath10k_qmi_fetch_board_file (struct ath10k_qmi *qmi) {struct ath10k *ar = qmi->ar; +int ret; ar->hif.bus =ATH10K_BUS_SNOC ; ar->id.qmi_ids_valid = true; ar->id.qmi_board_id = qmi->board_info.board_id; + ar->id.qmi_chip_id = qmi->chip_info.chip_id;To me a safer, and cleaner, option would be to have
ar->id.qmi_chip_id_valid, and only add qmi-chip-id=%x to the board id ifqmi_chip_id_validis true. That way there's not this magic0xffvalue hardcoded anywhere.
Quoted 3 lines
--
https://wireless.wiki.kernel.org/en/developers/documentation/submittingp
atches
_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k
Quoted 14 lines · Rakesh Pillai
Quoted 4 lines
drivers/net/wireless/ath/ath10k/qmi.c static int ath10k_qmi_cap_send_sync_msg(struct
Quoted 3 lines
drivers/net/wireless/ath/ath10k/qmi.c +0
-0@@ -576,6 +576,8 @@ static int ath10k_qmi_cap_send_sync_msg(struct
ath10k_qmi*qmi)Quoted 9 lines
drivers/net/wireless/ath/ath10k/qmi.c static int ath10k_qmi_cap_send_sync_msg(struct ath10k_qmi *qmi) · line 581
Quoted 6 lines
drivers/net/wireless/ath/ath10k/qmi.c +2
-0if (resp->chip_info_valid) { qmi->chip_info.chip_id = resp->chip_info.chip_id; qmi->chip_info.chip_family = resp->chip_info.chip_family; + }else { + qmi->chip_info.chip_id =0xFF ; }So you hard code
chip_idto0xffif it's not valid. Is it 100% guaranteed that there never will be a chip id with0xff?
Quoted 6 lines
0x0and0xffare invalid chip id and are are not used.
If thechip_idread fails, we fallback to the default board data.0xffis used to go to the default board data (Also this is in alignment with the current implementation ofboard_id)Does that make sense ?
I'm a bit hesitant, over the years I have seen cases so many cases where "foo is not used anywhere" and later that foo is actually used somewhere. 0xff means that there's only 254 different values, but I guess there are not that many chip ids? So a chip id is very different from a board id, right?
Signature · 6 lines
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
Quoted 14 lines · Rakesh Pillai
Quoted 4 lines
drivers/net/wireless/ath/ath10k/qmi.c static int ath10k_qmi_cap_send_sync_msg(struct
Quoted 3 lines
drivers/net/wireless/ath/ath10k/qmi.c +0
-0@@ -576,6 +576,8 @@ static int ath10k_qmi_cap_send_sync_msg(struct
ath10k_qmi*qmi)Quoted 9 lines
drivers/net/wireless/ath/ath10k/qmi.c static int ath10k_qmi_cap_send_sync_msg(struct ath10k_qmi *qmi) · line 581
Quoted 6 lines
drivers/net/wireless/ath/ath10k/qmi.c +2
-0if (resp->chip_info_valid) { qmi->chip_info.chip_id = resp->chip_info.chip_id; qmi->chip_info.chip_family = resp->chip_info.chip_family; + }else { + qmi->chip_info.chip_id =0xFF ; }So you hard code
chip_idto0xffif it's not valid. Is it 100% guaranteed that there never will be a chip id with0xff?
Quoted 6 lines
0x0and0xffare invalid chip id and are are not used.
If thechip_idread fails, we fallback to the default board data.0xffis used to go to the default board data (Also this is in alignment with the current implementation ofboard_id)Does that make sense ?
I'm a bit hesitant, over the years I have seen cases so many cases where "foo is not used anywhere" and later that foo is actually used somewhere. 0xff means that there's only 254 different values, but I guess there are not that many chip ids? So a chip id is very different from a board id, right?
Signature · 1 line
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 10 lines
-----Original Message-----
From: Kalle Valo <[email protected]>
Sent: Monday, September 7, 2020 9:48 PM
To: Rakesh Pillai <[email protected]>
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH] ath10k: Use bdf calibration variant for snoc targets
Quoted 10 lines
Quoted 3 lines · Rakesh Pillai
Quoted 3 lines
drivers/net/wireless/ath/ath10k/qmi.c static int
Quoted 3 lines
drivers/net/wireless/ath/ath10k/qmi.c +0
-0@@ -576,6 +576,8 @@ static intath10k_qmi_cap_send_sync_msg(struct
Quoted 4 lines
Quoted 4 lines
ath10k_qmi*qmi)Quoted 3 lines
drivers/net/wireless/ath/ath10k/qmi.c +0
-0if (resp->chip_info_valid) { qmi->chip_info.chip_id = resp->chip_info.chip_id; qmi->chip_info.chip_family =
resp->chip_info.chip_family;
Quoted 10 lines
Quoted 10 lines
Quoted 6 lines
drivers/net/wireless/ath/ath10k/qmi.c static int ath10k_qmi_cap_send_sync_msg(struct ath10k_qmi *qmi) · line 581
Quoted 3 lines
drivers/net/wireless/ath/ath10k/qmi.c +2
-0+ }else { + qmi->chip_info.chip_id =0xFF ; }So you hard code
chip_idto0xffif it's not valid. Is it 100% guaranteed that there never will be a chip id with0xff?
0x0and0xffare invalid chip id and are are not used.
If thechip_idread fails, we fallback to the default board data.0xffis used to go to the default board data (Also this is in alignment
with
Quoted 9 lines
Quoted 3 lines
the current implementation of
board_id)Does that make sense ?
I'm a bit hesitant, over the years I have seen cases so many cases where "foo is not used anywhere" and later that foo is actually used somewhere.
0xffmeans that there's only 254 different values, but I guess there are not that many chip ids? So a chip id is very different from a board id, right?
Yes that's correct.
Chip id is already being used in case of qca6174 (pci bus) We are bringing this to snoc bus chipset (WCN3990)
Quoted 4 lines
--
https://wireless.wiki.kernel.org/en/developers/documentation/submittingp
atches
_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k
Quoted 10 lines
-----Original Message-----
From: Kalle Valo <[email protected]>
Sent: Monday, September 7, 2020 9:48 PM
To: Rakesh Pillai <[email protected]>
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH] ath10k: Use bdf calibration variant for snoc targets
Quoted 10 lines
Quoted 3 lines · Rakesh Pillai
Quoted 3 lines
drivers/net/wireless/ath/ath10k/qmi.c static int
Quoted 3 lines
drivers/net/wireless/ath/ath10k/qmi.c +0
-0@@ -576,6 +576,8 @@ static intath10k_qmi_cap_send_sync_msg(struct
Quoted 4 lines
Quoted 4 lines
ath10k_qmi*qmi)Quoted 3 lines
drivers/net/wireless/ath/ath10k/qmi.c +0
-0if (resp->chip_info_valid) { qmi->chip_info.chip_id = resp->chip_info.chip_id; qmi->chip_info.chip_family =
resp->chip_info.chip_family;
Quoted 10 lines
Quoted 10 lines
Quoted 6 lines
drivers/net/wireless/ath/ath10k/qmi.c static int ath10k_qmi_cap_send_sync_msg(struct ath10k_qmi *qmi) · line 581
Quoted 3 lines
drivers/net/wireless/ath/ath10k/qmi.c +2
-0+ }else { + qmi->chip_info.chip_id =0xFF ; }So you hard code
chip_idto0xffif it's not valid. Is it 100% guaranteed that there never will be a chip id with0xff?
0x0and0xffare invalid chip id and are are not used.
If thechip_idread fails, we fallback to the default board data.0xffis used to go to the default board data (Also this is in alignment
with
Quoted 9 lines
Quoted 3 lines
the current implementation of
board_id)Does that make sense ?
I'm a bit hesitant, over the years I have seen cases so many cases where "foo is not used anywhere" and later that foo is actually used somewhere.
0xffmeans that there's only 254 different values, but I guess there are not that many chip ids? So a chip id is very different from a board id, right?
Yes that's correct.
Chip id is already being used in case of qca6174 (pci bus) We are bringing this to snoc bus chipset (WCN3990)
Quoted 4 lines
--
https://wireless.wiki.kernel.org/en/developers/documentation/submittingp
atches
Hi Kalle,
Quoted 32 lines
-----Original Message-----
From: Kalle Valo <[email protected]>
Sent: Wednesday, September 2, 2020 2:17 PM
To: Rakesh Pillai <[email protected]>
Cc: [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH] ath10k: Use bdf calibration variant for snoc targetsQuoted 22 lines · Rakesh Pillai
Board Data File (BDF) is loaded upon driver boot-up procedure. The right board data file is identified using bus and qmi-board-id.
The problem, however, can occur when the (default) board data file cannot fulfill with the vendor requirements and it is necessary to use a different board data file.
Add the support to get the variant field from DTSI and use tht information to load the vendor specific BDF.
The device tree requires addition strings to define the variant name
wifi@a000000 { status = "okay"; qcom,ath10k-calibration-variant = "xyz-v2"; }; wifi@a800000 { status = "okay"; qcom,ath10k-calibration-variant = "xyz-v1"; };
Quoted 7 lines
Quoted 4 lines
This would create the boarddata identifiers for the board-2.bin search
* bus=snoc,qmi-board-id=16,qmi-chip-id=0,variant=xyz-v1
* bus=snoc,qmi-board-id=17,qmi-chip-id=0,variant=xyz-v2You mention nothing about qmi-chip-id in the commit log. Please document what it is and also give some examples what kind of values there can be.
Let me add a bit more details about the chip-id and send v2 for this change.
Quoted 5 lines
drivers/net/wireless/ath/ath10k/qmi.c static int ath10k_qmi_cap_send_sync_msg(struct
Quoted 4 lines
drivers/net/wireless/ath/ath10k/qmi.c +0
-0@@ -576,6 +576,8 @@ static int ath10k_qmi_cap_send_sync_msg(struct
ath10k_qmi*qmi)
Quoted 9 lines
drivers/net/wireless/ath/ath10k/qmi.c static int ath10k_qmi_cap_send_sync_msg(struct ath10k_qmi *qmi) · line 581
Quoted 6 lines
drivers/net/wireless/ath/ath10k/qmi.c +2
-0if (resp->chip_info_valid) { qmi->chip_info.chip_id = resp->chip_info.chip_id; qmi->chip_info.chip_family = resp->chip_info.chip_family; + }else { + qmi->chip_info.chip_id =0xFF ; }So you hard code
chip_idto0xffif it's not valid. Is it 100% guaranteed that there never will be a chip id with0xff?
0x0 and 0xff are invalid chip id and are are not used.
If the chip_id read fails, we fallback to the default board data. 0xff is used to go to the default board data (Also this is in alignment with the current implementation of board_id)
Does that make sense ?
Quoted 23 lines
drivers/net/wireless/ath/ath10k/qmi.c static void
Quoted 4 lines
drivers/net/wireless/ath/ath10k/qmi.c +0
-0if (resp->board_info_valid)@@ -817,12 +819,18 @@ static void
ath10k_qmi_event_server_arrive(struct ath10k_qmi *qmi)drivers/net/wireless/ath/ath10k/qmi.c static void ath10k_qmi_event_server_arrive(struct ath10k_qmi *qmi) · line 827
Quoted 9 lines
drivers/net/wireless/ath/ath10k/qmi.c +2
-0static int ath10k_qmi_fetch_board_file (struct ath10k_qmi *qmi) {struct ath10k *ar = qmi->ar; +int ret; ar->hif.bus =ATH10K_BUS_SNOC ; ar->id.qmi_ids_valid = true; ar->id.qmi_board_id = qmi->board_info.board_id; + ar->id.qmi_chip_id = qmi->chip_info.chip_id;To me a safer, and cleaner, option would be to have
ar->id.qmi_chip_id_valid, and only add qmi-chip-id=%x to the board id ifqmi_chip_id_validis true. That way there's not this magic0xffvalue hardcoded anywhere.--
https://wireless.wiki.kernel.org/en/developers/documentation/submittingp
atches