x1000: fix hang that may occur in USB mode
Upon getting a USB reset, the USB core will update charging current by calling usb_charging_maxcurrent_change(). On all current X1000 targets this may cause a hang, since changing the charge current involves a blocking I2C transaction. Eg. if the host issues a reset when we're already configured as part of error recovery, the change from 500 mA -> 100 mA will cause a hang. Change-Id: I5b45272c01fa16b179ae3d16bbc50c7fab9a416b
This commit is contained in:
parent
d435bb77b5
commit
3a89fdee96
4 changed files with 9 additions and 0 deletions
|
@ -114,6 +114,7 @@
|
||||||
#define USB_DEVBSS_ATTR __attribute__((aligned(32)))
|
#define USB_DEVBSS_ATTR __attribute__((aligned(32)))
|
||||||
#define HAVE_USB_POWER
|
#define HAVE_USB_POWER
|
||||||
#define HAVE_USB_CHARGING_ENABLE
|
#define HAVE_USB_CHARGING_ENABLE
|
||||||
|
#define HAVE_USB_CHARGING_IN_THREAD
|
||||||
#define TARGET_USB_CHARGING_DEFAULT USB_CHARGING_FORCE
|
#define TARGET_USB_CHARGING_DEFAULT USB_CHARGING_FORCE
|
||||||
#define HAVE_BOOTLOADER_USB_MODE
|
#define HAVE_BOOTLOADER_USB_MODE
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -114,6 +114,7 @@
|
||||||
#define USB_DEVBSS_ATTR __attribute__((aligned(32)))
|
#define USB_DEVBSS_ATTR __attribute__((aligned(32)))
|
||||||
#define HAVE_USB_POWER
|
#define HAVE_USB_POWER
|
||||||
#define HAVE_USB_CHARGING_ENABLE
|
#define HAVE_USB_CHARGING_ENABLE
|
||||||
|
#define HAVE_USB_CHARGING_IN_THREAD
|
||||||
#define TARGET_USB_CHARGING_DEFAULT USB_CHARGING_FORCE
|
#define TARGET_USB_CHARGING_DEFAULT USB_CHARGING_FORCE
|
||||||
#define HAVE_BOOTLOADER_USB_MODE
|
#define HAVE_BOOTLOADER_USB_MODE
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -104,6 +104,7 @@
|
||||||
#define USB_DEVBSS_ATTR __attribute__((aligned(32)))
|
#define USB_DEVBSS_ATTR __attribute__((aligned(32)))
|
||||||
#define HAVE_USB_POWER
|
#define HAVE_USB_POWER
|
||||||
#define HAVE_USB_CHARGING_ENABLE
|
#define HAVE_USB_CHARGING_ENABLE
|
||||||
|
#define HAVE_USB_CHARGING_IN_THREAD
|
||||||
#define HAVE_BOOTLOADER_USB_MODE
|
#define HAVE_BOOTLOADER_USB_MODE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -928,8 +928,14 @@ void usb_core_bus_reset(void)
|
||||||
usb_address = 0;
|
usb_address = 0;
|
||||||
usb_state = DEFAULT;
|
usb_state = DEFAULT;
|
||||||
#ifdef HAVE_USB_CHARGING_ENABLE
|
#ifdef HAVE_USB_CHARGING_ENABLE
|
||||||
|
#ifdef HAVE_USB_CHARGING_IN_THREAD
|
||||||
|
/* On some targets usb_charging_maxcurrent_change() cannot be called
|
||||||
|
* from an interrupt handler; get the USB thread to do it instead. */
|
||||||
|
usb_charger_update();
|
||||||
|
#else
|
||||||
usb_charging_maxcurrent_change(usb_charging_maxcurrent());
|
usb_charging_maxcurrent_change(usb_charging_maxcurrent());
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* called by usb_drv_transfer_completed() */
|
/* called by usb_drv_transfer_completed() */
|
||||||
|
|
Loading…
Reference in a new issue