#include <linux/smp_lock.h>
#include <linux/errno.h>
#include <linux/device.h>
-#include <linux/usb_ch9.h>
+#include <linux/usb/ch9.h>
#include <linux/usb_gadget.h>
#include <linux/usb.h>
#include <linux/usb/otg.h>
#endif
/* host side ep0 states */
-#define MGC_END0_START 0x0
-#define MGC_END0_OUT 0x2
-#define MGC_END0_IN 0x4
-#define MGC_END0_STATUS 0x8
+enum musb_h_ep0_state {
+ MGC_END0_IDLE,
+ MGC_END0_START, /* expect ack of setup */
+ MGC_END0_IN, /* expect IN DATA */
+ MGC_END0_OUT, /* expect ack of OUT DATA */
+ MGC_END0_STATUS, /* expect ack of STATUS */
+} __attribute__ ((packed));
/* peripheral side ep0 states */
enum musb_g_ep0_state {
u32 port1_status;
unsigned long rh_timer;
- u8 bEnd0Stage; /* end0 stage while in host */
+ enum musb_h_ep0_state bEnd0Stage;
/* bulk traffic normally dedicates endpoint hardware, and each
* direction has its own ring of host side endpoints.
u8 min_power; /* vbus for periph, in mA/2 */
/* active means connected and not suspended */
- unsigned is_active:1;
+ unsigned is_active:1;
unsigned bIsMultipoint:1;
unsigned bIsHost:1;
#endif
#ifdef CONFIG_USB_GADGET_MUSB_HDRC
- unsigned bIsSelfPowered:1;
- unsigned bMayWakeup:1;
+ /* is_suspended means USB B_PERIPHERAL suspend */
+ unsigned is_suspended:1;
+
+ /* may_wakeup means remote wakeup is enabled */
+ unsigned may_wakeup:1;
+
+ /* is_self_powered is reported in device status and the
+ * config descriptor. is_bus_powered means B_PERIPHERAL
+ * draws some VBUS current; both can be true.
+ */
+ unsigned is_self_powered:1;
+ unsigned is_bus_powered:1;
+
unsigned bSetAddress:1;
unsigned bTestMode:1;
unsigned softconnect:1;