From patchwork Wed Nov 4 17:45:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 11881797 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=-6.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=no 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 4A9BBC388F9 for ; Wed, 4 Nov 2020 17:47:24 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 DB9E9205CA for ; Wed, 4 Nov 2020 17:47:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="h7/XacOY"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="GZRHGRIh" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DB9E9205CA 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=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version: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:In-Reply-To:References:List-Owner; bh=7B4ll5s/eSjTV7j2i/I+wdNYdP4izlA3cDOZb99qa14=; b=h7/XacOYKNd+cBAcTd//sMtlRS 5FQbaXqyIHrD+VyaNSlTJwmhPn7Gsv/j3yusTdTWtqAvO3qT7LCKWi+FQkz011OvoHUkQ8YAESyfs XCSVIJCNkk6EagBBKWiQkws7r8M82Io3bLQdEtCxkbyw1TWRZlOCESKK8I7d12pgO9Ruem/kfBvtg VDJzaNOSySoRF8UhRIx1x1UN0Z6CZuOpoUJIgXqJiqKlD679PS6z7Yu3TFBCVcayXNi/uUUSjCJ8a Xmph+ju9sVWmNwEPrby0ficNIs2Ij9cbrtcXHdPP/KCPr1BEFwXHif2aBV6Vtsk0vDM6aLf+X5kD/ 8YHF2iFg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kaMqt-0000bB-Lj; Wed, 04 Nov 2020 17:45:43 +0000 Received: from esa3.microchip.iphmx.com ([68.232.153.233]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kaMqr-0000ZD-2p for linux-arm-kernel@lists.infradead.org; Wed, 04 Nov 2020 17:45:42 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1604511940; x=1636047940; h=from:to:cc:subject:date:message-id:mime-version; bh=ZmimzAcfmhamS/+M4yrvoHe76P5sEggPdECJfrNqkVM=; b=GZRHGRIh9lf7MW8jaHqgInX12iwlRQWpYs14noGVUvpxC7kmrEGvYdFv RQBk7w3FnJeiqcgWEsFtQl37aFC8eQwlb5xe05e5Yk1P5OXB0rJYiShQ1 Nvw4/BrXgGkYiqC5jH5n1A1Gvn57FsThmhdBsC/L+VPzsBvT2OLRqRTZ5 Umg+H6t9+RchN/dW7n5Ml/5ywz/wdfoum/JtumWYyu5/T/5H474Gxw84C gxrNwHV4UlHzQJbu+V+D/cv6Y3ILQBgfDOxDHGbQw5UBIaF41YZ7LuZMd sn/LZC9csZwX6UKFg43yWlkpc042lVCRguVZd0KEc5UpZ3uGRB7dHhlF/ Q==; IronPort-SDR: p2pV9b5ZSXIJ9a3BCyo3pxiqGdMkqiR78sJeOJhH1HlkXdI/h5+hYgCvyVXOj30djzfiJiY3EQ FYcVVVUmA25qWXeAwyfDlcxthQ5d5eDDijYxDdwjxscBzUciH6f5+B54/G+FKG2FSROVPqjhCq tttMc7V9VZ1DPWMloxYXyduIF8v4oS1oRUQN1kBEbAVrI6cfU3rMUqtr+r3xPaqWMobiXQB7mS NXuL0C6TKw3/BXeiBuY5JmUVVCXKAMKMX6aGi0ot/264dDzJckztgSIi4D+FyNLqTnNOjgs1Jd RIc= X-IronPort-AV: E=Sophos;i="5.77,451,1596524400"; d="scan'208";a="97768114" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 04 Nov 2020 10:45:36 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) 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.1979.3; Wed, 4 Nov 2020 10:45:36 -0700 Received: from m18063-ThinkPad-T460p.microchip.com (10.10.115.15) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.1979.3 via Frontend Transport; Wed, 4 Nov 2020 10:45:31 -0700 From: Claudiu Beznea To: , , , , , Subject: [PATCH v2 0/8] clk: at91: adapt for dvfs Date: Wed, 4 Nov 2020 19:45:18 +0200 Message-ID: <1604511926-29516-1-git-send-email-claudiu.beznea@microchip.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201104_124541_282866_B6F86B11 X-CRM114-Status: GOOD ( 13.57 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, eugen.hristev@microchip.com, Claudiu Beznea , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi, SAMA7G5 is capable of DVFS. The supported CPU clock frequencies could be obtained from CPU PLL. The hardware block diagram for clock feeding the CPU is as follows: +--------+ +-->|divider1|--> CPU clock | +--------+ +--------+ +----------+ | +--------+ |CPU PLL |-->|prescaller|--+-->|divider0|--> MCK0 clock +--------+ +----------+ +--------+ When switching CPU clock frequencies the MCK0 is also changed by DVFS driver to avoid its over/under clocking (depending on CPU clock frequency requested by DVFS algorithms). Some of IPs feed by MCK0 are MCK0 glich aware, some are not. For this MCK0 was removed from the parents list of the IPs which are not MCK0 glitch aware (patch 5/8). This series adapt AT91 clocks (mostly sam9x60-pll and master clock drivers) so that runtime changes of these clocks to be allowed. The CPU clock was registered from prescaller clock (see above diagram) and no software control has been added for divider1 because the frequencies supported by SAMA7G5's CPU could be directly obtained from CPU PLL + prescaller. On top of this series I also added a fix for sama7g5.c code (patch 1/8). Please let me know if you would like me to send this one separtely (it would be nice if this fix could be integrated in 5.10). Thank you, Claudiu Beznea Changes in v2: - s/at91rm9200_mck_lock/at91sam9260_mck_lock in patch 7/8 Claudiu Beznea (6): clk: at91: sama7g5: fix compilation error clk: at91: clk-sam9x60-pll: allow runtime changes for pll clk: at91: sama7g5: remove mck0 from parent list of other clocks clk: at91: sama7g5: decrease lower limit for MCK0 rate clk: at91: clk-master: re-factor master clock clk: at91: sama7g5: register cpu clock Eugen Hristev (2): dt-bindings: clock: at91: add sama7g5 pll defines clk: at91: sama7g5: allow SYS and CPU PLLs to be exported and referenced in DT drivers/clk/at91/at91rm9200.c | 20 ++- drivers/clk/at91/at91sam9260.c | 24 ++- drivers/clk/at91/at91sam9g45.c | 30 ++-- drivers/clk/at91/at91sam9n12.c | 34 ++-- drivers/clk/at91/at91sam9rl.c | 22 ++- drivers/clk/at91/at91sam9x5.c | 27 +++- drivers/clk/at91/clk-master.c | 323 +++++++++++++++++++++++++++++++------ drivers/clk/at91/clk-sam9x60-pll.c | 102 ++++++++++-- drivers/clk/at91/dt-compat.c | 15 +- drivers/clk/at91/pmc.h | 20 ++- drivers/clk/at91/sam9x60.c | 35 ++-- drivers/clk/at91/sama5d2.c | 41 +++-- drivers/clk/at91/sama5d3.c | 37 +++-- drivers/clk/at91/sama5d4.c | 39 +++-- drivers/clk/at91/sama7g5.c | 139 +++++++++------- include/dt-bindings/clock/at91.h | 11 ++ 16 files changed, 692 insertions(+), 227 deletions(-)