public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Heiko Stübner" <heiko@sntech.de>
To: Doug Anderson <dianders@chromium.org>
Cc: Chris Zhong <zyw@rock-chips.com>,
	Rob Herring <robh+dt@kernel.org>, Pawel Moll <pawel.moll@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Ian Campbell <ijc+devicetree@hellion.org.uk>,
	Kumar Gala <galak@codeaurora.org>,
	Samuel Ortiz <sameo@linux.intel.com>,
	Lee Jones <lee.jones@linaro.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	"broonie@kernel.org" <broonie@kernel.org>,
	Alessandro Zummo <a.zummo@towertech.it>,
	Mike Turquette <mturquette@linaro.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	rtc-linux@googlegroups.com,
	Grant Likely <grant.likely@linaro.org>,
	Lin Huang <hl@rock-chips.com>,
	Tao Huang <huangtao@rock-chips.com>,
	Eddie Cai <cf@rock-chips.com>,
	zhangqing <zhangqing@rock-chips.com>, xxx <xxx@rock-chips.com>,
	Olof Johansson <olof@lixom.net>,
	Sonny Rao <sonnyrao@chromium.org>,
	Dmitry Torokhov <dtor@chromium.org>,
	Javier Martinez Canillas <javier.martinez@collabora.co.uk>,
	Kever Yang <kever.yang@rock-chips.com>
Subject: Re: [PATCH v6 2/5] MFD: RK808: Add new mfd driver for RK808
Date: Wed, 27 Aug 2014 22:12:56 +0200	[thread overview]
Message-ID: <1802767.SXJx6BfGCT@diego> (raw)
In-Reply-To: <CAD=FV=XasFYbZnFp5edJHsoyr6JRa7Wf0=GJZu3jr1doFULQBg@mail.gmail.com>

