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

dmaengine: s3c24xx: Add dma_slave_map for s3c2440 devices

This patch updates the s3c24xx dma driver to be able to pass a
dma_slave_map array via the platform data. This is needed to
be able to use the new, simpler dmaengine API [1].
I used the virtual DMA channels as a parameter for the dma_filter
function. By doing that, I could reuse the existing filter function in
drivers/dma/s3c24xx-dma.c.

I have tested this on my mini2440 board with the audio driver.
According to my observations, dma_request_slave_channel in the
function dmaengine_pcm_new in the file
sound/soc/soc-generic-dmaengine-pcm.c now returns a valid DMA channel
whereas before no DMA channel was returned at that point.

Entries for DMACH_XD0, DMACH_XD1 and DMACH_TIMER are missing because I
don't realy know which driver to use for these.

[1]
http://lists.infradead.org/pipermail/linux-arm-kernel/2015-December/393635.html

Signed-off-by: Sam Van Den Berge <sam.van.den.berge@telenet.be>
Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>

authored by

Sam Van Den Berge and committed by
Vinod Koul
34681d84 360af35b

+44
+35
arch/arm/mach-s3c24xx/common.c
··· 33 33 #include <linux/delay.h> 34 34 #include <linux/io.h> 35 35 #include <linux/platform_data/dma-s3c24xx.h> 36 + #include <linux/dmaengine.h> 36 37 37 38 #include <mach/hardware.h> 38 39 #include <mach/regs-clock.h> ··· 440 439 [DMACH_USB_EP4] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 3), }, 441 440 }; 442 441 442 + static const struct dma_slave_map s3c2440_dma_slave_map[] = { 443 + /* TODO: DMACH_XD0 */ 444 + /* TODO: DMACH_XD1 */ 445 + { "s3c2440-sdi", "rx-tx", (void *)DMACH_SDI }, 446 + { "s3c2410-spi.0", "rx", (void *)DMACH_SPI0 }, 447 + { "s3c2410-spi.0", "tx", (void *)DMACH_SPI0 }, 448 + { "s3c2410-spi.1", "rx", (void *)DMACH_SPI1 }, 449 + { "s3c2410-spi.1", "tx", (void *)DMACH_SPI1 }, 450 + { "s3c2440-uart.0", "rx", (void *)DMACH_UART0 }, 451 + { "s3c2440-uart.0", "tx", (void *)DMACH_UART0 }, 452 + { "s3c2440-uart.1", "rx", (void *)DMACH_UART1 }, 453 + { "s3c2440-uart.1", "tx", (void *)DMACH_UART1 }, 454 + { "s3c2440-uart.2", "rx", (void *)DMACH_UART2 }, 455 + { "s3c2440-uart.2", "tx", (void *)DMACH_UART2 }, 456 + { "s3c2440-uart.3", "rx", (void *)DMACH_UART3 }, 457 + { "s3c2440-uart.3", "tx", (void *)DMACH_UART3 }, 458 + /* TODO: DMACH_TIMER */ 459 + { "s3c24xx-iis", "rx", (void *)DMACH_I2S_IN }, 460 + { "s3c24xx-iis", "tx", (void *)DMACH_I2S_OUT }, 461 + { "samsung-ac97", "rx", (void *)DMACH_PCM_IN }, 462 + { "samsung-ac97", "tx", (void *)DMACH_PCM_OUT }, 463 + { "samsung-ac97", "rx", (void *)DMACH_MIC_IN }, 464 + { "s3c-hsudc", "rx0", (void *)DMACH_USB_EP1 }, 465 + { "s3c-hsudc", "rx1", (void *)DMACH_USB_EP2 }, 466 + { "s3c-hsudc", "rx2", (void *)DMACH_USB_EP3 }, 467 + { "s3c-hsudc", "rx3", (void *)DMACH_USB_EP4 }, 468 + { "s3c-hsudc", "tx0", (void *)DMACH_USB_EP1 }, 469 + { "s3c-hsudc", "tx1", (void *)DMACH_USB_EP2 }, 470 + { "s3c-hsudc", "tx2", (void *)DMACH_USB_EP3 }, 471 + { "s3c-hsudc", "tx3", (void *)DMACH_USB_EP4 } 472 + }; 473 + 443 474 static struct s3c24xx_dma_platdata s3c2440_dma_platdata = { 444 475 .num_phy_channels = 4, 445 476 .channels = s3c2440_dma_channels, 446 477 .num_channels = DMACH_MAX, 478 + .slave_map = s3c2440_dma_slave_map, 479 + .slavecnt = ARRAY_SIZE(s3c2440_dma_slave_map), 447 480 }; 448 481 449 482 struct platform_device s3c2440_device_dma = {
+3
drivers/dma/s3c24xx-dma.c
··· 1301 1301 s3cdma->slave.device_prep_dma_cyclic = s3c24xx_dma_prep_dma_cyclic; 1302 1302 s3cdma->slave.device_config = s3c24xx_dma_set_runtime_config; 1303 1303 s3cdma->slave.device_terminate_all = s3c24xx_dma_terminate_all; 1304 + s3cdma->slave.filter.map = pdata->slave_map; 1305 + s3cdma->slave.filter.mapcnt = pdata->slavecnt; 1306 + s3cdma->slave.filter.fn = s3c24xx_dma_filter; 1304 1307 1305 1308 /* Register as many memcpy channels as there are physical channels */ 1306 1309 ret = s3c24xx_dma_init_virtual_channels(s3cdma, &s3cdma->memcpy,
+6
include/linux/platform_data/dma-s3c24xx.h
··· 30 30 u16 chansel; 31 31 }; 32 32 33 + struct dma_slave_map; 34 + 33 35 /** 34 36 * struct s3c24xx_dma_platdata - platform specific settings 35 37 * @num_phy_channels: number of physical channels 36 38 * @channels: array of virtual channel descriptions 37 39 * @num_channels: number of virtual channels 40 + * @slave_map: dma slave map matching table 41 + * @slavecnt: number of elements in slave_map 38 42 */ 39 43 struct s3c24xx_dma_platdata { 40 44 int num_phy_channels; 41 45 struct s3c24xx_dma_channel *channels; 42 46 int num_channels; 47 + const struct dma_slave_map *slave_map; 48 + int slavecnt; 43 49 }; 44 50 45 51 struct dma_chan;