From patchwork Thu Mar 9 10:41:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 9613029 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 3FEB0602B4 for ; Thu, 9 Mar 2017 10:50:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 306AE285A6 for ; Thu, 9 Mar 2017 10:50:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 250A5285EF; Thu, 9 Mar 2017 10:50:24 +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 B61B3285A6 for ; Thu, 9 Mar 2017 10:50:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754439AbdCIKuV (ORCPT ); Thu, 9 Mar 2017 05:50:21 -0500 Received: from mail-wr0-f172.google.com ([209.85.128.172]:34475 "EHLO mail-wr0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754422AbdCIKtw (ORCPT ); Thu, 9 Mar 2017 05:49:52 -0500 Received: by mail-wr0-f172.google.com with SMTP id l37so42241004wrc.1 for ; Thu, 09 Mar 2017 02:49:51 -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=ej02/LfYHZvBAOxzjHHaIIaZlml0bcYOn9vQZHBR1NI=; b=B+8uPfnob4VNXjqqu6laQkBssUZyeGVZoi3+rBMFYkKOrv8UHUu5E2r2DQW82U/J2X LS6VnCJxIxDt6XyY0xAQE7wuzj1LdE888dBX3r7RUiqg2k8/R6/bchwmIhYULAMZ3qA7 Hw6IJK2PLHQIbbXMXKtIHi/QrAr8XZuV4yBBMpYzdDarHJLRn3BsRf4jj/s0NbykGphM 04skxtVdhbXlutd4/8zTF1yH1coxLWVfXy0rVAqlosvNQtwso/K1ssJU6i5mDaU1paia RSL3hHFKyllG9Nu97Hbz7Jlg34Lj0fM9QeSqKSNw42hN3Rapbna1rAkh44ie+cgsRRmY nNaQ== 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=ej02/LfYHZvBAOxzjHHaIIaZlml0bcYOn9vQZHBR1NI=; b=XkWUhyL09dU9fSrnvS1AVPngPP+vrPyS9rbqUimWSrBcNUWxKvYG4Kl/EoZSl9yOCR bEuaBNV/fGv8ARvBxz71BXBSYT36JOjAo3tpV0n0u/xVSqvWoNnhyfAT7O64J/BPNhgH 2DvkvukFANQJI/UX8gasLhPf1Kq5L/uePu+KKESlz8zgDAkMFYuomI/Fg15JhmA2yJmL w735eRnKx5wcYmvhbCrnUcZnu2AiEpFPEo6BxFjaGizKRT5j60O/91N+Qx8JimTQ9Dbs iJzXC4LPW8Y9ycHVSeTW8SIMUp3gBHWHJBQ+rjYwdWnf7Wg0qlYerxldmpw31UD7FD9H 36EA== X-Gm-Message-State: AMke39liWRIOWLO2He4XXlMnxil1605AMjloLlIfG1Ctb51sieog9tC4XaE3ZpQioLpot5/X X-Received: by 10.223.134.69 with SMTP id 5mr10618029wrw.22.1489056128006; Thu, 09 Mar 2017 02:42:08 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.googlemail.com with ESMTPSA id e6sm7724113wrc.30.2017.03.09.02.42.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Mar 2017 02:42:07 -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 4/9] clk: gxbb: put dividers and muxes in tables Date: Thu, 9 Mar 2017 11:41:49 +0100 Message-Id: <20170309104154.28295-5-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 2 dividers and 2 muxes declared for the gxbb platform. With the ongoing work on various subsystem, 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/gxbb.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/drivers/clk/meson/gxbb.c b/drivers/clk/meson/gxbb.c index c063287bb0ed..79e9313e6703 100644 --- a/drivers/clk/meson/gxbb.c +++ b/drivers/clk/meson/gxbb.c @@ -902,6 +902,16 @@ static struct clk_gate *const gxbb_clk_gates[] = { &gxbb_sar_adc_clk, }; +static struct clk_mux *const gxbb_clk_muxes[] = { + &gxbb_mpeg_clk_sel, + &gxbb_sar_adc_clk_sel, +}; + +static struct clk_divider *const gxbb_clk_dividers[] = { + &gxbb_mpeg_clk_div, + &gxbb_sar_adc_clk_div, +}; + static int gxbb_clkc_probe(struct platform_device *pdev) { void __iomem *clk_base; @@ -928,19 +938,21 @@ static int gxbb_clkc_probe(struct platform_device *pdev) /* Populate the base address for CPU clk */ gxbb_cpu_clk.base = clk_base; - /* Populate the base address for the MPEG clks */ - gxbb_mpeg_clk_sel.reg = clk_base + (u64)gxbb_mpeg_clk_sel.reg; - gxbb_mpeg_clk_div.reg = clk_base + (u64)gxbb_mpeg_clk_div.reg; - - /* Populate the base address for the SAR ADC clks */ - gxbb_sar_adc_clk_sel.reg = clk_base + (u64)gxbb_sar_adc_clk_sel.reg; - gxbb_sar_adc_clk_div.reg = clk_base + (u64)gxbb_sar_adc_clk_div.reg; - /* Populate base address for gates */ for (i = 0; i < ARRAY_SIZE(gxbb_clk_gates); i++) gxbb_clk_gates[i]->reg = clk_base + (u64)gxbb_clk_gates[i]->reg; + /* Populate base address for muxes */ + for (i = 0; i < ARRAY_SIZE(gxbb_clk_muxes); i++) + gxbb_clk_muxes[i]->reg = clk_base + + (u64)gxbb_clk_muxes[i]->reg; + + /* Populate base address for dividers */ + for (i = 0; i < ARRAY_SIZE(gxbb_clk_dividers); i++) + gxbb_clk_dividers[i]->reg = clk_base + + (u64)gxbb_clk_dividers[i]->reg; + /* * register all clks */