X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=carlfw%2Fusb%2Fmain.c;h=5c09476b29a5592b63906c21067d70ce25969a41;hb=12d3f1ba6ba522cd1ef11483d813fe2c2e64f04b;hp=95aac88b86b1d8d2a5d9f0027260495fa6365196;hpb=fa70a88970886b0a54bfd37086c66a1c08f50243;p=carl9170fw.git diff --git a/carlfw/usb/main.c b/carlfw/usb/main.c index 95aac88..5c09476 100644 --- a/carlfw/usb/main.c +++ b/carlfw/usb/main.c @@ -4,7 +4,7 @@ * Copyright (c) 2000-2005 ZyDAS Technology Corporation * Copyright (c) 2007-2009 Atheros Communications, Inc. * Copyright 2009 Johannes Berg - * Copyright 2009 Christian Lamparter + * Copyright 2009-2011 Christian Lamparter * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -27,6 +27,7 @@ #include "printf.h" #include "timer.h" #include "rom.h" +#include "wl.h" #include "shared/phy.h" #ifdef CONFIG_CARL9170FW_DEBUG_USB @@ -381,14 +382,24 @@ static void usb_handler(uint8_t usb_interrupt_level1) if (usb_interrupt_level2 & AR9170_USB_INTR_SRC7_USB_SUSPEND) { usb_suspend_ack(); - disable_watchdog(); + fw.suspend_mode = CARL9170_HOST_SUSPENDED; - /* GO_TO_SUSPEND stops the CPU clock too. */ - orb(AR9170_USB_REG_MAIN_CTRL, AR9170_USB_MAIN_CTRL_GO_TO_SUSPEND); + if (!(fw.usb.device_feature & USB_DEVICE_REMOTE_WAKEUP)) { + disable_watchdog(); + + /* GO_TO_SUSPEND stops the CPU clock too. */ + orb(AR9170_USB_REG_MAIN_CTRL, AR9170_USB_MAIN_CTRL_GO_TO_SUSPEND); + } else { + wlan_prepare_wol(); + } } if (usb_interrupt_level2 & AR9170_USB_INTR_SRC7_USB_RESUME) { usb_resume_ack(); + + fw.suspend_mode = CARL9170_HOST_AWAKE; + set(AR9170_USB_REG_WAKE_UP, 0); + reboot(); } } @@ -407,3 +418,6 @@ void handle_usb(void) usb_trigger_in(); } +void usb_timer(void) +{ +}