Ilya Yanok | eb81955 | 2012-11-06 13:48:21 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This is used to for host and peripheral modes of the driver for |
| 3 | * Inventra (Multidrop) Highspeed Dual-Role Controllers: (M)HDRC. |
| 4 | * |
| 5 | * Board initialization should put one of these into dev->platform_data, |
| 6 | * probably on some platform_device named "musb-hdrc". It encapsulates |
| 7 | * key configuration differences between boards. |
| 8 | */ |
| 9 | |
| 10 | #ifndef __LINUX_USB_MUSB_H |
| 11 | #define __LINUX_USB_MUSB_H |
| 12 | |
| 13 | #ifndef __deprecated |
| 14 | #define __deprecated |
| 15 | #endif |
| 16 | |
Igor Grinberg | 09bab6e | 2014-10-23 14:25:25 +0300 | [diff] [blame] | 17 | #include <linux/compat.h> |
| 18 | |
Ilya Yanok | eb81955 | 2012-11-06 13:48:21 +0000 | [diff] [blame] | 19 | /* The USB role is defined by the connector used on the board, so long as |
| 20 | * standards are being followed. (Developer boards sometimes won't.) |
| 21 | */ |
| 22 | enum musb_mode { |
| 23 | MUSB_UNDEFINED = 0, |
| 24 | MUSB_HOST, /* A or Mini-A connector */ |
| 25 | MUSB_PERIPHERAL, /* B or Mini-B connector */ |
| 26 | MUSB_OTG /* Mini-AB connector */ |
| 27 | }; |
| 28 | |
| 29 | struct clk; |
| 30 | |
| 31 | enum musb_fifo_style { |
| 32 | FIFO_RXTX, |
| 33 | FIFO_TX, |
| 34 | FIFO_RX |
| 35 | } __attribute__ ((packed)); |
| 36 | |
| 37 | enum musb_buf_mode { |
| 38 | BUF_SINGLE, |
| 39 | BUF_DOUBLE |
| 40 | } __attribute__ ((packed)); |
| 41 | |
| 42 | struct musb_fifo_cfg { |
| 43 | u8 hw_ep_num; |
| 44 | enum musb_fifo_style style; |
| 45 | enum musb_buf_mode mode; |
| 46 | u16 maxpacket; |
| 47 | }; |
| 48 | |
| 49 | #define MUSB_EP_FIFO(ep, st, m, pkt) \ |
| 50 | { \ |
| 51 | .hw_ep_num = ep, \ |
| 52 | .style = st, \ |
| 53 | .mode = m, \ |
| 54 | .maxpacket = pkt, \ |
| 55 | } |
| 56 | |
| 57 | #define MUSB_EP_FIFO_SINGLE(ep, st, pkt) \ |
| 58 | MUSB_EP_FIFO(ep, st, BUF_SINGLE, pkt) |
| 59 | |
| 60 | #define MUSB_EP_FIFO_DOUBLE(ep, st, pkt) \ |
| 61 | MUSB_EP_FIFO(ep, st, BUF_DOUBLE, pkt) |
| 62 | |
| 63 | struct musb_hdrc_eps_bits { |
| 64 | const char name[16]; |
| 65 | u8 bits; |
| 66 | }; |
| 67 | |
| 68 | struct musb_hdrc_config { |
| 69 | struct musb_fifo_cfg *fifo_cfg; /* board fifo configuration */ |
| 70 | unsigned fifo_cfg_size; /* size of the fifo configuration */ |
| 71 | |
| 72 | /* MUSB configuration-specific details */ |
| 73 | unsigned multipoint:1; /* multipoint device */ |
| 74 | unsigned dyn_fifo:1 __deprecated; /* supports dynamic fifo sizing */ |
| 75 | unsigned soft_con:1 __deprecated; /* soft connect required */ |
| 76 | unsigned utm_16:1 __deprecated; /* utm data witdh is 16 bits */ |
| 77 | unsigned big_endian:1; /* true if CPU uses big-endian */ |
| 78 | unsigned mult_bulk_tx:1; /* Tx ep required for multbulk pkts */ |
| 79 | unsigned mult_bulk_rx:1; /* Rx ep required for multbulk pkts */ |
| 80 | unsigned high_iso_tx:1; /* Tx ep required for HB iso */ |
| 81 | unsigned high_iso_rx:1; /* Rx ep required for HD iso */ |
| 82 | unsigned dma:1 __deprecated; /* supports DMA */ |
| 83 | unsigned vendor_req:1 __deprecated; /* vendor registers required */ |
| 84 | |
| 85 | u8 num_eps; /* number of endpoints _with_ ep0 */ |
| 86 | u8 dma_channels __deprecated; /* number of dma channels */ |
| 87 | u8 dyn_fifo_size; /* dynamic size in bytes */ |
| 88 | u8 vendor_ctrl __deprecated; /* vendor control reg width */ |
| 89 | u8 vendor_stat __deprecated; /* vendor status reg witdh */ |
| 90 | u8 dma_req_chan __deprecated; /* bitmask for required dma channels */ |
| 91 | u8 ram_bits; /* ram address size */ |
| 92 | |
| 93 | struct musb_hdrc_eps_bits *eps_bits __deprecated; |
| 94 | #ifdef CONFIG_BLACKFIN |
| 95 | /* A GPIO controlling VRSEL in Blackfin */ |
| 96 | unsigned int gpio_vrsel; |
| 97 | unsigned int gpio_vrsel_active; |
| 98 | /* musb CLKIN in Blackfin in MHZ */ |
| 99 | unsigned char clkin; |
| 100 | #endif |
| 101 | |
| 102 | }; |
| 103 | |
| 104 | struct musb_hdrc_platform_data { |
| 105 | /* MUSB_HOST, MUSB_PERIPHERAL, or MUSB_OTG */ |
| 106 | u8 mode; |
| 107 | |
| 108 | /* for clk_get() */ |
| 109 | const char *clock; |
| 110 | |
| 111 | /* (HOST or OTG) switch VBUS on/off */ |
| 112 | int (*set_vbus)(struct device *dev, int is_on); |
| 113 | |
| 114 | /* (HOST or OTG) mA/2 power supplied on (default = 8mA) */ |
| 115 | u8 power; |
| 116 | |
| 117 | /* (PERIPHERAL) mA/2 max power consumed (default = 100mA) */ |
| 118 | u8 min_power; |
| 119 | |
| 120 | /* (HOST or OTG) msec/2 after VBUS on till power good */ |
| 121 | u8 potpgt; |
| 122 | |
| 123 | /* (HOST or OTG) program PHY for external Vbus */ |
| 124 | unsigned extvbus:1; |
| 125 | |
| 126 | /* Power the device on or off */ |
| 127 | int (*set_power)(int state); |
| 128 | |
| 129 | /* MUSB configuration-specific details */ |
| 130 | struct musb_hdrc_config *config; |
| 131 | |
| 132 | /* Architecture specific board data */ |
| 133 | void *board_data; |
| 134 | |
| 135 | /* Platform specific struct musb_ops pointer */ |
| 136 | const void *platform_ops; |
| 137 | }; |
| 138 | |
| 139 | |
| 140 | /* TUSB 6010 support */ |
| 141 | |
| 142 | #define TUSB6010_OSCCLK_60 16667 /* psec/clk @ 60.0 MHz */ |
| 143 | #define TUSB6010_REFCLK_24 41667 /* psec/clk @ 24.0 MHz XI */ |
| 144 | #define TUSB6010_REFCLK_19 52083 /* psec/clk @ 19.2 MHz CLKIN */ |
| 145 | |
| 146 | #ifdef CONFIG_ARCH_OMAP2 |
| 147 | |
| 148 | extern int __init tusb6010_setup_interface( |
| 149 | struct musb_hdrc_platform_data *data, |
| 150 | unsigned ps_refclk, unsigned waitpin, |
| 151 | unsigned async_cs, unsigned sync_cs, |
| 152 | unsigned irq, unsigned dmachan); |
| 153 | |
| 154 | extern int tusb6010_platform_retime(unsigned is_refclk); |
| 155 | |
| 156 | #endif /* OMAP2 */ |
| 157 | |
| 158 | /* |
| 159 | * U-Boot specfic stuff |
| 160 | */ |
| 161 | int musb_register(struct musb_hdrc_platform_data *plat, void *bdata, |
| 162 | void *ctl_regs); |
| 163 | |
| 164 | #endif /* __LINUX_USB_MUSB_H */ |