BPI-R2 2.4Ghz and 5.6Ghz Wifi Working fine

Yes there is a DCHP server. When connected it is fine, but it take for ever and multiple retry.

br0 is set as as follow:

auto br0
iface br0 inet static
        bridge_ports lan0 lan1 lan2 lan3
        address 10.0.0.100
        netmask 255.255.255.0
        network 10.0.0.0

For me the key issue are due to:

Could not set station b4:9d:0b:zz:yy:xx flags for kernel driver (errno=11).

and

ap_free_sta: cancel ap_handle_timer for b4:9d:0b:zz:yy:xx

ip config

# ip a 
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 0e:55:63:f2:ce:06 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::c55:63ff:fef2:ce06/64 scope link 
       valid_lft forever preferred_lft forever
3: wan@eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 86:f9:67:b5:66:33 brd ff:ff:ff:ff:ff:ff
4: lan0@eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue master br0 state LOWERLAYERDOWN group default qlen 1000
    link/ether 86:f9:67:b5:66:33 brd ff:ff:ff:ff:ff:ff
5: lan1@eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue master br0 state LOWERLAYERDOWN group default qlen 1000
    link/ether 86:f9:67:b5:66:33 brd ff:ff:ff:ff:ff:ff
6: lan2@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br0 state UP group default qlen 1000
    link/ether 86:f9:67:b5:66:33 brd ff:ff:ff:ff:ff:ff
7: lan3@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br0 state UP group default qlen 1000
    link/ether 86:f9:67:b5:66:33 brd ff:ff:ff:ff:ff:ff
8: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 02:08:22:40:9d:7d brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.100/24 brd 10.0.0.255 scope global br0
       valid_lft forever preferred_lft forever
    inet6 fe80::84f9:67ff:feb5:6633/64 scope link 
       valid_lft forever preferred_lft forever
11: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 00:08:22:40:9d:7d brd ff:ff:ff:ff:ff:ff
12: ap0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq master br0 state UP group default qlen 1000
    link/ether 02:08:22:40:9d:7d brd ff:ff:ff:ff:ff:ff
    inet6 fe80::8:22ff:fe40:9d7d/64 scope link 
       valid_lft forever preferred_lft forever

Have you tried without the bridge. Maybe without encryption


I’ve got connection with my simple config, but these options i have not tested yet

Hi, I have opended uart, 0, 1, 2 nodes from kernel dti and, build again. But, /dev/wmtWifi has been disapeared.

I want to use GPIO Uart nodes and ap0 hotspot. Is there any way to use same time?

Imho ap0 has nothing to do with spi
but ap0 must be created via wmttools after every boot


I have uart enabled in 4.14 and can create ap0 and use it

Sorry, My mistake. Not uart, i2c


When I enabled i2C from kernel build options, The /dev/wmtWifi was disapeared on BPI after building.

@Yusuf_Bulbul you have enabled I2c only in kernel-options or did you also enabled anything additional in the DTS(i)?

that question must be answered by bpi-team
i did not know how the Combo-chip (mt6625l) for wifi/BT is connected to main-SOC

@garywang @ryder.lee

Well, there’s no relationship between I2C and combo chip. I guess you probably switch pinmux to other function when you enable something, but I don’t know the actual pin setting on R2. You could check it yourself.

I have no problems with i2c
i have nodes for i2c0-2 in dtsi and i2c0+1 enabled in dts

@Yusuf_Bulbul which kernel-option have you enabled? You know,that you must create ap0 after each boot?

As far as i know i2c1 is used for audio-controller

See here:

Hı frank. I couldn’t understand the issue. Sometimes, the wmtWifi is created with i2c nodes. But, sometimes after second kernel building with same kernel config, wmtWifi is not created.

I enabled this options from kernel config

   *I2C device interface
   *Usermode spi device driver support
   *Cameras/video grabbers support
   *Enable advanced debug functionality on V4L2 driver
   *Enable old style fixed minor ranges on /drivers/video device
   *V4L platform sevicez
   *USB video class
   *Uvc input events device support
   *Gspca Based webcams

And also I add uart nodes to mt7623.dtsi and mt7623n_bpi_r2.dts files.

How can I check wmtWifi nodes logs or some information about wmtWifi on userspace? Or Which command should I use for this?

As ryder.lee confirmed wmtwifi have nothing to with i2c. wmtWifi will be created via wmt-tools (wmt_loader, stp_uart_launcher).

I assume that gary put that commands in autorun (rc.local or init-script) on the image you are using and there is sometimes a (timing) issue.

You can look in /etc/rc.local or /etc/init.d or /etc/system.d

Also logs in /var/log (messages,syslog,
) and dmesg can be helpful

`stp_uart_launcher -p /etc/firmware &`

What does this command do? Do you know? Because, I think this can use some uart ports.

This is the second command which creates the wmtwifi device (first initializes the mt6625-chip).

it does not use the uart-ports on gpio, only a uart-like bus named btif

But you have problems with i2c and not uart

