summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Mayo <jmayo@nvidia.com>2010-07-20 17:55:54 -0700
committerGary King <gking@nvidia.com>2010-07-21 12:51:41 -0700
commitf2a7108a11cb874faf8fb3ff7eee44721a6b9e18 (patch)
tree44336d7a58b4e40298f0468d067877f81f458fd9
parentdd03be59ae18076839bd3c4d4470bc79a5cd2843 (diff)
[arm/tegra] let RTC internal and ODM drivers coexist
Change-Id: I353d5ff87243c3098100320b2cd184b47b471e84 Reviewed-on: http://git-master/r/4182 Reviewed-by: Gary King <gking@nvidia.com> Reviewed-by: Jonathan Mayo <jmayo@nvidia.com> Tested-by: Jonathan Mayo <jmayo@nvidia.com>
-rw-r--r--arch/arm/mach-tegra/board-nvodm.c31
-rw-r--r--drivers/rtc/rtc-tegra-odm.c45
2 files changed, 30 insertions, 46 deletions
diff --git a/arch/arm/mach-tegra/board-nvodm.c b/arch/arm/mach-tegra/board-nvodm.c
index dc1e1c8148fd..1f1931d0b5cf 100644
--- a/arch/arm/mach-tegra/board-nvodm.c
+++ b/arch/arm/mach-tegra/board-nvodm.c
@@ -111,7 +111,7 @@ static void __init tegra_setup_debug_uart(void)
NvOdmDebugConsole uart = NvOdmQueryDebugConsole();
const struct tegra_pingroup_config *pinmux = NULL;
const NvU32 *odm_table;
- struct clk *c;
+ struct clk *c = NULL;
NvU32 odm_nr;
int nr_pins;
@@ -847,13 +847,35 @@ static noinline void __init tegra_setup_gpio_key(void)
static void tegra_setup_gpio_key(void) { }
#endif
+#ifdef CONFIG_RTC_DRV_TEGRA
+static struct resource tegra_rtc_resources[] = {
+ [0] = {
+ .start = TEGRA_RTC_BASE,
+ .end = TEGRA_RTC_BASE + TEGRA_RTC_SIZE - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = INT_RTC,
+ .end = INT_RTC,
+ .flags = IORESOURCE_IRQ,
+ },
+};
-#ifdef CONFIG_RTC_DRV_TEGRA_ODM
static struct platform_device tegra_rtc_device = {
.name = "tegra_rtc",
.id = -1,
+ .resource = tegra_rtc_resources,
+ .num_resources = ARRAY_SIZE(tegra_rtc_resources),
};
#endif
+
+#ifdef CONFIG_RTC_DRV_TEGRA_ODM
+static struct platform_device tegra_rtc_odm_device = {
+ .name = "tegra_rtc_odm",
+ .id = -1,
+};
+#endif
+
#ifdef CONFIG_TEGRA_NVEC
static struct platform_device tegra_nvec_device = {
.name = "nvec",
@@ -1106,9 +1128,12 @@ static struct platform_device tegra_vibrator_device = {
#endif
static struct platform_device *nvodm_devices[] __initdata = {
-#ifdef CONFIG_RTC_DRV_TEGRA_ODM
+#ifdef CONFIG_RTC_DRV_TEGRA
&tegra_rtc_device,
#endif
+#ifdef CONFIG_RTC_DRV_TEGRA_ODM
+ &tegra_rtc_odm_device,
+#endif
#ifdef CONFIG_TEGRA_NVEC
&tegra_nvec_device,
#endif
diff --git a/drivers/rtc/rtc-tegra-odm.c b/drivers/rtc/rtc-tegra-odm.c
index f87a5be674d3..2a90d60b06b8 100644
--- a/drivers/rtc/rtc-tegra-odm.c
+++ b/drivers/rtc/rtc-tegra-odm.c
@@ -72,46 +72,6 @@ static int tegra_rtc_set_time(struct device *dev, struct rtc_time *tm)
}
#if (PMU_IOCTL_ENABLE)
-static int tegra_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long arg)
-{
- void __user *argp = (void __user *)arg;
- struct rtc_wkalrm wkalrm;
- NvU32 count = 0;
-
- switch (cmd) {
- case RTC_ALM_READ:
- if(NvOdmPmuReadAlarm(hPmu, &count))
- {
- wkalrm.time.tm_hour = count / 3600;
- wkalrm.time.tm_min = (count - (wkalrm.time.tm_hour * 3600)) / 60;
- wkalrm.time.tm_sec = (count - (wkalrm.time.tm_min * 60) - (wkalrm.time.tm_hour * 3600) );
- if (copy_to_user(argp, &count, sizeof(count)))
- return -EFAULT;
- }
- else
- {
- pr_debug("NvOdmPmuReadRtc failed\n");
- return -EINVAL;
- }
- break;
-
- case RTC_ALM_SET:
- if (copy_from_user(&wkalrm, argp, sizeof(wkalrm)))
- return -EFAULT;
- count = wkalrm.time.tm_hour * 3600 + wkalrm.time.tm_min * 60 + wkalrm.time.tm_sec;
- if(!NvOdmPmuWriteAlarm(hPmu, count))
- {
- pr_debug("NvOdmPmuWriteRtc failed\n");
- return -EINVAL;
- }
- break;
- default:
- return -EINVAL;
- }
-
- return 0;
-}
-
static int tegra_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *wkalrm)
{
@@ -170,7 +130,6 @@ static struct rtc_class_ops tegra_rtc_ops = {
.read_time = tegra_rtc_read_time,
.set_time = tegra_rtc_set_time,
#if (PMU_IOCTL_ENABLE)
- .ioctl = tegra_rtc_ioctl,
.read_alarm = tegra_rtc_read_alarm,
.set_alarm = tegra_rtc_set_alarm,
#endif
@@ -238,7 +197,7 @@ static void tegra_rtc_shutdown(struct platform_device *pdev)
{
}
-MODULE_ALIAS("platform:tegra_rtc");
+MODULE_ALIAS("platform:tegra_rtc_odm");
static struct platform_driver tegra_rtc_driver = {
.remove = __exit_p(tegra_rtc_remove),
@@ -248,7 +207,7 @@ static struct platform_driver tegra_rtc_driver = {
.resume = tegra_rtc_resume,
#endif
.driver = {
- .name = "tegra_rtc",
+ .name = "tegra_rtc_odm",
.owner = THIS_MODULE,
},
};