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, }, };