MTK 65XX系列通过USB OTG添加Ethernet RJ45有线网卡支持

最近客户要求使用MTk 6572芯片通过USB OTG添加支持有线网卡,我查遍了钩钩了所有网站,都没有相关论述,查看了MTK给的资料,包括FAQ,只说支持USB OTG键盘鼠标和U盘。怎么办?只有我自己来。
但是,按照我对于USB设备机构的理解,只要我们挂在了USB Ethernet的驱动,那么在USB Ethernet插入的时候,应该可以自动匹配到其设备驱动,所以只要我们挂在了USB Ethernet的驱动,那么就应该可以正常工作。
首先,就是回顾如果是非MTK平台,我们如何添加Ethernet的支持,当然通过Make Menuconfig加入驱动了。MTK自己定义的方法,实在没有时间去研究其如何配置的,就按照其自身的定义去配置。
./alps/mediatek/config/xxx_project/autoconfig/kconfig/project添加配置变量
当然,我们需要去下载最新的Ethernet驱动程序
网卡采用USB 2.0转以太网控制芯片AX88772B, android 2.3 和4.0下的通用网卡驱动不支持这款芯片, 需要从网上下载最新的linux 下AX88772B驱动
驱动下载地址:http://www.asix.com.tw/cs/download.php?sub=driverdetail&PItemID=105
我们进入/drivers/net/usb下面
./alps/mediatek/config/xxx_project/autoconfig/kconfig/project添加如下变量

CONFIG_USB_MTK_OTG=y
CONFIG_USB_MTK_HDRC_HCD=y
CONFIG_USB_PEGASUS=y
CONFIG_USB_USBNET=y
CONFIG_USB_NET_AX8817X=y
CONFIG_USB_NET_CDCETHER=y
CONFIG_USB_NET_CDC_NCM=y
CONFIG_USB_NET_CDC_SUBSET=y
CONFIG_USB_BELKIN=y
CONFIG_USB_ARMLINUX=y
CONFIG_USB_NET_ZAURUS=y

然后执行./mk -t n k,会报如下错误
**** Building ****
scripts/kconfig/conf --silentoldconfig Kconfig
../mediatek/platform/mt6572/kernel/Kconfig/Drivers:263:warning: config symbol defined without type
warning: (VIDEO_VIVI && FB_VGA16 && FB_S3 && FB_VT8623 && FB_ARK && USB_SISUSBVGA_CON && MTK_FB_SUPPORT_ASSERTION_LAYER) selects FONT_8x16 which has unmet direct dependencies (HAS_IOMEM && VT && (FRAMEBUFFER_CONSOLE || SGI_NEWPORT_CONSOLE || STI_CONSOLE || USB_SISUSBVGA_CON))
*
* Restart config...
*
*
* USB Network Adapters
*
USB CATC NetMate-based Ethernet device support (EXPERIMENTAL) (USB_CATC) [N/m/y/?] n
USB KLSI KL5USB101-based ethernet device support (USB_KAWETH) [N/m/y/?] n
USB Pegasus/Pegasus-II based ethernet device support (USB_PEGASUS) [Y/n/m/?] y
USB RTL8150 based ethernet device support (EXPERIMENTAL) (USB_RTL8150) [N/m/y/?] n
Multi-purpose USB Networking Framework (USB_USBNET) [Y/n/m/?] y
  ASIX AX88xxx Based USB 2.0 Ethernet Adapters (USB_NET_AX8817X) [Y/n/m/?] y
  CDC Ethernet support (smart devices such as cable modems) (USB_NET_CDCETHER) [Y/?] y
  CDC EEM support (USB_NET_CDC_EEM) [N/m/y/?] (NEW) aborted!

Console input/output is redirected. Run 'make oldconfig' to update configuration.

make[5]: *** [silentoldconfig] Error 1
make[4]: *** [silentoldconfig] Error 2
make[3]: *** No rule to make target `include/config/auto.conf', needed by `include/config/kernel.release'.  Stop.
make[2]: *** [sub-make] Error 2
Checking memory usage DONE!
                    ==> [OK]    2014/11/06 22:28:09
-------------------------------------------------------------------------------------------------------------------------------------------
这个错误表面,配置的一致性和完整性要求,我们必须./alps/mediatek/config/xxx_project/autoconfig/kconfig/project添加CONFIG_USB_NET_CDC_EEM=y的定义。
添加之后重新编译./mk -t n k,又报如下错误
scripts/kconfig/conf --silentoldconfig Kconfig
../mediatek/platform/mt6572/kernel/Kconfig/Drivers:263:warning: config symbol defined without type
warning: (VIDEO_VIVI && FB_VGA16 && FB_S3 && FB_VT8623 && FB_ARK && USB_SISUSBVGA_CON && MTK_FB_SUPPORT_ASSERTION_LAYER) selects FONT_8x16 which has unmet direct dependencies (HAS_IOMEM && VT && (FRAMEBUFFER_CONSOLE || SGI_NEWPORT_CONSOLE || STI_CONSOLE || USB_SISUSBVGA_CON))
*
* Restart config...
*
*
* USB Network Adapters
*
USB CATC NetMate-based Ethernet device support (EXPERIMENTAL) (USB_CATC) [N/m/y/?] n
USB KLSI KL5USB101-based ethernet device support (USB_KAWETH) [N/m/y/?] n
USB Pegasus/Pegasus-II based ethernet device support (USB_PEGASUS) [Y/n/m/?] y
USB RTL8150 based ethernet device support (EXPERIMENTAL) (USB_RTL8150) [N/m/y/?] n
Multi-purpose USB Networking Framework (USB_USBNET) [Y/n/m/?] y
  ASIX AX88xxx Based USB 2.0 Ethernet Adapters (USB_NET_AX8817X) [Y/n/m/?] y
  CDC Ethernet support (smart devices such as cable modems) (USB_NET_CDCETHER) [Y/?] y
  CDC EEM support (USB_NET_CDC_EEM) [Y/n/m/?] y
  CDC NCM support (USB_NET_CDC_NCM) [Y/n/m/?] y
  Davicom DM9601 based USB 1.1 10/100 ethernet devices (USB_NET_DM9601) [N/m/y/?] (NEW) aborted!

Console input/output is redirected. Run 'make oldconfig' to update configuration.

make[5]: *** [silentoldconfig] Error 1
make[4]: *** [silentoldconfig] Error 2
make[3]: *** No rule to make target `include/config/auto.conf', needed by `include/config/kernel.release'.  Stop.
make[2]: *** [sub-make] Error 2
Checking memory usage DONE!
这表明,我们又需要添加CONFIG_USB_NET_DM9601=y
一次一次的尝试,最后,我们添加如下所有配置变量,编译通过了。
CONFIG_USB_MTK_OTG=y
CONFIG_USB_MTK_HDRC_HCD=y
CONFIG_USB_PEGASUS=y
CONFIG_USB_USBNET=y
CONFIG_USB_NET_AX8817X=y
CONFIG_USB_NET_CDC_EEM=y
CONFIG_USB_NET_CDC_NCM=y
CONFIG_USB_NET_SMSC75XX=y
CONFIG_USB_NET_SMSC95XX=y
CONFIG_USB_NET_GL620A=y
CONFIG_USB_NET_NET1080=y
CONFIG_USB_NET_PLUSB=y
CONFIG_USB_NET_MCS7830=y
CONFIG_USB_NET_CDCETHER=y
CONFIG_USB_NET_CDC_NCM=y
CONFIG_USB_NET_DM9601=y
CONFIG_USB_NET_CDC_SUBSET=y
CONFIG_USB_BELKIN=y
CONFIG_USB_ARMLINUX=y
CONFIG_USB_NET_ZAURUS=y
CONFIG_USB_NET_RNDIS_HOST=y
CONFIG_USB_ALI_M5632=y
CONFIG_USB_AN2720=y
CONFIG_USB_EPSON2888=y
CONFIG_USB_KC2190=y
CONFIG_USB_NET_CX82310_ETH=y
CONFIG_USB_NET_KALMIA=y
CONFIG_USB_NET_QMI_WWAN=y
CONFIG_USB_NET_INT51X1=y
CONFIG_USB_SIERRA_NET=y
CONFIG_USB_VL600=y
--------------------------------------------------------------------------------
然后,把ROM烧到目标机器上。
然后使用USB调试线把网卡接上去,问题来了,由于我没有串口设备,同时USB OTG又被占用了,无法使用adb调试,怎么办?
我下载一个超级终端apk,可以在设备的界面中执行shell命令。
然后执行dmseg,看看插入OTG网卡的信息,可以看到网卡被正常找到和匹配驱动。
然后,在终端上执行
netcfg eth0 dhcp
setprop net.dns1 8.8.8.8
执行之后,执行一下ifconfig查看,就可以看到eth0被正常配置,并且分配了IP地址了,到此,调试结束了,后面的工作就简单了,就是修改Init.rc启动相关服务就可以了。

你可能感兴趣的:(MTK,eth0,otg,rj,65xx)