From patchwork Fri Jul 2 22:51:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Blumenstingl X-Patchwork-Id: 12356759 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=-8.7 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,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 1B497C07E95 for ; Fri, 2 Jul 2021 22:54:23 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 C86E0613ED for ; Fri, 2 Jul 2021 22:54:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C86E0613ED Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=googlemail.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=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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:In-Reply-To:References: List-Owner; bh=BLBZWBda1W2viB54EXs2NAaNuIsCneqMv4A++3Gx+Wo=; b=KR5Vn7Hc3Qq1jZ HRHLwr/8EaoW0SIy3bB8RmiCUXxRfPXrgqeEVcJI/xSp/EnNa2PpwVS8Evam+N541wpA+jTxfu939 pNPmeXxulY4lBKeWJEAdYmkUgvGLTGbudx4SS+/Y6LveHYO2Udn72bbFP8mi0P+uLV28xZkvNq2i6 jEMAfevbHNiQ8ZDpUiPWwMbeXOYPfx9Lldmnc9hQbRSh1HuYzq1mJ99g0F2Xr81YIOIg5IDj/HbBP RGNAZDRyAP7BkZ2eqZxjKnBpOg0aZ9I0jtLyFwI046z7365zR35QXOGjphgdCCHMtbR6XOVApFgCw XTovsp/1GOGULavJjWmg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lzS0x-004Bzw-Rp; Fri, 02 Jul 2021 22:52:04 +0000 Received: from mail-ej1-x62d.google.com ([2a00:1450:4864:20::62d]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lzS0u-004Bz3-CT for linux-arm-kernel@lists.infradead.org; Fri, 02 Jul 2021 22:52:01 +0000 Received: by mail-ej1-x62d.google.com with SMTP id o5so18641157ejy.7 for ; Fri, 02 Jul 2021 15:52:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=DrJ8vO1HssWxZ8Acjo/rbz8cE2rHN+SdBic4zIrJJMs=; b=ehFBsvpjSBEY74b8LNx4yff1LMl97sdYtBT2LyhV8U4Fdq49km4EhVnCpTC3lTkmru SvrpWcY6++4BQcuozbiS2tIC9XdEb8eVXqC9kU3ek6g/V0e9OYXS8f8WEZn6WjwnvF31 3M+Z/CLaOGrONS0nxXQnKWZyDTdXBaQ10s8YBUCK5ucya8XR/RButCeORfna5pPchtbi BRsb7wHS07wL1IMbhkr2I5/p00OTIsrh9BVhvEuBG5eppS+v2XMku2257mV2VCJiKZde PaGwnLlb3uUjRl+yKcZzE4DVtutJaj2c+RD6DtasDSktpJEFv7Lvx7O+6M4eeKTnx0pB tLKQ== 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:mime-version :content-transfer-encoding; bh=DrJ8vO1HssWxZ8Acjo/rbz8cE2rHN+SdBic4zIrJJMs=; b=oeIvNjLZOoWmJ297r1w+Vk0vwC4hbaPQyXHW7kRE3L7Qnr7AVbqmKiT1Ka6RyDCNh3 wLPJDP/ikgoQAMApY8UR2DueQUbODywj7T8qZs1ZZi6r/oCRoW33HrmFrSY32idBjiVR 6k+QC+uxo+rMBOMxPjDDeO9qd+g+TFOeS9P1KaBDExWWZOXtZHZiKpM7tWafbCLXilvz pionYrbFHSQ3lUlQUvGNaacSRWbIpOd5yDp8liousy0/qzG6pcyLZJLpgvmeJbHP9QYV k7BAwI9p9HxP/r4meoLBdLdbubTbUT4pSbiRbUtgVFJpFFIdORt6V0JnGVRIkzcbCYS8 lkNA== X-Gm-Message-State: AOAM5314Vs93uNFSrFSAXeYBKEDVkUHRtJ8Ut4cs9PmzLCEPORbVh6F9 UAA2OyIHfqw/9L0E5jK2VO4= X-Google-Smtp-Source: ABdhPJxTJSdxKuhnuggAFqvSl4jKwN16HmCiTpwLaotzMJhT5pNiE90uQl7XEfyNpmrg5b5X0dJC8w== X-Received: by 2002:a17:907:7252:: with SMTP id ds18mr2044138ejc.227.1625266318870; Fri, 02 Jul 2021 15:51:58 -0700 (PDT) Received: from localhost.localdomain (dynamic-095-117-063-046.95.117.pool.telefonica.de. [95.117.63.46]) by smtp.googlemail.com with ESMTPSA id r17sm1866964edt.33.2021.07.02.15.51.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Jul 2021 15:51:58 -0700 (PDT) From: Martin Blumenstingl To: linux-clk@vger.kernel.org, sboyd@kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Martin Blumenstingl Subject: [PATCH v1 0/6] clk: switch dividers to .determine_rate Date: Sat, 3 Jul 2021 00:51:39 +0200 Message-Id: <20210702225145.2643303-1-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210702_155200_484042_0DAC79AC X-CRM114-Status: GOOD ( 15.20 ) 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 This is a continuation of patch #2 ("clk: divider: Switch from .round_rate to .determine_rate by default", [0]) from my other series: "clk: meson: rounding for fast clocks on 32-bit SoCs" [1] That patch caused NULL dereferences in various drivers which are still accessing clk_divider_ops.round_rate directly (which got removed in the mentioned patch). Guenter Roeck found this issue first on Freescale i.MX6 Ultralite and reported it here: [2] Later on Marek Szyprowski reported that BCM2835 is also affected: [3] With this improved version of the patch I am taking a more definsive approach as suggested by Stephen Boyd. Instead of dropping clk_divider_ops.round_rate we're now keeping it and adding clk_divider_ops.determine_rate. CCF core already prefers .determine_rate over .round_rate so the new implementation is used by default. To simplify the transition to .determine_rate in the future this updated series now has five extra patches to port over the drivers which used clk_divider_ops.round_rate over to clk_divider_ops.determine_rate. I have compile-tested all patches. Additionally the imx patch is runtime-tested using Guenter Roeck's suggestion (thanks!): $ qemu-system-arm -M mcimx6ul-evk -m 512M -kernel arch/arm/boot/zImage -dtb arch/arm/boot/dts/imx6ul-14x14-evk.dtb -append "console=ttymxc0 loglevel=8 earlycon earlyprintk" -monitor stdio This series is based on clk-next commit 783d08bd02f5d3 ("Revert "clk: divider: Switch from .round_rate to .determine_rate by default"clk-next"). My suggestion is to let all patches go through clk-next (instead of individual driver trees) as the first patch in this series is a pre- condition for the other ones. [0] https://patchwork.kernel.org/project/linux-clk/patch/20210627223959.188139-3-martin.blumenstingl@googlemail.com/ [1] https://patchwork.kernel.org/project/linux-clk/cover/20210627223959.188139-1-martin.blumenstingl@googlemail.com/ [2] https://lore.kernel.org/linux-clk/20210701202540.GA1085600@roeck-us.net/ [3] https://lore.kernel.org/linux-clk/e21c34a3-2586-057d-013b-6c8ec094d1a8@samsung.com/ Martin Blumenstingl (6): clk: divider: Implement and wire up .determine_rate by default clk: imx: clk-divider-gate: Switch to clk_divider.determine_rate clk: bcm2835: Switch to clk_divider.determine_rate clk: stm32f4: Switch to clk_divider.determine_rate clk: stm32h7: Switch to clk_divider.determine_rate clk: stm32mp1: Switch to clk_divider.determine_rate drivers/clk/bcm/clk-bcm2835.c | 9 ++++----- drivers/clk/clk-divider.c | 23 +++++++++++++++++++++++ drivers/clk/clk-stm32f4.c | 8 ++++---- drivers/clk/clk-stm32h7.c | 8 ++++---- drivers/clk/clk-stm32mp1.c | 10 +++------- drivers/clk/imx/clk-divider-gate.c | 10 +++++----- 6 files changed, 43 insertions(+), 25 deletions(-)