From patchwork Mon May 5 13:57:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 29650 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ig0-f199.google.com (mail-ig0-f199.google.com [209.85.213.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A7B4C2055D for ; Mon, 5 May 2014 13:58:57 +0000 (UTC) Received: by mail-ig0-f199.google.com with SMTP id c1sf14724133igq.10 for ; Mon, 05 May 2014 06:58:57 -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=HlK5pGHeuvEoc/7b6JMEkE5QPV5XR/8dI4frZ9q7kZI=; b=EDUGJVHGwMBBAckNd5PXjUgH/PKuF+AmInpLK87YhpX9yEJvQcwrEFiwCl8xRS6Vi8 NJ5dDXOOSXFcjaIxT4c86SyHIRZ8EjPKvsXxSiN4De1hCcE1TPFrQ5HMX2TcPGtxHASm dDGfJIaN4Xht3JyR7myrMpDROtdlddyZLKh3FShcJqGGgriNcMbwRluLe1gVCZd001Hh 3u39/WYraTuKPHVSZoBIxcRqfwbVheHcbS9+7wRDgEZQC/5E89ARcbxqF6TFLbjfIxk9 vXNtLfo559mvfu8J3UdBawSDbb4o5beprvX18pA1EmFxlExYDwQvdD9OUlHfIfhG1uum 1lPw== X-Gm-Message-State: ALoCoQk/CipCwkogRGchpA5wKvkBl7LAobUarm2OgviduI+RlxHBDhWSxtvrqW+hiLVF+AuKg+Yn X-Received: by 10.182.45.131 with SMTP id n3mr17615817obm.20.1399298337119; Mon, 05 May 2014 06:58:57 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.83.240 with SMTP id j103ls2432066qgd.47.gmail; Mon, 05 May 2014 06:58:57 -0700 (PDT) X-Received: by 10.52.176.170 with SMTP id cj10mr2823724vdc.17.1399298337031; Mon, 05 May 2014 06:58:57 -0700 (PDT) Received: from mail-ve0-f170.google.com (mail-ve0-f170.google.com [209.85.128.170]) by mx.google.com with ESMTPS id tv3si1580967vdc.126.2014.05.05.06.58.57 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 05 May 2014 06:58:57 -0700 (PDT) Received-SPF: none (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) client-ip=209.85.128.170; Received: by mail-ve0-f170.google.com with SMTP id db11so4162975veb.29 for ; Mon, 05 May 2014 06:58:57 -0700 (PDT) X-Received: by 10.58.169.97 with SMTP id ad1mr360959vec.45.1399298336921; Mon, 05 May 2014 06:58:56 -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 ib8csp141995vcb; Mon, 5 May 2014 06:58:56 -0700 (PDT) X-Received: by 10.50.47.12 with SMTP id z12mr23685603igm.37.1399298336359; Mon, 05 May 2014 06:58:56 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k7si12505157igv.30.2014.05.05.06.58.55; Mon, 05 May 2014 06:58:55 -0700 (PDT) Received-SPF: none (google.com: devicetree-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 S932594AbaEEN6z (ORCPT + 8 others); Mon, 5 May 2014 09:58:55 -0400 Received: from mail-ig0-f181.google.com ([209.85.213.181]:40339 "EHLO mail-ig0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932395AbaEEN5l (ORCPT ); Mon, 5 May 2014 09:57:41 -0400 Received: by mail-ig0-f181.google.com with SMTP id h3so1463280igd.2 for ; Mon, 05 May 2014 06:57:40 -0700 (PDT) X-Received: by 10.42.214.143 with SMTP id ha15mr2423455icb.59.1399298260653; Mon, 05 May 2014 06:57:40 -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 w4sm27660107igl.7.2014.05.05.06.57.39 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 05 May 2014 06:57:39 -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 1/5] clk: bcm281xx: add an initialized flag Date: Mon, 5 May 2014 08:57:32 -0500 Message-Id: <1399298256-10965-2-git-send-email-elder@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1399298256-10965-1-git-send-email-elder@linaro.org> References: <1399298256-10965-1-git-send-email-elder@linaro.org> Sender: devicetree-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: devicetree@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=neutral (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) 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) \ { \