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))