tfm: Add wireless connection support for RPI4 29/228129/6 accepted/tizen/unified/20200323.173017 submit/tizen/20200320.075622
authorDongwoo Lee <dwoo08.lee@samsung.com>
Thu, 19 Mar 2020 04:45:10 +0000 (13:45 +0900)
committerJunghoon Kim <jhoon20.kim@samsung.com>
Fri, 20 Mar 2020 02:44:09 +0000 (02:44 +0000)
The nvram files for RPI4 and RPI3+ wifi chipset have a little
difference contents but name is identical. To deal with this,
the target is identified through sysfs node and the correct
nvram is selected by result.

In addition, now tfm shows ssid including serial number.

Change-Id: I7122574b09155cbd27ccf1c35c2cdcabe528864a
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
data/brcmfmac43455-sdio.raspberrypi,3-model-b-plus.txt [moved from data/brcmfmac43455-sdio.txt with 100% similarity]
data/brcmfmac43455-sdio.raspberrypi,4-model-b.txt [new file with mode: 0644]
data/hostapd.conf
scripts/41-flash.list
scripts/flash-init.sh

diff --git a/data/brcmfmac43455-sdio.raspberrypi,4-model-b.txt b/data/brcmfmac43455-sdio.raspberrypi,4-model-b.txt
new file mode 100644 (file)
index 0000000..425d293
--- /dev/null
@@ -0,0 +1,82 @@
+# SPDX-License-Identifier: GPL-2.0+
+# (C) Copyright 2018 Raspberry Pi (Trading) Ltd.
+# NVRAM config file for the BCM43455 WiFi/BT chip as found on the
+# Raspberry Pi 4 Model B
+aa2g=1
+aa5g=1
+AvVmid_c0=1,165,2,100,2,100,2,100,2,100
+boardflags=0x00480201
+boardflags2=0x40800000
+boardflags3=0x44200100
+boardrev=0x1304
+boardtype=0x6e4
+btc_mode=1
+btc_params1=0x7530
+btc_params8=0x4e20
+cbfilttype=1
+cckPwrIdxCorr=3
+cckTssiDelay=150
+deadman_to=481500000
+devid=0x43ab
+dot11agofdmhrbw202gpo=0x4442
+dot11b_opts=0x3aa85
+ed_thresh2g=-54
+ed_thresh5g=-54
+eu_edthresh2g=-54
+eu_edthresh5g=-54
+extpagain2g=2
+extpagain5g=2
+fdsslevel_ch11=6
+femctrl=0
+itrsw=1
+ldo1=4
+ltecxfnsel=0x22
+ltecxgcigpio=0x32
+ltecxmux=0
+ltecxpadnum=0x0504
+macaddr=b8:27:eb:74:f2:6c
+manfid=0x2d0
+maxp2ga0=80
+maxp5ga0=82,82,82,82
+mcsbw202gpo=0x98444422
+mcsbw205ghpo=0xb9555000
+mcsbw205glpo=0xb9555000
+mcsbw205gmpo=0xb9555000
+mcsbw402gpo=0x98444422
+mcsbw405ghpo=0xb9555000
+mcsbw405glpo=0xb9555000
+mcsbw405gmpo=0xb9555000
+mcsbw805ghpo=0xb9555000
+mcsbw805glpo=0xb9555000
+mcsbw805gmpo=0xb9555000
+nocrc=1
+ofdmlrbw202gpo=0x0022
+ofdmTssiDelay=150
+pa2ga0=-129,6525,-718
+pa2ga1=-149,4408,-601
+pa5ga0=-185,6836,-815,-186,6838,-815,-184,6859,-815,-184,6882,-818
+pa5ga1=-202,4285,-574,-201,4312,-578,-196,4391,-586,-201,4294,-575
+pdoffset2g40ma0=16
+pdoffset2gperchan=0,-2,1,0,1,0,1,1,1,0,0,-1,-1,0
+pdoffset40ma0=0x8888
+pdoffset80ma0=0x8888
+pdoffsetcckma0=2
+phycal_tempdelta=15
+prodid=0x06e4
+rawtempsense=0x1ff
+rxchain=1
+sromrev=11
+swctrlmap_2g=0x00000000,0x00000000,0x00000000,0x010000,0x3ff
+swctrlmap_5g=0x00100010,0x00200020,0x00200020,0x010000,0x3fe
+swctrlmapext_2g=0x00000000,0x00000000,0x00000000,0x000000,0x3
+swctrlmapext_5g=0x00000000,0x00000000,0x00000000,0x000000,0x3
+tssipos2g=1
+tssipos5g=1
+tworangetssi2g=1
+tworangetssi5g=1
+txchain=1
+txpwr2gAdcScale=1
+txpwr5gAdcScale=1
+vcodivmode=1
+vendid=0x14e4
+xtalfreq=37400
index 80cefcd..133fb81 100644 (file)
@@ -1,6 +1,6 @@
 interface=wlan0
 driver=nl80211
