From patchwork Fri Nov 6 09:27:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 11886523 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 0352EC388F2 for ; Fri, 6 Nov 2020 09:29:55 +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 8211E208B3 for ; Fri, 6 Nov 2020 09:29:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ZoS9o+tx"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="F3T652Ct" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8211E208B3 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=g2GIaVBtK3CZXx6d2+XBOPEWGQ+QhCjJ+3YiuAaicXw=; b=ZoS9o+tx5KtDmVb0itnaNa3RX5 pT0/VJT0wvqCphaMTgaZH0F/akqo6l2xdERcp/JQtYp/nZwJVCUVyOUiqJpLnAWv7dX5+WImT5f/a NHKEU8bmyYrde2WhdrSNOS5xREsZXgBASWZGfohEAorEhtTSwOV86MrCXdz3FiCdyB96bE142SNcw wo2p40p1Tv2oUV7E2s17ANoRPvNUFkvw8j7t69JX9E2d9XN3cWY0weif8LSf0L+4xVdsmqxOznYmn aPxMmWz3qBAIw/oRyXjB9bQcake248IeXmWKLH8Op2WuZZT9jqD0LP8ALHYFnjR9UlywvOBBLOz4e ZD3CIcoQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kay2e-0000gj-18; Fri, 06 Nov 2020 09:28:20 +0000 Received: from esa5.microchip.iphmx.com ([216.71.150.166]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kay2a-0000f6-Jv for linux-arm-kernel@lists.infradead.org; Fri, 06 Nov 2020 09:28:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1604654896; x=1636190896; h=from:to:cc:subject:date:message-id:mime-version; bh=XFJniwlkNXe8JM15OXyPD5pcQfDbLM43u1ZRyw/GVgk=; b=F3T652CtsAziZXl+6ull1NO+R+wHlBNWRPuBf5vhPj1TV60LdHy6UlaA QF6bJBsrt/vCPrbrDNKhHttCkRQ+/5fp2TksjIUYpLz3J1PzNzn7v1RHT XYCi05krfautZrpPbQ6UKxjQsEnZcST+oqlXEUr7tA3cokiuizbMPYDIU 5WeDoxf6aWkylrlDgvdKft9HmRyjDA+lct96tQVmlGNTCEtKn/NsJg7X2 xOrXL3XMKwjUWJsjDDmOoWhh/xShwRiVTOTt6NgWBlwGX1srV6AbD+Qup gQKj7xCHzcW6R4XWmQaGNLoss1dS3S7Be96ElqQ25eU60LfRM2ZVFVxip Q==; IronPort-SDR: PiN57OyndIRezPrmP27QVdfP9WUeWkQxAMo9QmP1nWM1lMY8qk5l0xrCE6Wmla35kxvYLbuVRn /aJL4OyZmsmv+0MX6nbmlfH9/QTAaE7tmvSHt9Pb0EnGE6CjjnDs9HeNNIwa2IB2h1vQMTvEne sJXSmbqioY+99bdOnL5nycYigbS8X7OzcRLENgAKeKTN7LhrXXOcI7jsnyuHglQRT7j2oRiqOZ gmaET2pVAMJDS629U9J9aKkdG7aXkAtIJ0pqWi+2ya0mqMaOpdY1s00CaMDxLzzIaio1QMsWB3 I90= X-IronPort-AV: E=Sophos;i="5.77,456,1596524400"; d="scan'208";a="97423883" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 06 Nov 2020 02:28:14 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Fri, 6 Nov 2020 02:28:13 -0700 Received: from m18063-ThinkPad-T460p.microchip.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.1979.3 via Frontend Transport; Fri, 6 Nov 2020 02:28:06 -0700 From: Claudiu Beznea To: , , , , , Subject: [PATCH v3 00/11] clk: at91: adapt for dvfs Date: Fri, 6 Nov 2020 11:27:53 +0200 Message-ID: <1604654884-30339-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-20201106_042816_868539_DA476AA5 X-CRM114-Status: GOOD ( 14.11 ) 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 7/11). 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/11). 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). Changes were tested on SAMA5D2, SAMA5D3, SAM9X60 and SAMA7G5. Thank you, Claudiu Beznea Changes in v3: - collected Reviewed-by, Tested-by tags - add patches 4/11, 5/11, 9/11 - in patch 10/11 use CLK_SET_RATE_GATE on MCK div and MCK pres for all the platforms except sama7g5 Changes in v2: - s/at91rm9200_mck_lock/at91sam9260_mck_lock in patch 7/8 Claudiu Beznea (7): 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: sama7g5: do not allow cpu pll to go higher than 1GHz clk: at91: clk-master: re-factor master clock clk: at91: sama7g5: register cpu clock Eugen Hristev (4): dt-bindings: clock: at91: add sama7g5 pll defines clk: at91: sama7g5: allow SYS and CPU PLLs to be exported and referenced in DT clk: at91: clk-master: add 5th divisor for mck master clk: at91: sama7g5: add 5th divisor for mck0 layout and characteristics drivers/clk/at91/at91rm9200.c | 21 ++- drivers/clk/at91/at91sam9260.c | 26 ++- drivers/clk/at91/at91sam9g45.c | 32 +++- drivers/clk/at91/at91sam9n12.c | 36 ++-- drivers/clk/at91/at91sam9rl.c | 23 ++- drivers/clk/at91/at91sam9x5.c | 28 +++- drivers/clk/at91/clk-master.c | 328 +++++++++++++++++++++++++++++++------ drivers/clk/at91/clk-sam9x60-pll.c | 102 ++++++++++-- drivers/clk/at91/dt-compat.c | 15 +- drivers/clk/at91/pmc.h | 22 ++- drivers/clk/at91/sam9x60.c | 36 ++-- drivers/clk/at91/sama5d2.c | 42 +++-- drivers/clk/at91/sama5d3.c | 38 +++-- drivers/clk/at91/sama5d4.c | 40 +++-- drivers/clk/at91/sama7g5.c | 204 ++++++++++++++--------- include/dt-bindings/clock/at91.h | 11 ++ 16 files changed, 759 insertions(+), 245 deletions(-)