diff mbox series

[net-next:,12/12] net: dsa: mv88e6xxx: add ACPI support

Message ID 20220620150225.1307946-13-mw@semihalf.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series ACPI support for DSA | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next, async
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Series has a cover letter
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit fail Errors and warnings before: 4 this patch: 5
netdev/cc_maintainers success CCed 9 of 9 maintainers
netdev/build_clang fail Errors and warnings before: 4 this patch: 4
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn fail Errors and warnings before: 4 this patch: 4
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 62 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Marcin Wojtas June 20, 2022, 3:02 p.m. UTC
Previous patches dropped the strict dependency on the OF_* API
in both generic DSA subsystem and the mv88e6xxx driver.
As a result the ACPI support can be introduced by adding
the necessary ID's in the acpi_match_table and a two
minor required adjustments, i.e. different mdiobus registration
and MDIO subnode name, so to conform ACPI namespace requirements [1].

[1] https://uefi.org/specs/ACPI/6.4/05_ACPI_Software_Programming_Model/ACPI_Software_Programming_Model.html#acpi-namespace

Signed-off-by: Marcin Wojtas <mw@semihalf.com>
---
 drivers/net/dsa/mv88e6xxx/chip.c | 25 ++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)

Comments

kernel test robot June 25, 2022, 2:54 a.m. UTC | #1
Hi Marcin,

I love your patch! Perhaps something to improve:

