diff options
Diffstat (limited to 'drivers/rtc/rtc-tegra.c')
-rw-r--r-- | drivers/rtc/rtc-tegra.c | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/drivers/rtc/rtc-tegra.c b/drivers/rtc/rtc-tegra.c index 2fc31aac3f4..773adffac27 100644 --- a/drivers/rtc/rtc-tegra.c +++ b/drivers/rtc/rtc-tegra.c | |||
@@ -1,7 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * An RTC driver for the NVIDIA Tegra 200 series internal RTC. | 2 | * An RTC driver for the NVIDIA Tegra 200 series internal RTC. |
3 | * | 3 | * |
4 | * Copyright (c) 2010, NVIDIA Corporation. | 4 | * Copyright (c) 2010-2011, NVIDIA Corporation. |
5 | * Copyright (c) 2010 Jon Mayo <jmayo@nvidia.com> | ||
5 | * | 6 | * |
6 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License as published by | 8 | * it under the terms of the GNU General Public License as published by |
@@ -343,7 +344,7 @@ static int __devinit tegra_rtc_probe(struct platform_device *pdev) | |||
343 | 344 | ||
344 | /* set context info. */ | 345 | /* set context info. */ |
345 | info->pdev = pdev; | 346 | info->pdev = pdev; |
346 | info->tegra_rtc_lock = __SPIN_LOCK_UNLOCKED(info->tegra_rtc_lock); | 347 | spin_lock_init(&info->tegra_rtc_lock); |
347 | 348 | ||
348 | platform_set_drvdata(pdev, info); | 349 | platform_set_drvdata(pdev, info); |
349 | 350 | ||
@@ -376,6 +377,36 @@ static int __devinit tegra_rtc_probe(struct platform_device *pdev) | |||
376 | 377 | ||
377 | dev_notice(&pdev->dev, "Tegra internal Real Time Clock\n"); | 378 | dev_notice(&pdev->dev, "Tegra internal Real Time Clock\n"); |
378 | 379 | ||
380 | #ifndef CONFIG_TEGRA_SILICON_PLATFORM | ||
381 | { | ||
382 | struct rtc_time tm; | ||
383 | |||
384 | /* Get the current time from the RTC. */ | ||
385 | ret = tegra_rtc_read_time(&pdev->dev, &tm); | ||
386 | if (ret) { | ||
387 | /* Report but ignore this error. */ | ||
388 | dev_err(&pdev->dev, | ||
389 | "Failed to get FPGA internal RTC time (err=%d)\n", | ||
390 | ret); | ||
391 | } else if (tm.tm_year < 2010) { | ||
392 | /* The RTC's default reset time is soooo last century. */ | ||
393 | tm.tm_year = 2010-1900; | ||
394 | tm.tm_mon = 0; | ||
395 | tm.tm_mday = 1; | ||
396 | tm.tm_hour = 0; | ||
397 | tm.tm_min = 0; | ||
398 | tm.tm_sec = 0; | ||
399 | ret = tegra_rtc_set_time(&pdev->dev, &tm); | ||
400 | if (ret) { | ||
401 | /* Report but ignore this error. */ | ||
402 | dev_err(&pdev->dev, | ||
403 | "Failed to set FPGA internal RTC time (err=%d)\n", | ||
404 | ret); | ||
405 | } | ||
406 | } | ||
407 | } | ||
408 | #endif | ||
409 | |||
379 | return 0; | 410 | return 0; |
380 | 411 | ||
381 | err_dev_unreg: | 412 | err_dev_unreg: |