From patchwork Fri Jan 19 15:42:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 10175639 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 AFF9E601E7 for ; Fri, 19 Jan 2018 15:44:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 85AA228533 for ; Fri, 19 Jan 2018 15:44:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 78A0F28535; Fri, 19 Jan 2018 15:44:07 +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=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.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 6DA9828712 for ; Fri, 19 Jan 2018 15:43:10 +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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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:In-Reply-To: References:List-Owner; bh=fxn15pxU5TFxuRtSshakVCNQh7sB3OsNyA9NS9e4qNo=; b=O3D UIFMvmygiUqAYdAmIJkPCoHPpDlFr6DDkdUbWNQX6vIlyNRfEkjAJE6wyIWBBgrGJKydjwDln/3ud zQz6S6sscWmoeqmuXHwZNZk4ndH1oLJ4EXva77dkhJ/wp038v3NjqLjLK8N0DvheriAfvoPfAlsc1 zM5ZORyFMrLmgUjFhm03+BTk/x1dmnGBtSqU5dFxtQ+49/d8zWpFqJ05ZMob74ftlh5ErWcfEnQZr HUDJIojCSFvxvpyMr/wM2P8DqyttT516ngeYfrW28fWRUkjpfQHw2y7FfZOM5eKUC8W1MV9K6of/z ICEC3SI7Bi65NPWMFyS7IgL4xTMXx7A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1ecYoi-00081Y-6p; Fri, 19 Jan 2018 15:42:56 +0000 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1ecYoe-0007w2-0o for linux-amlogic@lists.infradead.org; Fri, 19 Jan 2018 15:42:54 +0000 Received: by mail-wr0-x244.google.com with SMTP id o7so1947363wro.8 for ; Fri, 19 Jan 2018 07:42:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=HwdAGXWwh852qmDzl70V80+reOpGTIeiStglI0+NfpY=; b=uh510ZYO6MeQ5FnOwLUfdQU1bU/m/bN+3eSybdVNWG4DYsN5VvVaWrGARc6mg0h5A+ Ur3yC7N8Ue/AtFuxbt7jcSpPfVLx0reUn/VHOZ60YXOhAVulJIRjIBVAtj/wNeR3bnrE YM4A8U7NmTTYTSSriVizX/r64bpiVteMK7UbvXjphNMaf+1brpxWwWcoLp4ibXu8hjYy c9qKr1jL6risfP80McfBm378qTyszbtiOhwnBZYgyxFpZs0kUT9B6YVEtGE0fFAtvxaE 4XNyIfe00MXWHzYB+y8AIPgpwHRMPj7JNfWOpKyP5ChQ6N283aix05i4e16akcdv3LMC DrFg== 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; bh=HwdAGXWwh852qmDzl70V80+reOpGTIeiStglI0+NfpY=; b=DwFlWa3n4433e/Jarezc4xfAb/0PfZSWM0HR9TkfPEV7CLoy1PIr2713akV3Y5UYa5 tP3CKaPI4ilzu0/pAc385WQqsb92ZLDxFYV790gGdfpCIjSe45MMUfiAfmnaYsC5pIpO xr4HGnz4T7lLOeOjYMTVHxH8gAVneSPU8qAk9ZBeo6+38HmZOUszv8Y0iwew8nNKhbSB r3WiZqiq8B+rNITHFGqndsLNpwqEp0Q8gNN5YzAbH97COlhOS2RBExKnU1+dWas57FG+ 9tR8tU+1iur4wkqnMK15aFKJT9saqLgdY8auxRMvI6M95j9BdjCQn8kBUiq3HE+MHwao 90QA== X-Gm-Message-State: AKwxytckTBwdTLoLqYBmSwVlliPwKVVy8a0BjEBsTAuLbHva5GRdqLAA 3BOu8JF/L87mG2wAQyQzcykQSg== X-Google-Smtp-Source: ACJfBosOYS/UfOJNfHEgtFkU7RvVgQVjgBrbnAnB691z9XxVL4fnnJV5/9cZY6REgjMyfv3I62/TWA== X-Received: by 10.223.176.17 with SMTP id f17mr10151501wra.178.1516376559254; Fri, 19 Jan 2018 07:42:39 -0800 (PST) Received: from boomer.baylibre.local ([90.63.244.31]) by smtp.googlemail.com with ESMTPSA id w73sm25805113wrb.34.2018.01.19.07.42.38 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 19 Jan 2018 07:42:38 -0800 (PST) From: Jerome Brunet To: Neil Armstrong Subject: [PATCH] clk: meson: add axg misc bit to the mpll driver Date: Fri, 19 Jan 2018 16:42:36 +0100 Message-Id: <20180119154236.9797-1-jbrunet@baylibre.com> X-Mailer: git-send-email 2.14.3 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: Kevin Hilman , Michael Turquette , Stephen Boyd , linux-kernel@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-clk@vger.kernel.org, Jerome Brunet MIME-Version: 1.0 Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP On axg, the rate of the mpll is stuck as if sdm value was 4 and could not change (expect for mpll2 strangely). Looking at the vendor kernel, it turns out a new magic bit from the undocumented HHI_PLL_TOP_MISC register is required. Setting this bit solves the problem and the mpll rates are back to normal Fixes: 78b4af312f91 ("clk: meson-axg: add clock controller drivers") Signed-off-by: Jerome Brunet --- drivers/clk/meson/axg.c | 20 ++++++++++++++++++++ drivers/clk/meson/clk-mpll.c | 7 +++++++ drivers/clk/meson/clkc.h | 1 + 3 files changed, 28 insertions(+) diff --git a/drivers/clk/meson/axg.c b/drivers/clk/meson/axg.c index 953e119635a2..2f2b3845c01d 100644 --- a/drivers/clk/meson/axg.c +++ b/drivers/clk/meson/axg.c @@ -292,6 +292,11 @@ static struct meson_clk_mpll axg_mpll0 = { .shift = 25, .width = 1, }, + .misc = { + .reg_off = HHI_PLL_TOP_MISC, + .shift = 0, + .width = 1, + }, .lock = &meson_clk_lock, .hw.init = &(struct clk_init_data){ .name = "mpll0", @@ -322,6 +327,11 @@ static struct meson_clk_mpll axg_mpll1 = { .shift = 14, .width = 1, }, + .misc = { + .reg_off = HHI_PLL_TOP_MISC, + .shift = 1, + .width = 1, + }, .lock = &meson_clk_lock, .hw.init = &(struct clk_init_data){ .name = "mpll1", @@ -352,6 +362,11 @@ static struct meson_clk_mpll axg_mpll2 = { .shift = 14, .width = 1, }, + .misc = { + .reg_off = HHI_PLL_TOP_MISC, + .shift = 2, + .width = 1, + }, .lock = &meson_clk_lock, .hw.init = &(struct clk_init_data){ .name = "mpll2", @@ -382,6 +397,11 @@ static struct meson_clk_mpll axg_mpll3 = { .shift = 0, .width = 1, }, + .misc = { + .reg_off = HHI_PLL_TOP_MISC, + .shift = 3, + .width = 1, + }, .lock = &meson_clk_lock, .hw.init = &(struct clk_init_data){ .name = "mpll3", diff --git a/drivers/clk/meson/clk-mpll.c b/drivers/clk/meson/clk-mpll.c index 5144360e2c80..6d79d6daadc4 100644 --- a/drivers/clk/meson/clk-mpll.c +++ b/drivers/clk/meson/clk-mpll.c @@ -173,6 +173,13 @@ static int mpll_set_rate(struct clk_hw *hw, reg = PARM_SET(p->width, p->shift, reg, n2); writel(reg, mpll->base + p->reg_off); + p = &mpll->misc; + if (p->width != 0) { + reg = readl(mpll->base + p->reg_off); + reg = PARM_SET(p->width, p->shift, reg, 1); + writel(reg, mpll->base + p->reg_off); + } + if (mpll->lock) spin_unlock_irqrestore(mpll->lock, flags); else diff --git a/drivers/clk/meson/clkc.h b/drivers/clk/meson/clkc.h index 4acb35bda669..07aaba26a857 100644 --- a/drivers/clk/meson/clkc.h +++ b/drivers/clk/meson/clkc.h @@ -121,6 +121,7 @@ struct meson_clk_mpll { struct parm n2; struct parm en; struct parm ssen; + struct parm misc; spinlock_t *lock; };