Am Mittwoch, 27. August 2014, 12:59:35 schrieb Doug Anderson:
> Heiko,
> 
> On Wed, Aug 27, 2014 at 12:53 PM, Heiko Stübner <heiko@sntech.de> wrote:
> > Hi Chris,
> > 
> > Am Dienstag, 26. August 2014, 22:14:04 schrieb Chris Zhong:
> >> The RK808 chip is a power management IC for multimedia and handheld
> >> devices. It contains the following components:
> >> 
> >> - Regulators
> >> - RTC
> >> - Clkout
> >> 
> >> The RK808 core driver is registered as a platform driver and provides
> >> communication through I2C with the host device for the different
> >> components.
> >> 
> >> Signed-off-by: Chris Zhong <zyw@rock-chips.com>
> >> Signed-off-by: Zhang Qing <zhangqing@rock-chips.com>
> >> 
> >> ---
> > 
> > when testing this with Dougs dts integration I got irq errors like the
> > following:
> > 
> > INT_STS_REG1: 0x0
> > INT_STS_MSK_REG1: 0x0
> > INT_STS_REG2: 0x1
> > INT_STS_MSK_REG2: 0x0
> > random: nonblocking pool is initialized
> > irq 192: nobody cared (try booting with the "irqpoll" option)
> > CPU: 0 PID: 40 Comm: irq/192-rk808 Not tainted 3.17.0-rc1+ #1015
> > [<c001461c>] (unwind_backtrace) from [<c0011190>] (show_stack+0x10/0x14)
> > [<c0011190>] (show_stack) from [<c03e3e04>] (dump_stack+0x6c/0x84)
> > [<c03e3e04>] (dump_stack) from [<c00508e4>] (__report_bad_irq+0x28/0xb8)
> > [<c00508e4>] (__report_bad_irq) from [<c0050de4>]
> > (note_interrupt+0x1e8/0x28c) [<c0050de4>] (note_interrupt) from
> > [<c004ebdc>] (handle_irq_event_percpu+0x104/0x120) [<c004ebdc>]
> > (handle_irq_event_percpu) from [<c004ec3c>] (handle_irq_event+0x44/0x64)
> > [<c004ec3c>] (handle_irq_event) from [<c0051910>]
> > (handle_level_irq+0xd4/0x11c) [<c0051910>] (handle_level_irq) from
> > [<c004e5a8>] (generic_handle_irq+0x20/0x30) [<c004e5a8>]
> > (generic_handle_irq) from [<c01ba490>] (rockchip_irq_demux+0x190/0x228)
> > [<c01ba490>] (rockchip_irq_demux) from [<c004e5a8>]
> > (generic_handle_irq+0x20/0x30) [<c004e5a8>] (generic_handle_irq) from
> > [<c000f060>] (handle_IRQ+0x68/0x90) [<c000f060>] (handle_IRQ) from
> > [<c000858c>] (gic_handle_irq+0x3c/0x60) [<c000858c>] (gic_handle_irq)
> > from [<c0011bc0>] (__irq_svc+0x40/0x50) Exception stack(0xee31bed8 to
> > 0xee31bf20)
> > bec0:                                                       ee093518
> > f005e000 bee0: 00000010 000093e9 ee1fe880 ee2f98c0 ee1fe880 ee2f98e0
> > c004f6f0 00000000 bf00: 00000000 00000000 c03eb6d0 ee31bf20 c00522dc
> > c004f628 60000113 ffffffff [<c0011bc0>] (__irq_svc) from [<c004f628>]
> > (irq_finalize_oneshot+0xd4/0xf0) [<c004f628>] (irq_finalize_oneshot) from
> > [<c004f71c>] (irq_thread_fn+0x2c/0x34) [<c004f71c>] (irq_thread_fn) from
> > [<c004f844>] (irq_thread+0xc4/0x148) [<c004f844>] (irq_thread) from
> > [<c0035524>] (kthread+0xdc/0xf0)
> > [<c0035524>] (kthread) from [<c000e7f8>] (ret_from_fork+0x14/0x3c)
> > handlers:
> > [<c004ec5c>] irq_default_primary_handler threaded [<c021cc7c>]
> > regmap_irq_thread Disabling IRQ #192
> > 
> > 
> > As you can see there was already a PLUG_IN_INT pending, which stalled the
> > 
> > system till the irq got deactivated after 100000 iterations:
> >            CPU0
> > 
> > [...]
> > 
> >  92:     600231       GIC  92  ff650000.i2c
> > 
> > 192:     100001  rockchip_gpio_irq   4  rk808
> > 
> > 
> > I fixed it up with the following:
> > 
> > ------------ 8< ---------------
> > diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c
> > index f0d6518..1c25be7 100644
> > --- a/drivers/mfd/rk808.c
> > +++ b/drivers/mfd/rk808.c
> > @@ -61,8 +61,14 @@ static const struct rk808_reg_data pre_init_reg[] = {
> > 
> >         { RK808_BUCK2_CONFIG_REG, BUCK2_RATE_MASK,  BUCK_ILMIN_200MA },
> >         { RK808_VB_MON_REG,       MASK_ALL,         VB_LO_ACT |
> >         
> >                                                     VB_LO_SEL_3500MV },
> > 
> > -       { RK808_INT_STS_REG1,     MASK_NONE,        0 },
> > -       { RK808_INT_STS_REG2,     MASK_NONE,        0 },
> > +
> > +       /* ack any pending interrupts */
> > +       { RK808_INT_STS_REG1,     INT_STS_REG1_MASK, INT_STS_REG1_MASK },
> > +       { RK808_INT_STS_REG2,     INT_STS_REG2_MASK, INT_STS_REG2_MASK },
> > +
> > +       /* mask all interrupts */
> > +       { RK808_INT_STS_MSK_REG1, INT_STS_REG1_MASK, INT_STS_REG1_MASK },
> > +       { RK808_INT_STS_MSK_REG2, INT_STS_REG2_MASK, INT_STS_REG2_MASK },
> > 
> >  };
> >  
> >  static const struct regmap_irq rk808_irqs[] = {
> > 
> > diff --git a/include/linux/mfd/rk808.h b/include/linux/mfd/rk808.h
> > index 7af1952..8f8e48c 100644
> > --- a/include/linux/mfd/rk808.h
> > +++ b/include/linux/mfd/rk808.h
> > @@ -156,6 +156,8 @@ enum rk808_reg {
> > 
> >  #define BUCK2_RATE_MASK                (3 << 3)
> >  #define MASK_ALL       0xff
> >  #define MASK_NONE      0
> > 
> > +#define INT_STS_REG1_MASK      0x7f
> > +#define INT_STS_REG2_MASK      0x3
> > 
> >  #define SWITCH2_EN     BIT(6)
> >  #define SWITCH1_EN     BIT(5)
> > 
> > ------------ 8< ---------------
> > 
> > On startup I guess all pending irqs should be acked and also masked, as we
> > normally don't want to handle interrupts that happened way in the past
> > and they will get unmasked on their own, when one of them gets requested
> > by the rtc for example.
> > 
> > 
> > Heiko
> 
> Please see <https://chromium-review.googlesource.com/214241>  I asked
> Chris to squash this into his next revision.

Letting regmap handle this, is of course even better :-)


Heiko

      reply	other threads:[~2014-08-27 20:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-26 14:14 [PATCH v6 2/5] MFD: RK808: Add new mfd driver for RK808 Chris Zhong
2014-08-26 17:08 ` Doug Anderson
2014-08-27 13:39 ` Lee Jones
2014-08-27 15:56   ` Doug Anderson
2014-08-27 17:02     ` Lee Jones
2014-08-27 17:21   ` Dmitry Torokhov
2014-08-27 20:01     ` Doug Anderson
2014-08-28  7:33     ` Lee Jones
2014-08-27 19:53 ` Heiko Stübner
2014-08-27 19:59   ` Doug Anderson
2014-08-27 20:12     ` Heiko Stübner [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1802767.SXJx6BfGCT@diego \
    --to=heiko@sntech.de \
    --cc=a.zummo@towertech.it \
    --cc=broonie@kernel.org \
    --cc=cf@rock-chips.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dianders@chromium.org \
    --cc=dtor@chromium.org \
    --cc=galak@codeaurora.org \
    --cc=grant.likely@linaro.org \
    --cc=hl@rock-chips.com \
    --cc=huangtao@rock-chips.com \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=javier.martinez@collabora.co.uk \
    --cc=kever.yang@rock-chips.com \
    --cc=lee.jones@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mturquette@linaro.org \
    --cc=olof@lixom.net \
    --cc=pawel.moll@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=rtc-linux@googlegroups.com \
    --cc=sameo@linux.intel.com \
    --cc=sonnyrao@chromium.org \
    --cc=xxx@rock-chips.com \
    --cc=zhangqing@rock-chips.com \
    --cc=zyw@rock-chips.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox