Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp599649ybz; Wed, 15 Apr 2020 14:53:54 -0700 (PDT) X-Google-Smtp-Source: APiQypIN9Za81ykz7fSUBxoeI627bXzrPbcnlx1Mp6fBblKKI6LXcCuO967mSmygXrKnNr/SkKgR X-Received: by 2002:a05:6402:793:: with SMTP id d19mr26922272edy.106.1586987634721; Wed, 15 Apr 2020 14:53:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586987634; cv=none; d=google.com; s=arc-20160816; b=FQ0dM4pf4NVDyFrKFJr2m482uR99vHHgSmOi4hca29TFSIDUYwkwjA4TDqSzCdktzf IqrZX1sd+1cCGsB5xqJ0nyHiDjoAjTkkIXr9J8qnQnPv3hc2OpVomRP0z0nSSCJQ/RPR EbcAfOppwrTzuCzdJ2BP1o/QX+oNa2eWHDVzLR2hR2FU6K8D+YlLBSD5iyVFpqb9wV8W Bjs7HWc1B36AGWuI+qoVBxAfaRKL9eR45kQwROSMfQ571jbtz6x/paigxGVC8wUiFGMV aeaRUjAQiBonn65SVg9XWbMNuC98Y3x9SCeOozpFo5XgenEOqrFyRJdaUCwJ6QXuomzd eCRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=O7uRjqW9mqKqP7kTxyxdVa0MqMGMARXTNvz9n/EfWIY=; b=Z6TkH/ICHgVIytLymLPpaZjXwcTMZj5Mbhff3gJAm+Odi6o1v5iVPTzBfUve6mMlGg 6+KbQN9MJ/R7Rogt36URiVgA/s2wJaf9HNQA1m1NHM7KHf1SXz0aUKNzweAnGmPVgXKp OExia46tPyNs25uLSiDNu4wghPAF3MlCSk0cab0o0mp5LVX27g2V0gt8Cfwu8b0Z9jZC Syb18CHCIGqzS68lJiOF3qnXIStvVaiUTTRFCUuP75jZ4W+W9v9i2FioMT/Ev3m7F0Sj DArLUjI4uj9NHUQDZzExgScv3zmAa3LlhdRVjFOK5+4zNI1/CwfQUKvsMWMwh1fPDiT2 clCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@googlemail.com header.s=20161025 header.b=HbSrDAL5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id pv20si6955950ejb.295.2020.04.15.14.53.31; Wed, 15 Apr 2020 14:53:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@googlemail.com header.s=20161025 header.b=HbSrDAL5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2505404AbgDNUBJ (ORCPT + 99 others); Tue, 14 Apr 2020 16:01:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S2505370AbgDNUAb (ORCPT ); Tue, 14 Apr 2020 16:00:31 -0400 Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97CE1C03C1A7; Tue, 14 Apr 2020 13:00:30 -0700 (PDT) Received: by mail-wr1-x444.google.com with SMTP id j2so15986452wrs.9; Tue, 14 Apr 2020 13:00:30 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=O7uRjqW9mqKqP7kTxyxdVa0MqMGMARXTNvz9n/EfWIY=; b=HbSrDAL5XM1P7S99m4/XaKfGc3/lGtAegZqMkRgsyl9867VJDokMJPTYMv1/DfW4iz treHg/XOdow6XNoun7nkvR9TA0ocXx9CV7Ai2ovMfm+uL1k0wbLa9OzvDq5ezB+YNzZB fUNJQQ/+5cIruDCygAvZuktGKMyX6UXnqhp7KAYUIq/fNKZVf2aMMEtODX7dY8XaLb17 Jj+1mX6jUGi0AbWVlPEse2PB721c5DMgTsYoJFa/FRsuzRKYGK1sAHFRlrybosdLMzcB hTYLJr6jkgDubA6u4koNGXin3BLRzYTuEryzH59KpqlldPPRQCCQMrSJR80yODMQ1RG0 dBSg== 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=O7uRjqW9mqKqP7kTxyxdVa0MqMGMARXTNvz9n/EfWIY=; b=iO8DUQBstKOlcTf5QpljAb0XD3Nmbexw3qe5monRPRZ/QSYsLgTTVEU26iUQ2nUQlD 0XrC40eiw7CdL4YK2t6NCXgr0EyqquA7sNj3xB5D1Suhw2XutgqmQoHDjLrJIq8uOzYY bz9dnkVtC8vDCA1z70jTaQpizCA55Gd0UXxMDzl62LO8l730ItJDE0akiQrM3M9rIhiK nWHa7ATduLhXukhB/gyR7Qd+91Do5KTGI9g1f+4fUf1rN/M2munoeeNkAIeGm+pOigps WvaI5eoiLlD4LEwal/e4qy83KfvKnBQC7sR2iYEe/9nmBFPsqeO9DVHuzv8Kc5Lf8WQ9 +mJw== X-Gm-Message-State: AGi0PuaXeLSEMU3PfmuA4ey+pN3EHpJHCowKtLxW8kyqDXbjx5iMUXZ0 8jcdTPrCkzmFUXLLqMIEJLA= X-Received: by 2002:adf:f2c5:: with SMTP id d5mr25815033wrp.409.1586894429244; Tue, 14 Apr 2020 13:00:29 -0700 (PDT) Received: from localhost.localdomain (p200300F13717DF00428D5CFFFEB99DB8.dip0.t-ipconnect.de. [2003:f1:3717:df00:428d:5cff:feb9:9db8]) by smtp.googlemail.com with ESMTPSA id b4sm15540253wrv.42.2020.04.14.13.00.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Apr 2020 13:00:28 -0700 (PDT) From: Martin Blumenstingl To: jbrunet@baylibre.com, linux-amlogic@lists.infradead.org, linux-clk@vger.kernel.org Cc: narmstrong@baylibre.com, mturquette@baylibre.com, sboyd@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Martin Blumenstingl Subject: [PATCH 2/4] clk: meson: meson8b: Fix the polarity of the RESET_N lines Date: Tue, 14 Apr 2020 22:00:15 +0200 Message-Id: <20200414200017.226136-3-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200414200017.226136-1-martin.blumenstingl@googlemail.com> References: <20200414200017.226136-1-martin.blumenstingl@googlemail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org CLKC_RESET_VID_DIVIDER_CNTL_RESET_N_POST and CLKC_RESET_VID_DIVIDER_CNTL_RESET_N_PRE are active low. This means: - asserting them requires setting the register value to 0 - de-asserting them requires setting the register value to 1 Set the register value accordingly for these two reset lines by setting the inverted the register value compared to all other reset lines. Fixes: 189621726bc2f6 ("clk: meson: meson8b: register the built-in reset controller") Signed-off-by: Martin Blumenstingl --- drivers/clk/meson/meson8b.c | 81 ++++++++++++++++++++++++++----------- 1 file changed, 58 insertions(+), 23 deletions(-) diff --git a/drivers/clk/meson/meson8b.c b/drivers/clk/meson/meson8b.c index 90d284ffc780..fa251e45e208 100644 --- a/drivers/clk/meson/meson8b.c +++ b/drivers/clk/meson/meson8b.c @@ -3506,54 +3506,87 @@ static struct clk_regmap *const meson8b_clk_regmaps[] = { static const struct meson8b_clk_reset_line { u32 reg; u8 bit_idx; + bool active_low; } meson8b_clk_reset_bits[] = { [CLKC_RESET_L2_CACHE_SOFT_RESET] = { - .reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 30 + .reg = HHI_SYS_CPU_CLK_CNTL0, + .bit_idx = 30, + .active_low = false, }, [CLKC_RESET_AXI_64_TO_128_BRIDGE_A5_SOFT_RESET] = { - .reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 29 + .reg = HHI_SYS_CPU_CLK_CNTL0, + .bit_idx = 29, + .active_low = false, }, [CLKC_RESET_SCU_SOFT_RESET] = { - .reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 28 + .reg = HHI_SYS_CPU_CLK_CNTL0, + .bit_idx = 28, + .active_low = false, }, [CLKC_RESET_CPU3_SOFT_RESET] = { - .reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 27 + .reg = HHI_SYS_CPU_CLK_CNTL0, + .bit_idx = 27, + .active_low = false, }, [CLKC_RESET_CPU2_SOFT_RESET] = { - .reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 26 + .reg = HHI_SYS_CPU_CLK_CNTL0, + .bit_idx = 26, + .active_low = false, }, [CLKC_RESET_CPU1_SOFT_RESET] = { - .reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 25 + .reg = HHI_SYS_CPU_CLK_CNTL0, + .bit_idx = 25, + .active_low = false, }, [CLKC_RESET_CPU0_SOFT_RESET] = { - .reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 24 + .reg = HHI_SYS_CPU_CLK_CNTL0, + .bit_idx = 24, + .active_low = false, }, [CLKC_RESET_A5_GLOBAL_RESET] = { - .reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 18 + .reg = HHI_SYS_CPU_CLK_CNTL0, + .bit_idx = 18, + .active_low = false, }, [CLKC_RESET_A5_AXI_SOFT_RESET] = { - .reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 17 + .reg = HHI_SYS_CPU_CLK_CNTL0, + .bit_idx = 17, + .active_low = false, }, [CLKC_RESET_A5_ABP_SOFT_RESET] = { - .reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 16 + .reg = HHI_SYS_CPU_CLK_CNTL0, + .bit_idx = 16, + .active_low = false, }, [CLKC_RESET_AXI_64_TO_128_BRIDGE_MMC_SOFT_RESET] = { - .reg = HHI_SYS_CPU_CLK_CNTL1, .bit_idx = 30 + .reg = HHI_SYS_CPU_CLK_CNTL1, + .bit_idx = 30, + .active_low = false, }, [CLKC_RESET_VID_CLK_CNTL_SOFT_RESET] = { - .reg = HHI_VID_CLK_CNTL, .bit_idx = 15 + .reg = HHI_VID_CLK_CNTL, + .bit_idx = 15, + .active_low = false, }, [CLKC_RESET_VID_DIVIDER_CNTL_SOFT_RESET_POST] = { - .reg = HHI_VID_DIVIDER_CNTL, .bit_idx = 7 + .reg = HHI_VID_DIVIDER_CNTL, + .bit_idx = 7, + .active_low = false, }, [CLKC_RESET_VID_DIVIDER_CNTL_SOFT_RESET_PRE] = { - .reg = HHI_VID_DIVIDER_CNTL, .bit_idx = 3 + .reg = HHI_VID_DIVIDER_CNTL, + .bit_idx = 3, + .active_low = false, }, [CLKC_RESET_VID_DIVIDER_CNTL_RESET_N_POST] = { - .reg = HHI_VID_DIVIDER_CNTL, .bit_idx = 1 + .reg = HHI_VID_DIVIDER_CNTL, + .bit_idx = 1, + .active_low = true, }, [CLKC_RESET_VID_DIVIDER_CNTL_RESET_N_PRE] = { - .reg = HHI_VID_DIVIDER_CNTL, .bit_idx = 0 + .reg = HHI_VID_DIVIDER_CNTL, + .bit_idx = 0, + .active_low = true, }, }; @@ -3562,22 +3595,24 @@ static int meson8b_clk_reset_update(struct reset_controller_dev *rcdev, { struct meson8b_clk_reset *meson8b_clk_reset = container_of(rcdev, struct meson8b_clk_reset, reset); - unsigned long flags; const struct meson8b_clk_reset_line *reset; + unsigned long flags; + unsigned int value; if (id >= ARRAY_SIZE(meson8b_clk_reset_bits)) return -EINVAL; reset = &meson8b_clk_reset_bits[id]; + if (assert == reset->active_low) + value = 0; + else + value = BIT(reset->bit_idx); + spin_lock_irqsave(&meson_clk_lock, flags); - if (assert) - regmap_update_bits(meson8b_clk_reset->regmap, reset->reg, - BIT(reset->bit_idx), BIT(reset->bit_idx)); - else - regmap_update_bits(meson8b_clk_reset->regmap, reset->reg, - BIT(reset->bit_idx), 0); + regmap_update_bits(meson8b_clk_reset->regmap, reset->reg, + BIT(reset->bit_idx), value); spin_unlock_irqrestore(&meson_clk_lock, flags); -- 2.26.0