From patchwork Tue Feb 28 13:29:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 9595575 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 91898601D7 for ; Tue, 28 Feb 2017 13:30:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7EE2828504 for ; Tue, 28 Feb 2017 13:30:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 723D028520; Tue, 28 Feb 2017 13:30:48 +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 2B82528504 for ; Tue, 28 Feb 2017 13:30:48 +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=0oILjqn7QuL2mfcBASrBwJceOkQ2w7jo1GAh4+fmQ+8=; b=LaA9AGZadrYWnLIwk+6vW56wZf jpVTa3q6t0MxUtk5QNynDtI3mtbj587ea4tr407bZ+6ctUfMFCV8G63Xn37Z0EZCtLt3CMb3OeoyA HvTnFW4jx4I9Wi9MPaIn8UFddjfPxjeRNXDdW0EHzSIeSfU7BljmHknqbNrMD5LD+qA9fmaV7wTgK pWi1vPtxNoMbh7qNRwODf8J1XEwE0nrOeAAY828kJBByyWo0rV3vLrpf9YWY9JPaWtyRB6QqdnWjZ nDlJCSy1vhZYOl/cqAvoXtFqbfcXnbBczSGO6f9yHyDA4FIsNjfJC67Z2qi/ADEQRb6p1zeKe2Z4p P8C4i/Yw==; 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 1cihrW-0004B3-KG; Tue, 28 Feb 2017 13:30:42 +0000 Received: from mail-wr0-x235.google.com ([2a00:1450:400c:c0c::235]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cihrO-000455-5e for linux-amlogic@lists.infradead.org; Tue, 28 Feb 2017 13:30:40 +0000 Received: by mail-wr0-x235.google.com with SMTP id g10so8870221wrg.2 for ; Tue, 28 Feb 2017 05:30:13 -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=TpFKyD4XWJJoJySjzLwvO9K9PTGSWCA6cDjxGvXLY5s=; b=VqIXvejTfZuc+7Vlk1jWU09ewz+F/Z6+KyB1+Fxkb2bEVtgy1rHRTn59iJhyP5vpy7 FogJGDkgRzg7CSF14hCtDIn5NkBC4jo/d3ddnfnw0D5HjEsQRlF6CvVWPt+t7+dlUWPv NfyfeWAh4OEzmmP0B6RcWybRuwBe7dkB9KdRwfc5wPGxT1AfhM9wn8HJUs1ABv8pbZ8o yZKeDTbKbj6A15ACQ++OKSpNs9ICjdCIy8BYK6dRD48EbCq4jOdKe7Ai9P3qK8PXaVa6 OI5LOYsAbC1cFlVbdm8kIuWzSp9/GTPwXtAV/tSeemPxzShY3YPtm33eXQSVeF4h0k/u 3KVA== 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=TpFKyD4XWJJoJySjzLwvO9K9PTGSWCA6cDjxGvXLY5s=; b=F+FzvzKgFNAZxqnM2IDr/o5lNvkLjSAsLlrruhTtpNbW9Vp84EVHspvQZqOc69tJk8 qlRcnt2VwcFP9rCWIYYj18NQDPU2pTNI04fp3vQmaxU20cLtgRjsu0+KxXCjL0CzkDne X+gsew1vG/FP0Kin7HDGxN8kkjAl+vQN7pRHdGbWQyzoy4GcmdhJf1kaOETCzAEjoRXF hLERJT0+cfAuf9r6uE57bPxLCKjJZzkgITtF8kg/Mvj2NaVe8/tPD+13KrargEi+gtlU nnXXcuKh3GwDe3v6GIM+IzBapMGWmp1czKFU5yGzUCehlcbgqTIpvUgeO7kQIl+m/FER cbiQ== X-Gm-Message-State: AMke39ltNhGilztrQU8Dqa6l9U/ug6d5vOKOJmjVhovGQRasu5zCwGtM3Ij8QNV/d99E0bAD X-Received: by 10.223.154.225 with SMTP id a88mr2322988wrc.5.1488288612282; Tue, 28 Feb 2017 05:30:12 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.googlemail.com with ESMTPSA id k70sm18550982wmc.3.2017.02.28.05.30.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Feb 2017 05:30:11 -0800 (PST) From: Jerome Brunet To: Michael Turquette , Stephen Boyd , Kevin Hilman , Carlo Caione Subject: [PATCH 1/7] clk: meson8b: put dividers and muxes in tables Date: Tue, 28 Feb 2017 14:29:56 +0100 Message-Id: <20170228133002.17894-2-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_371309_7A2E169D X-CRM114-Status: GOOD ( 12.56 ) 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 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 | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/drivers/clk/meson/meson8b.c b/drivers/clk/meson/meson8b.c index 888494d4fb8a..44c24bf754cd 100644 --- a/drivers/clk/meson/meson8b.c +++ b/drivers/clk/meson/meson8b.c @@ -582,6 +582,15 @@ static struct clk_gate *meson8b_clk_gates[] = { &meson8b_ao_iface, }; +static struct clk_mux *meson8b_clk_muxes[] = { + &meson8b_mpeg_clk_sel, +}; + +static struct clk_divider *meson8b_clk_dividers[] = { + &meson8b_mpeg_clk_div, +}; + + static int meson8b_clkc_probe(struct platform_device *pdev) { void __iomem *clk_base; @@ -604,15 +613,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