Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 286094
b: refs/heads/master
c: c511595
h: refs/heads/master
v: v3
  • Loading branch information
Nicolas Ferre authored and Vinod Koul committed Nov 10, 2011
1 parent 63c9233 commit 488ba3f
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 67348450b86cb1b42aa4dd55cf7cde19c2e53461
refs/heads/master: c511595390a373e19a774246c659b4f563a4c3f3
14 changes: 14 additions & 0 deletions trunk/Documentation/devicetree/bindings/dma/atmel-dma.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
* Atmel Direct Memory Access Controller (DMA)

Required properties:
- compatible: Should be "atmel,<chip>-dma"
- reg: Should contain DMA registers location and length
- interrupts: Should contain DMA interrupt

Examples:

dma@ffffec00 {
compatible = "atmel,at91sam9g45-dma";
reg = <0xffffec00 0x200>;
interrupts = <21>;
};
32 changes: 31 additions & 1 deletion trunk/drivers/dma/at_hdmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/of.h>
#include <linux/of_device.h>

#include "at_hdmac_regs.h"

Expand Down Expand Up @@ -1175,6 +1177,20 @@ static void atc_free_chan_resources(struct dma_chan *chan)

/*-- Module Management -----------------------------------------------*/

#if defined(CONFIG_OF)
static const struct of_device_id atmel_dma_dt_ids[] = {
{
.compatible = "atmel,at91sam9rl-dma",
.data = (void *)ATDMA_DEVTYPE_SAM9RL
}, {
.compatible = "atmel,at91sam9g45-dma",
.data = (void *)ATDMA_DEVTYPE_SAM9G45
}, { /* sentinel */ }
};

MODULE_DEVICE_TABLE(of, atmel_dma_dt_ids);
#endif

static struct platform_device_id atdma_devtypes[] = {
{
.name = "at91sam9rl_dma",
Expand All @@ -1187,6 +1203,19 @@ static struct platform_device_id atdma_devtypes[] = {
}
};

static inline enum atdma_devtype __init at_dma_get_driver_data(
struct platform_device *pdev)
{
if (pdev->dev.of_node) {
const struct of_device_id *match;
match = of_match_node(atmel_dma_dt_ids, pdev->dev.of_node);
if (match == NULL)
return ATDMA_DEVTYPE_UNDEFINED;
return (enum atdma_devtype)match->data;
}
return platform_get_device_id(pdev)->driver_data;
}

/**
* at_dma_off - disable DMA controller
* @atdma: the Atmel HDAMC device
Expand Down Expand Up @@ -1218,7 +1247,7 @@ static int __init at_dma_probe(struct platform_device *pdev)
dma_cap_set(DMA_MEMCPY, cap_mask);

/* get DMA parameters from controller type */
atdmatype = platform_get_device_id(pdev)->driver_data;
atdmatype = at_dma_get_driver_data(pdev);

switch (atdmatype) {
case ATDMA_DEVTYPE_SAM9RL:
Expand Down Expand Up @@ -1526,6 +1555,7 @@ static struct platform_driver at_dma_driver = {
.driver = {
.name = "at_hdmac",
.pm = &at_dma_dev_pm_ops,
.of_match_table = of_match_ptr(atmel_dma_dt_ids),
},
};

Expand Down

0 comments on commit 488ba3f

Please sign in to comment.