123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- /*
- * @file hv_drv_UsbMusb.h
- * @brief This is used to for host and peripheral modes of the driver for
- * Inventra (Multidrop) Highspeed Dual-Role Controllers: (M)HDRC.
- *
- * Board initialization should put one of these into dev->platform_data,
- * probably on some platform_device named "musb-hdrc". It encapsulates
- * key configuration differences between boards.
- *
- * @author HiView SoC Software Team
- * @version 1.0.0
- * @date 2022-06-15
- */
- #ifndef __HV_DRV_USB_MUSB_H_
- #define __HV_DRV_USB_MUSB_H_
- #include "hv_drv_UsbCompat.h"
- /* The USB role is defined by the connector used on the board, so long as
- * standards are being followed. (Developer boards sometimes won't.)
- */
- enum musb_mode {
- MUSB_UNDEFINED = 0,
- MUSB_HOST, /* A or Mini-A connector */
- MUSB_PERIPHERAL, /* B or Mini-B connector */
- MUSB_OTG /* Mini-AB connector */
- };
- struct clk;
- enum musb_fifo_style {
- FIFO_RXTX,
- FIFO_TX,
- FIFO_RX
- } __attribute__ ((packed));
- enum musb_buf_mode {
- BUF_SINGLE,
- BUF_DOUBLE
- } __attribute__ ((packed));
- struct musb_fifo_cfg {
- u8 hw_ep_num;
- enum musb_fifo_style style;
- enum musb_buf_mode mode;
- u16 maxpacket;
- };
- #define MUSB_EP_FIFO(ep, st, m, pkt) \
- { \
- .hw_ep_num = ep, \
- .style = st, \
- .mode = m, \
- .maxpacket = pkt, \
- }
- #define MUSB_EP_FIFO_SINGLE(ep, st, pkt) \
- MUSB_EP_FIFO(ep, st, BUF_SINGLE, pkt)
- #define MUSB_EP_FIFO_DOUBLE(ep, st, pkt) \
- MUSB_EP_FIFO(ep, st, BUF_DOUBLE, pkt)
- struct musb_hdrc_eps_bits {
- const char name[16];
- u8 bits;
- };
- struct musb_hdrc_config {
- struct musb_fifo_cfg *fifo_cfg; /* board fifo configuration */
- unsigned fifo_cfg_size; /* size of the fifo configuration */
- /* MUSB configuration-specific details */
- unsigned multipoint:1; /* multipoint device */
- unsigned dyn_fifo:1; /* supports dynamic fifo sizing */
- unsigned soft_con:1; /* soft connect required */
- unsigned utm_16:1; /* utm data witdh is 16 bits */
- unsigned big_endian:1; /* true if CPU uses big-endian */
- unsigned mult_bulk_tx:1; /* Tx ep required for multbulk pkts */
- unsigned mult_bulk_rx:1; /* Rx ep required for multbulk pkts */
- unsigned high_iso_tx:1; /* Tx ep required for HB iso */
- unsigned high_iso_rx:1; /* Rx ep required for HD iso */
- unsigned dma:1; /* supports DMA */
- unsigned vendor_req:1; /* vendor registers required */
- u8 num_eps; /* number of endpoints _with_ ep0 */
- u8 dma_channels; /* number of dma channels */
- u8 dyn_fifo_size; /* dynamic size in bytes */
- u8 vendor_ctrl; /* vendor control reg width */
- u8 vendor_stat; /* vendor status reg witdh */
- u8 dma_req_chan; /* bitmask for required dma channels */
- u8 ram_bits; /* ram address size */
- struct musb_hdrc_eps_bits *eps_bits;
- };
- struct musb_hdrc_platform_data {
- /* MUSB_HOST, MUSB_PERIPHERAL, or MUSB_OTG */
- u8 mode;
- /* for clk_get() */
- const char *clock;
- /* (HOST or OTG) switch VBUS on/off */
- int (*set_vbus)(struct device *dev, int is_on);
- /* (HOST or OTG) mA/2 power supplied on (default = 8mA) */
- u8 power;
- /* (PERIPHERAL) mA/2 max power consumed (default = 100mA) */
- u8 min_power;
- /* (HOST or OTG) msec/2 after VBUS on till power good */
- u8 potpgt;
- /* (HOST or OTG) program PHY for external Vbus */
- unsigned extvbus:1;
- /* Power the device on or off */
- int (*set_power)(int state);
- /* MUSB configuration-specific details */
- struct musb_hdrc_config *config;
- /* Architecture specific board data */
- void *board_data;
- /* Platform specific struct musb_ops pointer */
- const void *platform_ops;
- };
- /*
- * U-Boot specfic stuff
- */
- int musb_register(struct musb_hdrc_platform_data *plat, void *bdata, void *ctl_regs);
- #endif
|