From patchwork Thu Aug 24 13:33:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 9920023 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 70B3760349 for ; Thu, 24 Aug 2017 13:34:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 68C98286DE for ; Thu, 24 Aug 2017 13:34:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5CD0B286E1; Thu, 24 Aug 2017 13:34:18 +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 003B9283E7 for ; Thu, 24 Aug 2017 13:34:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752930AbdHXNeO (ORCPT ); Thu, 24 Aug 2017 09:34:14 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:60394 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751185AbdHXNeM (ORCPT ); Thu, 24 Aug 2017 09:34:12 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20170824133410euoutp0241d9e6a7424f14298510ef02dd1a17f8~dy4t7f_FI1157011570euoutp02T; Thu, 24 Aug 2017 13:34:10 +0000 (GMT) Received: from eusmges2.samsung.com (unknown [203.254.199.241]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170824133409eucas1p29b1c260d73171ccd62df856028e6163b~dy4s-IH0E3274732747eucas1p2n; Thu, 24 Aug 2017 13:34:09 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2.samsung.com (EUCPMTA) with SMTP id 57.CE.12907.1D5DE995; Thu, 24 Aug 2017 14:34:09 +0100 (BST) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170824133408eucas1p1e7b9988ac74fdd3e8dd8d25ead949ec5~dy4sP6pDD2915629156eucas1p1L; Thu, 24 Aug 2017 13:34:08 +0000 (GMT) X-AuditID: cbfec7f1-f793a6d00000326b-2c-599ed5d13501 Received: from eusync4.samsung.com ( [203.254.199.214]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id FE.FC.18832.0D5DE995; Thu, 24 Aug 2017 14:34:08 +0100 (BST) Received: from AMDC2768.DIGITAL.local ([106.120.43.17]) by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OV60031EZ0V8CD0@eusync4.samsung.com>; Thu, 24 Aug 2017 14:34:08 +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, devicetree@vger.kernel.org, Krzysztof Kozlowski Subject: [PATCH v2 01/10] drm/exynos/decon5433: use readl_poll_timeout helpers Date: Thu, 24 Aug 2017 15:33:50 +0200 Message-id: <1503581639-580-2-git-send-email-a.hajda@samsung.com> X-Mailer: git-send-email 2.7.4 In-reply-to: <1503581639-580-1-git-send-email-a.hajda@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrFIsWRmVeSWpSXmKPExsWy7djPc7oXr86LNOi4ImBxa905VouNM9az Wsw/AmRd+fqezWLS/QksFufPb2C3mHF+H5PF2iN32R04PD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JJ3Nz7lAWkik1AU+Lv5ptsILaIgLLEqn3t7CA2s8BMJonmPRwgtrCAn8S815/B 6lkEVCWa3lxlBLF5BRwlLm6dywKxTU7i5rlOsM2cAk4SB/esAJspBFRz9fU+lgmMvAsYGVYx iqSWFuem5xYb6hUn5haX5qXrJefnbmIEBvO2Yz8372C8tDH4EKMAB6MSD2/DpXmRQqyJZcWV uYcYJTiYlUR4d20ECvGmJFZWpRblxxeV5qQWH2I0BTpqIrOUaHI+MNLySuINTQzNLQ2NjC0s zI2MlMR51S83RQoJpCeWpGanphakFsH0MXFwSjUw1ip43mQ4dfLmqYXPM2JvmUeWzvkXFN14 Yu6vy407PVYoKfgnhUYd2T353f1Vy9ZYpDxjMs+Wflaskfh2j+vKyDXcr2VMhfZ7rJ8ZUR0u Z7JL44FjwPPudfznJzDYbclX//v0TaFD2eYMX8H+c047G86/3XL7gKcux7R7HGs6DU6c/RU7 50rNDSWW4oxEQy3mouJEAP+9I+N8AgAA X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170824133408eucas1p1e7b9988ac74fdd3e8dd8d25ead949ec5 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-CMS-RootMailID: 20170824133408eucas1p1e7b9988ac74fdd3e8dd8d25ead949ec5 X-RootMTR: 20170824133408eucas1p1e7b9988ac74fdd3e8dd8d25ead949ec5 References: <1503581639-580-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;