Felipe Balbi | 550a737 | 2008-07-24 12:27:36 +0300 | [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 | |
Mark A. Greer | fbfc396 | 2009-04-21 20:52:54 -0700 | [diff] [blame] | 10 | #ifndef __LINUX_USB_MUSB_H |
| 11 | #define __LINUX_USB_MUSB_H |
| 12 | |
Felipe Balbi | 550a737 | 2008-07-24 12:27:36 +0300 | [diff] [blame] | 13 | /* The USB role is defined by the connector used on the board, so long as |
| 14 | * standards are being followed. (Developer boards sometimes won't.) |
| 15 | */ |
| 16 | enum musb_mode { |
| 17 | MUSB_UNDEFINED = 0, |
| 18 | MUSB_HOST, /* A or Mini-A connector */ |
| 19 | MUSB_PERIPHERAL, /* B or Mini-B connector */ |
| 20 | MUSB_OTG /* Mini-AB connector */ |
| 21 | }; |
| 22 | |
| 23 | struct clk; |
| 24 | |
Felipe Balbi | ca6d1b1 | 2008-08-08 12:40:54 +0300 | [diff] [blame] | 25 | struct musb_hdrc_eps_bits { |
| 26 | const char name[16]; |
| 27 | u8 bits; |
| 28 | }; |
| 29 | |
| 30 | struct musb_hdrc_config { |
| 31 | /* MUSB configuration-specific details */ |
| 32 | unsigned multipoint:1; /* multipoint device */ |
| 33 | unsigned dyn_fifo:1; /* supports dynamic fifo sizing */ |
| 34 | unsigned soft_con:1; /* soft connect required */ |
| 35 | unsigned utm_16:1; /* utm data witdh is 16 bits */ |
| 36 | unsigned big_endian:1; /* true if CPU uses big-endian */ |
| 37 | unsigned mult_bulk_tx:1; /* Tx ep required for multbulk pkts */ |
| 38 | unsigned mult_bulk_rx:1; /* Rx ep required for multbulk pkts */ |
| 39 | unsigned high_iso_tx:1; /* Tx ep required for HB iso */ |
| 40 | unsigned high_iso_rx:1; /* Rx ep required for HD iso */ |
| 41 | unsigned dma:1; /* supports DMA */ |
| 42 | unsigned vendor_req:1; /* vendor registers required */ |
| 43 | |
| 44 | u8 num_eps; /* number of endpoints _with_ ep0 */ |
| 45 | u8 dma_channels; /* number of dma channels */ |
| 46 | u8 dyn_fifo_size; /* dynamic size in bytes */ |
| 47 | u8 vendor_ctrl; /* vendor control reg width */ |
| 48 | u8 vendor_stat; /* vendor status reg witdh */ |
| 49 | u8 dma_req_chan; /* bitmask for required dma channels */ |
| 50 | u8 ram_bits; /* ram address size */ |
| 51 | |
| 52 | struct musb_hdrc_eps_bits *eps_bits; |
Bryan Wu | 2ffcdb3 | 2008-12-02 21:33:43 +0200 | [diff] [blame] | 53 | #ifdef CONFIG_BLACKFIN |
| 54 | /* A GPIO controlling VRSEL in Blackfin */ |
| 55 | unsigned int gpio_vrsel; |
| 56 | #endif |
| 57 | |
Felipe Balbi | ca6d1b1 | 2008-08-08 12:40:54 +0300 | [diff] [blame] | 58 | }; |
| 59 | |
Felipe Balbi | 550a737 | 2008-07-24 12:27:36 +0300 | [diff] [blame] | 60 | struct musb_hdrc_platform_data { |
| 61 | /* MUSB_HOST, MUSB_PERIPHERAL, or MUSB_OTG */ |
| 62 | u8 mode; |
| 63 | |
| 64 | /* for clk_get() */ |
| 65 | const char *clock; |
| 66 | |
| 67 | /* (HOST or OTG) switch VBUS on/off */ |
| 68 | int (*set_vbus)(struct device *dev, int is_on); |
| 69 | |
| 70 | /* (HOST or OTG) mA/2 power supplied on (default = 8mA) */ |
| 71 | u8 power; |
| 72 | |
| 73 | /* (PERIPHERAL) mA/2 max power consumed (default = 100mA) */ |
| 74 | u8 min_power; |
| 75 | |
| 76 | /* (HOST or OTG) msec/2 after VBUS on till power good */ |
| 77 | u8 potpgt; |
| 78 | |
Felipe Balbi | 550a737 | 2008-07-24 12:27:36 +0300 | [diff] [blame] | 79 | /* Power the device on or off */ |
| 80 | int (*set_power)(int state); |
| 81 | |
| 82 | /* Turn device clock on or off */ |
| 83 | int (*set_clock)(struct clk *clock, int is_on); |
Felipe Balbi | ca6d1b1 | 2008-08-08 12:40:54 +0300 | [diff] [blame] | 84 | |
| 85 | /* MUSB configuration-specific details */ |
| 86 | struct musb_hdrc_config *config; |
Maulik Mankad | 884b836 | 2010-02-17 14:09:30 -0800 | [diff] [blame^] | 87 | |
| 88 | /* Architecture specific board data */ |
| 89 | void *board_data; |
Felipe Balbi | 550a737 | 2008-07-24 12:27:36 +0300 | [diff] [blame] | 90 | }; |
| 91 | |
| 92 | |
| 93 | /* TUSB 6010 support */ |
| 94 | |
| 95 | #define TUSB6010_OSCCLK_60 16667 /* psec/clk @ 60.0 MHz */ |
| 96 | #define TUSB6010_REFCLK_24 41667 /* psec/clk @ 24.0 MHz XI */ |
| 97 | #define TUSB6010_REFCLK_19 52083 /* psec/clk @ 19.2 MHz CLKIN */ |
| 98 | |
| 99 | #ifdef CONFIG_ARCH_OMAP2 |
| 100 | |
| 101 | extern int __init tusb6010_setup_interface( |
| 102 | struct musb_hdrc_platform_data *data, |
| 103 | unsigned ps_refclk, unsigned waitpin, |
| 104 | unsigned async_cs, unsigned sync_cs, |
| 105 | unsigned irq, unsigned dmachan); |
| 106 | |
| 107 | extern int tusb6010_platform_retime(unsigned is_refclk); |
| 108 | |
| 109 | #endif /* OMAP2 */ |
Mark A. Greer | fbfc396 | 2009-04-21 20:52:54 -0700 | [diff] [blame] | 110 | |
| 111 | #endif /* __LINUX_USB_MUSB_H */ |