From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932689AbdBVOTU (ORCPT ); Wed, 22 Feb 2017 09:19:20 -0500 Received: from mail-pg0-f66.google.com ([74.125.83.66]:36494 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932368AbdBVOTN (ORCPT ); Wed, 22 Feb 2017 09:19:13 -0500 Date: Wed, 22 Feb 2017 23:19:09 +0900 From: Stafford Horne To: Joe Perches Cc: Jonas Bonn , Stefan Kristiansson , linux@roeck-us.net, openrisc@lists.librecores.org, linux-kernel@vger.kernel.org, Sebastian Macke , Christian Svensson Subject: Re: [PATCH v3 14/25] openrisc: Initial support for the idle state Message-ID: <20170222141909.GA2449@lianli.shorne-pla.net> References: <705d104f39c66faddd1fda08fc7b04f2b2e6a840.1487702890.git.shorne@gmail.com> <1487708681.2853.35.camel@perches.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1487708681.2853.35.camel@perches.com> User-Agent: Mutt/1.7.1 (2016-10-04) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 21, 2017 at 12:24:41PM -0800, Joe Perches wrote: > On Wed, 2017-02-22 at 04:11 +0900, Stafford Horne wrote: > > From: Sebastian Macke > > > > This patch adds basic support for the idle state of the cpu. > > The patch overrides the regular idle function, enables the interupts, > > checks for the power management unit and enables the cpu doze mode > > if available. > > trivia: > > > diff --git a/arch/openrisc/kernel/process.c b/arch/openrisc/kernel/process.c > [] > > @@ -75,6 +75,20 @@ void machine_power_off(void) > > __asm__("l.nop 1"); > > } > > > > +/* > > + * Send the doze signal to the cpu if available. > > + * Make sure, that all interrupts are enabled > > + */ > > +void arch_cpu_idle(void) > > +{ > > + unsigned long upr; > > + > > + local_irq_enable(); > > + upr = mfspr(SPR_UPR); > > + if (upr & SPR_UPR_PMP) > > + mtspr(SPR_PMR, mfspr(SPR_PMR) | SPR_PMR_DME); > > +} > > Perhaps this would be easier to read without the automatic > > void arch_cpu_idle(void) > { > local_irq_enable(); > if (mfspr(SPR_UPR) & SPR_UPR_PMP) > mtspr(SPR_PMR, mfspr(SPR_PMR) | SPR_PMR_DME); > } Yeah, that looks better. I made the change. Will post another series. From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stafford Horne Date: Wed, 22 Feb 2017 23:19:09 +0900 Subject: [OpenRISC] [PATCH v3 14/25] openrisc: Initial support for the idle state In-Reply-To: <1487708681.2853.35.camel@perches.com> References: <705d104f39c66faddd1fda08fc7b04f2b2e6a840.1487702890.git.shorne@gmail.com> <1487708681.2853.35.camel@perches.com> Message-ID: <20170222141909.GA2449@lianli.shorne-pla.net> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: openrisc@lists.librecores.org On Tue, Feb 21, 2017 at 12:24:41PM -0800, Joe Perches wrote: > On Wed, 2017-02-22 at 04:11 +0900, Stafford Horne wrote: > > From: Sebastian Macke > > > > This patch adds basic support for the idle state of the cpu. > > The patch overrides the regular idle function, enables the interupts, > > checks for the power management unit and enables the cpu doze mode > > if available. > > trivia: > > > diff --git a/arch/openrisc/kernel/process.c b/arch/openrisc/kernel/process.c > [] > > @@ -75,6 +75,20 @@ void machine_power_off(void) > > __asm__("l.nop 1"); > > } > > > > +/* > > + * Send the doze signal to the cpu if available. > > + * Make sure, that all interrupts are enabled > > + */ > > +void arch_cpu_idle(void) > > +{ > > + unsigned long upr; > > + > > + local_irq_enable(); > > + upr = mfspr(SPR_UPR); > > + if (upr & SPR_UPR_PMP) > > + mtspr(SPR_PMR, mfspr(SPR_PMR) | SPR_PMR_DME); > > +} > > Perhaps this would be easier to read without the automatic > > void arch_cpu_idle(void) > { > local_irq_enable(); > if (mfspr(SPR_UPR) & SPR_UPR_PMP) > mtspr(SPR_PMR, mfspr(SPR_PMR) | SPR_PMR_DME); > } Yeah, that looks better. I made the change. Will post another series.