[PATCH] ramips: backport upstream mt762x PCIe driver error log fixes

Shiji Yang yangshiji66 at outlook.com
Wed Jun 21 09:32:32 PDT 2023


From: Shiji Yang <yangshiji66 at qq.com>

These patches silence some mt762x PCIe driver error messeges by removing
the useless debugging codes and replacing incorrectly used 'dev_err()'
with 'dev_info()':

PCI: mt7621: Use dev_info() to log PCIe card detection [1]
mips: pci-mt7620: do not print NFTS register value as error log [2]
mips: pci-mt7620: use dev_info() to log PCIe device detection result [3]

Patch [1] has already been merged into the Linux 6.3 branch. Patches [2] and
[3] have been merged into the "mips-next" tree, and they will be part of the
upcoming Linux 6.5.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=v6.4-rc7&id=50233e105a0332ec0f3bc83180c416e6b200471e
[2] https://git.kernel.org/pub/scm/linux/kernel/git/mips/linux.git/commit/?id=9f9a035e6156a57d9da062b26d2a48d031744a1e
[3] https://git.kernel.org/pub/scm/linux/kernel/git/mips/linux.git/commit/?id=89ec9bbe60b61cc6ae3eddd6d4f43e128f8a88de

Signed-off-by: Shiji Yang <yangshiji66 at qq.com>
---
 ...do-not-print-NFTS-register-value-as-.patch | 32 +++++++++++++++
 ...use-dev_info-to-log-PCIe-device-dete.patch | 39 +++++++++++++++++++
 ...-dev_info-to-log-PCIe-card-detection.patch | 31 +++++++++++++++
 3 files changed, 102 insertions(+)
 create mode 100644 target/linux/ramips/patches-5.15/010-v6.5-01-mips-pci-mt7620-do-not-print-NFTS-register-value-as-.patch
 create mode 100644 target/linux/ramips/patches-5.15/010-v6.5-02-mips-pci-mt7620-use-dev_info-to-log-PCIe-device-dete.patch
 create mode 100644 target/linux/ramips/patches-5.15/110-v6.4-PCI-mt7621-Use-dev_info-to-log-PCIe-card-detection.patch

