From: 赵子初 Date: Tue, 6 Mar 2012 08:51:21 +0000 (+0800) Subject: phonepad:modify usb1.1 host -71 error X-Git-Tag: firefly_0821_release~9608 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=a2240cf588ee3049cb11859fa5167e5391db079c;p=firefly-linux-kernel-4.4.55.git phonepad:modify usb1.1 host -71 error --- diff --git a/arch/arm/mach-rk29/board-rk29phonepadsdk.c b/arch/arm/mach-rk29/board-rk29phonepadsdk.c index 169cc5ba8bc2..128e483b3bc2 100755 --- a/arch/arm/mach-rk29/board-rk29phonepadsdk.c +++ b/arch/arm/mach-rk29/board-rk29phonepadsdk.c @@ -1831,6 +1831,7 @@ static int mu509_io_deinit(void) struct rk29_mu509_data rk29_mu509_info = { .io_init = mu509_io_init, .io_deinit = mu509_io_deinit, + .modem_power_en = RK29_PIN6_PC2, .bp_power = RK29_PIN6_PB1,//RK29_PIN0_PB4, .bp_power_active_low = 1, .bp_reset = RK29_PIN6_PC7,//RK29_PIN0_PB3, diff --git a/drivers/misc/mu509.c b/drivers/misc/mu509.c index c56e098eaec0..7391fa636e8a 100755 --- a/drivers/misc/mu509.c +++ b/drivers/misc/mu509.c @@ -21,6 +21,7 @@ #include #include #include +#include MODULE_LICENSE("GPL"); @@ -44,7 +45,7 @@ struct class *modem_class = NULL; static int do_wakeup_irq = 0; static int modem_status; static int online = 0; - +int suspend_int =0; static void ap_wakeup_bp(struct platform_device *pdev, int wake) { struct rk29_mu509_data *pdata = pdev->dev.platform_data; @@ -56,8 +57,12 @@ extern void rk28_send_wakeup_key(void); static void do_wakeup(struct work_struct *work) { -// MODEMDBG("%s[%d]: %s\n", __FILE__, __LINE__, __FUNCTION__); - //rk28_send_wakeup_key(); + if(suspend_int) + { + gpio_set_value(gpdata->ap_wakeup_bp, 0); + suspend_int = 0; + } + } static DECLARE_DELAYED_WORK(wakeup_work, do_wakeup); @@ -68,7 +73,7 @@ static irqreturn_t detect_irq_handler(int irq, void *dev_id) do_wakeup_irq = 0; // MODEMDBG("%s[%d]: %s\n", __FILE__, __LINE__, __FUNCTION__); wake_lock_timeout(&modem_wakelock, 10 * HZ); - schedule_delayed_work(&wakeup_work, HZ / 10); + schedule_delayed_work(&wakeup_work, 2*HZ); } return IRQ_HANDLED; } @@ -209,6 +214,26 @@ static ssize_t online_write(struct class *cls, const char *_buf, size_t _count) return _count; } static CLASS_ATTR(online, 0777, online_read, online_write); +static void rk29_early_suspend(struct early_suspend *h) +{ + printk("*********************509____suspend\n"); + +} +static void rk29_early_resume(struct early_suspend *h) +{ + if(suspend_int) + { + printk("***************509____resume\n"); + gpio_set_value(gpdata->ap_wakeup_bp, 0); + suspend_int = 0; + } +} + +static struct early_suspend mu509_early_suspend = { + .suspend = rk29_early_suspend, + .resume = rk29_early_resume, + .level = EARLY_SUSPEND_LEVEL_DISABLE_FB - 1, + }; static int mu509_probe(struct platform_device *pdev) { struct rk29_mu509_data *pdata = gpdata = pdev->dev.platform_data; @@ -219,9 +244,12 @@ static int mu509_probe(struct platform_device *pdev) pdata->dev = &pdev->dev; if(pdata->io_init) pdata->io_init(); + gpio_set_value(pdata->modem_power_en, GPIO_HIGH); + msleep(1000); modem_poweron_off(1); modem_status = 1; + register_early_suspend(&mu509_early_suspend); mu509_data = kzalloc(sizeof(struct modem_dev), GFP_KERNEL); if(mu509_data == NULL) { @@ -274,6 +302,7 @@ err2: int mu509_suspend(struct platform_device *pdev, pm_message_t state) { + suspend_int = 1; do_wakeup_irq = 1; //MODEMDBG("-------------%s\n",__FUNCTION__); if(!online) @@ -286,8 +315,12 @@ int mu509_suspend(struct platform_device *pdev, pm_message_t state) int mu509_resume(struct platform_device *pdev) { //MODEMDBG("-------------%s\n",__FUNCTION__); - ap_wakeup_bp(pdev, 0); + //ap_wakeup_bp(pdev, 0); rk29_mux_api_set(GPIO1C1_UART0RTSN_SDMMC1WRITEPRT_NAME, GPIO1H_UART0_RTS_N); + if(gpio_get_value(gpdata->bp_wakeup_ap)) + { + schedule_delayed_work(&wakeup_work, 2*HZ); + } return 0; } @@ -302,6 +335,7 @@ void mu509_shutdown(struct platform_device *pdev) if(pdata->io_deinit) pdata->io_deinit(); cancel_work_sync(&mu509_data->work); + gpio_free(pdata->modem_power_en); gpio_free(pdata->bp_power); gpio_free(pdata->bp_reset); gpio_free(pdata->ap_wakeup_bp); diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 2fbdf8f68ce5..c077022fe7de 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c @@ -1338,11 +1338,13 @@ static void option_instat_callback(struct urb *urb) int status = urb->status; struct usb_serial_port *port = urb->context; struct option_port_private *portdata = usb_get_serial_port_data(port); + static int err_times = 0; dbg("%s", __func__); dbg("%s: urb %p port %p has data %p", __func__, urb, port, portdata); if (status == 0) { + err_times = 0; struct usb_ctrlrequest *req_pkt = (struct usb_ctrlrequest *)urb->transfer_buffer; @@ -1376,9 +1378,17 @@ static void option_instat_callback(struct urb *urb) dbg("%s: type %x req %x", __func__, req_pkt->bRequestType, req_pkt->bRequest); } - } else - err("%s: error %d", __func__, status); - + } + else{ + if(status == -EPROTO && err_times++ >10){ + err_times = 0; + printk("%s,recieve -71 error more than 10 times,so reset usb\n",__FUNCTION__); + usb_queue_reset_device(port->serial->interface); + return; + }else + err("%s : error %d",__func__, status); + } + /* Resubmit urb so we continue receiving IRQ data */ if (status != -ESHUTDOWN && status != -ENOENT) { err = usb_submit_urb(urb, GFP_ATOMIC); diff --git a/include/linux/mu509.h b/include/linux/mu509.h index 0c69ff84e0f7..431461037f96 100644 --- a/include/linux/mu509.h +++ b/include/linux/mu509.h @@ -20,6 +20,7 @@ struct rk29_mu509_data { unsigned int bp_reset_active_low; unsigned int bp_wakeup_ap; unsigned int ap_wakeup_bp; + unsigned int modem_power_en; }; #define MODEM_NAME "mu509"