linux icon indicating copy to clipboard operation
linux copied to clipboard

ARM: tegra: Add WiFi/BT support for ASUS TF701T

Open jenneron opened this issue 4 years ago • 0 comments

It currently does not work. I'm opening it to document what i discovered about WiFi/BT on this device.

Downstream board file: https://github.com/LineageOS/android_kernel_asus_tf701t/blob/V11.4.1.17/arch/arm/mach-tegra/board-macallan-sdhci.c

I added this patch to downstream kernel to follow its power sequence

patch
diff --git a/arch/arm/mach-tegra/board-macallan-pinmux.c b/arch/arm/mach-tegra/board-macallan-pinmux.c
index ba3fccc8..d5327561 100644
--- a/arch/arm/mach-tegra/board-macallan-pinmux.c
+++ b/arch/arm/mach-tegra/board-macallan-pinmux.c
@@ -66,6 +66,8 @@ static void __init macallan_gpio_init_configure(void)
 	struct gpio_init_pin_info *pins_info;
 	hw_rev revision = asustek_get_hw_rev();
 
+	pr_info("WIFI_INFO - add init_gpio_mode_macallan_common to pins_info - board-macallan-pinmux.c");
+	pr_info("WIFI_INFO - it means hog CC5 to false 0, X7 to false 0, U5 to true 0, U1 to true 0");
 	len = ARRAY_SIZE(init_gpio_mode_macallan_common);
 	pins_info = init_gpio_mode_macallan_common;
 
diff --git a/arch/arm/mach-tegra/board-macallan-sdhci.c b/arch/arm/mach-tegra/board-macallan-sdhci.c
index 1ad0a192..0fb527cb 100755
--- a/arch/arm/mach-tegra/board-macallan-sdhci.c
+++ b/arch/arm/mach-tegra/board-macallan-sdhci.c
@@ -267,13 +267,17 @@ static int macallan_wifi_power(int on)
 	pr_debug("%s: %d\n", __func__, on);
 
 	if (on) {
+		pr_info("WIFI_INFO - set X7 to 1 - macallan_wifi_power - board-macallan-sdhci.c");
 		gpio_set_value(MACALLAN_WLAN_RST, 1);
 		mdelay(100);
+		pr_info("WIFI_INFO - set CC5 to 1 - macallan_wifi_power - board-macallan-sdhci.c");
 		gpio_set_value(MACALLAN_WLAN_PWR, 1);
 		mdelay(200);
 	} else {
+		pr_info("WIFI_INFO - set X7 to 0 - macallan_wifi_power - board-macallan-sdhci.c");
 		gpio_set_value(MACALLAN_WLAN_RST, 0);
 		mdelay(100);
+		pr_info("WIFI_INFO - set CC5 to 0 - macallan_wifi_power - board-macallan-sdhci.c");
 		gpio_set_value(MACALLAN_WLAN_PWR, 0);
 	}
 
@@ -312,11 +316,14 @@ static int __init macallan_wifi_init(void)
 	if (rc)
 		pr_err("WLAN_WOW gpio direction configuration failed:%d\n", rc);
 
+	pr_info("WIFI_INFO - set U5 as interrupt - macallan_wifi_init - board-macallan-sdhci.c");
 	wifi_resource[0].start = wifi_resource[0].end =
 		gpio_to_irq(MACALLAN_WLAN_WOW);
 
+	pr_info("WIFI_INFO - set U1 to 1 - macallan_wifi_init - board-macallan-sdhci.c");
 	gpio_set_value(MACALLAN_EN_3V3_COM, 1);
 
+	pr_info("WIFI_INFO - register &macallan_wifi_device - macallan_wifi_init - board-macallan-sdhci.c");
 	platform_device_register(&macallan_wifi_device);
 	return 0;
 }

Using this patch i got:

downstream dmesg
[    0.068823] WIFI_INFO - add init_gpio_mode_macallan_common to pins_info - board-macallan-pinmux.c
[    0.068839] WIFI_INFO - it means hog CC5 to false 0, X7 to false 0, U5 to true 0, U1 to true 0
[    0.074582] WIFI_INFO - set U5 as interrupt - macallan_wifi_init - board-macallan-sdhci.c
[    0.074597] WIFI_INFO - set U1 to 1 - macallan_wifi_init - board-macallan-sdhci.c
[    0.074612] WIFI_INFO - register &macallan_wifi_device - macallan_wifi_init - board-macallan-sdhci.c
[    1.388853] WIFI_INFO - set X7 to 1 - macallan_wifi_power - board-macallan-sdhci.c
[    1.489144] WIFI_INFO - set CC5 to 1 - macallan_wifi_power - board-macallan-sdhci.c
[    8.732376] WIFI_INFO - set X7 to 1 - macallan_wifi_power - board-macallan-sdhci.c
[    8.840481] WIFI_INFO - set CC5 to 1 - macallan_wifi_power - board-macallan-sdhci.c
[DHD43XX] wifi_set_carddetect = 1
[    9.361727] WIFI_INFO - set X7 to 0 - macallan_wifi_power - board-macallan-sdhci.c
[    9.469298] WIFI_INFO - set CC5 to 0 - macallan_wifi_power - board-macallan-sdhci.c
[DHD43XX] =========== WLAN placed in RESET ========
[   26.586600] WIFI_INFO - set X7 to 1 - macallan_wifi_power - board-macallan-sdhci.c
[   26.958847] WIFI_INFO - set CC5 to 1 - macallan_wifi_power - board-macallan-sdhci.c
[DHD43XX] =========== WLAN going back to live  ========
[   28.483572] WIFI_INFO - set X7 to 0 - macallan_wifi_power - board-macallan-sdhci.c
[   28.927967] WIFI_INFO - set CC5 to 0 - macallan_wifi_power - board-macallan-sdhci.c
[DHD43XX] =========== WLAN placed in RESET ========
[   29.065202] WIFI_INFO - set X7 to 1 - macallan_wifi_power - board-macallan-sdhci.c
[   29.367630] WIFI_INFO - set CC5 to 1 - macallan_wifi_power - board-macallan-sdhci.c

Applied my changes to mainline:

result

brcmfmac hangs while/after loading firmware

asus-tf701t:~$ dmesg | grep brcmfmac
[   14.737190] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43340-sdio for chip BCM43341/2
[   14.761201] brcmfmac mmc2:0001:1: Direct firmware load for brcm/brcmfmac43340-sdio.asus,tf701t.bin failed with error -2
asus-tf701t:~$ dmesg | grep Bluetooth
[   14.067151] Bluetooth: Core ver 2.22
[   14.067354] Bluetooth: HCI device and connection manager initialized
[   14.067401] Bluetooth: HCI socket layer initialized
[   14.067420] Bluetooth: L2CAP socket layer initialized
[   14.067467] Bluetooth: SCO socket layer initialized
[   14.345996] Bluetooth: HCI UART driver ver 2.3
[   14.346020] Bluetooth: HCI UART protocol H4 registered
[   14.349020] Bluetooth: HCI UART protocol Broadcom registered
[   16.646536] Bluetooth: hci0: command 0xfc45 tx timeout
[   24.806409] Bluetooth: hci0: BCM: failed to write clock (-110)
[   24.806432] Bluetooth: hci0: Failed to set baudrate
[   26.956459] Bluetooth: hci0: command 0x1001 tx timeout
[   35.036777] Bluetooth: hci0: BCM: Reading local version info failed (-110)

jenneron avatar Oct 26 '21 00:10 jenneron