From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AA218C4332F for ; Fri, 25 Nov 2022 12:28:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=QiuPHQ8rJ0PTlHBJRQ7fxnDNfEF4BGxVSQX+rwU6cIA=; b=ZnejtPd92XYAf+ wcnMSzEB+mq5Uzc8Xh0fG7TPZI+9mObOm+XSqqTDB34zCWGBs5P3Xs/Lu+CgrvGSaf0QRlrJzui8Z Wt7eh5SSxLFACJ3XiESPzAi6POyUrTQ/T9vKw8AkuTwQZaovmMg4Mdx2VcDv7dB595ma+Gguf6MDh 84gfu5A/zzSDsO49TInx4xF6Q40NRqGSUd6u9Jb14urtWltm37FjV/5yKMCXAluZkTMfJ2ejhhs5n Kb5LZc9UaZzZpdUdDLwFSopHwx5YhiOAmm2SiQyRSOx1n6Oo8pLp0NXZQtfK6nA+G81HXc2pUScRj pHhF9FdbJdKTtT2LdTQw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oyXoA-00GPTv-MQ; Fri, 25 Nov 2022 12:27:54 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oyXo8-00GPSp-3K for linux-arm-kernel@lists.infradead.org; Fri, 25 Nov 2022 12:27:53 +0000 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 872B7B82A90; 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221125_042752_470660_6DFC7B07 X-CRM114-Status: GOOD ( 21.15 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel