mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/4] Blackfin RTC Driver updates
@ 2008-08-15  9:01 Bryan Wu
  2008-08-15  9:01 ` [PATCH 1/4] Blackfin RTC Driver: move irq request/free out of open/release and into probe/remove so that the non-dev interfaces (like sysfs) work as expected Bryan Wu
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Bryan Wu @ 2008-08-15  9:01 UTC (permalink / raw)
  To: a.zummo, rtc-linux; +Cc: akpm, linux-kernel


Hi folks,

These the latest 4 Blackfin RTC driver updating patches.

Thanks,
-Bryan

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/4] Blackfin RTC Driver: move irq request/free out of open/release and into probe/remove so that the non-dev interfaces (like sysfs) work as expected
  2008-08-15  9:01 [PATCH 0/4] Blackfin RTC Driver updates Bryan Wu
@ 2008-08-15  9:01 ` Bryan Wu
  2008-08-18 21:57   ` Andrew Morton
  2008-08-15  9:01 ` [PATCH 2/4] Blackfin RTC Driver: do all initialization before we register the rtc and make it available Bryan Wu
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 6+ messages in thread
From: Bryan Wu @ 2008-08-15  9:01 UTC (permalink / raw)
  To: a.zummo, rtc-linux; +Cc: akpm, linux-kernel, Mike Frysinger, Bryan Wu

From: Mike Frysinger <vapier.adi@gmail.com>

Signed-off-by: Mike Frysinger <vapier.adi@gmail.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
---
 drivers/rtc/rtc-bfin.c |   51 ++++++++++++++++++-----------------------------
 1 files changed, 20 insertions(+), 31 deletions(-)

diff --git a/drivers/rtc/rtc-bfin.c b/drivers/rtc/rtc-bfin.c
index a1af4c2..51741dc 100644
--- a/drivers/rtc/rtc-bfin.c
+++ b/drivers/rtc/rtc-bfin.c
@@ -218,26 +218,6 @@ static irqreturn_t bfin_rtc_interrupt(int irq, void *dev_id)
 		return IRQ_NONE;
 }
 
