Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
fork

Configure Feed

Select the types of activity you want to include in your feed.

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