[auto build test WARNING on rafael-pm/linux-next]
[also build test WARNING on robh/for-next linus/master v5.19-rc3 next-20220623]
[cannot apply to horms-ipvs/master]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/intel-lab-lkp/linux/commits/Marcin-Wojtas/ACPI-support-for-DSA/20220620-231646
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
config: ia64-allyesconfig
compiler: ia64-linux-gcc (GCC) 11.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/b3d15b4cbd3c4de7799791e739317bdf6304c6de
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Marcin-Wojtas/ACPI-support-for-DSA/20220620-231646
        git checkout b3d15b4cbd3c4de7799791e739317bdf6304c6de
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=ia64 SHELL=/bin/bash drivers/net/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   drivers/net/dsa/mv88e6xxx/chip.c: In function 'mv88e6xxx_mdios_register':
>> drivers/net/dsa/mv88e6xxx/chip.c:3966:17: warning: 'strncpy' output truncated before terminating nul copying 4 bytes from a string of the same length [-Wstringop-truncation]
    3966 |                 strncpy(mdio_node_name, "MDIO", ACPI_NAMESEG_SIZE);
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   {standard input}: Assembler messages:
   {standard input}:1908: Error: Register number out of range 0..1
   {standard input}:1908: Warning: Use of 'mov' violates WAW dependency 'GR%, % in 1 - 127' (impliedf), specific resource number is 39
   {standard input}:1908: Warning: Only the first path encountering the conflict is reported
   {standard input}:1906: Warning: This is the location of the conflicting usage
   {standard input}:1910: Error: Register number out of range 0..1
   {standard input}:1910: Warning: Use of 'mov' violates WAW dependency 'GR%, % in 1 - 127' (impliedf), specific resource number is 39
   {standard input}:1910: Warning: Only the first path encountering the conflict is reported
   {standard input}:1906: Warning: This is the location of the conflicting usage
   {standard input}:1910: Warning: Use of 'mov' violates WAW dependency 'GR%, % in 1 - 127' (impliedf), specific resource number is 39
   {standard input}:1910: Warning: Only the first path encountering the conflict is reported
   {standard input}:1908: Warning: This is the location of the conflicting usage
   {standard input}:1911: Error: Register number out of range 0..1
   {standard input}:1911: Warning: Use of 'mov' violates WAW dependency 'GR%, % in 1 - 127' (impliedf), specific resource number is 39
   {standard input}:1911: Warning: Only the first path encountering the conflict is reported
   {standard input}:1906: Warning: This is the location of the conflicting usage
   {standard input}:1911: Warning: Use of 'mov' violates WAW dependency 'GR%, % in 1 - 127' (impliedf), specific resource number is 39
   {standard input}:1911: Warning: Only the first path encountering the conflict is reported
   {standard input}:1908: Warning: This is the location of the conflicting usage
   {standard input}:1911: Warning: Use of 'mov' violates WAW dependency 'GR%, % in 1 - 127' (impliedf), specific resource number is 39
   {standard input}:1911: Warning: Only the first path encountering the conflict is reported
   {standard input}:1910: Warning: This is the location of the conflicting usage
   {standard input}:1912: Error: Register number out of range 0..1
   {standard input}:1912: Warning: Use of 'mov' violates WAW dependency 'GR%, % in 1 - 127' (impliedf), specific resource number is 39
   {standard input}:1912: Warning: Only the first path encountering the conflict is reported
   {standard input}:1906: Warning: This is the location of the conflicting usage
   {standard input}:1912: Warning: Use of 'mov' violates WAW dependency 'GR%, % in 1 - 127' (impliedf), specific resource number is 39
   {standard input}:1912: Warning: Only the first path encountering the conflict is reported
   {standard input}:1908: Warning: This is the location of the conflicting usage
   {standard input}:1912: Warning: Use of 'mov' violates WAW dependency 'GR%, % in 1 - 127' (impliedf), specific resource number is 39
   {standard input}:1912: Warning: Only the first path encountering the conflict is reported
   {standard input}:1910: Warning: This is the location of the conflicting usage
   {standard input}:1912: Warning: Use of 'mov' violates WAW dependency 'GR%, % in 1 - 127' (impliedf), specific resource number is 39
   {standard input}:1912: Warning: Only the first path encountering the conflict is reported
   {standard input}:1911: Warning: This is the location of the conflicting usage
   {standard input}:1915: Error: Register number out of range 0..1
   {standard input}:1916: Error: Register number out of range 0..1
   {standard input}:1916: Warning: Use of 'mov' violates WAW dependency 'GR%, % in 1 - 127' (impliedf), specific resource number is 39
   {standard input}:1916: Warning: Only the first path encountering the conflict is reported
   {standard input}:1915: Warning: This is the location of the conflicting usage
   {standard input}:4791: Error: Register number out of range 0..3
   {standard input}:4792: Error: Register number out of range 0..3
   {standard input}:4792: Warning: Use of 'mov' violates WAW dependency 'GR%, % in 1 - 127' (impliedf), specific resource number is 52
   {standard input}:4792: Warning: Only the first path encountering the conflict is reported
   {standard input}:4791: Warning: This is the location of the conflicting usage
   {standard input}:4793: Error: Register number out of range 0..3
   {standard input}:4793: Warning: Use of 'mov' violates WAW dependency 'GR%, % in 1 - 127' (impliedf), specific resource number is 52
   {standard input}:4793: Warning: Only the first path encountering the conflict is reported
   {standard input}:4791: Warning: This is the location of the conflicting usage
   {standard input}:4793: Warning: Use of 'mov' violates WAW dependency 'GR%, % in 1 - 127' (impliedf), specific resource number is 52
   {standard input}:4793: Warning: Only the first path encountering the conflict is reported
   {standard input}:4792: Warning: This is the location of the conflicting usage
   {standard input}:4797: Error: Register number out of range 0..3
   {standard input}:5097: Error: Register number out of range 0..2
   {standard input}:5097: Warning: Use of 'mov' violates WAW dependency 'GR%, % in 1 - 127' (impliedf), specific resource number is 40
   {standard input}:5093: Warning: This is the location of the conflicting usage
   {standard input}:5098: Error: Register number out of range 0..2
   {standard input}:5098: Warning: Use of 'mov' violates WAW dependency 'GR%, % in 1 - 127' (impliedf), specific resource number is 40
   {standard input}:5093: Warning: This is the location of the conflicting usage
   {standard input}:5098: Warning: Use of 'mov' violates WAW dependency 'GR%, % in 1 - 127' (impliedf), specific resource number is 40
   {standard input}:5097: Warning: This is the location of the conflicting usage
   {standard input}:5099: Error: Register number out of range 0..2
   {standard input}:5099: Warning: Use of 'mov' violates WAW dependency 'GR%, % in 1 - 127' (impliedf), specific resource number is 40
   {standard input}:5093: Warning: This is the location of the conflicting usage
   {standard input}:5099: Warning: Use of 'mov' violates WAW dependency 'GR%, % in 1 - 127' (impliedf), specific resource number is 40
   {standard input}:5097: Warning: This is the location of the conflicting usage
   {standard input}:5099: Warning: Use of 'mov' violates WAW dependency 'GR%, % in 1 - 127' (impliedf), specific resource number is 40
   {standard input}:5098: Warning: This is the location of the conflicting usage
   {standard input}:5102: Error: Register number out of range 0..2
   {standard input}:5103: Error: Register number out of range 0..2
   {standard input}:5103: Warning: Use of 'mov' violates WAW dependency 'GR%, % in 1 - 127' (impliedf), specific resource number is 40
   {standard input}:5102: Warning: This is the location of the conflicting usage
   {standard input}:10057: Error: Register number out of range 0..2
   {standard input}:10059: Error: Register number out of range 0..2
   {standard input}:10059: Warning: Use of 'mov' violates WAW dependency 'GR%, % in 1 - 127' (impliedf), specific resource number is 40
   {standard input}:10059: Warning: Only the first path encountering the conflict is reported
   {standard input}:10057: Warning: This is the location of the conflicting usage
   {standard input}:10060: Error: Register number out of range 0..2
   {standard input}:10060: Warning: Use of 'mov' violates WAW dependency 'GR%, % in 1 - 127' (impliedf), specific resource number is 40
   {standard input}:10060: Warning: Only the first path encountering the conflict is reported
   {standard input}:10057: Warning: This is the location of the conflicting usage
   {standard input}:10060: Warning: Use of 'mov' violates WAW dependency 'GR%, % in 1 - 127' (impliedf), specific resource number is 40
   {standard input}:10060: Warning: Only the first path encountering the conflict is reported
   {standard input}:10059: Warning: This is the location of the conflicting usage
   {standard input}:10061: Error: Register number out of range 0..2
   {standard input}:10061: Warning: Use of 'mov' violates WAW dependency 'GR%, % in 1 - 127' (impliedf), specific resource number is 40
   {standard input}:10061: Warning: Only the first path encountering the conflict is reported
   {standard input}:10057: Warning: This is the location of the conflicting usage
   {standard input}:10061: Warning: Use of 'mov' violates WAW dependency 'GR%, % in 1 - 127' (impliedf), specific resource number is 40
   {standard input}:10061: Warning: Only the first path encountering the conflict is reported
   {standard input}:10059: Warning: This is the location of the conflicting usage
   {standard input}:10061: Warning: Use of 'mov' violates WAW dependency 'GR%, % in 1 - 127' (impliedf), specific resource number is 40
   {standard input}:10061: Warning: Only the first path encountering the conflict is reported
   {standard input}:10060: Warning: This is the location of the conflicting usage
   {standard input}:10065: Error: Register number out of range 0..2
   {standard input}:10390: Error: Register number out of range 0..3
   {standard input}:10391: Error: Register number out of range 0..3
   {standard input}:10391: Warning: Use of 'mov' violates WAW dependency 'GR%, % in 1 - 127' (impliedf), specific resource number is 43


