From patchwork Thu Nov 15 22:40:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Blumenstingl X-Patchwork-Id: 10685193 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 C00F5109C for ; Thu, 15 Nov 2018 22:42:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B0EE72D52B for ; Thu, 15 Nov 2018 22:42:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A51BA2D522; Thu, 15 Nov 2018 22:42:02 +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 A0BFA2D523 for ; Thu, 15 Nov 2018 22:42:01 +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=rm4Ji2A5nJvBPekbO6JioTiSVb/HsKdZ5WZIU+inCJo=; b=SQ1fFBsepPq35N 5ydzjgXfHj3xkNnEJHOXYfxygi1o1JOIIjNpx5KB08o8qMcuJtosauBCNtfHkOzNYJ41CSBTd+1gc wZEsn143qQEmXa+XkoEy6uAjVuzxGv/RQdXxe73y0R2vOGoUvZVLCblXtm6pm54PO+yAl2bz7nsAC bwdMgmJ7GAuj5FU0rqs2KxUacaa8k5bGJN/gYDOUq+2IHrrQw0GU8UO6mBokuCrHwyJhna3RYJhhc TGjfhOOqqhK+2qgSbSNV9yu4buhKZ0VUPpzo9bG1u749A8bvHeiLtmhxcdevZmkYQa3pgLFc6MeAc xuy/tSY08w7kZJ2dw+EQ==; 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 1gNQKk-0001yU-Nt; Thu, 15 Nov 2018 22:41:58 +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 1gNQKH-0001OW-V8; Thu, 15 Nov 2018 22:41:31 +0000 Received: by mail-wm1-x342.google.com with SMTP id f1-v6so16775052wmg.1; Thu, 15 Nov 2018 14:41:19 -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=gZMD7wnXU4TaaGBEtiWhXDsupb7upfZU9u5SbgkwnA4=; b=aBQYBOtWevbWZAiKzp7qTMGntXPf6W7RXgqBtjykH4a9p+HWZX7vGJKoS062Ekb4c/ uLw/bSYvtElXoW2wj4Pa5KeLSfLqodb+Q6K/v8vBpa+tPZ3Nk44HzzwvmkV5HYNIJi+g bnvxDw3Z9TtLa0vVLgfXgSfaT/Al0QUdKUCjrT91tb42OBRzIh4TwMN3HpQb65Lcnq63 f+QCb50a3leYYun5+E/T1QwrKq5PJwEVxSVgPHAsKKsPx2v/vaeT3MuXvHdnCVGn2XER tUgOtzOPvH/kNvJN4S3C8DxLxtiqzb8a9s1sOSFxHNiv4WG7vVtFEn7WArz4N/Kfr/3m 6VeQ== 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=gZMD7wnXU4TaaGBEtiWhXDsupb7upfZU9u5SbgkwnA4=; b=ab6sFNn4PG5sGXWVY3ZrFJf72k4mqSCaoVbbfCM1YhsF8RLug9NUOnKHuZbsX4l5M9 l9GneTNXI0uNaqchaET7r4aXyzhjdUsOKiyLKOjVl8QB92RmVyROky1TCfBWrO5K8yEN tabTSMGkT7bQr8lCY9yIVnR5RgPmF/u1TW2zV+mn6vx5Px0j0SYS61gzTG9Hyr2hIMKi 9bBgbUvTMruUjQDOWcIHf0ntAYSh1QU3QJdeE7ZwKSKlkgleNFeJl3Bg3BSV3izNrsQf 99iVCb3i1299TCEetDX9x4JPEt66Lc8ZEsdXnFJICub9kVU2Z0eRgmJ6PSsmtUDwzRHX zyag== X-Gm-Message-State: AGRZ1gIV2ghJLCvw8TuNUmrryytcWoHHPd4YXocpU6VpWPVO5WQDfdMm zw2ZBQTgw576qv8yyL/FBxITOAbm X-Google-Smtp-Source: AJdET5dfq30sWDt296B3ZlWpVFJoJ12JjCSsBcxXitirCps+4fSPrq60NaSycUtzeswQu0ft05kGkw== X-Received: by 2002:a1c:1c5:: with SMTP id 188mr528207wmb.133.1542321677860; Thu, 15 Nov 2018 14:41:17 -0800 (PST) Received: from blackbox.darklights.net (p200300DCD717A100B85ACE585A885C51.dip0.t-ipconnect.de. [2003:dc:d717:a100:b85a:ce58:5a88:5c51]) by smtp.googlemail.com with ESMTPSA id x12sm2076388wmc.37.2018.11.15.14.41.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Nov 2018 14:41:17 -0800 (PST) From: Martin Blumenstingl To: linux-amlogic@lists.infradead.org, linux-clk@vger.kernel.org, jbrunet@baylibre.com, narmstrong@baylibre.com Subject: [PATCH v2 2/6] clk: meson: meson8b: do not use cpu_div3 for cpu_scale_out_sel Date: Thu, 15 Nov 2018 23:40:44 +0100 Message-Id: <20181115224048.13511-3-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181115224048.13511-1-martin.blumenstingl@googlemail.com> References: <20181115224048.13511-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-20181115_144129_997709_EE0937C9 X-CRM114-Status: GOOD ( 13.87 ) 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 9bd5920da0ff..a96bfee58a61 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, }, };