From patchwork Wed Aug 25 22:25:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 502321 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp1022567jab; Wed, 25 Aug 2021 15:24:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxMzbV+pMmc4nZURWzT8u3Ia+Cxm1+fTqI0nU5O4Xfl01TsKrfzHfpW4Rpm9Jdr5C3+ivKA X-Received: by 2002:a05:6638:3048:: with SMTP id u8mr600570jak.91.1629930297489; Wed, 25 Aug 2021 15:24:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629930297; cv=none; d=google.com; s=arc-20160816; b=ggxjVIrNpiLtXsjWdc6o5QaP2VwrmPMf5je+5tbIj/ywqD8HEsQmdYj87djrjwldmB NAJsntV9TfsXrGxB8CWpvO9KhSa972bE4sKmF61O5BMFTV7yC0MOHbWie3NyGPj2qQFS NwM5JAE0xA4ps7x1zC1OzSRibKLWDC7enQCKWIHXMLwVd3SS+B7O5OxZLX+xx4DUhZce 8k41kf00Ersfy5g85oJOuKIPkH5lEorext6LvJ8vfSpG3P+p1vuIhHQU+Af+Kp33cAJs 4YHnYE27C2ouPvjQokIf4YioT/1dK/81WZR6O6lBDLFnyOm1nIwPjsLuJeDrkOqZLy0X Dmxg== 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=CHbqQ8fRCnVK3Idr6RNjSXsfz0ngq03w7usVXN+ejos=; b=Ejrt31SWsS42fS51ztWNnkwGb6wecuNnStihn9mIDJCGkLUrn+0yrzTxY6XPMOTqGI ShfQn0ja+2Su3A+dNNEfmKNxBF+08Syfhe+oSW85yXUt5YYXIpyNmEmmUzN1PiPG8WZT /zmt1Knf3bWUlthBXUNIHTF6c4F/HS2tAlbK6b+/wIx1JDKeF7//cSlI4n8ki2ULO80P J7ItBvb9nFiVTUF6OOAbzpZZwj8lemZr30c6SL2DCt8t3j1Zb7d5y3NyFZYukozGNH7y uIAXrevv2BnRmN10Iy5nCwxQBqa1XNGyDxOwOnEhlMxLYrR5iGupfMKWO9v8rvQh+GKY ztTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=y461vBwF; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-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 b9si1021393ion.34.2021.08.25.15.24.57; Wed, 25 Aug 2021 15:24:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-msm-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=y461vBwF; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-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 S233513AbhHYWZl (ORCPT + 16 others); Wed, 25 Aug 2021 18:25:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233242AbhHYWZg (ORCPT ); Wed, 25 Aug 2021 18:25:36 -0400 Received: from mail-oi1-x235.google.com (mail-oi1-x235.google.com [IPv6:2607:f8b0:4864:20::235]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C691C061796 for ; Wed, 25 Aug 2021 15:24:50 -0700 (PDT) Received: by mail-oi1-x235.google.com with SMTP id n27so1909255oij.0 for ; Wed, 25 Aug 2021 15:24:50 -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=CHbqQ8fRCnVK3Idr6RNjSXsfz0ngq03w7usVXN+ejos=; b=y461vBwFD8A1katLlj19BbJOG+zm5UUGx6Kv7yQ8JQH7MR93Lly/X/EiiBNPnjUmp/ ni4CuiYEZeMcJ0TdiNITkeSYdkhodx9vwZSHs49IBEQr9m2+xQE22Js2kJ65Nt2YUd46 jwY0GOyJ7Dim2KqwA6VBq0rdhS3LgazL9QiZrOMd3lkLKZI4INefz5UYCrq5ymi0z21E 3J3iYreIG7aNnv1fPvAsUaDWtyNwaMeyKsF3wmm51CXzv72FOoVIZrMdzRda4HEtS/i9 kgHJ/UZ9GYdx9gCFMfQxpMQNu8dsXo3JddGkMobI0J8xS19YTGWvPghZ3G/YloC0+M2Y pVFw== 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=CHbqQ8fRCnVK3Idr6RNjSXsfz0ngq03w7usVXN+ejos=; b=Q63MgugdTfXlRBFf3chu9LsIuBTuIczIeqlRvUKaMEnEqCB27l7iqW7OBQJ61gyb+W XNxU5RXzbrAz1KJya85bzT+qPvFGqxdvAJjqxTSql1NOlKxoQ/yBv3E3b3N0DZt7MsO2 39lPgL3igZ12jvhBcnLyk2N5HGWIjnVcjJQa4LHcwNzRPeDHW4c34qtxaPtLRh7oFb/S S3lGswIHaZbnZ2BfKPATXKbb8mYpTLfqu3GKkOhk7XOnw89Q4ByOPFS6o2AduKY0/wGM UJ0c8VF+w84UXLe5p5u9t2++r2uuEDpGfLugm+Ccb7FNHDPVPL3m+NNIBOl7QDccbvn8 LGHg== X-Gm-Message-State: AOAM5306X3jnvL2j13FTckzwYhbFZF+aPWRszpbDLto+OXhy0PVGKrdg gM1Zi2nk5n/WJEaV7LRk0EoIhQ== X-Received: by 2002:aca:e0d7:: with SMTP id x206mr8616473oig.64.1629930289816; Wed, 25 Aug 2021 15:24:49 -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 u19sm263721oiv.28.2021.08.25.15.24.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Aug 2021 15:24:49 -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 v2 5/5] drm/msm/dp: Allow sub-regions to be specified in DT Date: Wed, 25 Aug 2021 15:25:57 -0700 Message-Id: <20210825222557.1499104-6-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210825222557.1499104-1-bjorn.andersson@linaro.org> References: <20210825222557.1499104-1-bjorn.andersson@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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 v1: - Reworked on top of changes in 4/5 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 4a7dad86159f..a5412ddade53 100644 --- a/drivers/gpu/drm/msm/dp/dp_parser.c +++ b/drivers/gpu/drm/msm/dp/dp_parser.c @@ -53,18 +53,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))