From patchwork Tue Jul 5 20:29:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abhilash Kesavan X-Patchwork-Id: 9214765 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 65DDB60752 for ; Tue, 5 Jul 2016 16:24:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 573F326E69 for ; Tue, 5 Jul 2016 16:24:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4B66D275A2; Tue, 5 Jul 2016 16:24:10 +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=-1.1 required=2.0 tests=BAYES_00, DATE_IN_FUTURE_03_06, DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=no version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id EE4D126E69 for ; Tue, 5 Jul 2016 16:24:09 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bKT7L-0006Rf-7y; Tue, 05 Jul 2016 16:22:35 +0000 Received: from mail-pa0-x244.google.com ([2607:f8b0:400e:c03::244]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bKT7D-00063w-AH for linux-arm-kernel@lists.infradead.org; Tue, 05 Jul 2016 16:22:33 +0000 Received: by mail-pa0-x244.google.com with SMTP id ts6so18800501pac.0 for ; Tue, 05 Jul 2016 09:22:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=DkpNhUgZs50N0kLhX0tDjr5lUNHdgbqH2kxbhwbdrNI=; b=R9WobyzGkjNKWDb8CFEf3SJa6CAPtTTS3Iyqmbp+nH9c28Vf/Gi2g554FcUalznoJi TOC8zZQPU+LUq0FRR1wsFd+8u951FJMBWcNbvRe6Lr3OIY9LuCwnseYc9h4U88i9V6Oh bnAjaP+LV+ni5lQlO5UX+SH5Pv9O4vWeS8mS+AmsfB8I1qZpcx3Y9br72LKatdQtBpB2 nKo7l90OCLHmPUyZBuVokKaiWKuOIkBcdybQr5qzajC60pMOUYxuPfOskEmEl+oY3+ZQ sktebEkO+dIezYWtPFQWJUwG/17F4LdfdTgsBEQP1KM564O8lc21oWjMALgN4dnIXX31 1BYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=DkpNhUgZs50N0kLhX0tDjr5lUNHdgbqH2kxbhwbdrNI=; b=hPfIpPoskwxVFWUqazXWVSt4IJyYJKsWN3ux2MS6TAwoECUvlOfcHzrymjxre//rzq Lln8sD+lGwZfIZoL9AC3l9walldY5xcmmYk4r8fJcNAh+aGuVT6+GMJZ3vo8m6aZODSW uzNUNc3Cw+WRMyZuKy2lIjkHWTVtto2vRe6Fxe/hfAZZi+EOL+aa2fVOyJRZsOZRho+f lfW2hUpzsYkrhuHHVsUQsKleKI9TeHSdiAFt6gG521wO9wSmRNvz6/IbV9IChxjk+eB4 R26j7XRnZYKcRgdpjXMQzBCgMc6W6V1HMkEw4yNXR0h/Irzc6W63ZPLBdyLpOJeDQyaw FzDw== X-Gm-Message-State: ALyK8tL++73e6uoInKho20Bj6mvQx9fCn7/xq/FlbQTA4soowh9CgZaFDp1JkZiLI6Do1g== X-Received: by 10.67.7.71 with SMTP id da7mr33148958pad.136.1467735730834; Tue, 05 Jul 2016 09:22:10 -0700 (PDT) Received: from localhost.localdomain ([180.151.249.230]) by smtp.gmail.com with ESMTPSA id zv2sm6524644pac.43.2016.07.05.09.22.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 05 Jul 2016 09:22:10 -0700 (PDT) From: Abhilash Kesavan To: s.nawrocki@samsung.com, tomasz.figa@gmail.com Subject: [PATCH v3 1/2] clk: samsung: cpu: Prepare for addition for Exynos7 CPU clocks Date: Wed, 6 Jul 2016 01:59:20 +0530 Message-Id: <1467750561-13957-2-git-send-email-a.kesavan@samsung.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1467750561-13957-1-git-send-email-a.kesavan@samsung.com> References: <1467750561-13957-1-git-send-email-a.kesavan@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160705_092227_576639_C82ACBBC X-CRM114-Status: GOOD ( 12.91 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: k.kozlowski@samsung.com, linux-samsung-soc@vger.kernel.org, b.zolnierkie@samsung.com, mturquette@baylibre.com, sboyd@codeaurora.org, linux-kernel@vger.kernel.org, kgene.kim@samsung.com, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Exynos7 has the same CPU clock registers layout as that present in Exynos5433 except for the bits in the MUX_STAT* registers. Add a new CLK_CPU_HAS_MODIFIED_MUX_STAT flag to handle this change. Signed-off-by: Abhilash Kesavan --- drivers/clk/samsung/clk-cpu.c | 10 ++++++++-- drivers/clk/samsung/clk-cpu.h | 2 ++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/clk/samsung/clk-cpu.c b/drivers/clk/samsung/clk-cpu.c index 8bf7e80..d40d740 100644 --- a/drivers/clk/samsung/clk-cpu.c +++ b/drivers/clk/samsung/clk-cpu.c @@ -322,7 +322,10 @@ static int exynos5433_cpuclk_pre_rate_change(struct clk_notifier_data *ndata, /* select the alternate parent */ mux_reg = readl(base + E5433_MUX_SEL2); writel(mux_reg | 1, base + E5433_MUX_SEL2); - wait_until_mux_stable(base + E5433_MUX_STAT2, 0, 2); + if (cpuclk->flags & CLK_CPU_HAS_MODIFIED_MUX_STAT) + wait_until_mux_stable(base + E5433_MUX_STAT2, 0, 1); + else + wait_until_mux_stable(base + E5433_MUX_STAT2, 0, 2); /* alternate parent is active now. set the dividers */ writel(div0, base + E5433_DIV_CPU0); @@ -348,7 +351,10 @@ static int exynos5433_cpuclk_post_rate_change(struct clk_notifier_data *ndata, /* select apll as the alternate parent */ mux_reg = readl(base + E5433_MUX_SEL2); writel(mux_reg & ~1, base + E5433_MUX_SEL2); - wait_until_mux_stable(base + E5433_MUX_STAT2, 0, 1); + if (cpuclk->flags & CLK_CPU_HAS_MODIFIED_MUX_STAT) + wait_until_mux_stable(base + E5433_MUX_STAT2, 0, 0); + else + wait_until_mux_stable(base + E5433_MUX_STAT2, 0, 1); exynos5433_set_safe_div(base, div, div_mask); spin_unlock_irqrestore(cpuclk->lock, flags); diff --git a/drivers/clk/samsung/clk-cpu.h b/drivers/clk/samsung/clk-cpu.h index d4b6b51..b4d9a4b 100644 --- a/drivers/clk/samsung/clk-cpu.h +++ b/drivers/clk/samsung/clk-cpu.h @@ -63,6 +63,8 @@ struct exynos_cpuclk { #define CLK_CPU_NEEDS_DEBUG_ALT_DIV (1 << 1) /* The CPU clock registers have Exynos5433-compatible layout */ #define CLK_CPU_HAS_E5433_REGS_LAYOUT (1 << 2) +/* Exynos5433-compatible layout with different MUX_STAT register bits */ +#define CLK_CPU_HAS_MODIFIED_MUX_STAT (1 << 3) }; extern int __init exynos_register_cpu_clock(struct samsung_clk_provider *ctx,