From patchwork Thu May 29 14:05:57 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 4264921 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7F3869F1E7 for ; Thu, 29 May 2014 14:08:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 971B7202DD for ; Thu, 29 May 2014 14:08:43 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (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 AAF592022A for ; Thu, 29 May 2014 14:08:42 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Wq0yc-0005cT-DZ; Thu, 29 May 2014 14:06:38 +0000 Received: from mail-ie0-f175.google.com ([209.85.223.175]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Wq0yP-0005Ri-Mp for linux-arm-kernel@lists.infradead.org; Thu, 29 May 2014 14:06:26 +0000 Received: by mail-ie0-f175.google.com with SMTP id y20so317609ier.20 for ; Thu, 29 May 2014 07:06:04 -0700 (PDT) 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=+FotFIK2EBG+zUwT5M9IYmSc7yaAlKhcZ2dNsDC2V1A=; b=Cm/7L9fm7qqNVextZAz3rv2FORX8EWlGbjsD1mpEWZio6k9hdFZVR9tYfsnxAGiWaF PEJrV0lLTFBCqpvCyz6RTtsQw+X2pLmC23qwR26swLyxPtEdgMIsTp21Iw8VgsBxmiRq vI8OSOKaJOdvRZOoWIRgt9QtGnmoZA3I4x8azVF27fe9k6RGLrwg/Y/sqwsnLqO0zyQG sRCBMWXWQ3A4uxHIHTTu1JYEFWZGNEs4wVBcZc+ob1piKbt2iZT7sb6bg+h6Kay1smlq icT05dIXFEmZn4GntzC5NRk9SS5nPzLALGEoG/LUkqQ5t1prehc0IT0jnK7vKCIIsGhm ifeg== X-Gm-Message-State: ALoCoQnrzf1GmuiXWSxpG2zpFHxu/5CiklyVOFRxjv+yc5My4l7UI3vx/yV+2j1oY9klJDrD1pdv X-Received: by 10.50.43.225 with SMTP id z1mr52090311igl.29.1401372364707; Thu, 29 May 2014 07:06:04 -0700 (PDT) Received: from localhost.localdomain (c-71-195-31-37.hsd1.mn.comcast.net. [71.195.31.37]) by mx.google.com with ESMTPSA id ng17sm2510130igb.13.2014.05.29.07.06.03 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 29 May 2014 07:06:04 -0700 (PDT) From: Alex Elder To: mturquette@linaro.org, mporter@linaro.org, bcm@fixthebug.org Subject: [PATCH v3 1/5] clk: bcm281xx: add an initialized flag Date: Thu, 29 May 2014 09:05:57 -0500 Message-Id: <1401372361-18842-2-git-send-email-elder@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1401372361-18842-1-git-send-email-elder@linaro.org> References: <1401372361-18842-1-git-send-email-elder@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140529_070625_791559_861B0AFE X-CRM114-Status: GOOD ( 15.75 ) X-Spam-Score: -0.7 (/) Cc: 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=-2.5 required=5.0 tests=BAYES_00,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 | 17 +++++++++++++++-- drivers/clk/bcm/clk-kona.h | 7 +++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/drivers/clk/bcm/clk-kona.c b/drivers/clk/bcm/clk-kona.c index 95af2e6..9691b62 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 */ @@ -1246,13 +1249,23 @@ static bool __peri_clk_init(struct kona_clk *bcm_clk) static bool __kona_clk_init(struct kona_clk *bcm_clk) { + bool ret; + + 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: + ret = false; 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 2537b30..10e238d 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) \ { \