summaryrefslogtreecommitdiffstats
path: root/drivers/rtc
diff options
context:
space:
mode:
authorKrzysztof Helt <krzysztof.h1@wp.pl>2008-09-03 15:41:57 -0700
committerDavid S. Miller <davem@davemloft.net>2008-09-03 15:41:57 -0700
commit64151ad5b3a03e236390d6d5160805ee4f4e7c67 (patch)
treefc47e478fd05dd84b7f0b3c5a019a3326ac8a880 /drivers/rtc
parent94fe7424a4c21940b4569200faaf0a0a5efd2924 (diff)
downloadop-kernel-dev-64151ad5b3a03e236390d6d5160805ee4f4e7c67.zip
op-kernel-dev-64151ad5b3a03e236390d6d5160805ee4f4e7c67.tar.gz
rtc-m48t59: allow externally mapped ioaddr
Add support for externally mapped ioaddr. This is required on sparc32 as the ioaddr must be mapped with of_ioremap(). Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/rtc')
-rw-r--r--drivers/rtc/rtc-m48t59.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/rtc/rtc-m48t59.c b/drivers/rtc/rtc-m48t59.c
index 50f9f10..867c8a7 100644
--- a/drivers/rtc/rtc-m48t59.c
+++ b/drivers/rtc/rtc-m48t59.c
@@ -411,9 +411,14 @@ static int __devinit m48t59_rtc_probe(struct platform_device *pdev)
if (!m48t59)
return -ENOMEM;
- m48t59->ioaddr = ioremap(res->start, res->end - res->start + 1);
- if (!m48t59->ioaddr)
- goto out;
+ m48t59->ioaddr = pdata->ioaddr;
+
+ if (!m48t59->ioaddr) {
+ /* ioaddr not mapped externally */
+ m48t59->ioaddr = ioremap(res->start, res->end - res->start + 1);
+ if (!m48t59->ioaddr)
+ goto out;
+ }
/* Try to get irq number. We also can work in
* the mode without IRQ.
@@ -481,11 +486,12 @@ out:
static int __devexit m48t59_rtc_remove(struct platform_device *pdev)
{
struct m48t59_private *m48t59 = platform_get_drvdata(pdev);
+ struct m48t59_plat_data *pdata = pdev->dev.platform_data;
sysfs_remove_bin_file(&pdev->dev.kobj, &m48t59_nvram_attr);
if (!IS_ERR(m48t59->rtc))
rtc_device_unregister(m48t59->rtc);
- if (m48t59->ioaddr)
+ if (m48t59->ioaddr && !pdata->ioaddr)
iounmap(m48t59->ioaddr);
if (m48t59->irq != NO_IRQ)
free_irq(m48t59->irq, &pdev->dev);
OpenPOWER on IntegriCloud