From patchwork Tue Mar 4 16:19:02 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tero Kristo X-Patchwork-Id: 25693 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yk0-f200.google.com (mail-yk0-f200.google.com [209.85.160.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8F67B206F9 for ; Tue, 4 Mar 2014 16:20:15 +0000 (UTC) Received: by mail-yk0-f200.google.com with SMTP id q9sf31940004ykb.3 for ; Tue, 04 Mar 2014 08:20:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe:content-type; bh=Bmkr8mml0+yyRBha2SgcQjhz3B71yXleGKDjueovWL4=; b=g5oCCXHGwztWWSze15SE7Wk9HbCSQvtv0GblWZE/jYjGS9tZXdRIX0B9/ImgdR0WDP ssMfwMuNppKoOCkxczv/o8XYMmzompEPXKABnG1WzVVH/H9B2QeVFRUQkhyXJjjKutiO wBfN8MYgK2ovwmZ0qDtX2QWf6fa7MeetiIU5IG1zaRCJs2pbfk3s0IveqNrB2805RBOP 9No2XaAc95AUo2FXlmt+OUr+gGkcuPHQr8Sb/WJrIYrzYCXgcGFldqm09EmzTXuZsVc7 VjSzD+S9p0huzdYDrR0sDHiZFtRFOtYVy20emdPtXdTG12IBIt5ZBKqokvEM09quqKco hP1g== X-Gm-Message-State: ALoCoQnm8hX24kj6FC6REW+cqsMJuMuorJnIdxlzreko2mQCI1rHiv1D7KpRaCuwHEhjEbFsJHoB X-Received: by 10.58.120.76 with SMTP id la12mr187207veb.21.1393950015223; Tue, 04 Mar 2014 08:20:15 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.85.133 with SMTP id n5ls2605665qgd.64.gmail; Tue, 04 Mar 2014 08:20:15 -0800 (PST) X-Received: by 10.221.30.14 with SMTP id sa14mr226657vcb.44.1393950015078; Tue, 04 Mar 2014 08:20:15 -0800 (PST) Received: from mail-vc0-f170.google.com (mail-vc0-f170.google.com [209.85.220.170]) by mx.google.com with ESMTPS id eb8si4705252vdb.8.2014.03.04.08.20.15 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 04 Mar 2014 08:20:15 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.170 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.170; Received: by mail-vc0-f170.google.com with SMTP id hu8so4572975vcb.15 for ; Tue, 04 Mar 2014 08:20:15 -0800 (PST) X-Received: by 10.221.66.73 with SMTP id xp9mr161938vcb.27.1393950014989; Tue, 04 Mar 2014 08:20:14 -0800 (PST) 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.130.193 with SMTP id u1csp138045vcs; Tue, 4 Mar 2014 08:20:14 -0800 (PST) X-Received: by 10.68.60.225 with SMTP id k1mr564406pbr.58.1393950013951; Tue, 04 Mar 2014 08:20:13 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id wq4si14758274pbc.137.2014.03.04.08.20.13; Tue, 04 Mar 2014 08:20:13 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751832AbaCDQUK (ORCPT + 5 others); Tue, 4 Mar 2014 11:20:10 -0500 Received: from arroyo.ext.ti.com ([192.94.94.40]:45093 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751282AbaCDQUJ (ORCPT ); Tue, 4 Mar 2014 11:20:09 -0500 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id s24GJj8r022575; Tue, 4 Mar 2014 10:19:45 -0600 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id s24GJj4P032325; Tue, 4 Mar 2014 10:19:45 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.3.174.1; Tue, 4 Mar 2014 10:19:45 -0600 Received: from localhost.localdomain (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id s24GJdR1017797; Tue, 4 Mar 2014 10:19:43 -0600 From: Tero Kristo To: , , , CC: Subject: [PATCH 02/18] ARM: OMAP2+: prcm: add omap_test_timeout to prcm-common.h Date: Tue, 4 Mar 2014 18:19:02 +0200 Message-ID: <1393949958-816-3-git-send-email-t-kristo@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1393949958-816-1-git-send-email-t-kristo@ti.com> References: <1393949958-816-1-git-send-email-t-kristo@ti.com> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: t-kristo@ti.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.170 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) 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: , Done in preparation to move cm/prm to drivers. These will still use omap_test_timeout, but will not have access to common.h header under mach-omap2 anymore. Signed-off-by: Tero Kristo --- arch/arm/mach-omap2/prcm-common.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/arch/arm/mach-omap2/prcm-common.h b/arch/arm/mach-omap2/prcm-common.h index 0e841fd..e982598 100644 --- a/arch/arm/mach-omap2/prcm-common.h +++ b/arch/arm/mach-omap2/prcm-common.h @@ -429,6 +429,26 @@ # ifndef __ASSEMBLER__ /** + * omap_test_timeout - busy-loop, testing a condition + * @cond: condition to test until it evaluates to true + * @timeout: maximum number of microseconds in the timeout + * @index: loop index (integer) + * + * Loop waiting for @cond to become true or until at least @timeout + * microseconds have passed. To use, define some integer @index in the + * calling code. After running, if @index == @timeout, then the loop has + * timed out. + */ +#define omap_test_timeout(cond, timeout, index) \ +({ \ + for (index = 0; index < timeout; index++) { \ + if (cond) \ + break; \ + udelay(1); \ + } \ +}) + +/** * struct omap_prcm_irq - describes a PRCM interrupt bit * @name: a short name describing the interrupt type, e.g. "wkup" or "io" * @offset: the bit shift of the interrupt inside the IRQ{ENABLE,STATUS} regs