diff mbox

[2/2] ath10k: search DT for qcom,ath10k-calibration-variant

Message ID 20170310080615.22958-2-sven.eckelmann@openmesh.com (mailing list archive)
State Deferred
Delegated to: Kalle Valo
Headers show

Commit Message

Sven Eckelmann March 10, 2017, 8:06 a.m. UTC
Board Data File (BDF) is loaded upon driver boot-up procedure. The right
board data file is identified on QCA4019 using bus, bmi-chip-id and
bmi-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.

This problem was solved for SMBIOS by adding a special SMBIOS type 0xF8.
Something similar has to be provided for systems without SMBIOS but with
device trees. No solution was specified by QCA and therefore a new one has
to be found for ath10k.

The device tree requires addition strings to define the variant name

    wifi@a000000 {
    	status = "okay";
    	qcom,ath10k-calibration-variant = "RT-AC58U";
    };

    wifi@a800000 {
    	status = "okay";
    	qcom,ath10k-calibration-variant = "RT-AC58U";
    };

This would create the boarddata identifiers for the board-2.bin search

 *  bus=ahb,bmi-chip-id=0,bmi-board-id=16,variant=RT-AC58U
 *  bus=ahb,bmi-chip-id=0,bmi-board-id=17,variant=RT-AC58U

Signed-off-by: Sven Eckelmann <sven.eckelmann@openmesh.com>
---
Since RFC:

 - initialize variant pointer to have it initialized to NULL when
   of_property_read_string fails (thanks Christian Lamparter)
 - Only print warning that DT doesn't contain string ones (thanks Christian
   Lamparter)
 - Split patch in DT doc and ath10k part (thanks Christian Lamparter)
 - Allow to overwrite the variant string via DT and ignore that SMBIOS had
   written anything to it
---
 drivers/net/wireless/ath/ath10k/core.c | 37 +++++++++++++++++++++++++++-------
 1 file changed, 30 insertions(+), 7 deletions(-)

Comments

Christian Lamparter March 10, 2017, 6:20 p.m. UTC | #1
On Friday, March 10, 2017 9:06:15 AM CET Sven Eckelmann wrote:
> Board Data File (BDF) is loaded upon driver boot-up procedure. The right
> board data file is identified on QCA4019 using bus, bmi-chip-id and
> bmi-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.
> 
> This problem was solved for SMBIOS by adding a special SMBIOS type 0xF8.
> Something similar has to be provided for systems without SMBIOS but with
> device trees. No solution was specified by QCA and therefore a new one has
> to be found for ath10k.
> 
> The device tree requires addition strings to define the variant name
> 
>     wifi@a000000 {
>     	status = "okay";
>     	qcom,ath10k-calibration-variant = "RT-AC58U";
>     };
> 
>     wifi@a800000 {
>     	status = "okay";
>     	qcom,ath10k-calibration-variant = "RT-AC58U";
>     };
> 
> This would create the boarddata identifiers for the board-2.bin search
> 
>  *  bus=ahb,bmi-chip-id=0,bmi-board-id=16,variant=RT-AC58U
>  *  bus=ahb,bmi-chip-id=0,bmi-board-id=17,variant=RT-AC58U
> 
> Signed-off-by: Sven Eckelmann <sven.eckelmann@openmesh.com>
> ---
I've attached a modified board-2.bin for the RT-AC58U variant:

# ath10k-bdencoder -i board-2.bin
FileSize: 48564
FileCRC32: 7ac95dfd
FileMD5: 825c8e7377b0d543024dbf62f2fd29ff
BoardNames[0]: 'bus=ahb,bmi-chip-id=0,bmi-board-id=16,variant=RT-AC58U'
BoardLength[0]: 12064
BoardCRC32[0]: bd216dd3
BoardMD5[0]: a12a4745c775beb5ab6ba1e4d711aea0
BoardNames[1]: 'bus=ahb,bmi-chip-id=0,bmi-board-id=16'
BoardLength[1]: 12064
BoardCRC32[1]: 65a8a5b3
BoardMD5[1]: cb5dcb0337706c313ea3342587b283ae
BoardNames[2]: 'bus=ahb,bmi-chip-id=0,bmi-board-id=17,variant=RT-AC58U'
BoardLength[2]: 12064
BoardCRC32[2]: a7d74de3
BoardMD5[2]: 17bbd05ee0cd9099a549c835b7399b3c
BoardNames[3]: 'bus=ahb,bmi-chip-id=0,bmi-board-id=17'
BoardLength[3]: 12064
BoardCRC32[3]: 4fe93ca0
BoardMD5[3]: 1aa45fad7a0d6f1c5774b251c712c67c

And this is a patched ath10k loading it:

