projects
/
carl9170fw.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
carl9170 firmware: always reset usb endpoints
[carl9170fw.git]
/
carlfw
/
usb
/
main.c
diff --git
a/carlfw/usb/main.c
b/carlfw/usb/main.c
index c2ad6c3d71fcc79fc4b1bc082430f796931745cd..1fb119e996f8933e70b16b4d24c77337203aa834 100644
(file)
--- 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 <johannes@sipsolutions.net>
* Copyright (c) 2000-2005 ZyDAS Technology Corporation
* Copyright (c) 2007-2009 Atheros Communications, Inc.
* Copyright 2009 Johannes Berg <johannes@sipsolutions.net>
- * Copyright
2009
Christian Lamparter <chunkeey@googlemail.com>
+ * Copyright
2009-2011
Christian Lamparter <chunkeey@googlemail.com>
*
* 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
*
* 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
@@
-23,12
+23,13
@@
#include "carl9170.h"
#include "carl9170.h"
+#include "shared/phy.h"
#include "hostif.h"
#include "printf.h"
#include "timer.h"
#include "rom.h"
#include "wl.h"
#include "hostif.h"
#include "printf.h"
#include "timer.h"
#include "rom.h"
#include "wl.h"
-#include "
shared/phy
.h"
+#include "
wol
.h"
#ifdef CONFIG_CARL9170FW_DEBUG_USB
void usb_putc(const char c)
#ifdef CONFIG_CARL9170FW_DEBUG_USB
void usb_putc(const char c)
@@
-245,7
+246,7
@@
static void turn_power_off(void)
AR9170_PWR_RESET_WLAN_MASK);
set(AR9170_PWR_REG_RESET, 0x0);
AR9170_PWR_RESET_WLAN_MASK);
set(AR9170_PWR_REG_RESET, 0x0);
-
set(AR9170_PWR_REG_CLOCK_SEL, AHB_40MHZ_OSC
);
+
clock_set(AHB_20_22MHZ, false
);
set(AR9170_PWR_REG_PLL_ADDAC, 0x5163); /* 0x502b; */
set(AR9170_PHY_REG_ADC_SERIAL_CTL, AR9170_PHY_ADC_SCTL_SEL_EXTERNAL_RADIO);
set(AR9170_PWR_REG_PLL_ADDAC, 0x5163); /* 0x502b; */
set(AR9170_PHY_REG_ADC_SERIAL_CTL, AR9170_PHY_ADC_SCTL_SEL_EXTERNAL_RADIO);
@@
-376,6
+377,7
@@
static void usb_handler(uint8_t usb_interrupt_level1)
if (usb_interrupt_level2 & AR9170_USB_INTR_SRC7_USB_RESET) {
usb_reset_ack();
if (usb_interrupt_level2 & AR9170_USB_INTR_SRC7_USB_RESET) {
usb_reset_ack();
+ usb_reset_eps();
reboot();
}
reboot();
}
@@
-384,21
+386,30
@@
static void usb_handler(uint8_t usb_interrupt_level1)
fw.suspend_mode = CARL9170_HOST_SUSPENDED;
fw.suspend_mode = CARL9170_HOST_SUSPENDED;
- if (!(fw.usb.device_feature & USB_DEVICE_REMOTE_WAKEUP)) {
+#ifdef CONFIG_CARL9170FW_WOL
+ if (!(fw.usb.device_feature & USB_DEVICE_REMOTE_WAKEUP) ||
+ !fw.wol.cmd.flags) {
disable_watchdog();
/* GO_TO_SUSPEND stops the CPU clock too. */
orb(AR9170_USB_REG_MAIN_CTRL, AR9170_USB_MAIN_CTRL_GO_TO_SUSPEND);
} else {
disable_watchdog();
/* GO_TO_SUSPEND stops the CPU clock too. */
orb(AR9170_USB_REG_MAIN_CTRL, AR9170_USB_MAIN_CTRL_GO_TO_SUSPEND);
} else {
- w
lan_prepare_wol
();
+ w
ol_prepare
();
}
}
+#else /* CONFIG_CARL9170FW_WOL */
+ disable_watchdog();
+
+ /* GO_TO_SUSPEND stops the CPU clock too. */
+ orb(AR9170_USB_REG_MAIN_CTRL, AR9170_USB_MAIN_CTRL_GO_TO_SUSPEND);
+#endif /* CONFIG_CARL9170FW_WOL */
}
if (usb_interrupt_level2 & AR9170_USB_INTR_SRC7_USB_RESUME) {
}
if (usb_interrupt_level2 & AR9170_USB_INTR_SRC7_USB_RESUME) {
+ usb_resume_ack();
+
fw.suspend_mode = CARL9170_HOST_AWAKE;
fw.suspend_mode = CARL9170_HOST_AWAKE;
-
andl(AR9170_USB_REG_WAKE_UP, AR9170_USB_WAKE_UP_WAKE
);
+
set(AR9170_USB_REG_WAKE_UP, 0
);
- usb_resume_ack();
reboot();
}
}
reboot();
}
}
@@
-419,9
+430,4
@@
void handle_usb(void)
void usb_timer(void)
{
void usb_timer(void)
{
-#ifdef CONFIG_CARL9170FW_WOL
- if (fw.suspend_mode == CARL9170_AWAKE_HOST) {
- orl(AR9170_USB_REG_WAKE_UP, AR9170_USB_WAKE_UP_WAKE);
- }
-#endif /* CONFIG_CARL9170FW_WOL */
}
}