nand: gpmc: Handle bitflips in erased pages when using BCH ECC engine
[platform/kernel/u-boot.git] / include / usb.h
index b6b48a8..b3851fd 100644 (file)
@@ -103,7 +103,7 @@ enum {
  */
 struct usb_device {
        int     devnum;                 /* Device number on USB bus */
-       int     speed;                  /* full/low/high */
+       enum usb_device_speed speed;    /* full/low/high */
        char    mf[32];                 /* manufacturer */
        char    prod[32];               /* product */
        char    serial[32];             /* serial number */
@@ -140,7 +140,7 @@ struct usb_device {
        int act_len;                    /* transferred bytes */
        int maxchild;                   /* Number of ports if hub */
        int portnr;                     /* Port number, 1=first */
-#ifndef CONFIG_DM_USB
+#if !CONFIG_IS_ENABLED(DM_USB)
        /* parent hub, or NULL if this is the root hub */
        struct usb_device *parent;
        struct usb_device *children[USB_MAXCHILDREN];
@@ -148,7 +148,7 @@ struct usb_device {
 #endif
        /* slot_id - for xHCI enabled devices */
        unsigned int slot_id;
-#ifdef CONFIG_DM_USB
+#if CONFIG_IS_ENABLED(DM_USB)
        struct udevice *dev;            /* Pointer to associated device */
        struct udevice *controller_dev; /* Pointer to associated controller */
 #endif
@@ -173,7 +173,7 @@ enum usb_init_type {
 int usb_lowlevel_init(int index, enum usb_init_type init, void **controller);
 int usb_lowlevel_stop(int index);
 
-#if defined(CONFIG_USB_MUSB_HOST) || defined(CONFIG_DM_USB)
+#if defined(CONFIG_USB_MUSB_HOST) || CONFIG_IS_ENABLED(DM_USB)
 int usb_reset_root_port(struct usb_device *dev);
 #else
 #define usb_reset_root_port(dev)
@@ -184,10 +184,10 @@ int submit_bulk_msg(struct usb_device *dev, unsigned long pipe,
 int submit_control_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
                        int transfer_len, struct devrequest *setup);
 int submit_int_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
-                       int transfer_len, int interval);
+                       int transfer_len, int interval, bool nonblock);
 
 #if defined CONFIG_USB_EHCI_HCD || defined CONFIG_USB_MUSB_HOST \
-       || defined(CONFIG_DM_USB)
+       || CONFIG_IS_ENABLED(DM_USB)
 struct int_queue *create_int_queue(struct usb_device *dev, unsigned long pipe,
        int queuesize, int elementsize, void *buffer, int interval);
 int destroy_int_queue(struct usb_device *dev, struct int_queue *queue);
@@ -242,6 +242,12 @@ int usb_host_eth_scan(int mode);
 
 #ifdef CONFIG_USB_KEYBOARD
 
+/*
+ * USB Keyboard reports are 8 bytes in boot protocol.
+ * Appendix B of HID Device Class Definition 1.11
+ */
+#define USB_KBD_BOOT_REPORT_SIZE 8
+
 int drv_usb_kbd_init(void);
 int usb_kbd_deregister(int force);
 
@@ -261,8 +267,9 @@ int usb_control_msg(struct usb_device *dev, unsigned int pipe,
                        void *data, unsigned short size, int timeout);
 int usb_bulk_msg(struct usb_device *dev, unsigned int pipe,
                        void *data, int len, int *actual_length, int timeout);
-int usb_submit_int_msg(struct usb_device *dev, unsigned long pipe,
-                       void *buffer, int transfer_len, int interval);
+int usb_int_msg(struct usb_device *dev, unsigned long pipe,
+               void *buffer, int transfer_len, int interval, bool nonblock);
+int usb_lock_async(struct usb_device *dev, int lock);
 int usb_disable_asynch(int disable);
 int usb_maxpacket(struct usb_device *dev, unsigned long pipe);
 int usb_get_configuration_no(struct usb_device *dev, int cfgno,
@@ -588,20 +595,20 @@ struct usb_hub_device {
        struct usb_tt tt;               /* Transaction Translator */
 };
 
-#ifdef CONFIG_DM_USB
+#if CONFIG_IS_ENABLED(DM_USB)
 /**
- * struct usb_platdata - Platform data about a USB controller
+ * struct usb_plat - Platform data about a USB controller
  *
- * Given a USB controller (UCLASS_USB) dev this is dev_get_platdata(dev)
+ * Given a USB controller (UCLASS_USB) dev this is dev_get_plat(dev)
  */
-struct usb_platdata {
+struct usb_plat {
        enum usb_init_type init_type;
 };
 
 /**
- * struct usb_dev_platdata - Platform data about a USB device
+ * struct usb_dev_plat - Platform data about a USB device
  *
- * Given a USB device dev this structure is dev_get_parent_platdata(dev).
+ * Given a USB device dev this structure is dev_get_parent_plat(dev).
  * This is used by sandbox to provide emulation data also.
  *
  * @id:                ID used to match this device
@@ -610,7 +617,7 @@ struct usb_platdata {
  * @strings:   List of descriptor strings (for sandbox emulation purposes)
  * @desc_list: List of descriptors (for sandbox emulation purposes)
  */
-struct usb_dev_platdata {
+struct usb_dev_plat {
        struct usb_device_id id;
        int devnum;
        /*
@@ -652,14 +659,14 @@ struct usb_bus_priv {
 };
 
 /**
- * struct usb_emul_platdata - platform data about the USB emulator
+ * struct usb_emul_plat - platform data about the USB emulator
  *
  * Given a USB emulator (UCLASS_USB_EMUL) 'dev', this is
- * dev_get_uclass_platdata(dev).
+ * dev_get_uclass_plat(dev).
  *
  * @port1:     USB emulator device port number on the parent hub
  */
-struct usb_emul_platdata {
+struct usb_emul_plat {
        int port1;      /* Port number (numbered from 1) */
 };
 
@@ -708,7 +715,7 @@ struct dm_usb_ops {
         */
        int (*interrupt)(struct udevice *bus, struct usb_device *udev,
                         unsigned long pipe, void *buffer, int length,
-                        int interval);
+                        int interval, bool nonblock);
 
        /**
         * create_int_queue() - Create and queue interrupt packets
@@ -785,6 +792,16 @@ struct dm_usb_ops {
         * in a USB transfer. USB class driver needs to be aware of this.
         */
        int (*get_max_xfer_size)(struct udevice *bus, size_t *size);
+
+       /**
+        * lock_async() - Keep async schedule after a transfer
+        *
+        * It may be desired to keep the asynchronous schedule running even
+        * after a transfer finishes, usually when doing multiple transfers
+        * back-to-back. This callback allows signalling the USB controller
+        * driver to do just that.
+        */
+       int (*lock_async)(struct udevice *udev, int lock);
 };
 
 #define usb_get_ops(dev)       ((struct dm_usb_ops *)(dev)->driver->ops)
@@ -905,6 +922,15 @@ struct ehci_ctrl;
 int usb_setup_ehci_gadget(struct ehci_ctrl **ctlrp);
 
 /**
+ * usb_remove_ehci_gadget() - Remove a gadget USB device
+ *
+ * TODO(sjg@chromium.org): Tidy this up when USB gadgets can use driver model
+ *
+ * This provides a way to tell a controller to remove a USB device
+ */
+int usb_remove_ehci_gadget(struct ehci_ctrl **ctlrp);
+
+/**
  * usb_stor_reset() - Prepare to scan USB storage devices
  *
  * Empty the list of USB storage devices in preparation for scanning them.
@@ -912,7 +938,7 @@ int usb_setup_ehci_gadget(struct ehci_ctrl **ctlrp);
  */
 void usb_stor_reset(void);
 
-#else /* !CONFIG_DM_USB */
+#else /* !CONFIG_IS_ENABLED(DM_USB) */
 
 struct usb_device *usb_get_dev_index(int index);
 
@@ -1029,7 +1055,8 @@ int usb_emul_bulk(struct udevice *emul, struct usb_device *udev,
  * @return 0 if OK, -ve on error
  */
 int usb_emul_int(struct udevice *emul, struct usb_device *udev,
-                 unsigned long pipe, void *buffer, int length, int interval);
+                 unsigned long pipe, void *buffer, int length, int interval,
+                 bool nonblock);
 
 /**
  * usb_emul_find() - Find an emulator for a particular device