From patchwork Thu Jun 15 20:15:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 13281707 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 3CA43EB64D9 for ; Thu, 15 Jun 2023 20:15:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 28FDE10E535; Thu, 15 Jun 2023 20:15:31 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) by gabe.freedesktop.org (Postfix) with ESMTPS id B873D10E535 for ; Thu, 15 Jun 2023 20:15:28 +0000 (UTC) Received: from tr.lan (ip-86-49-120-218.bb.vodafone.cz [86.49.120.218]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: marex@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 2E5CC8617C; Thu, 15 Jun 2023 22:15:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1686860125; bh=G1lbRyM0mBvSwPbPJlV+/r3jfCO67BRw6keSWA0TxaQ=; h=From:To:Cc:Subject:Date:From; b=K+UaNCN9YAbCSbRIN8k+rPICKxGuCaoPvhLXXQbkv69ST2GFvvgsy0HrlwQXIArey g15jAOzmFjTy1mNaBttPNBJlkQp5/u07QEDU3quIdPyMU3u4KPzoJfryeIKt+dxJ8y Vja/WVfXLtHmF+78vDQ5ymk+2dhlrXMY2rF4toVaOlBauUBJbdgly1tf9nz3GeXbGr gycqNQawhS/vIpDdsBP5CP1TPcYRkxc+PnfbQvhahWnFhS39Bky+YJ6kdmtFl+Tht+ KmuCF0Zg+k3SmdY9JzUYHfjnzb77vfkoZirjMJQFoyeOyYf75nipO49ireVYkEiVaG hky8NYza6mMDg== From: Marek Vasut To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm: bridge: samsung-dsim: Drain command transfer FIFO before transfer Date: Thu, 15 Jun 2023 22:15:11 +0200 Message-Id: <20230615201511.565923-1-marex@denx.de> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean 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 , Andrzej Hajda , Jonas Karlman , Jernej Skrabec , Jagan Teki , Marek Szyprowski , Laurent Pinchart Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Wait until the command transfer FIFO is empty before loading in the next command. The previous behavior where the code waited until command transfer FIFO was not full suffered from transfer corruption, where the last command in the FIFO could be overwritten in case the FIFO indicates not full, but also does not have enough space to store another transfer yet. Signed-off-by: Marek Vasut Reviewed-by: Jagan Teki Tested-by: Jagan Teki # imx8mm-icore --- Cc: Andrzej Hajda Cc: Daniel Vetter Cc: David Airlie Cc: Inki Dae Cc: Jagan Teki Cc: Jernej Skrabec Cc: Jonas Karlman Cc: Laurent Pinchart Cc: Marek Szyprowski Cc: Neil Armstrong Cc: Robert Foss Cc: dri-devel@lists.freedesktop.org --- drivers/gpu/drm/bridge/samsung-dsim.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c index 043b8109e64aa..9b7a00bafeaaa 100644 --- a/drivers/gpu/drm/bridge/samsung-dsim.c +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -1009,7 +1009,7 @@ 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_FULL)) + if (reg & DSIM_SFR_HEADER_EMPTY) return 0; if (!cond_resched())