Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Lee Jones and committed by
Linus Walleij
2968da0b 5f6091a0

+17 -3
+17 -3
drivers/usb/musb/ux500_dma.c
··· 34 34 #include <linux/platform_data/usb-musb-ux500.h> 35 35 #include "musb_core.h" 36 36 37 + static 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" }; 39 + static 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 + 37 42 struct ux500_dma_channel { 38 43 struct dma_channel channel; 39 44 struct ux500_dma_controller *controller; ··· 296 291 struct musb_hdrc_platform_data *plat = dev->platform_data; 297 292 struct ux500_musb_board_data *data; 298 293 struct dma_channel *dma_channel = NULL; 294 + char **chan_names; 299 295 u32 ch_num; 300 296 u8 dir; 301 297 u8 is_tx = 0; ··· 318 312 /* Prepare the loop for RX channels */ 319 313 channel_array = controller->rx_channel; 320 314 param_array = data ? data->dma_rx_param_array : NULL; 315 + chan_names = (char **)iep_chan_names; 321 316 322 317 for (dir = 0; dir < 2; dir++) { 323 318 for (ch_num = 0; ··· 334 327 dma_channel->status = MUSB_DMA_STATUS_FREE; 335 328 dma_channel->max_len = SZ_16M; 336 329 337 - ux500_channel->dma_chan = dma_request_channel(mask, 338 - data->dma_filter, 339 - param_array[ch_num]); 330 + ux500_channel->dma_chan = 331 + dma_request_slave_channel(dev, chan_names[ch_num]); 332 + 333 + if (!ux500_channel->dma_chan) 334 + ux500_channel->dma_chan = 335 + dma_request_channel(mask, 336 + data->dma_filter, 337 + param_array[ch_num]); 338 + 340 339 if (!ux500_channel->dma_chan) { 341 340 ERR("Dma pipe allocation error dir=%d ch=%d\n", 342 341 dir, ch_num); ··· 358 345 /* Prepare the loop for TX channels */ 359 346 channel_array = controller->tx_channel; 360 347 param_array = data ? data->dma_tx_param_array : NULL; 348 + chan_names = (char **)oep_chan_names; 361 349 is_tx = 1; 362 350 } 363 351