[  106.155058] ath10k_ahb a800000.wifi: boot get otp board id result 0x00004400 board_id 17 chip_id 0
[  106.155092] ath10k_ahb a800000.wifi: SMBIOS bdf variant name not set.
[  106.155154] ath10k_ahb a800000.wifi: boot using board name 'bus=ahb,bmi-chip-id=0,bmi-board-id=17,variant=RT-AC58U'
[  106.155570] ath10k_ahb a800000.wifi: board name
[  106.155607] ath10k_ahb a800000.wifi: 00000000: 62 75 73 3d 61 68 62 2c 62 6d 69 2d 63 68 69 70  bus=ahb,bmi-chip
[  106.155644] ath10k_ahb a800000.wifi: 00000010: 2d 69 64 3d 30 2c 62 6d 69 2d 62 6f 61 72 64 2d  -id=0,bmi-board-
[  106.155681] ath10k_ahb a800000.wifi: 00000020: 69 64 3d 31 36 2c 76 61 72 69 61 6e 74 3d 52 54  id=16,variant=RT
[  106.155904] ath10k_ahb a800000.wifi: 00000030: 2d 41 43 35 38 55                                -AC58U
[  106.155972] ath10k_ahb a800000.wifi: board name
[  106.156057] ath10k_ahb a800000.wifi: 00000000: 62 75 73 3d 61 68 62 2c 62 6d 69 2d 63 68 69 70  bus=ahb,bmi-chip
[  106.156142] ath10k_ahb a800000.wifi: 00000010: 2d 69 64 3d 30 2c 62 6d 69 2d 62 6f 61 72 64 2d  -id=0,bmi-board-
[  106.156211] ath10k_ahb a800000.wifi: 00000020: 69 64 3d 31 36                                   id=16
[  106.156662] ath10k_ahb a800000.wifi: board name
[  106.156700] ath10k_ahb a800000.wifi: 00000000: 62 75 73 3d 61 68 62 2c 62 6d 69 2d 63 68 69 70  bus=ahb,bmi-chip
[  106.156737] ath10k_ahb a800000.wifi: 00000010: 2d 69 64 3d 30 2c 62 6d 69 2d 62 6f 61 72 64 2d  -id=0,bmi-board-
[  106.156773] ath10k_ahb a800000.wifi: 00000020: 69 64 3d 31 37 2c 76 61 72 69 61 6e 74 3d 52 54  id=17,variant=RT
[  106.156809] ath10k_ahb a800000.wifi: 00000030: 2d 41 43 35 38 55                                -AC58U
[  106.156845] ath10k_ahb a800000.wifi: boot found match for name 'bus=ahb,bmi-chip-id=0,bmi-board-id=17,variant=RT-AC58U'
[  106.156876] ath10k_ahb a800000.wifi: boot found board data for 'bus=ahb,bmi-chip-id=0,bmi-board-id=17,variant=RT-AC58U'
[  106.156906] ath10k_ahb a800000.wifi: using board api 2
[  106.163704] ath10k_ahb a800000.wifi: board_file api 2 bmi_id 0:17 crc32 f222ba02
[  106.165037] ath10k_ahb a800000.wifi: boot push board extended data addr 0x0
[  106.184867] ath10k_ahb a800000.wifi: boot cal file downloaded
[  106.184905] ath10k_ahb a800000.wifi: boot using calibration mode pre-cal-file
[  106.184945] ath10k_ahb a800000.wifi: boot upload otp to 0x1234 len 4582 for board id
[  106.205657] ath10k_ahb a800000.wifi: boot get otp board id result 0x00004400 board_id 17 chip_id 0
[  106.205811] ath10k_ahb a800000.wifi: boot push board extended data addr 0x0
[  106.225685] ath10k_ahb a800000.wifi: boot upload otp to 0x1234 len 4582
[  106.252294] ath10k_ahb a800000.wifi: boot otp execute result 0

@Aeolus Yang / Kalle / QCA: Would it be possible to assign a variant string to
the Asus RT-AC58U?

I've attached the necessary bmi-board-id=16 and bmi-board-id=17 board 
files to this mail as well. So, all that needs to be done is to add
them to the board-2.bin on your codeaurora / ath10k-firmware project.

Kalle: Can you please update the board-2.bin for the IPQ40XX on your
ath10k-firmware project on github?

https://source.codeaurora.org/quic/qsdk/oss/firmware/ath10k-firmware/plain/ath10k/QCA40XX/hw1.0/board-2.bin
It looks like this board-2.bin has support for a few more boards.

Thanks,
Christian
Sven Eckelmann March 15, 2017, 8:04 a.m. UTC | #2
On Freitag, 10. März 2017 19:20:54 CET Christian Lamparter wrote:
[...]
> @Aeolus Yang / Kalle / QCA: Would it be possible to assign a variant string to
> the Asus RT-AC58U?
> 
> I've attached the necessary bmi-board-id=16 and bmi-board-id=17 board 
> files to this mail as well. So, all that needs to be done is to add
> them to the board-2.bin on your codeaurora / ath10k-firmware project.

@Aeolus Yang / QCA, any new infos how these BDFs or similar ones can be 
integrated in the official [1] QCA40XX board-2.bin? OpenMesh received a board 
which required modified BDFs for bmi-board-id=16 and bmi-board-id=17. This BDF 
was generated by QCA and the ODM and of course conflicts with the
bmi-board-id=16/17 file in the official QCA40XX board-2.bin. The variant 
string method [2,3] is currently the only way to have all these conflicting 
files in the same board-2.bin.

