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: 9595571 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 A8FAB601D7 for ; Tue, 28 Feb 2017 13:30:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9675D28504 for ; Tue, 28 Feb 2017 13:30:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8B3C228520; Tue, 28 Feb 2017 13:30:43 +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 1903928504 for ; Tue, 28 Feb 2017 13:30:42 +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=O3xFbzeW8tnwwvFcTrdtnPXLGjR9V4wjP/sl6wqdbvo=; b=axSNVoPHP6TFpz1VDRvcZV8Ev0 QDsNJkt5ZiTbGF+GtqLHBM5L04kCPwKBwV5GPLVF6HDGAf6VcxnO0aFSqapMvveSUgXp6/jokPr6Q 61az/2/XkhswNWRm8CQ2d5ShdG29BLTtR2WLYnHyZ6jRy5BCP4QMc+7vIRvVB6sa0oeZOYcskHcaV xu60bZnx3U4kW+LkUL5MZcTm0ep1HYFGQaxxChAJCcAvZ1InQ4i3tCkYTpvS9zV0nNDvjoJKqcdX2 UTTUGcEoFAPChVpw4dBbNId5Jwj6D0i/jjAfkFHT9A/kQEb2aJA4QfJZ+Rlnl++5xWedFBzSDXRU/ P7p/O5hA==; 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 1cihrR-00048o-RD; Tue, 28 Feb 2017 13:30:37 +0000 Received: from mail-wm0-x236.google.com ([2a00:1450:400c:c09::236]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cihrN-00045s-Tg for linux-amlogic@lists.infradead.org; Tue, 28 Feb 2017 13:30:35 +0000 Received: by mail-wm0-x236.google.com with SMTP id u199so11749987wmd.1 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=cjD82txECOs/BuZMOH6Lm2GGYuym4+yHRa3nflUkMCztiFvz1bg1p55V/7PByANCrt 542npUNFF71Qq3CX5AuKkFUCIbMhUPktrJ01M+fwo5UBsgsiBuwxXNQarxyNE7Z4pLQU hcP8Had/I8tN/Npwf5aHHgKI+j5OTqbBxMMk83M6Dohn6MD5pKwPEDGO2UGq0N6UyjJE DNDAG1SKh/pWx2K+WWbcSqt+648qKsLSyXI/h6cv3wgHgHrnP5z03RoopTDGnhjktnok X9RjhbYTgEb+zGxXljnekwBFaoZn0s5z32dVsRnC8xFnJ/+H8QEOS/BMGjk9FSv+SMWr tRBQ== X-Gm-Message-State: AMke39mUy4BLNJEA9PN6B1XXR64z7lYiXmKkeB0waKyUXiDadjaLSuKJlEJi4d9E2WS5Ytik 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170228_053034_131605_9CECA7A6 X-CRM114-Status: GOOD ( 12.16 ) 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 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 */