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.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/misc/atmel_tclib.c b/drivers/misc/atmel_tclib.c
index de6dea7c5d52..c8d8e38d0d8a 100644
--- a/drivers/misc/atmel_tclib.c
+++ b/drivers/misc/atmel_tclib.c
@@ -114,9 +114,21 @@ void atmel_tc_free(struct atmel_tc *tc)
114EXPORT_SYMBOL_GPL(atmel_tc_free); 114EXPORT_SYMBOL_GPL(atmel_tc_free);
115 115
116#if defined(CONFIG_OF) 116#if defined(CONFIG_OF)
117static struct atmel_tcb_config tcb_rm9200_config = {
118 .counter_width = 16,
119};
120
121static struct atmel_tcb_config tcb_sam9x5_config = {
122 .counter_width = 32,
123};
124
117static const struct of_device_id atmel_tcb_dt_ids[] = { 125static const struct of_device_id atmel_tcb_dt_ids[] = {
118 { 126 {
119 .compatible = "atmel,at91rm9200-tcb", 127 .compatible = "atmel,at91rm9200-tcb",
128 .data = &tcb_rm9200_config,
129 }, {
130 .compatible = "atmel,at91sam9x5-tcb",
131 .data = &tcb_sam9x5_config,
120 }, { 132 }, {
121 /* sentinel */ 133 /* sentinel */
122 } 134 }
@@ -150,6 +162,14 @@ static int __init tc_probe(struct platform_device *pdev)
150 return -EINVAL; 162 return -EINVAL;
151 } 163 }
152 164
165 /* Now take SoC information if available */
166 if (pdev->dev.of_node) {
167 const struct of_device_id *match;
168 match = of_match_node(atmel_tcb_dt_ids, pdev->dev.of_node);
169 if (match)
170 tc->tcb_config = match->data;
171 }
172
153 tc->clk[0] = clk; 173 tc->clk[0] = clk;
154 tc->clk[1] = clk_get(&pdev->dev, "t1_clk"); 174 tc->clk[1] = clk_get(&pdev->dev, "t1_clk");
155 if (IS_ERR(tc->clk[1])) 175 if (IS_ERR(tc->clk[1]))