summaryrefslogtreecommitdiff
path: root/drivers/rtc
diff options
context:
space:
mode:
authorScott Williams <scwilliams@nvidia.com>2010-12-07 11:13:31 -0800
committerDan Willemsen <dwillemsen@nvidia.com>2011-11-30 21:43:14 -0800
commit355972d0cc83c04ccc1d0c8287c450dabcfd05a6 (patch)
tree0e219583bba98a886e91a2fc4a768f69775471ee /drivers/rtc
parentd9d5c223aa2b71f3c855270be8e3074422b9ed4f (diff)
[ARM/tegra] Add initial Tegra3 driver support
Bug 764354 Original-Change-Id: I807433ff825bed1fe91ce0cf50a2b3691c64ef0a Reviewed-on: http://git-master/r/12227 Reviewed-by: Scott Williams <scwilliams@nvidia.com> Tested-by: Scott Williams <scwilliams@nvidia.com> Original-Change-Id: I3da91a438f98f2f51618446ce024f3fefd726a19 Rebase-Id: R05d2230fc2dcbdccfcd00161b15f6bb45332c843
Diffstat (limited to 'drivers/rtc')
-rw-r--r--drivers/rtc/Kconfig3
-rw-r--r--drivers/rtc/rtc-tegra.c35
2 files changed, 34 insertions, 4 deletions
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 5e542d5a7964..6550d8ccc513 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -1064,8 +1064,7 @@ config RTC_DRV_TEGRA
tristate "NVIDIA Tegra Internal RTC driver"
depends on RTC_CLASS && ARCH_TEGRA
help
- If you say yes here you get support for the
- Tegra 200 series internal RTC module.
+ If you say yes here you get support for the Tegra internal RTC module.
This drive can also be built as a module. If so, the module
will be called rtc-tegra.
diff --git a/drivers/rtc/rtc-tegra.c b/drivers/rtc/rtc-tegra.c
index 75259fe38602..361d55454f9f 100644
--- a/drivers/rtc/rtc-tegra.c
+++ b/drivers/rtc/rtc-tegra.c
@@ -376,6 +376,36 @@ static int __devinit tegra_rtc_probe(struct platform_device *pdev)
dev_notice(&pdev->dev, "Tegra internal Real Time Clock\n");
+#ifdef CONFIG_TEGRA_FPGA_PLATFORM
+ {
+ struct rtc_time tm;
+
+ /* Get the current time from the RTC. */
+ ret = tegra_rtc_read_time(&pdev->dev, &tm);
+ if (ret) {
+ /* Report but ignore this error. */
+ dev_err(&pdev->dev,
+ "Failed to get FPGA internal RTC time (err=%d)\n",
+ ret);
+ } else if (tm.tm_year < 2010) {
+ /* The RTC's default reset time is soooo last century. */
+ tm.tm_year = 2010-1900;
+ tm.tm_mon = 0;
+ tm.tm_mday = 1;
+ tm.tm_hour = 0;
+ tm.tm_min = 0;
+ tm.tm_sec = 0;
+ ret = tegra_rtc_set_time(&pdev->dev, &tm);
+ if (ret) {
+ /* Report but ignore this error. */
+ dev_err(&pdev->dev,
+ "Failed to set FPGA internal RTC time (err=%d)\n",
+ ret);
+ }
+ }
+ }
+#endif
+
return 0;
err_dev_unreg:
@@ -449,6 +479,9 @@ static int tegra_rtc_resume(struct platform_device *pdev)
return 0;
}
+#else
+#define tegra_rtc_suspend NULL
+#define tegra_rtc_resume NULL
#endif
static void tegra_rtc_shutdown(struct platform_device *pdev)
@@ -465,10 +498,8 @@ static struct platform_driver tegra_rtc_driver = {
.name = "tegra_rtc",
.owner = THIS_MODULE,
},
-#ifdef CONFIG_PM
.suspend = tegra_rtc_suspend,
.resume = tegra_rtc_resume,
-#endif
};
static int __init tegra_rtc_init(void)