From patchwork Tue Apr 18 12:39:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 9685469 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8CF7C602C9 for ; Tue, 18 Apr 2017 12:40:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7EAD32522B for ; Tue, 18 Apr 2017 12:40:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 737CD28342; Tue, 18 Apr 2017 12:40:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 15E292522B for ; Tue, 18 Apr 2017 12:40:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751467AbdDRMkT (ORCPT ); Tue, 18 Apr 2017 08:40:19 -0400 Received: from mailout4.w1.samsung.com ([210.118.77.14]:30898 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752911AbdDRMkR (ORCPT ); Tue, 18 Apr 2017 08:40:17 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OOL00AP1V71ND90@mailout4.w1.samsung.com> for linux-samsung-soc@vger.kernel.org; Tue, 18 Apr 2017 13:40:13 +0100 (BST) Received: from eusmges2.samsung.com (unknown [203.254.199.241]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170418124013eucas1p16a7496475bfc0c795b56648426f876f2~2flEONtU73058130581eucas1p1H; Tue, 18 Apr 2017 12:40:13 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2.samsung.com (EUCPMTA) with SMTP id 07.8F.04459.C2906F85; Tue, 18 Apr 2017 13:40:12 +0100 (BST) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170418124012eucas1p1754a7d3053c6a22203fa32a979f18b01~2flDkuX2q3042230422eucas1p1o; Tue, 18 Apr 2017 12:40:12 +0000 (GMT) X-AuditID: cbfec7f1-f796e6d00000116b-2b-58f6092cc7bb Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id F0.E6.17452.DA906F85; Tue, 18 Apr 2017 13:42:21 +0100 (BST) Received: from AMDC2768.DIGITAL.local ([106.120.43.17]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OOL006UZV6ZTM40@eusync1.samsung.com>; Tue, 18 Apr 2017 13:40:12 +0100 (BST) From: Andrzej Hajda To: Inki Dae Cc: Andrzej Hajda , Bartlomiej Zolnierkiewicz , Marek Szyprowski , dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH 1/7] drm/exynos/decon5433: use readl_poll_timeout helpers Date: Tue, 18 Apr 2017 14:39:57 +0200 Message-id: <1492519203-23537-2-git-send-email-a.hajda@samsung.com> X-Mailer: git-send-email 2.7.4 In-reply-to: <1492519203-23537-1-git-send-email-a.hajda@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrNIsWRmVeSWpSXmKPExsWy7djPc7o6nN8iDGbMMba4te4cq8XGGetZ La58fc9mMen+BBaLGef3MVmsPXKX3YHN4373cSaPvi2rGD0+b5ILYI7isklJzc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9rWzgxQxC1xhlGj/1gU2SljAU+LeiRnMXYwcHCwCqhJ7JkWChHkF nCUmXLzKArFNTuLmuU5mEJtTwEWi99xpVhBbCKhm/ZyTjBMYeRcwMqxiFEktLc5Nzy021CtO zC0uzUvXS87P3cQIDNdtx35u3sF4aWPwIUYBDkYlHt4V+75ECLEmlhVX5h5ilOBgVhLhXffh a4QQb0piZVVqUX58UWlOavEhRlOgmyYyS4km5wNjKa8k3tDE0NzS0MjYwsLcyEhJnLfkw5Vw IYH0xJLU7NTUgtQimD4mDk6pBsbeB/k6u8Lfyl/3ENI+/nf+2t89+r4y7vudo/r+T9TjjPae Y2N9R4LzgmBThearzbwS2x/V6b8pOpiutbWTl+GPnMLRc76SlWn+XAUtL9b/z/ryLJJriu3D vTvl3WaX1ZpwKn5ekzfv3pPPc9aG7y9LviCyeft0pz/sXvu/p9sp3tmdnrtmX7ASS3FGoqEW c1FxIgDaPQ5KbQIAAA== X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170418124012eucas1p1754a7d3053c6a22203fa32a979f18b01 X-Msg-Generator: CA X-Sender-IP: 182.198.249.179 X-Local-Sender: =?UTF-8?B?QW5kcnplaiBIYWpkYRtTUlBPTC1LZXJuZWwgKFRQKRvsgrw=?= =?UTF-8?B?7ISx7KCE7J6QG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Global-Sender: =?UTF-8?B?QW5kcnplaiBIYWpkYRtTUlBPTC1LZXJuZWwgKFRQKRtTYW1z?= =?UTF-8?B?dW5nIEVsZWN0cm9uaWNzG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Sender-Code: =?UTF-8?B?QzEwG0VIURtDMTBDRDAyQ0QwMjczOTI=?= CMS-TYPE: 201P X-HopCount: 7 X-CMS-RootMailID: 20170418124012eucas1p1754a7d3053c6a22203fa32a979f18b01 X-RootMTR: 20170418124012eucas1p1754a7d3053c6a22203fa32a979f18b01 References: <1492519203-23537-1-git-send-email-a.hajda@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Linux core provide helpers for polling with timeout, lets use them. Signed-off-by: Andrzej Hajda --- drivers/gpu/drm/exynos/exynos5433_drm_decon.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c index 5792ca88..237b4c9 100644 --- a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c +++ b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -407,24 +408,19 @@ static void decon_atomic_flush(struct exynos_drm_crtc *crtc) static void decon_swreset(struct decon_context *ctx) { - unsigned int tries; unsigned long flags; + u32 val; + int ret; writel(0, ctx->addr + DECON_VIDCON0); - for (tries = 2000; tries; --tries) { - if (~readl(ctx->addr + DECON_VIDCON0) & VIDCON0_STOP_STATUS) - break; - udelay(10); - } + readl_poll_timeout(ctx->addr + DECON_VIDCON0, val, + ~val & VIDCON0_STOP_STATUS, 12, 20000); writel(VIDCON0_SWRESET, ctx->addr + DECON_VIDCON0); - for (tries = 2000; tries; --tries) { - if (~readl(ctx->addr + DECON_VIDCON0) & VIDCON0_SWRESET) - break; - udelay(10); - } + ret = readl_poll_timeout(ctx->addr + DECON_VIDCON0, val, + ~val & VIDCON0_SWRESET, 12, 20000); - WARN(tries == 0, "failed to software reset DECON\n"); + WARN(ret < 0, "failed to software reset DECON\n"); spin_lock_irqsave(&ctx->vblank_lock, flags); ctx->frame_id = 0;