当前位置: 首页 > news >正文

RK3588 EC200A-CN【4G模块】调试

1、修改kernel


diff --git a/arch/arm64/boot/dts/rockchip/rk3588-nvr-demo.dtsi b/arch/arm64/boot/dts/rockchip/rk3588-nvr-demo.dtsi
index d8a7a43cdfa0..772f16633148 100755
--- a/arch/arm64/boot/dts/rockchip/rk3588-nvr-demo.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3588-nvr-demo.dtsi
@@ -187,6 +187,13 @@status = "okay";};+       lk4g_gpio {
+               compatible = "rockchip,lk4g_gpio";
+               pinctrl-0 = <&mod4g_pins>;
+               pwr_4g = <&gpio1 RK_PB0 GPIO_ACTIVE_HIGH>;
+               rst_4g = <&gpio1 RK_PA7 GPIO_ACTIVE_HIGH>;
+               status = "okay";
+       };};&pwm11 {
@@ -207,7 +214,7 @@reset-gpios = <&gpio1 RK_PA7 GPIO_ACTIVE_LOW>;vpcie3v3-supply = <&vcc3v3_pcie30>;rockchip,init-delay-ms = <100>;
-       status = "disabled";
+       status = "okay";};&pcie2x1l2 {
@@ -792,6 +799,13 @@};};+       lk4g_pins {
+               mod4g_pins: mod4g-pins {
+                       rockchip,pins = <1 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>,
+                                               <1 RK_PA7 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+       };
+       hdmi {hdmirx_det: hdmirx-det {rockchip,pins = <1 RK_PD5 RK_FUNC_GPIO &pcfg_pull_up>;
diff --git a/arch/arm64/configs/rk3588_nvr.config b/arch/arm64/configs/rk3588_nvr.config
index 79ffd373d61e..a0e41797dd71 100644
--- a/arch/arm64/configs/rk3588_nvr.config
+++ b/arch/arm64/configs/rk3588_nvr.config
@@ -27,7 +27,7 @@ CONFIG_ROCKCHIP_CLK_COMPENSATION=y# CONFIG_USB_ACM is not set# CONFIG_USB_CONFIGFS_ACM is not set# CONFIG_USB_CONFIGFS_MASS_STORAGE is not set
-# CONFIG_USB_SERIAL is not set
+CONFIG_USB_SERIAL=y# CONFIG_WLAN is not setCONFIG_DMABUF_CACHE=yCONFIG_ASYNC_CORE=y
diff --git a/arch/arm64/configs/rockchip_linux_defconfig b/arch/arm64/configs/rockchip_linux_defconfig
index db5fdc8f6d1a..d07c618855cd 100644
--- a/arch/arm64/configs/rockchip_linux_defconfig
+++ b/arch/arm64/configs/rockchip_linux_defconfig
@@ -1,3 +1,17 @@
+CONFIG_USB_NET_DRIVERS=y
+CONFIG_USB_USBNET=y
+CONFIG_USB_NET_QMI_WWAN=y
+CONFIG_USB_WDM=y
+CONFIG_USB_USBNET=y
+CONFIG_NET_CDCETHER=y
+#CONFIG_NET_RNDIS_HOST=y
+CONFIG_PPP=y
+CONFIG_PPP_ASYNC=y
+CONFIG_PPP_SYNC_TTY=y
+CONFIG_PPP_DEFLATE=y
+CONFIG_USB_SERIAL=y
+CONFIG_USB_SERIAL_WWAN=y
+CONFIG_USB_SERIAL_OPTION=yCONFIG_R8169=yCONFIG_VIDEO_ROCKCHIP_HDMIRX=yCONFIG_DEFAULT_HOSTNAME="localhost"
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index 3944ae6552d3..397d1946790d 100755
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -64,3 +64,4 @@ obj-y                         += rockchip/obj-y += lkir.oobj-y += lkir_send.oobj-y += lkes7243.o
+obj-y += lk4g_gpio.o
diff --git a/drivers/misc/lk4g_gpio.c b/drivers/misc/lk4g_gpio.c
new file mode 100755
index 000000000000..8a2f8ce1ccdf
--- /dev/null
+++ b/drivers/misc/lk4g_gpio.c
@@ -0,0 +1,198 @@
+/*^M
+ * linux/drivers/hwmon/lkencodeic.c^M
+ *^M
+ * 3-Axis Orientation/Motion Detection Sensor support^M
+ *^M
+ * Copyright (C) 2009-2010 LenKeng Ltd.^M
+ *^M
+ * This program is free software; you can redistribute it and/or modify^M
+ * it under the terms of the GNU General Public License as published by^M
+ * the Free Software Foundation; either version 2 of the License, or^M
+ * (at your option) any later version.^M
+ *^M
+ * This program is distributed in the hope that it will be useful,^M
+ * but WITHOUT ANY WARRANTY; without even the implied warranty ofdddfsafasfasfasfsafd^M
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the^M
+ * GNU General Public License for more details.^M
+ *^M
+ * You should have received a copy of the GNU General Public License^M
+ * along with this program; if not, write to the Free Software^M
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.^M
+ */^M
+^M
+#include <linux/module.h>^M
+#include <linux/slab.h>^M
+#include <linux/interrupt.h>^M
+#include <linux/irq.h>^M
+#include <linux/delay.h>^M
+#include <linux/i2c.h>^M
+#include <linux/err.h>^M
+#include <linux/input-polldev.h>^M
+#include <linux/device.h>^M
+#include <linux/uaccess.h>^M
+#include <linux/timer.h>^M
+#include <linux/timex.h>^M
+#include <linux/rtc.h>^M
+#include <linux/platform_device.h>^M
+#include <linux/miscdevice.h>^M
+//#include <linux/lkec.h>^M
+#include <linux/gpio.h>^M
+#include <linux/of_gpio.h>^M
+^M
+#include <linux/wakelock.h>^M
+^M
+#include <linux/timekeeping.h>^M
+^M
+//static struct pwm_device     *pwm;^M
+^M
+typedef unsigned char  uchar;^M
+typedef char           schar;^M
+typedef unsigned char  uint8;^M
+typedef signed char    int8;^M
+typedef unsigned short uint16;^M
+typedef short          int16;^M
+typedef unsigned int   uint32;^M
+typedef int            int32;^M
+^M
+#define GPIO_RST_HIGH  _IO('k', 0)^M
+#define GPIO_RST_LOW   _IO('k', 1)^M
+#define GPIO_PWR_HIGH  _IO('k', 2)^M
+#define GPIO_PWR_LOW   _IO('k', 3)^M
+^M
+static int gpio_pwr_4g;^M
+static int gpio_rst_4g;^M
+^M
+static long lk4g_gpio_ioctl(struct file * file, unsigned int cmd, unsigned long arg)^M
+{^M
+       switch (cmd) {^M
+               case GPIO_RST_HIGH:^M
+            gpio_direction_output(gpio_rst_4g, 1);^M
+            break;^M
+        ^M
+        case GPIO_RST_LOW:^M
+            gpio_direction_output(gpio_rst_4g, 0);^M
+            break;^M
+        ^M
+        case GPIO_PWR_HIGH:^M
+            gpio_direction_output(gpio_pwr_4g, 1);^M
+            break;^M
+        ^M
+        case GPIO_PWR_LOW:^M
+            gpio_direction_output(gpio_pwr_4g, 0);^M
+            break;^M
+               break;^M
+       }^M
+       return 0;^M
+}^M
+^M
+^M
+static struct file_operations lk4g_gpio_fops = {^M
+       .owner = THIS_MODULE,^M
+       //.open = lk4g_gpio_open,^M
+       //.release = lk4g_gpio_release,^M
+       .unlocked_ioctl = lk4g_gpio_ioctl,^M
+    //.read = lk4g_gpio_read,^M
+    //.write = lk4g_gpio_write,^M
+};^M
+^M
+static struct miscdevice lk4g_gpio_device = {^M
+       .minor = MISC_DYNAMIC_MINOR,^M
+       .name = "lk4g_gpio",^M
+       .fops = &lk4g_gpio_fops,^M
+};^M
+^M
+static int  lk4g_gpio_probe(struct platform_device *pdev)^M
+{^M
+    struct device_node *np = pdev->dev.of_node;^M
+       int ret;^M
+    int err;^M
+       ^M
+       printk("====lk4g_gpio_probe==\n");^M
+^M
+       gpio_pwr_4g = of_get_named_gpio(np, "pwr_4g", 0);^M
+       if (!gpio_is_valid(gpio_pwr_4g)) {^M
+               dev_err(&pdev->dev, "invalid host gpio%d\n", gpio_pwr_4g);^M
+       } else {^M
+               err = devm_gpio_request(&pdev->dev, gpio_pwr_4g, "pwr_4g");^M
+               if (err) {^M
+                       dev_err(&pdev->dev,^M
+                               "failed to request GPIO%d for pwr_4g\n",^M
+                               gpio_pwr_4g);^M
+                       ret = err;^M
+               }^M
+               gpio_direction_output(gpio_pwr_4g, 1);^M
+               printk("====gpio_pwr_4g==\n");^M
+       }^M
+       ^M
+       gpio_rst_4g = of_get_named_gpio(np, "rst_4g", 0);^M
+       if (!gpio_is_valid(gpio_rst_4g)) {^M
+               dev_err(&pdev->dev, "invalid host gpio%d\n", gpio_rst_4g);^M
+       } else {^M
+               err = devm_gpio_request(&pdev->dev, gpio_rst_4g, "rst_4g");^M
+               if (err) {^M
+                       dev_err(&pdev->dev,^M
+                               "failed to request GPIO%d for rst_4g\n",^M
+                               gpio_rst_4g);^M
+                       ret = err;^M
+               }^M
+               gpio_direction_output(gpio_rst_4g, 1);^M
+               printk("====rst_4g==\n");^M
+       }^M
+       ret = misc_register(&lk4g_gpio_device);^M
+       if (ret) {^M
+               pr_err("lkgsv_probe: lk4g_gpio_device register failed\n");^M
+               goto misc_register_failed;^M
+       }^M
+       ^M
+       return 0;^M
+       ^M
+misc_register_failed:^M
+       misc_deregister(&lk4g_gpio_device);^M
+       return -1;^M
+}^M
+^M
+static int  lk4g_gpio_remove(struct platform_device *pdev)^M
+{^M
+       misc_deregister(&lk4g_gpio_device);^M
+       return 0;^M
+}^M
+^M
+static struct of_device_id lk4g_gpio_of_match[] = {^M
+       { .compatible = "rockchip,lk4g_gpio" },^M
+       { }^M
+};^M
+^M
+static struct platform_driver lk4g_gpio_driver = {^M
+       .probe = lk4g_gpio_probe,^M
+    .remove            = lk4g_gpio_remove, ^M
+    .driver            = {^M
+        .name  = "lk4g_gpio", ^M
+               .of_match_table = of_match_ptr(lk4g_gpio_of_match),^M
+               .owner  = THIS_MODULE,^M
+       },^M
+};^M
+^M
+static int lk4g_gpio_init(void)^M
+{^M
+       int retval = 0;^M
+^M
+       retval = platform_driver_register(&lk4g_gpio_driver);^M
+       if (retval < 0) {^M
+               printk(KERN_ERR "%s retval=%d\n", __func__, retval);^M
+               return retval;^M
+       }^M
+       return 0;^M
+}^M
+^M
+static void lk4g_gpio_exit(void)^M
+{^M
+       platform_driver_unregister(&lk4g_gpio_driver);^M
+}^M
+^M
+module_init(lk4g_gpio_init); ^M
+module_exit(lk4g_gpio_exit);^M
+^M
+MODULE_AUTHOR("LenKeng,Inc.");^M
+MODULE_DESCRIPTION("lk4g_gpio driver");^M
+MODULE_LICENSE("GPL");^M
+^M
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
old mode 100644
new mode 100755
index b878f4c87fee..67bd7c27ef07
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -587,6 +587,9 @@ static void option_instat_callback(struct urb *urb);static const struct usb_device_id option_ids[] = {
+#if 1 //Added by Quectel
+        {USB_DEVICE(0x2C7C, 0x6005)  },
+#endif{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) },{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA_LIGHT) },
@@ -2161,6 +2164,9 @@ static struct usb_serial_driver option_1port_device = {.suspend           = usb_wwan_suspend,.resume            = usb_wwan_resume,#endif
+#if 1 //Added by Quectel
+        .reset_resume      = usb_wwan_resume,
+#endif};static struct usb_serial_driver * const serial_drivers[] = {
@@ -2203,6 +2209,23 @@ static int option_probe(struct usb_serial *serial,if (device_flags & NUMEP2 && iface_desc->bNumEndpoints != 2)return -ENODEV;+#if 1 //Added by Quectel
+     if (serial->dev->descriptor.idVendor == cpu_to_le16(0x2C7C)) {
+         __u16 idProduct = le16_to_cpu(serial->dev->descriptor.idProduct);
+         struct usb_interface_descriptor *intf = &serial->interface->cur_altsetting->desc;
+         if (intf->bInterfaceClass != 0xFF || intf->bInterfaceSubClass == 0x42) {
+             //ECM, RNDIS, NCM, MBIM, ACM, UAC, ADB
+             return -ENODEV;
+         }
+        if ((idProduct&0xF000) == 0x0000) {
+         //MDM interface 4 is QMI
+         if (intf->bInterfaceNumber == 4 && intf->bNumEndpoints == 3
+            && intf->bInterfaceSubClass == 0xFF && intf->bInterfaceProtocol == 0xFF)
+             return -ENODEV;
+        }
+    }
+#endif
+/* Store the device flags so we can use them during attach. */usb_set_serial_data(serial, (void *)device_flags);diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c
old mode 100644
new mode 100755
index b2285d5a869d..33826cdcedb3
--- a/drivers/usb/serial/usb_wwan.c
+++ b/drivers/usb/serial/usb_wwan.c
@@ -476,6 +476,13 @@ static struct urb *usb_wwan_setup_urb(struct usb_serial_port *port,usb_fill_bulk_urb(urb, serial->dev,usb_sndbulkpipe(serial->dev, endpoint) | dir,buf, len, callback, ctx);
+        #if 1 //Added by Quectel for zero packet
+        if (dir == USB_DIR_OUT) {
+            struct usb_device_descriptor *desc = &serial->dev->descriptor;
+            if (desc->idVendor == cpu_to_le16(0x2C7C))
+                urb->transfer_flags |= URB_ZERO_PACKET;
+        }
+        #endifif (intfdata->use_zlp && dir == USB_DIR_OUT)urb->transfer_flags |= URB_ZERO_PACKET;

2、配置网卡接口类型

EC200A只有这两种拨号方式,LINUX系统自带都支持

echo "AT+QCFG=\"usbnet\",1" > /dev/ttyUSB2

3、拨号

echo -en "AT+QNETDEVCTL=1,1,1\r\n" > /dev/ttyUSB2

最后可以ping'百度成功,就代表拨号成功

4、调试命令

[root@RK3588:/]# lsusb
Bus 005 Device 001: ID 1d6b:0002
Bus 003 Device 001: ID 1d6b:0001
Bus 001 Device 001: ID 1d6b:0002
Bus 001 Device 003: ID 2c7c:6005
Bus 006 Device 001: ID 1d6b:0003
Bus 001 Device 002: ID 1a86:8092
Bus 004 Device 001: ID 1d6b:0001
Bus 002 Device 001: ID 1d6b:0002
[root@RK3588:/]# ls -ll /dev/ttyUSB
ls: cannot access '/dev/ttyUSB': No such file or directory
[root@RK3588:/]# ls -ll /dev/ttyUSB*
crw-rw---- 1 root dialout 188, 0 Jan  1 00:00 /dev/ttyUSB0
crw-rw---- 1 root dialout 188, 1 Jan  1 00:00 /dev/ttyUSB1
crw-rw---- 1 root dialout 188, 2 Jan  1 00:00 /dev/ttyUSB2

相关文章:

  • 【大模型从入门到精通33】开源库框架LangChain RAG 系统中的问答技术3
  • 解决前端访问IIS服务器发生跨域请求报错的方法
  • Mac移动硬盘选什么格式最好 Mac怎么用ntfs移动硬盘
  • 数据恢复新宠儿:2024年新兴软件趋势与亮点解析
  • ArcGis在线地图插件Maponline(好用版)
  • ORA-01110
  • 二十二、状态模式
  • 江协科技STM32学习- P5 GPIO输出
  • 20240822 每日AI必读资讯
  • 思特科技:国家宝藏数字体验馆展现东方美学 让“文物活起来”
  • 谷歌CEO闭门讲话误开直播,AI前沿资讯令人震惊……外网视频全部下架
  • CAS-ViT实战:使用CAS-ViT实现图像分类任务(一)
  • 学习使用pymodbus模块实现Modbus通讯
  • 【JS|第25期】探索HTTP POST请求:请求体的演变与应用
  • 编程思维模式比编程语言内容等更重要也更难传授-2024-机器人篇
  • 【腾讯Bugly干货分享】从0到1打造直播 App
  • 2018以太坊智能合约编程语言solidity的最佳IDEs
  • Javascript 原型链
  • Java反射-动态类加载和重新加载
  • jQuery(一)
  • JS函数式编程 数组部分风格 ES6版
  • js数组之filter
  • Map集合、散列表、红黑树介绍
  • OSS Web直传 (文件图片)
  • PAT A1017 优先队列
  • Python进阶细节
  • Redux系列x:源码分析
  • Shadow DOM 内部构造及如何构建独立组件
  • Swoft 源码剖析 - 代码自动更新机制
  • Vue2 SSR 的优化之旅
  • vue从创建到完整的饿了么(18)购物车详细信息的展示与删除
  • 产品三维模型在线预览
  • 创建一个Struts2项目maven 方式
  • 番外篇1:在Windows环境下安装JDK
  • 基于组件的设计工作流与界面抽象
  • 警报:线上事故之CountDownLatch的威力
  • 判断客户端类型,Android,iOS,PC
  • 前端面试之CSS3新特性
  • 网页视频流m3u8/ts视频下载
  • 正则表达式
  • 【云吞铺子】性能抖动剖析(二)
  • HanLP分词命名实体提取详解
  • postgresql行列转换函数
  • 阿里云服务器购买完整流程
  • ​渐进式Web应用PWA的未来
  • #微信小程序(布局、渲染层基础知识)
  • #中的引用型是什么意识_Java中四种引用有什么区别以及应用场景
  • (Java实习生)每日10道面试题打卡——JavaWeb篇
  • (vue)页面文件上传获取:action地址
  • (阿里云在线播放)基于SpringBoot+Vue前后端分离的在线教育平台项目
  • (第8天)保姆级 PL/SQL Developer 安装与配置
  • (二)Pytorch快速搭建神经网络模型实现气温预测回归(代码+详细注解)
  • (分布式缓存)Redis哨兵
  • (附源码)计算机毕业设计SSM基于健身房管理系统
  • (附源码)小程序 交通违法举报系统 毕业设计 242045