-static int bfin_rtc_open(struct device *dev)
-{
-	int ret;
-
-	dev_dbg_stamp(dev);
-
-	ret = request_irq(IRQ_RTC, bfin_rtc_interrupt, IRQF_SHARED, to_platform_device(dev)->name, dev);
-	if (!ret)
-		bfin_rtc_reset(dev, RTC_ISTAT_WRITE_COMPLETE);
-
-	return ret;
-}
-
-static void bfin_rtc_release(struct device *dev)
-{
-	dev_dbg_stamp(dev);
-	bfin_rtc_reset(dev, 0);
-	free_irq(IRQ_RTC, dev);
-}
-
 static void bfin_rtc_int_set(u16 rtc_int)
 {
 	bfin_write_RTC_ISTAT(rtc_int);
@@ -370,8 +350,6 @@ static int bfin_rtc_proc(struct device *dev, struct seq_file *seq)
 }
 
 static struct rtc_class_ops bfin_rtc_ops = {
-	.open          = bfin_rtc_open,
-	.release       = bfin_rtc_release,
 	.ioctl         = bfin_rtc_ioctl,
 	.read_time     = bfin_rtc_read_time,
 	.set_time      = bfin_rtc_set_time,
@@ -383,29 +361,37 @@ static struct rtc_class_ops bfin_rtc_ops = {
 static int __devinit bfin_rtc_probe(struct platform_device *pdev)
 {
 	struct bfin_rtc *rtc;
+	struct device *dev = &pdev->dev;
 	int ret = 0;
 
-	dev_dbg_stamp(&pdev->dev);
+	dev_dbg_stamp(dev);
 
+	/* Allocate memory for our RTC struct */
 	rtc = kzalloc(sizeof(*rtc), GFP_KERNEL);
 	if (unlikely(!rtc))
 		return -ENOMEM;
+	platform_set_drvdata(pdev, rtc);
 
-	rtc->rtc_dev = rtc_device_register(pdev->name, &pdev->dev, &bfin_rtc_ops, THIS_MODULE);
-	if (IS_ERR(rtc)) {
-		ret = PTR_ERR(rtc->rtc_dev);
+	/* Grab the IRQ and init the hardware */
+	ret = request_irq(IRQ_RTC, bfin_rtc_interrupt, IRQF_SHARED, pdev->name, dev);
+	if (unlikely(ret))
 		goto err;
-	}
-
-	/* see comment at top of file about stopwatch/PIE */
+	bfin_rtc_reset(dev, RTC_ISTAT_WRITE_COMPLETE);
 	bfin_write_RTC_SWCNT(0);
 
-	platform_set_drvdata(pdev, rtc);
+	/* Register our RTC with the RTC framework */
+	rtc->rtc_dev = rtc_device_register(pdev->name, dev, &bfin_rtc_ops, THIS_MODULE);
+	if (unlikely(IS_ERR(rtc))) {
+		ret = PTR_ERR(rtc->rtc_dev);
+		goto err_irq;
+	}
 
-	device_init_wakeup(&pdev->dev, 1);
+	device_init_wakeup(dev, 1);
 
 	return 0;
 
+ err_irq:
+	free_irq(IRQ_RTC, dev);
  err:
 	kfree(rtc);
 	return ret;
@@ -414,7 +400,10 @@ static int __devinit bfin_rtc_probe(struct platform_device *pdev)
 static int __devexit bfin_rtc_remove(struct platform_device *pdev)
 {
 	struct bfin_rtc *rtc = platform_get_drvdata(pdev);
+	struct device *dev = &pdev->dev;
 
+	bfin_rtc_reset(dev, 0);
+	free_irq(IRQ_RTC, dev);
 	rtc_device_unregister(rtc->rtc_dev);
 	platform_set_drvdata(pdev, NULL);
 	kfree(rtc);
-- 
1.5.6

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 2/4] Blackfin RTC Driver: do all initialization before we register the rtc and make it available
  2008-08-15  9:01 [PATCH 0/4] Blackfin RTC Driver updates Bryan Wu
  2008-08-15  9:01 ` [PATCH 1/4] Blackfin RTC Driver: move irq request/free out of open/release and into probe/remove so that the non-dev interfaces (like sysfs) work as expected Bryan Wu
@ 2008-08-15  9:01 ` Bryan Wu
  2008-08-15  9:01 ` [PATCH 3/4] Blackfin RTC Driver: BF561 not have on-chip RTC Bryan Wu
  2008-08-15  9:01 ` [PATCH 4/4] Blackfin RTC Driver: dont let RTC programming in bootloaders randomly cause ~5 second boot delays Bryan Wu
  3 siblings, 0 replies; 6+ messages in thread
From: Bryan Wu @ 2008-08-15  9:01 UTC (permalink / raw)
  To: a.zummo, rtc-linux; +Cc: akpm, linux-kernel, Mike Frysinger, Bryan Wu

From: Mike Frysinger <vapier.adi@gmail.com>

Signed-off-by: Mike Frysinger <vapier.adi@gmail.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
---
 drivers/rtc/rtc-bfin.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/rtc/rtc-bfin.c b/drivers/rtc/rtc-bfin.c
index 51741dc..9d2da1c 100644
--- a/drivers/rtc/rtc-bfin.c
+++ b/drivers/rtc/rtc-bfin.c
@@ -371,6 +371,7 @@ static int __devinit bfin_rtc_probe(struct platform_device *pdev)
 	if (unlikely(!rtc))
 		return -ENOMEM;
 	platform_set_drvdata(pdev, rtc);
+	device_init_wakeup(dev, 1);
 
 	/* Grab the IRQ and init the hardware */
 	ret = request_irq(IRQ_RTC, bfin_rtc_interrupt, IRQF_SHARED, pdev->name, dev);
@@ -386,8 +387,6 @@ static int __devinit bfin_rtc_probe(struct platform_device *pdev)
 		goto err_irq;
 	}
 
-	device_init_wakeup(dev, 1);
-
 	return 0;
 
  err_irq:
-- 
1.5.6

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 3/4] Blackfin RTC Driver: BF561 not have on-chip RTC
  2008-08-15  9:01 [PATCH 0/4] Blackfin RTC Driver updates Bryan Wu
  2008-08-15  9:01 ` [PATCH 1/4] Blackfin RTC Driver: move irq request/free out of open/release and into probe/remove so that the non-dev interfaces (like sysfs) work as expected Bryan Wu
  2008-08-15  9:01 ` [PATCH 2/4] Blackfin RTC Driver: do all initialization before we register the rtc and make it available Bryan Wu
@ 2008-08-15  9:01 ` Bryan Wu
  2008-08-15  9:01 ` [PATCH 4/4] Blackfin RTC Driver: dont let RTC programming in bootloaders randomly cause ~5 second boot delays Bryan Wu
  3 siblings, 0 replies; 6+ messages in thread
From: Bryan Wu @ 2008-08-15  9:01 UTC (permalink / raw)
  To: a.zummo, rtc-linux; +Cc: akpm, linux-kernel, Graf Yang, Bryan Wu

From: Graf Yang <graf.yang@analog.com>

Signed-off-by: Graf Yang <graf.yang@analog.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
---
 drivers/rtc/Kconfig |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 90ab738..9a9755c 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -561,7 +561,7 @@ config RTC_DRV_AT91SAM9_GPBR
 
 config RTC_DRV_BFIN
 	tristate "Blackfin On-Chip RTC"
-	depends on BLACKFIN
+	depends on BLACKFIN && !BF561
 	help
 	  If you say yes here you will get support for the
 	  Blackfin On-Chip Real Time Clock.
-- 
1.5.6

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 4/4] Blackfin RTC Driver: dont let RTC programming in bootloaders randomly cause ~5 second boot delays
  2008-08-15  9:01 [PATCH 0/4] Blackfin RTC Driver updates Bryan Wu
                   ` (2 preceding siblings ...)
  2008-08-15  9:01 ` [PATCH 3/4] Blackfin RTC Driver: BF561 not have on-chip RTC Bryan Wu
