aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorLee Jones <lee.jones@linaro.org>2013-05-15 05:51:47 -0400
committerLinus Walleij <linus.walleij@linaro.org>2013-06-04 05:12:04 -0400
commit2968da0b2c7297a29d49c7084d6865c2cf627093 (patch)
tree4f817cfe3d4f124abcd12288bce7c1e0b90f4639 /drivers/usb
parent5f6091a023ca435c49467348e388fa89e635436a (diff)
usb: musb: ux500: attempt to find channels by name before using pdata
If we can ever get to a state where we can solely search for DMA channels by name, this will almost completely alleviate the requirement to pass copious amounts of information though platform data. Here we take the first step towards this. The next step will be to enable Device Tree complete with name<->event_line mapping. Cc: linux-usb@vger.kernel.org Acked-by: Felipe Balbi <balbi@ti.com> Acked-by: Fabio Baltieri <fabio.baltieri@linaro.org> Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/musb/ux500_dma.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/drivers/usb/musb/ux500_dma.c b/drivers/usb/musb/ux500_dma.c
index 4bd5400e0395..7d80699a5ff7 100644
--- a/drivers/usb/musb/ux500_dma.c
+++ b/drivers/usb/musb/ux500_dma.c
@@ -34,6 +34,11 @@
34#include <linux/platform_data/usb-musb-ux500.h> 34#include <linux/platform_data/usb-musb-ux500.h>
35#include "musb_core.h" 35#include "musb_core.h"
36 36
37static const char *iep_chan_names[] = { "iep_1_9", "iep_2_10", "iep_3_11", "iep_4_12",
38 "iep_5_13", "iep_6_14", "iep_7_15", "iep_8" };
39static const char *oep_chan_names[] = { "oep_1_9", "oep_2_10", "oep_3_11", "oep_4_12",
40 "oep_5_13", "oep_6_14", "oep_7_15", "oep_8" };
41
37struct ux500_dma_channel { 42struct ux500_dma_channel {
38 struct dma_channel channel; 43 struct dma_channel channel;
39 struct ux500_dma_controller *controller; 44 struct ux500_dma_controller *controller;
@@ -291,6 +296,7 @@ static int ux500_dma_controller_start(struct dma_controller *c)
291 struct musb_hdrc_platform_data *plat = dev->platform_data; 296 struct musb_hdrc_platform_data *plat = dev->platform_data;
292 struct ux500_musb_board_data *data; 297 struct ux500_musb_board_data *data;
293 struct dma_channel *dma_channel = NULL; 298 struct dma_channel *dma_channel = NULL;
299 char **chan_names;
294 u32 ch_num; 300 u32 ch_num;
295 u8 dir; 301 u8 dir;
296 u8 is_tx = 0; 302 u8 is_tx = 0;
@@ -312,6 +318,7 @@ static int ux500_dma_controller_start(struct dma_controller *c)
312 /* Prepare the loop for RX channels */ 318 /* Prepare the loop for RX channels */
313 channel_array = controller->rx_channel; 319 channel_array = controller->rx_channel;
314 param_array = data ? data->dma_rx_param_array : NULL; 320 param_array = data ? data->dma_rx_param_array : NULL;
321 chan_names = (char **)iep_chan_names;
315 322
316 for (dir = 0; dir < 2; dir++) { 323 for (dir = 0; dir < 2; dir++) {
317 for (ch_num = 0; 324 for (ch_num = 0;
@@ -327,9 +334,15 @@ static int ux500_dma_controller_start(struct dma_controller *c)
327 dma_channel->status = MUSB_DMA_STATUS_FREE; 334 dma_channel->status = MUSB_DMA_STATUS_FREE;
328 dma_channel->max_len = SZ_16M; 335 dma_channel->max_len = SZ_16M;
329 336
330 ux500_channel->dma_chan = dma_request_channel(mask, 337 ux500_channel->dma_chan =
331 data->dma_filter, 338 dma_request_slave_channel(dev, chan_names[ch_num]);
332 param_array[ch_num]); 339
340 if (!ux500_channel->dma_chan)
341 ux500_channel->dma_chan =
342 dma_request_channel(mask,
343 data->dma_filter,
344 param_array[ch_num]);
345
333 if (!ux500_channel->dma_chan) { 346 if (!ux500_channel->dma_chan) {
334 ERR("Dma pipe allocation error dir=%d ch=%d\n", 347 ERR("Dma pipe allocation error dir=%d ch=%d\n",
335 dir, ch_num); 348 dir, ch_num);
@@ -345,6 +358,7 @@ static int ux500_dma_controller_start(struct dma_controller *c)
345 /* Prepare the loop for TX channels */ 358 /* Prepare the loop for TX channels */
346 channel_array = controller->tx_channel; 359 channel_array = controller->tx_channel;
347 param_array = data ? data->dma_tx_param_array : NULL; 360 param_array = data ? data->dma_tx_param_array : NULL;
361 chan_names = (char **)oep_chan_names;
348 is_tx = 1; 362 is_tx = 1;
349 } 363 }
350 364