Can i use calibrationdata if i have no mtd (debian/ubuntu)?
This mt76 driver loads eeprom kinda tricky (look at eeprom.c
). First, there is parameter in wmac node:
mediatek,mtd-eeprom = <(reference) (offset)>;
where (reference) - reference to partition definiton, (offset) - offset in it.
Driver looks for mtd-eeprom parameter, follow to partition reference, take label of it and then uses mtd subsystem to load content by partiton label. So, actually, only label is needed from device tree.
Next, you can simulate mtd by using block2mtd driver, which makes mtd devices from common block devices (like emmc/sd). Also there is cmdline parser which can make mtd partitioning. You can enable both driver and parser:
CONFIG_MTD_BLOCK2MTD=y
CONFIG_MTD_CMDLINE_PARTS=y
Next, we need to create virtual mtd device and made fake partition for mt76 in dts, example from OpenWRT build for eMMC:
bootargs = "earlycon=uart8250,mmio32,0x11002000 console=ttyS0,115200n1 swiotlb=512 block2mtd.block2mtd=/dev/mmcblk0,65536,eMMC,5 mtdparts=eMMC:768k(mbr),512k(uboot),512k(uboot-env),256k(factory),-(firmware)"
&mmc0 {
....
/* Fake card and partition, just for taking name "factory" */
emmc@0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "mmc-card";
reg = <0>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
factory: partition@1c0000 {
label = "factory";
/* no need actually, just for sure */
reg = <0x01c0000 0x00040000>;
};
};
};
};
/* EEPROM location */
&wmac {
mediatek,mtd-eeprom = <&factory 0x0000>;
status = "okay";
};
For debian, you can create GPT partition somewhere on SD/eMMC card, flash EEPROM to it.
For example, 256k EEPROM partition at 204800 sector (100MiB), then dts will looks like
bootargs = "... block2mtd.block2mtd=/dev/mmcblk1,65536,SD,5 mtdparts=SD:100M(boot),256k(factory),-(root)"
&mmc1 {
....
/* Fake card and partition, just for taking name "factory" */
sd@0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "mmc-card";
reg = <0>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
factory: partition@6400000 {
label = "factory";
/* no need actually, just for sure */
reg = <0x06400000 0x00040000>;
};
};
};
};
&wmac {
mediatek,mtd-eeprom = <&factory 0x0000>;
status = "okay";
};
However, you should use block2mtd driver (drivers/mtd/devices/block2mtd.c) from OpenWRT tree, because vanilla driver uses auto-generated mtd names with colon, which breaks mtdparts