Realtek Wifi bringup on imx8mp phytech board

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Realtek Wifi bringup on imx8mp phytech board

3,352 次查看
anushag
Contributor I

Hi ,

I am working on Realtek wifi driver bring up realtek rtl8822bu bring upon imx8mp phytec phyboard pollux platform for Android 11.

phytec module name :phyboard pollux

Wifi driver module name to integrate and port to the android kernel :Realtek Wifi USB rtl8822bu module

I have followed the below steps for Porting the realdriver to android :

1) Downloaded and extracted the android release source code package and synced the repo

curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
$ export PATH=${PATH}:~/bin
$ source ~/imx-android-11.0.0_1.2.1/imx_android_setup.sh

2) Did a complete build of the android after repo syncing by the following steps :

export AARCH64_GCC_CROSS_COMPILE=/opt/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-
gnu/bin/aarch64-linux-gnu-

source build/envsetup.sh

lunch 72

./imx-make.sh -j16

3) Cloned the Realtek Wifi USB driver from the below git repo :

https://github.com/ulli-kroll/rtl8822bu

Cloned the folder in drivers/net/wireless/realtek and compiled successfully .

4)  Inserted the comfig CONFIG_RTL8822BU=M in the below file in the path :

device/nxp/imx8m/phyboard_pollux/android_addition_defconfig

5) Added the output .ko file path in the BoardConfig.mk file in the below path :

android_build/device/nxp/imx8m/phyboard_pollux/BoardConfig.mk

+ BOARD_WLAN_DEVICE := bcmdhd
+ WPA_SUPPLICANT_VERSION := VER_0_8_X
+ BOARD_WPA_SUPPLICANT_DRIVER := NL80211
+ BOARD_HOSTAPD_DRIVER := NL80211
+ BOARD_HOSTAPD_PRIVATE_LIB := lib_driver_cmd_bcmdhd
+ BOARD_WPA_SUPPLICANT_PRIVATE_LIB := lib_driver_cmd_bcmdhd
+ WIFI_DRIVER_FW_PATH_PARAM := "/sys/module/brcmfmac/parameters/alternative_fw_path"
+ BOARD_VENDOR_KERNEL_MODULES += \
+ $(KERNEL_OUT)/drivers/net/wireless/realtek/rtl8822bu/rtl8822bu.ko #added

6) Added the output .ko file path in the BoardConfig.mk file in the below path :

device/nxp/imx8m/phyboard_pollux/SharedBoardConfig.mk

+ $(KERNEL_OUT)/drivers/net/wireless/realtek/rtl8822bu/rtl8822bu.ko \ #added

7) Added the firmware in the below path and inserted the path of the firmware inserted in the phyboardpollux.mk file .THis line is inserted in the below file in the path :device/nxp/imx8m/phyboard_pollux/phyboard_pollux.mk

+device/nxp/imx8m/phyboard_pollux/lib/firmware/rtlwifi/rtl8822bufw.bin:$(TARGET_COPY_OUT_VENDOR)/firmware/rtlwifi/rtl8822bufw.bin #added

Compiled and generated rtl8822bu.ko and inserted(insmod) the module after flashing the android images.

9)After booting and connecting to HDMI ,I switched on Wifi and it turned back off automatically and captured the logs .There was a issue in the HAL layer while communicating from the java framework side.

WifiHAL path:hardware/broadcom/wlan/bcmdhd/

I am attaching the logs hereby:

