aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/dma')
-rw-r--r--drivers/dma/at_hdmac.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index d1869c597e42..f3cb4a009e7d 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -23,6 +23,8 @@
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/slab.h> 25#include <linux/slab.h>
26#include <linux/of.h>
27#include <linux/of_device.h>
26 28
27#include "at_hdmac_regs.h" 29#include "at_hdmac_regs.h"
28 30
@@ -1175,6 +1177,20 @@ static void atc_free_chan_resources(struct dma_chan *chan)
1175 1177
1176/*-- Module Management -----------------------------------------------*/ 1178/*-- Module Management -----------------------------------------------*/
1177 1179
1180#if defined(CONFIG_OF)
1181static const struct of_device_id atmel_dma_dt_ids[] = {
1182 {
1183 .compatible = "atmel,at91sam9rl-dma",
1184 .data = (void *)ATDMA_DEVTYPE_SAM9RL
1185 }, {
1186 .compatible = "atmel,at91sam9g45-dma",
1187 .data = (void *)ATDMA_DEVTYPE_SAM9G45
1188 }, { /* sentinel */ }
1189};
1190
1191MODULE_DEVICE_TABLE(of, atmel_dma_dt_ids);
1192#endif
1193
1178static struct platform_device_id atdma_devtypes[] = { 1194static struct platform_device_id atdma_devtypes[] = {
1179 { 1195 {
1180 .name = "at91sam9rl_dma", 1196 .name = "at91sam9rl_dma",
@@ -1187,6 +1203,19 @@ static struct platform_device_id atdma_devtypes[] = {
1187 } 1203 }
1188}; 1204};
1189 1205
1206static inline enum atdma_devtype __init at_dma_get_driver_data(
1207 struct platform_device *pdev)
1208{
1209 if (pdev->dev.of_node) {
1210 const struct of_device_id *match;
1211 match = of_match_node(atmel_dma_dt_ids, pdev->dev.of_node);
1212 if (match == NULL)
1213 return ATDMA_DEVTYPE_UNDEFINED;
1214 return (enum atdma_devtype)match->data;
1215 }
1216 return platform_get_device_id(pdev)->driver_data;
1217}
1218
1190/** 1219/**
1191 * at_dma_off - disable DMA controller 1220 * at_dma_off - disable DMA controller
1192 * @atdma: the Atmel HDAMC device 1221 * @atdma: the Atmel HDAMC device
@@ -1218,7 +1247,7 @@ static int __init at_dma_probe(struct platform_device *pdev)
1218 dma_cap_set(DMA_MEMCPY, cap_mask); 1247 dma_cap_set(DMA_MEMCPY, cap_mask);
1219 1248
1220 /* get DMA parameters from controller type */ 1249 /* get DMA parameters from controller type */
1221 atdmatype = platform_get_device_id(pdev)->driver_data; 1250 atdmatype = at_dma_get_driver_data(pdev);
1222 1251
1223 switch (atdmatype) { 1252 switch (atdmatype) {
1224 case ATDMA_DEVTYPE_SAM9RL: 1253 case ATDMA_DEVTYPE_SAM9RL:
@@ -1526,6 +1555,7 @@ static struct platform_driver at_dma_driver = {
1526 .driver = { 1555 .driver = {
1527 .name = "at_hdmac", 1556 .name = "at_hdmac",
1528 .pm = &at_dma_dev_pm_ops, 1557 .pm = &at_dma_dev_pm_ops,
1558 .of_match_table = of_match_ptr(atmel_dma_dt_ids),
1529 }, 1559 },
1530}; 1560};
1531 1561