From patchwork Fri Sep 20 06:22:33 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Hesselbarth X-Patchwork-Id: 2915251 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id BEE13BFF05 for ; Fri, 20 Sep 2013 06:23:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E75C3202C8 for ; Fri, 20 Sep 2013 06:23:37 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DD8D2202C1 for ; Fri, 20 Sep 2013 06:23:36 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VMu7m-0002Xm-BA; Fri, 20 Sep 2013 06:23:30 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VMu7j-0000Hh-6k; Fri, 20 Sep 2013 06:23:27 +0000 Received: from mail-bk0-f54.google.com ([209.85.214.54]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VMu7f-0000Gp-E7 for linux-arm-kernel@lists.infradead.org; Fri, 20 Sep 2013 06:23:25 +0000 Received: by mail-bk0-f54.google.com with SMTP id mz12so1777bkb.41 for ; Thu, 19 Sep 2013 23:22:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=HrC6P8dlKftsPN+AI0XQHR7YCI/hwzWMAeSUyZuFe84=; b=RtjgkRHJXqa3OicmE2KfrmoW+0WpsGLyxTVLQSMYyhaUVbBLxC6MGfKoWThKmRjIDH XllzX8UuTkSkdLLuJrVvrUvy9RnkV7sSQX8srRV6YN+42qqFlQQ3BCPoBmEBCIadbFeI BgrPf0C4zV2e9qAMtIG4nsF16tTidkonSRIiS5UYwYEysSKTLBOtS21m+n8a8B1VVw7X tnUeT726x7AN37+heEetCm82nTKD/fPTH+jUFIrOdQX5BdprNx/2UnPMVqBCJJuPEp0R DnMeUD1F8uXlCkOa+Q7un0ljXDjK7/hhUS/4ZRG/S1CgM64lnJs+heWmahuBoddnlYll DIWQ== X-Received: by 10.204.234.8 with SMTP id ka8mr2809451bkb.5.1379658165270; Thu, 19 Sep 2013 23:22:45 -0700 (PDT) Received: from topkick.lan (dslc-082-083-247-252.pools.arcor-ip.net. [82.83.247.252]) by mx.google.com with ESMTPSA id z6sm4027080bkn.8.1969.12.31.16.00.00 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 19 Sep 2013 23:22:44 -0700 (PDT) From: Sebastian Hesselbarth To: Sebastian Hesselbarth Subject: [PATCH v2 07/26] clk: vt8500: parse pmc_base from clock driver Date: Fri, 20 Sep 2013 08:22:33 +0200 Message-Id: <1379658153-28070-1-git-send-email-sebastian.hesselbarth@gmail.com> In-Reply-To: <1379526839-14798-8-git-send-email-sebastian.hesselbarth@gmail.com> References: <1379526839-14798-8-git-send-email-sebastian.hesselbarth@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130920_022323_627237_BB3A957F X-CRM114-Status: GOOD ( 14.45 ) X-Spam-Score: -2.7 (--) Cc: Mike Turquette , Arnd Bergmann , linux-kernel@vger.kernel.org, Olof Johansson , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Currently, clock providers for vt8500 depend on machine_init providing pmc_base address before calling of_clk_init. With upcoming arch-wide .time_init calling of_clk_init, we should make clock providers independent of mach code. This adds a pmc_base parsing helper to current clock provider that gets called if there is no pmc_base set, yet. Signed-off-by: Sebastian Hesselbarth Acked-by: Tony Prisk --- Changelog: v1->v2: - Also check pmc_base in vtwm_device_clk_init (Reported by Tony Prisk) This also requires vtwm_set_pmc_base to move upwards. Cc: Olof Johansson Cc: Arnd Bergmann Cc: Tony Prisk Cc: Mike Turquette Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org --- drivers/clk/clk-vt8500.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/clk/clk-vt8500.c b/drivers/clk/clk-vt8500.c index 82306f5..39fe72a 100644 --- a/drivers/clk/clk-vt8500.c +++ b/drivers/clk/clk-vt8500.c @@ -15,11 +15,14 @@ #include #include +#include #include #include #include #include +#define LEGACY_PMC_BASE 0xD8130000 + /* All clocks share the same lock as none can be changed concurrently */ static DEFINE_SPINLOCK(_lock); @@ -53,6 +56,21 @@ struct clk_pll { static void __iomem *pmc_base; +static __init void vtwm_set_pmc_base(void) +{ + struct device_node *np = + of_find_compatible_node(NULL, NULL, "via,vt8500-pmc"); + + if (np) + pmc_base = of_iomap(np, 0); + else + pmc_base = ioremap(LEGACY_PMC_BASE, 0x1000); + of_node_put(np); + + if (!pmc_base) + pr_err("%s:of_iomap(pmc) failed\n", __func__); +} + #define to_clk_device(_hw) container_of(_hw, struct clk_device, hw) #define VT8500_PMC_BUSY_MASK 0x18 @@ -222,6 +240,9 @@ static __init void vtwm_device_clk_init(struct device_node *node) int rc; int clk_init_flags = 0; + if (!pmc_base) + vtwm_set_pmc_base(); + dev_clk = kzalloc(sizeof(*dev_clk), GFP_KERNEL); if (WARN_ON(!dev_clk)) return; @@ -636,6 +657,9 @@ static __init void vtwm_pll_clk_init(struct device_node *node, int pll_type) struct clk_init_data init; int rc; + if (!pmc_base) + vtwm_set_pmc_base(); + rc = of_property_read_u32(node, "reg", ®); if (WARN_ON(rc)) return;