From patchwork Fri Sep 8 15:35:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Izard X-Patchwork-Id: 9944571 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 695CF6035D for ; Fri, 8 Sep 2017 15:40:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 57BB0287E7 for ; Fri, 8 Sep 2017 15:40:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4C970287F8; Fri, 8 Sep 2017 15:40:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B3103287E7 for ; Fri, 8 Sep 2017 15:40:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=FvYF13BBZ0VAGB89H0w2R96XG6m0wMlXJVYJyZBguQ4=; b=hQuNbIcL1fg5pRTDXtH2CnU2qD Rfavempgr9f77RR9yJNoGZejZwU69ZRugifESA3uzNmkodRMfBS3zoOHG+jMaEwRHIRX0WBfcKR89 X/hHZ57TAELn1fYLsHTGDeSP3ppYqxZ1ghIJlm6yyVPuVbizpFVcX8B2m6oSIde55TU1XJ3gdDk9x S+GGu3ZRFkB1P/XBuNuJjLWFvuN7CM/XUryNAfK2B9cvkl973n0YRdwSdPC2H8ihPNs54U/06cTTk CrH6vbegSZul6sP/gxb1n70oa/g9pIzY8pFVEsTqhJhGfs/YbGb5tQ2SEFQnEwnGo0tj953J7TwoC s3fe0FIA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dqLOC-0000cm-C1; Fri, 08 Sep 2017 15:40:16 +0000 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dqLKk-00067Q-CH; Fri, 08 Sep 2017 15:36:47 +0000 Received: by mail-wr0-x242.google.com with SMTP id g50so1407548wra.3; Fri, 08 Sep 2017 08:36:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=9beE8Cf39tr6tZRj5PuOk2crYg7vW204uQ0hp5zpIWs=; b=fxfysY/lEXiDbWbCRseZG/7PkmOctGpsH02X2EmNtjvE1Ntn9AYTr+uGo7xnbzFryp HgyQ3bZabNE3bCGFsE74wt6OpRdBwEPrXTwIuayrah9qMjJyXyM8Baubm4WKo/efpmSG SsNLHwCGY2c7StHZKuaG6hTo40ijFHP2zl91Eq2zbaYmfqGA17jwtWpCXmjS93/RM+uv 1t864x/7D4GeuxNC9LtWDhlhecTVYnMRIdNkQs0UkqlxGtuwUx1gudO1z3dH6ZmIB2yc gT65vmgIPB707dRpkkMo2vUr5AWlrc33CQLvNJwI/wbTa/EduonLd9GhHTgI+iaYU0Kn saGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=9beE8Cf39tr6tZRj5PuOk2crYg7vW204uQ0hp5zpIWs=; b=LT8TG0F+Xyi0H1ez1VR6crB0ejLYrF5V+4H3ANqTthK6LP+hzj8Qnm4+CpClHpI/4B rv/mE7iUqnuooCbrlq8MD+7mEHFIndnwPIz973VABSstzvbuyG+ORtoPlSmHg/B2CtpL S2AUxGA6NUw+78mQzDTaJiPuN8ZiWZ+kXiJmSkns1DmcgRb/29USptJTQBz9x72x96pj /c1et70oBi66Gxspgg2LDFpiaLmIWoFIQ6M3k5dhaig2E23k4Tm/tPnwnZQW+XrgCHiI 6cgUvGpLGd1n1Lsg+ggSxLOjcqbC4moQHdoLBtoNdq97AzauAwJj1cTgFkCCzRWD5rwe qIUg== X-Gm-Message-State: AHPjjUjdZgpgKbb0ZgZhPCH1ptjOx3nVn1/WIKuT/lYUatzxAAXBJ1Hx tVo7jTBivm2Bpg== X-Google-Smtp-Source: ADKCNb4zDKdZlUxvWvNNAbhPe45hRJh6QAn8A+MXH5xh7Zuw4wzc8nzN+7814Q3NAxX9NkX+IzNskw== X-Received: by 10.223.183.133 with SMTP id s5mr2816650wre.145.1504884979413; Fri, 08 Sep 2017 08:36:19 -0700 (PDT) Received: from localhost.localdomain (146.187.3.109.rev.sfr.net. [109.3.187.146]) by smtp.gmail.com with ESMTPSA id p199sm1689224wmb.28.2017.09.08.08.36.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Sep 2017 08:36:18 -0700 (PDT) From: Romain Izard To: Nicolas Ferre , Boris Brezillon , Michael Turquette , Stephen Boyd , Ludovic Desroches , Jonathan Cameron , Wenyou Yang , Josh Wu , David Woodhouse , Brian Norris , Marek Vasut , Cyrille Pitchen , Thierry Reding , Richard Genoud , Greg Kroah-Hartman , Alan Stern Subject: [PATCH v1 03/10] clk: at91: pmc: Support backup for programmable clocks Date: Fri, 8 Sep 2017 17:35:57 +0200 Message-Id: <20170908153604.28383-4-romain.izard.pro@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170908153604.28383-1-romain.izard.pro@gmail.com> References: <20170908153604.28383-1-romain.izard.pro@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170908_083642_681376_C2710089 X-CRM114-Status: UNSURE ( 9.65 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-pwm@vger.kernel.org, linux-iio@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, linux-serial@vger.kernel.org, Romain Izard , Romain Izard , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Romain Izard Save and restore the System Clock and Programmable Clock register for the backup use case. Signed-off-by: Romain Izard --- drivers/clk/at91/pmc.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/clk/at91/pmc.c b/drivers/clk/at91/pmc.c index 07dc2861ad3f..5421b03553ec 100644 --- a/drivers/clk/at91/pmc.c +++ b/drivers/clk/at91/pmc.c @@ -66,6 +66,7 @@ static struct u32 pcr[PMC_MAX_IDS]; u32 audio_pll0; u32 audio_pll1; + u32 pckr[3]; } pmc_cache; void pmc_register_id(u8 id) @@ -103,6 +104,8 @@ static int pmc_suspend(void) regmap_read(pmcreg, AT91_PMC_PCR, &pmc_cache.pcr[registered_ids[i]]); } + for (i = 0; i < 3; i++) + regmap_read(pmcreg, AT91_PMC_PCKR(i), &pmc_cache.pckr[i]); return 0; } @@ -143,6 +146,8 @@ static void pmc_resume(void) pmc_cache.pcr[registered_ids[i]] | AT91_PMC_PCR_CMD); } + for (i = 0; i < 3; i++) + regmap_write(pmcreg, AT91_PMC_PCKR(i), pmc_cache.pckr[i]); if (pmc_cache.uckr & AT91_PMC_UPLLEN) mask |= AT91_PMC_LOCKU;