From patchwork Thu Mar 28 12:34:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 13608472 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 2B794C54E64 for ; Thu, 28 Mar 2024 12:35:00 +0000 (UTC) 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:References:In-Reply-To: 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: List-Owner; bh=JpplCbGZe9hY5eHAIWjt70eZGd1w0weuSWDybKTNzx4=; b=hFUB9bRdJXzQe8 1RMhKyHM1aQ7DiCtrm//CORpxbyX6JHMrhEcYa8aaOOMsUeFJeQE7r/XtgGkOIiWYzGAxzWl1X41o Dbq/ChBqGlA2JvrxyR9liDBwTO4m4ynYumAjkRRjqjxUnYx5Hz9cUL45MUfl8ttUtsqDn9YJPOLfz NzlWi1E8Xzb/SWqpyRRUgNNT+Y40RSwy9meXFIxtuvOrJnwp273hlqk6PLaNoI4kbnbg442WGk0Wx Rm+pRRtqw1F+oeoEinX3B30CUAwaMWR41oXPCAZrfCN+uiPOw7kA+Z2PpILwdKxc3RZUgakGMFjhe mAqjdkf5xBmpIGYSoq0Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rpoy2-0000000DvcI-0Hhb; Thu, 28 Mar 2024 12:34:50 +0000 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rpoxz-0000000DvaD-1Q3A for linux-arm-kernel@lists.infradead.org; Thu, 28 Mar 2024 12:34:48 +0000 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-41545e9f482so2927115e9.2 for ; Thu, 28 Mar 2024 05:34:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711629285; x=1712234085; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=RjhTo09dO/7V38CJBlOuZewKYi9PkSHGMjLUhNN+TaQ=; b=iyKIV4U5GRFL2FfU2mWSoWvwTFYXIgkI14Xhfq9FITYrKZSZx/1iHQU/5pFWyuMcRB nhfmA/jD1bAe9/LAVZCRh/EK0hAMZxBYT5OwvpPWYqX7sRkjWkg62i+KeAH9EZo2CplL DsyCNYJBe1fqpKe8DmR763VsFlk88TwhW8KkhO0f3+GlP21Ji+ZMMpfvc3z0kzUkVE6v Mh6XlkCdVblOxOELJzYJGL5X2QAXNWy1V2IY5PXjK6W/vTwBFnQSNVD/Dbzuqed72o8p HkhTYICT6ucpbQKlqluV5KqdvUN7/ME7iGMaFubgt/+ACxhx9F9Rwe8QJ6C3cnlMQpqB Wipg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711629285; x=1712234085; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RjhTo09dO/7V38CJBlOuZewKYi9PkSHGMjLUhNN+TaQ=; b=C7Fx56TjMEAAHhnrrxiaa1xCyQcC2DOdSlafhbKRaPrEEXkJ7oz2lyqJBJ+3uq8Poe zw8J6MwrwTKzhdP9ngUXmH2R7lhouMTzZobHqzWGQ1qny4HkrCI7JnGIu5pXpQjRZS4/ 0OjFyQy+bxyMFlMLp7Qwv4Z5xboO0hyLjV76M/g7sqe+v22TipnvEzTNMPEYkPqZNLLB fiRzutHCJqzUxnzhXihL9TZ7G0+jrgHVw93VwxX9U8v2X5CxTu/Kgoun6CWrz5f5fZFF XIhs0sWKBrDlfoeW8bqLenK89MLp7O45Z3wNKtnq9IPgcTQ0a5CxttE5jD3Mo/uRg9HC PI9g== X-Forwarded-Encrypted: i=1; AJvYcCX25ZoKrbBXnRuLthHngawH+se7C+OhSsnJwDvMxVY7PeSRpnQhCFoJXDk2UA0wx2seUopt3iFv30OTTdEGinDvpd5tpzf3P5TEc1GctoCcrhNqiZg= X-Gm-Message-State: AOJu0YxkkVIKGsEfxTP2DdsiXTLaCgdTG5Q6geYjtYHvOHYBMeCyvx/Q n4uJrw2oHL6R4QrA1eiA/zuEYjrvN/2njGUd73KDvQFAAfmvKCABfc8bs9Xwl2Y= X-Google-Smtp-Source: AGHT+IEeEXB2tNCVWGb87xNYSbBQDlb72910RZrNwEk6zjsX5DNZR0GunhOGsmBaPuzi8NH9mWDR+g== X-Received: by 2002:a5d:4ccc:0:b0:342:2ea8:18fa with SMTP id c12-20020a5d4ccc000000b003422ea818famr2188036wrt.15.1711629285483; Thu, 28 Mar 2024 05:34:45 -0700 (PDT) Received: from ta2.c.googlers.com.com (158.100.79.34.bc.googleusercontent.com. [34.79.100.158]) by smtp.gmail.com with ESMTPSA id u6-20020adfa186000000b00341e2146b53sm1639671wru.106.2024.03.28.05.34.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 05:34:45 -0700 (PDT) From: Tudor Ambarus To: peter.griffin@linaro.org, krzysztof.kozlowski@linaro.org Cc: alim.akhtar@samsung.com, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, andre.draszik@linaro.org, willmcvicker@google.com, kernel-team@android.com, s.nawrocki@samsung.com, cw00.choi@samsung.com, mturquette@baylibre.com, sboyd@kernel.org, semen.protsenko@linaro.org, linux-clk@vger.kernel.org, jaewon02.kim@samsung.com, Tudor Ambarus Subject: [PATCH v3 1/3] clk: samsung: introduce nMUX for MUX clks that can reparented Date: Thu, 28 Mar 2024 12:34:38 +0000 Message-ID: <20240328123440.1387823-2-tudor.ambarus@linaro.org> X-Mailer: git-send-email 2.44.0.396.g6e790dbe36-goog In-Reply-To: <20240328123440.1387823-1-tudor.ambarus@linaro.org> References: <20240328123440.1387823-1-tudor.ambarus@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240328_053447_467241_66AC8E67 X-CRM114-Status: GOOD ( 13.24 ) 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 All samsung MUX clocks that are defined with MUX() set the CLK_SET_RATE_NO_REPARENT flag in __MUX(), which prevents MUXes to be reparented during clk_set_rate(). Introduce nMUX() for MUX clocks that can be reparented on clock rate change. "nMUX" comes from "n-to-1 selector", hopefully emphasising that the selector can change on clock rate changes. Ideally MUX/MUX_F() should change to not have the CLK_SET_RATE_NO_REPARENT flag set by default, and all their users to be updated to add the flag back (like in the case of DIV and GATE). But this is a very intrusive change and because for now only GS101 allows MUX reparenting on clock rate change, stick with nMUX(). One user of nMUX() will be GS101. GS101 defines MUX clocks that are dedicated for each instance of an IP (see MUX USI). The reparenting of these MUX clocks will not affect other instances of the same IP or different IPs altogether. Signed-off-by: Tudor Ambarus Reviewed-by: André Draszik --- drivers/clk/samsung/clk.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/clk/samsung/clk.h b/drivers/clk/samsung/clk.h index a70bd7cce39f..fb06caa71f0a 100644 --- a/drivers/clk/samsung/clk.h +++ b/drivers/clk/samsung/clk.h @@ -133,7 +133,7 @@ struct samsung_mux_clock { .name = cname, \ .parent_names = pnames, \ .num_parents = ARRAY_SIZE(pnames), \ - .flags = (f) | CLK_SET_RATE_NO_REPARENT, \ + .flags = f, \ .offset = o, \ .shift = s, \ .width = w, \ @@ -141,9 +141,16 @@ struct samsung_mux_clock { } #define MUX(_id, cname, pnames, o, s, w) \ - __MUX(_id, cname, pnames, o, s, w, 0, 0) + __MUX(_id, cname, pnames, o, s, w, CLK_SET_RATE_NO_REPARENT, 0) #define MUX_F(_id, cname, pnames, o, s, w, f, mf) \ + __MUX(_id, cname, pnames, o, s, w, (f) | CLK_SET_RATE_NO_REPARENT, mf) + +/* Used by MUX clocks where reparenting on clock rate change is allowed. */ +#define nMUX(_id, cname, pnames, o, s, w) \ + __MUX(_id, cname, pnames, o, s, w, 0, 0) + +#define nMUX_F(_id, cname, pnames, o, s, w, f, mf) \ __MUX(_id, cname, pnames, o, s, w, f, mf) /**