Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp811962ybg; Tue, 9 Jun 2020 13:32:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzK71WPQTmvGgD9nhjuQ8v4T4J63DvJkyug9Jx3VmgUHXKqhLikiNmunyTzdSRiQAlVxZCw X-Received: by 2002:a50:d499:: with SMTP id s25mr29733895edi.161.1591734773841; Tue, 09 Jun 2020 13:32:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591734773; cv=none; d=google.com; s=arc-20160816; b=exFSEyu2IylbsgQkp/3KsVyPypCgrk0tw8Ev7k5jMvwYaZR72YKgbfNkRalowgxcno sMPHIg1j93bxhaVWd2L00QnnkKxpEPLkLg6U1ELnMISK1hnp18pkx3Hxn3FAPAT1qR7N VS7AwFoAv0AZqxUFxQ0k1DqJmR9V8L11b9tRWgLK2DZnPYHjLKefjQDShKeTgMG+dYZn DDGsmhtN+Box2KEW9SYDLzwhOzT8mpHCz8ICq33NdJxrbei71ImXharrMeGueg0mchtY X8o3CBJz5uBCyfgj5oNAbmVmYpCDl4hTQ2v6eoJglqAW8+wU8V6lEjte0D6NtiyvRGN9 IZbA== 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; bh=fcSSSD+M2AO6MV2Ri/rsvFnhNHTpnfeglSaDJbQwyY8=; b=LAEAiiLaMX+bn3PqH1k1Ka/OmEbIVLHXAilpYndjnQVr7qS2kz1IyqLMw8hWxi65eE Uy3ipU29IDaOrAFmvm2hvKsBM3/CMWSmzzkBLrn2gnZn2ZUWKx0Wf48uZGLfH2fVn9XP 4VozQ9o3pX86xFECMdWg3OqXRcqyoU+4zVhOQcCKyPxHIFQ9nag4uoM6DPsZQbPMAN1S tYi5yrnS53+NLi/SoKwD2wZlxPxQXacAJB3EGe5p7AOeL3iQYRs1fHfd/Y5qU25WrSHq 1zzqKg7+hGkJVOD7i9E0cybY4GqqcglEIbkJixyAHRAsMpCl2M7NxsgwauyXjFp/mRsK wiPA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id n12si11538927ejh.152.2020.06.09.13.32.31; Tue, 09 Jun 2020 13:32:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S2388983AbgFISVQ (ORCPT + 99 others); Tue, 9 Jun 2020 14:21:16 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:51740 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732358AbgFIRsl (ORCPT ); Tue, 9 Jun 2020 13:48:41 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: aratiu) with ESMTPSA id E95962A0752 From: Adrian Ratiu To: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-rockchip@lists.infradead.org, Laurent Pinchart Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Heiko Stuebner , Philippe CORNU , Yannick FERTRE , Jernej Skrabec , Andrzej Hajda , Jonas Karlman , linux-imx@nxp.com, kernel@collabora.com, linux-stm32@st-md-mailman.stormreply.com, Emil Velikov , Adrian Pop , Arnaud Ferraris Subject: [PATCH v9 08/11] drm: stm: dw-mipi-dsi: let the bridge handle the HW version check Date: Tue, 9 Jun 2020 20:49:56 +0300 Message-Id: <20200609174959.955926-9-adrian.ratiu@collabora.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200609174959.955926-1-adrian.ratiu@collabora.com> References: <20200609174959.955926-1-adrian.ratiu@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The stm mipi-dsi platform driver added a version test in commit fa6251a747b7 ("drm/stm: dsi: check hardware version") so that HW revisions other than v1.3x get rejected. The rockchip driver had no such check and just assumed register layouts are v1.3x compatible. Having such tests was a good idea because only v130/v131 layouts were supported at the time, however since adding multiple layout support in the bridge, the version is automatically checked for all drivers, compatible layouts get picked and unsupported HW is automatically rejected by the bridge, so there's no use keeping the test in the stm driver. The main reason prompting this change is that the stm driver test immediately disabled the peripheral clock after reading the version, making the bridge read version 0x0 immediately after in its own probe(), so we move the clock disabling after the bridge does the version test. Tested on STM32F769 and STM32MP1. Cc: linux-stm32@st-md-mailman.stormreply.com Cc: Emil Velikov Reported-by: Adrian Pop Tested-by: Adrian Pop Tested-by: Arnaud Ferraris Signed-off-by: Adrian Ratiu --- New in v6. --- drivers/gpu/drm/stm/dw_mipi_dsi-stm.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c b/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c index 2e1f2664495d0..45f67f8a5f6c8 100644 --- a/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c +++ b/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c @@ -396,26 +396,19 @@ static int dw_mipi_dsi_stm_probe(struct platform_device *pdev) goto err_dsi_probe; } + /* enable pclk so MMIO register values can be read, else reads == 0x0 */ ret = clk_prepare_enable(pclk); if (ret) { DRM_ERROR("%s: Failed to enable peripheral clk\n", __func__); goto err_dsi_probe; } - dsi->hw_version = dsi_read(dsi, DSI_VERSION) & VERSION; - clk_disable_unprepare(pclk); - - if (dsi->hw_version != HWVER_130 && dsi->hw_version != HWVER_131) { - ret = -ENODEV; - DRM_ERROR("bad dsi hardware version\n"); - goto err_dsi_probe; - } - dw_mipi_dsi_stm_plat_data.base = dsi->base; dw_mipi_dsi_stm_plat_data.priv_data = dsi; platform_set_drvdata(pdev, dsi); + /* setup the bridge, this will also access MMIO registers via regmap */ dsi->dsi = dw_mipi_dsi_probe(pdev, &dw_mipi_dsi_stm_plat_data); if (IS_ERR(dsi->dsi)) { ret = PTR_ERR(dsi->dsi); @@ -423,6 +416,11 @@ static int dw_mipi_dsi_stm_probe(struct platform_device *pdev) goto err_dsi_probe; } + dsi->hw_version = dsi_read(dsi, DSI_VERSION) & VERSION; + + /* initial MMIO config done, disable clk to save power */ + clk_disable_unprepare(pclk); + return 0; err_dsi_probe: -- 2.27.0