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: 9595583 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 E694660574 for ; Tue, 28 Feb 2017 13:30:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D3C8628520 for ; Tue, 28 Feb 2017 13:30:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C878E28524; Tue, 28 Feb 2017 13:30:59 +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 777A928520 for ; Tue, 28 Feb 2017 13:30:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752630AbdB1Na7 (ORCPT ); Tue, 28 Feb 2017 08:30:59 -0500 Received: from mail-wr0-f181.google.com ([209.85.128.181]:36729 "EHLO mail-wr0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751060AbdB1Na5 (ORCPT ); Tue, 28 Feb 2017 08:30:57 -0500 Received: by mail-wr0-f181.google.com with SMTP id u108so8870990wrb.3 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=U/VYbjppTFCiGEYcvAYmGzuPnfrkjudi/00uoteaPLsEuY11wPrewXgkGbL13xmb1I ep/ZXhghPpxiQ4Sd5ZrK8wB8YMMiOw/BU65LYF03gLWBqFagMCJjb/dA22vdTtNheTLn NmBBExMN2taa+YdYyooyHhlJQPuBt+n2iNm+8AVnDCugjYkbrDZV3Ic/eQaGI5g6yV9A fpnrTiiOExuUHGYXOBGDinVoeWRtwX/ZtHtCP6Rlzod8nazOhzuGQVoVcVD/F/m2gzHM NEs3miPHIxOpx/hpBceXa64EXSJVnIyLbBFuGMp7XfRV5kv3L6o39hmkN0KBpbZAUJwJ AuAQ== X-Gm-Message-State: AMke39kS+/Y8zg5O5cd0jMlnixnTqDSNnzsTDVF+V4T2OPzzSiqOaCvHy7XgPyBr9CrmKAPp 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 Cc: Jerome Brunet , linux-clk@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org 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> 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 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