Having the RT-AC58U already integrated in the official board-2.bin would be 
good example and would reduce the barrier for other vendors (with the same
problem) a lot. For example OpenMesh could then use the same approach to get
their BDFs integrated. 

Kind regards,
	Sven

[1] "official" as in "part of the official repositories"
    * https://github.com/kvalo/ath10k-firmware
    * https://source.codeaurora.org/quic/qsdk/oss/firmware/ath10k-firmware
    * https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/
[2] https://patchwork.kernel.org/patch/9615179/
[3] https://patchwork.kernel.org/patch/9615181/
Sven Eckelmann Aug. 21, 2017, 7:11 a.m. UTC | #3
On Freitag, 10. März 2017 19:20:54 CEST Christian Lamparter wrote:
[...]
> @Aeolus Yang / Kalle / QCA: Would it be possible to assign a variant string to
> the Asus RT-AC58U?
> 
> I've attached the necessary bmi-board-id=16 and bmi-board-id=17 board 
> files to this mail as well. So, all that needs to be done is to add
> them to the board-2.bin on your codeaurora / ath10k-firmware project.
> 
> Kalle: Can you please update the board-2.bin for the IPQ40XX on your
> ath10k-firmware project on github?
> 
> https://source.codeaurora.org/quic/qsdk/oss/firmware/ath10k-firmware/plain/ath10k/QCA40XX/hw1.0/board-2.bin
> It looks like this board-2.bin has support for a few more boards.

Any updates on that?

Kind regards,
	Sven
Kalle Valo Oct. 27, 2017, 9:34 a.m. UTC | #4
Sven Eckelmann <sven.eckelmann@openmesh.com> writes:

> On Freitag, 10. März 2017 19:20:54 CEST Christian Lamparter wrote:

> [...]

>> @Aeolus Yang / Kalle / QCA: Would it be possible to assign a variant string to

>> the Asus RT-AC58U?

>> 

>> I've attached the necessary bmi-board-id=16 and bmi-board-id=17 board 

>> files to this mail as well. So, all that needs to be done is to add

>> them to the board-2.bin on your codeaurora / ath10k-firmware project.

>> 

>> Kalle: Can you please update the board-2.bin for the IPQ40XX on your

>> ath10k-firmware project on github?

>> 

>> https://source.codeaurora.org/quic/qsdk/oss/firmware/ath10k-firmware/plain/ath10k/QCA40XX/hw1.0/board-2.bin

>> It looks like this board-2.bin has support for a few more boards.

>

> Any updates on that?


Sorry, I had missed these somehow. I put them now back to my queue:

https://patchwork.kernel.org/patch/9615183/

https://patchwork.kernel.org/patch/9615185/

-- 
Kalle Valo
Kalle Valo Dec. 8, 2017, 9:27 a.m. UTC | #5
Sven Eckelmann <sven.eckelmann@openmesh.com> writes:

> Board Data File (BDF) is loaded upon driver boot-up procedure. The right
> board data file is identified on QCA4019 using bus, bmi-chip-id and
> bmi-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.
>
> This problem was solved for SMBIOS by adding a special SMBIOS type 0xF8.
> Something similar has to be provided for systems without SMBIOS but with
> device trees. No solution was specified by QCA and therefore a new one has
> to be found for ath10k.
>
> The device tree requires addition strings to define the variant name
>
>     wifi@a000000 {
>     	status = "okay";
>     	qcom,ath10k-calibration-variant = "RT-AC58U";
>     };
>
>     wifi@a800000 {
>     	status = "okay";
>     	qcom,ath10k-calibration-variant = "RT-AC58U";
>     };
>
> This would create the boarddata identifiers for the board-2.bin search
>
>  *  bus=ahb,bmi-chip-id=0,bmi-board-id=16,variant=RT-AC58U
>  *  bus=ahb,bmi-chip-id=0,bmi-board-id=17,variant=RT-AC58U
>
> Signed-off-by: Sven Eckelmann <sven.eckelmann@openmesh.com>
> ---
> Since RFC:
>
>  - initialize variant pointer to have it initialized to NULL when
>    of_property_read_string fails (thanks Christian Lamparter)
>  - Only print warning that DT doesn't contain string ones (thanks Christian
>    Lamparter)
>  - Split patch in DT doc and ath10k part (thanks Christian Lamparter)
>  - Allow to overwrite the variant string via DT and ignore that SMBIOS had
>    written anything to it

[...]

