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: 9613043 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 5722B602B4 for ; Thu, 9 Mar 2017 10:51:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 47BAB285A6 for ; Thu, 9 Mar 2017 10:51:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3C7D8285E8; Thu, 9 Mar 2017 10:51: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=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E1D54285A6 for ; Thu, 9 Mar 2017 10:51:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932188AbdCIKvF (ORCPT ); Thu, 9 Mar 2017 05:51:05 -0500 Received: from mail-wm0-f46.google.com ([74.125.82.46]:34894 "EHLO mail-wm0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754626AbdCIKuc (ORCPT ); Thu, 9 Mar 2017 05:50:32 -0500 Received: by mail-wm0-f46.google.com with SMTP id v186so136137543wmd.0 for ; Thu, 09 Mar 2017 02:50:31 -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=AVF7cm9NEssbiwhiCDPcFE/VB3SpcUjcRuuWRAntqMBQp8T5f7zxfr8VG0sNAdyiIK j5AgHVP7bRINNfWZYRVAkOxHqvdm6p7m7z7R1OGOpbWXjCupPlzVqO6hBfKwBwmyiQ5Z xFJFupbIdplnyHmDVz6EwXY/hiQWkovGdyBYDGRclDZfZVGE+3EQTV7SDCWol2M+pJ+y UV6bektIj78jeZTc/iFiHyJPDHyeSpgfc9ZfL8idj1fOuBhP1qwvf8zM1TTQSB0kO5W/ 1KamFE4z02sitpDO0eZbheVKqhh2f/3ohhmLEphZwmCjVGQIeKHmD0VqRmXJsxXv75IG QudQ== X-Gm-Message-State: AMke39nW82ZzmNVGbKriBPoUf1X/9J1yn3cas6NwbToy4JwW7Lb1nZiVSbrxxaziaIGo3Ys1 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 Cc: Jerome Brunet , linux-clk@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org 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> Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.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