Re: support for Ampak AP6255 (bcm43455c0 with SDIO device ID 0xa9bf)

2017-01-16 Thread Arend Van Spriel
On 15-1-2017 0:18, Martin Blumenstingl wrote:
> Hello,
> 
> I recently got a "Khadas VIM Pro" (see [0] for more information)
> The "Pro" version comes with an AP6255 wifi chipset.
> Looking at the vendor firmware this seems to be a bcm43455 device: [1]
> 
> To my surprise brcmfmac from a mainline 4.10-rc3 kernel did not pick
> this device up.
> So I started investigating:
> $ grep "" 
> /sys/class/mmc_host/mmc2/mmc2\:0001/mmc2\:0001\:*/{class,device,vendor}
> /sys/class/mmc_host/mmc2/mmc2:0001/mmc2:0001:1/class:0x00
> /sys/class/mmc_host/mmc2/mmc2:0001/mmc2:0001:2/class:0x00
> /sys/class/mmc_host/mmc2/mmc2:0001/mmc2:0001:3/class:0x02
> /sys/class/mmc_host/mmc2/mmc2:0001/mmc2:0001:1/device:0xa9bf
> /sys/class/mmc_host/mmc2/mmc2:0001/mmc2:0001:2/device:0xa9bf
> /sys/class/mmc_host/mmc2/mmc2:0001/mmc2:0001:3/device:0xa9bf
> /sys/class/mmc_host/mmc2/mmc2:0001/mmc2:0001:1/vendor:0x02d0
> /sys/class/mmc_host/mmc2/mmc2:0001/mmc2:0001:2/vendor:0x02d0
> /sys/class/mmc_host/mmc2/mmc2:0001/mmc2:0001:3/vendor:0x02d0
> 
> I then went ahead and added the device ID to
> drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c (sample
> patch attached)
> as a result of that the device is now being detected.
> it boots fine with the firmware found in linux-firmware: [2] (plus the
> nvram.txt from the vendor repo [1] renamed to brcmfmac43455-sdio.txt)
> 
> $ cat /sys/kernel/debug/brcmfmac/mmc2\:0001\:1/revinfo
> vendorid: 0x14e4
> deviceid: 0x43ab
> radiorev: 0.88.3.11
> chipnum: 17221 (4345)
> chiprev: 6
> chippkg: 2
> corerev: 54
> boardid: 0x06e4
> boardvendor: 0x14e4
> boardrev: P304
> driverrev: 7.45.18
> ucoderev: 0
> bus: 0
> phytype: 11
> phyrev: 20
> anarev: 0
> nvramrev: 00079ac5
> 
> downloading a random 100MB file from the internet using curl confirms this.
> There are no hangs, connection drops, other devices are also working fine.
> 
> the problem I'm facing is very simply (but unfortunately a very common
> development problem): naming things (the SDIO_DEVICE_ID_BROADCOM_TODO
> constant)!
> there's already a definition for SDIO_DEVICE_ID_BROADCOM_4345 with
> value 0x4345, does that mean 0xa9bf should be
> SDIO_DEVICE_ID_BROADCOM_43455?

Yup. That seems a good name to me.

Regards,
Arend

> Regards,
> Martin
> 
> 
> [0] http://khadas.com/vim/
> [1] 
> https://github.com/khadas/android_hardware_amlogic_wifi/tree/b6709758755568e4a0ff6e80993be0fc64c77fb9/bcm_ampak/config/6255
> [2] 
> https://git.kernel.org/cgit/linux/kernel/git/firmware/linux-firmware.git/commit/brcm/brcmfmac43455-sdio.bin?id=b9a38d041d38ac6cf47274e9933f8083e12fc601
> 


support for Ampak AP6255 (bcm43455c0 with SDIO device ID 0xa9bf)

2017-01-14 Thread Martin Blumenstingl
Hello,

I recently got a "Khadas VIM Pro" (see [0] for more information)
The "Pro" version comes with an AP6255 wifi chipset.
Looking at the vendor firmware this seems to be a bcm43455 device: [1]

To my surprise brcmfmac from a mainline 4.10-rc3 kernel did not pick
this device up.
So I started investigating:
$ grep "" 
/sys/class/mmc_host/mmc2/mmc2\:0001/mmc2\:0001\:*/{class,device,vendor}
/sys/class/mmc_host/mmc2/mmc2:0001/mmc2:0001:1/class:0x00
/sys/class/mmc_host/mmc2/mmc2:0001/mmc2:0001:2/class:0x00
/sys/class/mmc_host/mmc2/mmc2:0001/mmc2:0001:3/class:0x02
/sys/class/mmc_host/mmc2/mmc2:0001/mmc2:0001:1/device:0xa9bf
/sys/class/mmc_host/mmc2/mmc2:0001/mmc2:0001:2/device:0xa9bf
/sys/class/mmc_host/mmc2/mmc2:0001/mmc2:0001:3/device:0xa9bf
/sys/class/mmc_host/mmc2/mmc2:0001/mmc2:0001:1/vendor:0x02d0
/sys/class/mmc_host/mmc2/mmc2:0001/mmc2:0001:2/vendor:0x02d0
/sys/class/mmc_host/mmc2/mmc2:0001/mmc2:0001:3/vendor:0x02d0

I then went ahead and added the device ID to
drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c (sample
patch attached)
as a result of that the device is now being detected.
it boots fine with the firmware found in linux-firmware: [2] (plus the
nvram.txt from the vendor repo [1] renamed to brcmfmac43455-sdio.txt)

$ cat /sys/kernel/debug/brcmfmac/mmc2\:0001\:1/revinfo
vendorid: 0x14e4
deviceid: 0x43ab
radiorev: 0.88.3.11
chipnum: 17221 (4345)
chiprev: 6
chippkg: 2
corerev: 54
boardid: 0x06e4
boardvendor: 0x14e4
boardrev: P304
driverrev: 7.45.18
ucoderev: 0
bus: 0
phytype: 11
phyrev: 20
anarev: 0
nvramrev: 00079ac5

downloading a random 100MB file from the internet using curl confirms this.
There are no hangs, connection drops, other devices are also working fine.

the problem I'm facing is very simply (but unfortunately a very common
development problem): naming things (the SDIO_DEVICE_ID_BROADCOM_TODO
constant)!
there's already a definition for SDIO_DEVICE_ID_BROADCOM_4345 with
value 0x4345, does that mean 0xa9bf should be
SDIO_DEVICE_ID_BROADCOM_43455?


Regards,
Martin


[0] http://khadas.com/vim/
[1] 
https://github.com/khadas/android_hardware_amlogic_wifi/tree/b6709758755568e4a0ff6e80993be0fc64c77fb9/bcm_ampak/config/6255
[2] 
https://git.kernel.org/cgit/linux/kernel/git/firmware/linux-firmware.git/commit/brcm/brcmfmac43455-sdio.bin?id=b9a38d041d38ac6cf47274e9933f8083e12fc601
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
index 72139b579b18..7206bb1f9908 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
@@ -1106,6 +1106,7 @@ static const struct sdio_device_id brcmf_sdmmc_ids[] = {
 	BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4345),
 	BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4354),
 	BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4356),
+	BRCMF_SDIO_DEVICE(0xa9bf),
 	{ /* end: all zeroes */ }
 };
 MODULE_DEVICE_TABLE(sdio, brcmf_sdmmc_ids);