> --- a/drivers/net/wireless/ath/ath10k/core.c
> +++ b/drivers/net/wireless/ath/ath10k/core.c
> @@ -779,6 +779,25 @@ static int ath10k_core_check_smbios(struct ath10k *ar)
>  	return 0;
>  }
>  
> +static int ath10k_core_check_dt(struct ath10k *ar)
> +{
> +	struct device_node *node;
> +	const char *variant = NULL;
> +
> +	node = ar->dev->of_node;
> +	if (!node)
> +		return -ENOENT;
> +
> +	of_property_read_string(node, "qcom,ath10k-calibration-variant",
> +				&variant);
> +	if (!variant)
> +		return -ENODATA;
> +
> +	strscpy(ar->id.bdf_ext, variant, sizeof(ar->id.bdf_ext));

Kbuild bot found a warning here:

   drivers/net/wireless/ath/ath10k/core.c: In function 'ath10k_core_check_dt':
>> drivers/net/wireless/ath/ath10k/core.c:877:2: warning: ignoring return value of 'strscpy', declared with attribute warn_unused_result [-Wunused-result]
     strscpy(ar->id.bdf_ext, variant, sizeof(ar->id.bdf_ext));
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I guess warn_unused_result in strscpy() is a recent addition and that's
why you didn't see it.
Kalle Valo Dec. 8, 2017, 9:50 a.m. UTC | #6
Christian Lamparter <chunkeey@googlemail.com> writes:

> On Friday, March 10, 2017 9:06:15 AM CET Sven Eckelmann wrote:
>> Board Data File (BDF) is loaded upon driver boot-up procedure. The right
>> board data file is identified on QCA4019 using bus, bmi-chip-id and
>> bmi-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.
>> 
>> This problem was solved for SMBIOS by adding a special SMBIOS type 0xF8.
>> Something similar has to be provided for systems without SMBIOS but with
>> device trees. No solution was specified by QCA and therefore a new one has
>> to be found for ath10k.
>> 
>> The device tree requires addition strings to define the variant name
>> 
>>     wifi@a000000 {
>>     	status = "okay";
>>     	qcom,ath10k-calibration-variant = "RT-AC58U";
>>     };
>> 
>>     wifi@a800000 {
>>     	status = "okay";
>>     	qcom,ath10k-calibration-variant = "RT-AC58U";
>>     };
>> 
>> This would create the boarddata identifiers for the board-2.bin search
>> 
>>  *  bus=ahb,bmi-chip-id=0,bmi-board-id=16,variant=RT-AC58U
>>  *  bus=ahb,bmi-chip-id=0,bmi-board-id=17,variant=RT-AC58U
>> 
>> Signed-off-by: Sven Eckelmann <sven.eckelmann@openmesh.com>

[...]

> @Aeolus Yang / Kalle / QCA: Would it be possible to assign a variant string to
> the Asus RT-AC58U?

What do you mean? Add qcom,ath10k-calibration-variant to that board's
device tree or something else?

> I've attached the necessary bmi-board-id=16 and bmi-board-id=17 board 
> files to this mail as well. So, all that needs to be done is to add
> them to the board-2.bin on your codeaurora / ath10k-firmware project.
>
> Kalle: Can you please update the board-2.bin for the IPQ40XX on your
> ath10k-firmware project on github?

Where did you get these board files from?

BTW, it seems lots of people want to add board files so I wrote
instruction how I prefer them submitted:

https://wireless.wiki.kernel.org/en/users/drivers/ath10k/boardfiles

> https://source.codeaurora.org/quic/qsdk/oss/firmware/ath10k-firmware/plain/ath10k/QCA40XX/hw1.0/board-2.bin
>
> It looks like this board-2.bin has support for a few more boards.

I checked and that should be in ath10k-firmware.git now:

$ ath10k-bdencoder --diff ../board-2.bin board-2.bin  | tail -1
0 board image(s) added, 0 changed, 0 deleted, 9 in total
Christian Lamparter Jan. 29, 2018, 8:09 p.m. UTC | #7
Sven's boarddata for the OpenMesh A42 has been accepted. \o/
So let's try to get the board data for the RT-AC58U merged.

On Friday, December 8, 2017 10:50:12 AM CET Kalle Valo wrote:
> > I've attached the necessary bmi-board-id=16 and bmi-board-id=17 board 
> > files to this mail as well. So, all that needs to be done is to add
> > them to the board-2.bin on your codeaurora / ath10k-firmware project.
> >
> > Kalle: Can you please update the board-2.bin for the IPQ40XX on your
> > ath10k-firmware project on github?

Since some time has passed since the original submission, I just stick to
answering the questions in the the guide from:
<https://wireless.wiki.kernel.org/en/users/drivers/ath10k/boardfiles>

> description for what hardware this is
The hardware is the ASUS RT-AC58U [0]. It has a IPQ4018 SoC which
hosts two ath10k wifis. <https://www.asus.com/Networking/RT-AC58U/>
It's based on the qcom-ipq4019-ap.dk01.1-c2. machid: 0x8010100 .
the 5GHz and 2.4GHz radio components were drastically changed and
as a result, the device's wifis don't work very well with the reference
board-2.bin values. The 5GHz wifi suffers the most, the max throughput
tops out at 6 Mbps, even in the best possible "lab conditions".

> origin of the board file (did you create it yourself or where you downloaded)

These files are available in ASUS's GPL Source Code release.

The source code can be downloaded from this site:
<https://www.asus.com/Networking/RT-AC58U/HelpDesk_Download/>
Just select "Driver & Tools" in the right frame and "Others"
in the "Please select OS". It's the second tab called "Source Code":

|Version 3.0.0.4.380.8119
|2017/10/30  522.32 MBytes
|GPL of ASUS RT-AC58U for firmware 3.0.0.4.380.8119
(Note: If you press "Show all", it will list two older releases as well.
The boarddata files I sent you back then came from the original 
GPL_RT-AC58U_3.0.0.4.380.6516-g6772678 release. But the boarddata_*.bin
files have been updated since. So I'm attaching the new ones this time.)

The zip file contains one big GPL_RT-AC58U_3.0.0.4.380.8119-gdb642b4.tgz
which in turn contain these these two files.
asuswrt/release/src/router/qca-wifi-fw.ipq40xx/RT-AC58U/boarddata_0.bin
asuswrt/release/src/router/qca-wifi-fw.ipq40xx/RT-AC58U/boarddata_1.bin

I took the liberty of renaming the files to:

boarddata_0 -> bus=ahb,bmi-chip-id=0,bmi-board-id=16,variant=ASUS-RT-AC58U.bin
boarddata_1 -> bus=ahb,bmi-chip-id=0,bmi-board-id=17,variant=ASUS-RT-AC58U.bin

> ids to be used with the board file (ATH10K_BD_IE_BOARD_NAME in ath10k)

Following OpenMesh A42 example of "VENDOR-DEVICE", I choose to go with:
"ASUS-RT-AC58U" as the variant string:

full board name (ATH10K_BD_IE_BOARD_NAME):
bus=ahb,bmi-chip-id=0,bmi-board-id=16,variant=ASUS-RT-AC58U
bus=ahb,bmi-chip-id=0,bmi-board-id=17,variant=ASUS-RT-AC58U

    {
        "data": "bus=ahb,bmi-chip-id=0,bmi-board-id=16,variant=ASUS-RT-AC58U.bin", 
        "names": [
            "bus=ahb,bmi-chip-id=0,bmi-board-id=16,variant=ASUS-RT-AC58U"
        ]
    }, 
    {
        "data": "bus=ahb,bmi-chip-id=0,bmi-board-id=17,variant=ASUS-RT-AC58U.bin", 
        "names": [
            "bus=ahb,bmi-chip-id=0,bmi-board-id=17,variant=ASUS-RT-AC58U"
        ]
    },   

    (if this is appended at the end of board-2.json, please remove the
     last comma)

> attach the actual board file (board.bin)
attached.

just in case. These are the sha256sum:
d9eb177737983ed320027d50711fd17fadc8057ff0a99d1d455342ef7a7bb1af  \
    bus=ahb,bmi-chip-id=0,bmi-board-id=16,variant=ASUS-RT-AC58U.bin

24969cd91553fd915c51a8fe51c7b7e0e273679e1349b47d0a6c5ef4b4bb4a1b  \
    bus=ahb,bmi-chip-id=0,bmi-board-id=17,variant=ASUS-RT-AC58U.bin

I also verified that the ASUS' firmware for the RT-AC58U 
(FW_RT_AC58U_30043808119.ZIP) uses the very same files.
Kalle Valo April 19, 2018, 2:56 p.m. UTC | #8
Christian Lamparter <chunkeey@googlemail.com> writes:

> On Friday, March 10, 2017 9:06:15 AM CET Sven Eckelmann wrote:
>> Board Data File (BDF) is loaded upon driver boot-up procedure. The right
>> board data file is identified on QCA4019 using bus, bmi-chip-id and
>> bmi-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.
>> 
>> This problem was solved for SMBIOS by adding a special SMBIOS type 0xF8.
>> Something similar has to be provided for systems without SMBIOS but with
>> device trees. No solution was specified by QCA and therefore a new one has
>> to be found for ath10k.
>> 
>> The device tree requires addition strings to define the variant name
>> 
>>     wifi@a000000 {
>>     	status = "okay";
>>     	qcom,ath10k-calibration-variant = "RT-AC58U";
>>     };
>> 
>>     wifi@a800000 {
>>     	status = "okay";
>>     	qcom,ath10k-calibration-variant = "RT-AC58U";
>>     };
>> 
>> This would create the boarddata identifiers for the board-2.bin search
>> 
>>  *  bus=ahb,bmi-chip-id=0,bmi-board-id=16,variant=RT-AC58U
>>  *  bus=ahb,bmi-chip-id=0,bmi-board-id=17,variant=RT-AC58U
>> 
>> Signed-off-by: Sven Eckelmann <sven.eckelmann@openmesh.com>
>> ---
> I've attached a modified board-2.bin for the RT-AC58U variant:
>
> # ath10k-bdencoder -i board-2.bin
> FileSize: 48564
> FileCRC32: 7ac95dfd
> FileMD5: 825c8e7377b0d543024dbf62f2fd29ff
> BoardNames[0]: 'bus=ahb,bmi-chip-id=0,bmi-board-id=16,variant=RT-AC58U'
> BoardLength[0]: 12064
> BoardCRC32[0]: bd216dd3
> BoardMD5[0]: a12a4745c775beb5ab6ba1e4d711aea0
> BoardNames[1]: 'bus=ahb,bmi-chip-id=0,bmi-board-id=16'
> BoardLength[1]: 12064
> BoardCRC32[1]: 65a8a5b3
> BoardMD5[1]: cb5dcb0337706c313ea3342587b283ae
> BoardNames[2]: 'bus=ahb,bmi-chip-id=0,bmi-board-id=17,variant=RT-AC58U'
> BoardLength[2]: 12064
> BoardCRC32[2]: a7d74de3
> BoardMD5[2]: 17bbd05ee0cd9099a549c835b7399b3c
> BoardNames[3]: 'bus=ahb,bmi-chip-id=0,bmi-board-id=17'
> BoardLength[3]: 12064
> BoardCRC32[3]: 4fe93ca0
> BoardMD5[3]: 1aa45fad7a0d6f1c5774b251c712c67c
>
> And this is a patched ath10k loading it:
>
> [ 106.155058] ath10k_ahb a800000.wifi: boot get otp board id result
> 0x00004400 board_id 17 chip_id 0
> [  106.155092] ath10k_ahb a800000.wifi: SMBIOS bdf variant name not set.
> [ 106.155154] ath10k_ahb a800000.wifi: boot using board name
> 'bus=ahb,bmi-chip-id=0,bmi-board-id=17,variant=RT-AC58U'
> [  106.155570] ath10k_ahb a800000.wifi: board name
> [ 106.155607] ath10k_ahb a800000.wifi: 00000000: 62 75 73 3d 61 68 62
> 2c 62 6d 69 2d 63 68 69 70 bus=ahb,bmi-chip
> [ 106.155644] ath10k_ahb a800000.wifi: 00000010: 2d 69 64 3d 30 2c 62
> 6d 69 2d 62 6f 61 72 64 2d -id=0,bmi-board-
> [ 106.155681] ath10k_ahb a800000.wifi: 00000020: 69 64 3d 31 36 2c 76
> 61 72 69 61 6e 74 3d 52 54 id=16,variant=RT
> [ 106.155904] ath10k_ahb a800000.wifi: 00000030: 2d 41 43 35 38 55
> -AC58U
> [  106.155972] ath10k_ahb a800000.wifi: board name
> [ 106.156057] ath10k_ahb a800000.wifi: 00000000: 62 75 73 3d 61 68 62
> 2c 62 6d 69 2d 63 68 69 70 bus=ahb,bmi-chip
> [ 106.156142] ath10k_ahb a800000.wifi: 00000010: 2d 69 64 3d 30 2c 62
> 6d 69 2d 62 6f 61 72 64 2d -id=0,bmi-board-
> [ 106.156211] ath10k_ahb a800000.wifi: 00000020: 69 64 3d 31 36 id=16
> [  106.156662] ath10k_ahb a800000.wifi: board name
> [ 106.156700] ath10k_ahb a800000.wifi: 00000000: 62 75 73 3d 61 68 62
> 2c 62 6d 69 2d 63 68 69 70 bus=ahb,bmi-chip
> [ 106.156737] ath10k_ahb a800000.wifi: 00000010: 2d 69 64 3d 30 2c 62
> 6d 69 2d 62 6f 61 72 64 2d -id=0,bmi-board-
> [ 106.156773] ath10k_ahb a800000.wifi: 00000020: 69 64 3d 31 37 2c 76
> 61 72 69 61 6e 74 3d 52 54 id=17,variant=RT
> [ 106.156809] ath10k_ahb a800000.wifi: 00000030: 2d 41 43 35 38 55
> -AC58U
> [ 106.156845] ath10k_ahb a800000.wifi: boot found match for name
> 'bus=ahb,bmi-chip-id=0,bmi-board-id=17,variant=RT-AC58U'
> [ 106.156876] ath10k_ahb a800000.wifi: boot found board data for
> 'bus=ahb,bmi-chip-id=0,bmi-board-id=17,variant=RT-AC58U'
> [  106.156906] ath10k_ahb a800000.wifi: using board api 2
> [  106.163704] ath10k_ahb a800000.wifi: board_file api 2 bmi_id 0:17 crc32 f222ba02
> [  106.165037] ath10k_ahb a800000.wifi: boot push board extended data addr 0x0
> [  106.184867] ath10k_ahb a800000.wifi: boot cal file downloaded
> [  106.184905] ath10k_ahb a800000.wifi: boot using calibration mode pre-cal-file
> [ 106.184945] ath10k_ahb a800000.wifi: boot upload otp to 0x1234 len
> 4582 for board id
> [ 106.205657] ath10k_ahb a800000.wifi: boot get otp board id result
> 0x00004400 board_id 17 chip_id 0
> [  106.205811] ath10k_ahb a800000.wifi: boot push board extended data addr 0x0
> [  106.225685] ath10k_ahb a800000.wifi: boot upload otp to 0x1234 len 4582
> [  106.252294] ath10k_ahb a800000.wifi: boot otp execute result 0
>
> @Aeolus Yang / Kalle / QCA: Would it be possible to assign a variant string to
> the Asus RT-AC58U?
>
> I've attached the necessary bmi-board-id=16 and bmi-board-id=17 board 
> files to this mail as well. So, all that needs to be done is to add
> them to the board-2.bin on your codeaurora / ath10k-firmware project.
>
> Kalle: Can you please update the board-2.bin for the IPQ40XX on your
> ath10k-firmware project on github?

I have added them now, please check:

https://github.com/kvalo/ath10k-firmware/commit/a47bcf1e58c4d8914af0951a80fd8861368b700d

New:
bus=ahb,bmi-chip-id=0,bmi-board-id=16,variant=RT-AC58U

Changed:


Deleted:

1 board image(s) added, 0 changed, 0 deleted, 24 in total

New:
bus=ahb,bmi-chip-id=0,bmi-board-id=17,variant=RT-AC58U

Changed:


Deleted:

1 board image(s) added, 0 changed, 0 deleted, 25 in total
Christian Lamparter April 20, 2018, 7:50 p.m. UTC | #9
On Donnerstag, 19. April 2018 16:56:36 CEST Kalle Valo wrote:
> [...]
> I have added them now, please check:
> 
> https://github.com/kvalo/ath10k-firmware/commit/a47bcf1e58c4d8914af0951a80fd8861368b700d
Yes, The RT-AC58U is now working much better. 

The updated RT-AC58U board-data is here:
<http://lists.infradead.org/pipermail/ath10k/2018-January/010770.html>

Regards
Christian
Kalle Valo Oct. 8, 2018, 8:21 a.m. UTC | #10
Christian Lamparter <chunkeey@gmail.com> writes:

> Sven's boarddata for the OpenMesh A42 has been accepted. \o/
> So let's try to get the board data for the RT-AC58U merged.
>
> On Friday, December 8, 2017 10:50:12 AM CET Kalle Valo wrote:
>> > I've attached the necessary bmi-board-id=16 and bmi-board-id=17 board 
>> > files to this mail as well. So, all that needs to be done is to add
>> > them to the board-2.bin on your codeaurora / ath10k-firmware project.
>> >
>> > Kalle: Can you please update the board-2.bin for the IPQ40XX on your
>> > ath10k-firmware project on github?
>
> Since some time has passed since the original submission, I just stick to
> answering the questions in the the guide from:
> <https://wireless.wiki.kernel.org/en/users/drivers/ath10k/boardfiles>
>
>> description for what hardware this is
> The hardware is the ASUS RT-AC58U [0]. It has a IPQ4018 SoC which
> hosts two ath10k wifis. <https://www.asus.com/Networking/RT-AC58U/>
> It's based on the qcom-ipq4019-ap.dk01.1-c2. machid: 0x8010100 .
> the 5GHz and 2.4GHz radio components were drastically changed and
> as a result, the device's wifis don't work very well with the reference
> board-2.bin values. The 5GHz wifi suffers the most, the max throughput
> tops out at 6 Mbps, even in the best possible "lab conditions".
>
>> origin of the board file (did you create it yourself or where you downloaded)
>
> These files are available in ASUS's GPL Source Code release.
>
> The source code can be downloaded from this site:
> <https://www.asus.com/Networking/RT-AC58U/HelpDesk_Download/>
> Just select "Driver & Tools" in the right frame and "Others"
> in the "Please select OS". It's the second tab called "Source Code":
>
> |Version 3.0.0.4.380.8119
> |2017/10/30  522.32 MBytes
> |GPL of ASUS RT-AC58U for firmware 3.0.0.4.380.8119
> (Note: If you press "Show all", it will list two older releases as well.
> The boarddata files I sent you back then came from the original 
> GPL_RT-AC58U_3.0.0.4.380.6516-g6772678 release. But the boarddata_*.bin
> files have been updated since. So I'm attaching the new ones this time.)
>
> The zip file contains one big GPL_RT-AC58U_3.0.0.4.380.8119-gdb642b4.tgz
> which in turn contain these these two files.
> asuswrt/release/src/router/qca-wifi-fw.ipq40xx/RT-AC58U/boarddata_0.bin
> asuswrt/release/src/router/qca-wifi-fw.ipq40xx/RT-AC58U/boarddata_1.bin
>
> I took the liberty of renaming the files to:
>
> boarddata_0 -> bus=ahb,bmi-chip-id=0,bmi-board-id=16,variant=ASUS-RT-AC58U.bin
> boarddata_1 -> bus=ahb,bmi-chip-id=0,bmi-board-id=17,variant=ASUS-RT-AC58U.bin
>
>> ids to be used with the board file (ATH10K_BD_IE_BOARD_NAME in ath10k)
>
> Following OpenMesh A42 example of "VENDOR-DEVICE", I choose to go with:
> "ASUS-RT-AC58U" as the variant string:
>
> full board name (ATH10K_BD_IE_BOARD_NAME):
> bus=ahb,bmi-chip-id=0,bmi-board-id=16,variant=ASUS-RT-AC58U
> bus=ahb,bmi-chip-id=0,bmi-board-id=17,variant=ASUS-RT-AC58U
>
>     {
>         "data": "bus=ahb,bmi-chip-id=0,bmi-board-id=16,variant=ASUS-RT-AC58U.bin", 
>         "names": [
>             "bus=ahb,bmi-chip-id=0,bmi-board-id=16,variant=ASUS-RT-AC58U"
>         ]
>     }, 
>     {
>         "data": "bus=ahb,bmi-chip-id=0,bmi-board-id=17,variant=ASUS-RT-AC58U.bin", 
>         "names": [
>             "bus=ahb,bmi-chip-id=0,bmi-board-id=17,variant=ASUS-RT-AC58U"
>         ]
>     },   
>
>     (if this is appended at the end of board-2.json, please remove the
>      last comma)
>
>> attach the actual board file (board.bin)
> attached.
>
> just in case. These are the sha256sum:
> d9eb177737983ed320027d50711fd17fadc8057ff0a99d1d455342ef7a7bb1af  \
>     bus=ahb,bmi-chip-id=0,bmi-board-id=16,variant=ASUS-RT-AC58U.bin
>
> 24969cd91553fd915c51a8fe51c7b7e0e273679e1349b47d0a6c5ef4b4bb4a1b  \
>     bus=ahb,bmi-chip-id=0,bmi-board-id=17,variant=ASUS-RT-AC58U.bin
>
> I also verified that the ASUS' firmware for the RT-AC58U 
> (FW_RT_AC58U_30043808119.ZIP) uses the very same files.

Added, thanks. But please do double check that I didn't do any mistakes.

https://github.com/kvalo/ath10k-firmware/commit/4b89c2b7efef0ba663339c1a42c673e97c7562bd
diff mbox

Patch

diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
index 0a8e29e9a0eb..e459e84afe9f 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -779,6 +779,25 @@  static int ath10k_core_check_smbios(struct ath10k *ar)
 	return 0;
 }
 
+static int ath10k_core_check_dt(struct ath10k *ar)
+{
+	struct device_node *node;
+	const char *variant = NULL;
+
+	node = ar->dev->of_node;
+	if (!node)
+		return -ENOENT;
+
+	of_property_read_string(node, "qcom,ath10k-calibration-variant",
+				&variant);
+	if (!variant)
+		return -ENODATA;
+
+	strscpy(ar->id.bdf_ext, variant, sizeof(ar->id.bdf_ext));
+
+	return 0;
+}
+
 static int ath10k_download_and_run_otp(struct ath10k *ar)
 {
 	u32 result, address = ar->hw_params.patch_load_addr;
@@ -1145,19 +1164,19 @@  static int ath10k_core_create_board_name(struct ath10k *ar, char *name,
 	/* strlen(',variant=') + strlen(ar->id.bdf_ext) */
 	char variant[9 + ATH10K_SMBIOS_BDF_EXT_STR_LENGTH] = { 0 };
 
+	if (ar->id.bdf_ext[0] != '\0')
+		scnprintf(variant, sizeof(variant), ",variant=%s",
+			  ar->id.bdf_ext);
+
 	if (ar->id.bmi_ids_valid) {
 		scnprintf(name, name_len,
-			  "bus=%s,bmi-chip-id=%d,bmi-board-id=%d",
+			  "bus=%s,bmi-chip-id=%d,bmi-board-id=%d%s",
 			  ath10k_bus_str(ar->hif.bus),
 			  ar->id.bmi_chip_id,
-			  ar->id.bmi_board_id);
+			  ar->id.bmi_board_id, variant);
 		goto out;
 	}
 
-	if (ar->id.bdf_ext[0] != '\0')
-		scnprintf(variant, sizeof(variant), ",variant=%s",
-			  ar->id.bdf_ext);
-
 	scnprintf(name, name_len,
 		  "bus=%s,vendor=%04x,device=%04x,subsystem-vendor=%04x,subsystem-device=%04x%s",
 		  ath10k_bus_str(ar->hif.bus),
@@ -2221,7 +2240,11 @@  static int ath10k_core_probe_fw(struct ath10k *ar)
 
 	ret = ath10k_core_check_smbios(ar);
 	if (ret)
-		ath10k_dbg(ar, ATH10K_DBG_BOOT, "bdf variant name not set.\n");
+		ath10k_dbg(ar, ATH10K_DBG_BOOT, "SMBIOS bdf variant name not set.\n");
+
+	ret = ath10k_core_check_dt(ar);
+	if (ret)
+		ath10k_dbg(ar, ATH10K_DBG_BOOT, "DT bdf variant name not set.\n");
 
 	ret = ath10k_core_fetch_board_file(ar);
 	if (ret) {