summaryrefslogtreecommitdiffstats
path: root/recipes-kernel/linux/linux-ti-staging/0001-Revert-usb-musb-musb_cppi41-Revert-the-Advisory-1.0..patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-kernel/linux/linux-ti-staging/0001-Revert-usb-musb-musb_cppi41-Revert-the-Advisory-1.0..patch')
-rw-r--r--recipes-kernel/linux/linux-ti-staging/0001-Revert-usb-musb-musb_cppi41-Revert-the-Advisory-1.0..patch158
1 files changed, 0 insertions, 158 deletions
diff --git a/recipes-kernel/linux/linux-ti-staging/0001-Revert-usb-musb-musb_cppi41-Revert-the-Advisory-1.0..patch b/recipes-kernel/linux/linux-ti-staging/0001-Revert-usb-musb-musb_cppi41-Revert-the-Advisory-1.0..patch
deleted file mode 100644
index dcb33226..00000000
--- a/recipes-kernel/linux/linux-ti-staging/0001-Revert-usb-musb-musb_cppi41-Revert-the-Advisory-1.0..patch
+++ /dev/null
@@ -1,158 +0,0 @@
1From f576e148cd15f10224e4ce13b6773717682f9a5a Mon Sep 17 00:00:00 2001
2From: Chase Maupin <Chase.Maupin@ti.com>
3Date: Fri, 21 Feb 2014 09:05:48 -0600
4Subject: [PATCH 1/4] Revert "usb: musb: musb_cppi41: Revert the Advisory 1.0.13 workaround"
5
6This reverts commit c424ef3e2beb89488e7e597446b4c6bc8f1852c5.
7---
8 drivers/usb/musb/musb_cppi41.c | 96 +++++++++++++++++++++++++++++++++-------
9 1 files changed, 79 insertions(+), 17 deletions(-)
10
11diff --git a/drivers/usb/musb/musb_cppi41.c b/drivers/usb/musb/musb_cppi41.c
12index d02facc..01df8f9 100644
13--- a/drivers/usb/musb/musb_cppi41.c
14+++ b/drivers/usb/musb/musb_cppi41.c
15@@ -31,6 +31,7 @@ struct cppi41_dma_channel {
16 u8 port_num;
17 u8 is_tx;
18 u8 is_allocated;
19+ u8 usb_toggle;
20
21 dma_addr_t buf_addr;
22 u32 total_len;
23@@ -55,6 +56,50 @@ struct cppi41_dma_controller {
24 u32 auto_req;
25 };
26
27+static void save_rx_toggle(struct cppi41_dma_channel *cppi41_channel)
28+{
29+ u16 csr;
30+ u8 toggle;
31+
32+ if (cppi41_channel->is_tx)
33+ return;
34+ if (!is_host_active(cppi41_channel->controller->musb))
35+ return;
36+
37+ csr = musb_readw(cppi41_channel->hw_ep->regs, MUSB_RXCSR);
38+ toggle = csr & MUSB_RXCSR_H_DATATOGGLE ? 1 : 0;
39+
40+ cppi41_channel->usb_toggle = toggle;
41+}
42+
43+static void update_rx_toggle(struct cppi41_dma_channel *cppi41_channel)
44+{
45+ u16 csr;
46+ u8 toggle;
47+
48+ if (cppi41_channel->is_tx)
49+ return;
50+ if (!is_host_active(cppi41_channel->controller->musb))
51+ return;
52+
53+ csr = musb_readw(cppi41_channel->hw_ep->regs, MUSB_RXCSR);
54+ toggle = csr & MUSB_RXCSR_H_DATATOGGLE ? 1 : 0;
55+
56+ /*
57+ * AM335x Advisory 1.0.13: Due to internal synchronisation error the
58+ * data toggle may reset from DATA1 to DATA0 during receiving data from
59+ * more than one endpoint.
60+ */
61+ if (!toggle && toggle == cppi41_channel->usb_toggle) {
62+ csr |= MUSB_RXCSR_H_DATATOGGLE | MUSB_RXCSR_H_WR_DATATOGGLE;
63+ musb_writew(cppi41_channel->hw_ep->regs, MUSB_RXCSR, csr);
64+ dev_dbg(cppi41_channel->controller->musb->controller,
65+ "Restoring DATA1 toggle.\n");
66+ }
67+
68+ cppi41_channel->usb_toggle = toggle;
69+}
70+
71 static bool musb_is_tx_fifo_empty(struct musb_hw_ep *hw_ep)
72 {
73 u8 epnum = hw_ep->epnum;
74@@ -217,6 +262,8 @@ static void cppi41_dma_callback(void *private_data)
75 hw_ep->epnum, cppi41_channel->transferred,
76 cppi41_channel->total_len);
77
78+ update_rx_toggle(cppi41_channel);
79+
80 if (cppi41_channel->transferred == cppi41_channel->total_len ||
81 transferred < cppi41_channel->packet_sz)
82 cppi41_channel->prog_len = 0;
83@@ -347,6 +394,7 @@ static bool cppi41_configure_channel(struct dma_channel *channel,
84 struct dma_async_tx_descriptor *dma_desc;
85 enum dma_transfer_direction direction;
86 struct musb *musb = cppi41_channel->controller->musb;
87+ unsigned use_gen_rndis = 0;
88
89 dev_dbg(musb->controller,
90 "configure ep%d/%x packet_sz=%d, mode=%d, dma_addr=0x%llx, len=%d is_tx=%d\n",
91@@ -359,26 +407,39 @@ static bool cppi41_configure_channel(struct dma_channel *channel,
92 cppi41_channel->transferred = 0;
93 cppi41_channel->packet_sz = packet_sz;
94
95- /* RNDIS mode */
96- if (len > packet_sz) {
97- musb_writel(musb->ctrl_base,
98- RNDIS_REG(cppi41_channel->port_num), len);
99- /* gen rndis */
100- cppi41_set_dma_mode(cppi41_channel,
101- EP_MODE_DMA_GEN_RNDIS);
102-
103- /* auto req */
104- cppi41_set_autoreq_mode(cppi41_channel,
105+ /*
106+ * Due to AM335x' Advisory 1.0.13 we are not allowed to transfer more
107+ * than max packet size at a time.
108+ */
109+ if (cppi41_channel->is_tx)
110+ use_gen_rndis = 1;
111+
112+ if (use_gen_rndis) {
113+ /* RNDIS mode */
114+ if (len > packet_sz) {
115+ musb_writel(musb->ctrl_base,
116+ RNDIS_REG(cppi41_channel->port_num), len);
117+ /* gen rndis */
118+ cppi41_set_dma_mode(cppi41_channel,
119+ EP_MODE_DMA_GEN_RNDIS);
120+
121+ /* auto req */
122+ cppi41_set_autoreq_mode(cppi41_channel,
123 EP_MODE_AUTOREG_ALL_NEOP);
124- } else {
125- musb_writel(musb->ctrl_base,
126- RNDIS_REG(cppi41_channel->port_num), 0);
127- cppi41_set_dma_mode(cppi41_channel,
128- EP_MODE_DMA_TRANSPARENT);
129- cppi41_set_autoreq_mode(cppi41_channel,
130+ } else {
131+ musb_writel(musb->ctrl_base,
132+ RNDIS_REG(cppi41_channel->port_num), 0);
133+ cppi41_set_dma_mode(cppi41_channel,
134+ EP_MODE_DMA_TRANSPARENT);
135+ cppi41_set_autoreq_mode(cppi41_channel,
136 EP_MODE_AUTOREG_NONE);
137+ }
138+ } else {
139+ /* fallback mode */
140+ cppi41_set_dma_mode(cppi41_channel, EP_MODE_DMA_TRANSPARENT);
141+ cppi41_set_autoreq_mode(cppi41_channel, EP_MODE_AUTOREG_NONE);
142+ len = min_t(u32, packet_sz, len);
143 }
144-
145 cppi41_channel->prog_len = len;
146 direction = cppi41_channel->is_tx ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM;
147 dma_desc = dmaengine_prep_slave_single(dc, dma_addr, len, direction,
148@@ -390,6 +451,7 @@ static bool cppi41_configure_channel(struct dma_channel *channel,
149 dma_desc->callback_param = channel;
150 cppi41_channel->cookie = dma_desc->tx_submit(dma_desc);
151
152+ save_rx_toggle(cppi41_channel);
153 dma_async_issue_pending(dc);
154 return true;
155 }
156--
1571.7.0.4
158