From patchwork Tue May 20 12:52:38 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 30429 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f197.google.com (mail-qc0-f197.google.com [209.85.216.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 21E9120671 for ; Tue, 20 May 2014 12:54:01 +0000 (UTC) Received: by mail-qc0-f197.google.com with SMTP id w7sf1172838qcr.4 for ; Tue, 20 May 2014 05:54:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=86YZft0HEYFw45zn/JvSHEx8Gz5Gye3NJbPhqMTshok=; b=lftsazJ2n68I2Op8FhH3Zb/pVCPu6CHcDn1ICwiDDIwOVOrSZjmXv+BkG03tSSVYWU x4bQK/BPE1vomLZju76iKntOknVF6XLQI2g+vTSKNTFg8yPJ5mG2UKZFjePzwNyzOfnc ekYpqowCUSVxIGL/3eaDQG/6FEpJ6vP1kQd3OJwV5ZP6ot7bkUTGayeaw4LrKK/iQcfI 18TR61DJG/6YJTpKXhgFNrOepDvB00QgETg56kp9xcOwMB5j4O6uRyfoK3y1FB22AgIm b4LuCkMq6UzNWPwIeAh0pW4w76nLlGZDV6rUXiCvT7QkufQS/IAFLGTxdOybtSNomSFa hh2A== X-Gm-Message-State: ALoCoQlWSON29ANOWrEgDqMKZhF1+y8h3Ujy/SS10J7+lLsjiWaTJYT74IQ4wzOKe5b/WoaLAbm5 X-Received: by 10.58.187.107 with SMTP id fr11mr12319285vec.34.1400590440963; Tue, 20 May 2014 05:54:00 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.21.203 with SMTP id 69ls211301qgl.35.gmail; Tue, 20 May 2014 05:54:00 -0700 (PDT) X-Received: by 10.52.147.200 with SMTP id tm8mr362758vdb.54.1400590440833; Tue, 20 May 2014 05:54:00 -0700 (PDT) Received: from mail-ve0-f171.google.com (mail-ve0-f171.google.com [209.85.128.171]) by mx.google.com with ESMTPS id an4si4923513vdd.44.2014.05.20.05.54.00 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 20 May 2014 05:54:00 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.171 as permitted sender) client-ip=209.85.128.171; Received: by mail-ve0-f171.google.com with SMTP id oz11so519422veb.30 for ; Tue, 20 May 2014 05:54:00 -0700 (PDT) X-Received: by 10.58.245.2 with SMTP id xk2mr19931781vec.9.1400590440749; Tue, 20 May 2014 05:54:00 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp28085vcb; Tue, 20 May 2014 05:54:00 -0700 (PDT) X-Received: by 10.66.246.229 with SMTP id xz5mr50306734pac.119.1400590439851; Tue, 20 May 2014 05:53:59 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ag2si1675965pbc.83.2014.05.20.05.53.59; Tue, 20 May 2014 05:53:59 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753509AbaETMxx (ORCPT + 27 others); Tue, 20 May 2014 08:53:53 -0400 Received: from mail-ig0-f180.google.com ([209.85.213.180]:58938 "EHLO mail-ig0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752915AbaETMwm (ORCPT ); Tue, 20 May 2014 08:52:42 -0400 Received: by mail-ig0-f180.google.com with SMTP id c1so662104igq.7 for ; Tue, 20 May 2014 05:52:42 -0700 (PDT) X-Received: by 10.50.61.243 with SMTP id t19mr4451644igr.41.1400590362222; Tue, 20 May 2014 05:52:42 -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 kw1sm28775309igb.4.2014.05.20.05.52.41 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 20 May 2014 05:52:41 -0700 (PDT) From: Alex Elder To: mturquette@linaro.org, mporter@linaro.org, bcm@fixthebug.org, devicetree@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/5] clk: bcm281xx: add an initialized flag Date: Tue, 20 May 2014 07:52:38 -0500 Message-Id: <1400590362-11177-2-git-send-email-elder@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1400590362-11177-1-git-send-email-elder@linaro.org> References: <1400590362-11177-1-git-send-email-elder@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: elder@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.171 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 d603c4e..d8a7f38 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 */ @@ -1194,13 +1197,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) \ { \