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: 9612999 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 350B7602B4 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 24928285CE for ; Thu, 9 Mar 2017 10:42:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 196E5285E5; 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 C6F03285CE for ; Thu, 9 Mar 2017 10:42:38 +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=/Py/fIFB6zchlVXbAsLJ/oD2mf7f1Kt07orXS0G1CtE=; b=jyTW4LHWHZV8dwGMPLLMh6oEkA qj1X70qp8YAAb+DZoY1TL9mTDvUmk4Pl1r9of5mlhe6iWJ7GKGY9pXXBqygAp75d+1g7ux+rWIMph ax5yzW7NarGEnLt4EU07SEJw8TcYBH5AuDGMRqvFaVqWGV3vVpepOaLQfVah1qjOPxcQBiM8EfRb5 gfqMy5tNoFtdDyC8LAdjB7oyYaFfDh7eL75wp7U4hqJBZRTI4wkwkfieLe3maOzV03isSO6VfrVGf tQ1ss6n7FtF+AOtt2ci4hj1Z8RUIKmQEfxjqdqc+E2rDv6gowIvDCSmnMxNtBS4d91H8aEZ65JgRy NfEReD9Q==; 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-0006RC-7n; Thu, 09 Mar 2017 10:42:33 +0000 Received: from mail-wr0-x231.google.com ([2a00:1450:400c:c0c::231]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1clvWd-0006KP-3s for linux-amlogic@lists.infradead.org; Thu, 09 Mar 2017 10:42:30 +0000 Received: by mail-wr0-x231.google.com with SMTP id g10so42099277wrg.2 for ; Thu, 09 Mar 2017 02:42:09 -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=iiuAs0ptEY8WtJt5tqthlXEUFVCKVGL/ugEKNDXqyIx4JOU2GpyOC/swlhWicnbUMY 2ys0q+ox1YvRc3sYqTAvNZw7EpyRCLh7YF8YEBwG52Dw89lK5hqHq9rG9rVslfwCzV6l kl5As/rWAKLHjGlxJrxcBakhvWfo6tMj1QCeudCI7h0tzZmZ6eQwQNU+JVwY+quZN7qk 274IEBDM9f16DIfo9ilsROn/ZHVkTpW7Z5iTIpKkfXoosxKsCgjjuStKD32nl3dNRDG2 KnXf4oQJXxghlMLTeQlaaNpKlIhepuDS2vGOALXrzn8K+Cdj8NlpA7OY9XoA0ez1cv0P mdWA== X-Gm-Message-State: AMke39nuHANpn/qf7tVyrQpToNmNd5FMasX5jQM4Sf4b6oLWLrFt7Ji+sQXWuAPvbczHqSdR 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170309_024227_317450_E6210367 X-CRM114-Status: GOOD ( 12.20 ) 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 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 */