-ssid=TIZEN_RPI3
+ssid=
 channel=6
 ignore_broadcast_ssid=0
 hw_mode=g
index c9c2611..834fe76 100755 (executable)
@@ -27,6 +27,7 @@ WITHLIBS="
 /bin/hostapd
 /bin/dnsmasq
 /bin/ln
+/bin/sed
 "
 
 # LinkFileName:Target
index 6473dd7..33c1f8e 100755 (executable)
@@ -21,6 +21,7 @@ INSMOD="/usr/sbin/insmod"
 DNSMASQ="/usr/bin/dnsmasq"
 HOSTAPD="/usr/bin/hostapd"
 LINK="/usr/bin/ln"
+SED="/usr/bin/sed"
 
 NETIF="eth0"
 WLANIF="wlan0"
@@ -49,6 +50,36 @@ setup_usb() {
        fi
 }
 
+#------------------------------------------------
+# Identify the target and prepare firmwares
+#------------------------------------------------
+prepare_wireless() {
+       MODEL=$(cat /sys/firmware/devicetree/base/model)
+
+       if [[ $MODEL == *"Raspberry"* ]]; then
+               FIRM_DIR="/lib/firmware/brcm"
+
+               if [ "$MODEL" = "Raspberry Pi 4 Model B" ]; then
+                       COMPAT="raspberrypi,4-model-b"
+                       FIRMWARE="brcmfmac43455-sdio"
+                       BOARD_TYPE="RPI4"
+               elif [ "$MODEL" = "Raspberry Pi 3 Model B+" ]; then
+                       COMPAT="raspberrypi,3-model-b-plus"
+                       FIRMWARE="brcmfmac43455-sdio"
+                       BOARD_TYPE="RPI3+"
+               elif [ "$MODEL" = "Raspberry Pi 3 Model B" ]; then
+                       BOARD_TYPE="RPI3"
+               fi
+
+               if [ -n "$COMPAT" ]; then
+                       $LINK -s ${FIRM_DIR}/${FIRMWARE}.${COMPAT}.txt ${FIRM_DIR}/${FIRMWARE}.txt
+               fi
+               SERIAL=$(cat /sys/firmware/devicetree/base/serial-number)
+       else
+               SERIAL=""
+               BOARD_TYPE="BOARD"
+       fi
+}
 
 #------------------------------------------------
 # Copy Module and Firmware file
@@ -68,6 +99,9 @@ setup_wireless() {
                $COPY $BRCMUTIL /lib/firmware/brcm/
                $SYNC
                $UMOUNT ${TMP_PATH}
+
+               prepare_wireless
+
                $INSMOD /lib/firmware/brcm/brcmutil.ko
                sleep 1
                $INSMOD /lib/firmware/brcm/brcmfmac.ko
@@ -77,7 +111,10 @@ setup_wireless() {
                $IFCONFIG $WLANIF ${WLANIP} up
 
                $DNSMASQ -p 0 -9 -C /lib/firmware/brcm/dnsmasq.conf
-               SSID=`$HOSTAPD -B /lib/firmware/brcm/hostapd.conf | "$GREP" -oP '(?<=ssid\s\")(.*?)(?=\")'`
+               SSID="TIZEN_${BOARD_TYPE}_${SERIAL}"
+
+               $SED -i "s/ssid=/ssid=${SSID}/g" /lib/firmware/brcm/hostapd.conf
+               $HOSTAPD -B /lib/firmware/brcm/hostapd.conf > /dev/null
        else
                echo "There is no module partition"
                WLANIP="N/A"