Thomas Abraham | 38f424f | 2009-01-04 09:41:03 +0530 | [diff] [blame] | 1 | /* |
| 2 | * Mentor USB OTG Core host controller driver. |
| 3 | * |
| 4 | * Copyright (c) 2008 Texas Instruments |
| 5 | * |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 6 | * SPDX-License-Identifier: GPL-2.0+ |
Thomas Abraham | 38f424f | 2009-01-04 09:41:03 +0530 | [diff] [blame] | 7 | * |
| 8 | * Author: Thomas Abraham t-abraham@ti.com, Texas Instruments |
| 9 | */ |
| 10 | |
| 11 | #ifndef __MUSB_HCD_H__ |
| 12 | #define __MUSB_HCD_H__ |
| 13 | |
| 14 | #include "musb_core.h" |
| 15 | #ifdef CONFIG_USB_KEYBOARD |
Jean-Christophe PLAGNIOL-VILLARD | 2a7a031 | 2009-05-16 12:14:54 +0200 | [diff] [blame] | 16 | #include <stdio_dev.h> |
Thomas Abraham | 38f424f | 2009-01-04 09:41:03 +0530 | [diff] [blame] | 17 | extern unsigned char new[]; |
| 18 | #endif |
| 19 | |
Bryan Wu | 3169ce8 | 2009-06-16 05:26:27 -0400 | [diff] [blame] | 20 | #ifndef CONFIG_MUSB_TIMEOUT |
| 21 | # define CONFIG_MUSB_TIMEOUT 100000 |
| 22 | #endif |
| 23 | |
Thomas Abraham | 38f424f | 2009-01-04 09:41:03 +0530 | [diff] [blame] | 24 | /* This defines the endpoint number used for control transfers */ |
| 25 | #define MUSB_CONTROL_EP 0 |
| 26 | |
| 27 | /* This defines the endpoint number used for bulk transfer */ |
Bryan Wu | e956f34 | 2009-12-16 22:04:02 -0500 | [diff] [blame] | 28 | #ifndef MUSB_BULK_EP |
| 29 | # define MUSB_BULK_EP 1 |
| 30 | #endif |
Thomas Abraham | 38f424f | 2009-01-04 09:41:03 +0530 | [diff] [blame] | 31 | |
| 32 | /* This defines the endpoint number used for interrupt transfer */ |
| 33 | #define MUSB_INTR_EP 2 |
| 34 | |
| 35 | /* Determine the operating speed of MUSB core */ |
| 36 | #define musb_ishighspeed() \ |
| 37 | ((readb(&musbr->power) & MUSB_POWER_HSMODE) \ |
| 38 | >> MUSB_POWER_HSMODE_SHIFT) |
| 39 | |
Bryan Wu | 73073cc | 2010-01-09 16:53:54 -0500 | [diff] [blame] | 40 | #define min_t(type, x, y) \ |
| 41 | ({ type __x = (x); type __y = (y); __x < __y ? __x : __y; }) |
| 42 | |
| 43 | /* USB HUB CONSTANTS (not OHCI-specific; see hub.h) */ |
| 44 | |
| 45 | /* destination of request */ |
| 46 | #define RH_INTERFACE 0x01 |
| 47 | #define RH_ENDPOINT 0x02 |
| 48 | #define RH_OTHER 0x03 |
| 49 | |
| 50 | #define RH_CLASS 0x20 |
| 51 | #define RH_VENDOR 0x40 |
| 52 | |
| 53 | /* Requests: bRequest << 8 | bmRequestType */ |
| 54 | #define RH_GET_STATUS 0x0080 |
| 55 | #define RH_CLEAR_FEATURE 0x0100 |
| 56 | #define RH_SET_FEATURE 0x0300 |
| 57 | #define RH_SET_ADDRESS 0x0500 |
| 58 | #define RH_GET_DESCRIPTOR 0x0680 |
| 59 | #define RH_SET_DESCRIPTOR 0x0700 |
| 60 | #define RH_GET_CONFIGURATION 0x0880 |
| 61 | #define RH_SET_CONFIGURATION 0x0900 |
| 62 | #define RH_GET_STATE 0x0280 |
| 63 | #define RH_GET_INTERFACE 0x0A80 |
| 64 | #define RH_SET_INTERFACE 0x0B00 |
| 65 | #define RH_SYNC_FRAME 0x0C80 |
| 66 | /* Our Vendor Specific Request */ |
| 67 | #define RH_SET_EP 0x2000 |
| 68 | |
| 69 | /* Hub port features */ |
| 70 | #define RH_PORT_CONNECTION 0x00 |
| 71 | #define RH_PORT_ENABLE 0x01 |
| 72 | #define RH_PORT_SUSPEND 0x02 |
| 73 | #define RH_PORT_OVER_CURRENT 0x03 |
| 74 | #define RH_PORT_RESET 0x04 |
| 75 | #define RH_PORT_POWER 0x08 |
| 76 | #define RH_PORT_LOW_SPEED 0x09 |
| 77 | |
| 78 | #define RH_C_PORT_CONNECTION 0x10 |
| 79 | #define RH_C_PORT_ENABLE 0x11 |
| 80 | #define RH_C_PORT_SUSPEND 0x12 |
| 81 | #define RH_C_PORT_OVER_CURRENT 0x13 |
| 82 | #define RH_C_PORT_RESET 0x14 |
| 83 | |
| 84 | /* Hub features */ |
| 85 | #define RH_C_HUB_LOCAL_POWER 0x00 |
| 86 | #define RH_C_HUB_OVER_CURRENT 0x01 |
| 87 | |
| 88 | #define RH_DEVICE_REMOTE_WAKEUP 0x00 |
| 89 | #define RH_ENDPOINT_STALL 0x01 |
| 90 | |
| 91 | #define RH_ACK 0x01 |
| 92 | #define RH_REQ_ERR -1 |
| 93 | #define RH_NACK 0x00 |
| 94 | |
Thomas Abraham | 38f424f | 2009-01-04 09:41:03 +0530 | [diff] [blame] | 95 | /* extern functions */ |
| 96 | extern int musb_platform_init(void); |
| 97 | extern void musb_platform_deinit(void); |
| 98 | |
| 99 | #endif /* __MUSB_HCD_H__ */ |