From patchwork Wed Aug 9 14:56:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 13348110 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 252A7C0015E for ; Wed, 9 Aug 2023 14:56:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3F29110E0B4; Wed, 9 Aug 2023 14:56:54 +0000 (UTC) Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2CCFC10E0B4 for ; Wed, 9 Aug 2023 14:56:52 +0000 (UTC) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20230809145650euoutp02bbcb17067c15690b995ca3817af1dcf9~5vuFrVfWa1155811558euoutp02p for ; Wed, 9 Aug 2023 14:56:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20230809145650euoutp02bbcb17067c15690b995ca3817af1dcf9~5vuFrVfWa1155811558euoutp02p DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1691593010; bh=HAlAesE0BjCgDLJLgmI4YUdhZFr0SXUgrtK+H7JNwHE=; h=From:To:Cc:Subject:Date:References:From; b=RzwGFFBeR+FFZg1+OQyLWm4AVPIwaWIiLWbx2pq042H19KxM83ghc148mt0NpmSDw venvNHC8ezTH3Zw9393Xsx6i+AOZkyBGSMTY93am6p4+2cx/cfL+oEDDuTevC1aMhT E+3PHA7aXjyDDKHEZoP990H3qEZCKQJcbgnHJnAw= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20230809145650eucas1p17429ab1a944b18adadc94ee2a4c988a3~5vuFUgJD82459124591eucas1p1S; Wed, 9 Aug 2023 14:56:50 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id CA.98.37758.139A3D46; Wed, 9 Aug 2023 15:56:49 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20230809145649eucas1p1bb67f98aa4b2987b263b0fd84204d8a2~5vuE2M7EC2458724587eucas1p1H; Wed, 9 Aug 2023 14:56:49 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20230809145649eusmtrp1830cc2870bfc058afaa91d3481262bf8~5vuE1XSZL2119721197eusmtrp1u; Wed, 9 Aug 2023 14:56:49 +0000 (GMT) X-AuditID: cbfec7f5-7ffff7000002937e-c6-64d3a931be73 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 33.B3.10549.139A3D46; Wed, 9 Aug 2023 15:56:49 +0100 (BST) Received: from AMDC4653.eu.corp.samsungelectronics.net (unknown [106.120.51.32]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20230809145648eusmtip26efa07886556648f91b57bab35a8d9cd~5vuEKWJ-D0445804458eusmtip2e; Wed, 9 Aug 2023 14:56:48 +0000 (GMT) From: Marek Szyprowski To: dri-devel@lists.freedesktop.org Subject: [PATCH v4] drm: bridge: samsung-dsim: Fix waiting for empty cmd transfer FIFO on older Exynos Date: Wed, 9 Aug 2023 16:56:41 +0200 Message-Id: <20230809145641.3213210-1-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.34.1 MIME-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zb 8gSjCYki96M8zJle5CR/6mrZfH6uz9rOW/88D/16xhYiKNNx4ejTkK1fO4usrJyieazWK5g9 FZsfFr+s+ntjrqi14okuCf3ZfwO++Lz+3/Zt9Qv2e0osxRmJhlrMRcWJAHsWAqM2AwAA X-CMS-MailID: 20230809145649eucas1p1bb67f98aa4b2987b263b0fd84204d8a2 X-Msg-Generator: CA X-RootMTR: 20230809145649eucas1p1bb67f98aa4b2987b263b0fd84204d8a2 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20230809145649eucas1p1bb67f98aa4b2987b263b0fd84204d8a2 References: X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marek Vasut , Neil Armstrong , Robert Foss , Jonas Karlman , Laurent Pinchart , Jernej Skrabec , Tomasz Figa , Jagan Teki , Andrzej Hajda , Marek Szyprowski Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Samsung DSIM used in older Exynos SoCs (like Exynos 4210, 4x12, 3250) doesn't report empty level of packer header FIFO. In case of those SoCs, use the old way of waiting for empty command tranfsfer FIFO, removed recently by commit 14806c641582 ("Drain command transfer FIFO before transfer"). Fixes: 14806c641582 ("drm: bridge: samsung-dsim: Drain command transfer FIFO before transfer") Signed-off-by: Marek Szyprowski Reviewed-by: Marek Vasut --- v4: - made has_broken_fifoctrl_emptyhdr a bitfield v3: - fixed 'fixes' tag, added reviewed-by v2: - added additional delay when workaround is used as suggested by Marek Vasut v1: https://lore.kernel.org/all/20230718131859.3114135-1-m.szyprowski@samsung.com/ --- Samsung DSIM used in older Exynos SoCs (like Exynos 4210, 4x12, 3250) doesn't report empty level of packer header FIFO. In case of those SoCs, use the old way of waiting for empty command tranfsfer FIFO, removed recently by commit 14806c641582 ("Drain command transfer FIFO before transfer"). Fixes: 14806c641582 ("Drain command transfer FIFO before transfer") Signed-off-by: Marek Szyprowski --- drivers/gpu/drm/bridge/samsung-dsim.c | 18 ++++++++++++++++-- include/drm/bridge/samsung-dsim.h | 1 + 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c index c49091691ab1..35d29f6cd3e2 100644 --- a/drivers/gpu/drm/bridge/samsung-dsim.c +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -413,6 +413,7 @@ static const struct samsung_dsim_driver_data exynos3_dsi_driver_data = { .m_min = 41, .m_max = 125, .min_freq = 500, + .has_broken_fifoctrl_emptyhdr = 1, }; static const struct samsung_dsim_driver_data exynos4_dsi_driver_data = { @@ -429,6 +430,7 @@ static const struct samsung_dsim_driver_data exynos4_dsi_driver_data = { .m_min = 41, .m_max = 125, .min_freq = 500, + .has_broken_fifoctrl_emptyhdr = 1, }; static const struct samsung_dsim_driver_data exynos5_dsi_driver_data = { @@ -1010,8 +1012,20 @@ static int samsung_dsim_wait_for_hdr_fifo(struct samsung_dsim *dsi) do { u32 reg = samsung_dsim_read(dsi, DSIM_FIFOCTRL_REG); - if (reg & DSIM_SFR_HEADER_EMPTY) - return 0; + if (!dsi->driver_data->has_broken_fifoctrl_emptyhdr) { + if (reg & DSIM_SFR_HEADER_EMPTY) + return 0; + } else { + if (!(reg & DSIM_SFR_HEADER_FULL)) { + /* + * Wait a little bit, so the pending data can + * actually leave the FIFO to avoid overflow. + */ + if (!cond_resched()) + usleep_range(950, 1050); + return 0; + } + } if (!cond_resched()) usleep_range(950, 1050); diff --git a/include/drm/bridge/samsung-dsim.h b/include/drm/bridge/samsung-dsim.h index 05100e91ecb9..6fc9bb2979e4 100644 --- a/include/drm/bridge/samsung-dsim.h +++ b/include/drm/bridge/samsung-dsim.h @@ -53,6 +53,7 @@ struct samsung_dsim_driver_data { unsigned int plltmr_reg; unsigned int has_freqband:1; unsigned int has_clklane_stop:1; + unsigned int has_broken_fifoctrl_emptyhdr:1; unsigned int num_clks; unsigned int min_freq; unsigned int max_freq;