09-19 12:48:57.053 358 358 E WifiHAL : Failed to register debug response; result = -95
09-19 12:48:57.053 358 358 E android.hardware.wifi@1.0-service: Failed to get driver version: UNKNOWN ERROR
09-19 12:48:57.053 358 358 I android.hardware.wifi@1.0-service: Configured chip in mode 0
09-19 12:48:57.053 358 358 W android.hardware.wifi@1.0-service: No active wlan interfaces in use! Using default
09-19 12:48:57.053 0 0 W RTW : rtw_ndev_notifier_call(wlan0) state:14
09-19 12:48:57.053 0 0 W RTW : _netdev_open(wlan0) , bup=1
09-19 12:48:57.053 0 0 W RTW : -871x_drv - drv_open, bup=1
09-19 12:48:57.054 0 0 W RTW : cfg80211_rtw_set_power_mgmt(wlan0) enabled:1, timeout:-1
09-19 12:48:57.054 0 0 W RTW : rtw_ndev_notifier_call(wlan0) state:1
09-19 12:48:57.054 546 699 D HalDevMgr: updateRttController: no one is interested in RTT controllers
09-19 12:48:57.054 358 358 I android.hardware.wifi@1.0-service: Adding interface handle for wlan0
09-19 12:48:57.054 358 358 E android.hardware.wifi@1.0-service: Failed to set DFS flag; DFS channels may be unavailable.
09-19 12:48:57.066 546 700 I WifiP2pNative: Registering for interface available listener
09-19 12:48:57.067 546 700 D WifiP2pNative: P2P InterfaceAvailableListener true
09-19 12:48:57.067 546 700 D WifiP2pService: Wifi enabled=false, P2P Interface availability=true
09-19 12:48:57.068 546 699 D WifiNl80211Manager: Setting up interface for client mode
09-19 12:48:57.070 469 469 I wificond: create scanner for interface with index: 8
09-19 12:48:57.070 469 469 I wificond: subscribe scan result for interface with index: 8
09-19 12:48:57.071 0 0 W RTW : cfg80211_rtw_get_txpower
09-19 12:48:57.073 546 699 I WifiNative: Interface state changed on Iface:{Name=wlan0,Id=10,Type=STA_SCAN}, isUp=true
09-19 12:48:57.073 546 699 I WifiNative: Successfully setup Iface:{Name=wlan0,Id=10,Type=STA_SCAN}
09-19 12:48:57.073 546 699 E SupplicantStaIfaceHal: Can't call getKeyMgmtCapabilities_1_3, ISupplicantStaIface is null
09-19 12:48:57.075 546 699 E WifiVendorHal: getSupportedFeatureSet(l.1263) failed {.code = ERROR_UNKNOWN, .description = unknown error}
09-19 12:48:57.077 546 699 E WifiVendorHal: getSupportedFeatureSet(l.1276) failed {.code = ERROR_UNKNOWN, .description = unknown error}
09-19 12:48:57.084 546 699 E SupplicantStaIfaceHal: Can't call getWpaDriverFeatureSet, ISupplicantStaIface is null
09-19 12:48:57.084 546 699 D WifiClientModeManager: entering StartedState
09-19 12:48:57.085 546 699 D WifiClientModeManager: entering ScanOnlyModeState
09-19 12:48:57.086 546 699 D WifiScanRequestProxy: Sending scan available broadcast: true
09-19 12:48:57.086 546 702 I WifiScanningService: Received a request to enable scanning, UID = 1000
09-19 12:48:57.086 546 699 I WifiScanRequestProxy: Scanning is enabled
09-19 12:48:57.086 546 699 I WifiScanRequestProxy: Scanning for hidden networks is disabled
09-19 12:48:57.087 546 699 D WakeupController: start()
09-19 12:48:57.087 546 699 I WakeupController: Ignore wakeup start since there are no good networks.
09-19 12:48:57.087 546 702 E WifiVendorHal: getBgScanCapabilities(l.674) failed {.code = ERROR_UNKNOWN, .description = unknown error}
09-19 12:48:57.089 546 546 D WifiP2pService: Wifi enabled=false, P2P Interface availability=true
09-19 12:48:57.089 546 699 I SupplicantStaIfaceHal: Starting supplicant using HIDL
09-19 12:48:57.091 242 242 I hwservicemanager: Since android.hardware.wifi.supplicant@1.0::ISupplicant/default is not registered, trying to start it as a lazy HAL.
09-19 12:48:57.092 546 699 D SupplicantStaIfaceHal: Successfully triggered start of supplicant using HIDL
09-19 12:48:57.096 0 0 I init : starting service 'wpa_supplicant'...
09-19 12:48:57.096 546 702 I WifiScanningService: Created a new impl for wlan0
09-19 12:48:57.096 546 702 I WifiScanningService: wifi driver loaded with scan capabilities: max buckets=16
09-19 12:48:57.097 0 0 I init : Created socket '/dev/socket/wpa_wlan0', mode 660, user 1010, group 1010
09-19 12:48:57.103 0 0 I init : Control message: Processed ctl.interface_start for 'android.hardware.wifi.supplicant@1.0::ISupplicant/default' from pid: 242 (/system/bin/hwservicemanager)
09-19 12:48:57.144 2107 2107 I wpa_supplicant: Processing hidl events on FD 3
09-19 12:48:57.147 2107 2107 I HidlServiceManagement: Registered android.hardware.wifi.supplicant@1.3::ISupplicant/default (start delay of 52ms)
09-19 12:48:57.147 2107 2107 I wpa_supplicant: Successfully initialized wpa_supplicant
09-19 12:48:57.147 2107 2107 E wpa_supplicant: Failed to open config file '/data/vendor/wifi/wpa/wpa_supplicant.conf', error: No such file or directory
09-19 12:48:57.147 2107 2107 E wpa_supplicant: Failed to read or parse configuration '/data/vendor/wifi/wpa/wpa_supplicant.conf'.
09-19 12:48:57.150 546 598 W HidlServiceManagement: getService: found dead hwbinder service for android.hardware.wifi.supplicant@1.0::ISupplicant/default.
09-19 12:48:57.151 546 598 E SupplicantStaIfaceHal: ISupplicant.getService exception: java.util.NoSuchElementException
09-19 12:48:57.151 546 598 E SupplicantStaIfaceHal: initalizing ISupplicant failed.
09-19 12:48:57.152 0 0 I binder : send failed reply for transaction 277220 to 546:598
09-19 12:48:57.153 0 0 I init : Service 'wpa_supplicant' (pid 2107) exited with status 255 oneshot service took 0.053000 seconds in background
09-19 12:48:57.153 0 0 I init : Sending signal 9 to service 'wpa_supplicant' (pid 2107) process group...
09-19 12:48:57.154 0 0 I libprocessgroup: Successfully killed process cgroup uid 0 pid 2107 in 0ms
09-19 12:48:57.237 546 827 I system_server: oneway function results will be dropped but finished with status OK and parcel size 4
09-19 12:48:57.237 382 482 W APM::AudioPolicyEngine: getDevicesForStrategy() unknown strategy: -1
09-19 12:48:58.414 0 0 D logd : logdr: UID=0 GID=0 PID=2110 b tail=0 logMask=99 pid=0 start=0ns timeout=0ns
09-19 12:48:59.074 0 0 W RTW : ==>rtw_ps_processor .fw_state(0)
09-19 12:48:59.299 0 0 W RTW : WARN _is_fw_read_cmd_down, reg_1cc(f), msg_box(0)...
09-19 12:48:59.299 0 0 W RTW : WARN fw read cmd failed...
09-19 12:49:00.003 761 761 D KeyguardClockSwitch: Updating clock: 1249
09-19 12:49:00.222 367 435 W audio_hw_primary: do_out_standby... 0xe7684210
09-19 12:49:00.224 546 827 I system_server: oneway function results will be dropped but finished with status OK and parcel size 4
09-19 12:49:01.092 546 806 E WifiThreadRunner: WifiThreadRunner.call() timed out!
09-19 12:49:01.092 546 806 E WifiThreadRunner: java.lang.Throwable: Stack trace:
09-19 12:49:01.092 546 806 E WifiThreadRunner: at com.android.server.wifi.WifiThreadRunner.call(WifiThreadRunner.java:80)
09-19 12:49:01.092 546 806 E WifiThreadRunner: at com.android.server.wifi.WifiServiceImpl.getScanResults(WifiServiceImpl.java:2733)
09-19 12:49:01.092 546 806 E WifiThreadRunner: at android.net.wifi.IWifiManager$Stub.onTransact(IWifiManager.java:730)
09-19 12:49:01.092 546 806 E WifiThreadRunner: at android.os.Binder.execTransactInternal(Binder.java:1154)
09-19 12:49:01.092 546 806 E WifiThreadRunner: at android.os.Binder.execTransact(Binder.java:1123)
09-19 12:49:01.090 0 0 W RTW : ==>rtw_ps_processor .fw_state(0)
09-19 12:49:01.317 0 0 W RTW : WARN _is_fw_read_cmd_down, reg_1cc(f), msg_box(0)...
09-19 12:49:01.317 0 0 W RTW : WARN fw read cmd failed...
09-19 12:49:02.102 546 699 E WifiNative: Failed to connect to supplicant
09-19 12:49:02.102 546 699 E WifiNative: Failed to start supplicant
09-19 12:49:02.104 358 358 I android.hardware.wifi@1.0-service: Adding interface handle for wlan0
09-19 12:49:02.104 358 358 W android.hardware.wifi@1.0-service: No active wlan interfaces in use! Using default
09-19 12:49:02.106 469 469 I wificond: Unsubscribe scan result for interface with index: 8
09-19 12:49:02.107 546 699 D WifiNl80211Manager: tearing down interfaces in wificond
09-19 12:49:02.107 546 576 I EthernetTracker: interfaceLinkStateChanged, iface: wlan0, up: false
09-19 12:49:02.108 0 0 W RTW : rtw_ndev_notifier_call(wlan0) state:10
09-19 12:49:02.108 0 0 W RTW : netdev_close(wlan0) , bup=1
09-19 12:49:02.108 0 0 W RTW : (2)871x_drv - drv_close, bup=1, hw_init_completed=_TRUE
09-19 12:49:02.108 0 0 W RTW : -871x_drv - drv_close, bup=1
09-19 12:49:02.108 0 0 W RTW : rtw_ndev_notifier_call(wlan0) state:2
09-19 12:49:02.109 0 0 W RTW : cfg80211_rtw_get_txpower
09-19 12:49:02.109 358 358 I WifiHAL : found interface wlan0
09-19 12:49:02.109 358 358 E WifiHAL : Calling hal cleanup
09-19 12:49:02.109 358 358 E WifiHAL : Cancel: Stop Hal
09-19 12:49:02.109 358 358 E WifiHAL : Failed to register set hal start response; result = -95
09-19 12:49:02.109 358 358 I WifiHAL : Failed to remove command 2: 0x0
09-19 12:49:02.109 358 2105 E WifiHAL : wifi_event_loop: Read after POLL returned 4, error no = 0 (Success)
09-19 12:49:02.109 358 2105 D WifiHAL : Got a signal to exit!!!
09-19 12:49:02.109 358 2105 I WifiHAL : Exit wifi_event_loop
09-19 12:49:02.109 358 358 E WifiHAL : wifi_cleanup: Read after POLL returned 4, error no = 0 (Success)
09-19 12:49:02.109 358 358 E WifiHAL : Event processing terminated
09-19 12:49:02.110 358 358 I WifiHAL : wifi nan internal clean up done
09-19 12:49:02.110 358 358 I WifiHAL : event_cb callbacks left: 0
09-19 12:49:02.110 358 358 I WifiHAL : Check bad commands: num_cmd:0 bad_commands:0
09-19 12:49:02.110 358 358 I WifiHAL : internal clean up
09-19 12:49:02.110 358 358 I WifiHAL : cmd_sock non null. clean up
09-19 12:49:02.110 358 358 I WifiHAL : cleanup_handler cb
09-19 12:49:02.110 358 358 I android.hardware.wifi@1.0-service: Legacy HAL stop complete callback received
09-19 12:49:02.110 358 358 I WifiHAL : Internal cleanup completed
09-19 12:49:02.110 358 358 E WifiHAL : wifi_clean_up done
09-19 12:49:02.111 358 358 I android.hardware.wifi@1.0-service: Wifi HAL stopped
09-19 12:49:02.112 546 699 I WifiVendorHal: Vendor Hal stopped
09-19 12:49:02.113 546 699 D WifiClientModeManager: STA iface wlan0 was destroyed, stopping client mode
09-19 12:49:02.113 546 699 E WifiClientModeImpl: Failed to setPowerSave, interfaceName is null
09-19 12:49:02.113 546 699 E SupplicantStaIfaceHal: Can't call setBtCoexistenceMode, ISupplicantStaIface is null
09-19 12:49:02.114 546 699 V WifiClientModeImpl: stopIpClient IpClientWithPreConnection: false
09-19 12:49:02.114 546 699 V WifiClientModeImpl: java.lang.Throwable
09-19 12:49:02.114 546 699 V WifiClientModeImpl: at com.android.server.wifi.ClientModeImpl.stopIpClient(ClientModeImpl.java:1068)
09-19 12:49:02.114 546 699 V WifiClientModeImpl: at com.android.server.wifi.ClientModeImpl.stopDhcpSetup(ClientModeImpl.java:1083)
09-19 12:49:02.114 546 699 V WifiClientModeImpl: at com.android.server.wifi.ClientModeImpl.handleNetworkDisconnect(ClientModeImpl.java:2760)
09-19 12:49:02.114 546 699 V WifiClientModeImpl: at com.android.server.wifi.ClientModeImpl.handleIfaceDestroyed(ClientModeImpl.java:1568)
09-19 12:49:02.114 546 699 V WifiClientModeImpl: at com.android.server.wifi.ClientModeManager$ClientModeStateMachine$1.onDestroyed(ClientModeManager.java:423)
09-19 12:49:02.114 546 699 V WifiClientModeImpl: at com.android.server.wifi.WifiNative.onInterfaceDestroyed(WifiNative.java:578)
09-19 12:49:02.114 546 699 V WifiClientModeImpl: at com.android.server.wifi.WifiNative.access$1200(WifiNative.java:77)
09-19 12:49:02.114 546 699 V WifiClientModeImpl: at com.android.server.wifi.WifiNative$InterfaceDestoyedListenerInternal.onDestroyed(WifiNative.java:605)
09-19 12:49:02.114 546 699 V WifiClientModeImpl: at com.android.server.wifi.WifiVendorHal$StaInterfaceDestroyedListenerInternal.onDestroyed(WifiVendorHal.java:429)
09-19 12:49:02.114 546 699 V WifiClientModeImpl: at com.android.server.wifi.HalDeviceManager$InterfaceDestroyedListenerProxy.action(HalDeviceManager.java:2165)
09-19 12:49:02.114 546 699 V WifiClientModeImpl: at com.android.server.wifi.HalDeviceManager$ListenerProxy.trigger(HalDeviceManager.java:2130)
09-19 12:49:02.114 546 699 V WifiClientModeImpl: at com.android.server.wifi.HalDeviceManager.dispatchDestroyedListeners(HalDeviceManager.java:2081)
09-19 12:49:02.114 546 699 V WifiClientModeImpl: at com.android.server.wifi.HalDeviceManager.removeIfaceInternal(HalDeviceManager.java:2000)
09-19 12:49:02.114 546 699 V WifiClientModeImpl: at com.android.server.wifi.HalDeviceManager.removeIface(HalDeviceManager.java:265)
09-19 12:49:02.114 546 699 V WifiClientModeImpl: at com.android.server.wifi.WifiVendorHal.removeStaIface(WifiVendorHal.java:478)
09-19 12:49:02.114 546 699 V WifiClientModeImpl: at com.android.server.wifi.WifiNative.removeStaIface(WifiNative.java:865)
09-19 12:49:02.114 546 699 V WifiClientModeImpl: at com.android.server.wifi.WifiNative.teardownInterface(WifiNative.java:1309)
09-19 12:49:02.114 546 699 V WifiClientModeImpl: at com.android.server.wifi.WifiNative.switchClientInterfaceToConnectivityMode(WifiNative.java:1249)
09-19 12:49:02.114 546 699 V WifiClientModeImpl: at com.android.server.wifi.ClientModeManager$ClientModeStateMachine$StartedState.processMessage(ClientModeManager.java:520)
09-19 12:49:02.114 546 699 V WifiClientModeImpl: at com.android.wifi.x.com.android.internal.util.StateMachine$SmHandler.processMsg(StateMachine.java:992)
09-19 12:49:02.114 546 699 V WifiClientModeImpl: at com.android.wifi.x.com.android.internal.util.StateMachine$SmHandler.handleMessage(StateMachine.java:809)
09-19 12:49:02.114 546 699 V WifiClientModeImpl: at android.os.Handler.dispatchMessage(Handler.java:106)
09-19 12:49:02.114 546 699 V WifiClientModeImpl: at android.os.Looper.loop(Looper.java:223)
09-19 12:49:02.114 546 699 V WifiClientModeImpl: at android.os.HandlerThread.run(HandlerThread.java:67)
09-19 12:49:02.115 546 699 I WifiNative: Successfully torn down Iface:{Name=wlan0,Id=10,Type=STA_SCAN}
09-19 12:49:02.115 546 699 E HalDevMgr: getAllChipInfo: called but mWifi is null!?
09-19 12:49:02.115 546 699 E HalDevMgr: dispatchAvailableForRequestListeners: no chip info found
09-19 12:49:02.115 546 699 W HalDevMgr: stopWifi called but mWifi is null!?
09-19 12:49:02.115 546 700 W HalDevMgr: isWifiStarted called but mWifi is null!?
09-19 12:49:02.115 546 699 I WifiNative: Successfully initiated teardown for iface=wlan0
09-19 12:49:02.117 546 699 D WifiScanRequestProxy: Sending scan available broadcast: false
09-19 12:49:02.117 546 546 D WifiP2pService: Wifi enabled=false, P2P Interface availability=true
09-19 12:49:02.118 546 702 I WifiScanningService: Received a request to disable scanning, UID = 1000
09-19 12:49:02.118 546 702 E WifiNl80211Manager: No valid wificond scanner interface handler
09-19 12:49:02.118 546 702 I WifiScanningService: Removed an impl for wlan0
09-19 12:49:02.119 546 699 I WifiScanRequestProxy: Scanning is disabled
09-19 12:49:02.119 546 702 I WifiScanningService: wifi driver unloaded
09-19 12:49:02.120 546 699 W HalDevMgr: isWifiStarted called but mWifi is null!?
09-19 12:49:02.121 546 699 W HalDevMgr: isWifiStarted called but mWifi is null!?
09-19 12:49:02.121 546 699 E WifiNative: Could not get Iface object for interface null?

 

I am attaching the log file hereby for the same.Please guide for the same.

 

Thanks and Regards

Anusha

0 项奖励
回复
3 回复数

3,131 次查看
kunyichen
Contributor IV

I Belive the issues need contact module vendor to provide porting guide, due to android need HAL porting

0 项奖励
回复

3,323 次查看
Chavira
NXP TechSupport
NXP TechSupport

Hi @anushag !

Thank you for contacting NXP Support!

Sorry, our Android source code is for our EVK boards and only works for our Wifi-Modules, and other modules are not implemented.

Please try to use the Phytec source code:

https://www.phytec.eu/en/bsp-download/?bsp=BSP-Android-NXP-i.MX8MP-ALPHA1


If the problem persists try to contact Phytec support.

Best Regards!

Chavira

0 项奖励
回复

3,137 次查看
Swaranjali
Contributor I

I'm facing same issue for imx8qxp with realtek rtl8192EU driver

0 项奖励
回复