Received: by 10.192.165.148 with SMTP id m20csp3279981imm; Mon, 23 Apr 2018 04:00:09 -0700 (PDT) X-Google-Smtp-Source: AIpwx49MpXxeCxm0HN9RLXKvgms2wgfRNzkaj2OL8cv2eJaKBJDuPWn/0VQtTnhDJbiPJjbnZrqg X-Received: by 2002:a17:902:8606:: with SMTP id f6-v6mr20420264plo.258.1524481209815; Mon, 23 Apr 2018 04:00:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524481209; cv=none; d=google.com; s=arc-20160816; b=vlL9Hg2aLqvi+5QhKouNRbBmxpjViElNhypj6PhoC4EOhklm1m34L7yoyLlm3e0RMU TNsSF06ew7mJlQKsZ0IZC3qZR0RESu7TncszLJpGRpiapS+5vPyNOVae6sqTg1WNwC9F 8XTanBcrvYRih7yVuLcRFUSEWcasoNJkg+Om944qH1PuJBjP6aR6ySfeDSRULpsFcyjl qa3ZPlE1V1hiOEBW4gLlc9JPrXXIBXZAAzVJVkCu0XoabyS/tPqFSjjknuzVhTvdnhid HGbHJ43M6dvyxcvi9ME/bpIJrLaVGi9kikb3aJtuKPYLLua4AaYh0HvO8CHRlKLs7UEZ Hd6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=hPmg7hrOu8xIi5/b6cU3GKlzYuWA9NbunlMhqSXk6YY=; b=S23ocWt5qkJsr3Agc+e5DfdUwxVvUJ0V+LunUHGZ+lES88DeYVJY+aAQFIxcS/SiI+ mgZQJYWIHVphmN0VefPKFNZ7uRJCfc4kKz8ZjWQ7380Ri8aPAhCAc7nrsdYv3dPHf4lI ZHFgupQLrBOjtzUjk1cly8eZ5HRmudAedkVHHYrLmnf+i4MK+qGL9vjsw5aUcOwabrLh NwEYQfigTG6gor9XAc+A5ello4WCNO+2WPaC3bnzR4Z1uItVZr8zoVW9fNtf9MX2nC/o ZP/dcVJjTBTKJ7X5XIFY0d57cjv83+HDRxjAiC+bCPHVirpVJE8IMfRunE5SjS4i9tS1 ml1A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m77si11259984pfk.56.2018.04.23.03.59.55; Mon, 23 Apr 2018 04:00:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754898AbeDWKub (ORCPT + 99 others); Mon, 23 Apr 2018 06:50:31 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:38472 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754767AbeDWKuV (ORCPT ); Mon, 23 Apr 2018 06:50:21 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: eballetbo) with ESMTPSA id 93998277B96 From: Enric Balletbo i Serra To: architt@codeaurora.org, inki.dae@samsung.com, thierry.reding@gmail.com, hjc@rock-chips.com, seanpaul@chromium.org, airlied@linux.ie, tfiga@chromium.org, heiko@sntech.de Cc: dri-devel@lists.freedesktop.org, dianders@chromium.org, a.hajda@samsung.com, kernel@collabora.com, m.szyprowski@samsung.com, linux-samsung-soc@vger.kernel.org, jy0922.shim@samsung.com, rydberg@bitmath.org, krzk@kernel.org, linux-rockchip@lists.infradead.org, kgene@kernel.org, orjan.eide@arm.com, wxt@rock-chips.com, jeffy.chen@rock-chips.com, linux-arm-kernel@lists.infradead.org, wzz@rock-chips.com, hl@rock-chips.com, jingoohan1@gmail.com, sw0312.kim@samsung.com, linux-kernel@vger.kernel.org, kyungmin.park@samsung.com, Laurent.pinchart@ideasonboard.com, kuankuan.y@gmail.com, hshi@chromium.org, =?UTF-8?q?St=C3=A9phane=20Marchesin?= , Enric Balletbo i Serra Subject: [RESEND PATCH v6 02/27] drm/bridge: analogix_dp: Check AUX_EN status when doing AUX transfer Date: Mon, 23 Apr 2018 12:49:38 +0200 Message-Id: <20180423105003.9004-3-enric.balletbo@collabora.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180423105003.9004-1-enric.balletbo@collabora.com> References: <20180423105003.9004-1-enric.balletbo@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lin Huang We should check AUX_EN bit to confirm the AUX CH operation is completed. Cc: Stéphane Marchesin Signed-off-by: Lin Huang Signed-off-by: zain wang Signed-off-by: Sean Paul Signed-off-by: Thierry Escande Signed-off-by: Enric Balletbo i Serra Tested-by: Marek Szyprowski Reviewed-by: Archit Taneja --- .../gpu/drm/bridge/analogix/analogix_dp_reg.c | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c index 9df2f3ef000c..e78c861b9e06 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c @@ -1073,9 +1073,9 @@ ssize_t analogix_dp_transfer(struct analogix_dp_device *dp, { u32 reg; u8 *buffer = msg->buffer; - int timeout_loop = 0; unsigned int i; int num_transferred = 0; + int ret; /* Buffer size of AUX CH is 16 bytes */ if (WARN_ON(msg->size > 16)) @@ -1139,17 +1139,20 @@ ssize_t analogix_dp_transfer(struct analogix_dp_device *dp, writel(reg, dp->reg_base + ANALOGIX_DP_AUX_CH_CTL_2); - /* Is AUX CH command reply received? */ + ret = readx_poll_timeout(readl, dp->reg_base + ANALOGIX_DP_AUX_CH_CTL_2, + reg, !(reg & AUX_EN), 25, 500 * 1000); + if (ret) { + dev_err(dp->dev, "AUX CH enable timeout!\n"); + return -ETIMEDOUT; + } + /* TODO: Wait for an interrupt instead of looping? */ - reg = readl(dp->reg_base + ANALOGIX_DP_INT_STA); - while (!(reg & RPLY_RECEIV)) { - timeout_loop++; - if (timeout_loop > DP_TIMEOUT_LOOP_COUNT) { - dev_err(dp->dev, "AUX CH command reply failed!\n"); - return -ETIMEDOUT; - } - reg = readl(dp->reg_base + ANALOGIX_DP_INT_STA); - usleep_range(10, 11); + /* Is AUX CH command reply received? */ + ret = readx_poll_timeout(readl, dp->reg_base + ANALOGIX_DP_INT_STA, + reg, reg & RPLY_RECEIV, 10, 20 * 1000); + if (ret) { + dev_err(dp->dev, "AUX CH cmd reply timeout!\n"); + return -ETIMEDOUT; } /* Clear interrupt source for AUX CH command reply */ -- 2.17.0