Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Krzysztof Helt and committed by
David S. Miller
64151ad5 94fe7424

+12 -4
+10 -4
drivers/rtc/rtc-m48t59.c
··· 411 411 if (!m48t59) 412 412 return -ENOMEM; 413 413 414 - m48t59->ioaddr = ioremap(res->start, res->end - res->start + 1); 415 - if (!m48t59->ioaddr) 416 - goto out; 414 + m48t59->ioaddr = pdata->ioaddr; 415 + 416 + if (!m48t59->ioaddr) { 417 + /* ioaddr not mapped externally */ 418 + m48t59->ioaddr = ioremap(res->start, res->end - res->start + 1); 419 + if (!m48t59->ioaddr) 420 + goto out; 421 + } 417 422 418 423 /* Try to get irq number. We also can work in 419 424 * the mode without IRQ. ··· 486 481 static int __devexit m48t59_rtc_remove(struct platform_device *pdev) 487 482 { 488 483 struct m48t59_private *m48t59 = platform_get_drvdata(pdev); 484 + struct m48t59_plat_data *pdata = pdev->dev.platform_data; 489 485 490 486 sysfs_remove_bin_file(&pdev->dev.kobj, &m48t59_nvram_attr); 491 487 if (!IS_ERR(m48t59->rtc)) 492 488 rtc_device_unregister(m48t59->rtc); 493 - if (m48t59->ioaddr) 489 + if (m48t59->ioaddr && !pdata->ioaddr) 494 490 iounmap(m48t59->ioaddr); 495 491 if (m48t59->irq != NO_IRQ) 496 492 free_irq(m48t59->irq, &pdev->dev);
+2
include/linux/rtc/m48t59.h
··· 55 55 56 56 int type; /* RTC model */ 57 57 58 + /* ioaddr mapped externally */ 59 + void __iomem *ioaddr; 58 60 /* offset to RTC registers, automatically set according to the type */ 59 61 unsigned int offset; 60 62 };