* messages similar to the usb 2.0 spec for hub control and
* status. For these systems it may be necessary to write
* function to decode standard usb control messages into
- * equivalent cvmx-usb API calls. As an example, the following
- * code is used under Linux for some of the basic hub control
- * messages.
- *
- * @code
- * static int octeon_usb_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, u16 wIndex, char *buf, u16 wLength)
- * {
- * cvmx_usb_state_t *usb = (cvmx_usb_state_t *)hcd->hcd_priv;
- * cvmx_usb_port_status_t usb_port_status;
- * int port_status;
- * struct usb_hub_descriptor *desc;
- * unsigned long flags;
- *
- * switch (typeReq)
- * {
- * case ClearHubFeature:
- * DEBUG_ROOT_HUB("OcteonUSB: ClearHubFeature\n");
- * switch (wValue)
- * {
- * case C_HUB_LOCAL_POWER:
- * case C_HUB_OVER_CURRENT:
- * // Nothing required here
- * break;
- * default:
- * return -EINVAL;
- * }
- * break;
- * case ClearPortFeature:
- * DEBUG_ROOT_HUB("OcteonUSB: ClearPortFeature");
- * if (wIndex != 1)
- * {
- * DEBUG_ROOT_HUB(" INVALID\n");
- * return -EINVAL;
- * }
- *
- * switch (wValue)
- * {
- * case USB_PORT_FEAT_ENABLE:
- * DEBUG_ROOT_HUB(" ENABLE");
- * local_irq_save(flags);
- * cvmx_usb_disable(usb);
- * local_irq_restore(flags);
- * break;
- * case USB_PORT_FEAT_SUSPEND:
- * DEBUG_ROOT_HUB(" SUSPEND");
- * // Not supported on Octeon
- * break;
- * case USB_PORT_FEAT_POWER:
- * DEBUG_ROOT_HUB(" POWER");
- * // Not supported on Octeon
- * break;
- * case USB_PORT_FEAT_INDICATOR:
- * DEBUG_ROOT_HUB(" INDICATOR");
- * // Port inidicator not supported
- * break;
- * case USB_PORT_FEAT_C_CONNECTION:
- * DEBUG_ROOT_HUB(" C_CONNECTION");
- * // Clears drivers internal connect status change flag
- * cvmx_usb_set_status(usb, cvmx_usb_get_status(usb));
- * break;
- * case USB_PORT_FEAT_C_RESET:
- * DEBUG_ROOT_HUB(" C_RESET");
- * // Clears the driver's internal Port Reset Change flag
- * cvmx_usb_set_status(usb, cvmx_usb_get_status(usb));
- * break;
- * case USB_PORT_FEAT_C_ENABLE:
- * DEBUG_ROOT_HUB(" C_ENABLE");
- * // Clears the driver's internal Port Enable/Disable Change flag
- * cvmx_usb_set_status(usb, cvmx_usb_get_status(usb));
- * break;
- * case USB_PORT_FEAT_C_SUSPEND:
- * DEBUG_ROOT_HUB(" C_SUSPEND");
- * // Clears the driver's internal Port Suspend Change flag,
- * which is set when resume signaling on the host port is
- * complete
- * break;
- * case USB_PORT_FEAT_C_OVER_CURRENT:
- * DEBUG_ROOT_HUB(" C_OVER_CURRENT");
- * // Clears the driver's overcurrent Change flag
- * cvmx_usb_set_status(usb, cvmx_usb_get_status(usb));
- * break;
- * default:
- * DEBUG_ROOT_HUB(" UNKNOWN\n");
- * return -EINVAL;
- * }
- * DEBUG_ROOT_HUB("\n");
- * break;
- * case GetHubDescriptor:
- * DEBUG_ROOT_HUB("OcteonUSB: GetHubDescriptor\n");
- * desc = (struct usb_hub_descriptor *)buf;
- * desc->bDescLength = 9;
- * desc->bDescriptorType = 0x29;
- * desc->bNbrPorts = 1;
- * desc->wHubCharacteristics = 0x08;
- * desc->bPwrOn2PwrGood = 1;
- * desc->bHubContrCurrent = 0;
- * desc->bitmap[0] = 0;
- * desc->bitmap[1] = 0xff;
- * break;
- * case GetHubStatus:
- * DEBUG_ROOT_HUB("OcteonUSB: GetHubStatus\n");
- * *(__le32 *)buf = 0;
- * break;
- * case GetPortStatus:
- * DEBUG_ROOT_HUB("OcteonUSB: GetPortStatus");
- * if (wIndex != 1)
- * {
- * DEBUG_ROOT_HUB(" INVALID\n");
- * return -EINVAL;
- * }
- *
- * usb_port_status = cvmx_usb_get_status(usb);
- * port_status = 0;
- *
- * if (usb_port_status.connect_change)
- * {
- * port_status |= (1 << USB_PORT_FEAT_C_CONNECTION);
- * DEBUG_ROOT_HUB(" C_CONNECTION");
- * }
- *
- * if (usb_port_status.port_enabled)
- * {
- * port_status |= (1 << USB_PORT_FEAT_C_ENABLE);
- * DEBUG_ROOT_HUB(" C_ENABLE");
- * }
- *
- * if (usb_port_status.connected)
- * {
- * port_status |= (1 << USB_PORT_FEAT_CONNECTION);
- * DEBUG_ROOT_HUB(" CONNECTION");
- * }
- *
- * if (usb_port_status.port_enabled)
- * {
- * port_status |= (1 << USB_PORT_FEAT_ENABLE);
- * DEBUG_ROOT_HUB(" ENABLE");
- * }
- *
- * if (usb_port_status.port_over_current)
- * {
- * port_status |= (1 << USB_PORT_FEAT_OVER_CURRENT);
- * DEBUG_ROOT_HUB(" OVER_CURRENT");
- * }
- *
- * if (usb_port_status.port_powered)
- * {
- * port_status |= (1 << USB_PORT_FEAT_POWER);
- * DEBUG_ROOT_HUB(" POWER");
- * }
- *
- * if (usb_port_status.port_speed == CVMX_USB_SPEED_HIGH)
- * {
- * port_status |= (1 << USB_PORT_FEAT_HIGHSPEED);
- * DEBUG_ROOT_HUB(" HIGHSPEED");
- * }
- * else if (usb_port_status.port_speed == CVMX_USB_SPEED_LOW)
- * {
- * port_status |= (1 << USB_PORT_FEAT_LOWSPEED);
- * DEBUG_ROOT_HUB(" LOWSPEED");
- * }
- *
- * *((__le32 *)buf) = cpu_to_le32(port_status);
- * DEBUG_ROOT_HUB("\n");
- * break;
- * case SetHubFeature:
- * DEBUG_ROOT_HUB("OcteonUSB: SetHubFeature\n");
- * // No HUB features supported
- * break;
- * case SetPortFeature:
- * DEBUG_ROOT_HUB("OcteonUSB: SetPortFeature");
- * if (wIndex != 1)
- * {
- * DEBUG_ROOT_HUB(" INVALID\n");
- * return -EINVAL;
- * }
- *
- * switch (wValue)
- * {
- * case USB_PORT_FEAT_SUSPEND:
- * DEBUG_ROOT_HUB(" SUSPEND\n");
- * return -EINVAL;
- * case USB_PORT_FEAT_POWER:
- * DEBUG_ROOT_HUB(" POWER\n");
- * return -EINVAL;
- * case USB_PORT_FEAT_RESET:
- * DEBUG_ROOT_HUB(" RESET\n");
- * local_irq_save(flags);
- * cvmx_usb_disable(usb);
- * if (cvmx_usb_enable(usb))
- * DEBUG_ERROR("Failed to enable the port\n");
- * local_irq_restore(flags);
- * return 0;
- * case USB_PORT_FEAT_INDICATOR:
- * DEBUG_ROOT_HUB(" INDICATOR\n");
- * // Not supported
- * break;
- * default:
- * DEBUG_ROOT_HUB(" UNKNOWN\n");
- * return -EINVAL;
- * }
- * break;
- * default:
- * DEBUG_ROOT_HUB("OcteonUSB: Unknown root hub request\n");
- * return -EINVAL;
- * }
- * return 0;
- * }
- * @endcode
+ * equivalent cvmx-usb API calls.
*
* <h2>Interrupts</h2>
*