From patchwork Thu Jul 22 02:42:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 483855 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp6762895jao; Wed, 21 Jul 2021 19:44:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz2m0pr6aodJst1w/l1E0Hj1zGRcBxV5IUZuJmzuAwK4fsTYOkX2W66RiNbZFS6YA9x/qBY X-Received: by 2002:a02:90d0:: with SMTP id c16mr33479569jag.106.1626921864998; Wed, 21 Jul 2021 19:44:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626921864; cv=none; d=google.com; s=arc-20160816; b=ZSPma24o3GxefTE9Fzg60kMd50sq2R9TS1WVkKHIXCD/rguMoqLJSiNwBhqgRu3WJn 8iNh9QtIJ3wu242UIoALNOrQetSZsS0kjPTq3RJukjZqlfeqOl4BSmYyS1hFcFSe8EEK sTrmPZdSHKarpZNaxCVB/KBhZNUgFpryCsi9mAuYAvmii+gAW67KMkLBogPWXPyy0m+q bAmG9mtjFsNbmOk5rNTKRLxgaIvuhTP8cUlnMQWg1bwGJfosB4TD59mDiPJHqlcOTGxW IC3sXF6ehFMOlP2YHIudaEAsKHm+y1rk41/lxow0GCx1iZC06lVPT2d5eqWx9D+NpSNy QLHQ== 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=uhoriXxwuf3F+ep/Ax/y3D7yAyI4y+wKU+diem5MpTA=; b=aSajyf5m1Gg6pLIi1AUy+Dtotcg/IBj2CSeFN8i9VU3sKsgxF3qQ91qm2yzaDNeRVb a/XQoZ5yAksQIKCql3VAMjMwprJH2ZhyylFVB11RoPaG3JCX/L4OBli5dLOau7PKAnKa G9ONZOcvpRegDUggbXMN+42YOV+pEPXOxmiet8IBow4NcUjlzI9vhrsr57ZEns0/EmeR uhV1J205/5fwGHFwHdiLd3mXcGRp+KTyGlQDm6rFjocQarK34MZn0KcnmIVCgSlseQ6z NlkHjXytOAANtGZczlLL0AyWooK1otUa2vVWiOLzbqi3rrEjQvziLMEzUY/nQsFiPOcO JtCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZdBi2xPC; 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 z7si1358727ilq.32.2021.07.21.19.44.23; Wed, 21 Jul 2021 19:44:24 -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=ZdBi2xPC; 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 S230510AbhGVCDq (ORCPT + 7 others); Wed, 21 Jul 2021 22:03:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230514AbhGVCDo (ORCPT ); Wed, 21 Jul 2021 22:03:44 -0400 Received: from mail-oi1-x22f.google.com (mail-oi1-x22f.google.com [IPv6:2607:f8b0:4864:20::22f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFBF8C0617A1 for ; Wed, 21 Jul 2021 19:44:16 -0700 (PDT) Received: by mail-oi1-x22f.google.com with SMTP id s23so5057207oiw.12 for ; Wed, 21 Jul 2021 19:44: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=uhoriXxwuf3F+ep/Ax/y3D7yAyI4y+wKU+diem5MpTA=; b=ZdBi2xPCD1R0VnJO6SavUR7GyC1Qambh3gp4KeO0sbhvIYnOo6MPCsLJ6v1Cl5f4VA Anr4nQvC+6tFNE6CeRot/cI4AVIUFN2aHccBkHRvZ+JibvKCbHl2rH90fyEhMjZxegBq Q+S4kxj6APRr8EgUnH4xDmSNZXsIIT3w1SlYuTfeOvepP6A448tE5GTgO+Shk8sCkCyv HUZJeQhlMw3ByhEnOq/HHR84wSmAUArNiu55uIkyvPxtQVcMQ425L2jhoTc3hnfNvB7L hmmCCUij94G13agr+DrhgA7fq9PgnQ96VRlFlkAF5gXxg92nBKobk77Usgv+7rBUxLuP BeJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=uhoriXxwuf3F+ep/Ax/y3D7yAyI4y+wKU+diem5MpTA=; b=WJ59ygaD7oeJ20wk7mHwkWae+n/6wqzKAqNJTh0eM4i5SalpTbLIPjQ6Hq+JrtVwcR F9Fs4C2P2OUwFcmk+RIYFS8/4fjEpMARge1j9TuOuqBHnP9yrHVjLRMhAMdD57Oc9NlB bHrKY9a/Uu/ZgJhJvCODL19vqK1hQps6/bkCz8lRDfq0fngRGF2KTHRxppKdFIq0a+Zi BTWAVXYpePsr3ls4K0+Z6lEOPOkAHsi5gYU8ypBWBdI6vTDM2guowexMsnAN973TommE hZm8SO2RvRxWwTsBzVyyQGNAaOknRtbf6nLLa6x19KF+nxHwA2OTd70rCbNdJFsbQjxc Natw== X-Gm-Message-State: AOAM533AlK2eqRj/lbyYA/YjgYBSc8XDpYEjn9fjhTZFA8g5a1ZnCKMJ Wu+O1Lst/mYsClgeLvt7B63iZQ== X-Received: by 2002:a54:4102:: with SMTP id l2mr27057626oic.126.1626921856181; Wed, 21 Jul 2021 19:44:16 -0700 (PDT) Received: from localhost.localdomain (104-57-184-186.lightspeed.austtx.sbcglobal.net. [104.57.184.186]) by smtp.gmail.com with ESMTPSA id u18sm5346519oif.9.2021.07.21.19.44.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jul 2021 19:44: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 Subject: [PATCH 5/5] drm/msm/dp: Allow sub-regions to be specified in DT Date: Wed, 21 Jul 2021 19:42:27 -0700 Message-Id: <20210722024227.3313096-6-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210722024227.3313096-1-bjorn.andersson@linaro.org> References: <20210722024227.3313096-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. Signed-off-by: Bjorn Andersson --- drivers/gpu/drm/msm/dp/dp_parser.c | 49 +++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 11 deletions(-) -- 2.29.2 Reviewed-by: Stephen Boyd Reviewed-by: Abhinav Kumar diff --git a/drivers/gpu/drm/msm/dp/dp_parser.c b/drivers/gpu/drm/msm/dp/dp_parser.c index 1a10901ae574..fc8a6452f641 100644 --- a/drivers/gpu/drm/msm/dp/dp_parser.c +++ b/drivers/gpu/drm/msm/dp/dp_parser.c @@ -63,18 +63,45 @@ static int dp_parser_ctrl_res(struct dp_parser *parser) return PTR_ERR(dss->ahb); } - 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 = dp_ioremap(pdev, 1, &dss->aux_len); + if (IS_ERR(dss->aux)) { + /* + * 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) == -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 = dss->ahb + DP_DEFAULT_AUX_OFFSET; + dss->aux_len = DP_DEFAULT_AUX_SIZE; + dss->link = dss->ahb + DP_DEFAULT_LINK_OFFSET; + dss->link_len = DP_DEFAULT_LINK_SIZE; + dss->p0 = dss->ahb + DP_DEFAULT_P0_OFFSET; + dss->p0_len = DP_DEFAULT_P0_SIZE; + } else { + DRM_ERROR("unable to remap aux region: %pe\n", dss->aux); + return PTR_ERR(dss->aux); + } + } else { + dss->link = dp_ioremap(pdev, 2, &dss->link_len); + if (IS_ERR(dss->link)) { + DRM_ERROR("unable to remap link region: %pe\n", dss->link); + return PTR_ERR(dss->link); + } - dss->ahb_len = DP_DEFAULT_AHB_SIZE; - dss->aux = dss->ahb + DP_DEFAULT_AUX_OFFSET; - dss->aux_len = DP_DEFAULT_AUX_SIZE; - dss->link = dss->ahb + DP_DEFAULT_LINK_OFFSET; - dss->link_len = DP_DEFAULT_LINK_SIZE; - dss->p0 = dss->ahb + DP_DEFAULT_P0_OFFSET; - dss->p0_len = DP_DEFAULT_P0_SIZE; + dss->p0 = dp_ioremap(pdev, 3, &dss->p0_len); + if (IS_ERR(dss->p0)) { + DRM_ERROR("unable to remap p0 region: %pe\n", dss->p0); + return PTR_ERR(dss->p0); + } + } io->phy = devm_phy_get(&pdev->dev, "dp"); if (IS_ERR(io->phy))