From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753518AbcHAM0k (ORCPT ); Mon, 1 Aug 2016 08:26:40 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:61089 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753686AbcHAMZn (ORCPT ); Mon, 1 Aug 2016 08:25:43 -0400 From: Arnd Bergmann To: linux-arm-kernel@lists.infradead.org Cc: Chenhui Zhao , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, z.chenhui@gmail.com, jason.jin@nxp.com, Thomas Gleixner , Jason Cooper , Marc Zyngier Subject: Re: [PATCH 2/2] soc: nxp: Add a RCPM driver Date: Mon, 01 Aug 2016 14:25:04 +0200 Message-ID: <2024386.Ra8uvttlE9@wuerfel> User-Agent: KMail/5.1.3 (Linux/4.4.0-31-generic; KDE/5.18.0; x86_64; ; ) In-Reply-To: <1470044943-3814-2-git-send-email-chenhui.zhao@nxp.com> References: <1470044943-3814-1-git-send-email-chenhui.zhao@nxp.com> <1470044943-3814-2-git-send-email-chenhui.zhao@nxp.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:AlTe6papK08e6pV3UV7dGsBZBMOs7C0i905fGx7HcummAgAHzON gsxOrGpTqXEzqptCJCtEjLwXN3TGzYVaV80deqpC8UvmiZRZ+N32+BHoAyDHHDkU66z7JaE ASBa1WfY5EGGTpcAZWdQR0bi5eOkIQByjac3weKlOZbPw85QBwI0gl6+qf3JzPAxCu3Lco9 w4Sc3UtRxOilQMEocfMWg== X-UI-Out-Filterresults: notjunk:1;V01:K0:uUSm1LxXVTs=:hGhk8Wkte/ow9ezBSeMKlR YyP5BJfhdbCcfnR7LtmMbfgaCCQMPhKqkn7Yn2UjvlUDl19zpE3kazdtzTeijO1kbamUI8Mer TcKmHg7wC5mhgyJ32cYu0rqwS9HOpJRuSIJ9Ed5CicLm0m9L4Cx2OKv7c5R6c2LI3vZ1sCtnU zOmpNw3SOscfcRufI5mVReCOzP9urOhK4ovGTO79D1FODsh5aAHUJDgZpZHiS1Y3gx3GvVK11 ZLaGUH6ILuVxmLFTqZV0UcHk6d7UZWOrJ2tc/iJGWOkm5YHvHQZtLiaAWSOELJoQJ1vJphjfK 3XAqpPNoh85nPMb7Dic1TeBoLOUUdzii51cPmEkU5rrZEAtR4H5niRv1trjb/OJ66VIYBYyp8 HpQQwvpIC7GCRE2TKO/Fk+78TZhhEdgU6r5iaBQRkMRlWbgUp7+NySXPGKmYzXbQRUdbQ1RDC gMCEste+AYBF+tClO9stqfOLoZ9k9mkq5dWJcdx/Uk0UcPu712Tybu2KcFAXSibA9GM3dOS9m oAerSM12UAIYv09beVgHBQEO5MBwd2BMr1i3Vzfib02lQ5z9vLqvWXbRj+i4VqWSLheGcCZhP dHhCwveZQ5j0ChRNENi+CSWiXTb8Vo1+k5wK7HxcLYNjoSOkCr9uhD2RWfeDOgf3Na9UgNVt1 4BI/reYgtKWF9aiKDqfhzAN+N2kn3/QzzsbBREUJfS2w9qMl/aXmUX4h5sDJdU+ONxX/OW7TZ tTg6pAz/ySEvMzz5 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Adding irqchip maintainers to cc, as this wakeup handling is normally part of the irq controller. > + > +#include > +#include > +#include > +#include > +#include > + > +/* 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