linux-3.0: rtc-twl: Updated Sakoman patches with newer versions
authorJoel A Fernandes <agnel.joel@gmail.com>
Thu, 11 Aug 2011 03:12:55 +0000 (22:12 -0500)
committerKoen Kooi <koen@dominion.thruhere.net>
Thu, 11 Aug 2011 06:43:38 +0000 (08:43 +0200)
This fixes all IRQ kernel panics that were showing up on my BeagleBoard-xM

* Refreshed patch that switched to using threaded IRQ (0009-rtc-twl-Switch-to-using-threaded-irq.patch)
* Added patch to fix registration vs init order (0010-fix-registration-vs-init-order.patch)
* Modified batter recharge patch to be applyable with the other changes (0014-rtc-twl-add-support-for-backup-battery-recharge.patch)

Summary of patches added/updated:

[PATCH 1/2] rtc: twl: Use threaded IRQ, remove IRQ enable in interrupt handler
[PATCH 2/2] rtc: twl: Fix registration vs. init order

kernel.org patchwork links:
 http://www.spinics.net/lists/linux-omap/msg54794.html
 http://www.mail-archive.com/linux-omap@vger.kernel.org/msg53176.html

Signed-off-by: Joel A Fernandes <agnel.joel@gmail.com>
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
recipes-kernel/linux/linux-3.0/sakoman/0009-rtc-twl-Switch-to-using-threaded-irq.patch
recipes-kernel/linux/linux-3.0/sakoman/0010-fix-registration-vs-init-order.patch [new file with mode: 0644]
recipes-kernel/linux/linux-3.0/sakoman/0014-rtc-twl-add-support-for-backup-battery-recharge.patch [moved from recipes-kernel/linux/linux-3.0/sakoman/0010-rtc-twl-add-support-for-backup-battery-recharge.patch with 90% similarity]
recipes-kernel/linux/linux_3.0.bb

index 59e1f37497b652a9cce49811428e8328e0e43045..750bec8b1176fb60a08ff7ae1c28560fe3a94b72 100644 (file)
@@ -1,25 +1,61 @@
-From 61f6890ed80c09e40841221d238410a8d9ebace6 Mon Sep 17 00:00:00 2001
-From: Ilkka Koskinen <ilkka.koskinen@nokia.com>
-Date: Wed, 16 Mar 2011 16:07:14 +0000
-Subject: [PATCH 09/13] rtc-twl: Switch to using threaded irq
+From patchwork Wed Jul 27 07:07:20 2011
+Subject: [1/2] rtc: twl: Use threaded IRQ,
+ remove IRQ enable in interrupt handler
+Date: Wed, 27 Jul 2011 07:07:20 -0000
+From: Todd Poynor <toddpoynor@google.com>
+X-Patchwork-Id: 1010862
+Message-Id: <1311750441-5559-1-git-send-email-toddpoynor@google.com>
+To: Alessandro Zummo <a.zummo@towertech.it>
+Cc: rtc-linux@googlegroups.com, linux-omap@vger.kernel.org,
+ linux-kernel@vger.kernel.org, Todd Poynor <toddpoynor@google.com>
+
+IRQs disabled on entry to twl_rtc_interrupt is not a consequence
+of LOCKDEP; both twl6030 and twl4030 explicitly disable IRQs
+before calling the module IRQ handlers.
+
+The ISR should not be enabling IRQs; use a threaded IRQ handler
+instead.
+
+Also fixes warnings:
+
+  WARNING: at kernel/irq/handle.c:130 handle_irq_event_percpu+nnn
+  irq nnn handler twl_rtc_interrupt+nnn enabled interrupts
+
+Signed-off-by: Todd Poynor <toddpoynor@google.com>
 
 ---
- drivers/rtc/rtc-twl.c |    2 +-
- 1 files changed, 1 insertions(+), 1 deletions(-)
+drivers/rtc/rtc-twl.c |   14 +++-----------
+ 1 files changed, 3 insertions(+), 11 deletions(-)
 
 diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c
