Received: by 10.192.165.156 with SMTP id m28csp2176643imm; Thu, 12 Apr 2018 09:48:17 -0700 (PDT) X-Google-Smtp-Source: AIpwx49cJ5T9f3t2p4dfmYNfIzG7Zf6GQTPbqzThghUAkb/jhfr9WqLRAFL37NSRQhwx6vvR/e8P X-Received: by 10.101.66.70 with SMTP id d6mr1274975pgq.234.1523551697340; Thu, 12 Apr 2018 09:48:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523551697; cv=none; d=google.com; s=arc-20160816; b=nX9IdUKPH9ADdgTc2SOogA0vKR37zoPNgrjiBXUF+1y6QjsM5JREr6g8CAV/QItXco 6SV00rJPkW4vjC0aDeOHE5Q9QiFOvtSG4KIKyoLGyvW74ZpuB1MRHn1diJalBZ2wTEKM r1IdSFRTLSXZaF0fFPcSVqEbn6GgBt23Vwtilcpl/xcpHkdfRFiRusuShz1DiW2zlYHX SoqnJDP2XvrTNEI5AMPxn2vFH01elcj3g3Ii0ZGdFsiBHCau19zACo2uvKMNWfIweJLd FHdQKCbn56TxGh2vTdzBpUqCpHNF/w/AS/A6ZIclsOP8DJ0ylZzOHdISKZ70T+MCanbT oEQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject :dkim-signature:arc-authentication-results; bh=tHaR84NJ++McdWC/dGZCGK/pxDm7FYUWssZzPilmAt8=; b=FT7IIjconQhqxbyZRvBROwKxqodhxsSMJrgRlbDGVYyhhq7jF5bZJ2b+h9bORojkWi SU9LS1K+PVwh2o8ozd9j7yiPVDOYvO6Vn5I0ir73ZTSBmUdmMMBHFKFrXTc8vVY+uFIo jm1ovVK7AslCKiZn4EwJVK4uJtt8gwQAcVk7/CTXiXbsWUxVVWxKckW2u5ixxE2Uadzj OoOjgWHekobAUakcyD8Kcb5umX4//Os8VbE+uUa+7W8DelNpEL5f3Sh2lvJ308nhmIY2 qE4xwvRZRDm1e67aL1Ovz8WZOzNTIn8wnYpj+2xl5mAeJa9aBwvOAqVch6S59siZu86v 7hHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=oNOqr0BP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o61-v6si3548290pld.646.2018.04.12.09.47.40; Thu, 12 Apr 2018 09:48:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=oNOqr0BP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752794AbeDLQoi (ORCPT + 99 others); Thu, 12 Apr 2018 12:44:38 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:38798 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752424AbeDLQog (ORCPT ); Thu, 12 Apr 2018 12:44:36 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w3CGevgD036645; Thu, 12 Apr 2018 16:44:14 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2017-10-26; bh=tHaR84NJ++McdWC/dGZCGK/pxDm7FYUWssZzPilmAt8=; b=oNOqr0BPhnEMgMQGNfXC8i+9U5vAVr3Ps/Ejzg/MZeWMYT2JvZSKz2oq0mmaTUm5uYFq 2O/0B6l7Hi2F8w+eUbRAn4Z19M9VhAnDQvI8XQ3lmmVCNmCRLKFWw7uED+1QZ+iX0fOD sdeg8JKomG3upcWsusFZfkSvTVOH2CTKTPHuB6XGlLSfzaj/Hqvgk/6eFQXpoGvhCLcv NyjtonCZhgqOGMfbCcVoU7VTtUWNwTiDIZEldgCI9JHmhSepPP676L0BhAddB9TYvgCI bnhBZ/Vs28g+yxn9mMMUf5qkBoNcPbX2LfYzftjiKYqzzObrLs4uCt5TGoBE4UzTs9PQ tA== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2130.oracle.com with ESMTP id 2h6ne7n4fr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 Apr 2018 16:44:14 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w3CGiDHv030748 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 Apr 2018 16:44:13 GMT Received: from abhmp0012.oracle.com (abhmp0012.oracle.com [141.146.116.18]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w3CGiCXZ017324; Thu, 12 Apr 2018 16:44:12 GMT Received: from Santoshs-MacBook-Pro.local (/50.225.201.71) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 12 Apr 2018 09:44:12 -0700 Subject: Re: [PATCH 01/14] memory: ti-emif-sram: Add resume function to recopy sram code To: Keerthy , linus.walleij@linaro.org, grygorii.strashko@ti.com, tony@atomide.com Cc: t-kristo@ti.com, Russ.Dill@ti.com, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, ssantosh@kernel.org, haojian.zhuang@linaro.org, linux-arm-kernel@lists.infradead.org, d-gerlach@ti.com References: <1523505239-16229-1-git-send-email-j-keerthy@ti.com> <1523505239-16229-2-git-send-email-j-keerthy@ti.com> From: "santosh.shilimkar@oracle.com" Organization: Oracle Corporation Message-ID: <31688cf4-b6ca-e7ce-3407-46262006b38f@oracle.com> Date: Thu, 12 Apr 2018 10:44:10 -0600 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <1523505239-16229-2-git-send-email-j-keerthy@ti.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8861 signatures=668698 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1804120164 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/11/18 9:53 PM, Keerthy wrote: > From: Dave Gerlach > > After an RTC+DDR cycle we lose sram context so emif pm functions present > in sram are lost. We can check if the first byte of the original > code in DDR contains the same first byte as the code in sram, and if > they do not match we know we have lost context and must recopy the > functions to the previous address to maintain PM functionality. > > Signed-off-by: Dave Gerlach > Signed-off-by: Keerthy > --- > drivers/memory/ti-emif-pm.c | 24 ++++++++++++++++++++++++ > 1 file changed, 24 insertions(+) > > diff --git a/drivers/memory/ti-emif-pm.c b/drivers/memory/ti-emif-pm.c > index 632651f..ec4a62c 100644 > --- a/drivers/memory/ti-emif-pm.c > +++ b/drivers/memory/ti-emif-pm.c > @@ -249,6 +249,25 @@ int ti_emif_get_mem_type(void) > }; > MODULE_DEVICE_TABLE(of, ti_emif_of_match); > > +#ifdef CONFIG_PM_SLEEP > +static int ti_emif_resume(struct device *dev) > +{ > + unsigned long tmp = > + __raw_readl((void *)emif_instance->ti_emif_sram_virt); > + > + /* > + * Check to see if what we are copying is already present in the > + * first byte at the destination, only copy if it is not which > + * indicates we have lost context and sram no longer contains > + * the PM code > + */ > + if (tmp != ti_emif_sram) > + ti_emif_push_sram(dev, emif_instance); > + > + return 0; > +} > +#endif /* CONFIG_PM_SLEEP */ Instead of this indirect method , why can't just check the previous deep sleep mode and based on that do copy or not. EMIF power status register should have something like that ? Another minor point is even though there is nothing to do in suspend, might be good to have a callback with comment that nothing to do with some explanation why not. Don't have strong preference but may for better readability. Regards, Santosh