Received: by 10.192.165.156 with SMTP id m28csp237746imm; Wed, 18 Apr 2018 21:12:41 -0700 (PDT) X-Google-Smtp-Source: AIpwx483shS8xGOLeS+Qw6huyD6Pgnt/AYEh+yDuoM65lnnwCbP16z+7QTZB+Vs0AWPDHS4AzQKl X-Received: by 2002:a17:902:8f94:: with SMTP id z20-v6mr4606837plo.174.1524111161564; Wed, 18 Apr 2018 21:12:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524111161; cv=none; d=google.com; s=arc-20160816; b=M7m6DLYOS5GhquRPfvuyAT6OxETXn+7thTUrnAiLzsgb0uw17LaJ7xQSYGPN1mJGD+ bULhpxWg5XPMYaHKc5ioxcaIMg+DaQNpO0vvfruU5suV8iHCV4sOTmGjIF92xLE/j09e 0EjB35L/0B6ao/hx+Wh9Zc6VybdI0DkEBobAiPU+w2tqKU1tqaoUdZR460LrZT5OaKFY EttBaFGQftGHTNJqHVta+T8GyDtiG67jyzKJiRVs3oEtmpIGgSPjXw4UzDgw03W7eKt1 vlXfGP6Bjtr/rFKCOZOXj95rGhbcRvVA/p/itSKuWrg+WDT9ls3LokKq5K4Ew+U2l2it 55cg== 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=jkb2gDSaNEyG6wqTT0XDR0DyVTyeCf0y/ZHDlvriWBg=; b=DCqCES+AVW9k1X1moqP8jD5HF1ZRDiITDYUyFGrv6zJ/m7q0d/YRx5SzrQtyj58Rc1 SzpKUq+BY2Jx2PqmAEvwWD5oUhjTN+WNziRWCo9uZXN7QDVgTfk/EpHjQ6lBm6mt2SKJ 4bo3fBp+m6aWsQBUMuhvq7M+FE+UkJ4jxxDok9kur9kvLhT01ORMM1jgCtG48ptU4UNq Ypisuel0UCuTjtkP7t0+QfGqBqDtCIuTOGhjyYbPPYDYg+bd6acgZOccySyBGa730M+z SXwzuAEx8L3A8zWYboYeN7I4ow/fgICJnutjSz7Li8Neuu7dHEsUwrI7hB63WAF7RtLh YN9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=pwkRPULV; 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 k9-v6si2568024plt.413.2018.04.18.21.12.27; Wed, 18 Apr 2018 21:12:41 -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=pwkRPULV; 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 S1753182AbeDSELM (ORCPT + 99 others); Thu, 19 Apr 2018 00:11:12 -0400 Received: from lelnx194.ext.ti.com ([198.47.27.80]:50519 "EHLO lelnx194.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750913AbeDSELL (ORCPT ); Thu, 19 Apr 2018 00:11:11 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by lelnx194.ext.ti.com (8.15.1/8.15.1) with ESMTP id w3J4AmiC032601; Wed, 18 Apr 2018 23:10:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1524111048; bh=A/Lu2j+ece/Yw5YC1kmhnSi5oj7e6KptaaSxep/1cFo=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=pwkRPULV+/GP8uCyuZQDV/kVLsWb1fJbEfnLBbV5VQa/aj8z+Dgbqtt6X6tg2+mm7 bpUpwSzK2QgMsxMWe9aZGymVgNmQnWpcwTGEXgwh1I/msesG80m4O6bOOl73iN6iip T2H6E91kVNj/e+JFPWdzOh4puqwSZob8g6UwYDfs= Received: from DLEE107.ent.ti.com (dlee107.ent.ti.com [157.170.170.37]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w3J4Al6U008787; Wed, 18 Apr 2018 23:10:48 -0500 Received: from DLEE114.ent.ti.com (157.170.170.25) by DLEE107.ent.ti.com (157.170.170.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Wed, 18 Apr 2018 23:10:47 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DLEE114.ent.ti.com (157.170.170.25) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1466.3 via Frontend Transport; Wed, 18 Apr 2018 23:10:47 -0500 Received: from [172.24.191.45] (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w3J4AgkU004070; Wed, 18 Apr 2018 23:10:43 -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: <8e92db66-c2cb-8110-120d-fb6ff06ac643@ti.com> Date: Mon, 16 Apr 2018 15:50:32 +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 previous state of sram, not sure of it. > > 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 > >