-index f9a2799..f3e5045 100644
+index 9a81f77..ece41b9 100644
 --- a/drivers/rtc/rtc-twl.c
 +++ b/drivers/rtc/rtc-twl.c
-@@ -462,7 +462,7 @@ static int __devinit twl_rtc_probe(struct platform_device *pdev)
+@@ -362,14 +362,6 @@ static irqreturn_t twl_rtc_interrupt(int irq, void *rtc)
+       int res;
+       u8 rd_reg;
+-#ifdef CONFIG_LOCKDEP
+-      /* WORKAROUND for lockdep forcing IRQF_DISABLED on us, which
+-       * we don't want and can't tolerate.  Although it might be
+-       * friendlier not to borrow this thread context...
+-       */
+-      local_irq_enable();
+-#endif
+-
+       res = twl_rtc_read_u8(&rd_reg, REG_RTC_STATUS_REG);
+       if (res)
+               goto out;
+@@ -462,9 +454,9 @@ static int __devinit twl_rtc_probe(struct platform_device *pdev)
        if (ret < 0)
                goto out1;
  
 -      ret = request_irq(irq, twl_rtc_interrupt,
+-                              IRQF_TRIGGER_RISING,
+-                              dev_name(&rtc->dev), rtc);
 +      ret = request_threaded_irq(irq, NULL, twl_rtc_interrupt,
-                               IRQF_TRIGGER_RISING,
-                               dev_name(&rtc->dev), rtc);
++                                 IRQF_TRIGGER_RISING,
++                                 dev_name(&rtc->dev), rtc);
        if (ret < 0) {
--- 
-1.6.6.1
-
+               dev_err(&pdev->dev, "IRQ is not free.\n");
+               goto out1;
diff --git a/recipes-kernel/linux/linux-3.0/sakoman/0010-fix-registration-vs-init-order.patch b/recipes-kernel/linux/linux-3.0/sakoman/0010-fix-registration-vs-init-order.patch
new file mode 100644 (file)
index 0000000..16aab35
--- /dev/null
@@ -0,0 +1,128 @@
+From patchwork Wed Jul 27 07:07:21 2011
+Content-Type: text/plain; charset="utf-8"
+MIME-Version: 1.0
+Content-Transfer-Encoding: 7bit
+Subject: [2/2] rtc: twl: Fix registration vs. init order
+Date: Wed, 27 Jul 2011 07:07:21 -0000
+From: Todd Poynor <toddpoynor@google.com>
+X-Patchwork-Id: 1010892
+Message-Id: <1311750441-5559-2-git-send-email-toddpoynor@google.com>
+To: Alessandro Zummo <a.zummo@towertech.it>
+Cc: rtc-linux@googlegroups.com, linux-omap@vger.kernel.org,
+ linux-kernel@vger.kernel.org, Todd Poynor <toddpoynor@google.com>
+
+Only register as an RTC device after the hardware has been
+successfully initialized.  The RTC class driver will call
+back to this driver to read a pending alarm, and other
+drivers watching for new devices on the RTC class may
+read the RTC time upon registration.  Such access might
+occur while the RTC is stopped, prior to clearing
+pending alarms, etc.
+
+The new ordering also avoids leaving the platform
+device drvdata set to an unregistered struct rtc_device *
+on probe errors.
+
+Signed-off-by: Todd Poynor <toddpoynor@google.com>
+
+---
+drivers/rtc/rtc-twl.c |   52 ++++++++++++++++++++++--------------------------
+ 1 files changed, 24 insertions(+), 28 deletions(-)
+
+diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c
+index ece41b9..20687d5 100644
+--- a/drivers/rtc/rtc-twl.c
++++ b/drivers/rtc/rtc-twl.c
+@@ -420,24 +420,12 @@ static struct rtc_class_ops twl_rtc_ops = {
+ static int __devinit twl_rtc_probe(struct platform_device *pdev)
+ {
+       struct rtc_device *rtc;
+-      int ret = 0;
++      int ret = -EINVAL;
+       int irq = platform_get_irq(pdev, 0);
+       u8 rd_reg;
+       if (irq <= 0)
+-              return -EINVAL;
+-
+-      rtc = rtc_device_register(pdev->name,
+-                                &pdev->dev, &twl_rtc_ops, THIS_MODULE);
+-      if (IS_ERR(rtc)) {
+-              ret = PTR_ERR(rtc);
+-              dev_err(&pdev->dev, "can't register RTC device, err %ld\n",
+-                      PTR_ERR(rtc));
+-              goto out0;
+-
+-      }
+-
+-      platform_set_drvdata(pdev, rtc);
++              goto out1;
+       ret = twl_rtc_read_u8(&rd_reg, REG_RTC_STATUS_REG);
+       if (ret < 0)
+@@ -454,14 +442,6 @@ static int __devinit twl_rtc_probe(struct platform_device *pdev)
+       if (ret < 0)
+               goto out1;
+-      ret = request_threaded_irq(irq, NULL, twl_rtc_interrupt,
+-                                 IRQF_TRIGGER_RISING,
+-                                 dev_name(&rtc->dev), rtc);
+-      if (ret < 0) {
+-              dev_err(&pdev->dev, "IRQ is not free.\n");
+-              goto out1;
+-      }
+-
+       if (twl_class_is_6030()) {
+               twl6030_interrupt_unmask(TWL6030_RTC_INT_MASK,
+                       REG_INT_MSK_LINE_A);
+@@ -472,28 +452,44 @@ static int __devinit twl_rtc_probe(struct platform_device *pdev)
+       /* Check RTC module status, Enable if it is off */
+       ret = twl_rtc_read_u8(&rd_reg, REG_RTC_CTRL_REG);
+       if (ret < 0)
+-              goto out2;
++              goto out1;
+       if (!(rd_reg & BIT_RTC_CTRL_REG_STOP_RTC_M)) {
+               dev_info(&pdev->dev, "Enabling TWL-RTC.\n");
+               rd_reg = BIT_RTC_CTRL_REG_STOP_RTC_M;
+               ret = twl_rtc_write_u8(rd_reg, REG_RTC_CTRL_REG);
+               if (ret < 0)
+-                      goto out2;
++                      goto out1;
+       }
+       /* init cached IRQ enable bits */
+       ret = twl_rtc_read_u8(&rtc_irq_bits, REG_RTC_INTERRUPTS_REG);
+       if (ret < 0)
++              goto out1;
++
++      rtc = rtc_device_register(pdev->name,
++                                &pdev->dev, &twl_rtc_ops, THIS_MODULE);
++      if (IS_ERR(rtc)) {
++              ret = PTR_ERR(rtc);
++              dev_err(&pdev->dev, "can't register RTC device, err %ld\n",
++                      PTR_ERR(rtc));
++              goto out1;
++      }
++
++      ret = request_threaded_irq(irq, NULL, twl_rtc_interrupt,
++                                 IRQF_TRIGGER_RISING,
++                                 dev_name(&rtc->dev), rtc);
++      if (ret < 0) {
++              dev_err(&pdev->dev, "IRQ is not free.\n");
+               goto out2;
++      }
+-      return ret;
++      platform_set_drvdata(pdev, rtc);
++      return 0;
+ out2:
+-      free_irq(irq, rtc);
+-out1:
+       rtc_device_unregister(rtc);
+-out0:
++out1:
+       return ret;
+ }
similarity index 90%
rename from recipes-kernel/linux/linux-3.0/sakoman/0010-rtc-twl-add-support-for-backup-battery-recharge.patch
rename to recipes-kernel/linux/linux-3.0/sakoman/0014-rtc-twl-add-support-for-backup-battery-recharge.patch
index 7afbf33bcba9c6036fa782a7ce9994095540458a..270d0af39597b8488ae35d3685f1712fc6f2c678 100644 (file)
@@ -7,14 +7,16 @@ Subject: [PATCH 10/13] rtc-twl: add support for backup battery recharge
  drivers/rtc/rtc-twl.c |   25 +++++++++++++++++++++++++
  1 files changed, 25 insertions(+), 0 deletions(-)
 
+
 diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c
-index f3e5045..1fe1bc9 100644
+index a64494e..552446b 100644
 --- a/drivers/rtc/rtc-twl.c
 +++ b/drivers/rtc/rtc-twl.c
-@@ -30,6 +30,23 @@
+@@ -30,7 +30,24 @@
  
  #include <linux/i2c/twl.h>
  
+-
 +/*
 + * PM_RECEIVER block register offsets (use TWL4030_MODULE_PM_RECEIVER)
 + */
@@ -32,12 +34,13 @@ index f3e5045..1fe1bc9 100644
 +#define BIT_PM_RECEIVER_BB_CFG_BBISEL_150UA     0x01
 +#define BIT_PM_RECEIVER_BB_CFG_BBISEL_500UA     0x02
 +#define BIT_PM_RECEIVER_BB_CFG_BBISEL_1MA       0x03
++ 
  /*
   * RTC block register offsets (use TWL_MODULE_RTC)
-@@ -495,6 +512,14 @@ static int __devinit twl_rtc_probe(struct platform_device *pdev)
-       if (ret < 0)
+  */
+@@ -484,6 +501,14 @@ static int __devinit twl_rtc_probe(struct platform_device *pdev)
                goto out2;
+       }
  
 +      /* enable backup battery charging */
 +      /* use a conservative 25uA @ 3.1V */
@@ -47,9 +50,6 @@ index f3e5045..1fe1bc9 100644
 +              BIT_PM_RECEIVER_BB_CFG_BBISEL_25UA,
 +              REG_BB_CFG);
 +
-       return ret;
- out2:
--- 
-1.6.6.1
+       platform_set_drvdata(pdev, rtc);
+       return 0;
 
index edb8df7914434550894a5847f244d0ae7f85a597..718b6af0b1a96fa511f8905e43ee637665285b9d 100644 (file)
@@ -9,7 +9,7 @@ COMPATIBLE_MACHINE = "(beagleboard)"
 SRCREV_pn-${PN} = "94ed5b4788a7cdbe68bc7cb8516972cbebdc8274"
 
 # The main PR is now using MACHINE_KERNEL_PR, for omap3 see conf/machine/include/omap3.inc
-MACHINE_KERNEL_PR_append = "k"
+MACHINE_KERNEL_PR_append = "m"
 
 FILESPATHPKG_prepend = "linux-3.0:"
 
@@ -208,10 +208,11 @@ SRC_URI += "git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-3.0.y.git
             file://sakoman/0007-drivers-input-touchscreen-ads7846-return-ENODEV-if-d.patch \
             file://sakoman/0008-Revert-omap2_mcspi-Flush-posted-writes.patch \
             file://sakoman/0009-rtc-twl-Switch-to-using-threaded-irq.patch \
-            file://sakoman/0010-rtc-twl-add-support-for-backup-battery-recharge.patch \
+            file://sakoman/0010-fix-registration-vs-init-order.patch \
             file://sakoman/0011-soc-codecs-Enable-audio-capture-by-default-for-twl40.patch \
             file://sakoman/0012-soc-codecs-twl4030-Turn-on-mic-bias-by-default.patch \
             file://sakoman/0013-omap-mmc-twl4030-move-clock-input-selection-prior-to.patch \
+            file://sakoman/0014-rtc-twl-add-support-for-backup-battery-recharge.patch \
             \
             file://sgx/0001-ARM-L2-Add-and-export-outer_clean_all.patch \
             file://defconfig"