Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp10448697rwb; Fri, 25 Nov 2022 04:52:46 -0800 (PST) X-Google-Smtp-Source: AA0mqf6ZmQ1zi4YJujLwHZcjjCmiyy98y1dKWRnfKmaFpjgOqjIWBYCTfuv9FuSzh4GfD16YBKI4 X-Received: by 2002:aa7:d78a:0:b0:46a:610:7fa5 with SMTP id s10-20020aa7d78a000000b0046a06107fa5mr14467174edq.188.1669380766339; Fri, 25 Nov 2022 04:52:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669380766; cv=none; d=google.com; s=arc-20160816; b=QRyxiOWNRAjG7ltw6g6Fe4Hs/nZM6QFvYC5IL3cYLHvEIIELviuOih6lspCd6TDfHz QKEZ0a6zIiTWlJicvrcZl+u05PX0FDQYeZDgRyh6Tkwm9Zf23VQD6vulkd9r2Zx1w+WP 9ueFmw9Y7Eo2gHzGUiDtbqePzJOmO91qVTvvxEFhIMT1l9zWfw3N/fSh/kn6dEpkBWuI VJA52mfeVTHAN3y4pY1kVigJe+L+SOwrDU1tPCzi0kPLR+DOSXtkmmbsY+cS6EfRNN4l EGVUHZIMoFa9t4HuMywmIYBZogT3iTweoYb18uV8oy4V0//5bZO2DlXDz52H6FO7dajc eDEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=N+Ljgm0pP099vxc0TUcbp88bFoDpQ/rk5QtKyvKxdW8=; b=tQJzG0lerYqT88Yxk+S5fVQy2tODuiz8iQ29B59IyxbilS96Qxh7eAmC3RS/Lu7s9/ latoRtqN5x905ArXjqvm7q2P3Z67EUTf4uQ/HST3Ao/dRqbGzIF/X8wSKZReAEQld3E/ 5lW2Xyotsao1JgJM6gMsdmrg0bPKZjIK5ycLItwl7hszMGpmckRQNcJmHCKhvqXI5nxH Y8ASaUOE9ces9VnpzLbmk47ZEfkcAYLbxU9YZcpzaAwgv3L5VbDQ3KiClj76JR+PlpQt Pl51Th+xNOumuIyqIPNOAP6EOWi3Cem59u5gNPw/Mpf4gFiYl3Yh27zGxGtAiJap6a9i ossA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ZtGpgHJf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i20-20020aa7dd14000000b00461dca37cd0si3129862edv.126.2022.11.25.04.52.22; Fri, 25 Nov 2022 04:52:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ZtGpgHJf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229617AbiKYM1y (ORCPT + 86 others); Fri, 25 Nov 2022 07:27:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229491AbiKYM1x (ORCPT ); Fri, 25 Nov 2022 07:27:53 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F20801DDFB; Fri, 25 Nov 2022 04:27:51 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A4C2CB82A92; Fri, 25 Nov 2022 12:27:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1B504C433D6; Fri, 25 Nov 2022 12:27:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669379269; bh=PVmnxrUgHUfQVAVze+UCc6oLNX2A8iRf2P5L11tfoN8=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=ZtGpgHJfPzraVTm7xpYBum+KkpJ5ZEY5ZfvYqxbeKXjclEHVuEjPPKJ+b7ZlM7adC 5IiEbHqztwFnRAjYQmHerigmds9daLNuTpkNf//6+M1a+XszUjkOTZtykeIgsepRH+ RIoJoMZsq+lEzehJ0Pc2CAkt+5YLlUL9U544tSyKr1Z8Y+dqo5S01/UrxOqAlBrS1T AoK13jv/9IYY3xqTduLI5SrqyAHxEbYyQdJCZ1hhWY/oa4kxJjDV1jObVor2s0YU5w dpy+dfZK1ZPvZU5WajvzwV0OpzTdNmpm/Pk1iH9lKSolD6G2qGesbpO15upwrh3+Dg i/oVc+nK/O0Kw== Message-ID: Date: Fri, 25 Nov 2022 14:27:43 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [PATCH v7 2/5] PCI: j721e: Add per platform maximum lane settings Content-Language: en-US To: Matt Ranostay , lpieralisi@kernel.org, robh@kernel.org, kw@linux.com, bhelgaas@google.com, krzysztof.kozlowski@linaro.org, vigneshr@ti.com, tjoseph@cadence.com, sergio.paracuellos@gmail.com, pthombar@cadence.com, linux-pci@vger.kernel.org Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org References: <20221124081221.1206167-1-mranostay@ti.com> <20221124081221.1206167-3-mranostay@ti.com> From: Roger Quadros In-Reply-To: <20221124081221.1206167-3-mranostay@ti.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Matt, On 24/11/2022 10:12, Matt Ranostay wrote: > Various platforms have different maximum amount of lanes that can be > selected. Add max_lanes to struct j721e_pcie to allow for detection of this > which is needed to calculate the needed bitmask size for the possible lane > count. > > Signed-off-by: Matt Ranostay > Signed-off-by: Vignesh Raghavendra > --- > drivers/pci/controller/cadence/pci-j721e.c | 11 ++++++++--- > 1 file changed, 8 insertions(+), 3 deletions(-) > > diff --git a/drivers/pci/controller/cadence/pci-j721e.c b/drivers/pci/controller/cadence/pci-j721e.c > index cc83a8925ce0..8990f58d64d5 100644 > --- a/drivers/pci/controller/cadence/pci-j721e.c > +++ b/drivers/pci/controller/cadence/pci-j721e.c > @@ -47,8 +47,6 @@ enum link_status { > > #define GENERATION_SEL_MASK GENMASK(1, 0) > > -#define MAX_LANES 2 > - > struct j721e_pcie { > struct cdns_pcie *cdns_pcie; > struct clk *refclk; > @@ -71,6 +69,7 @@ struct j721e_pcie_data { > unsigned int quirk_disable_flr:1; > u32 linkdown_irq_regfield; > unsigned int byte_access_allowed:1; > + unsigned int max_lanes; > }; > > static inline u32 j721e_pcie_user_readl(struct j721e_pcie *pcie, u32 offset) > @@ -290,11 +289,13 @@ static const struct j721e_pcie_data j721e_pcie_rc_data = { > .quirk_retrain_flag = true, > .byte_access_allowed = false, > .linkdown_irq_regfield = LINK_DOWN, > + .max_lanes = 2, > }; > > static const struct j721e_pcie_data j721e_pcie_ep_data = { > .mode = PCI_MODE_EP, > .linkdown_irq_regfield = LINK_DOWN, > + .max_lanes = 2, > }; > > static const struct j721e_pcie_data j7200_pcie_rc_data = { > @@ -302,23 +303,27 @@ static const struct j721e_pcie_data j7200_pcie_rc_data = { > .quirk_detect_quiet_flag = true, > .linkdown_irq_regfield = J7200_LINK_DOWN, > .byte_access_allowed = true, > + .max_lanes = 2, > }; > > static const struct j721e_pcie_data j7200_pcie_ep_data = { > .mode = PCI_MODE_EP, > .quirk_detect_quiet_flag = true, > .quirk_disable_flr = true, > + .max_lanes = 2, > }; > > static const struct j721e_pcie_data am64_pcie_rc_data = { > .mode = PCI_MODE_RC, > .linkdown_irq_regfield = J7200_LINK_DOWN, > .byte_access_allowed = true, > + .max_lanes = 1, > }; > > static const struct j721e_pcie_data am64_pcie_ep_data = { > .mode = PCI_MODE_EP, > .linkdown_irq_regfield = J7200_LINK_DOWN, > + .max_lanes = 1, > }; > > static const struct of_device_id of_j721e_pcie_match[] = { > @@ -432,7 +437,7 @@ static int j721e_pcie_probe(struct platform_device *pdev) > pcie->user_cfg_base = base; > > ret = of_property_read_u32(node, "num-lanes", &num_lanes); > - if (ret || num_lanes > MAX_LANES) > + if (ret || num_lanes > data->max_lanes) > num_lanes = 1; num_lanes = data->max_lanes; ? Should we also print an error message saying that invalid num-lanes was supplied in device tree? Is it better to error out of probe? > pcie->num_lanes = num_lanes; > cheers, -roger