From patchwork Fri Oct 1 17:43:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 515084 Delivered-To: patch@linaro.org Received: by 2002:a02:606e:0:0:0:0:0 with SMTP id d46csp1020318jaf; Fri, 1 Oct 2021 10:42:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyHs26zboHjhiBXP7h+E1fMlV7xCUjFNuXc7Ul2XhJfh7XKhblvURw8Ak1eDVSwDU2POZ4O X-Received: by 2002:a63:585c:: with SMTP id i28mr10622983pgm.70.1633110145223; Fri, 01 Oct 2021 10:42:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633110145; cv=none; d=google.com; s=arc-20160816; b=EcQMfSrCXCZRjeXVFEtgQDEcYeBxSRjzoCew0uY6yjesRH8WJ2JXeB4u05ML3NcRC8 65HqyK68vtuURvUYaFdwaH2/rChyLmbNZb+EiaM6fOyaeD1G7HsdDyrjm1lrkrJU7YSB 1/di22sp45o9rYqILdMwdQBQulQsMPNE+N9hyDb54WDCfd3uK5nddcr9lHMjMK46P1s4 x651WfvhKrtEk0lRRvNo2qXyLsXTFD7n+68Kzd96SRXoc4RYP+BgtO5BZaR8k9tX4yP4 1anepBV+AxmUqeKkAf9+YA5xBurIWtj4OJD5MMQZdfzYZHq/zRwkFTa4pNNtTkDRgiLR tNyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=1XfRi83lxmTXo1mPygdX7KTNkhcpA1zU3QO1+ROpzaM=; b=PD36A4JzA66i+q0aE9OzvSX6Cw7TLK69cCxwBh515uKXETaGQv/iJLl542ESyt7OBI aANPz187ow1TWFyqyHezte3CyFAt49UKjIfhX0rLzTXb330eL4xmns85Ptl6lsBlLJSr BCp4jdrfCDER5ZDdHFWBojPXQv+PekTVgw/kQ4XYC4gUGvgHzdJANDOfgKS1RvEfo/re i/osnGgFGpbBDWgGwM3a2v+c/FGEZbhbyFHPdsRuDunmcK9FUW8zlzHMEs9kaBC2hajx 5t9iSBN1UgedqNFX//f6aZnvAy1vM6gtbvM1VC8z4MvUm9Lbd1RuuMzCxEmuSKhOEqit 351w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="BjV/LAd5"; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f184si8092847pfb.67.2021.10.01.10.42.24; Fri, 01 Oct 2021 10:42:25 -0700 (PDT) Received-SPF: pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="BjV/LAd5"; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355399AbhJARoE (ORCPT + 7 others); Fri, 1 Oct 2021 13:44:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232084AbhJARoA (ORCPT ); Fri, 1 Oct 2021 13:44:00 -0400 Received: from mail-oi1-x22e.google.com (mail-oi1-x22e.google.com [IPv6:2607:f8b0:4864:20::22e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 223BFC061775 for ; Fri, 1 Oct 2021 10:42:16 -0700 (PDT) Received: by mail-oi1-x22e.google.com with SMTP id s24so12342202oij.8 for ; Fri, 01 Oct 2021 10:42:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1XfRi83lxmTXo1mPygdX7KTNkhcpA1zU3QO1+ROpzaM=; b=BjV/LAd5fMomk9CbkbZKRN1uPjTa7v3BRm90A2QbqxBtlPl4Ni9iDnE+c2Oqfgt8Y5 hAkvSt/rafwEPaawca5eo3p/IGZH6fiDeTm26ytEV3Zw+X1q2g50HOoldTXNwiRLnqy1 cGXIM8tSivoVPDrAPTJIiA1e6dttoq+LwXDZVX4pnxCX7nr9C2x97M/iQa+mWAMMzh/j gy+rxYYWOohi+7TL/Un3OYYdBmWZ9MGi2hD7uZOvWrcATewcmSq+4gDL7jhoLAg49ddH g5YG+b31MtqoI6ip7vhMTtf/PjdhwVfpIsy6MX+IVHU/SCAA1QKmXi3SHoB2DUKjGGPe 3v/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1XfRi83lxmTXo1mPygdX7KTNkhcpA1zU3QO1+ROpzaM=; b=f70i21Mu634zNwAa6zE+tIaX2xuN9/jjp2+w93BT7CDyvUvWsgmACUWcFosy7PwKDs PMMXnOlucWvcobUbfeLprKdkRsNww+QoSac5FS1qYPUocCluYe/ljZBhOT9AyFArq2Ez maIiUYaqgupa1nz/lYMLCVqPJ4xjU1P7+XTK6w9awRONx4MfNW26DElh11O6x/BrsY56 9oVNpaKsITsw7g4WkJvnU2dn6N06JkdwrH8yfsViK5qgbYVXe649vMC5vC9LE/3iXw8o DCnWvYqzFZ/QOr74v9ZZ2NG1YxqcPeyELcOhou3AoUyLFVjY0JF7tdBE1pz+GSjgglzj nVww== X-Gm-Message-State: AOAM533VRNNz404rj/JjcjISCInwn1uIH83Nw1yJZDlw6wJ2jWt0homG QQwDO79bK1E76yLWYMNRk6gokw== X-Received: by 2002:a54:410b:: with SMTP id l11mr4806256oic.74.1633110135506; Fri, 01 Oct 2021 10:42:15 -0700 (PDT) Received: from localhost.localdomain ([2600:1700:a0:3dc8:205:1bff:fec0:b9b3]) by smtp.gmail.com with ESMTPSA id u15sm1369264oon.35.2021.10.01.10.42.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Oct 2021 10:42:15 -0700 (PDT) From: Bjorn Andersson To: Rob Clark , Sean Paul , David Airlie , Daniel Vetter , Rob Herring , Stephen Boyd , Abhinav Kumar Cc: Kuogee Hsieh , Tanmay Shah , Chandan Uddaraju , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Rob Herring Subject: [PATCH v3 1/5] dt-bindings: msm/dp: Change reg definition Date: Fri, 1 Oct 2021 10:43:56 -0700 Message-Id: <20211001174400.981707-2-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20211001174400.981707-1-bjorn.andersson@linaro.org> References: <20211001174400.981707-1-bjorn.andersson@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org reg was defined as one region covering the entire DP block, but the memory map is actually split in 4 regions and obviously the size of these regions differs between platforms. Switch the reg to require that all four regions are specified instead. It is expected that the implementation will handle existing DTBs, even though the schema defines the new layout. Reviewed-by: Stephen Boyd Reviewed-by: Rob Herring Signed-off-by: Bjorn Andersson --- Changes since v2: - None .../bindings/display/msm/dp-controller.yaml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) -- 2.29.2 diff --git a/Documentation/devicetree/bindings/display/msm/dp-controller.yaml b/Documentation/devicetree/bindings/display/msm/dp-controller.yaml index d89b3c510c27..6bb424c21340 100644 --- a/Documentation/devicetree/bindings/display/msm/dp-controller.yaml +++ b/Documentation/devicetree/bindings/display/msm/dp-controller.yaml @@ -19,7 +19,12 @@ properties: - qcom,sc7180-dp reg: - maxItems: 1 + items: + - description: ahb register block + - description: aux register block + - description: link register block + - description: p0 register block + - description: p1 register block interrupts: maxItems: 1 @@ -99,7 +104,11 @@ examples: displayport-controller@ae90000 { compatible = "qcom,sc7180-dp"; - reg = <0xae90000 0x1400>; + reg = <0xae90000 0x200>, + <0xae90200 0x200>, + <0xae90400 0xc00>, + <0xae91000 0x400>, + <0xae91400 0x400>; interrupt-parent = <&mdss>; interrupts = <12>; clocks = <&dispcc DISP_CC_MDSS_AHB_CLK>, From patchwork Fri Oct 1 17:43:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 515085 Delivered-To: patch@linaro.org Received: by 2002:a02:606e:0:0:0:0:0 with SMTP id d46csp1020339jaf; Fri, 1 Oct 2021 10:42:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz9fcwbu4M1FVbSBNM3v7WRbzAN5u/gyZCM6OiZK1v4N9tzq9/UYJilzw5x0X04fxZVmWGs X-Received: by 2002:a17:90a:1904:: with SMTP id 4mr14627630pjg.190.1633110147393; Fri, 01 Oct 2021 10:42:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633110147; cv=none; d=google.com; s=arc-20160816; b=onf87vTSL6LUCLJgxGHNG1fDwBgnXEIH0J0lPLvDk3TtApZE8ljwOP9RAYrRE+XJBT iKTb56xFwWGllX9QCjokDSGDhbjm2TpVlPkWjylhAyATdu5DyQizu+80UHDsEtqCRaOS SAMHiuM1/WV++vPiqyZLrHSvqr6iYogX+elS2qFYwjYrgOZ5lALhGCPY6IKecLi7uHah c7xau8G1yfZ657lzeyMkTzWZcsv6RIDr2A6BRFnfDBZ0QWCR0qe7qOEjVlqMy6QAqbYm HKVhYdj185ZyDMGwGsDY3PO0Xc9Yl2JjhAaaqWdJfnVL//0/9nv8R+LflEqhes/RFuC2 lYHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=fHZ78g5puTcAagNMTBHlfiD9Kb8rN2BoNZJ9C5Btpns=; b=N2EuzKn0pZfSNccCFq8zq4qH4N2/u8RTWP35mTs/zNIYVuXt3cxkZt472BxuWWBuaf hEepI2gNdRfKuAA66V+h8LT8WZRvbjfATm2CbQH4aDyuyW0iEjyMcBd4OkujuH8vws5i x1Y/meM3spOf5/8wWY2j96wC1o60YvjRi5siJQp6ZJPXuFmDO57wamANKPuI0hQnzYZ6 iS/xhcvKiWxIcg/x7msb2JeaWGf5eUOP+WNB2Xw3LBFRu1D6NChX+eAbwDWLiwFlThub Jk1kx0eDSYK8Ws+QtUm0W66XXP5vSMas31sjIMRxWS2XT/6iYAjgNZBPcwDLzzwVP82G 7nQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vZl6euf7; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f184si8092847pfb.67.2021.10.01.10.42.27; Fri, 01 Oct 2021 10:42:27 -0700 (PDT) Received-SPF: pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vZl6euf7; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355430AbhJARoE (ORCPT + 7 others); Fri, 1 Oct 2021 13:44:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354427AbhJARoC (ORCPT ); Fri, 1 Oct 2021 13:44:02 -0400 Received: from mail-oi1-x233.google.com (mail-oi1-x233.google.com [IPv6:2607:f8b0:4864:20::233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18B0AC0613E5 for ; Fri, 1 Oct 2021 10:42:18 -0700 (PDT) Received: by mail-oi1-x233.google.com with SMTP id s24so12342337oij.8 for ; Fri, 01 Oct 2021 10:42:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=fHZ78g5puTcAagNMTBHlfiD9Kb8rN2BoNZJ9C5Btpns=; b=vZl6euf7vMDgy/HfZaLxtxe6MvUas1MczCtWiJT8KkHgnHTjRL3SCeemb1hOwETRn6 qoVlhSc5gsYa/fGKsaKFcNyW4AASsVLTYW80xhIdGqDTptv9CYVfktclQTOtAen5zT5I li+hHfHNuRduBoqpkPJgmmeyI8Kv6QgDY9rIFCA0OZwKpLdh3Pi/rYletrVRKH4LttT1 PwgJzBl2lYDfCPhNbuZ84zmW+ic25rv+ETfLMxqnr/00oKpJ7mTAJrASEhmlvUiFw+6f uG6gL8Xkbir3FSTXO1sAQ26j3D3iXEQRSsXt/BVZC+70wgUa9LrNYQcRuAfngwMdNO98 1zBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=fHZ78g5puTcAagNMTBHlfiD9Kb8rN2BoNZJ9C5Btpns=; b=FrhHW441e7KhdQ+Y85J9EhcqbCZeeNwsDbYTi+dkd730kf2Dgn/HcL4ExMG4GYsjgS aVjdIrlLz6+I7LhRmWy1VMOiWGbL8ShgWe70LEdCUEOvlVGobosOxPtVKn+d+x87YYpf ciUmAirp4CgvCpN1pU3Zv3JgQ30Tzz84Z8G2PHiUwO2exsc50CxLdYOB66qkKh57VxJO er1CbEGUeXPCoXKlfBmN+ISu/4YKjOz55QhLYeVorSa02RxCH+/w8mBMLDhcWnPy85VW kh0KLCm+ZRz081ZVFeSOMsjx+ylJrDvP5xA6LCNT8rL2fb75LcZrLQSDZCnTms/QQ0FQ r+1g== X-Gm-Message-State: AOAM5328S+6Tia1dhmo+98D50IsNayPVlC/yJSdPTGDWF/mPEClqjeY+ 3fTADH3ZOO1Of4T+/jO0kNusAA== X-Received: by 2002:a05:6808:2128:: with SMTP id r40mr4797532oiw.24.1633110137422; Fri, 01 Oct 2021 10:42:17 -0700 (PDT) Received: from localhost.localdomain ([2600:1700:a0:3dc8:205:1bff:fec0:b9b3]) by smtp.gmail.com with ESMTPSA id u15sm1369264oon.35.2021.10.01.10.42.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Oct 2021 10:42:16 -0700 (PDT) From: Bjorn Andersson To: Rob Clark , Sean Paul , David Airlie , Daniel Vetter , Rob Herring , Stephen Boyd , Abhinav Kumar Cc: Kuogee Hsieh , Tanmay Shah , Chandan Uddaraju , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 3/5] drm/msm/dp: Refactor ioremap wrapper Date: Fri, 1 Oct 2021 10:43:58 -0700 Message-Id: <20211001174400.981707-4-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20211001174400.981707-1-bjorn.andersson@linaro.org> References: <20211001174400.981707-1-bjorn.andersson@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org In order to deal with multiple memory ranges in the following commit change the ioremap wrapper to not poke directly into the dss_io_data struct. While at it, devm_ioremap_resource() already prints useful error messages on failure, so omit the unnecessary prints from the caller. Signed-off-by: Bjorn Andersson --- Changes since v2: - Switched to devm_platform_get_and_ioremap_resource() drivers/gpu/drm/msm/dp/dp_parser.c | 35 ++++++++++-------------------- drivers/gpu/drm/msm/dp/dp_parser.h | 2 +- 2 files changed, 12 insertions(+), 25 deletions(-) -- 2.29.2 diff --git a/drivers/gpu/drm/msm/dp/dp_parser.c b/drivers/gpu/drm/msm/dp/dp_parser.c index c064ced78278..c05ba1990218 100644 --- a/drivers/gpu/drm/msm/dp/dp_parser.c +++ b/drivers/gpu/drm/msm/dp/dp_parser.c @@ -19,40 +19,27 @@ static const struct dp_regulator_cfg sdm845_dp_reg_cfg = { }, }; -static int msm_dss_ioremap(struct platform_device *pdev, - struct dss_io_data *io_data) +static void __iomem *dp_ioremap(struct platform_device *pdev, int idx, size_t *len) { - struct resource *res = NULL; + struct resource *res; + void __iomem *base; - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - DRM_ERROR("%pS->%s: msm_dss_get_res failed\n", - __builtin_return_address(0), __func__); - return -ENODEV; - } - - io_data->len = (u32)resource_size(res); - io_data->base = devm_ioremap(&pdev->dev, res->start, io_data->len); - if (!io_data->base) { - DRM_ERROR("%pS->%s: ioremap failed\n", - __builtin_return_address(0), __func__); - return -EIO; - } + base = devm_platform_get_and_ioremap_resource(pdev, idx, &res); + if (!IS_ERR(base)) + *len = resource_size(res); - return 0; + return base; } static int dp_parser_ctrl_res(struct dp_parser *parser) { - int rc = 0; struct platform_device *pdev = parser->pdev; struct dp_io *io = &parser->io; + struct dss_io_data *dss = &io->dp_controller; - rc = msm_dss_ioremap(pdev, &io->dp_controller); - if (rc) { - DRM_ERROR("unable to remap dp io resources, rc=%d\n", rc); - return rc; - } + dss->base = dp_ioremap(pdev, 0, &dss->len); + if (IS_ERR(dss->base)) + return PTR_ERR(dss->base); io->phy = devm_phy_get(&pdev->dev, "dp"); if (IS_ERR(io->phy)) diff --git a/drivers/gpu/drm/msm/dp/dp_parser.h b/drivers/gpu/drm/msm/dp/dp_parser.h index 34b49628bbaf..dc62e70b1640 100644 --- a/drivers/gpu/drm/msm/dp/dp_parser.h +++ b/drivers/gpu/drm/msm/dp/dp_parser.h @@ -26,7 +26,7 @@ enum dp_pm_type { }; struct dss_io_data { - u32 len; + size_t len; void __iomem *base; }; From patchwork Fri Oct 1 17:44:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 515087 Delivered-To: patch@linaro.org Received: by 2002:a02:606e:0:0:0:0:0 with SMTP id d46csp1020384jaf; Fri, 1 Oct 2021 10:42:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxm3RgeLF8QrQw5sh+Veqm7jx+gxe0mOaEWUSWmI/TLGWTkCaAFumwL7AaK8tvq5xjHwF09 X-Received: by 2002:a17:902:680d:b0:13e:8068:2286 with SMTP id h13-20020a170902680d00b0013e80682286mr5875806plk.12.1633110149709; Fri, 01 Oct 2021 10:42:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633110149; cv=none; d=google.com; s=arc-20160816; b=mFRVI3bpY6VEuuJdNaNk9Rzid3LE4ndoetIqp9Nn9G2/y/UpyshT/AN2WCpv/DTF7N b/5gxM7t3AjCLNgc4/wID/WUgtvxo2R7qxoMZbkRKpIc1R61pBKWKTw/2S3QntWV1QLj GZM5sbAOE8ggbl6faHpinAnArxtV3cYWTTiGSopuZ3U5INPHYkKgcmirgLiYkmZ5kQAX ykdCbg5ivoc78jI2Ijen4oQQxRAt4dMtS9evYR5mFWBIWSgrdqhGwMtyBZWsy7SMX40E jf30kZbkoQjL5hvfLNxT/HIa7cmfaJM+ptWKfYjIm0bnRrdwWz0sGMQtMmsypvSN4h4i lz1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=RuDmOgPfw7NqoydBG9DQd34tvaItfS8ZKq0v6QDg/FY=; b=aRYckMpjokf4+5C8MWsW0miL9HmjewabPGb8m64sH9rxeWuaQobNJLefTvJLIp3IZ8 VDW6jZwPNt+Igxz4toMoN/+8qtoODRUSIkOn/pPXJ9mrQR+3Tvm6X2dn50YTpYV0L6Y4 s7N2r5uCCZraNK3BVV3NEJ5gLR+Ge2D4odfJskuSknh5J4ODBKwYS9GE++0F3BFWPEVm iWKGHOTeUcOhg8zAoiNVlx59Uh1+tujx+8kKHkD+sF5+vSe3RpIMAVxOj7PMT9QtutE4 MhHC0ff0bMNk/QfkN+MCjfP0BKH7xPqoNbKazOBIChZgOeFnzmn+jET4AeoEGndkI7sy E8nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XLFHevB6; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f184si8092847pfb.67.2021.10.01.10.42.29; Fri, 01 Oct 2021 10:42:29 -0700 (PDT) Received-SPF: pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XLFHevB6; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355452AbhJARoL (ORCPT + 7 others); Fri, 1 Oct 2021 13:44:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355427AbhJARoE (ORCPT ); Fri, 1 Oct 2021 13:44:04 -0400 Received: from mail-ot1-x32c.google.com (mail-ot1-x32c.google.com [IPv6:2607:f8b0:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57BDBC06177E for ; Fri, 1 Oct 2021 10:42:20 -0700 (PDT) Received: by mail-ot1-x32c.google.com with SMTP id h9-20020a9d2f09000000b005453f95356cso12445250otb.11 for ; Fri, 01 Oct 2021 10:42:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=RuDmOgPfw7NqoydBG9DQd34tvaItfS8ZKq0v6QDg/FY=; b=XLFHevB6WrVgB1k383+Eu2L6o1qbyh58b6SA8R/5BAw8TC7lyqv5IHXHTh7gCmKLsD JtQJBcH+5/FlXZLnaln8on35bnRb9B7YlTtjle+vzTyxT191syLSAlrcBtl/HONyMZ5L OjhVF911PC8tk7jBqUUWTHpKZ2JcO4pvyNFhhZFz66ffzBIJdteqYwJbMYHqHhgrBR5/ mINS3p9w6Jerb7cqf9Q6f2tv6/iw0CxHxcDrldyOOyDlZfSqqEDcgp/SjJV2EvHNzoD8 Fn2r1P+gRCnNtt6UB9Edv2Guq8nw48v+1tcem18VUIAqkCcywLDGzRjzLEEBavkmiOaq j97A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RuDmOgPfw7NqoydBG9DQd34tvaItfS8ZKq0v6QDg/FY=; b=SCBhkP+nb5gi+0lmv8ovZAX0GqUjciN/T05nzt6d3VUpM2IHT9TLqITZtsMJxyG7Pw NuU+MBpkzvQWqxa5hniAe8I2wx81hxsRzmqBF+c/O2ZaNpkVPZFKScTE1ZwgMrmEab49 fqL5sAX7Hu9uvfJnwWchUbtsMO0RTc0H/afAjNO4tI2x1IdmGv1MhJz/gvhnzktYdClA XzElvPDnyMq6N2k7CxQq8gJ1ZNu+Xmr7bIxdCjb3sxAwCzBdWKtPguSwi1FP9NEOcSaZ 7yTlmyZnUt51ngLp4AuPofl6b5e1vCisWzMnw+hFcFKKLsIk9WL5KfH4QC4CAUT2KIO7 zfQQ== X-Gm-Message-State: AOAM533ohquWvGEzs2cpTT4e63hQtewPR6BacQM85baEeM7+FD2kj4Tx mhkcDm6Vb0pUXIAnYd+TDWwOtQ== X-Received: by 2002:a05:6830:310c:: with SMTP id b12mr11691000ots.193.1633110139673; Fri, 01 Oct 2021 10:42:19 -0700 (PDT) Received: from localhost.localdomain ([2600:1700:a0:3dc8:205:1bff:fec0:b9b3]) by smtp.gmail.com with ESMTPSA id u15sm1369264oon.35.2021.10.01.10.42.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Oct 2021 10:42:19 -0700 (PDT) From: Bjorn Andersson To: Rob Clark , Sean Paul , David Airlie , Daniel Vetter , Rob Herring , Stephen Boyd , Abhinav Kumar Cc: Kuogee Hsieh , Tanmay Shah , Chandan Uddaraju , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 5/5] drm/msm/dp: Allow sub-regions to be specified in DT Date: Fri, 1 Oct 2021 10:44:00 -0700 Message-Id: <20211001174400.981707-6-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20211001174400.981707-1-bjorn.andersson@linaro.org> References: <20211001174400.981707-1-bjorn.andersson@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Not all platforms has P0 at an offset of 0x1000 from the base address, so add support for specifying each sub-region in DT. The code falls back to the predefined offsets in the case that only a single reg is specified, in order to support existing DT. Reviewed-by: Stephen Boyd Reviewed-by: Abhinav Kumar Signed-off-by: Bjorn Andersson --- Changes since v2: - None drivers/gpu/drm/msm/dp/dp_parser.c | 49 +++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 11 deletions(-) -- 2.29.2 diff --git a/drivers/gpu/drm/msm/dp/dp_parser.c b/drivers/gpu/drm/msm/dp/dp_parser.c index 1f084b2b5bd3..4d6e047f803d 100644 --- a/drivers/gpu/drm/msm/dp/dp_parser.c +++ b/drivers/gpu/drm/msm/dp/dp_parser.c @@ -50,18 +50,45 @@ static int dp_parser_ctrl_res(struct dp_parser *parser) if (IS_ERR(dss->ahb.base)) return PTR_ERR(dss->ahb.base); - if (dss->ahb.len < DP_DEFAULT_P0_OFFSET + DP_DEFAULT_P0_SIZE) { - DRM_ERROR("legacy memory region not large enough\n"); - return -EINVAL; - } + dss->aux.base = dp_ioremap(pdev, 1, &dss->aux.len); + if (IS_ERR(dss->aux.base)) { + /* + * The initial binding had a single reg, but in order to + * support variation in the sub-region sizes this was split. + * dp_ioremap() will fail with -ENODEV here if only a single + * reg is specified, so fill in the sub-region offsets and + * lengths based on this single region. + */ + if (PTR_ERR(dss->aux.base) == -ENODEV) { + if (dss->ahb.len < DP_DEFAULT_P0_OFFSET + DP_DEFAULT_P0_SIZE) { + DRM_ERROR("legacy memory region not large enough\n"); + return -EINVAL; + } + + dss->ahb.len = DP_DEFAULT_AHB_SIZE; + dss->aux.base = dss->ahb.base + DP_DEFAULT_AUX_OFFSET; + dss->aux.len = DP_DEFAULT_AUX_SIZE; + dss->link.base = dss->ahb.base + DP_DEFAULT_LINK_OFFSET; + dss->link.len = DP_DEFAULT_LINK_SIZE; + dss->p0.base = dss->ahb.base + DP_DEFAULT_P0_OFFSET; + dss->p0.len = DP_DEFAULT_P0_SIZE; + } else { + DRM_ERROR("unable to remap aux region: %pe\n", dss->aux.base); + return PTR_ERR(dss->aux.base); + } + } else { + dss->link.base = dp_ioremap(pdev, 2, &dss->link.len); + if (IS_ERR(dss->link.base)) { + DRM_ERROR("unable to remap link region: %pe\n", dss->link.base); + return PTR_ERR(dss->link.base); + } - dss->ahb.len = DP_DEFAULT_AHB_SIZE; - dss->aux.base = dss->ahb.base + DP_DEFAULT_AUX_OFFSET; - dss->aux.len = DP_DEFAULT_AUX_SIZE; - dss->link.base = dss->ahb.base + DP_DEFAULT_LINK_OFFSET; - dss->link.len = DP_DEFAULT_LINK_SIZE; - dss->p0.base = dss->ahb.base + DP_DEFAULT_P0_OFFSET; - dss->p0.len = DP_DEFAULT_P0_SIZE; + dss->p0.base = dp_ioremap(pdev, 3, &dss->p0.len); + if (IS_ERR(dss->p0.base)) { + DRM_ERROR("unable to remap p0 region: %pe\n", dss->p0.base); + return PTR_ERR(dss->p0.base); + } + } io->phy = devm_phy_get(&pdev->dev, "dp"); if (IS_ERR(io->phy))