All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matt Ranostay <mranostay@ti.com>
To: <linux-pci@vger.kernel.org>, <linux-arm-kernel@lists.infradead.org>
Cc: <tjoseph@cadence.com>, <vigneshr@ti.com>, <kishon@ti.com>,
	Matt Ranostay <mranostay@ti.com>
Subject: [PATCH 3/3] PCI: j721e: Add warnings on num-lanes misconfiguration
Date: Fri, 9 Sep 2022 13:16:07 -0700	[thread overview]
Message-ID: <20220909201607.3835-4-mranostay@ti.com> (raw)
In-Reply-To: <20220909201607.3835-1-mranostay@ti.com>

Added dev_warn messages to alert of devicetree misconfigurations
for incorrect num-lanes setting, or the lack of one being defined.

Cc: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Matt Ranostay <mranostay@ti.com>
Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
---
 drivers/pci/controller/cadence/pci-j721e.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/controller/cadence/pci-j721e.c b/drivers/pci/controller/cadence/pci-j721e.c
index 4c6c677fab54..4f0464371e80 100644
--- a/drivers/pci/controller/cadence/pci-j721e.c
+++ b/drivers/pci/controller/cadence/pci-j721e.c
@@ -438,8 +438,17 @@ 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 > data->max_lanes)
+	if (ret) {
+		dev_warn(dev, "no num-lanes defined, defaulting to 1\n");
 		num_lanes = 1;
+	}
+
+	if (num_lanes > data->max_lanes) {
+		dev_warn(dev, "defined num-lanes %d is greater than the "
+			      "allowed maximum of %d, defaulting to 1\n",
+			      num_lanes, data->max_lanes);
+		num_lanes = 1;
+	}
 	pcie->num_lanes = num_lanes;
 
 	if (dma_set_mask_and_coherent(dev, DMA_BIT_MASK(48)))
-- 
2.37.2


WARNING: multiple messages have this Message-ID (diff)
From: Matt Ranostay <mranostay@ti.com>
To: <linux-pci@vger.kernel.org>, <linux-arm-kernel@lists.infradead.org>
Cc: <tjoseph@cadence.com>, <vigneshr@ti.com>, <kishon@ti.com>,
	Matt Ranostay <mranostay@ti.com>
Subject: [PATCH 3/3] PCI: j721e: Add warnings on num-lanes misconfiguration
Date: Fri, 9 Sep 2022 13:16:07 -0700	[thread overview]
Message-ID: <20220909201607.3835-4-mranostay@ti.com> (raw)
In-Reply-To: <20220909201607.3835-1-mranostay@ti.com>

Added dev_warn messages to alert of devicetree misconfigurations
for incorrect num-lanes setting, or the lack of one being defined.

Cc: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Matt Ranostay <mranostay@ti.com>
Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
---
 drivers/pci/controller/cadence/pci-j721e.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/controller/cadence/pci-j721e.c b/drivers/pci/controller/cadence/pci-j721e.c
index 4c6c677fab54..4f0464371e80 100644
--- a/drivers/pci/controller/cadence/pci-j721e.c
+++ b/drivers/pci/controller/cadence/pci-j721e.c
@@ -438,8 +438,17 @@ 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 > data->max_lanes)
+	if (ret) {
+		dev_warn(dev, "no num-lanes defined, defaulting to 1\n");
 		num_lanes = 1;
+	}
+
+	if (num_lanes > data->max_lanes) {
+		dev_warn(dev, "defined num-lanes %d is greater than the "
+			      "allowed maximum of %d, defaulting to 1\n",
+			      num_lanes, data->max_lanes);
+		num_lanes = 1;
+	}
 	pcie->num_lanes = num_lanes;
 
 	if (dma_set_mask_and_coherent(dev, DMA_BIT_MASK(48)))
-- 
2.37.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2022-09-09 20:16 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-09 20:16 [PATCH 0/3] PCI: add 4x lane support for pci-j721e controllers Matt Ranostay
2022-09-09 20:16 ` Matt Ranostay
2022-09-09 20:16 ` [PATCH 1/3] PCI: j721e: Add PCIe 4x lane selection support Matt Ranostay
2022-09-09 20:16   ` Matt Ranostay
2022-09-23  9:20   ` Kishon Vijay Abraham I
2022-09-23  9:20     ` Kishon Vijay Abraham I
2022-09-24 23:21     ` Matt Ranostay
2022-09-24 23:21       ` Matt Ranostay
2022-09-09 20:16 ` [PATCH 2/3] PCI: j721e: Add per platform maximum lane settings Matt Ranostay
2022-09-09 20:16   ` Matt Ranostay
2022-09-09 20:16 ` Matt Ranostay [this message]
2022-09-09 20:16   ` [PATCH 3/3] PCI: j721e: Add warnings on num-lanes misconfiguration Matt Ranostay

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220909201607.3835-4-mranostay@ti.com \
    --to=mranostay@ti.com \
    --cc=kishon@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=tjoseph@cadence.com \
    --cc=vigneshr@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.