aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/clocksource/sh_cmt.c
diff options
context:
space:
mode:
authorMagnus Damm <damm@igel.co.jp>2009-04-15 06:50:04 -0400
committerPaul Mundt <lethal@linux-sh.org>2009-04-19 00:06:22 -0400
commite475eedb09ee9a0fd855f3e923aa9af31c17d141 (patch)
tree603e6c83531b613d4551e3a711c36ec864fea9fd /drivers/clocksource/sh_cmt.c
parentaefe6475720bd5eb8aacbc881488f3aa65618562 (diff)
clocksource: sh_cmt earlytimer support
Add Early Platform Driver support to the sh_cmt driver using the earlytimer class. Signed-off-by: Magnus Damm <damm@igel.co.jp> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'drivers/clocksource/sh_cmt.c')
-rw-r--r--drivers/clocksource/sh_cmt.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c
index 1c92c39a53aa..02bae3994abe 100644
--- a/drivers/clocksource/sh_cmt.c
+++ b/drivers/clocksource/sh_cmt.c
@@ -566,9 +566,19 @@ static int sh_cmt_setup(struct sh_cmt_priv *p, struct platform_device *pdev)
566static int __devinit sh_cmt_probe(struct platform_device *pdev) 566static int __devinit sh_cmt_probe(struct platform_device *pdev)
567{ 567{
568 struct sh_cmt_priv *p = platform_get_drvdata(pdev); 568 struct sh_cmt_priv *p = platform_get_drvdata(pdev);
569 struct sh_cmt_config *cfg = pdev->dev.platform_data;
569 int ret; 570 int ret;
570 571
571 p = kmalloc(sizeof(*p), GFP_KERNEL); 572 if (p) {
573 pr_info("sh_cmt: %s kept as earlytimer\n", cfg->name);
574 return 0;
575 }
576
577 if (is_early_platform_device(pdev))
578 p = alloc_bootmem(sizeof(*p));
579 else
580 p = kmalloc(sizeof(*p), GFP_KERNEL);
581
572 if (p == NULL) { 582 if (p == NULL) {
573 dev_err(&pdev->dev, "failed to allocate driver data\n"); 583 dev_err(&pdev->dev, "failed to allocate driver data\n");
574 return -ENOMEM; 584 return -ENOMEM;
@@ -576,7 +586,10 @@ static int __devinit sh_cmt_probe(struct platform_device *pdev)
576 586
577 ret = sh_cmt_setup(p, pdev); 587 ret = sh_cmt_setup(p, pdev);
578 if (ret) { 588 if (ret) {
579 kfree(p); 589 if (is_early_platform_device(pdev))
590 free_bootmem(__pa(p), sizeof(*p));
591 else
592 kfree(p);
580 593
581 platform_set_drvdata(pdev, NULL); 594 platform_set_drvdata(pdev, NULL);
582 } 595 }
@@ -606,6 +619,7 @@ static void __exit sh_cmt_exit(void)
606 platform_driver_unregister(&sh_cmt_device_driver); 619 platform_driver_unregister(&sh_cmt_device_driver);
607} 620}
608 621
622early_platform_init("earlytimer", &sh_cmt_device_driver);
609module_init(sh_cmt_init); 623module_init(sh_cmt_init);
610module_exit(sh_cmt_exit); 624module_exit(sh_cmt_exit);
611 625