@ 2008-08-15  9:01 ` Bryan Wu
  3 siblings, 0 replies; 6+ messages in thread
From: Bryan Wu @ 2008-08-15  9:01 UTC (permalink / raw)
  To: a.zummo, rtc-linux; +Cc: akpm, linux-kernel, Mike Frysinger, Bryan Wu

From: Mike Frysinger <vapier.adi@gmail.com>

Signed-off-by: Mike Frysinger <vapier.adi@gmail.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
---
 drivers/rtc/rtc-bfin.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/drivers/rtc/rtc-bfin.c b/drivers/rtc/rtc-bfin.c
index 9d2da1c..34439ce 100644
--- a/drivers/rtc/rtc-bfin.c
+++ b/drivers/rtc/rtc-bfin.c
@@ -363,6 +363,7 @@ static int __devinit bfin_rtc_probe(struct platform_device *pdev)
 	struct bfin_rtc *rtc;
 	struct device *dev = &pdev->dev;
 	int ret = 0;
+	unsigned long timeout;
 
 	dev_dbg_stamp(dev);
 
@@ -377,6 +378,13 @@ static int __devinit bfin_rtc_probe(struct platform_device *pdev)
 	ret = request_irq(IRQ_RTC, bfin_rtc_interrupt, IRQF_SHARED, pdev->name, dev);
 	if (unlikely(ret))
 		goto err;
+	/* sometimes the bootloader touched things, but the write complete was not
+	 * enabled, so let's just do a quick timeout here since the IRQ will not fire ...
+	 */
+	timeout = jiffies + HZ;
+	while (bfin_read_RTC_ISTAT() & RTC_ISTAT_WRITE_PENDING)
+		if (time_after(jiffies, timeout))
+			break;
 	bfin_rtc_reset(dev, RTC_ISTAT_WRITE_COMPLETE);
 	bfin_write_RTC_SWCNT(0);
 
-- 
1.5.6

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/4] Blackfin RTC Driver: move irq request/free out of open/release and into probe/remove so that the non-dev interfaces (like sysfs) work as expected
  2008-08-15  9:01 ` [PATCH 1/4] Blackfin RTC Driver: move irq request/free out of open/release and into probe/remove so that the non-dev interfaces (like sysfs) work as expected Bryan Wu
@ 2008-08-18 21:57   ` Andrew Morton
  0 siblings, 0 replies; 6+ messages in thread
From: Andrew Morton @ 2008-08-18 21:57 UTC (permalink / raw)
  To: Bryan Wu; +Cc: a.zummo, rtc-linux, linux-kernel, vapier.adi, cooloney

On Fri, 15 Aug 2008 17:01:17 +0800
Bryan Wu <cooloney@kernel.org> wrote:

> Subject: [PATCH 1/4] Blackfin RTC Driver: move irq request/free out of open/release and into probe/remove so that the non-dev interfaces (like sysfs) work as expected

umm, please don't try to fit the whole changelog into the patch title.

> Date: Fri, 15 Aug 2008 17:01:17 +0800
> X-Mailer: git-send-email 1.5.6
> 
> From: Mike Frysinger <vapier.adi@gmail.com>

put it here instead?

> Signed-off-by: Mike Frysinger <vapier.adi@gmail.com>
> Signed-off-by: Bryan Wu <cooloney@kernel.org>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-08-18 21:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-15  9:01 [PATCH 0/4] Blackfin RTC Driver updates Bryan Wu
2008-08-15  9:01 ` [PATCH 1/4] Blackfin RTC Driver: move irq request/free out of open/release and into probe/remove so that the non-dev interfaces (like sysfs) work as expected Bryan Wu
2008-08-18 21:57   ` Andrew Morton
2008-08-15  9:01 ` [PATCH 2/4] Blackfin RTC Driver: do all initialization before we register the rtc and make it available Bryan Wu
2008-08-15  9:01 ` [PATCH 3/4] Blackfin RTC Driver: BF561 not have on-chip RTC Bryan Wu
2008-08-15  9:01 ` [PATCH 4/4] Blackfin RTC Driver: dont let RTC programming in bootloaders randomly cause ~5 second boot delays Bryan Wu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome