From patchwork Thu Apr 15 10:50:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 12205131 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7876EC433ED for ; Thu, 15 Apr 2021 11:00:58 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 07F3561152 for ; Thu, 15 Apr 2021 11:00:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 07F3561152 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=fCKiOVdbzfYDwaVED6FMLtPyfuFrzRQ3sGtalYzpV1A=; b=idwsN11Y9XtooQiLOCpY0jtgN kHcMJSxcYI3EQpLpW6k/fTNNeANNKG27ktFzqC0rybDShR4WMT2cgSM6tPqtUG0h5J2Ox52ZH5ga8 zZbyxUam0bIXOJuSH2BbandPEQWt6POyNyFFhupWpa6OZLuTK1CCQm8x0TKFDk4W1dpW6wpvENEsm htDD+uOACafhBVQX00de7+6FvPj8SoZbf7C/vKTSl3eIw3f2+JCybECabN9+FyrH5uiPewW8d5Mi1 5kBf4zG8DtTI7IMdjjE25OjRvVHAnQm//uKo7HCc0U26QaJPt8xZfyDGuM+abnFlLkzgCvbziixd1 VQb+rb4kg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lWzi8-00FqIE-26; Thu, 15 Apr 2021 10:59:00 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lWzbU-00FntL-92 for linux-arm-kernel@desiato.infradead.org; Thu, 15 Apr 2021 10:52:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Type: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date :Subject:CC:To:From:Sender:Reply-To:Content-ID:Content-Description; bh=pImAtkSfSqtSx9N17emCmpFMHBStgjCA4nai7ibC4EA=; b=bJCjfExJNEwKieVEyTa228MCu+ E+vFw+DBeQ/orJDk0qiLyyuBooocgbd+23BKo3q1aT0k647hmOjnPgko978N8tXh+5jgaVM9/WF8d z2h6PwopUqFcNX2nraecw3VQEG55aeTGQe1h9N2/XpA6cCEad/j9d3W6B1MyY8G9qY8ItGj7dJh2o k5n3HvFjMU42i6wUCqFm9Q837tIxEQSpFPf7I7MDw0bSNKJzWZqbaCvH+RXzbPuDd6KeyFEFd9Mpp NIOHaQnEztV8tQIhyogbw3CkuZUPHl6fMkW4eocGSzRbBH/IYC1NHPtLb/xsIYX0t6MtWeMOSxktO obfYTnmA==; Received: from esa.microchip.iphmx.com ([68.232.154.123]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lWzbR-008V58-IX for linux-arm-kernel@lists.infradead.org; Thu, 15 Apr 2021 10:52:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1618483925; x=1650019925; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gH+P3u9QqmYU3zqS64hGGjXJzweivpLPH2/q118Kpho=; b=JjWM3Za4xSRpm+PJ4tI7Dc9Exzs6PvhFkUiJkbNF9F08hjcs9nwL8N0z sCP/QkrchKan3G1VGkWpIbXCXAwBGMLg5yvUoBnmEkiXo+ixG9b4WOjTB P6R3pMUSzrQAKsKmgvHwDcFY3zVMlJsKbrOwdFLf63sqltlLwU4ecItpr G5G/swMzwunMt1LxobXrU1gVuL9gs2ZQjlgAR9JCOw7REq6HDgJVknfj7 aJdaLGJU3ZOMaJrGwld9Au4AkPVrS1oP1KqMjlRfYUye+j16UvwEo/rtn XBZZ9P7MgYonuUzxeZ7UI6ciaD+AYNS8Q3rc7FLjuFe47uRibWRmmP8G5 g==; IronPort-SDR: oEDTGLD9flQz/sZt1ISMaHIsGHYcKstu4MD0t7x9AHg2mvLhSaKKL3VBAClnYsLZGJou+/fhLP SP+GebcOpks9aC3537OuMYDn+3vbOCohjDK/Pwk2aQRDpyMu8P1hB27B+lCxPkrXbq9V1OH/Al mLXrF8ieoW31d5x3vX+3VoslhIGs5kUB0LWgJoX0s0LVwfTEVr9hDN+v1LYI610R1Ywn0CIvCK PPoi8frbKyUR+3VzLC6cb0g2odwwkFohPQKTtU0ZZVOY4YMkx7cWB4GzFcV0frjWBfCefIbc/o DyU= X-IronPort-AV: E=Sophos;i="5.82,223,1613458800"; d="scan'208";a="113688537" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 15 Apr 2021 03:52:05 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Thu, 15 Apr 2021 03:52:04 -0700 Received: from m18063-ThinkPad-T460p.mchp-main.com (10.10.115.15) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Thu, 15 Apr 2021 03:52:02 -0700 From: Claudiu Beznea To: , , , , CC: , , , Claudiu Beznea Subject: [PATCH v3 18/24] ARM: at91: pm: add sama7g5 ddr phy controller Date: Thu, 15 Apr 2021 13:50:04 +0300 Message-ID: <20210415105010.569620-19-claudiu.beznea@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210415105010.569620-1-claudiu.beznea@microchip.com> References: <20210415105010.569620-1-claudiu.beznea@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210415_035205_721290_D58CC48E X-CRM114-Status: GOOD ( 12.40 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org SAMA7G5 self-refresh procedure accesses also the DDR PHY registers. Adapt the code so that the at91_dt_ramc() to look also for DDR PHYs, in case it is mandatory. Signed-off-by: Claudiu Beznea --- arch/arm/mach-at91/pm.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c index 5dc942a2012d..4dec7216a80e 100644 --- a/arch/arm/mach-at91/pm.c +++ b/arch/arm/mach-at91/pm.c @@ -552,7 +552,12 @@ static const struct of_device_id ramc_ids[] __initconst = { { /*sentinel*/ } }; -static __init void at91_dt_ramc(void) +static const struct of_device_id ramc_phy_ids[] __initconst = { + { .compatible = "microchip,sama7g5-ddr3phy", }, + { /* Sentinel. */ }, +}; + +static __init void at91_dt_ramc(bool phy_mandatory) { struct device_node *np; const struct of_device_id *of_id; @@ -578,6 +583,16 @@ static __init void at91_dt_ramc(void) if (!idx) panic(pr_fmt("unable to find compatible ram controller node in dtb\n")); + /* Lookup for DDR PHY node, if any. */ + for_each_matching_node_and_match(np, ramc_phy_ids, &of_id) { + soc_pm.data.ramc_phy = of_iomap(np, 0); + if (!soc_pm.data.ramc_phy) + panic(pr_fmt("unable to map ramc phy cpu registers\n")); + } + + if (phy_mandatory && !soc_pm.data.ramc_phy) + panic(pr_fmt("DDR PHY is mandatory!\n")); + if (!standby) { pr_warn("ramc no standby function available\n"); return; @@ -936,7 +951,7 @@ void __init at91rm9200_pm_init(void) soc_pm.data.standby_mode = AT91_PM_STANDBY; soc_pm.data.suspend_mode = AT91_PM_ULP0; - at91_dt_ramc(); + at91_dt_ramc(false); /* * AT91RM9200 SDRAM low-power mode cannot be used with self-refresh. @@ -960,7 +975,7 @@ void __init sam9x60_pm_init(void) at91_pm_modes_validate(modes, ARRAY_SIZE(modes)); at91_pm_modes_init(iomaps, ARRAY_SIZE(iomaps)); - at91_dt_ramc(); + at91_dt_ramc(false); at91_pm_init(NULL); soc_pm.ws_ids = sam9x60_ws_ids; @@ -980,7 +995,7 @@ void __init at91sam9_pm_init(void) soc_pm.data.standby_mode = AT91_PM_STANDBY; soc_pm.data.suspend_mode = AT91_PM_ULP0; - at91_dt_ramc(); + at91_dt_ramc(false); at91_pm_init(at91sam9_idle); } @@ -994,7 +1009,7 @@ void __init sama5_pm_init(void) return; at91_pm_modes_validate(modes, ARRAY_SIZE(modes)); - at91_dt_ramc(); + at91_dt_ramc(false); at91_pm_init(NULL); } @@ -1015,7 +1030,7 @@ void __init sama5d2_pm_init(void) at91_pm_modes_validate(modes, ARRAY_SIZE(modes)); at91_pm_modes_init(iomaps, ARRAY_SIZE(iomaps)); - at91_dt_ramc(); + at91_dt_ramc(false); at91_pm_init(NULL); soc_pm.ws_ids = sama5d2_ws_ids;