From patchwork Thu Feb 20 00:12:59 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 3683781 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 BE356BF13A for ; Thu, 20 Feb 2014 00:42:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E9253201CD for ; Thu, 20 Feb 2014 00:42:56 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 06DAC201BA for ; Thu, 20 Feb 2014 00:42:56 +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 1WGHJI-0001rs-Cl; Thu, 20 Feb 2014 00:16:17 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WGHIP-00058J-Lw; Thu, 20 Feb 2014 00:15:21 +0000 Received: from mail-ie0-f177.google.com ([209.85.223.177]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WGHGg-0004ul-He for linux-arm-kernel@lists.infradead.org; Thu, 20 Feb 2014 00:13:47 +0000 Received: by mail-ie0-f177.google.com with SMTP id rp18so803867iec.36 for ; Wed, 19 Feb 2014 16:13:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=QJcZAabqcensNt7QF9rSXXSfwV+EbrrHU+6qU8GuEL4=; b=GkNPeVpcpSeFmVQrWCHSBdd/XcBJuQF4j8O7sN09Bwj68zZVRxBwbgyXg0cpQldXt2 9B+HuZKB1wOyP7h+HShsReXNw6jU1ywrwI+SOkctob8v/aEQYl9xcapslcZE8htR8SLF aaCx/dwiA1i9WnW7P9SDhAzqGtUnIqE+ffqMAPGzoXSZA7ygXKqgIJH/9FrsSMW2RLtP tSIPbhDb1pJCipqynZ10+XtqTEwS2TFpHYGVXqlH0eMCI2fEotihmfZeDJyTf4UZ3Bc0 ZFVZkwYGd5OPnVCMgMfy/FZ9oWkPaCt3Jv6A8xDeHuTb/6S9jzLO23tckusGk6jrvk2p LfTA== X-Gm-Message-State: ALoCoQm7HRS0MyjAFmAjKcyE5F6/VB01cNw2k0AjtweKzzK7pwf79PkCcPd0E9+apg3u4ejmUrt3 X-Received: by 10.43.65.145 with SMTP id xm17mr29057399icb.35.1392855193192; Wed, 19 Feb 2014 16:13:13 -0800 (PST) Received: from localhost.localdomain (c-71-195-31-37.hsd1.mn.comcast.net. [71.195.31.37]) by mx.google.com with ESMTPSA id gd5sm5623419igd.5.2014.02.19.16.13.12 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 19 Feb 2014 16:13:12 -0800 (PST) From: Alex Elder To: mturquette@linaro.org, bcm@fixthebug.org, mporter@linaro.org, robh+dt@kernel.org, pawel.moll@arm.com, mark.rutland@arm.com, ijc+devicetree@hellion.org.uk, galak@codeaurora.org, linux@arm.linux.org.uk Subject: [PATCH 09/12] clk: bcm281xx: add an initialized flag Date: Wed, 19 Feb 2014 18:12:59 -0600 Message-Id: <1392855182-21155-10-git-send-email-elder@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1392855182-21155-1-git-send-email-elder@linaro.org> References: <1392855182-21155-1-git-send-email-elder@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140219_191334_709015_87026911 X-CRM114-Status: GOOD ( 16.60 ) X-Spam-Score: 0.3 (/) Cc: devicetree@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, linux-kernel@vger.kernel.org, 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=-1.9 required=5.0 tests=BAYES_00,KHOP_BIG_TO_CC, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, 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 Add a flag that tracks whether a clock has already been initialized. This will be used by the next patch to avoid initializing a clock more than once when it's listed as a prerequisite. Signed-off-by: Alex Elder --- drivers/clk/bcm/clk-kona.c | 16 ++++++++++++++-- drivers/clk/bcm/clk-kona.h | 7 +++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/drivers/clk/bcm/clk-kona.c b/drivers/clk/bcm/clk-kona.c index 64b6361..6caed3b 100644 --- a/drivers/clk/bcm/clk-kona.c +++ b/drivers/clk/bcm/clk-kona.c @@ -27,6 +27,9 @@ #define CCU_ACCESS_PASSWORD 0xA5A500 #define CLK_GATE_DELAY_LOOP 2000 +#define clk_is_initialized(_clk) FLAG_TEST((_clk), KONA, INITIALIZED) +#define clk_set_initialized(_clk) FLAG_SET((_clk), KONA, INITIALIZED) + /* Bitfield operations */ /* Produces a mask of set bits covering a range of a 32-bit value */ @@ -1192,13 +1195,22 @@ static bool __peri_clk_init(struct kona_clk *bcm_clk) static bool __kona_clk_init(struct kona_clk *bcm_clk) { + bool ret = false; + + if (clk_is_initialized(bcm_clk)) + return true; + switch (bcm_clk->type) { case bcm_clk_peri: - return __peri_clk_init(bcm_clk); + ret = __peri_clk_init(bcm_clk); + break; default: BUG(); } - return -EINVAL; + if (ret) + clk_set_initialized(bcm_clk); + + return ret; } /* Set a CCU and all its clocks into their desired initial state */ diff --git a/drivers/clk/bcm/clk-kona.h b/drivers/clk/bcm/clk-kona.h index c6285d2..01fa776 100644 --- a/drivers/clk/bcm/clk-kona.h +++ b/drivers/clk/bcm/clk-kona.h @@ -406,6 +406,7 @@ struct kona_clk { struct clk_init_data init_data; /* includes name of this clock */ struct ccu_data *ccu; /* ccu this clock is associated with */ enum bcm_clk_type type; + u32 flags; /* BCM_CLK_KONA_FLAGS_* below */ union { void *data; struct peri_clk_data *peri; @@ -414,6 +415,12 @@ struct kona_clk { #define to_kona_clk(_hw) \ container_of(_hw, struct kona_clk, hw) +/* + * Kona clock flags: + * INITIALIZED clock has been initialized already + */ +#define BCM_CLK_KONA_FLAGS_INITIALIZED ((u32)1 << 0) /* Clock initialized */ + /* Initialization macro for an entry in a CCU's kona_clks[] array. */ #define KONA_CLK(_ccu_name, _clk_name, _type) \ { \