Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp573455imm; Wed, 23 May 2018 01:49:11 -0700 (PDT) X-Google-Smtp-Source: AB8JxZobRDdtssCB5irYF0bxu0dv4rNf0pZXkwyWEs91pEZzImu25HF8U+ZyNaFEgVnvyKrKFEVt X-Received: by 2002:a62:5281:: with SMTP id g123-v6mr2019345pfb.22.1527065351520; Wed, 23 May 2018 01:49:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527065351; cv=none; d=google.com; s=arc-20160816; b=ApRZEXS5FheC2WaSynwKUOxMBLyErEoIpYltHSi92gupgxxFBImRHQFH6uCh/bFvwk 6WXL2lrlvA0SqPshnJf2eiM3MxKtH1cW/H2U0N+WQz1Zvpj/NkE0Sxzo90HqB+EJJo16 QHKyj2DhzHGJ2Jz478Miqxf0waImbsT9wk2Yv3RJkzFA8BqEUN8FSJy0NigNSz80EOB/ 7kvGoRquxSf31OssxvjCNaUrXni4qQqHB0z67JUInndrunY9dWjUBFNhzb8/5FPPqL5P 7A6FqZoYB2WXZt+vZPrrfTzgGQB4QeYdeMPZrKfmn46yLM2aSpUsncbcFaMq8YXX9Gb3 ztzw== 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:references:cc:to:from:subject:dkim-signature :arc-authentication-results; bh=wzEm9UNzBDI4qEIf7KFK6B8b1ozLN7c8N176Xgxdj1E=; b=VvlJlxMZwjOpKktcsEDTJtVoimUh9oKMvGSwNLPHmwuno+rTg2rDBqVICPD7rKHtoj 6sqzUtQ9Ox9dNgfdEmdYBBlkb7Fu6xpOV5pNdEwivF0A269w/4gc4QyZ1/dy95HRNYDG 16uMirKvWRG9bY9OFP6G2d8ETCFy+cD2AEvcbO5IT77T+LVxfU6102B2zSw0DfNiOkUB vsZkAYgdXl1yPK17QxsuYamsmhUPjV9DZEy30/DUrn+XoBflD6QTmgWHJiF15jnbpUpB D/aorIXF4lfONss5Z/Hx4Nno1Viuo/ewyyCCrftUFeyxw3+QA2UBscBLh6ynTjkWsJ5C apxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=HB0KWFdn; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t12-v6si4176570pgc.523.2018.05.23.01.48.56; Wed, 23 May 2018 01:49:11 -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=@ti.com header.s=ti-com-17Q1 header.b=HB0KWFdn; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754523AbeEWIrq (ORCPT + 99 others); Wed, 23 May 2018 04:47:46 -0400 Received: from fllnx209.ext.ti.com ([198.47.19.16]:18594 "EHLO fllnx209.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754341AbeEWIro (ORCPT ); Wed, 23 May 2018 04:47:44 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by fllnx209.ext.ti.com (8.15.1/8.15.1) with ESMTP id w4N8lEsN006061; Wed, 23 May 2018 03:47:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1527065234; bh=wzEm9UNzBDI4qEIf7KFK6B8b1ozLN7c8N176Xgxdj1E=; h=Subject:From:To:CC:References:Date:In-Reply-To; b=HB0KWFdnPC+W1kdOZql6q73M1ch+jnFzaUHgnyiUFKx4MmBR7FpRU3jHrmwRkeSUH afsoEeWkTFX7N4Y7TsL1oSQzwsBgd+pC6ti/xiU8xtwgNG2f/vbl9ywvfk1CFR4PIU fPbGirVOT2vpV3vvsW6SIYZcgwkeyCWJI5hruw9E= Received: from DFLE101.ent.ti.com (dfle101.ent.ti.com [10.64.6.22]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w4N8lEWQ000327; Wed, 23 May 2018 03:47:14 -0500 Received: from DFLE108.ent.ti.com (10.64.6.29) by DFLE101.ent.ti.com (10.64.6.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Wed, 23 May 2018 03:47:13 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DFLE108.ent.ti.com (10.64.6.29) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1466.3 via Frontend Transport; Wed, 23 May 2018 03:47:13 -0500 Received: from [172.24.191.45] (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id w4N8l9ms025003; Wed, 23 May 2018 03:47:10 -0500 Subject: Re: [PATCH 01/14] memory: ti-emif-sram: Add resume function to recopy sram code From: Keerthy To: "santosh.shilimkar@oracle.com" , , , CC: , , , , , , , References: <1523505239-16229-1-git-send-email-j-keerthy@ti.com> <1523505239-16229-2-git-send-email-j-keerthy@ti.com> <31688cf4-b6ca-e7ce-3407-46262006b38f@oracle.com> Message-ID: <739d9bbf-2acc-9c90-db43-cf78f5b184e3@ti.com> Date: Wed, 23 May 2018 14:17:09 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Monday 16 April 2018 03:59 PM, Keerthy wrote: > > > On Thursday 12 April 2018 10:14 PM, santosh.shilimkar@oracle.com wrote: >> 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 ? > > I will check if we have a register that tells the previous state of sram. Unfortunately i do not see any such register for knowing SRAM previous state in am43 TRM and hence this indirect way of knowing. http://www.ti.com/lit/ug/spruhl7h/spruhl7h.pdf > >> >> 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. I can add a blank suspend call with comment "The contents are already present in DDR hence no need to explicitly save" The comment in resume function pretty much explains the above. So let me know if i need to add the suspend callback. Regards, Keerthy > > Okay. Thanks a lot for the quick feedback! > >> >> Regards, >> Santosh >> >>