add SEW290 3G modem
authorzzy <zzy@rock-chips.com>
Mon, 13 May 2013 03:49:36 +0000 (11:49 +0800)
committerzzy <zzy@rock-chips.com>
Mon, 13 May 2013 06:14:02 +0000 (14:14 +0800)
arch/arm/mach-rk30/board-rk30-phonepad.c [changed mode: 0755->0644]
drivers/misc/bp/chips/Kconfig
drivers/misc/bp/chips/Makefile
drivers/misc/bp/chips/sew290.c [new file with mode: 0644]
drivers/usb/serial/option.c [changed mode: 0755->0644]
drivers/usb/serial/usb-serial.c [changed mode: 0755->0644]
include/linux/bp-auto.h

old mode 100755 (executable)
new mode 100644 (file)
index c9e157f..dd47529
@@ -1427,21 +1427,41 @@ static int bp_io_deinit(void)
        return 0;
 }
  
-
-struct bp_platform_data bp_auto_info = {       
-       .board_id = BOARD_ID_C8003,
-       .bp_id = BP_ID_MT6229,
-       .init_platform_hw = bp_io_init, 
-       .exit_platform_hw = bp_io_deinit,       
-       .bp_power = RK30_PIN6_PB2,      // 3g_power
-       .bp_en = RK30_PIN2_PB6,         // 3g_en
-       .bp_usb_en = RK30_PIN2_PC0,     //W_disable
-       .bp_uart_en = RK30_PIN2_PC1,    //EINT9
-       .bp_wakeup_ap = RK30_PIN6_PA1,  //
-       .ap_ready = RK30_PIN2_PB7,      //
-       .gpio_valid = 0,                //don't use this gpios
+static int bp_id_get(void)
+{      
+       int bp_id = 0;
+       #if defined(CONFIG_BP_AUTO_MT6229)
+       bp_id = BP_ID_MT6229;
+       #elif defined(CONFIG_BP_AUTO_MU509)
+       bp_id = BP_ID_MU509;
+       #elif defined(CONFIG_BP_AUTO_MW100)
+       bp_id = BP_ID_MW100;
+       #elif defined(CONFIG_BP_AUTO_MI700)
+       bp_id = BP_ID_MI700;
+       #endif  
+       #elif defined(CONFIG_BP_AUTO_MI700)
+       bp_id = BP_ID_SEW290;
+       #endif  
+       return bp_id;
+}
+
+struct bp_platform_data bp_auto_info = {
+       .init_platform_hw       = bp_io_init,   
+       .exit_platform_hw       = bp_io_deinit,
+       .get_bp_id              = bp_id_get,
+       .bp_power               = RK30_PIN6_PB2,        // 3g_power,¸ù¾Ýʵ¼Ê½ÓÏßÅäÖÃ
+       .bp_en                  = BP_UNKNOW_DATA,       // 3g_en
+       .bp_reset                       = BP_UNKNOW_DATA,   //¸ù¾Ýʵ¼ÊÅäÖÃ
+       .bp_usb_en              = BP_UNKNOW_DATA,       //W_disable
+       .bp_uart_en             = BP_UNKNOW_DATA,       //EINT9
+       .bp_wakeup_ap   = RK30_PIN2_PC4,        //¸ù¾Ýʵ¼Ê½ÓÏßÅäÖÃ
+       .ap_wakeup_bp   = RK30_PIN2_PC4,        //¸ù¾Ýʵ¼ÊÅäÖÃ
+       .ap_ready               = BP_UNKNOW_DATA,       //
+       .bp_ready               = BP_UNKNOW_DATA,
+       .gpio_valid             = 1,            //if 1:gpio is define in bp_auto_info,if 0:is not use gpio in bp_auto_info
 };
 
+
 struct platform_device device_bp_auto = {      
         .name = "bp-auto",     
        .id = -1,       
index 4b095c214060a3f8cd2f1d892871d0f3b367a638..29e63cc71fee9822029cf36600ae2bebd747f698 100755 (executable)
@@ -16,3 +16,6 @@ config BP_AUTO_C66A
 bool "modem c66a"\r
         default n\r
 \r
+config BP_AUTO_SEW290\r
+bool "modem sew290"\r
+        default n\r
index 87d0d739ea7821f2c0b82721c3f0029e451fa14b..12fd8870b1407e9a7dc485c7ea15f47dfd7687eb 100755 (executable)
@@ -6,3 +6,4 @@ obj-$(CONFIG_BP_AUTO)                           += sc6610.o
 obj-$(CONFIG_BP_AUTO)                          += m51.o\r
 obj-$(CONFIG_BP_AUTO)                          += mtk6250.o\r
 obj-$(CONFIG_BP_AUTO)                           += c66a.o\r
+obj-$(CONFIG_BP_AUTO)                           += sew290.o\r
diff --git a/drivers/misc/bp/chips/sew290.c b/drivers/misc/bp/chips/sew290.c
new file mode 100644 (file)
index 0000000..b456627
--- /dev/null
@@ -0,0 +1,258 @@
+/* drivers/misc/bp/chips/mu509.c\r
+ *\r
+ * Copyright (C) 2012-2015 ROCKCHIP.\r
+ * Author: luowei <lw@rock-chips.com>\r
+ *\r
+ * This software is licensed under the terms of the GNU General Public\r
+ * License version 2, as published by the Free Software Foundation, and\r
+ * may be copied, distributed, and modified under those terms.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ */\r
+#include <linux/module.h>\r
+#include <linux/kernel.h>\r
+#include <linux/i2c.h>\r
+#include <linux/irq.h>\r
+#include <linux/gpio.h>\r
+#include <linux/input.h>\r
+#include <linux/platform_device.h>\r
+#include <linux/fs.h>\r
+#include <linux/uaccess.h>\r
+#include <linux/miscdevice.h>\r
+#include <linux/circ_buf.h>\r
+#include <linux/interrupt.h>\r
+#include <linux/miscdevice.h>\r
+#include <mach/iomux.h>\r
+#include <mach/gpio.h>\r
+#include <asm/gpio.h>\r
+#include <linux/delay.h>\r
+#include <linux/poll.h>\r
+#include <linux/wait.h>\r
+#include <linux/wakelock.h>\r
+#include <linux/workqueue.h>\r
+#include <linux/slab.h>\r
+#include <linux/earlysuspend.h>\r
+\r
+#include <linux/bp-auto.h>\r
+        \r
+        \r
+#if 0\r
+#define DBG(x...)  printk(x)\r
+\r
+#else\r
+#define DBG(x...)\r
+#endif\r
+\r
+\r
+/****************operate according to bp chip:start************/\r
+static int bp_active(struct bp_private_data *bp, int enable)\r
+{              \r
+       printk("<-----SEW290 bp_active-------->\n");\r
+       if(enable)\r
+       {\r
+               gpio_set_value(bp->ops->bp_power, GPIO_LOW);\r
+                msleep(1000);\r
+                gpio_set_value(bp->ops->bp_power, GPIO_HIGH);\r
+                msleep(2500);\r
+                gpio_set_value(bp->ops->bp_power, GPIO_LOW);\r
+                gpio_set_value(bp->ops->ap_wakeup_bp, GPIO_LOW);\r
+       }\r
+       else\r
+       {\r
+                gpio_set_value(bp->ops->bp_en, GPIO_HIGH);\r
+                msleep(4000);\r
+                gpio_set_value(bp->ops->bp_en, GPIO_LOW);\r
+\r
+       }\r
+       \r
+       return 0;\r
+}\r
+\r
+static int ap_wake_bp(struct bp_private_data *bp, int wake)\r
+{\r
+       int result = 0;\r
+       \r
+       gpio_set_value(bp->ops->ap_wakeup_bp, wake);  \r
+       \r
+       return result;\r
+\r
+}\r
+\r
+static void  ap_wake_bp_work(struct work_struct *work)\r
+{\r
+       struct delayed_work *wakeup_work = container_of(work, struct delayed_work, work);\r
+       struct bp_private_data *bp = container_of(wakeup_work, struct bp_private_data, wakeup_work);\r
+\r
+       if(bp->suspend_status)\r
+       {\r
+               if(bp->ops->ap_wake_bp)\r
+               bp->ops->ap_wake_bp(bp, 0);\r
+       }\r
+       else    \r
+       {\r
+               if(bp->ops->ap_wake_bp)\r
+               bp->ops->ap_wake_bp(bp, 1);\r
+       }\r
+}\r
+\r
+\r
+static int bp_init(struct bp_private_data *bp)\r
+{\r
+       printk("<-----SEW290 bp_init-------->\n");\r
+       gpio_direction_output(bp->ops->bp_power, GPIO_HIGH);\r
+       gpio_set_value(bp->ops->bp_power, GPIO_HIGH);\r
+       msleep(500);\r
+       //if(bp->ops->active)\r
+       //      bp->ops->active(bp, 1);\r
+       gpio_direction_input(bp->ops->bp_wakeup_ap);\r
+       gpio_direction_output(bp->ops->bp_reset, GPIO_LOW);\r
+       gpio_direction_output(bp->ops->bp_en, GPIO_LOW);\r
+       gpio_direction_output(bp->ops->ap_wakeup_bp, GPIO_HIGH);\r
+       INIT_DELAYED_WORK(&bp->wakeup_work, ap_wake_bp_work);\r
+       return 0;\r
+}\r
+\r
+static int bp_reset(struct bp_private_data *bp)\r
+{\r
+//     gpio_direction_output(bp->ops->bp_power, GPIO_HIGH);\r
+//     msleep(500);\r
+       gpio_set_value(bp->ops->bp_reset, GPIO_HIGH);\r
+       msleep(100);\r
+       gpio_set_value(bp->ops->bp_reset, GPIO_LOW);\r
+       gpio_set_value(bp->ops->bp_en, GPIO_LOW);\r
+       msleep(1000);\r
+       gpio_set_value(bp->ops->bp_en, GPIO_HIGH);\r
+       msleep(700);\r
+       gpio_set_value(bp->ops->bp_en, GPIO_LOW);\r
+       gpio_set_value(bp->ops->ap_wakeup_bp, GPIO_LOW);\r
+\r
+       return 0;\r
+}\r
+\r
+static int bp_wake_ap(struct bp_private_data *bp)\r
+{\r
+       printk("<-----SEW290 bp_wake_ap-------->\n");\r
+       \r
+       bp->suspend_status = 0;\r
+       wake_lock_timeout(&bp->bp_wakelock, 20* HZ);\r
+       \r
+       return 0;\r
+}\r
+\r
+\r
+static int bp_shutdown(struct bp_private_data *bp)\r
+{\r
+       int result = 0;\r
+       \r
+       if(bp->ops->active)\r
+               bp->ops->active(bp, 0);\r
+       gpio_set_value(bp->ops->bp_power, GPIO_LOW);\r
+       cancel_delayed_work_sync(&bp->wakeup_work);     \r
+\r
+       return result;\r
+}\r
+\r
+\r
+\r
+static int bp_suspend(struct bp_private_data *bp)\r
+{      \r
+\r
+       printk("<-----SEW290 bp_suspend-------->\n");\r
+       \r
+       bp->suspend_status = 1;\r
+       gpio_set_value(bp->ops->ap_wakeup_bp, GPIO_LOW);                \r
+       \r
+       return 0;\r
+}\r
+\r
+\r
+\r
+\r
+static int bp_resume(struct bp_private_data *bp)\r
+{      \r
+\r
+       printk("<-----SEW290 bp_resume-------->\n");\r
+       bp->suspend_status = 0; \r
+       gpio_set_value(bp->ops->ap_wakeup_bp, GPIO_HIGH);       \r
+       \r
+       \r
+       return 0;\r
+}\r
+\r
+\r
+struct bp_operate bp_sew290_ops = {\r
+       .name                   = "sew290",\r
+       .bp_id                  = BP_ID_SEW290,\r
+       .bp_bus                 = BP_BUS_TYPE_USB_UART,         \r
+       .bp_pid                 = 0,    \r
+       .bp_vid                 = 0,    \r
+       .bp_power               = BP_UNKNOW_DATA,       // 3g_power\r
+       .bp_en                  = BP_UNKNOW_DATA,       // 3g_en\r
+       .bp_reset                       = BP_UNKNOW_DATA,\r
+       .ap_ready               = BP_UNKNOW_DATA,       //\r
+       .bp_ready               = BP_UNKNOW_DATA,\r
+       .ap_wakeup_bp           = RK30_PIN2_PC5,\r
+       .bp_wakeup_ap           = RK30_PIN2_PC4,        //\r
+       .bp_uart_en             = BP_UNKNOW_DATA,       //EINT9\r
+       .bp_usb_en              = BP_UNKNOW_DATA,       //W_disable\r
+       .trig                   = IRQF_TRIGGER_RISING,\r
+\r
+       .active                 = bp_active,\r
+       .init                   = bp_init,\r
+       .reset                  = bp_reset,\r
+       .ap_wake_bp             = ap_wake_bp,\r
+       .bp_wake_ap             = bp_wake_ap,\r
+       .shutdown               = bp_shutdown,\r
+       .read_status            = NULL,\r
+       .write_status           = NULL,\r
+       .suspend                = bp_suspend,\r
+       .resume                 = bp_resume,\r
+       .misc_name              = NULL,\r
+       .private_miscdev        = NULL,\r
+};\r
+\r
+/****************operate according to bp chip:end************/\r
+\r
+//function name should not be changed\r
+static struct bp_operate *bp_get_ops(void)\r
+{\r
+       return &bp_sew290_ops;\r
+}\r
+\r
+static int __init bp_sew290_init(void)\r
+{\r
+       struct bp_operate *ops = bp_get_ops();\r
+       int result = 0;\r
+       result = bp_register_slave(NULL, NULL, bp_get_ops);\r
+       if(result)\r
+       {       \r
+               return result;\r
+       }\r
+       \r
+       if(ops->private_miscdev)\r
+       {\r
+               result = misc_register(ops->private_miscdev);\r
+               if (result < 0) {\r
+                       printk("%s:misc_register err\n",__func__);\r
+                       return result;\r
+               }\r
+       }\r
+       \r
+       DBG("%s\n",__func__);\r
+       return result;\r
+}\r
+\r
+static void __exit bp_sew290_exit(void)\r
+{\r
+       //struct bp_operate *ops = bp_get_ops();\r
+       bp_unregister_slave(NULL, NULL, bp_get_ops);\r
+}\r
+\r
+\r
+subsys_initcall(bp_sew290_init);\r
+module_exit(bp_sew290_exit);\r
+\r
old mode 100755 (executable)
new mode 100644 (file)
index e24a779..6f1d6c1
@@ -1331,6 +1331,8 @@ static const struct usb_device_id option_ids[] = {
        { USB_DEVICE(0x1d09, 0x1010) },
     { USB_DEVICE(0x19D2, 0x1181) },
        { USB_DEVICE(0x2020, 0x1005)},//S830 3G Dongle
+    { USB_DEVICE(0x1782, 0x0002)},//U7501
+       { USB_DEVICE(0x21f5, 0x2012) },//SEW290
 // cmy end
 //xxh
    { USB_DEVICE_AND_INTERFACE_INFO(0x05c6, 0x1000, 0xff, 0xff, 0xff) },
old mode 100755 (executable)
new mode 100644 (file)
index a3ea0ac..83e6259
@@ -1075,9 +1075,10 @@ int usb_serial_probe(struct usb_interface *interface,
        }
 #ifdef CONFIG_BP_AUTO
                int bp_id = get_current_bp_id();
-               if (((le16_to_cpu(dev->descriptor.idVendor) == 0x12D1 ) && (le16_to_cpu(dev->descriptor.idProduct) == 0x1001) && (bp_id == 2))
+               if (((le16_to_cpu(dev->descriptor.idVendor) == 0x1782 ) && (le16_to_cpu(dev->descriptor.idProduct) == 0x0002) && (bp_id == 2))
                        || ((le16_to_cpu(dev->descriptor.idVendor) == 0x19f5) && (le16_to_cpu(dev->descriptor.idProduct) == 0x9013) && (bp_id == 4))                    
                        || ((le16_to_cpu(dev->descriptor.idVendor) == 0x0E8D) && (le16_to_cpu(dev->descriptor.idProduct) == 0x00A2) && (bp_id == 1))
+                       || ((le16_to_cpu(dev->descriptor.idVendor) == 0x21f5) && (le16_to_cpu(dev->descriptor.idProduct) == 0x2012) && (bp_id == 10))
                ){
                        BP_USB =1;
 
index d0a9eb245171e99603d8f552df71a25ea94ff354..76d89c2a139090f23f72e1646623e5ef47c09f48 100644 (file)
@@ -35,6 +35,7 @@ enum bp_id{
        BP_ID_M50,              //spreadtrum RDA GSM\r
        BP_ID_MT6250,  //ZINN M50  EDGE\r
        BP_ID_C66A,    //zhongben\r
+       BP_ID_SEW290,    //SCV SEW290 WCDMA\r
        BP_ID_NUM,  \r
 };\r
 \r