From patchwork Thu Mar 9 10:41:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 9613001 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 E53A1602B4 for ; Thu, 9 Mar 2017 10:42:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D5159285CE for ; Thu, 9 Mar 2017 10:42:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C9FBE285E0; Thu, 9 Mar 2017 10:42:39 +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.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham 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 856AF285CE for ; Thu, 9 Mar 2017 10:42:39 +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:References: In-Reply-To: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:List-Owner; bh=oeoVJm95/TZkTuQ2HzVVmY0fOJQMxAbOzl5ncYpM5q0=; b=B1B9y0ovdrvzOVwNvJuR4AKD8w +KC80BYueLkMefE/3r7BRATrlwQ3RfHSCwof/IGGS5ncs86w16neI4wzPbe+hwAn7X9vN7c0A4wvT PdP7pYQrPOShzmXQQ36IjyVS9Rn9r045dfYqR52ZKVIfxiU4/uMiljf7CwQ3XMRL/Y5YxNuXZ0wXn HDzRnGZ2f12Z3+YMzEyp6k93futI2lx0BIrdkMuCwZ11zaEQ06QdhK1nXRvTFIQCyf5WKPo54ZANu Qht7UohhzAAOagy/shpK2C6TJYACzn+JATxYsvZpFSl9ZTn2JqnbC1cCFXT+1Lf6BE94vM8mP4UJq 2lPHbsBQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1clvWj-0006Rz-UJ; Thu, 09 Mar 2017 10:42:33 +0000 Received: from mail-wm0-x22c.google.com ([2a00:1450:400c:c09::22c]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1clvWe-0006K8-HY for linux-amlogic@lists.infradead.org; Thu, 09 Mar 2017 10:42:30 +0000 Received: by mail-wm0-x22c.google.com with SMTP id t189so52516682wmt.1 for ; Thu, 09 Mar 2017 02:42:08 -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:in-reply-to:references; bh=3VtaDuGybo7j5QgYszsnR/P4c9P4orUgURiD9pZBYfo=; b=NSEa7WrPhpjf4iTo4skrrezOrRQSW3oaIx07uppt2c7f6GSKEBSd6YUHO06G3JI8i4 KGFpo3OmI0GhyhU16GJes/umNqOiivRCyu+ICtFVeWz/VL3fclimTlr8qWm+gdemOC/j W7t7B5IyTFFRlZvK1/Cf3CrU9+d2MjIJoeLhbPhGPF5LnQ8jz422iaQiYZM6vU4fUPfb 9A121tiSYJKjc5dD2RXCUt8Tb9EEUKwbeCOWXG0p5MmKdMxCzgWc5pp/z9Oe8a1EFLJx ap/oPBGkdXliibhzwit5bW0gu5lJeO855R5LvL1T1BB37KaVAdh0Zcfg9J5FcQeDt4ZI me1A== 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; bh=3VtaDuGybo7j5QgYszsnR/P4c9P4orUgURiD9pZBYfo=; b=Ee6eIEeOVzCuuPjipx8pbgT/re9L22+5XRCejmujeLf4wc3RQJr0RXeeuOCIC027qi Lbg0K1MBSAQ+VBxpZ7lQ2iiGv3/rFUMRP6klrU/9tP5r5ZxU1lZE/9CXLJvQMHl/MBnB beG5qmUCoAdUoZEeDttJtbpz/RNFTMFOLRdAj1OCCJkiKEwr86mCSy04szwJ7aCGa+tU pFolXnUhs26CMykdT8rEzaqa2oYlI5A0VU+j5gmtauoiwdKeTUVItKBubDwaZXxzMcu3 AN8Zu13QozzTxyk5sx1K2ghSW6hSeu9VZJCQiQ7q6Rp5DjNckpDnxmWXMwn3Tk8M2H4d oQow== X-Gm-Message-State: AMke39lcQ+w6oJMk5lon8w305KOGzYR5lRaATCiw46UYT6mC1fxx9DdYJ2HXdCm//xcYYKlH X-Received: by 10.28.84.18 with SMTP id i18mr26387573wmb.130.1489056127081; Thu, 09 Mar 2017 02:42:07 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.googlemail.com with ESMTPSA id e6sm7724113wrc.30.2017.03.09.02.42.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Mar 2017 02:42:06 -0800 (PST) From: Jerome Brunet To: Michael Turquette , Stephen Boyd , Kevin Hilman , Carlo Caione Subject: [PATCH v2 3/9] clk: meson8b: put dividers and muxes in tables Date: Thu, 9 Mar 2017 11:41:48 +0100 Message-Id: <20170309104154.28295-4-jbrunet@baylibre.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170309104154.28295-1-jbrunet@baylibre.com> References: <20170309104154.28295-1-jbrunet@baylibre.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170309_024228_834866_7CCBAE2D X-CRM114-Status: GOOD ( 12.91 ) 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: linux-amlogic@lists.infradead.org, linux-clk@vger.kernel.org, linux-kernel@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 Until now, there was only 1 divider and 1 mux declared for the meson8b platform. With the ongoing work on various system, including audio, this is about to change. Use the same approach as gates for dividers and muxes, putting them in tables to fix the register address at runtime. Signed-off-by: Jerome Brunet --- drivers/clk/meson/meson8b.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/drivers/clk/meson/meson8b.c b/drivers/clk/meson/meson8b.c index d1cc4d7cc8ff..2937443d4505 100644 --- a/drivers/clk/meson/meson8b.c +++ b/drivers/clk/meson/meson8b.c @@ -582,6 +582,14 @@ static struct clk_gate *const meson8b_clk_gates[] = { &meson8b_ao_iface, }; +static struct clk_mux *const meson8b_clk_muxes[] = { + &meson8b_mpeg_clk_sel, +}; + +static struct clk_divider *const meson8b_clk_dividers[] = { + &meson8b_mpeg_clk_div, +}; + static int meson8b_clkc_probe(struct platform_device *pdev) { void __iomem *clk_base; @@ -604,15 +612,21 @@ static int meson8b_clkc_probe(struct platform_device *pdev) /* Populate the base address for CPU clk */ meson8b_cpu_clk.base = clk_base; - /* Populate the base address for the MPEG clks */ - meson8b_mpeg_clk_sel.reg = clk_base + (u32)meson8b_mpeg_clk_sel.reg; - meson8b_mpeg_clk_div.reg = clk_base + (u32)meson8b_mpeg_clk_div.reg; - /* Populate base address for gates */ for (i = 0; i < ARRAY_SIZE(meson8b_clk_gates); i++) meson8b_clk_gates[i]->reg = clk_base + (u32)meson8b_clk_gates[i]->reg; + /* Populate base address for muxes */ + for (i = 0; i < ARRAY_SIZE(meson8b_clk_muxes); i++) + meson8b_clk_muxes[i]->reg = clk_base + + (u32)meson8b_clk_muxes[i]->reg; + + /* Populate base address for dividers */ + for (i = 0; i < ARRAY_SIZE(meson8b_clk_dividers); i++) + meson8b_clk_dividers[i]->reg = clk_base + + (u32)meson8b_clk_dividers[i]->reg; + /* * register all clks * CLKID_UNUSED = 0, so skip it and start with CLKID_XTAL = 1