Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1591379yba; Thu, 25 Apr 2019 02:21:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqyoQZiIIasuuAeb/IxtUTG3JhWNr5gLmNCY/RZ0kyO9lHD1XatwEU8TsANHkDIhejlaRCLk X-Received: by 2002:a63:d146:: with SMTP id c6mr2089464pgj.452.1556184083779; Thu, 25 Apr 2019 02:21:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556184083; cv=none; d=google.com; s=arc-20160816; b=B/0hAV7pD7j1Dci43d0eTF+rRt0qPveVungmJ1Wf2lVtg/goVmG5l+wZcJRK7rhXyy VFqmMhd0HIndhYraHVDa6n1R0Byk4qqgVN0u/gxv2zcypVASlVb2K2LzurxEVMj0qrqv bg7peUFaTYtCt79hqcFcKrvv05WWUfA/1OjoAPBnn1fbfXZaQT0YBBpRIYs53yc1rIU7 j5eKfgXpVMdp3K5qJBFGf/5Ft1zZd4eTK02BFy1n+Hh4h4tOJ8kEyjoxHs6QyflaIc97 iKUf2BL3SsDAB2/DmH597L77M/JhL0h/rW/lBZdVms1ywj2DCm9VYVGx0BlpQEH4ER9d kHIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=prAx0r5ij765hQTK6defP8wg64bqsiLPZXCksdQ0U6U=; b=TkGfIpOZehANYMSRhXXVA5XZg1AQbyhOkEgmkP/4bzzbYQHzS0aQ1s+cg/C1m1Wbrn 3VAWto/tgqXbtyH88cBTdkxh8voC5ao9jYdQ7Hg4bjjjMKdLjpcsg1FoeL+4LJU7BPj7 KNolK4M7PHPFY3qGBNP9ATpLqK8lpZKRhyEd72gi/huQXq1Eb6dfLoYDZ/0O/ZdKsH2c dE3e4+n8CDCgkM5TouOYhRoMevecSkVb1Ri1YOlHzCmG4cxfIw4eDW66/LZp5oTg9APd YhHKccS3GKrGAjjLpZDENJ+PV227dnXKFXyvFYNS178y7VmME7EPuNfMXTwspRPezRS7 G/vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=wniT5D8j; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 27si22459130pfr.146.2019.04.25.02.21.09; Thu, 25 Apr 2019 02:21:23 -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; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=wniT5D8j; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728571AbfDYJS0 (ORCPT + 99 others); Thu, 25 Apr 2019 05:18:26 -0400 Received: from perceval.ideasonboard.com ([213.167.242.64]:35104 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728537AbfDYJSY (ORCPT ); Thu, 25 Apr 2019 05:18:24 -0400 Received: from pendragon.ideasonboard.com (net-37-182-44-227.cust.vodafonedsl.it [37.182.44.227]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 2BB565F; Thu, 25 Apr 2019 11:18:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1556183901; bh=A8unK81K5jpjF7m6yXqXk3+YvT7+8zM3Gr8YuevpnrM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=wniT5D8jDiIXwqPEZvkoQRwTU3bxcTpJ6CbhNDJhroGSTHTFA3iFZCjIqSEgpb3wO a+zgtKry0vPp0P0z5hP35FiWY3AJXpgyj8Pv/ghTvs/9TcRHv/piQqNPgFOgv5psss sLNsMjZQmFOuJODtnzsS3nKOHwnkxz//XN5dM5eA= Date: Thu, 25 Apr 2019 12:18:10 +0300 From: Laurent Pinchart To: Matt Redfearn Cc: Andrzej Hajda , Philippe Cornu , "dri-devel@lists.freedesktop.org" , Matthew Redfearn , Nickey Yang , Heiko Stuebner , Archit Taneja , "linux-kernel@vger.kernel.org" , David Airlie , Daniel Vetter Subject: Re: [PATCH] drm/bridge/synopsys: dsi: Wait for all active lanes to reach stop Message-ID: <20190425091810.GA4557@pendragon.ideasonboard.com> References: <20190424142124.25776-1-matt.redfearn@thinci.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20190424142124.25776-1-matt.redfearn@thinci.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Matt, Thank you for the patch. On Wed, Apr 24, 2019 at 02:21:40PM +0000, Matt Redfearn wrote: > The Synopsys manual states that software should wait for all active > lanes to reach stop state (User manual section 3.1.5). Currently the > driver only waits for / checks that the clock lane is in stop state. Fix > this by waiting for the mask of PHY STATUS bits corresponding to the > active lanes to be set. > > Signed-off-by: Matt Redfearn I don't have access to the datasheet, but the change makes sense. Reviewed-by: Laurent Pinchart > --- > > drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 15 ++++++++++++--- > 1 file changed, 12 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > index bd15c21a177..38e88071363 100644 > --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > @@ -189,6 +189,10 @@ > #define DSI_PHY_TX_TRIGGERS 0xac > > #define DSI_PHY_STATUS 0xb0 > +#define PHY_STOP_STATE_LANE_3 BIT(11) > +#define PHY_STOP_STATE_LANE_2 BIT(9) > +#define PHY_STOP_STATE_LANE_1 BIT(7) > +#define PHY_STOP_STATE_LANE_0 BIT(4) > #define PHY_STOP_STATE_CLK_LANE BIT(2) > #define PHY_LOCK BIT(0) > > @@ -752,7 +756,7 @@ static void dw_mipi_dsi_dphy_init(struct dw_mipi_dsi *dsi) > > static void dw_mipi_dsi_dphy_enable(struct dw_mipi_dsi *dsi) > { > - u32 val; > + u32 val, mask; > int ret; > > dsi_write(dsi, DSI_PHY_RSTZ, PHY_ENFORCEPLL | PHY_ENABLECLK | > @@ -763,11 +767,16 @@ static void dw_mipi_dsi_dphy_enable(struct dw_mipi_dsi *dsi) > if (ret) > DRM_DEBUG_DRIVER("failed to wait phy lock state\n"); > > + mask = PHY_STOP_STATE_CLK_LANE | PHY_STOP_STATE_LANE_0; > + mask |= (dsi->lanes >= 2) ? PHY_STOP_STATE_LANE_1 : 0; > + mask |= (dsi->lanes >= 3) ? PHY_STOP_STATE_LANE_2 : 0; > + mask |= (dsi->lanes == 4) ? PHY_STOP_STATE_LANE_3 : 0; > + > ret = readl_poll_timeout(dsi->base + DSI_PHY_STATUS, > - val, val & PHY_STOP_STATE_CLK_LANE, 1000, > + val, (val & mask) == mask, 1000, > PHY_STATUS_TIMEOUT_US); > if (ret) > - DRM_DEBUG_DRIVER("failed to wait phy clk lane stop state\n"); > + DRM_DEBUG_DRIVER("failed to wait phy stop state\n"); > } > > static void dw_mipi_dsi_clear_err(struct dw_mipi_dsi *dsi) -- Regards, Laurent Pinchart