Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 64151ad5 authored by Krzysztof Helt's avatar Krzysztof Helt Committed by David S. Miller
Browse files

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: default avatarKrzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 94fe7424
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -411,9 +411,14 @@ static int __devinit m48t59_rtc_probe(struct platform_device *pdev)
	if (!m48t59)
		return -ENOMEM;

	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 @@ static int __devinit m48t59_rtc_probe(struct platform_device *pdev)
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);
+2 −0
Original line number Diff line number Diff line
@@ -55,6 +55,8 @@ struct m48t59_plat_data {

	int type; /* RTC model */

	/* ioaddr mapped externally */
	void __iomem *ioaddr;
	/* offset to RTC registers, automatically set according to the type */
	unsigned int offset;
};