openwrt/target/linux/generic/files/drivers/platform/mikrotik
Thibaut VARÈNE 41b867165d generic: platform/mikrotik: implement multi caldata
MikroTik recently changed again the way they store wlan calibration data
on devices. Prior to this change, ERD calibration data for all available
radios was stored within a single identifier node ("tag" in RouterBoot
parlance).

Recent devices have been seen with calibration (and BDF) data stored in
separate identifiers within LZOR packing for each radio: this patch
addresses this by:
1) ensuring that both variants are properly supported,
2) preserving backward compatibility with existing data consumers,
3) allowing for more than 2 calibration blobs to be exposed via sysfs.

Specifically, before this patch, the driver would provide a single sysfs
file named /sys/firmware/mikrotik/hard_config/wlan_data that contained
whatever calibration data found on the device's flash. After this patch,
when executed on a device that uses the old style storage, this behavior
is unchanged, but when executed on a device that uses new style storage
(for either traditional "ERD" packing or "LZOR" packing), the driver
replaces that single file with a folder containing one or more files
each containing the data encoded within individual identifiers.

As far as OpenWRT is concerned, this means that for devices which are
known to exist with both styles of data storage, a suitable hotplug stub
could look like this for e.g. the second radio:

wdata="/sys/firmware/mikrotik/hard_config/wlan_data"
( [ -f "$wdata" ] && caldata_sysfsload_from_file "$wdata" 0x8000 0x2f20 ) || \
( [ -d "$wdata" ] && caldata_sysfsload_from_file "$wdata/data_2" 0x0 0x2f20 )

This patch has been tested with LZOR old and new style packing on ipq4019,
and with old style on ath79.

Tested-by: John Thomson <git@johnthomson.fastmail.com.au>
Tested-by: Шебанов Алексей <admin@ublaze.ru>
Tested-by: Alen Opačić <subixonfire@gmail.com>
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
Tested-by: Robert Marko <robimarko@gmail.com>
2020-11-12 18:21:55 +01:00
..
Kconfig generic: routerboot sysfs: add support for soft_config 2020-05-28 11:09:10 +02:00
Makefile generic: routerboot sysfs: add support for soft_config 2020-05-28 11:09:10 +02:00
rb_hardconfig.c generic: platform/mikrotik: implement multi caldata 2020-11-12 18:21:55 +01:00
rb_softconfig.c target: remove obsolete kernel version switches for 4.19 2020-10-30 19:45:24 +01:00
routerboot.c generic: platform/mikrotik: fix routerboot_tag_show_u32s() 2020-07-08 16:07:05 +02:00
routerboot.h generic: routerboot sysfs: move tag_show_u32() 2020-05-28 11:09:10 +02:00