Received: by 10.192.165.156 with SMTP id m28csp469044imm; Mon, 16 Apr 2018 03:31:32 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/bzOaOH942zJUSTwcj/jFc0rEPiVHbBnpIf9ztHBY4slprQPx0dgutBAk9MJ2wuRA43IgC X-Received: by 2002:a17:902:549:: with SMTP id 67-v6mr15079472plf.276.1523874692194; Mon, 16 Apr 2018 03:31:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523874692; cv=none; d=google.com; s=arc-20160816; b=Ggz7kx7I9BSb9Njg51eHWLgBY7LermI2Fm9pgzVjB3/CwuFtCxQcjskBOLjJla869d ztgt2dxPVLSsEE92ijx5HLuheJZcl47anJGcswJJnRGl2G8GyXxRZGu4lpZW68DmfTbK dnWuGsT/jAH1crTBDf2KBXqRXX0p6vDRHAa67XaoCoMJM5kyqJN84bR2+aHmdVh726GZ 0zH5hwu77WFyMlN7RF1zhrImLxXuWR+XahinZX76lYB07xXbjO2Bi8fonE3YEoq8dYUh 5CUUMxDiAIRqADJg+5++UltShgFoUyskhsAIVM9eubtpP7qKLe1RQ0QwfX9ttOliyhE+ oMbA== 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:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=hG+S7ZK604Fw+1ZfX7HhdFoITIFe33zio9F0RL4ovk4=; b=T0QVAwc0YzCJmg0lpQA+ArMhQhzFRhJrPyxLNOsAEj6y4gi/QcFZQqaLEBO0wsU8JS uscg80Rq+DdDhYAXXUAQkU14botvlBuQwVwwQ1jDKMNngoEpVh8AQlYTojTi32pwc1WJ 8D/2/a9MGKghIgqKbLQgWTqQ3Z7ekmu+nnBMThHUFtMs9OM4xtaSA88N/QrGkmlW2UgZ whp043avhvh3f0ewClcsz4LvC56vPslGXsuUqGbEVqo3G+2ZkOMIb6cUVVwocUOaOaGd ElKl1cn1uIE7BxqMflk2xScaW2ZpkXzNXHCl1vF0Gzn7gKrZEjRAWWQ4zcdZZGHk+7uJ 7YFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=YpGtB0BP; 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 g12-v6si11561334pla.133.2018.04.16.03.31.17; Mon, 16 Apr 2018 03:31:32 -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=YpGtB0BP; 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 S1754326AbeDPK3s (ORCPT + 99 others); Mon, 16 Apr 2018 06:29:48 -0400 Received: from fllnx210.ext.ti.com ([198.47.19.17]:37715 "EHLO fllnx210.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753916AbeDPK3p (ORCPT ); Mon, 16 Apr 2018 06:29:45 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by fllnx210.ext.ti.com (8.15.1/8.15.1) with ESMTP id w3GATJcS022223; Mon, 16 Apr 2018 05:29:19 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1523874559; bh=zlfLPtAzJmGOIdQNtSEqPvcX/JLiIsbCHf/Z/MpXI34=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=YpGtB0BP/iLM3DJ/OA3rJmn9898lE9oq7JfEjO3UMSoVXo4QvNF4ZMypJw1fovQjP suzsWnOyu/9lZFfV5NUEFMMeZU9UXOGMQVCvh0abfSTcd7VxZ5nKbRsOoCDfMD5M34 rxSt8Wwl10RP83LYeybc6dNrFQOeCHYMQ0KGvXOc= Received: from DFLE113.ent.ti.com (dfle113.ent.ti.com [10.64.6.34]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w3GATJGL001010; Mon, 16 Apr 2018 05:29:19 -0500 Received: from DFLE110.ent.ti.com (10.64.6.31) by DFLE113.ent.ti.com (10.64.6.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Mon, 16 Apr 2018 05:29:19 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE110.ent.ti.com (10.64.6.31) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Mon, 16 Apr 2018 05:29:19 -0500 Received: from [172.24.191.45] (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w3GATEBC014767; Mon, 16 Apr 2018 05:29:15 -0500 Subject: Re: [PATCH 01/14] memory: ti-emif-sram: Add resume function to recopy sram code 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> From: Keerthy Message-ID: Date: Mon, 16 Apr 2018 15:59:14 +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: <31688cf4-b6ca-e7ce-3407-46262006b38f@oracle.com> 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 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. > > 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. Okay. Thanks a lot for the quick feedback! > > Regards, > Santosh > >