aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/atmel_tclib.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/misc/atmel_tclib.c')
-rw-r--r--drivers/misc/atmel_tclib.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/drivers/misc/atmel_tclib.c b/drivers/misc/atmel_tclib.c
index 7a6512a148d4..de6dea7c5d52 100644
--- a/drivers/misc/atmel_tclib.c
+++ b/drivers/misc/atmel_tclib.c
@@ -6,8 +6,10 @@
6#include <linux/ioport.h> 6#include <linux/ioport.h>
7#include <linux/kernel.h> 7#include <linux/kernel.h>
8#include <linux/platform_device.h> 8#include <linux/platform_device.h>
9#include <linux/module.h>
9#include <linux/slab.h> 10#include <linux/slab.h>
10#include <linux/export.h> 11#include <linux/export.h>
12#include <linux/of.h>
11 13
12/* 14/*
13 * This is a thin library to solve the problem of how to portably allocate 15 * This is a thin library to solve the problem of how to portably allocate
@@ -48,7 +50,13 @@ struct atmel_tc *atmel_tc_alloc(unsigned block, const char *name)
48 50
49 spin_lock(&tc_list_lock); 51 spin_lock(&tc_list_lock);
50 list_for_each_entry(tc, &tc_list, node) { 52 list_for_each_entry(tc, &tc_list, node) {
51 if (tc->pdev->id == block) { 53 if (tc->pdev->dev.of_node) {
54 if (of_alias_get_id(tc->pdev->dev.of_node, "tcb")
55 == block) {
56 pdev = tc->pdev;
57 break;
58 }
59 } else if (tc->pdev->id == block) {
52 pdev = tc->pdev; 60 pdev = tc->pdev;
53 break; 61 break;
54 } 62 }
@@ -105,6 +113,18 @@ void atmel_tc_free(struct atmel_tc *tc)
105} 113}
106EXPORT_SYMBOL_GPL(atmel_tc_free); 114EXPORT_SYMBOL_GPL(atmel_tc_free);
107 115
116#if defined(CONFIG_OF)
117static const struct of_device_id atmel_tcb_dt_ids[] = {
118 {
119 .compatible = "atmel,at91rm9200-tcb",
120 }, {
121 /* sentinel */
122 }
123};
124
125MODULE_DEVICE_TABLE(of, atmel_tcb_dt_ids);
126#endif
127
108static int __init tc_probe(struct platform_device *pdev) 128static int __init tc_probe(struct platform_device *pdev)
109{ 129{
110 struct atmel_tc *tc; 130 struct atmel_tc *tc;
@@ -154,7 +174,10 @@ static int __init tc_probe(struct platform_device *pdev)
154} 174}
155 175
156static struct platform_driver tc_driver = { 176static struct platform_driver tc_driver = {
157 .driver.name = "atmel_tcb", 177 .driver = {
178 .name = "atmel_tcb",
179 .of_match_table = of_match_ptr(atmel_tcb_dt_ids),
180 },
158}; 181};
159 182
160static int __init tc_init(void) 183static int __init tc_init(void)