WiFi on Galaxy S3
So, mainline boots! However, with only access to a console over UART, copying files to/from the S3 involves rebooting
to recovery mode, plugging into USB, and pushing the file using Android's debug bridge, adb
. This is... painful.
Fortunately, the S3 and Note 2 include a BCM4334 for WiFi + Bluetooth
functionality. For now, I'm going to focus on WiFi - although Bluetooth shouldn't be too tricky in the future.
Some digging lead to two commits in the Tizen 3.10 kernel, which allow the BCM4334 to boot up and be detected over the SDIO bus, and also to send/receive data.
My first approach was to port the code from Tizen to mainline - unsurprisingly, things changed quite a bit between 4.13 and 3.10. After much hacking, I came up with this not awful looking patch to enable the external 32khz clock, and this ugly hack to enable the WL_REG pin.
So, I sent the clock patch to several mailing lists (a daunting task first time around, for sure). Fortunately, I did nothing terribly wrong (yay!) After some review, the existence of mmc-pwrseq-simple was pointed out to me, which does exactly what is needed - d'oh. One simple patch later and we're in business - almost.
The final step is to ensure that the correct firmware (from linux-firmware) and that the correct "nvram calibration" file is in /lib/firmware/brcm/brcmfmac4334-sdio.txt. I have no idea what this file does, exactly (calibrates something, i guess?), but it's important. It can also be found in any Android ROM for the device, "nvram_net.txt" somewhere in /system. With that, the wifi interface can be brought up successfully and used.