vim +/strncpy +3966 drivers/net/dsa/mv88e6xxx/chip.c

  3956	
  3957	static int mv88e6xxx_mdios_register(struct mv88e6xxx_chip *chip,
  3958					    struct fwnode_handle *fwnode)
  3959	{
  3960		char mdio_node_name[] = "mdio";
  3961		struct fwnode_handle *child;
  3962		int err;
  3963	
  3964		/* Update subnode name if operating in the ACPI world. */
  3965		if (is_acpi_node(fwnode))
> 3966			strncpy(mdio_node_name, "MDIO", ACPI_NAMESEG_SIZE);
  3967	
  3968		/* Always register one mdio bus for the internal/default mdio
  3969		 * bus. This maybe represented in the device tree, but is
  3970		 * optional.
  3971		 */
  3972		child = fwnode_get_named_child_node(fwnode, mdio_node_name);
  3973		err = mv88e6xxx_mdio_register(chip, child, false);
  3974		fwnode_handle_put(child);
  3975		if (err)
  3976			return err;
  3977	
  3978		/* Walk the device tree, and see if there are any other nodes
  3979		 * which say they are compatible with the external mdio
  3980		 * bus.
  3981		 */
  3982		fwnode_for_each_available_child_node(fwnode, child) {
  3983			if (fwnode_property_match_string(child, "compatible",
  3984							 "marvell,mv88e6xxx-mdio-external") == 0) {
  3985				err = mv88e6xxx_mdio_register(chip, child, true);
  3986				if (err) {
  3987					mv88e6xxx_mdios_unregister(chip);
  3988					fwnode_handle_put(child);
  3989					return err;
  3990				}
  3991			}
  3992		}
  3993	
  3994		return 0;
  3995	}
  3996
