diff options
author | Nicolas Ferre <nicolas.ferre@atmel.com> | 2012-01-19 18:44:49 +0100 |
---|---|---|
committer | Nicolas Ferre <nicolas.ferre@atmel.com> | 2012-03-01 13:38:49 +0100 |
commit | 8e315a7b0c082c6743a6636ead5674a2265638d3 (patch) | |
tree | 9eabbe8dfff1679fcc7c1ca72f81e58631dfdfcb /drivers/misc/atmel_tclib.c | |
parent | 3a61a5dae49bf3d1afb7f75c8acb3607f26565af (diff) | |
download | op-kernel-dev-8e315a7b0c082c6743a6636ead5674a2265638d3.zip op-kernel-dev-8e315a7b0c082c6743a6636ead5674a2265638d3.tar.gz |
ARM: at91/tc/clocksource: Add 32 bit variant to Timer Counter
Some SoC have a 32 bit variant of Timer Counter Blocks. We do not
need the chaining of two 16 bit counters anymore for them.
The SoC nature is deduced from the device tree "compatible" string.
For non-device-tree configurations, backward compatibility is maintained
by using the default 16 bit counter configuration.
This patch addresses both the atmel_tclib and its user: tcb_clksrc
clocksource.
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'drivers/misc/atmel_tclib.c')
-rw-r--r-- | drivers/misc/atmel_tclib.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/misc/atmel_tclib.c b/drivers/misc/atmel_tclib.c index de6dea7..c8d8e38 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) EXPORT_SYMBOL_GPL(atmel_tc_free); #if defined(CONFIG_OF) +static struct atmel_tcb_config tcb_rm9200_config = { + .counter_width = 16, +}; + +static struct atmel_tcb_config tcb_sam9x5_config = { + .counter_width = 32, +}; + static const struct of_device_id atmel_tcb_dt_ids[] = { { .compatible = "atmel,at91rm9200-tcb", + .data = &tcb_rm9200_config, + }, { + .compatible = "atmel,at91sam9x5-tcb", + .data = &tcb_sam9x5_config, }, { /* sentinel */ } @@ -150,6 +162,14 @@ static int __init tc_probe(struct platform_device *pdev) return -EINVAL; } + /* Now take SoC information if available */ + if (pdev->dev.of_node) { + const struct of_device_id *match; + match = of_match_node(atmel_tcb_dt_ids, pdev->dev.of_node); + if (match) + tc->tcb_config = match->data; + } + tc->clk[0] = clk; tc->clk[1] = clk_get(&pdev->dev, "t1_clk"); if (IS_ERR(tc->clk[1])) |