aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma/sh/shdma.c
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2013-06-18 12:16:57 -0400
committerVinod Koul <vinod.koul@intel.com>2013-07-05 02:11:00 -0400
commit67eacc1583909d0588c8d5d80c16298c899a6382 (patch)
tree093794f972e21cf084efcb734667453db1c68926 /drivers/dma/sh/shdma.c
parentd0951a23383d09276f7976ed34d8f1cede629b48 (diff)
DMA: shdma: add DT support
This patch adds Device Tree support to the shdma driver. No special DT properties are used, only standard DMA DT bindings are implemented. Since shdma controllers reside on SoCs, their configuration is SoC-specific and shall be passed to the driver from the SoC platform data, using the auxdata procedure. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Diffstat (limited to 'drivers/dma/sh/shdma.c')
-rw-r--r--drivers/dma/sh/shdma.c31
1 files changed, 25 insertions, 6 deletions
diff --git a/drivers/dma/sh/shdma.c b/drivers/dma/sh/shdma.c
index a5a1887c34b5..b67f45f5c271 100644
--- a/drivers/dma/sh/shdma.c
+++ b/drivers/dma/sh/shdma.c
@@ -301,20 +301,32 @@ static void sh_dmae_setup_xfer(struct shdma_chan *schan,
301 } 301 }
302} 302}
303 303
304/*
305 * Find a slave channel configuration from the contoller list by either a slave
306 * ID in the non-DT case, or by a MID/RID value in the DT case
307 */
304static const struct sh_dmae_slave_config *dmae_find_slave( 308static const struct sh_dmae_slave_config *dmae_find_slave(
305 struct sh_dmae_chan *sh_chan, int slave_id) 309 struct sh_dmae_chan *sh_chan, int match)
306{ 310{
307 struct sh_dmae_device *shdev = to_sh_dev(sh_chan); 311 struct sh_dmae_device *shdev = to_sh_dev(sh_chan);
308 struct sh_dmae_pdata *pdata = shdev->pdata; 312 struct sh_dmae_pdata *pdata = shdev->pdata;
309 const struct sh_dmae_slave_config *cfg; 313 const struct sh_dmae_slave_config *cfg;
310 int i; 314 int i;
311 315
312 if (slave_id >= SH_DMA_SLAVE_NUMBER) 316 if (!sh_chan->shdma_chan.dev->of_node) {
313 return NULL; 317 if (match >= SH_DMA_SLAVE_NUMBER)
318 return NULL;
314 319
315 for (i = 0, cfg = pdata->slave; i < pdata->slave_num; i++, cfg++) 320 for (i = 0, cfg = pdata->slave; i < pdata->slave_num; i++, cfg++)
316 if (cfg->slave_id == slave_id) 321 if (cfg->slave_id == match)
317 return cfg; 322 return cfg;
323 } else {
324 for (i = 0, cfg = pdata->slave; i < pdata->slave_num; i++, cfg++)
325 if (cfg->mid_rid == match) {
326 sh_chan->shdma_chan.slave_id = cfg->slave_id;
327 return cfg;
328 }
329 }
318 330
319 return NULL; 331 return NULL;
320} 332}
@@ -920,11 +932,18 @@ static int sh_dmae_remove(struct platform_device *pdev)
920 return 0; 932 return 0;
921} 933}
922 934
935static const struct of_device_id sh_dmae_of_match[] = {
936 { .compatible = "renesas,shdma", },
937 { }
938};
939MODULE_DEVICE_TABLE(of, sh_dmae_of_match);
940
923static struct platform_driver sh_dmae_driver = { 941static struct platform_driver sh_dmae_driver = {
924 .driver = { 942 .driver = {
925 .owner = THIS_MODULE, 943 .owner = THIS_MODULE,
926 .pm = &sh_dmae_pm, 944 .pm = &sh_dmae_pm,
927 .name = SH_DMAE_DRV_NAME, 945 .name = SH_DMAE_DRV_NAME,
946 .of_match_table = sh_dmae_of_match,
928 }, 947 },
929 .remove = sh_dmae_remove, 948 .remove = sh_dmae_remove,
930 .shutdown = sh_dmae_shutdown, 949 .shutdown = sh_dmae_shutdown,