diff mbox series

Patch

diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index 556defa4379d..a74e528184aa 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -10,6 +10,8 @@ 
  *	Vivien Didelot <vivien.didelot@savoirfairelinux.com>
  */
 
+#include <linux/acpi.h>
+#include <linux/acpi_mdio.h>
 #include <linux/bitfield.h>
 #include <linux/delay.h>
 #include <linux/dsa/mv88e6xxx.h>
@@ -3913,7 +3915,10 @@  static int mv88e6xxx_mdio_register(struct mv88e6xxx_chip *chip,
 			goto out;
 	}
 
-	err = of_mdiobus_register(bus, np);
+	if (is_acpi_node(fwnode))
+		err = acpi_mdiobus_register(bus, fwnode);
+	else
+		err = of_mdiobus_register(bus, np);
 	if (err) {
 		dev_err(chip->dev, "Cannot register MDIO bus (%d)\n", err);
 		mv88e6xxx_g2_irq_mdio_free(chip, bus);
@@ -3952,14 +3957,19 @@  static void mv88e6xxx_mdios_unregister(struct mv88e6xxx_chip *chip)
 static int mv88e6xxx_mdios_register(struct mv88e6xxx_chip *chip,
 				    struct fwnode_handle *fwnode)
 {
+	char mdio_node_name[] = "mdio";
 	struct fwnode_handle *child;
 	int err;
 
+	/* Update subnode name if operating in the ACPI world. */
+	if (is_acpi_node(fwnode))
+		strncpy(mdio_node_name, "MDIO", ACPI_NAMESEG_SIZE);
+
 	/* Always register one mdio bus for the internal/default mdio
 	 * bus. This maybe represented in the device tree, but is
 	 * optional.
 	 */
-	child = fwnode_get_named_child_node(fwnode, "mdio");
+	child = fwnode_get_named_child_node(fwnode, mdio_node_name);
 	err = mv88e6xxx_mdio_register(chip, child, false);
 	fwnode_handle_put(child);
 	if (err)
@@ -7177,6 +7187,16 @@  static const struct of_device_id mv88e6xxx_of_match[] = {
 
 MODULE_DEVICE_TABLE(of, mv88e6xxx_of_match);
 
+#ifdef CONFIG_ACPI
+static const struct acpi_device_id sdhci_mv88e6xxx_acpi_ids[] = {
+	{ .id = "MRVL0120", (kernel_ulong_t)&mv88e6xxx_table[MV88E6085]},
+	{ .id = "MRVL0121", (kernel_ulong_t)&mv88e6xxx_table[MV88E6190]},
+	{ .id = "MRVL0122", (kernel_ulong_t)&mv88e6xxx_table[MV88E6250]},
+	{}
+};
+MODULE_DEVICE_TABLE(acpi, sdhci_mv88e6xxx_acpi_ids);
+#endif
+
 static struct mdio_driver mv88e6xxx_driver = {
 	.probe	= mv88e6xxx_probe,
 	.remove = mv88e6xxx_remove,
@@ -7184,6 +7204,7 @@  static struct mdio_driver mv88e6xxx_driver = {
 	.mdiodrv.driver = {
 		.name = "mv88e6085",
 		.of_match_table = mv88e6xxx_of_match,
+		.acpi_match_table = ACPI_PTR(sdhci_mv88e6xxx_acpi_ids),
 		.pm = &mv88e6xxx_pm_ops,
 	},
 };