From patchwork Wed Nov 14 22:57:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Blumenstingl X-Patchwork-Id: 10683337 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 01E1A14DB for ; Wed, 14 Nov 2018 22:58:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E359F2BD8A for ; Wed, 14 Nov 2018 22:58:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D4B512BD92; Wed, 14 Nov 2018 22:58:51 +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=-3.6 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 664CE2BD8A for ; Wed, 14 Nov 2018 22:58:51 +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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=oUoh5RVP5wEc4K08IdbgCCUSnRV3jDb6o4tIoygpkEA=; b=elIe8VzYvVTpTv V0As+OS3k1HIwTomijQTp6csYZT4d1/k9zzMCnZce1Olzgj//u+Yr04DosSJpzDLrs1z6QmwU0vUT 70OAXA88CwXVf9sOrcQVSX5eT/tNt/G93o1OcASomC4izBB1lxogKto2+mkdf82m5j09wTv3sfYlO jdorRwEZNnUJEdoVIVK1VE2lWpmICO6AXX7cl5QJSkFnmSVVSkJnInkktzEvEF8qAfHK/DYQF6DW9 nhwVwuqiXwp5JZ4CAjJcgsDsHLYKbf7L41LMv/HnwoIGMaUvwcv0wfRLpPanFVtXhowYoKZUhGG69 e8JzQuwsvrbUOav9OOBg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gN47T-0000ag-M3; Wed, 14 Nov 2018 22:58:47 +0000 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gN46l-00087p-Nj; Wed, 14 Nov 2018 22:58:06 +0000 Received: by mail-wr1-x443.google.com with SMTP id z13-v6so19105736wrs.3; Wed, 14 Nov 2018 14:57:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mqeqV0l+4ciF5RTVW9joEtdlIbRSvfaFdjva14ByRQM=; b=IbCQFyyVdMVMgwlkpg4LyGdG9lmHPNKlQgYIcye4QYFBer6s2lRBkfJvs6qwqZppJj 62Qik7Lp8EqPJWqlpMEVzISczyfQbEuoNn7Bzhw7qjFD+7nk5K9BtJGG5po/O90z/Bep jZB0inDrIGa2tfHvXFruKc5rv339jmI2LMRV6W/QOrJ5L+pgAFe1RIYlK0uD/UZOd0xw kzrMCdye9eL0Ou1Y0XIM5Q//FZuUVWG41wuCpBrZwW8Sg87sfjKmpfwBqqzJiPSd9lt4 4krMyKYLfODfnlGmj1vptcVe7x7MGEsKlRKIcnMfslVzqK7Zj5WVvn7u/6bllF191Egx 1n5Q== 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:mime-version:content-transfer-encoding; bh=mqeqV0l+4ciF5RTVW9joEtdlIbRSvfaFdjva14ByRQM=; b=W8kEHsCLbj5QOhFK6hHLWmXBaP9havqb4RRzvnkqOaG7/PUyC6y4s3ebng27ZW6/Ww FdAjzt+w+7u0AIIICWlMKWCok6tJVD+JBRMrYUuGfvzY5/8/jzPW/StjCfux5p0wVQgF OXbJR2m/juQp4evxz+/MKf8RdfVh71e7YZrd68O1cUv7Vi6k9hSOgcVKogvCpmP0w90N 9gzmhZJPw/LCuTOvZ8gC4iRDTHFUeBp9l+sYYJTB1ghRn1vOdZmOnlb59KVyT3AnYxfQ blesLGzknh0vy7mLEcRhtpNDAqyC0a2ULzwtjdTfryQxIPzBR1sfMroLm82oCu4eNZ+O vSag== X-Gm-Message-State: AGRZ1gKE0YI+ab5DBIcre22nnV23MWKi0qjbvhiL8tD8u/qLQGopD74J 3W3oIwn450m1fdJL2JJ2oYOwixQs X-Google-Smtp-Source: AJdET5djTpjBY0KV3FDCcu2Viy0gYHjlh01ToHzIDSeMfzz24L1fdUVBnwr1RLhfhYimgYG7mh+3tQ== X-Received: by 2002:a5d:48cc:: with SMTP id p12-v6mr3773836wrs.122.1542236271637; Wed, 14 Nov 2018 14:57:51 -0800 (PST) Received: from blackbox.darklights.net (p200300DCD717A100301AB549B11D5ACB.dip0.t-ipconnect.de. [2003:dc:d717:a100:301a:b549:b11d:5acb]) by smtp.googlemail.com with ESMTPSA id n7-v6sm18987784wrt.60.2018.11.14.14.57.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Nov 2018 14:57:51 -0800 (PST) From: Martin Blumenstingl To: linux-amlogic@lists.infradead.org, linux-clk@vger.kernel.org, jbrunet@baylibre.com, narmstrong@baylibre.com Subject: [RFC v1 1/7] clk: meson: meson8b: run from the XTAL when changing the CPU frequency Date: Wed, 14 Nov 2018 23:57:19 +0100 Message-Id: <20181114225725.2821-2-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181114225725.2821-1-martin.blumenstingl@googlemail.com> References: <20181114225725.2821-1-martin.blumenstingl@googlemail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181114_145803_772325_7EE55923 X-CRM114-Status: GOOD ( 15.00 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: sboyd@kernel.org, Martin Blumenstingl , mturquette@baylibre.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Changing the CPU clock requires changing various clocks including the SYS PLL. The existing meson clk-pll and clk-regmap drivers can change all of the relevant clocks already. However, changing for exampe the SYS PLL is problematic because as long as the CPU is running off a clock derived from SYS PLL changing the latter results in a full system lockup. Fix this system lockup by switching the CPU clock to run off the XTAL while we are changing the any of the clocks in the CPU clock tree. Signed-off-by: Martin Blumenstingl Reviewed-by: Jerome Brunet --- drivers/clk/meson/meson8b.c | 63 +++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/drivers/clk/meson/meson8b.c b/drivers/clk/meson/meson8b.c index 9bd5920da0ff..40e77fe4ba7c 100644 --- a/drivers/clk/meson/meson8b.c +++ b/drivers/clk/meson/meson8b.c @@ -1103,6 +1103,53 @@ static const struct reset_control_ops meson8b_clk_reset_ops = { .deassert = meson8b_clk_reset_deassert, }; +struct meson8b_nb_data { + struct notifier_block nb; + struct clk_hw_onecell_data *onecell_data; +}; + +static int meson8b_cpu_clk_notifier_cb(struct notifier_block *nb, + unsigned long event, void *data) +{ + struct meson8b_nb_data *nb_data = + container_of(nb, struct meson8b_nb_data, nb); + struct clk_hw **hws = nb_data->onecell_data->hws; + struct clk_hw *cpu_clk_hw, *parent_clk_hw; + struct clk *cpu_clk, *parent_clk; + int ret; + + switch (event) { + case PRE_RATE_CHANGE: + parent_clk_hw = hws[CLKID_XTAL]; + break; + + case POST_RATE_CHANGE: + parent_clk_hw = hws[CLKID_CPU_SCALE_OUT_SEL]; + break; + + default: + return NOTIFY_DONE; + } + + cpu_clk_hw = hws[CLKID_CPUCLK]; + cpu_clk = __clk_lookup(clk_hw_get_name(cpu_clk_hw)); + + parent_clk = __clk_lookup(clk_hw_get_name(parent_clk_hw)); + + ret = clk_set_parent(cpu_clk, parent_clk); + if (ret) + return notifier_from_errno(ret); + + udelay(100); + + return NOTIFY_OK; +} + +static struct meson8b_nb_data meson8b_cpu_nb_data = { + .nb.notifier_call = meson8b_cpu_clk_notifier_cb, + .onecell_data = &meson8b_hw_onecell_data, +}; + static const struct regmap_config clkc_regmap_config = { .reg_bits = 32, .val_bits = 32, @@ -1112,6 +1159,8 @@ static const struct regmap_config clkc_regmap_config = { static void __init meson8b_clkc_init(struct device_node *np) { struct meson8b_clk_reset *rstc; + const char *notifier_clk_name; + struct clk *notifier_clk; void __iomem *clk_base; struct regmap *map; int i, ret; @@ -1166,6 +1215,20 @@ static void __init meson8b_clkc_init(struct device_node *np) return; } + /* + * FIXME we shouldn't program the muxes in notifier handlers. The + * tricky programming sequence will be handled by the forthcoming + * coordinated clock rates mechanism once that feature is released. + */ + notifier_clk_name = clk_hw_get_name(&meson8b_cpu_scale_out_sel.hw); + notifier_clk = __clk_lookup(notifier_clk_name); + ret = clk_notifier_register(notifier_clk, &meson8b_cpu_nb_data.nb); + if (ret) { + pr_err("%s: failed to register the CPU clock notifier\n", + __func__); + return; + } + ret = of_clk_add_hw_provider(np, of_clk_hw_onecell_get, &meson8b_hw_onecell_data); if (ret) From patchwork Wed Nov 14 22:57:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Blumenstingl X-Patchwork-Id: 10683341 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 47B9514DB for ; Wed, 14 Nov 2018 22:58:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 386902BD92 for ; Wed, 14 Nov 2018 22:58:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2102A2BDB2; Wed, 14 Nov 2018 22:58:57 +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=-3.6 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 B65652BD92 for ; Wed, 14 Nov 2018 22:58:56 +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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=AWy6UjSWF5mdggUlpJCT54hkYiXAEv+mc6NGAW/G4wU=; b=kGerNUsc+tBgap krdGdFtlZjqrL5lXciPYVCPlax4DrHAn215+rLskih0J2ewCftuCaN2qwYV9S8KCL9jxegBCAYwr/ hd+WE9+DIOpO51NqxnXrSaTHbs78kbaZhEQ/veZJsEqyKe1KHuitWisN2juH15jBkQzn4uKa7i79H D8mXwzDmy0z0zl1b0/D0vMCDEppvcTg7GKmZyd4io2hbWxi1S6uTyj7KTni7Rpk1CAmutiQC7CPSg vTpPP5TWwY+5kEKdxQ4ok+PO7rifrFZRV7miJ05GoZmfzwmM3oQ9CTH3L5mQlm0RrUDeqUX5kmjlE YdGgbq7wLCUWZpPfHTJQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gN47Z-0000ha-Ny; Wed, 14 Nov 2018 22:58:53 +0000 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gN46m-00087x-Lx; Wed, 14 Nov 2018 22:58:06 +0000 Received: by mail-wm1-x344.google.com with SMTP id f1-v6so14514454wmg.1; Wed, 14 Nov 2018 14:57:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=i9XbLDddSRNz8Pp8GKo015RHTfUcwsMZBJji8p3sH4I=; b=KE5OgF0oygUDEZtDLffHBW4PRmIGWH6ysVGZYdttZh2bDOrS6CBlrk+Gy9q8hAZQTH LUYbhqkvAwJ8NKYgqRPUdRRjE/Jk5qhn8+ypFINADAXxTKKc4gePb9LU/cTROQCT1vxr EPtThUNdHwZ4gLdmSo5gjQq8noNaTVCo3MB+h7TSfNkTlBO8geeyizwmAwzwFU5JWsvL FfdAlTKDeSfAGQVXe36MQ9XVC6SbEYEu4llXhQoek0hQ3OZKuHBCZOxMRw8uHwO/9ykI yfcQYAycTtJgSna0xM6JUGmcf87ARIe5v9zwPZi/C22c9KgvKetzjjl9wNLkBznXlImD C//g== 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:mime-version:content-transfer-encoding; bh=i9XbLDddSRNz8Pp8GKo015RHTfUcwsMZBJji8p3sH4I=; b=Il/gBjGTVM/CiplFexTpWte8y+eAnBE17fokRUz6sJiUnuD7Ul9jNmLqij76uEcDHQ OD8qLASMJx2f2hPZwSgXN8Ios/jFpwThPA/9t5PSVlxXeQ4vOFeQl4Lc1KsIoEGJ5dyC K2SEn6T5r2AZ4shEi7Y+vTuHoQhpUPpmlEopMnDm0y8N3VSQZKlspn3L1wlADyVKxnMI xeTR6BlSkc+dHki+WDr8ecJjOYunuVQNi6MTG2x7t4/mLvI25Vm0mzcX6PPjWBlJYEVi KsbPjORMDuJGOYIiQ9jLe9sumnVRrsY4Wc1nFdFz5E5V4zUt82fKgXfuVhMNW1DZLhXc UWSg== X-Gm-Message-State: AGRZ1gL6QUV9m2oEgwDVfit8wX+PP1ea+Rf4Y1CiNr/17zsq4pZObTfT f/kepi3B7vSJ5UlRzofQXl4q7TbH X-Google-Smtp-Source: AJdET5c4on8n5X2RSehY+5ikgJJ/wFg/MLTQkrjIZIyFjjlkIITTdMqbDtiMVTN3QT5otmflXLjaJQ== X-Received: by 2002:a1c:d0cd:: with SMTP id h196mr3535898wmg.13.1542236272737; Wed, 14 Nov 2018 14:57:52 -0800 (PST) Received: from blackbox.darklights.net (p200300DCD717A100301AB549B11D5ACB.dip0.t-ipconnect.de. [2003:dc:d717:a100:301a:b549:b11d:5acb]) by smtp.googlemail.com with ESMTPSA id n7-v6sm18987784wrt.60.2018.11.14.14.57.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Nov 2018 14:57:52 -0800 (PST) From: Martin Blumenstingl To: linux-amlogic@lists.infradead.org, linux-clk@vger.kernel.org, jbrunet@baylibre.com, narmstrong@baylibre.com Subject: [RFC v1 2/7] clk: meson: meson8b: do not use cpu_div3 for cpu_scale_out_sel Date: Wed, 14 Nov 2018 23:57:20 +0100 Message-Id: <20181114225725.2821-3-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181114225725.2821-1-martin.blumenstingl@googlemail.com> References: <20181114225725.2821-1-martin.blumenstingl@googlemail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181114_145804_735228_2350E924 X-CRM114-Status: GOOD ( 13.22 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: sboyd@kernel.org, Martin Blumenstingl , mturquette@baylibre.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The cpu_div3 clock (cpu_in divided by 3) generates a signal with a duty cycle of 33%. The CPU clock however requires a clock signal with a duty cycle of 50% to run stable. cpu_div3 was observed to be problematic when cycling through all available CPU frequencies (with additional patches on top of this one) while running "stress --cpu 4" in the background. This caused sporadic hangs where the whole system would fully lock up. Amlogic's 3.10 kernel code also does not use the cpu_div3 clock either when changing the CPU clock. Signed-off-by: Martin Blumenstingl Reviewed-by: Jerome Brunet --- drivers/clk/meson/meson8b.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/clk/meson/meson8b.c b/drivers/clk/meson/meson8b.c index 40e77fe4ba7c..8a3c346e110d 100644 --- a/drivers/clk/meson/meson8b.c +++ b/drivers/clk/meson/meson8b.c @@ -608,20 +608,27 @@ static struct clk_regmap meson8b_cpu_scale_div = { }, }; +static u32 mux_table_cpu_scale_out_sel[] = { 0, 1, 3 }; static struct clk_regmap meson8b_cpu_scale_out_sel = { .data = &(struct clk_regmap_mux_data){ .offset = HHI_SYS_CPU_CLK_CNTL0, .mask = 0x3, .shift = 2, + .table = mux_table_cpu_scale_out_sel, }, .hw.init = &(struct clk_init_data){ .name = "cpu_scale_out_sel", .ops = &clk_regmap_mux_ro_ops, + /* + * NOTE: We are skipping the parent with value 0x2 (which is + * "cpu_div3") because it results in a duty cycle of 33% which + * makes the system unstable and can result in a lockup of the + * whole system. + */ .parent_names = (const char *[]) { "cpu_in_sel", "cpu_div2", - "cpu_div3", "cpu_scale_div" }, - .num_parents = 4, + .num_parents = 3, .flags = CLK_SET_RATE_PARENT, }, }; From patchwork Wed Nov 14 22:57:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Blumenstingl X-Patchwork-Id: 10683325 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DADD21759 for ; Wed, 14 Nov 2018 22:58:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CD1C22BF88 for ; Wed, 14 Nov 2018 22:58:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C16E92BF93; Wed, 14 Nov 2018 22:58:20 +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=-3.6 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 34DB32BF8B for ; Wed, 14 Nov 2018 22:58:20 +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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=K18SDmbl8jo91LuH2+mDJZuf9LGHgpDjLPhitMksy8A=; b=HXMPKtqh/GGoa8 T2794uTyrJcNM+Z9uClNEVkINPkehXjnkAAwEOL5e7kGTK3x2qHBvGe3688xBGtoLWJUhcH0gOWmg L8bsiIXOjxLA2cz+nkjaGf/2eH1yBG91nvhD+tkSbDStzHAMWPkSjQvMXi9YTHtfUwovh9SkE+VgP r5PuqVG1n1yrd3MXXynkWej43dIgn7CEoNlUM2bYZKalTFDRlh45EriFVBZ9SBnQKNgOVGPwS/WEA 7vct61XSMczxi8QWbCqoTcXKmNzmm7GsaVL5bokCy4grEhDjbID/R/4V9qVfGE1YXqMuwaW2U9l3G Sb7RAlFcl31sgP+nUmhg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gN46z-0008Pj-U7; Wed, 14 Nov 2018 22:58:17 +0000 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gN46l-000883-Nk; Wed, 14 Nov 2018 22:58:05 +0000 Received: by mail-wr1-x443.google.com with SMTP id v18-v6so19101590wrt.8; Wed, 14 Nov 2018 14:57:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=T0RIdbj41WMBGlBYmwnCzpr3eDQ3vT6i3efI49BspNg=; b=c81J09fZIRIfQ3NXnELmVnJBBeVW9yr3GcO4eY70fRJyu2oo53KuOcd1nYvYGZTc3G WzU0VhYZhnxKO1bFdT75qNyTGZK554yaewi/4Erf/C84yrbpiPrTR9ATte1b8LF0mGjH IPj+6fOuOrfguo5xyJK+NNjvRMygYKRyH7dYkm87Bft4U9Ld0BI/uG5AC9r3J3zuxCSD k7IMaoVO9ncLBbcclmNS0/AIRuXKOzcZNcvXlJIe3uU9d6axl9kh3vJQJiSgj+KO9pVr OZgDY+3AQ1vEEOSu2Qlnj45x7YUNb77jiBmJMjdc2jN3kIL2kt6+jmm+9dsJoy48TuYZ fyGw== 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:mime-version:content-transfer-encoding; bh=T0RIdbj41WMBGlBYmwnCzpr3eDQ3vT6i3efI49BspNg=; b=ueWnJ2teyMg0uKsuunNObA+IcYi5nWRhIDpj+jf6K4YE+ykaXBKQINJ+K5X/dZR+J2 fV7fiPGQB1tcSAktbcyHD3SlJTZa/SbZMCJk0YxZ2xW41qE+Elb/EKYxBNmJM3up+L2N cN5XHb/3y5iUS8jNaRxLzo2nUH1WPlhFjo5rQ+Q3Qe+CwAcMOnEKItnF7XsNCI/gqUa4 9ZmR59CUJO8jeIaNYTAhnrqa+GihwmvmuPCESG1SC/99whQ307Yu9BDybkvgvlNl5q2b cdBW4tBb2u5enWgUS1I5StQL86V6IkQXlnblbgN5jYdXqAkl1P+qzzriF0Rk6HXvrElF WuXg== X-Gm-Message-State: AGRZ1gJBXTZe4UoDD1KuOsD/GVoTi8dXpvRE9c7Xoti0dUJQRxkh2Qqv gk0KlE0145Y74+FdCsPSdhNU8wuT X-Google-Smtp-Source: AJdET5eXn94wuy/HY2p2+zPnGKIkkOJNDJlBio7vB/a+cY6KAKooRd7/MSGfpBV2ShZooSMr/5oRmw== X-Received: by 2002:adf:8264:: with SMTP id 91mr3625837wrb.312.1542236273997; Wed, 14 Nov 2018 14:57:53 -0800 (PST) Received: from blackbox.darklights.net (p200300DCD717A100301AB549B11D5ACB.dip0.t-ipconnect.de. [2003:dc:d717:a100:301a:b549:b11d:5acb]) by smtp.googlemail.com with ESMTPSA id n7-v6sm18987784wrt.60.2018.11.14.14.57.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Nov 2018 14:57:53 -0800 (PST) From: Martin Blumenstingl To: linux-amlogic@lists.infradead.org, linux-clk@vger.kernel.org, jbrunet@baylibre.com, narmstrong@baylibre.com Subject: [RFC v1 3/7] clk: meson: clk-pll: check if the clock is already enabled Date: Wed, 14 Nov 2018 23:57:21 +0100 Message-Id: <20181114225725.2821-4-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181114225725.2821-1-martin.blumenstingl@googlemail.com> References: <20181114225725.2821-1-martin.blumenstingl@googlemail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181114_145803_769505_2FB58CA4 X-CRM114-Status: GOOD ( 12.70 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: sboyd@kernel.org, Martin Blumenstingl , mturquette@baylibre.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Since commit 6f888e7bc7bd58 ("clk: meson: clk-pll: add enable bit") our PLLs also support the "enable" bit. Currently meson_clk_pll_enable unconditionally resets the PLL, enables it, takes it out of reset and waits until it is locked. This works fine for our current clock trees. However, there will be a problem once we allow modifications to sys_pll on Meson8, Meson8b and Meson8m2 (which will be required for CPU frequency scaling): the CPU clock is derived from the sys_pll clock. Once clk_enable is called on the CPU clock this will be propagated by the common clock framework up until the sys_pll clock. If we reset the PLL unconditionally in meson_clk_pll_enable the CPU will be stopped (on Meson8, Meson8b and Meson8m2). To prevent this we simply check if the PLL is already enabled and do reset the PLL if it's already enabled and locked. Signed-off-by: Martin Blumenstingl Reviewed-by: Jerome Brunet --- drivers/clk/meson/clk-pll.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/clk/meson/clk-pll.c b/drivers/clk/meson/clk-pll.c index f5b5b3fabe3c..b46cca953f4f 100644 --- a/drivers/clk/meson/clk-pll.c +++ b/drivers/clk/meson/clk-pll.c @@ -200,11 +200,32 @@ static void meson_clk_pll_init(struct clk_hw *hw) } } +static int meson_clk_pll_is_enabled(struct clk_hw *hw) +{ + struct clk_regmap *clk = to_clk_regmap(hw); + struct meson_clk_pll_data *pll = meson_clk_pll_data(clk); + + if (meson_parm_read(clk->map, &pll->rst)) + return 0; + + if (!meson_parm_read(clk->map, &pll->en)) + return 0; + + if (!meson_parm_read(clk->map, &pll->l)) + return 0; + + return 1; +} + static int meson_clk_pll_enable(struct clk_hw *hw) { struct clk_regmap *clk = to_clk_regmap(hw); struct meson_clk_pll_data *pll = meson_clk_pll_data(clk); + /* do nothing if the PLL is already enabled */ + if (meson_clk_pll_is_enabled(hw)) + return 0; + /* Make sure the pll is in reset */ meson_parm_write(clk->map, &pll->rst, 1); From patchwork Wed Nov 14 22:57:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Blumenstingl X-Patchwork-Id: 10683333 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2327F14D6 for ; Wed, 14 Nov 2018 22:58:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 132512BC6C for ; Wed, 14 Nov 2018 22:58:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 04CC52BC71; Wed, 14 Nov 2018 22:58:36 +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=-3.6 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 81E9F2BC6C for ; Wed, 14 Nov 2018 22:58:35 +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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=2qOgC2nh5JLEnzBfXCOvvW+bWUaqwEpUrbWn2Dikdfs=; b=ncAkDPhz9//XP4 XO1XBB70N5S7Il7iJ62EJoxqm5Nkqzlgxrheu7Oh9zOecCTPyfKH3+uNZ4xJO99xzMbnXrUYJ63rw 1tAsvOcZARlQupdg+tvNnkChNYuLBAeayX8Z2haf2M3ilfPhq0gBWz+nuI8WVLa34NAoJj/qe14Tv pNIjMjukVM9GGMvvVX5VdcLq8qmuZoFoRWlW6OP8mMG8MJ/VvqFa/JKxS5uzMG2Mt1FgeWDjG/v4Z /u5HjmbhnFibD5lUfaA7iOaaOMC/Q4bGHE/VwAcRVjNB/h9swoNwcmDgmuFM4HmA+xRZqvsFNlltt yjx8rd9rWnHUbJvrB4JA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gN47C-0000BK-65; Wed, 14 Nov 2018 22:58:30 +0000 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gN46l-000886-Nj; Wed, 14 Nov 2018 22:58:05 +0000 Received: by mail-wr1-x443.google.com with SMTP id k15-v6so19064380wre.12; Wed, 14 Nov 2018 14:57:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/fU3iJUznAqxv4GxLIhJ8UE2d70EiTCopB45m9DeqKk=; b=K0KMlUlgRJsOMGydt4Q3whagKmW8xgSzC3F0M66q0q168BUD0gxg6pDM5TeFdbEZ2A RI5rWFc7cHqOAtBVyj5mnHJpJrHIwiBIpeh/YRK9ZKmhmDLKkc1INvsT6KpOQZl15XZG 5JiiJh7IVGeyMog+cvBpcazKK2h1V7Gyrq3OFf/c33efZwsq5/g8oWsqsgIsKq12wBhx sj5rCmCviC8RYJzc3Z9FigMdZAHAKr7X8S2btZ+g3Bo8c2pbJc4Z/AyBwP7sQNzHPpPu VN0/E4Ig0z0jeaDCYTRboTLHkKqi7K3yGNPIDXZgOTAvChB7QrYkkPZLEIpqzvWi3xr9 48OQ== 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:mime-version:content-transfer-encoding; bh=/fU3iJUznAqxv4GxLIhJ8UE2d70EiTCopB45m9DeqKk=; b=lN67Aq5hdhkszyEpz5ersKkhmzGVT05Mam6LLRzHrr8HsMc2FxcpezrrpLocCF6XU9 lDb4sCE6EI5UfXBcpFLy2Hi1hRZS1lUQFheLKaA4JT+AGdzx1a2ZrOxUjfMflxqTXims Vh0D76wsAYamAhMgA7eJEUO9ZD0egAiCBb6ftV+pxgdN5PNEu9RwHS8zQaBUAfENE11P rc7nCE7thLJPCHrbvmqtXzpbw45L2Y2/6B7TxXe/mVxKk1VYZAhf3fXYyrwZX/eVyayT pQap2b5gN+kkpQ8m53pjMuJIztYzgYyUcuz/QsPmhWVxW8QT/YQrJha3NECDaRBvnH9O MYSA== X-Gm-Message-State: AGRZ1gK9om64Yzt0WpAosyMhAAyQ79xWYSW1OFiQPj+qPgaZMy3P0wj7 GC1NniZzxwtTwdzdKQplkBnWs1ac X-Google-Smtp-Source: AJdET5cCqavL2fJsvJqkY1EgPSxNlGBLCl/eV2taX4lLg5xIPFUyrTrmnsdtZEAhsvOEhuXGgHDCVA== X-Received: by 2002:a5d:40cc:: with SMTP id b12-v6mr3812260wrq.133.1542236275263; Wed, 14 Nov 2018 14:57:55 -0800 (PST) Received: from blackbox.darklights.net (p200300DCD717A100301AB549B11D5ACB.dip0.t-ipconnect.de. [2003:dc:d717:a100:301a:b549:b11d:5acb]) by smtp.googlemail.com with ESMTPSA id n7-v6sm18987784wrt.60.2018.11.14.14.57.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Nov 2018 14:57:54 -0800 (PST) From: Martin Blumenstingl To: linux-amlogic@lists.infradead.org, linux-clk@vger.kernel.org, jbrunet@baylibre.com, narmstrong@baylibre.com Subject: [RFC v1 4/7] clk: meson: clk-pll: add the is_enabled function in the clk_ops Date: Wed, 14 Nov 2018 23:57:22 +0100 Message-Id: <20181114225725.2821-5-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181114225725.2821-1-martin.blumenstingl@googlemail.com> References: <20181114225725.2821-1-martin.blumenstingl@googlemail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181114_145803_772348_2126B6EB X-CRM114-Status: GOOD ( 12.29 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: sboyd@kernel.org, Martin Blumenstingl , mturquette@baylibre.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Now that we have a utility function to check whether the PLL is enabled we can also pass that to our clk_ops to let the common clock framework know about the status of the hardware clock. For now this is of limited use since the only common clock framework's internal "disabled unused clocks" mechanism checks for this. Everything else still uses the ref-counting (internal to the common clock framework) when clk_enable is called. Signed-off-by: Martin Blumenstingl --- drivers/clk/meson/clk-pll.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/clk/meson/clk-pll.c b/drivers/clk/meson/clk-pll.c index b46cca953f4f..65eeae0989d9 100644 --- a/drivers/clk/meson/clk-pll.c +++ b/drivers/clk/meson/clk-pll.c @@ -309,10 +309,12 @@ const struct clk_ops meson_clk_pll_ops = { .recalc_rate = meson_clk_pll_recalc_rate, .round_rate = meson_clk_pll_round_rate, .set_rate = meson_clk_pll_set_rate, + .is_enabled = meson_clk_pll_is_enabled, .enable = meson_clk_pll_enable, .disable = meson_clk_pll_disable }; const struct clk_ops meson_clk_pll_ro_ops = { .recalc_rate = meson_clk_pll_recalc_rate, + .is_enabled = meson_clk_pll_is_enabled, }; From patchwork Wed Nov 14 22:57:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Blumenstingl X-Patchwork-Id: 10683349 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CDF6B14DB for ; Wed, 14 Nov 2018 22:59:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BB3172BFF8 for ; Wed, 14 Nov 2018 22:59:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AC25A2BFFB; Wed, 14 Nov 2018 22:59:58 +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=-3.6 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 47B652BFF8 for ; Wed, 14 Nov 2018 22:59:58 +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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=enEgH4GuUiTB/JB21ntEyYucgp6TR82QN5twaGwQ29E=; b=lMce21DuvtW74i nvoSDIjYlv2DEq3YbL3qHSmekArUPMe/a4nKrpXWsiwcUGUO6skMz30g1zV03P5cbkp0rXlr7JJw1 8qae185KK5AJH7fbtPlQqkai5o5RVLfxq4Y+RxYJJ2p0IfiBLRYES51WA6QCY0HzJPQO+uvd1ms1d l8i9GKoXt/Q6dK6qhI8fdH+gl8hLzqnYDa5PBqVlgofujN+W5PcJMZYpv2A52tM5QvTWhjCfbBcSf 7wmQzGIdG7icLvJWeYNQzLYTXK14VWyAwJHzWhdCocTZqUlaCJ3+Usf88lZ+zmYqhqLBSRrvesCet EImjKFokTII+gpAbzQfw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gN48a-0001c9-Gi; Wed, 14 Nov 2018 22:59:56 +0000 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gN46q-00088P-Fm; Wed, 14 Nov 2018 22:58:09 +0000 Received: by mail-wm1-x342.google.com with SMTP id f2-v6so16182143wme.3; Wed, 14 Nov 2018 14:57:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ZpToRpzBghPIlSWFDMTCMs/livATbaezHsbunO8fvSA=; b=mfwiNurd87CBkFA/C87CCGI7bTZ+K1SisLRKZHceabEfVyWOJVuWqtdU8/MlBySqTL 4R2a/szkUVtkj5akRszQRrIqAanz3qMQzkGbtyei5hzHebjhIVtudzNBGtzNFmTv0e1U xDEGax3vKUhrVn+GNGDoEYLn6dPjyzcoCeAwk9VVIRZAyd9I2eY8isqzw9dctG1A8G0T DSsn2B5tjrKbOW04DmqCoTkBbB03lJ4wSaYcGBb2Qm/WrGW88OPO/93YpSK4tkUZX1HH fCljtvglQKZRGsFD2qjT7xsK8nL39DY4Mstq4P+F8KfAJgkMi+8Qn0QYTwFSs9KRIy9o OFaQ== 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:mime-version:content-transfer-encoding; bh=ZpToRpzBghPIlSWFDMTCMs/livATbaezHsbunO8fvSA=; b=R21gC+IXmnVTZegk5zKAu5elJj6YwPCe/CnjwBsYrLsG/kE6seyUgwv79ajkIkuwWg WTFeFV7+RApmDYnfdFTukdR1CuRDVIjLSX2myevKpETieZO4e+gDsf+bhpWvMcseMtze LRo8QcGCOlaYoUR1PgeigpM4eDsNfqMMmbKdQjGKthWtY8NWSFYDh9PpdtPH13X3waQ/ /CN0JuFR7gL9ZMNXROpU9eXMaLbL3XHhETaVkvk3Exs/wkieF7ZHpHryCIud5xHZeGNF 9dwUZ7lmHux4gzG9/WgRxz4DA54JyN/IzS0owM+SQH0yg+h5f7CbLdq+sUH+3Yh6zLED RQHA== X-Gm-Message-State: AGRZ1gJQlL/tE6nOXQts6djspKMos4Q3M7hj6KVHJPHlHcXgvtDgmfJT RBh6XC+gsKlMRhC9k+TRaqWUn3+o X-Google-Smtp-Source: AJdET5fOuZpnAt7CO3ajTrrKSSV+IFgNJfDUQZg3NGopPUo/go919dQlttxbfjiufJQtn9Ky/ZI45g== X-Received: by 2002:a1c:bb42:: with SMTP id l63-v6mr3292207wmf.32.1542236276292; Wed, 14 Nov 2018 14:57:56 -0800 (PST) Received: from blackbox.darklights.net (p200300DCD717A100301AB549B11D5ACB.dip0.t-ipconnect.de. [2003:dc:d717:a100:301a:b549:b11d:5acb]) by smtp.googlemail.com with ESMTPSA id n7-v6sm18987784wrt.60.2018.11.14.14.57.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Nov 2018 14:57:55 -0800 (PST) From: Martin Blumenstingl To: linux-amlogic@lists.infradead.org, linux-clk@vger.kernel.org, jbrunet@baylibre.com, narmstrong@baylibre.com Subject: [RFC v1 5/7] clk: meson: meson8b: mark the CPU clock as CLK_IS_CRITICAL Date: Wed, 14 Nov 2018 23:57:23 +0100 Message-Id: <20181114225725.2821-6-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181114225725.2821-1-martin.blumenstingl@googlemail.com> References: <20181114225725.2821-1-martin.blumenstingl@googlemail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181114_145808_599093_14A47C8E X-CRM114-Status: GOOD ( 15.95 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: sboyd@kernel.org, Martin Blumenstingl , mturquette@baylibre.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP We don't want the common clock framework to disable the "cpu_clk" if it's not used by any device. The cpufreq-dt driver does not enable the CPU clocks. However, even if it would we would still want the CPU clock to be enabled at all times because the CPU clock is also required even if we disable CPU frequency scaling on a specific board. The reason why we want the CPU clock to be enabled is a clock further up in the tree: Since commit 6f888e7bc7bd58 ("clk: meson: clk-pll: add enable bit") the sys_pll can be disabled. However, since the CPU clock is derived from sys_pll we don't want sys_pll to get disabled. The common clock framework takes care of that for us by enabling all parent clocks of our CPU clock when we mark the CPU clock with CLK_IS_CRITICAL. Until now this is not a problem yet because all clocks in the CPU clock's tree (including sys_pll) are read-only. However, once we allow modifications to the clocks in that tree we will need this. Signed-off-by: Martin Blumenstingl Acked-by: Jerome Brunet --- drivers/clk/meson/meson8b.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/clk/meson/meson8b.c b/drivers/clk/meson/meson8b.c index 8a3c346e110d..d566dd5bc567 100644 --- a/drivers/clk/meson/meson8b.c +++ b/drivers/clk/meson/meson8b.c @@ -646,7 +646,8 @@ static struct clk_regmap meson8b_cpu_clk = { "cpu_scale_out_sel" }, .num_parents = 2, .flags = (CLK_SET_RATE_PARENT | - CLK_SET_RATE_NO_REPARENT), + CLK_SET_RATE_NO_REPARENT | + CLK_IS_CRITICAL), }, }; From patchwork Wed Nov 14 22:57:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Blumenstingl X-Patchwork-Id: 10683351 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 26E4D14BA for ; Wed, 14 Nov 2018 23:00:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 150532BFFC for ; Wed, 14 Nov 2018 23:00:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 062982BFFB; Wed, 14 Nov 2018 23:00:05 +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=-3.6 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 9DA132BFFB for ; Wed, 14 Nov 2018 23:00:05 +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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=7AbY8b4VT7hdu4kM0xhm96HQhxB5EL9PMBunOpx8LH0=; b=B9briqUIRaWvzW pdyd5fasLEmmLUYkoW0MSLT2y0YEAAdTY04KowYfTyJLzWw3hBb4rr4JqhBeXAJKgPhWRpa7BXcDz Y8C+s8+uCQHznXMiDZ9UZRmfjV7Wi6+yiNXuUyPIOKFDEGHTPbX6mw4WKxlmZxp/utZ+Mkvuz0i5U ENlpxZnQCPK7hrk9RdwvQt21Rtltkf8yB0JZzxkNr0lPLh75ZJ0cwYhVMLPB6Ib1gnLGJUCJACtNS 22gmnh1PSdBM4ZHJECCIz/m3qwIGGH/HPGkeCM0wb10WDH5RJTMascKoXelqGaZUftxkyD6et6UVM KooJLm9T35LTMgmfNCCQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gN48d-0001ej-Br; Wed, 14 Nov 2018 22:59:59 +0000 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gN46r-00088S-Ng; Wed, 14 Nov 2018 22:58:11 +0000 Received: by mail-wr1-x444.google.com with SMTP id p4so9934652wrt.7; Wed, 14 Nov 2018 14:57:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ZdbHJpWfnE4dGFR/ow//dClXtqW/EtX9HERAF4Q8i2I=; b=DQNvAzeGWkDxCVEsx+IXCEhNio/mPxQMG97/B+xXkSL7iRylj5EJqHMfE5L/l79LEI BYH+tJT/xmTKXKwTaqnvryiD1pjpVGn11HL8UA95kXKbEFaCr2bkIRvSV/IFnOFpexfy Ttm7BWgf8zqcc1Q4sGgDHARksHcPqUf98oY7iWDICv1GWKNU/iRJwfHcdUEk+DAQ3+oY V1XWGoBar70LN7gKrxrDW0s34qDuNImNBCcLJzEa/2+6h4cgMu26vdyFv09WrfDs5cRy Z2a2e7QxqOac41BXUaaF6ZTE0aVBIp8mBygWXneOUdDQDD60yKR90biJSg6SDQg/97Ws LTvA== 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:mime-version:content-transfer-encoding; bh=ZdbHJpWfnE4dGFR/ow//dClXtqW/EtX9HERAF4Q8i2I=; b=qgcvoctw70H5h1+l2cABsO0iMRyYeiTNryL5fI3IV9DEZaHOYN8AxazPrWp2Bqb9rE cEtSsa/qVj3aytAjcm5sDttm36g8dWbdga4HiYAP2BJN0ubWhdghCvTvK+7VyrWupOEZ i9GfVIiEj2mQ4CxpSMZmNa54r1l0S1q7Wb2NT9DvYAwnGm26hADIEDyH6rl+8cpsFSdf bdvWe5bBznizXWrC1HYi1Ixi1ZvXL0bfWOXH1SR2ydW+wYH/v/40qV8Z6u1DxOE0FG2K tlN4ZYGWtubH8Ggp17sApg03dF6VuFP8nRWr1ep9HN2Guh00BcrKce7bfyULho+ifZbk X/aQ== X-Gm-Message-State: AGRZ1gK1E7Fb2igDx2xFl8Mkksoa9ZIF6vaWgAXd+N9Zmf90Ki7xiZBr drL5m71CenUUwmHypQllLc3b3Ol5 X-Google-Smtp-Source: AJdET5db3Eo5Ii1AFuVT0vAIGJ2PQTwq1hpyQmM9c7jYQnz+74k5zml2zBkq5Sh0E2c6Y4bUaOS5Zw== X-Received: by 2002:a5d:6684:: with SMTP id l4mr3952933wru.154.1542236277466; Wed, 14 Nov 2018 14:57:57 -0800 (PST) Received: from blackbox.darklights.net (p200300DCD717A100301AB549B11D5ACB.dip0.t-ipconnect.de. [2003:dc:d717:a100:301a:b549:b11d:5acb]) by smtp.googlemail.com with ESMTPSA id n7-v6sm18987784wrt.60.2018.11.14.14.57.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Nov 2018 14:57:56 -0800 (PST) From: Martin Blumenstingl To: linux-amlogic@lists.infradead.org, linux-clk@vger.kernel.org, jbrunet@baylibre.com, narmstrong@baylibre.com Subject: [RFC v1 6/7] clk: meson: meson8b: add support for more M/N values in sys_pll Date: Wed, 14 Nov 2018 23:57:24 +0100 Message-Id: <20181114225725.2821-7-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181114225725.2821-1-martin.blumenstingl@googlemail.com> References: <20181114225725.2821-1-martin.blumenstingl@googlemail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181114_145809_783596_E295C14E X-CRM114-Status: GOOD ( 14.42 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: sboyd@kernel.org, Martin Blumenstingl , mturquette@baylibre.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The sys_pll on the EC-100 board is configured to 1584MHz at boot (either by u-boot, firmware or chip defaults). This is achieved by using M = 66, N = 1 (24MHz * 66 / 1). At boot the CPU clock is running off sys_pll divided by 2 which results in 792MHz. Thus M = 66 is considered to be a "safe" value for Meson8b. To achieve 1608MHz (one of the CPU OPPs on Meson8 and Meson8m2) we need M = 67, N = 1. I ran "stress --cpu 4" while infinitely cycling through all available frequencies on my Meson8m2 board and could not spot any issues with this setting (after ~12 hours of running this). On Meson8, Meson8b and Meson8m2 we also want to be able to use 408MHz and 816MHz CPU frequencies. These can be achieved by dividing sys_pll by 4 (for 408MHz) or 2 (for 816MHz). That means that sys_pll has to run at 1632MHz which can be generated using M = 68, N = 1. Similarily we also want to be able to use 1008MHz as CPU frequency. This means that sys_pll has to run either at 1008MHz or 2016MHz. The former would result in an M value of 42, which is lower than the smallest value used by the 3.10 GPL kernel sources from Amlogic (50 is the lower limit there). Thus we need to run sys_pll at 2016MHz which can ge generated using M = 84, N = 1. I tested M = 68 and M = 84 on my Meson8b Odroid-C1 and my Meson8m2 board by running "stress --cpu 4" while infinitely cycling thorugh all available frequencies. I could not spot any issues after ~12 hours of running this. Amlogic's 3.10 GPL kernel sources have more M/N combinations. I did not add them yet because M = 74 (to achieve close to 1800MHz on Meson8) and M = 82 (to achieve close to 1992MHz on Meson8 as well) caused my Meson8m2 board to hang randomly. It's not clear why this is (for example because the board's voltage regulator design is bad, some missing bits for these values in our clk-pll driver, etc.). Thus the following M values from the Amlogic 3.10 GPL kernel sources are skipped as of now: 69, 70, 71, 72, 73, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98 Signed-off-by: Martin Blumenstingl Acked-by: Jerome Brunet --- drivers/clk/meson/meson8b.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/clk/meson/meson8b.c b/drivers/clk/meson/meson8b.c index d566dd5bc567..c06a1a7faa4c 100644 --- a/drivers/clk/meson/meson8b.c +++ b/drivers/clk/meson/meson8b.c @@ -43,6 +43,11 @@ static const struct pll_params_table sys_pll_params_table[] = { PLL_PARAMS(62, 1), PLL_PARAMS(63, 1), PLL_PARAMS(64, 1), + PLL_PARAMS(65, 1), + PLL_PARAMS(66, 1), + PLL_PARAMS(67, 1), + PLL_PARAMS(68, 1), + PLL_PARAMS(84, 1), { /* sentinel */ }, }; From patchwork Wed Nov 14 22:57:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Blumenstingl X-Patchwork-Id: 10683339 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4C5E914D6 for ; Wed, 14 Nov 2018 22:58:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3D8EB2BD8A for ; Wed, 14 Nov 2018 22:58:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 316962BD98; Wed, 14 Nov 2018 22:58:55 +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=-3.6 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 CA3FC2BD8A for ; Wed, 14 Nov 2018 22:58:54 +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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=ePXqlS7MQ7oR8qgkmQaQCPXu4ojLCCdNrTSeCWuLPHg=; b=qPhyKN+7HL27qj BtYFoWWylqxJOm2c1ZK1oePfzzuaTlvdTNt/03qh53u9L1UmWY5KZf9DJ7iTxmaiJj7OJMz2qikb7 LgEPhIBtvjro33bisLhlJWXQbzIJrGhGppIcEzXPn4H53Lv/QnNdRef6Xs4Fwlp/u2tMgu2U0XC4h xCHaDQ7rXrRirHJB7WcwjuZOSycDB00jzTb3JS9naegZFVMhG4GW3MxHvppPzYXBXT7kPQjt4ibCO TMwnRmevByv2+aecYmda56YPeGL+L21gtLrRC3ypu0C/84xyVzPUDPpuhBcQ5WY+5CvpXVAceqqWD 9cwH2inq/cXN1+IMM4Nw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gN47W-0000dz-7C; Wed, 14 Nov 2018 22:58:50 +0000 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gN46m-00088W-NU; Wed, 14 Nov 2018 22:58:06 +0000 Received: by mail-wm1-x344.google.com with SMTP id u13-v6so16262505wmc.4; Wed, 14 Nov 2018 14:58:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CVZ5uvw2/86wt6Serx6lIpgnovwRR9rOzr4LZhzakUs=; b=q838D237yNSrJ16Jo5GXvOyCzWY0h6dPjzT8TAAOqnENilInt7Rgzx8PbCRwdBCFNZ 1WfIhM6RVjUQsMcym/TvPDUr+Lczqhbx+aiCgkxLCwkflW/0dhRtUqz+ahhkiaVEOpX2 FL9GBa56vajhsvQADxxeyNMgMbrOD4vqDz8LqmK1P4rVeceL/O4koJBqx/DK6ZMKAYYM 2PgFT3sS4tprwq11Fl0bVm/uaPKGypKQYMLhcWEPVN/arL1kGpeK3Vj9w8+CazOdMQe+ r0F0WiPVJBBlRtlxrPdjqorQ4CIDSQOiY2IQR0hXcI5li456SVHqf1/FlPJIvclY9r/K 3F+A== 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:mime-version:content-transfer-encoding; bh=CVZ5uvw2/86wt6Serx6lIpgnovwRR9rOzr4LZhzakUs=; b=SUuXaAxDy5M73+z1JqDmUkjjHJUYt1DNkqEluHVPHHqK2LVyXocuZDB9oK6MZOBvJz W91zIvhetPkxD6axQAKZrzAQPpMRNpVnZXvIfV9yMKGT19uHqaIo/l2iKu5DVOjbrg1S xkX7jZMyvL6JEt5Vw51FgbRgx0TMw/T7J2EgebIe8fhSaBqwwjbyAcOP14plJ3pFTK+u MLciK1y4h7ySFVAFX54pWWO5VMbnn3yOfzgQ+7i8GzfflMaKqdDnfLAQmjHf4mEaOwTK Y41AmTr4zqjAAG1rPR1632jx2JxiVw7Yn54nVTvMDPkL6Y9SQvgpW1muLwOj95bZaEb6 EKOw== X-Gm-Message-State: AGRZ1gLpUuNk9OI6bV+tAQvS6xHMhmtPuFC1HjcdWEk6hRxTjl4QkrrQ s0gJnYbbImu1tzVyr84W/n27rziO X-Google-Smtp-Source: AJdET5fO7/YSWljnTaW+mruQlXqAqxjkoELr3BtA3Q58whJchNx5/o6Vn+yRcvQ/iKviEPBiqVgqlQ== X-Received: by 2002:a1c:ac85:: with SMTP id v127mr3350283wme.62.1542236278624; Wed, 14 Nov 2018 14:57:58 -0800 (PST) Received: from blackbox.darklights.net (p200300DCD717A100301AB549B11D5ACB.dip0.t-ipconnect.de. [2003:dc:d717:a100:301a:b549:b11d:5acb]) by smtp.googlemail.com with ESMTPSA id n7-v6sm18987784wrt.60.2018.11.14.14.57.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Nov 2018 14:57:57 -0800 (PST) From: Martin Blumenstingl To: linux-amlogic@lists.infradead.org, linux-clk@vger.kernel.org, jbrunet@baylibre.com, narmstrong@baylibre.com Subject: [RFC v1 7/7] clk: meson: meson8b: allow changing the CPU clock tree Date: Wed, 14 Nov 2018 23:57:25 +0100 Message-Id: <20181114225725.2821-8-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181114225725.2821-1-martin.blumenstingl@googlemail.com> References: <20181114225725.2821-1-martin.blumenstingl@googlemail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181114_145804_772246_454017D1 X-CRM114-Status: GOOD ( 12.41 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: sboyd@kernel.org, Martin Blumenstingl , mturquette@baylibre.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Currently all clocks in the CPU clock tree are marked as read-only (using the corresponding _ro_ clk_ops). This was correct since changing the clock tree could cause the system to lock up. Switch all clocks to their corresponding clk_ops variant which is not read-only to allow changing the CPU clock tree since the bug which locked up the system is now fixed (by switching the CPU clock temporary to run off XTAL while changing the CPU clock tree). Signed-off-by: Martin Blumenstingl Reviewed-by: Jerome Brunet --- drivers/clk/meson/meson8b.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/clk/meson/meson8b.c b/drivers/clk/meson/meson8b.c index c06a1a7faa4c..b3bdc7e05441 100644 --- a/drivers/clk/meson/meson8b.c +++ b/drivers/clk/meson/meson8b.c @@ -203,7 +203,7 @@ static struct clk_regmap meson8b_sys_pll_dco = { }, .hw.init = &(struct clk_init_data){ .name = "sys_pll_dco", - .ops = &meson_clk_pll_ro_ops, + .ops = &meson_clk_pll_ops, .parent_names = (const char *[]){ "xtal" }, .num_parents = 1, }, @@ -218,7 +218,7 @@ static struct clk_regmap meson8b_sys_pll = { }, .hw.init = &(struct clk_init_data){ .name = "sys_pll", - .ops = &clk_regmap_divider_ro_ops, + .ops = &clk_regmap_divider_ops, .parent_names = (const char *[]){ "sys_pll_dco" }, .num_parents = 1, .flags = CLK_SET_RATE_PARENT, @@ -552,7 +552,7 @@ static struct clk_regmap meson8b_cpu_in_sel = { }, .hw.init = &(struct clk_init_data){ .name = "cpu_in_sel", - .ops = &clk_regmap_mux_ro_ops, + .ops = &clk_regmap_mux_ops, .parent_names = (const char *[]){ "xtal", "sys_pll" }, .num_parents = 2, .flags = (CLK_SET_RATE_PARENT | @@ -606,7 +606,7 @@ static struct clk_regmap meson8b_cpu_scale_div = { }, .hw.init = &(struct clk_init_data){ .name = "cpu_scale_div", - .ops = &clk_regmap_divider_ro_ops, + .ops = &clk_regmap_divider_ops, .parent_names = (const char *[]){ "cpu_in_sel" }, .num_parents = 1, .flags = CLK_SET_RATE_PARENT, @@ -623,7 +623,7 @@ static struct clk_regmap meson8b_cpu_scale_out_sel = { }, .hw.init = &(struct clk_init_data){ .name = "cpu_scale_out_sel", - .ops = &clk_regmap_mux_ro_ops, + .ops = &clk_regmap_mux_ops, /* * NOTE: We are skipping the parent with value 0x2 (which is * "cpu_div3") because it results in a duty cycle of 33% which @@ -646,7 +646,7 @@ static struct clk_regmap meson8b_cpu_clk = { }, .hw.init = &(struct clk_init_data){ .name = "cpu_clk", - .ops = &clk_regmap_mux_ro_ops, + .ops = &clk_regmap_mux_ops, .parent_names = (const char *[]){ "xtal", "cpu_scale_out_sel" }, .num_parents = 2,