Received: by 2002:a05:7412:798b:b0:fc:a2b0:25d7 with SMTP id fb11csp96777rdb; Wed, 21 Feb 2024 19:04:41 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWmu1Gh8f8i9UZCw374oJTJ+Oyv5ZPzU7AkBHE4vflaDBsk1ya3cxMfpJ3Cpc7hP0mAqdOugeqsW1GeCQmPl8lexxRVQLAoZs6ch2qebA== X-Google-Smtp-Source: AGHT+IH73jEWg9TBm79/3VwAi9QQjs/nF3CJLPs9dxL5uV5fVYxZhnm59/jYFhW2dzpFndPb5koK X-Received: by 2002:a17:902:e84e:b0:1db:de64:ffd0 with SMTP id t14-20020a170902e84e00b001dbde64ffd0mr16526742plg.23.1708571081270; Wed, 21 Feb 2024 19:04:41 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708571081; cv=pass; d=google.com; s=arc-20160816; b=Do+BcvhNnyp+m8z5rk7ySyo13d8mHzyK9jnydpUZkwObcw3g19IS+crDfO+BSD6/Fe nbILfpGe39xoid2/Uy4u/KRXc4FLY4SSvivozwkoAEs/6phKA0GZgZIRjFRgC2gIq/f/ QRvtyaAFf25Rlwt3YGzQ0vR+jY5ojDOM029+DeYGQyBMjC8076MRk7DH+61io/P2yX2y AVTLCmVK1d6uHbgiB26aS7kfseMf14p5mDne8Rk8FPTB1GitNI0eHDAJ3br92O+jEWP5 S47K3ybPCVCnPrL4CcwldUld7Iyhl5nGVB7uXPsDwIHy2mbsWOpvUg7Z9/eYp78NyXFH ARdg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Gr/yHix3JzjuluFq1TtfZCC5Pd9Qq4G1cyD4GVYOtnc=; fh=JARg+xmS/6YAqTkGz+5IYHz3YyxYmG74gNsf3AtY9Fs=; b=tkX5QIocs4ZdoGBkfUHhCYVALgQPW1NSsYEOYBCqL3LJxJRmYFQdKsjMR4Hwf6GEpL fbNv6TAUKBnrOPnmGx5kzlsZaAH3BehwqQuWtGr9RkDoQnQnwRZFe+SreEYpxskE+4lR Dh1h29q/rICdQ/HIwpPfU3IIaySUswzHcSUpfECbLXJuVLCqlmy8NYC1ShnhXT9HyrME fLkAtrTaAVmrwNg31KoOiSfux4R/ocGOGOxHsfAuSsffT1I2o/D5vk52XzfdTTozd4CS UaGUzF3RpEKrAFwljxvyAPSA5Yqyo8abYOQmeM4pTKGGavmLopsYooE342SNhMYoaLDs puEA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=g8GV2oq0; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-75826-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75826-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id p18-20020a170902e75200b001d9167b8e73si1849961plf.444.2024.02.21.19.04.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 19:04:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-75826-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=g8GV2oq0; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-75826-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75826-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id EDE4228480B for ; Thu, 22 Feb 2024 03:04:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B8407249FC; Thu, 22 Feb 2024 03:02:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="g8GV2oq0" Received: from mail-oa1-f45.google.com (mail-oa1-f45.google.com [209.85.160.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6EAB120DF8 for ; Thu, 22 Feb 2024 03:02:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708570969; cv=none; b=RfRwJL55Acg4/lCPJP6mx/RAKCTtS08yamcZTAR4XYkUaDWdOE3ZhM5LvnP68XYDxRY7sJLfgWPHfhgv5SY1eqqbQ7OhIKfJbA+0hbNJ66BzySGulF9V+6iKteUEcK2Xx81+P6/YIN+86+vr5q98+8W++zOgvRfSeED2Kypxpj4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708570969; c=relaxed/simple; bh=mF6ovrjw7+9sFKQNzXZPHWylrbwz4f8h18NF4imFlcE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=HoSGeij0jo7LqzBN7V/WSs4P3vHnq5xLTWL+i7qAxiwqY7zis5kS4M2HFaQKfT51Szvwo2Ps3Z+SbgBRMsfjLXqKn5ZPEWmOFTo0w0JWWAUPlPoUGKqZZnSnHlbOW5ZbXx9qd4qi6dKcyP+tQcEx2he6IPSUO0VkGEzKyXdsjRY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=g8GV2oq0; arc=none smtp.client-ip=209.85.160.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-oa1-f45.google.com with SMTP id 586e51a60fabf-21e45ed41d7so3187986fac.0 for ; Wed, 21 Feb 2024 19:02:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708570965; x=1709175765; darn=vger.kernel.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=Gr/yHix3JzjuluFq1TtfZCC5Pd9Qq4G1cyD4GVYOtnc=; b=g8GV2oq0OafQLL8s5jXqterG++eOEomrUj6w5eQ8McKLidRxLCFOGC7yh9yRQd7lm1 fXNJcjsSjE+G656uPTBK4xLNOv52Ul3ruflQsIu/YJhTUljhfrDD3OBaU0mH3X8lTuHX 4Mj6iMIqIf46QFXIUxpGrfNkcECTqrVlKVntamEiZoulzTCfvEXrfxTFbMSkC24L5o5A yM8UDLgNgoclmrD7ZVMC4l1F8ayKWlcSS2WFzOpaI90WBUgLwGXFUKE4SyscvPGamJZm 6lxZNBOWjO264uSGoCk1AQheCfLdGs3PlWYFm2T95qEucENqL8GJnlrh3JmcojwRSnYE PnYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708570965; x=1709175765; 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=Gr/yHix3JzjuluFq1TtfZCC5Pd9Qq4G1cyD4GVYOtnc=; b=eSFEboIHjO4YF5bsbQPspkjTlA4ahX4pa5dWGHL4htmd00/YbmAbqxU7HC3dmncUDD JtEKZ7J2IQybxwj9lvXwnHoZ3OKo2o3S3nZ+dX2492dXkcnipnlWtIzIu4BAGzvdNvDA npbgXHPwhh5dacSUCsnjLji9XPXFCzzJv/JH/OLKS7QjHCWM9M8jObupYpgZzQuo2cR1 UkgLK+K5QBjSF8kfwc/Gm94sRQOuMZ7VIiTyxEns9szWD5KMG3z7KVpS7d6RneXKMVE9 981np8Y9iqWPVZ0ADQ0PrfRh0vjKxZ1tgB9X3UvJgUaMahx31pd+jUNEVMoc1wFIDa6L 6gnQ== X-Forwarded-Encrypted: i=1; AJvYcCWJ6f82G+xqqLvDDeU/nt75HRWNg7HHBpCXMu5AK91W1588Y/hIj0mEv3cQkc9/c/pvVweoXr5IzLXjW92BQPOsGl7TSd3OLWstRkDY X-Gm-Message-State: AOJu0YzdWVIDGONKqs8IMOZuAHUP82OzaQSQDzlA+f77yKKC7vuQOvoh 0+kAhKH74AhrY4SFTz1b6naIdr+HCZVayXSjBg296Ba+sh9MhArIUr4EeiNGw1E= X-Received: by 2002:a05:6871:1ca:b0:21e:635c:a5b8 with SMTP id q10-20020a05687101ca00b0021e635ca5b8mr17215407oad.26.1708570965242; Wed, 21 Feb 2024 19:02:45 -0800 (PST) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id sk14-20020a056871800e00b0021ec89a1a2asm1937031oab.32.2024.02.21.19.02.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 19:02:44 -0800 (PST) From: Sam Protsenko To: Krzysztof Kozlowski , Sylwester Nawrocki , Chanwoo Choi Cc: Alim Akhtar , Michael Turquette , Stephen Boyd , Rob Herring , Conor Dooley , Tomasz Figa , linux-samsung-soc@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 11/15] clk: samsung: Pass mask to wait_until_mux_stable() Date: Wed, 21 Feb 2024 21:02:31 -0600 Message-Id: <20240222030235.27815-12-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240222030235.27815-1-semen.protsenko@linaro.org> References: <20240222030235.27815-1-semen.protsenko@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Make it possible to use wait_until_mux_stable() for MUX registers where the mask is different from MUX_MASK (e.g. in upcoming CPU clock implementation for Exynos850). No functional change. Signed-off-by: Sam Protsenko --- Changes in v2: - none drivers/clk/samsung/clk-cpu.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/clk/samsung/clk-cpu.c b/drivers/clk/samsung/clk-cpu.c index 93e961855875..89b24fd5d0a9 100644 --- a/drivers/clk/samsung/clk-cpu.c +++ b/drivers/clk/samsung/clk-cpu.c @@ -135,16 +135,16 @@ static void wait_until_divider_stable(void __iomem *div_reg, unsigned long mask) * value was changed. */ static void wait_until_mux_stable(void __iomem *mux_reg, u32 mux_pos, - unsigned long mux_value) + unsigned long mask, unsigned long mux_value) { unsigned long timeout = jiffies + msecs_to_jiffies(MAX_STAB_TIME); do { - if (((readl(mux_reg) >> mux_pos) & MUX_MASK) == mux_value) + if (((readl(mux_reg) >> mux_pos) & mask) == mux_value) return; } while (time_before(jiffies, timeout)); - if (((readl(mux_reg) >> mux_pos) & MUX_MASK) == mux_value) + if (((readl(mux_reg) >> mux_pos) & mask) == mux_value) return; pr_err("%s: re-parenting mux timed-out\n", __func__); @@ -249,7 +249,7 @@ static int exynos_cpuclk_pre_rate_change(struct clk_notifier_data *ndata, /* select sclk_mpll as the alternate parent */ mux_reg = readl(base + regs->mux_sel); writel(mux_reg | (1 << 16), base + regs->mux_sel); - wait_until_mux_stable(base + regs->mux_stat, 16, 2); + wait_until_mux_stable(base + regs->mux_stat, 16, MUX_MASK, 2); /* alternate parent is active now. set the dividers */ writel(div0, base + regs->div_cpu0); @@ -290,7 +290,7 @@ static int exynos_cpuclk_post_rate_change(struct clk_notifier_data *ndata, /* select mout_apll as the alternate parent */ mux_reg = readl(base + regs->mux_sel); writel(mux_reg & ~(1 << 16), base + regs->mux_sel); - wait_until_mux_stable(base + regs->mux_stat, 16, 1); + wait_until_mux_stable(base + regs->mux_stat, 16, MUX_MASK, 1); if (cpuclk->flags & CLK_CPU_NEEDS_DEBUG_ALT_DIV) { div |= (cfg_data->div0 & E4210_DIV0_ATB_MASK); @@ -362,7 +362,7 @@ static int exynos5433_cpuclk_pre_rate_change(struct clk_notifier_data *ndata, /* select the alternate parent */ mux_reg = readl(base + regs->mux_sel); writel(mux_reg | 1, base + regs->mux_sel); - wait_until_mux_stable(base + regs->mux_stat, 0, 2); + wait_until_mux_stable(base + regs->mux_stat, 0, MUX_MASK, 2); /* alternate parent is active now. set the dividers */ writel(div0, base + regs->div_cpu0); @@ -390,7 +390,7 @@ static int exynos5433_cpuclk_post_rate_change(struct clk_notifier_data *ndata, /* select apll as the alternate parent */ mux_reg = readl(base + regs->mux_sel); writel(mux_reg & ~1, base + regs->mux_sel); - wait_until_mux_stable(base + regs->mux_stat, 0, 1); + wait_until_mux_stable(base + regs->mux_stat, 0, MUX_MASK, 1); exynos_set_safe_div(cpuclk, div, div_mask); spin_unlock_irqrestore(cpuclk->lock, flags); -- 2.39.2