huawei MW269V2 是wifi+bt+fm三合一模块,wifi采用broadcom BCM4330,
SDIO接口。
s5pv210上面的android4.0.3 bsp,内核版本为3.0.8.
将开发板通过usb口上电,然后通过转接板插入tf卡接口,打印信息如下:
mmc_attach_sdio ENTER
mmc_attach_sdio mmc_attach_bus
mmc2: card claims to support voltages below the defined range. These will be ignored.
mmc2: error -84 whilst initialising SDIO card
mmc_rescan_try_freq not sdio!
mmc2: Timeout waiting for hardware interrupt.
查询头文件得到
#define EILSEQ 84 /* Illegal byte sequence */
对drivers/mmc/目录跟踪,
mmc_attach_sdio mmc_attach_bus
mmc_sdio_init_card ENTER >>
mmc_sdio_init_card ENTER
mmc_sdio_init_card mmc_host_is_spi
mmc_sdio_init_card mmc_alloc_card
mmc_sdio_init_card MMC_TYPE_SDIO
mmc_sdio_init_card init_card
mmc_sdio_init_card mmc_set_bus_mode
mmc_sdio_init_card mmc_send_relative_addr return 0
mmc_sdio_init_card mmc_sd_get_csd
mmc_sdio_init_card mmc_select_card
mmc_sdio_init_card set parameters
mmc_sdio_init_card sdio_read_cccr
mmc_sdio_init_card sdio_read_common_cis
mmc_sdio_init_card sdio_disable_cd
mmc_sdio_init_card sdio_enable_hs
mmc_sdio_init_card sdio_enable_4bit_bus
mmc2: error -84 whilst initialising SDIO card
mmc_rescan_try_freq not sdio!
而如果是烧写的android2.3.7的内核版本2.6.35.7,则很顺利识别到:
mmc2: new high speed SDIO card at address 0001
在找不到其他方法的情况下,决定将2.6.35.7的mmc堆栈移植到3.0.8.
将3.0.8中 drivers/mmc include/linux/mmc 删除,从2.6.35.7拷贝相应的
目录。然后需要改动的地方主要有arch/arm/mach-s5pv210和arch/arm/plat-samsung中一些文件。
其中arch/arm/mach-s5pv210/setup-sdhci.c 和 arch/arm/mach-s5pv210/setup-sdhci-gpio.c 如果完全采用2.6.35.7的,则可以正常的识别到sdio card。如果使用3.0.8
部分,则出现-84的错误。
经过排除,发现问题出在
void s5pv210_setup_sdhci2_cfg_gpio(struct platform_device *dev, int width)
使用2.6.35.7的代码:
void s5pv210_setup_sdhci2_cfg_gpio(struct platform_device *dev, int width)
{
unsigned int gpio;
switch (width) {
/* Channel 2 supports 4 and 8-bit bus width */
case 8:
/* Set all the necessary GPIO function and pull up/down */
for (gpio = S5PV210_GPG3(3); gpio <= S5PV210_GPG3(6); gpio++) {
s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3));
s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
s3c_gpio_set_drvstrength(gpio, S3C_GPIO_DRVSTR_2X);
}
case 0:
case 1:
case 4:
/* Set all the necessary GPIO function and pull up/down */
for (gpio = S5PV210_GPG2(0); gpio <= S5PV210_GPG2(6); gpio++) {
if (gpio != S5PV210_GPG2(2)) {
s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
}
s3c_gpio_set_drvstrength(gpio, S3C_GPIO_DRVSTR_2X);
}
break;
default:
printk(KERN_ERR "Wrong SD/MMC bus width : %d\n", width);
}
}
则可以正常识别。
使用3.0.8的代码:
void s5pv210_setup_sdhci2_cfg_gpio(struct platform_device *dev, int width)
{
struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
/* Set all the necessary GPG2[0:1] pins to special-function 2 */
s3c_gpio_cfgrange_nopull(S5PV210_GPG2(0), 2, S3C_GPIO_SFN(2));
switch (width) {
case 8:
/* Data pin GPG3[3:6] to special-function 3 */
s3c_gpio_cfgrange_nopull(S5PV210_GPG3(3), 4, S3C_GPIO_SFN(3));
case 4:
/* Data pin GPG2[3:6] to special-function 2 */
s3c_gpio_cfgrange_nopull(S5PV210_GPG2(3), 4, S3C_GPIO_SFN(2));
default:
break;
}
s3c_gpio_setpull(S5PV210_GPG2(2), S3C_GPIO_PULL_UP);
s3c_gpio_cfgpin(S5PV210_GPG2(2), S3C_GPIO_SFN(2));
}
则识别出错-84。
经过测试,是一定要设置强度:
s3c_gpio_set_drvstrength(S5PV210_GPG2(3), S3C_GPIO_DRVSTR_2X);
还要增加1bit的情况:
case 1:
s3c_gpio_cfgrange_nopull(S5PV210_GPG2(3), 1, S3C_GPIO_SFN(2));
s3c_gpio_set_drvstrength(S5PV210_GPG2(3), S3C_GPIO_DRVSTR_2X);
for (gpio = S5PV210_GPG2(0); gpio <= S5PV210_GPG2(1); gpio++) {
if (gpio != S5PV210_GPG2(2)) {
s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
}
s3c_gpio_set_drvstrength(gpio, S3C_GPIO_DRVSTR_2X);
}
另外,需要增加对s3c_gpio_set_drvstrength()函数的支持。
arch/arm/mach-s5pv210/include/mach/irqs.h
#define S5P_IRQ_GPIOINT(x) (S5P_GPIOINT_BASE + (x))
arch/arm/plat-samsung/include/plat/gpio-core.h
struct s3c_gpio_chip {
+
int eint_offset;
};
从2.6.35.7拷贝 arch/arm/mach-s5pv210/gpiolib.c到3.0.8中
修改 arch/arm/mach-s5pv210/Makefile
- obj-$(CONFIG_CPU_S5PV210)
+= cpu.o init.o clock.o dma.o
+ obj-$(CONFIG_CPU_S5PV210)
+= cpu.o init.o clock.o dma.o gpiolib.o
可以正常识别sdio设备后,"insmod /system/etc/bcm4330.ko", 不能load firmware,
也不能生成socket设备wlan0,而移植2.6.35.7版本的mmc是可以生成wlan0的,
从github上同步samsung-kernel-aries下来,
jeff@translogic:samsung-kernel-aries$ git branch -a
android-samsung-2.6.35
* android-samsung-3.0-ics
remotes/origin/HEAD -> origin/android-samsung-3.0-ics
remotes/origin/android-samsung-2.6.35
remotes/origin/android-samsung-3.0-ics
remotes/origin/bluetooth
remotes/origin/dock_audio
remotes/origin/docking
remotes/origin/ics
remotes/origin/newfmradio
remotes/origin/samsung-merge
remotes/origin/sound
将其中 drivers/mmc include/linux/mmc 部分更新过来,测试可以生成wlan0。