您尚未登录。

楼主 #1 2020-08-10 19:54:24

sy373466062
会员
注册时间: 2018-11-12
已发帖子: 130
积分: 116

AP6212无法使用的问题请教

使用imx6ull + AP6212, 启动的时候可以看到mmc1相关说明:

[    2.944015] mmc1: SDHCI controller on 2194000.usdhc [2194000.usdhc] using ADMA
[    2.961923] imx6ul-pinctrl 2290000.iomuxc-snvs: failed to get pin(26) name
[    2.969139] pinconfig core: failed to register map default (1): no group/pin given
[    2.976996] leds-gpio: probe of leds@0 failed with error -22
[    2.987258] ledtrig-cpu: registered to indicate activity on CPUs
[    3.001583] mmc1: queuing unknown CIS tuple 0x80 (2 bytes)
[    3.010644] usbcore: registered new interface driver usbhid
[    3.016642] usbhid: USB HID core driver
[    3.020616] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
[    3.028065] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
[    3.047443] mmc1: queuing unknown CIS tuple 0x80 (7 bytes)
[    3.066963] NET: Registered protocol family 26
[    3.072784] mmc1: queuing unknown CIS tuple 0x81 (9 bytes)

[    3.318863] mmc1: new high speed SDIO card at address 0001
[    3.357009] brcmfmac mmc1:0001:1: Falling back to user helper

自动inmod module后,出现下面的错误:

[    7.864343] brcmfmac: brcmf_sdio_htclk: HT Avail timeout (1000000): clkctl 0x50
[    8.934454] brcmfmac: brcmf_sdio_htclk: HT Avail timeout (1000000): clkctl 0x50

固件也是有的,使用的是github armbain(buildroot)中的文件,下面是/lib/firmware/bcmd的文件:

bcm43438a0.hcd           fw_bcm43438a0.bin        fw_bcm43438a0_apsta.bin  fw_bcm43438a1.bin        fw_bcm43438a1_apsta.bin  nvram.txt                nvram_ap6212a.txt

其中nvram_ap6212a.txt文件内容如下:

#AP6212_NVRAM_V1.0_20140603
# 2.4 GHz, 20 MHz BW mode

# The following parameter values are just placeholders, need to be updated.
manfid=0x2d0
prodid=0x0726
vendid=0x14e4
devid=0x43e2
boardtype=0x0726
boardrev=0x1101
boardnum=22
macaddr=00:90:4c:c5:12:38
sromrev=11
boardflags=0x00404201
xtalfreq=26000
nocrc=1
ag0=255
aa2g=1
ccode=ALL

pa0itssit=0x20
extpagain2g=0

#PA parameters for 2.4GHz, measured at CHIP OUTPUT
pa2ga0=-168,7161,-820
AvVmid_c0=0x0,0xc8
cckpwroffset0=5

# PPR params
maxp2ga0=90
txpwrbckof=6
cckbw202gpo=0x5555
legofdmbw202gpo=0x77777777
mcsbw202gpo=0xaaaaaaaa

# OFDM IIR :
ofdmdigfilttype=7
# PAPD mode:
papdmode=2

il0macaddr=00:90:4c:c5:12:38
wl0id=0x431b

#OOB parameters
hostwake=0x40
hostrdy=0x41
usbrdy=0x03
usbrdydelay=100
deadman_to=0xffffffff
# muxenab: 0x1 for UART enable, 0x10 for Host awake
muxenab=0x10
# CLDO PWM voltage settings - 0x4 - 1.1 volt
#cldo_pwm=0x4

dts相关代码如下:

	reg_brcm: regulator-brcm {
		compatible = "regulator-fixed";
		enable-active-high;
		gpio = <&gpio4 28 GPIO_ACTIVE_HIGH>;
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_brcm_reg>;
		regulator-name = "brcm_reg";
		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;
		startup-delay-us = <200000>;
	};



		pinctrl_usdhc2_alt: usdhc2grp_alt {
			fsl,pins = <
				MX6UL_PAD_LCD_DATA18__USDHC2_CMD    0x17051
                //Ref imx6ul-pico-hobbit.dts
				//MX6UL_PAD_LCD_DATA19__USDHC2_CLK    0x10059
				MX6UL_PAD_LCD_DATA19__USDHC2_CLK    0x17051
				MX6UL_PAD_LCD_DATA20__USDHC2_DATA0  0x17051
				MX6UL_PAD_LCD_DATA21__USDHC2_DATA1  0x17051
				MX6UL_PAD_LCD_DATA22__USDHC2_DATA2  0x17051
				MX6UL_PAD_LCD_DATA23__USDHC2_DATA3  0x17051
			>;
		};

		pinctrl_wifi: wifigrp {
                fsl,pins = <
        			MX6UL_PAD_CSI_DATA07__GPIO4_IO28     0x03029    /*wifi power*/

                >;
        };