Here my merge of the uart-driver in 4.14 where you can see which device-nodes involved: https://github.com/frank-w/BPI-R2-4.14/commit/e6b369a5ade19206db433b46d0102ae000b87e99

Here you see commands to create ap0: http://www.fw-web.de/dokuwiki/doku.php?id=en:bpi-r2:wlan#internal

It may be wrong uart nodes lines.

Is there any problem these lines which I add mt7623n_bpi_dts?

uart0: serial@11002000 {
		compatible = "mediatek,mt7623-uart",
			     "mediatek,mt6577-uart";
		reg = <0 0x11002000 0 0x400>;
		interrupts = <GIC_SPI 51 IRQ_TYPE_LEVEL_LOW>;
		clocks = <&pericfg CLK_PERI_UART0_SEL>,
			 <&pericfg CLK_PERI_UART0>;
		clock-names = "baud", "bus";
		status = "disabled";
	};

	uart1: serial@11003000 {
		compatible = "mediatek,mt7623-uart",
			     "mediatek,mt6577-uart";
		reg = <0 0x11003000 0 0x400>;
		interrupts = <GIC_SPI 52 IRQ_TYPE_LEVEL_LOW>;
		clocks = <&pericfg CLK_PERI_UART1_SEL>,
			 <&pericfg CLK_PERI_UART1>;
		clock-names = "baud", "bus";
		status = "disabled";
	};

and I add to mt7623.dtsi ?

    &uart0 {
    	status = "okay";
    };

&uart1 {
	status = "okay";
};

also, Kernel 4.14 includes these lines. when I add lines to pio block in kernel 4.4, it gives kernel compiling error. So, I don’t add this lines.

uart0_pins_a: uart@0 {
		pins_dat {
			pinmux = <MT7623_PIN_79_URXD0_FUNC_URXD0>,
				 <MT7623_PIN_80_UTXD0_FUNC_UTXD0>;
		};
	};

	uart1_pins_a: uart@1 {
		pins_dat {
			pinmux = <MT7623_PIN_81_URXD1_FUNC_URXD1>,
				 <MT7623_PIN_82_UTXD1_FUNC_UTXD1>;
		};
	};

Many Thanks your helps.

Uart0/1 is added to my 4.4 repo to
you can use that dts(i)
but uart has also nothing to do with i2c or wifi

Okay. I will make somethings clear tomorrow and back here. Thank you my friend. You are the best.

Please decide if you mean uart or i2c
these are 2 different things and having nothing to do with the internal wifi. And a separate thread is imho here also indicated :wink:

Hi Frank. When I enabled i2c, wmtWifi registered and works fine.

dmesg |grep -i wifi
[   42.246822] [MTK-WIFI] WIFI_init: mtk_wmt_WIFI_chrdev driver(major 153) installed.
[   42.246837] [WLAN-MOD-INIT][I]do_wlan_drv_init:WMT-WIFI char dev init, ret:0
[   44.258510] [MTK-WIFI] WIFI_open: WIFI_open: major 153 minor 0 (pid 992)
[   44.258570] [MTK-WIFI] WIFI_write: WIFI_write 1
[   44.611472] [MTK-WIFI] WIFI_write: WMT turn on WIFI fail!
[   44.611637] [MTK-WIFI] WIFI_close: WIFI_close: major 153 minor 0 (pid 992)

When I added Uart nodes and I enabled spi, wmtWifi has been failed.

dmesg |grep -i wifi
[   19.867838] [MTK-WIFI] WIFI_init: Fail to register chrdev
[   19.867841] [WLAN-MOD-INIT][I]do_wlan_drv_init:WMT-WIFI char dev init, ret:-16

Also, When I removed the uart nodes after this. And wmtWifi init has been succesfull.

What does it mean -16 return code for wifi init?

Have you tried my dts(i) from 4.4-repo?

I assume the dts is broken after uart is added (maybe wrong order or similar).

On uart there must uart2 before uart0/1 else debug-uart is not working


I think, I am wrong again. Sorry. I tested Uart again without SPI. And it worked.

There is a crash with SPI not Uart actually.

There is wifi device major number defination in the file “linux-mt/drivers/misc/mediatek/connectivity/common/combo/linux/wmt_chrdev_wifi.c”

#define WIFI_DEV_MAJOR 153

#define PFX                         "[MTK-WIFI] "
#define WIFI_LOG_DBG                  3
#define WIFI_LOG_INFO                 2
#define WIFI_LOG_WARN                 1
#define WIFI_LOG_ERR                  0

In here, The major number of Wifi device is defined as 153. If I look at /proc/devices;

153 mtk_wmt_WIFI_chrdev

Also When I enabled spi user support and I looked at /proc/devices;

153 Spi

Spi is defined as 153 too. I think, When I enabled User Spi support from kernel options, wifi_init is failed because of this.

Is there any way to define wifi_dev_mojor number as diffirent from 153?

In 4.14 there is a Problem with spidev (crash on loading spidev) because of missing compatible-definition
Maybe 4.4 has that problem too

See also link from ryder.lee in Spi-thread