Message ID | 20240911161054.4494-4-Raju.Lakkaraju@microchip.com (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | Add support to SFP for PCI11x1x chips | expand |
Hi Raju, kernel test robot noticed the following build errors: [auto build test ERROR on net-next/main] url: https://github.com/intel-lab-lkp/linux/commits/Raju-Lakkaraju/net-lan743x-Add-SFP-support-check-flag/20240912-002444 base: net-next/main patch link: https://lore.kernel.org/r/20240911161054.4494-4-Raju.Lakkaraju%40microchip.com patch subject: [PATCH net-next V2 3/5] net: lan743x: Register the platform device for sfp pluggable module config: x86_64-randconfig-003-20240914 (https://download.01.org/0day-ci/archive/20240915/202409151058.rOgbMAJJ-lkp@intel.com/config) compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240915/202409151058.rOgbMAJJ-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202409151058.rOgbMAJJ-lkp@intel.com/ All errors (new ones prefixed by >>): >> ld.lld: error: undefined symbol: i2c_get_adapter_by_fwnode >>> referenced by sfp.c:2981 (drivers/net/phy/sfp.c:2981) >>> drivers/net/phy/sfp.o:(sfp_probe) in archive vmlinux.a -- >> ld.lld: error: undefined symbol: i2c_put_adapter >>> referenced by sfp.c:2989 (drivers/net/phy/sfp.c:2989) >>> drivers/net/phy/sfp.o:(sfp_probe) in archive vmlinux.a >>> referenced by sfp.c:2965 (drivers/net/phy/sfp.c:2965) >>> drivers/net/phy/sfp.o:(sfp_cleanup) in archive vmlinux.a -- >> ld.lld: error: undefined symbol: hwmon_device_unregister >>> referenced by sfp.c:1640 (drivers/net/phy/sfp.c:1640) >>> drivers/net/phy/sfp.o:(__sfp_sm_event) in archive vmlinux.a -- >> ld.lld: error: undefined symbol: mdio_i2c_alloc >>> referenced by sfp.c:707 (drivers/net/phy/sfp.c:707) >>> drivers/net/phy/sfp.o:(__sfp_sm_event) in archive vmlinux.a -- >> ld.lld: error: undefined symbol: hwmon_sanitize_name >>> referenced by sfp.c:1611 (drivers/net/phy/sfp.c:1611) >>> drivers/net/phy/sfp.o:(sfp_hwmon_probe) in archive vmlinux.a -- >> ld.lld: error: undefined symbol: hwmon_device_register_with_info >>> referenced by sfp.c:1617 (drivers/net/phy/sfp.c:1617) >>> drivers/net/phy/sfp.o:(sfp_hwmon_probe) in archive vmlinux.a -- >> ld.lld: error: undefined symbol: i2c_transfer >>> referenced by sfp.c:648 (drivers/net/phy/sfp.c:648) >>> drivers/net/phy/sfp.o:(sfp_i2c_read) in archive vmlinux.a >>> referenced by sfp.c:680 (drivers/net/phy/sfp.c:680) >>> drivers/net/phy/sfp.o:(sfp_i2c_write) in archive vmlinux.a Kconfig warnings: (for reference only) WARNING: unmet direct dependencies detected for GP_PCI1XXXX Depends on [n]: PCI [=y] && GPIOLIB [=y] && NVMEM_SYSFS [=n] Selected by [y]: - LAN743X [=y] && NETDEVICES [=y] && ETHERNET [=y] && NET_VENDOR_MICROCHIP [=y] && PCI [=y] && PTP_1588_CLOCK_OPTIONAL [=y] WARNING: unmet direct dependencies detected for SFP Depends on [m]: NETDEVICES [=y] && PHYLIB [=y] && I2C [=m] && PHYLINK [=y] && (HWMON [=m] || HWMON [=m]=n [=n]) Selected by [y]: - LAN743X [=y] && NETDEVICES [=y] && ETHERNET [=y] && NET_VENDOR_MICROCHIP [=y] && PCI [=y] && PTP_1588_CLOCK_OPTIONAL [=y] WARNING: unmet direct dependencies detected for I2C_PCI1XXXX Depends on [m]: I2C [=m] && HAS_IOMEM [=y] && PCI [=y] Selected by [y]: - LAN743X [=y] && NETDEVICES [=y] && ETHERNET [=y] && NET_VENDOR_MICROCHIP [=y] && PCI [=y] && PTP_1588_CLOCK_OPTIONAL [=y]
diff --git a/drivers/net/ethernet/microchip/Kconfig b/drivers/net/ethernet/microchip/Kconfig index 9c08a4af257a..3dacf39b49b4 100644 --- a/drivers/net/ethernet/microchip/Kconfig +++ b/drivers/net/ethernet/microchip/Kconfig @@ -52,6 +52,7 @@ config LAN743X select PHYLINK select I2C_PCI1XXXX select GP_PCI1XXXX + select SFP help Support for the Microchip LAN743x and PCI11x1x families of PCI Express Ethernet devices diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c index dc571020ae1b..c1061e2972f9 100644 --- a/drivers/net/ethernet/microchip/lan743x_main.c +++ b/drivers/net/ethernet/microchip/lan743x_main.c @@ -16,6 +16,7 @@ #include <linux/iopoll.h> #include <linux/crc16.h> #include <linux/phylink.h> +#include <linux/platform_device.h> #include "lan743x_main.h" #include "lan743x_ethtool.h" @@ -187,6 +188,11 @@ static int pci1xxxx_gpio_dev_get(struct lan743x_adapter *adapter) static void lan743x_pci_cleanup(struct lan743x_adapter *adapter) { + if (adapter->sfp_dev) { + platform_device_unregister(adapter->sfp_dev); + adapter->sfp_dev = NULL; + } + if (adapter->nodes) { software_node_unregister_node_group(adapter->nodes->group); kfree(adapter->nodes); @@ -3062,6 +3068,31 @@ static int lan743x_swnodes_register(struct lan743x_adapter *adapter) return software_node_register_node_group(nodes->group); } +static int lan743x_sfp_register(struct lan743x_adapter *adapter) +{ + struct pci_dev *pdev = adapter->pdev; + struct platform_device_info sfp_info; + struct platform_device *sfp_dev; + + memset(&sfp_info, 0, sizeof(sfp_info)); + sfp_info.parent = &adapter->pdev->dev; + sfp_info.fwnode = software_node_fwnode(adapter->nodes->group[SWNODE_SFP]); + sfp_info.name = "sfp"; + sfp_info.id = (pdev->bus->number << 8) | pdev->devfn; + sfp_dev = platform_device_register_full(&sfp_info); + if (IS_ERR(sfp_dev)) { + netif_err(adapter, drv, adapter->netdev, + "Failed to register SFP device\n"); + return PTR_ERR(sfp_dev); + } + + adapter->sfp_dev = sfp_dev; + netif_dbg(adapter, drv, adapter->netdev, + "SFP platform device registered"); + + return 0; +} + static int lan743x_phylink_sgmii_config(struct lan743x_adapter *adapter) { u32 sgmii_ctl; @@ -3851,6 +3882,18 @@ static int lan743x_pcidev_probe(struct pci_dev *pdev, if (ret) goto cleanup_pci; + if (adapter->is_sfp_support_en) { + adapter->i2c_adap->dev.fwnode = + software_node_fwnode(adapter->nodes->group[SWNODE_I2C]); + + ret = lan743x_sfp_register(adapter); + if (ret < 0) { + netif_err(adapter, probe, netdev, + "Failed to register sfp (%d)\n", ret); + goto cleanup_pci; + } + } + ret = lan743x_mdiobus_init(adapter); if (ret) goto cleanup_hardware; diff --git a/drivers/net/ethernet/microchip/lan743x_main.h b/drivers/net/ethernet/microchip/lan743x_main.h index bf0d0f285e39..c303a69c3bea 100644 --- a/drivers/net/ethernet/microchip/lan743x_main.h +++ b/drivers/net/ethernet/microchip/lan743x_main.h @@ -1129,6 +1129,7 @@ struct lan743x_adapter { struct phylink_config phylink_config; struct lan743x_sw_nodes *nodes; struct i2c_adapter *i2c_adap; + struct platform_device *sfp_dev; }; #define LAN743X_COMPONENT_FLAG_RX(channel) BIT(20 + (channel))
Add support for sfp pluggable module as platform device handle the gpio input and output signals and i2c bus access the sfp eeprom data. Signed-off-by: Raju Lakkaraju <Raju.Lakkaraju@microchip.com> --- Change List: ============ V1 -> V2: - Add platform_device_unregister( ) when sfp register fail V0 -> V1: - No change drivers/net/ethernet/microchip/Kconfig | 1 + drivers/net/ethernet/microchip/lan743x_main.c | 43 +++++++++++++++++++ drivers/net/ethernet/microchip/lan743x_main.h | 1 + 3 files changed, 45 insertions(+)