&usdhc2 {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_usdhc2_alt>; //ToDo: Pullup check !
	non-removable;
    bus-width = <4>;
	//cd-post;
    //no-1-8-v;
    wifi-host;
    //pm-ignore-notify;
    keep-power-in-suspend;
    //enable-sdio-wakeup;
    wakeup-source;
    status= "okay";
  
    vmmc-supply = <&reg_brcm>;

    brcmf: wifi@1 {
        //reg = <1>;
        compatible = "brcm,bcm4329-fmac";
        //interrupt-parent = <&pio>;
        //interrupts = < IRQ_TYPE_LEVEL_LOW>;

        //Gpio4-14
        interrupt-parent = <&gpio4>;
        //            io14   triggerFlag(include/linux/irq.h)
        interrupts = <14 IRQ_TYPE_EDGE_FALLING>;
        interrupt-name = "host-wake";
    };

};

内核中配置如下:

# CONFIG_B43LEGACY_PIO_MODE is not set
CONFIG_BRCMUTIL=m
CONFIG_BRCMSMAC=m
CONFIG_BRCMFMAC=m
CONFIG_BRCMFMAC_PROTO_BCDC=y
CONFIG_BRCMFMAC_SDIO=y
# CONFIG_BRCMFMAC_USB is not set
CONFIG_BRCM_TRACING=y
CONFIG_BRCMDBG=y
CONFIG_BCMDHD=m
CONFIG_BCMDHD_SDIO=m
CONFIG_BCM4339=m
CONFIG_BCM43340=m
CONFIG_BCM4354=m
CONFIG_BCMDHD_FW_PATH="/lib/firmware/bcmd/fw_bcm43438a1_apsta.bin"
CONFIG_BCMDHD_NVRAM_PATH="/lib/firmware/bcmd/nvram_ap6212a.txt"
# CONFIG_DHD_USE_STATIC_BUF is not set
# CONFIG_DHD_USE_SCHED_SCAN is not set
CONFIG_BCMDHD_1363=m
CONFIG_BCM4359=y

然后内核是4.9.88添加了ap6212 不同版本的patch:

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
index d46f086..2a47aa0 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
@@ -14,6 +14,7 @@
  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */

+//#define DEBUG 1
 #include <linux/types.h>
 #include <linux/atomic.h>
 #include <linux/kernel.h>
@@ -607,7 +608,9 @@ BRCMF_FW_NVRAM_DEF(43340, "brcmfmac43340-sdio.bin", "brcmfmac43340-sdio.txt");
 BRCMF_FW_NVRAM_DEF(4335, "brcmfmac4335-sdio.bin", "brcmfmac4335-sdio.txt");
 BRCMF_FW_NVRAM_DEF(43362, "brcmfmac43362-sdio.bin", "brcmfmac43362-sdio.txt");
 BRCMF_FW_NVRAM_DEF(4339, "brcmfmac4339-sdio.bin", "brcmfmac4339-sdio.txt");
-BRCMF_FW_NVRAM_DEF(43430, "brcmfmac43430-sdio.bin", "brcmfmac43430-sdio.txt");
+//BRCMF_FW_NVRAM_DEF(43430, "brcmfmac43430-sdio.bin", "brcmfmac43430-sdio.txt");
+BRCMF_FW_NVRAM_DEF(43430A0, "brcmfmac43430a0-sdio.bin", "brcmfmac43430a0-sdio.txt");
+BRCMF_FW_NVRAM_DEF(43430A1, "brcmfmac43430-sdio.bin", "brcmfmac43430-sdio.txt");
 BRCMF_FW_NVRAM_DEF(43455, "brcmfmac43455-sdio.bin", "brcmfmac43455-sdio.txt");
 BRCMF_FW_NVRAM_DEF(4354, "brcmfmac4354-sdio.bin", "brcmfmac4354-sdio.txt");
 BRCMF_FW_NVRAM_DEF(4356, "brcmfmac4356-sdio.bin", "brcmfmac4356-sdio.txt");
@@ -624,7 +627,9 @@ static struct brcmf_firmware_mapping brcmf_sdio_fwnames[] = {
        BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4335_CHIP_ID, 0xFFFFFFFF, 4335),
        BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43362_CHIP_ID, 0xFFFFFFFE, 43362),
        BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4339_CHIP_ID, 0xFFFFFFFF, 4339),
-       BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43430_CHIP_ID, 0xFFFFFFFF, 43430),
+       //BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43430_CHIP_ID, 0xFFFFFFFF, 43430),
+       BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43430_CHIP_ID, 0x00000001, 43430A0),
+       BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43430_CHIP_ID, 0xFFFFFFFF, 43430A1),
        BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4345_CHIP_ID, 0xFFFFFFC0, 43455),
        BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4354_CHIP_ID, 0xFFFFFFFF, 4354),
        BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4356_CHIP_ID, 0xFFFFFFFF, 4356)

启动后加载的module:
root@ccimx6ulsbc:~# lsmod
Module                  Size  Used by    Not tainted
bcmdhd                700504  0


原理图如下:
AP6212.png


大伙可以帮忙看看这个是啥原因,为何出现前面的“ HT Avail timeout (1000000): clkctl 0x50” ? 该如何解决或者调查呢? 谢谢各位。

最近编辑记录 sy373466062 (2020-08-10 19:54:52)

离线

#2 2020-08-10 20:05:20

路人甲
会员
注册时间: 2017-09-07
已发帖子: 202
积分: 199.5

Re: AP6212无法使用的问题请教

这种sdio读写tf卡正常吗?

离线

#3 2020-08-10 22:11:20

春风吹又生
会员
注册时间: 2020-02-25
已发帖子: 61
积分: 60

Re: AP6212无法使用的问题请教

把时钟降低到 5Mhz左右, 接逻辑分析仪, 看是不是每根信号线时序都是正常的.

离线

#4 2020-08-14 11:25:22

stackoverF
会员
注册时间: 2020-04-20
已发帖子: 20
积分: 20

Re: AP6212无法使用的问题请教

你的LPO管脚是否提供了32.768Khz的时钟?这个非常重要

离线

楼主 #5 2020-08-16 21:45:33

sy373466062
会员
注册时间: 2018-11-12
已发帖子: 130
积分: 116

Re: AP6212无法使用的问题请教

stackoverF 说:

你的LPO管脚是否提供了32.768Khz的时钟?这个非常重要

LPO这个接地了,使用的是内部32K clk

离线

#6 2020-09-08 13:59:27

stackoverF
会员
注册时间: 2020-04-20
已发帖子: 20
积分: 20

Re: AP6212无法使用的问题请教

你需要外接32K有源信号,内部的不OK

sy373466062 说:
stackoverF 说:

你的LPO管脚是否提供了32.768Khz的时钟?这个非常重要

LPO这个接地了,使用的是内部32K clk

离线

楼主 #7 2020-09-20 15:21:53

sy373466062
会员
注册时间: 2018-11-12
已发帖子: 130
积分: 116

Re: AP6212无法使用的问题请教

请教一下,使用imx6ull自己生的PMW生成32K的波,应该也是可以的吧?
现在使用PWM用逻辑分析仪可以看到32K的方波(50%占空比)输入给AP6212,但是还是不行

还尝试了使用Arduino生成32K的CLK(PWM,50%占空比)也不行。这可能是啥原因呢?

出现的log还是前面的那个Timeout



stackoverF 说:

你需要外接32K有源信号,内部的不OK

sy373466062 说:

LPO这个接地了,使用的是内部32K clk

离线

#8 2020-10-25 08:26:10

我思故我在
会员
注册时间: 2019-09-03
已发帖子: 244
积分: 243.5

Re: AP6212无法使用的问题请教

&i2c0 {
	status = "okay";

	hym8563: hym8563@51 {
		compatible = "haoyu,hym8563";
		reg = <0x51>;
		#clock-cells = <0>;
		clock-frequency = <32768>;
		clock-output-names = "xin32k";
	};
};

	sdio_pwrseq: sdio-pwrseq {
		compatible = "mmc-pwrseq-simple";
		clocks = <&hym8563>;
		/* clock-names = "ext_clock"; */
		pinctrl-names = "default";
		pinctrl-0 = <&wifi_enable_h>;

		/*
		 * On the module itself this is one of these (depending
		 * on the actual card populated):
		 * - SDIO_RESET_L_WL_REG_ON
		 * - PDN (power down when low)
		 */
		reset-gpios = <&gpio2 26 GPIO_ACTIVE_LOW>; /* GPIO2_D2 */
	};

	wireless-bluetooth {
		compatible = "bluetooth-platdata";
		clocks = <&hym8563>;
		clock-names = "ext_clock";
		uart_rts_gpios = <&gpio3 6 GPIO_ACTIVE_LOW>;
		pinctrl-names = "default", "rts_gpio";
		pinctrl-0 = <&uart11_rts>;
		pinctrl-1 = <&uart11_rts_gpio>;
		BT,power_gpio = <&gpio2 29 GPIO_ACTIVE_HIGH>;
		BT,wake_host_irq = <&gpio3 26 GPIO_ACTIVE_HIGH>;
		status = "okay";
	};

这个好像是用外部rtc芯片给wifi提供32k?

离线

#9 2021-05-12 11:11:05

devinzhang91
会员
注册时间: 2020-06-16
已发帖子: 7
积分: 5

Re: AP6212无法使用的问题请教

楼主,我也是一样的问题,不过是H3 + AP6212的平台,请问你的问题解决了吗?

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn