Commit e80f558912491b096484b8bbb029842a2150aeb6

Authored by Ravi Babu
1 parent b9923dd9ac

usb: musb: cppi41: g_multi gadget fixes in dma mode

- bug fixes for schedular table add_(remove) channel API's
- adds the sched_tbl_control flag to add/remove channel dynamically.
- This fixes the g_multi gadget issue.

Signed-off-by: Ravi Babu <ravibabu@ti.com>

Showing 5 changed files with 24 additions and 17 deletions Side-by-side Diff

drivers/usb/musb/cppi41.c
... ... @@ -70,17 +70,7 @@
70 70 u8 enb;
71 71 };
72 72  
73   -struct cppi41_dma_sched_tbl_t dma_sched_tbl[MAX_SCHED_TBL_ENTRY] = {
74   - /*pos dma_ch# is_tx enb/dis*/
75   - { 0, 0, 0, 1},
76   - { 1, 0, 1, 1},
77   - { 2, 1, 0, 1},
78   - { 3, 1, 1, 1},
79   - { 4, 2, 0, 1},
80   - { 5, 2, 1, 1},
81   - { 6, 3, 0, 1},
82   - { 7, 3, 1, 1}
83   -};
  73 +struct cppi41_dma_sched_tbl_t dma_sched_tbl[MAX_SCHED_TBL_ENTRY];
84 74  
85 75 struct cppi41_queue_mgr cppi41_queue_mgr[CPPI41_NUM_QUEUE_MGR];
86 76 EXPORT_SYMBOL(cppi41_queue_mgr);
... ... @@ -341,6 +331,18 @@
341 331 * for the CPPI 4.1 system.
342 332 */
343 333 cppi41_init_teardown_queue(dma_num);
  334 +
  335 + for (i = 0; i < MAX_SCHED_TBL_ENTRY; i += 2) {
  336 + dma_sched_tbl[i].pos = i;
  337 + dma_sched_tbl[i].dma_ch = i;
  338 + dma_sched_tbl[i].is_tx = 1;
  339 + dma_sched_tbl[i].enb = 1;
  340 +
  341 + dma_sched_tbl[i+1].pos = i + 1;
  342 + dma_sched_tbl[i+1].dma_ch = i;
  343 + dma_sched_tbl[i+1].is_tx = 0;
  344 + dma_sched_tbl[i+1].enb = 1;
  345 + }
344 346  
345 347 /* Initialize the DMA scheduler. */
346 348 num_reg = (tbl_size + 3) / 4;
drivers/usb/musb/cppi41.h
... ... @@ -203,7 +203,7 @@
203 203 * DMA Scheduler - Table Region
204 204 */
205 205 #define DMA_SCHED_TABLE_WORD_REG(n) ((n) << 2)
206   -#define MAX_SCHED_TBL_ENTRY 8
  206 +#define MAX_SCHED_TBL_ENTRY 60
207 207  
208 208 /*
209 209 * CPPI 4.1 Host Packet Descriptor
drivers/usb/musb/cppi41_dma.c
... ... @@ -829,8 +829,8 @@
829 829 u8 en_bd_intr = cppi->en_bd_intr;
830 830 u8 dma_mode, autoreq;
831 831 u8 rx_dma_mode = cppi->cppi_info->rx_dma_mode;
  832 + u8 sched_tbl_ctrl = cppi->cppi_info->sched_tbl_ctrl;
832 833  
833   -
834 834 pkt_len = rx_ch->length;
835 835 /*
836 836 * Rx can use the generic RNDIS mode where we can
... ... @@ -977,8 +977,9 @@
977 977 }
978 978  
979 979 /* enable schedular if not enabled */
980   - if (is_peripheral_active(cppi->musb) && (n_bd > 0))
981   - cppi41_schedtbl_add_dma_ch(0, 0, rx_ch->ch_num, 0);
  980 + if (sched_tbl_ctrl && is_peripheral_active(cppi->musb) && (n_bd > 0))
  981 + cppi41_schedtbl_add_dma_ch(0, 0,
  982 + cppi->cppi_info->ep_dma_ch[rx_ch->ch_num], 0);
982 983 return 1;
983 984 }
984 985  
... ... @@ -1797,6 +1798,7 @@
1797 1798 u8 ch_num, ep_num;
1798 1799 struct musb *musb = cppi->musb;
1799 1800 u32 length = 0, orig_buf_len;
  1801 + u8 sched_tbl_ctrl = cppi->cppi_info->sched_tbl_ctrl;
1800 1802  
1801 1803 /* Extract the data from received packet descriptor */
1802 1804 length = curr_pd->hw_desc.desc_info & CPPI41_PKT_LEN_MASK;
1803 1805  
... ... @@ -1819,9 +1821,10 @@
1819 1821 if (curr_pd->eop) {
1820 1822 curr_pd->eop = 0;
1821 1823 /* disable the rx dma schedular */
1822   - if (is_peripheral_active(cppi->musb) &&
  1824 + if (sched_tbl_ctrl && is_peripheral_active(cppi->musb) &&
1823 1825 !cppi->cppi_info->rx_inf_mode)
1824   - cppi41_schedtbl_remove_dma_ch(0, 0, ch_num, 0);
  1826 + cppi41_schedtbl_remove_dma_ch(0, 0,
  1827 + cppi->cppi_info->ep_dma_ch[ch_num], 0);
1825 1828 }
1826 1829  
1827 1830 /*
drivers/usb/musb/cppi41_dma.h
... ... @@ -46,6 +46,7 @@
46 46 u8 bd_intr_ctrl;
47 47 u8 rx_dma_mode;
48 48 u8 rx_inf_mode;
  49 + u8 sched_tbl_ctrl;
49 50 u32 version;
50 51 };
51 52  
drivers/usb/musb/ti81xx.c
... ... @@ -474,6 +474,7 @@
474 474 cppi_info->tx_comp_q = id ? tx_comp_q1 : tx_comp_q;
475 475 cppi_info->rx_comp_q = id ? rx_comp_q1 : rx_comp_q;
476 476 cppi_info->bd_intr_ctrl = 1;
  477 + cppi_info->sched_tbl_ctrl = 0;
477 478 cppi_info->version = usbss_read(USBSS_REVISION);
478 479  
479 480 if (cppi41_init_done)