From: khilman@kernel.org (Kevin Hilman)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v4 1/3] power-domain: add power domain drivers for Rockchip platform
Date: Mon, 20 Oct 2014 14:31:17 -0700 [thread overview]
Message-ID: <7hppdme8d6.fsf@deeprootsystems.com> (raw)
In-Reply-To: <1413795824-3453-2-git-send-email-jinkun.hong@rock-chips.com> (jinkun hong's message of "Mon, 20 Oct 2014 02:03:41 -0700")
"jinkun.hong" <jinkun.hong@rock-chips.com> writes:
> From: "jinkun.hong" <jinkun.hong@rock-chips.com>
>
> Add power domain drivers based on generic power domain for Rockchip platform,
> and support RK3288.
>
> Signed-off-by: Jack Dai <jack.dai@rock-chips.com>
> Signed-off-by: jinkun.hong <jinkun.hong@rock-chips.com>
[...]
> +static int rockchip_pmu_set_idle_request(struct rockchip_domain *pd,
> + bool idle)
> +{
> + u32 idle_mask = BIT(pd->idle_shift);
> + u32 idle_target = idle << (pd->idle_shift);
> + u32 ack_mask = BIT(pd->ack_shift);
> + u32 ack_target = idle << (pd->ack_shift);
> + unsigned int mask = BIT(pd->req_shift);
> + unsigned int val;
> + unsigned long flags;
> +
> + spin_lock_irqsave(&pd->idle_lock, flags);
> + val = (idle) ? mask : 0;
> + regmap_update_bits(pd->regmap_pmu, REQ_OFFSET, mask, val);
> + dsb();
A summary of the locking and barriers here (or in changelog) would be
helpful for reviewers to verify you're protecting what you need to
protect.
> + do {
> + regmap_read(pd->regmap_pmu, ACK_OFFSET, &val);
> + } while ((val & ack_mask) != ack_target);
> +
> + do {
> + regmap_read(pd->regmap_pmu, IDLE_OFFSET, &val);
> + } while ((val & idle_mask) != idle_target);
> +
> + spin_unlock_irqrestore(&pd->idle_lock, flags);
These IRQ-disabled while loops look like opportunities to lockup the
system. Maybe add a timeout or a maximum number of tries?
> + return 0;
> +}
Kevin
WARNING: multiple messages have this Message-ID (diff)
From: Kevin Hilman <khilman@kernel.org>
To: "jinkun.hong" <jinkun.hong@rock-chips.com>
Cc: linus.walleij@linaro.org, linux-arm-kernel@lists.infradead.org,
Russell King <linux@arm.linux.org.uk>,
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>,
Grant Likely <grant.likely@linaro.org>,
linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
Randy Dunlap <rdunlap@infradead.org>,
linux-doc@vger.kernel.org, dianders@chromium.org,
Heiko Stuebner <heiko@sntech.de>,
linux-rockchip@lists.infradead.org,
Ulf Hansson <ulf.hansson@linaro.org>,
Jack Dai <jack.dai@rock-chips.com>
Subject: Re: [PATCH v4 1/3] power-domain: add power domain drivers for Rockchip platform
Date: Mon, 20 Oct 2014 14:31:17 -0700 [thread overview]
Message-ID: <7hppdme8d6.fsf@deeprootsystems.com> (raw)
In-Reply-To: <1413795824-3453-2-git-send-email-jinkun.hong@rock-chips.com> (jinkun hong's message of "Mon, 20 Oct 2014 02:03:41 -0700")
"jinkun.hong" <jinkun.hong@rock-chips.com> writes:
> From: "jinkun.hong" <jinkun.hong@rock-chips.com>
>
> Add power domain drivers based on generic power domain for Rockchip platform,
> and support RK3288.
>
> Signed-off-by: Jack Dai <jack.dai@rock-chips.com>
> Signed-off-by: jinkun.hong <jinkun.hong@rock-chips.com>
[...]
> +static int rockchip_pmu_set_idle_request(struct rockchip_domain *pd,
> + bool idle)
> +{
> + u32 idle_mask = BIT(pd->idle_shift);
> + u32 idle_target = idle << (pd->idle_shift);
> + u32 ack_mask = BIT(pd->ack_shift);
> + u32 ack_target = idle << (pd->ack_shift);
> + unsigned int mask = BIT(pd->req_shift);
> + unsigned int val;
> + unsigned long flags;
> +
> + spin_lock_irqsave(&pd->idle_lock, flags);
> + val = (idle) ? mask : 0;
> + regmap_update_bits(pd->regmap_pmu, REQ_OFFSET, mask, val);
> + dsb();
A summary of the locking and barriers here (or in changelog) would be
helpful for reviewers to verify you're protecting what you need to
protect.
> + do {
> + regmap_read(pd->regmap_pmu, ACK_OFFSET, &val);
> + } while ((val & ack_mask) != ack_target);
> +
> + do {
> + regmap_read(pd->regmap_pmu, IDLE_OFFSET, &val);
> + } while ((val & idle_mask) != idle_target);
> +
> + spin_unlock_irqrestore(&pd->idle_lock, flags);
These IRQ-disabled while loops look like opportunities to lockup the
system. Maybe add a timeout or a maximum number of tries?
> + return 0;
> +}
Kevin
next prev parent reply other threads:[~2014-10-20 21:31 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-20 9:03 [PATCH v4 0/3] ARM: rk3288 : Add PM Domain support jinkun.hong
2014-10-20 9:03 ` jinkun.hong
2014-10-20 9:03 ` [PATCH v4 1/3] power-domain: add power domain drivers for Rockchip platform jinkun.hong
2014-10-20 9:03 ` jinkun.hong
2014-10-20 9:09 ` Varka Bhadram
2014-10-20 9:09 ` Varka Bhadram
2014-10-20 21:31 ` Kevin Hilman [this message]
2014-10-20 21:31 ` Kevin Hilman
2014-10-20 21:40 ` Russell King - ARM Linux
2014-10-20 21:40 ` Russell King - ARM Linux
2014-10-22 3:40 ` Hong jinkun
2014-10-22 3:40 ` Hong jinkun
2014-10-20 9:03 ` [PATCH v4 2/3] dt-bindings: add document of Rockchip power domain jinkun.hong
2014-10-20 9:03 ` jinkun.hong
2014-10-20 9:03 ` [PATCH v4 3/3] ARM: dts: add rk3288 power-domain node jinkun.hong
2014-10-20 9:03 ` jinkun.hong
2014-10-20 21:32 ` [PATCH v4 0/3] ARM: rk3288 : Add PM Domain support Kevin Hilman
2014-10-20 21:32 ` Kevin Hilman
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=7hppdme8d6.fsf@deeprootsystems.com \
--to=khilman@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.