From patchwork Tue Feb 28 13:29:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 9595591 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 094AB601D7 for ; Tue, 28 Feb 2017 13:31:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EB53928504 for ; Tue, 28 Feb 2017 13:31:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E017D28520; Tue, 28 Feb 2017 13:31:17 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,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 8760728504 for ; Tue, 28 Feb 2017 13:31:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752578AbdB1NbB (ORCPT ); Tue, 28 Feb 2017 08:31:01 -0500 Received: from mail-wm0-f54.google.com ([74.125.82.54]:37734 "EHLO mail-wm0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752479AbdB1Na5 (ORCPT ); Tue, 28 Feb 2017 08:30:57 -0500 Received: by mail-wm0-f54.google.com with SMTP id v77so11703749wmv.0 for ; Tue, 28 Feb 2017 05:30:17 -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=5B7w0awY7ucZuOCjrw45zWwm1PHo9oO5WQLfGAJDHlc=; b=FOwxGcaL0GrVjBLGeaBI+ik7N0x85ICBNUqsTLHDhvKytcQwYn6G3e0NP02DKvO5Kw CnDPnWNqp9UyWQiuJczZgbhOEbFYHqsOrCU2vPadv3dndkm4jKayFnBueIJEd5R2TJ7C +s+tKLzV7Ygj8GjcFYwd9LqrRK4YrKjSlySTEPF2COdgX0hNovcXpTej+m5bm+A/aGU7 281sXEZ6Q6/bHmAk8W/8EWP3ntW6hNoXhpRSgcFLKTjYMaWeugsXh7Kt0chENYJ00HEI ItVqUSo9b8r7VVbi4mw54VlEQs75IpTlSRhUDZjHSFu7DAOtioSDJytBypoJyc88x169 MDxQ== 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=5B7w0awY7ucZuOCjrw45zWwm1PHo9oO5WQLfGAJDHlc=; b=Huin2waPsD5CHhl+5Ar9L7yK45MSrFoRj4Sxo5K9CXGKxoLL/MBgdP0yiuYVWbP3EA rF/sAksifJAdB+aAE026ZHehxZb3ssyEGnwjUjtvltWnjeMi8LzkO1hNzwl2KkSG82te 7MgK1dhybfMNb4YxCt12U/PQ/r7nkm/a1X8L7xTiQjtYgIcICuNB9uGjJ15Nf9OAhPO6 pxLD0CZr8jT843/QopocEymJsqB1sJ7MopBoTDTKUfqG/xqJ02AvOCiVLnmXHDOtR/7T mp9f1qAmOYI8a9hOmL3P0ZmSAsJbe4bJcyTGZ9lHpeAgzNYzTiezvvHEs+F0QGvXhV8r m5IA== X-Gm-Message-State: AMke39lwylvEG1XKis7TNLedfh1WU6GAiYHcTWALU88NOpgZSDBlEu+4MJkvgjh7Rt4EIbx2 X-Received: by 10.28.211.80 with SMTP id k77mr16819168wmg.124.1488288616332; Tue, 28 Feb 2017 05:30:16 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.googlemail.com with ESMTPSA id k70sm18550982wmc.3.2017.02.28.05.30.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Feb 2017 05:30:15 -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 2/7] clk: gxbb: put dividers and muxes in tables Date: Tue, 28 Feb 2017 14:29:57 +0100 Message-Id: <20170228133002.17894-3-jbrunet@baylibre.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170228133002.17894-1-jbrunet@baylibre.com> References: <20170228133002.17894-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 1c1ec137a3cc..388b0c8838af 100644 --- a/drivers/clk/meson/gxbb.c +++ b/drivers/clk/meson/gxbb.c @@ -902,6 +902,16 @@ static struct clk_gate *gxbb_clk_gates[] = { &gxbb_sar_adc_clk, }; +static struct clk_mux *gxbb_clk_muxes[] = { + &gxbb_mpeg_clk_sel, + &gxbb_sar_adc_clk_sel, +}; + +static struct clk_divider *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 */