diff --git a/target/linux/ramips/patches-5.15/010-v6.5-01-mips-pci-mt7620-do-not-print-NFTS-register-value-as-.patch b/target/linux/ramips/patches-5.15/010-v6.5-01-mips-pci-mt7620-do-not-print-NFTS-register-value-as-.patch
new file mode 100644
index 0000000000..704e861b82
--- /dev/null
+++ b/target/linux/ramips/patches-5.15/010-v6.5-01-mips-pci-mt7620-do-not-print-NFTS-register-value-as-.patch
@@ -0,0 +1,32 @@
+From 9f9a035e6156a57d9da062b26d2a48d031744a1e Mon Sep 17 00:00:00 2001
+From: Shiji Yang <yangshiji66 at outlook.com>
+Date: Tue, 20 Jun 2023 18:43:22 +0800
+Subject: [PATCH 1/2] mips: pci-mt7620: do not print NFTS register value as
+ error log
+
+These codes are used to read NFTS_TIMEOUT_DELAY register value and
+write it into kernel log after writing the register. they are only
+used for debugging during driver development, so there is no need
+to keep them now.
+
+Tested on MT7628AN router Motorola MWR03.
+
+Signed-off-by: Shiji Yang <yangshiji66 at outlook.com>
+Reviewed-by: Sergio Paracuellos <sergio.paracuellos at gmail.com>
+Signed-off-by: Thomas Bogendoerfer <tsbogend at alpha.franken.de>
+---
+ arch/mips/pci/pci-mt7620.c | 3 ---
+ 1 file changed, 3 deletions(-)
+
+--- a/arch/mips/pci/pci-mt7620.c
++++ b/arch/mips/pci/pci-mt7620.c
+@@ -274,9 +274,6 @@ static int mt7628_pci_hw_init(struct pla
+ 	val |= 0x50 << 8;
+ 	pci_config_write(NULL, 0, 0x70c, 4, val);
+ 
+-	pci_config_read(NULL, 0, 0x70c, 4, &val);
+-	dev_err(&pdev->dev, "Port 0 N_FTS = %x\n", (unsigned int) val);
+-
+ 	return 0;
+ }
+ 
diff --git a/target/linux/ramips/patches-5.15/010-v6.5-02-mips-pci-mt7620-use-dev_info-to-log-PCIe-device-dete.patch b/target/linux/ramips/patches-5.15/010-v6.5-02-mips-pci-mt7620-use-dev_info-to-log-PCIe-device-dete.patch
new file mode 100644
index 0000000000..5898a110ea
--- /dev/null
+++ b/target/linux/ramips/patches-5.15/010-v6.5-02-mips-pci-mt7620-use-dev_info-to-log-PCIe-device-dete.patch
@@ -0,0 +1,39 @@
+From 89ec9bbe60b61cc6ae3eddd6d4f43e128f8a88de Mon Sep 17 00:00:00 2001
+From: Shiji Yang <yangshiji66 at outlook.com>
+Date: Tue, 20 Jun 2023 18:43:23 +0800
+Subject: [PATCH 2/2] mips: pci-mt7620: use dev_info() to log PCIe device
+ detection result
+
+Usually, We only need to print the error log when there is a PCIe card but
+initialization fails. Whether the driver finds the PCIe card or not is the
+expected behavior. So it's better to log these information with dev_info().
+
+Tested on MT7628AN router Motorola MWR03.
+
+Signed-off-by: Shiji Yang <yangshiji66 at outlook.com>
+Reviewed-by: Sergio Paracuellos <sergio.paracuellos at gmail.com>
+Signed-off-by: Thomas Bogendoerfer <tsbogend at alpha.franken.de>
+---
+ arch/mips/pci/pci-mt7620.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/arch/mips/pci/pci-mt7620.c
++++ b/arch/mips/pci/pci-mt7620.c
+@@ -331,7 +331,7 @@ static int mt7620_pci_probe(struct platf
+ 		rt_sysc_m32(RALINK_PCIE0_CLK_EN, 0, RALINK_CLKCFG1);
+ 		if (ralink_soc == MT762X_SOC_MT7620A)
+ 			rt_sysc_m32(LC_CKDRVPD, PDRV_SW_SET, PPLL_DRV);
+-		dev_err(&pdev->dev, "PCIE0 no card, disable it(RST&CLK)\n");
++		dev_info(&pdev->dev, "PCIE0 no card, disable it(RST&CLK)\n");
+ 		return -1;
+ 	}
+ 
+@@ -374,7 +374,7 @@ int pcibios_map_irq(const struct pci_dev
+ 			dev->bus->number, slot);
+ 		return 0;
+ 	}
+-	dev_err(&dev->dev, "card - bus=0x%x, slot = 0x%x irq=%d\n",
++	dev_info(&dev->dev, "card - bus=0x%x, slot = 0x%x irq=%d\n",
+ 		dev->bus->number, slot, irq);
+ 
+ 	/* configure the cache line size to 0x14 */
diff --git a/target/linux/ramips/patches-5.15/110-v6.4-PCI-mt7621-Use-dev_info-to-log-PCIe-card-detection.patch b/target/linux/ramips/patches-5.15/110-v6.4-PCI-mt7621-Use-dev_info-to-log-PCIe-card-detection.patch
new file mode 100644
index 0000000000..94519b9c01
--- /dev/null
+++ b/target/linux/ramips/patches-5.15/110-v6.4-PCI-mt7621-Use-dev_info-to-log-PCIe-card-detection.patch
@@ -0,0 +1,31 @@
+From 50233e105a0332ec0f3bc83180c416e6b200471e Mon Sep 17 00:00:00 2001
+From: Sergio Paracuellos <sergio.paracuellos at gmail.com>
+Date: Fri, 24 Mar 2023 08:37:33 +0100
+Subject: PCI: mt7621: Use dev_info() to log PCIe card detection
+
+When there is no card plugged on a PCIe port a log reporting that
+the port will be disabled is flagged as an error (dev_err()).
+
+Since this is not an error at all, change the log level by using
+dev_info() instead.
+
+Link: https://lore.kernel.org/r/20230324073733.1596231-1-sergio.paracuellos@gmail.com
+Signed-off-by: Sergio Paracuellos <sergio.paracuellos at gmail.com>
+Signed-off-by: Lorenzo Pieralisi <lpieralisi at kernel.org>
+---
+ drivers/pci/controller/pcie-mt7621.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/pci/controller/pcie-mt7621.c
++++ b/drivers/pci/controller/pcie-mt7621.c
+@@ -383,8 +383,8 @@ static int mt7621_pcie_init_ports(struct
+ 		u32 slot = port->slot;
+ 
+ 		if (!mt7621_pcie_port_is_linkup(port)) {
+-			dev_err(dev, "pcie%d no card, disable it (RST & CLK)\n",
+-				slot);
++			dev_info(dev, "pcie%d no card, disable it (RST & CLK)\n",
++				 slot);
+ 			mt7621_control_assert(port);
+ 			port->enabled = false;
+ 			num_disabled++;
-- 
2.30.2




More information about the openwrt-devel mailing list