《EC20 — 海思3521d添加EC20驱动》

如果lsusb没有看到VID和PID,需要查看一下硬件是否有问题。我这边是要把复位引脚拉低。

 

1.移植EC20 R2.0(注意是R2.0,是两个不同版本,对应着两个不同的VID和PID)

1.1将模块插上后:

 可以看到第一个就是已经识别模块。

 

1.2/home/hisi3531D/Hi3531DV100_SDK_V1.0.4.0/osdrv/opensource/kernel/linux-3.18.y/drivers/usb/serial/option.c中添加

 

1.3删除掉[KERNEL]/drivers/usb/serial/qcserial.c 中的

 

 

删除掉[KERNEL]/drivers/net/usb/qmi_wwan.c

 

 

 

1.4添加零数据包处理机制:

[KERNEL]/drivers/usb/serial/usb_wwan.c 中添加

#if 1
if (dir == USB_DIR_OUT) { 
 struct usb_device_descriptor *desc = &serial->dev->descriptor; 
 if (desc->idVendor == cpu_to_le16(0x05C6) && desc->idProduct == cpu_to_le16(0x9090)) 
 urb->transfer_flags |= URB_ZERO_PACKET; 
 if (desc->idVendor == cpu_to_le16(0x05C6) && desc->idProduct == cpu_to_le16(0x9003)) 
 urb->transfer_flags |= URB_ZERO_PACKET; 
 if (desc->idVendor == cpu_to_le16(0x05C6) && desc->idProduct == cpu_to_le16(0x9215)) 
 urb->transfer_flags |= URB_ZERO_PACKET; 
 if (desc->idVendor == cpu_to_le16(0x2C7C)) 
 urb->transfer_flags |= URB_ZERO_PACKET; 
} 
#endif

到urb *usb_wwan_setup_urb函数。

 

1.5添加复位唤醒

在kernel/linux-3.18.y/drivers/usb/serial/option.c中

 

 

 

1.6 Use GobiNet or QMI WWAN

kernel/linux-3.18.y/drivers/usb/serial/option.c中添加以下代码到static int option_probe

#if 1
if (serial->dev->descriptor.idVendor == cpu_to_le16(0x05C6) && 
serial->dev->descriptor.idProduct == cpu_to_le16(0x9003) 
 && serial->interface->cur_altsetting->desc.bInterfaceNumber >= 4) 
return -ENODEV; 
if (serial->dev->descriptor.idVendor == cpu_to_le16(0x05C6) && 
serial->dev->descriptor.idProduct == cpu_to_le16(0x9215) 
 && serial->interface->cur_altsetting->desc.bInterfaceNumber >= 4) 
 return -ENODEV; 
 if (serial->dev->descriptor.idVendor == cpu_to_le16(0x2C7C) 
 && serial->interface->cur_altsetting->desc.bInterfaceNumber >= 4) 
 return -ENODEV; 
#endif

 

1.7做完这些,就可以进行内核的配置了

 Make ARCH=arm CROSS_COMPILE=arm-hisiv600-linux- menuconfig,确认以下选项:
Device Drivers->USB Support-> USB Serial Converter support-> USB driver for GSM and CDMA modems       选择为M或*

 

 

2.移植GObiNet drivers

2.1 将驱动源码移到[KERNEL]/drivers/net/usb/” 中(里面驱动的makefile不要加进去)

 

2.2 配置

 

 

 

2.3在[KERNEL]/drivers/net/usb/Makefile

obj-y += GobiNet.o

GobiNet-objs := GobiUSBNet.o QMIDevice.o QMI.o

 

2.4运行编译

重新编译内核

 

3.编译运行quectel-CM

将源码放在linux中,然后编译。得到输出文件quectel-CM

放到开发板运行:./quectel-CM -s 3gnet &

[01-01_00:07:33:691] WCDMA&LTE_QConnectManager_Linux&Android_V1.1.33
[01-01_00:07:33:692] ./quectel-CM profile[1] = 3gnet///0, pincode = (null)
[01-01_00:07:33:692] Find /sys/bus/usb/devices/1-1 idVendor=2c7c idProduct=0125
[01-01_00:07:33:692] Find /sys/bus/usb/devices/1-1:1.4/net/eth1
[01-01_00:07:33:692] Find usbnet_adapter = eth1
[01-01_00:07:33:692] Find /sys/bus/usb/devices/1-1:1.4/GobiQMI/qcqmi1
[01-01_00:07:33:692] Find qmichannel = /dev/qcqmi1
[01-01_00:07:33:713] Get clientWDS = 7
[01-01_00:07:33:744] Get clientDMS = 8
[01-01_00:07:33:776] Get clientNAS = 9
[01-01_00:07:33:810] Get clientUIM = 10
[01-01_00:07:33:841] Get clientWDA = 11
[01-01_00:07:33:873] requestBaseBandVersion EC20CEFAGR06A10M4G
[01-01_00:07:33:937] requestGetSIMStatus SIMStatus: SIM_READY
[01-01_00:07:33:937] requestSetProfile[1] 3gnet///0
[01-01_00:07:34:001] requestGetProfile[1] 3gnet///0
[01-01_00:07:34:033] requestRegistrationState2 MCC: 460, MNC: 1, PS: Attached, DataCap: LTE
[01-01_00:07:34:065] requestQueryDataCall IPv4ConnectionStatus: DISCONNECTED
[01-01_00:07:34:129] requestRegistrationState2 MCC: 460, MNC: 1, PS: Attached, DataCap: LTE
[01-01_00:07:34:193] requestSetupDataCall WdsConnectionIPv4Handle: 0x872b2430
[01-01_00:07:34:289] requestQueryDataCall IPv4ConnectionStatus: CONNECTED
[01-01_00:07:34:321] ifconfig eth1 up
GobiNet 1-1:1.4 eth1: kevent 12 may have been dropped
GobiNet 1-1:1.4 eth1: kevent 12 may have been dropped
[01-01_00:07:34:335] busybox udhcpc -f -n -q -t 5 -i eth1
[01-01_00:07:34:339] udhcpc (v1.20.2) started
[01-01_00:07:34:340] Setting IP address 0.0.0.0 on eth1
[01-01_00:07:34:368] Sending discover...
[01-01_00:07:34:428] Sending select for 10.235.222.232...
[01-01_00:07:34:488] Lease of 10.235.222.232 obtained, lease time 7200
[01-01_00:07:34:490] Setting IP address 10.235.222.232 on eth1
[01-01_00:07:34:492] Deleting routers
route: SIOCDELRT: No such process
[01-01_00:07:34:494] Adding router 10.235.222.233
[01-01_00:07:34:496] Recreating /etc/resolv.conf
[01-01_00:07:34:497]  Adding DNS server 120.80.80.80
[01-01_00:07:34:497]  Adding DNS server 221.5.88.88

 

4.4G模块调试

将4G复位引脚拉低

 

 即把GPIO5_3拉低。

 

G:\海思资料\Hi3521D社区硬件\SDK\Hi3521D V100R001C02SPC040\ReleaseDoc\zh\00.hardware\chip\Hi3521DV100

有一个xlsx文档,里面说明了海思各种引脚的定义。

还有一个编译器用户指南,里面说明了相关寄存器的定义和地址。

 

 himm 0x120F00D0  0  (修改管脚复用)

 

 

 

 

 himm 0x121A4000 4096

 

有个问题就是用himm修改后,再用himm看,奇怪的时候没有数值没有改变。但是实际上有效果。

 

 

 

 

 

 

 

 

posted @ 2019-11-19 14:30  一个不知道干嘛的小萌新  阅读(1839)  评论(0编辑  收藏  举报