From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932310AbdDFSWl (ORCPT ); Thu, 6 Apr 2017 14:22:41 -0400 Received: from imap0.codethink.co.uk ([185.43.218.159]:55633 "EHLO imap0.codethink.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754797AbdDFSWf (ORCPT ); Thu, 6 Apr 2017 14:22:35 -0400 Message-ID: <1491502950.10415.41.camel@codethink.co.uk> Subject: Re: [PATCH 4.4 23/26] power: reset: at91-poweroff: timely shutdown LPDDR memories From: Ben Hutchings To: Alexandre Belloni Cc: Sebastian Reichel , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, stable@vger.kernel.org Date: Thu, 06 Apr 2017 19:22:30 +0100 In-Reply-To: <20170406181324.horsqbprkajwuern@piout.net> References: <20170406083604.362636628@linuxfoundation.org> <20170406083605.797902629@linuxfoundation.org> <1491500739.10415.38.camel@codethink.co.uk> <20170406181324.horsqbprkajwuern@piout.net> Organization: Codethink Ltd. Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.12.9-1+b1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2017-04-06 at 20:13 +0200, Alexandre Belloni wrote: > On 06/04/2017 at 18:45:39 +0100, Ben Hutchings wrote: > > On Thu, 2017-04-06 at 10:38 +0200, Greg Kroah-Hartman wrote: > > > 4.4-stable review patch. If anyone has any objections, please let me know. > > > > > > ------------------ > > > > > > From: Alexandre Belloni > > > > > > commit 0b0408745e7ff24757cbfd571d69026c0ddb803c upstream. > > > > > > LPDDR memories can only handle up to 400 uncontrolled power off. Ensure the > > > proper power off sequence is used before shutting down the platform. > > > > > > Signed-off-by: Alexandre Belloni > > > Signed-off-by: Sebastian Reichel > > > Signed-off-by: Greg Kroah-Hartman > > [...] > > > +static void at91_lpddr_poweroff(void) > > > +{ > > > + asm volatile( > > > + /* Align to cache lines */ > > > + ".balign 32\n\t" > > > + > > > + /* Ensure AT91_SHDW_CR is in the TLB by reading it */ > > > + " ldr r6, [%2, #" __stringify(AT91_SHDW_CR) "]\n\t" > > > > This clobbers r6... > > > > > + /* Power down SDRAM0 */ > > > + " str %1, [%0, #" __stringify(AT91_DDRSDRC_LPR) "]\n\t" > > > + /* Shutdown CPU */ > > > + " str %3, [%2, #" __stringify(AT91_SHDW_CR) "]\n\t" > > > + > > > + " b .\n\t" > > > + : > > > + : "r" (mpddrc_base), > > > + "r" cpu_to_le32(AT91_DDRSDRC_LPDDR2_PWOFF), > > > + "r" (at91_shdwc_base), > > > + "r" cpu_to_le32(AT91_SHDW_KEY | AT91_SHDW_SHDW) > > > + : "r0"); > > [...] > > > > ...but the clobber list has r0. > > > > Indeed. However, It doesn't matter much as nothing can possibly run > afterwards. It does matter because the compiler can use r6 for one of the inputs. Ben. -- Ben Hutchings Software Developer, Codethink Ltd.