By the official diagram, GPIO pins 63 and 79 control the PCIe path, and both default to the M-key PCIE slot. Inquiring the status of the pin in OpenWrt confirms this.
Unbinding all 4 PCIE controllers with the following command:
for a in 11280000.pcie 11290000.pcie 11300000.pcie 11310000.pcie; do
[ -e /sys/bus/platform/drivers/mtk-pcie-gen3/$a ] && echo $a > /sys/bus/platform/drivers/mtk-pcie-gen3/unbind
done
Then set the GPIO pins 63 and 79 to 1 again
gpioset -c gpiochip0 -C pcie_sel -z 63=1 79=1
Rebind the PCIe controller:
for a in 11280000.pcie 11290000.pcie 11300000.pcie 11310000.pcie; do
echo $a > /sys/bus/platform/drivers/mtk-pcie-gen3/bind 2>/dev/null
done
Yes gpio needs to be set correctly before pcie scan. I tested all m.2 with my kernel before upstreaming this part (i use key-m as default and key-b as overlay).