devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: linux-arm-kernel@lists.infradead.org
Cc: devicetree@vger.kernel.org, z.chenhui@gmail.com,
	Chenhui Zhao <chenhui.zhao@nxp.com>,
	jason.jin@nxp.com, Marc Zyngier <marc.zyngier@arm.com>,
	linux-kernel@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>,
	Jason Cooper <jason@lakedaemon.net>
Subject: Re: [PATCH 2/2] soc: nxp: Add a RCPM driver
Date: Mon, 01 Aug 2016 14:25:04 +0200	[thread overview]
Message-ID: <2024386.Ra8uvttlE9@wuerfel> (raw)
In-Reply-To: <1470044943-3814-2-git-send-email-chenhui.zhao@nxp.com>

On Monday, August 1, 2016 5:49:03 PM CEST Chenhui Zhao wrote:
> The NXP's QorIQ Processors based on ARM Core have a RCPM module
> (Run Control and Power Management), which performs all device-level
> tasks associated with power management.
> 
> This patch mainly implements the wakeup sources configuration before
> entering LPM20, a low power state of device-level. The devices can be
> waked up by specified sources, such as Flextimer, GPIO and so on.
> 
> Signed-off-by: Chenhui Zhao <chenhui.zhao@nxp.com>

Adding irqchip maintainers to cc, as this wakeup handling is normally
part of the irq controller.

> +
> +#include <linux/kernel.h>
> +#include <linux/io.h>
> +#include <linux/of_platform.h>
> +#include <linux/of_address.h>
> +#include <linux/suspend.h>
> +
> +/* So far there are not more than two registers */
> +#define RCPM_IPPDEXPCR0		0x140
> +#define RCPM_IPPDEXPCR1		0x144
> +#define RCPM_IPPDEXPCR(x)	(RCPM_IPPDEXPCR0 + 4 * x)
> +#define RCPM_WAKEUP_CELL_MAX_SIZE	2
> +
> +/* it reprents the number of the registers RCPM_IPPDEXPCR */
> +static unsigned int rcpm_wakeup_cells;
> +static void __iomem *rcpm_reg_base;
> +static u32 ippdexpcr[RCPM_WAKEUP_CELL_MAX_SIZE];

Can you make these local to the context of whoever
calls into the driver?


> +static void rcpm_wakeup_fixup(struct device *dev, void *data)
> +{
> +	struct device_node *node = dev ? dev->of_node : NULL;
> +	u32 value[RCPM_WAKEUP_CELL_MAX_SIZE + 1];
> +	int ret;
> +	int i;
> +
> +	if (!dev || !node || !device_may_wakeup(dev))
> +		return;
> +
> +	/*
> +	 * Get the values in the "rcpm-wakeup" property.
> +	 * Refer to Documentation/devicetree/bindings/soc/fsl/rcpm.txt
> +	 */
> +	ret = of_property_read_u32_array(node, "rcpm-wakeup",
> +					 value, rcpm_wakeup_cells + 1);

My first impression is that you are trying to do something
in a platform specific way that should be handled by common
code here.

You are parsing rcpm_wakeup_cells once for the global node,
but you don't check whether the device that has the rcpm-wakeup
node actually refers to this instance, and that would require
an incompatible change if we ever get an implementation that
has multiple such nodes.

	Arnd

  reply	other threads:[~2016-08-01 12:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-01  9:49 [PATCH 1/2] ARM: dts: ls1043a: add a rcpm node Chenhui Zhao
2016-08-01  9:49 ` [PATCH 2/2] soc: nxp: Add a RCPM driver Chenhui Zhao
2016-08-01 12:25   ` Arnd Bergmann [this message]
2016-08-01 12:55     ` Marc Zyngier
2016-08-03  3:42     ` Chenhui Zhao
     [not found]   ` <1470044943-3814-2-git-send-email-chenhui.zhao-3arQi8VN3Tc@public.gmane.org>
2016-08-01 13:22     ` Marc Zyngier
2016-08-03  3:28       ` Chenhui Zhao

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=2024386.Ra8uvttlE9@wuerfel \
    --to=arnd@arndb.de \
    --cc=chenhui.zhao@nxp.com \
    --cc=devicetree@vger.kernel.org \
    --cc=jason.jin@nxp.com \
    --cc=jason@lakedaemon.net \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --cc=tglx@linutronix.de \
    --cc=z.chenhui@gmail.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;
as well as URLs for NNTP newsgroup(s).