diff mbox series

staging: octeon: repair "fixed-link" support

Message ID 20201009094739.5411-1-alexander.sverdlin@nokia.com (mailing list archive)
State Not Applicable
Headers show
Series staging: octeon: repair "fixed-link" support | expand

Commit Message

Alexander Sverdlin Oct. 9, 2020, 9:47 a.m. UTC
From: Alexander Sverdlin <alexander.sverdlin@nokia.com>

The PHYs must be registered once in device probe function, not in device
open callback because it's only possible to register them once.

Fixes: a25e278020 ("staging: octeon: support fixed-link phys")
Signed-off-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>
---
 drivers/staging/octeon/ethernet-mdio.c |  6 ------
 drivers/staging/octeon/ethernet.c      | 10 ++++++++++
 2 files changed, 10 insertions(+), 6 deletions(-)

Comments

kernel test robot Oct. 9, 2020, 11:15 a.m. UTC | #1
Hi Alexander,

I love your patch! Yet something to improve:

[auto build test ERROR on staging/staging-testing]

url:    https://github.com/0day-ci/linux/commits/Alexander-A-Sverdlin/staging-octeon-repair-fixed-link-support/20201009-174828
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 76c3bdd67d27289b9e407113821eab2a70bbcca6
config: x86_64-allyesconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
        # https://github.com/0day-ci/linux/commit/99d271d0a7dda48d064e12957a8846907220bf44
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Alexander-A-Sverdlin/staging-octeon-repair-fixed-link-support/20201009-174828
        git checkout 99d271d0a7dda48d064e12957a8846907220bf44
        # save the attached .config to linux build tree
        make W=1 ARCH=x86_64 

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

All errors (new ones prefixed by >>):

   drivers/staging/octeon/ethernet.c: In function 'cvm_oct_probe':
>> drivers/staging/octeon/ethernet.c:897:5: error: 'r' undeclared (first use in this function); did you mean 'rq'?
     897 |     r = of_phy_register_fixed_link(priv->of_node);
         |     ^
         |     rq
   drivers/staging/octeon/ethernet.c:897:5: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/staging/octeon/ethernet.c:900:25: error: 'struct octeon_ethernet' has no member named 'ipd_port'
     900 |          interface, priv->ipd_port);
         |                         ^~

vim +897 drivers/staging/octeon/ethernet.c

   692	
   693		pip = pdev->dev.of_node;
   694		if (!pip) {
   695			pr_err("Error: No 'pip' in /aliases\n");
   696			return -EINVAL;
   697		}
   698	
   699		cvm_oct_configure_common_hw();
   700	
   701		cvmx_helper_initialize_packet_io_global();
   702	
   703		if (receive_group_order) {
   704			if (receive_group_order > 4)
   705				receive_group_order = 4;
   706			pow_receive_groups = (1 << (1 << receive_group_order)) - 1;
   707		} else {
   708			pow_receive_groups = BIT(pow_receive_group);
   709		}
   710	
   711		/* Change the input group for all ports before input is enabled */
   712		num_interfaces = cvmx_helper_get_number_of_interfaces();
   713		for (interface = 0; interface < num_interfaces; interface++) {
   714			int num_ports = cvmx_helper_ports_on_interface(interface);
   715			int port;
   716	
   717			for (port = cvmx_helper_get_ipd_port(interface, 0);
   718			     port < cvmx_helper_get_ipd_port(interface, num_ports);
   719			     port++) {
   720				union cvmx_pip_prt_tagx pip_prt_tagx;
   721	
   722				pip_prt_tagx.u64 =
   723				    cvmx_read_csr(CVMX_PIP_PRT_TAGX(port));
   724	
   725				if (receive_group_order) {
   726					int tag_mask;
   727	
   728					/* We support only 16 groups at the moment, so
   729					 * always disable the two additional "hidden"
   730					 * tag_mask bits on CN68XX.
   731					 */
   732					if (OCTEON_IS_MODEL(OCTEON_CN68XX))
   733						pip_prt_tagx.u64 |= 0x3ull << 44;
   734	
   735					tag_mask = ~((1 << receive_group_order) - 1);
   736					pip_prt_tagx.s.grptagbase	= 0;
   737					pip_prt_tagx.s.grptagmask	= tag_mask;
   738					pip_prt_tagx.s.grptag		= 1;
   739					pip_prt_tagx.s.tag_mode		= 0;
   740					pip_prt_tagx.s.inc_prt_flag	= 1;
   741					pip_prt_tagx.s.ip6_dprt_flag	= 1;
   742					pip_prt_tagx.s.ip4_dprt_flag	= 1;
   743					pip_prt_tagx.s.ip6_sprt_flag	= 1;
   744					pip_prt_tagx.s.ip4_sprt_flag	= 1;
   745					pip_prt_tagx.s.ip6_dst_flag	= 1;
   746					pip_prt_tagx.s.ip4_dst_flag	= 1;
   747					pip_prt_tagx.s.ip6_src_flag	= 1;
   748					pip_prt_tagx.s.ip4_src_flag	= 1;
   749					pip_prt_tagx.s.grp		= 0;
   750				} else {
   751					pip_prt_tagx.s.grptag	= 0;
   752					pip_prt_tagx.s.grp	= pow_receive_group;
   753				}
   754	
   755				cvmx_write_csr(CVMX_PIP_PRT_TAGX(port),
   756					       pip_prt_tagx.u64);
   757			}
   758		}
   759	
   760		cvmx_helper_ipd_and_packet_input_enable();
   761	
   762		memset(cvm_oct_device, 0, sizeof(cvm_oct_device));
   763	
   764		/*
   765		 * Initialize the FAU used for counting packet buffers that
   766		 * need to be freed.
   767		 */
   768		cvmx_fau_atomic_write32(FAU_NUM_PACKET_BUFFERS_TO_FREE, 0);
   769	
   770		/* Initialize the FAU used for counting tx SKBs that need to be freed */
   771		cvmx_fau_atomic_write32(FAU_TOTAL_TX_TO_CLEAN, 0);
   772	
   773		if ((pow_send_group != -1)) {
   774			struct net_device *dev;
   775	
   776			dev = alloc_etherdev(sizeof(struct octeon_ethernet));
   777			if (dev) {
   778				/* Initialize the device private structure. */
   779				struct octeon_ethernet *priv = netdev_priv(dev);
   780	
   781				SET_NETDEV_DEV(dev, &pdev->dev);
   782				dev->netdev_ops = &cvm_oct_pow_netdev_ops;
   783				priv->imode = CVMX_HELPER_INTERFACE_MODE_DISABLED;
   784				priv->port = CVMX_PIP_NUM_INPUT_PORTS;
   785				priv->queue = -1;
   786				strscpy(dev->name, "pow%d", sizeof(dev->name));
   787				for (qos = 0; qos < 16; qos++)
   788					skb_queue_head_init(&priv->tx_free_list[qos]);
   789				dev->min_mtu = VLAN_ETH_ZLEN - mtu_overhead;
   790				dev->max_mtu = OCTEON_MAX_MTU - mtu_overhead;
   791	
   792				if (register_netdev(dev) < 0) {
   793					pr_err("Failed to register ethernet device for POW\n");
   794					free_netdev(dev);
   795				} else {
   796					cvm_oct_device[CVMX_PIP_NUM_INPUT_PORTS] = dev;
   797					pr_info("%s: POW send group %d, receive group %d\n",
   798						dev->name, pow_send_group,
   799						pow_receive_group);
   800				}
   801			} else {
   802				pr_err("Failed to allocate ethernet device for POW\n");
   803			}
   804		}
   805	
   806		num_interfaces = cvmx_helper_get_number_of_interfaces();
   807		for (interface = 0; interface < num_interfaces; interface++) {
   808			cvmx_helper_interface_mode_t imode =
   809			    cvmx_helper_interface_get_mode(interface);
   810			int num_ports = cvmx_helper_ports_on_interface(interface);
   811			int port;
   812			int port_index;
   813	
   814			for (port_index = 0,
   815			     port = cvmx_helper_get_ipd_port(interface, 0);
   816			     port < cvmx_helper_get_ipd_port(interface, num_ports);
   817			     port_index++, port++) {
   818				struct octeon_ethernet *priv;
   819				struct net_device *dev =
   820				    alloc_etherdev(sizeof(struct octeon_ethernet));
   821				if (!dev) {
   822					pr_err("Failed to allocate ethernet device for port %d\n",
   823					       port);
   824					continue;
   825				}
   826	
   827				/* Initialize the device private structure. */
   828				SET_NETDEV_DEV(dev, &pdev->dev);
   829				priv = netdev_priv(dev);
   830				priv->netdev = dev;
   831				priv->of_node = cvm_oct_node_for_port(pip, interface,
   832								      port_index);
   833	
   834				INIT_DELAYED_WORK(&priv->port_periodic_work,
   835						  cvm_oct_periodic_worker);
   836				priv->imode = imode;
   837				priv->port = port;
   838				priv->queue = cvmx_pko_get_base_queue(priv->port);
   839				priv->fau = fau - cvmx_pko_get_num_queues(port) * 4;
   840				priv->phy_mode = PHY_INTERFACE_MODE_NA;
   841				for (qos = 0; qos < 16; qos++)
   842					skb_queue_head_init(&priv->tx_free_list[qos]);
   843				for (qos = 0; qos < cvmx_pko_get_num_queues(port);
   844				     qos++)
   845					cvmx_fau_atomic_write32(priv->fau + qos * 4, 0);
   846				dev->min_mtu = VLAN_ETH_ZLEN - mtu_overhead;
   847				dev->max_mtu = OCTEON_MAX_MTU - mtu_overhead;
   848	
   849				switch (priv->imode) {
   850				/* These types don't support ports to IPD/PKO */
   851				case CVMX_HELPER_INTERFACE_MODE_DISABLED:
   852				case CVMX_HELPER_INTERFACE_MODE_PCIE:
   853				case CVMX_HELPER_INTERFACE_MODE_PICMG:
   854					break;
   855	
   856				case CVMX_HELPER_INTERFACE_MODE_NPI:
   857					dev->netdev_ops = &cvm_oct_npi_netdev_ops;
   858					strscpy(dev->name, "npi%d", sizeof(dev->name));
   859					break;
   860	
   861				case CVMX_HELPER_INTERFACE_MODE_XAUI:
   862					dev->netdev_ops = &cvm_oct_xaui_netdev_ops;
   863					strscpy(dev->name, "xaui%d", sizeof(dev->name));
   864					break;
   865	
   866				case CVMX_HELPER_INTERFACE_MODE_LOOP:
   867					dev->netdev_ops = &cvm_oct_npi_netdev_ops;
   868					strscpy(dev->name, "loop%d", sizeof(dev->name));
   869					break;
   870	
   871				case CVMX_HELPER_INTERFACE_MODE_SGMII:
   872					priv->phy_mode = PHY_INTERFACE_MODE_SGMII;
   873					dev->netdev_ops = &cvm_oct_sgmii_netdev_ops;
   874					strscpy(dev->name, "eth%d", sizeof(dev->name));
   875					break;
   876	
   877				case CVMX_HELPER_INTERFACE_MODE_SPI:
   878					dev->netdev_ops = &cvm_oct_spi_netdev_ops;
   879					strscpy(dev->name, "spi%d", sizeof(dev->name));
   880					break;
   881	
   882				case CVMX_HELPER_INTERFACE_MODE_GMII:
   883					priv->phy_mode = PHY_INTERFACE_MODE_GMII;
   884					dev->netdev_ops = &cvm_oct_rgmii_netdev_ops;
   885					strscpy(dev->name, "eth%d", sizeof(dev->name));
   886					break;
   887	
   888				case CVMX_HELPER_INTERFACE_MODE_RGMII:
   889					dev->netdev_ops = &cvm_oct_rgmii_netdev_ops;
   890					strscpy(dev->name, "eth%d", sizeof(dev->name));
   891					cvm_set_rgmii_delay(priv, interface,
   892							    port_index);
   893					break;
   894				}
   895	
   896				if (priv->of_node && of_phy_is_fixed_link(priv->of_node)) {
 > 897					r = of_phy_register_fixed_link(priv->of_node);
   898					if (r) {
   899						netdev_err(dev, "Failed to register fixed link for interface %d, port %d\n",
 > 900							   interface, priv->ipd_port);
   901						dev->netdev_ops = NULL;
   902					}
   903				}
   904	
   905				if (!dev->netdev_ops) {
   906					free_netdev(dev);
   907				} else if (register_netdev(dev) < 0) {
   908					pr_err("Failed to register ethernet device for interface %d, port %d\n",
   909					       interface, priv->port);
   910					free_netdev(dev);
   911				} else {
   912					cvm_oct_device[priv->port] = dev;
   913					fau -=
   914					    cvmx_pko_get_num_queues(priv->port) *
   915					    sizeof(u32);
   916					schedule_delayed_work(&priv->port_periodic_work,
   917							      HZ);
   918				}
   919			}
   920		}
   921	
   922		cvm_oct_tx_initialize();
   923		cvm_oct_rx_initialize();
   924	
   925		/*
   926		 * 150 uS: about 10 1500-byte packets at 1GE.
   927		 */
   928		cvm_oct_tx_poll_interval = 150 * (octeon_get_clock_rate() / 1000000);
   929	
   930		schedule_delayed_work(&cvm_oct_rx_refill_work, HZ);
   931	
   932		return 0;
   933	}
   934	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Greg KH Oct. 9, 2020, 1:09 p.m. UTC | #2
On Fri, Oct 09, 2020 at 11:47:39AM +0200, Alexander A Sverdlin wrote:
> From: Alexander Sverdlin <alexander.sverdlin@nokia.com>
> 
> The PHYs must be registered once in device probe function, not in device
> open callback because it's only possible to register them once.
> 
> Fixes: a25e278020 ("staging: octeon: support fixed-link phys")
> Signed-off-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>

Looks like it breaks the build, please fix up and test your patches when
sending them out next time.

thanks,

greg k-h
kernel test robot Oct. 9, 2020, 2:31 p.m. UTC | #3
Hi Alexander,

I love your patch! Yet something to improve:

[auto build test ERROR on staging/staging-testing]

url:    https://github.com/0day-ci/linux/commits/Alexander-A-Sverdlin/staging-octeon-repair-fixed-link-support/20201009-174828
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 76c3bdd67d27289b9e407113821eab2a70bbcca6
config: arm64-randconfig-r033-20201009 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 4cfc4025cc1433ca5ef1c526053fc9c4bfe64109)
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
        # install arm64 cross compiling tool for clang build
        # apt-get install binutils-aarch64-linux-gnu
        # https://github.com/0day-ci/linux/commit/99d271d0a7dda48d064e12957a8846907220bf44
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Alexander-A-Sverdlin/staging-octeon-repair-fixed-link-support/20201009-174828
        git checkout 99d271d0a7dda48d064e12957a8846907220bf44
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64 

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

All errors (new ones prefixed by >>):

>> drivers/staging/octeon/ethernet.c:897:5: error: use of undeclared identifier 'r'
                                   r = of_phy_register_fixed_link(priv->of_node);
                                   ^
   drivers/staging/octeon/ethernet.c:898:9: error: use of undeclared identifier 'r'
                                   if (r) {
                                       ^
   drivers/staging/octeon/ethernet.c:898:9: error: use of undeclared identifier 'r'
   drivers/staging/octeon/ethernet.c:898:9: error: use of undeclared identifier 'r'
>> drivers/staging/octeon/ethernet.c:900:27: error: no member named 'ipd_port' in 'struct octeon_ethernet'
                                                      interface, priv->ipd_port);
                                                                 ~~~~  ^
   5 errors generated.

vim +/r +897 drivers/staging/octeon/ethernet.c

   692	
   693		pip = pdev->dev.of_node;
   694		if (!pip) {
   695			pr_err("Error: No 'pip' in /aliases\n");
   696			return -EINVAL;
   697		}
   698	
   699		cvm_oct_configure_common_hw();
   700	
   701		cvmx_helper_initialize_packet_io_global();
   702	
   703		if (receive_group_order) {
   704			if (receive_group_order > 4)
   705				receive_group_order = 4;
   706			pow_receive_groups = (1 << (1 << receive_group_order)) - 1;
   707		} else {
   708			pow_receive_groups = BIT(pow_receive_group);
   709		}
   710	
   711		/* Change the input group for all ports before input is enabled */
   712		num_interfaces = cvmx_helper_get_number_of_interfaces();
   713		for (interface = 0; interface < num_interfaces; interface++) {
   714			int num_ports = cvmx_helper_ports_on_interface(interface);
   715			int port;
   716	
   717			for (port = cvmx_helper_get_ipd_port(interface, 0);
   718			     port < cvmx_helper_get_ipd_port(interface, num_ports);
   719			     port++) {
   720				union cvmx_pip_prt_tagx pip_prt_tagx;
   721	
   722				pip_prt_tagx.u64 =
   723				    cvmx_read_csr(CVMX_PIP_PRT_TAGX(port));
   724	
   725				if (receive_group_order) {
   726					int tag_mask;
   727	
   728					/* We support only 16 groups at the moment, so
   729					 * always disable the two additional "hidden"
   730					 * tag_mask bits on CN68XX.
   731					 */
   732					if (OCTEON_IS_MODEL(OCTEON_CN68XX))
   733						pip_prt_tagx.u64 |= 0x3ull << 44;
   734	
   735					tag_mask = ~((1 << receive_group_order) - 1);
   736					pip_prt_tagx.s.grptagbase	= 0;
   737					pip_prt_tagx.s.grptagmask	= tag_mask;
   738					pip_prt_tagx.s.grptag		= 1;
   739					pip_prt_tagx.s.tag_mode		= 0;
   740					pip_prt_tagx.s.inc_prt_flag	= 1;
   741					pip_prt_tagx.s.ip6_dprt_flag	= 1;
   742					pip_prt_tagx.s.ip4_dprt_flag	= 1;
   743					pip_prt_tagx.s.ip6_sprt_flag	= 1;
   744					pip_prt_tagx.s.ip4_sprt_flag	= 1;
   745					pip_prt_tagx.s.ip6_dst_flag	= 1;
   746					pip_prt_tagx.s.ip4_dst_flag	= 1;
   747					pip_prt_tagx.s.ip6_src_flag	= 1;
   748					pip_prt_tagx.s.ip4_src_flag	= 1;
   749					pip_prt_tagx.s.grp		= 0;
   750				} else {
   751					pip_prt_tagx.s.grptag	= 0;
   752					pip_prt_tagx.s.grp	= pow_receive_group;
   753				}
   754	
   755				cvmx_write_csr(CVMX_PIP_PRT_TAGX(port),
   756					       pip_prt_tagx.u64);
   757			}
   758		}
   759	
   760		cvmx_helper_ipd_and_packet_input_enable();
   761	
   762		memset(cvm_oct_device, 0, sizeof(cvm_oct_device));
   763	
   764		/*
   765		 * Initialize the FAU used for counting packet buffers that
   766		 * need to be freed.
   767		 */
   768		cvmx_fau_atomic_write32(FAU_NUM_PACKET_BUFFERS_TO_FREE, 0);
   769	
   770		/* Initialize the FAU used for counting tx SKBs that need to be freed */
   771		cvmx_fau_atomic_write32(FAU_TOTAL_TX_TO_CLEAN, 0);
   772	
   773		if ((pow_send_group != -1)) {
   774			struct net_device *dev;
   775	
   776			dev = alloc_etherdev(sizeof(struct octeon_ethernet));
   777			if (dev) {
   778				/* Initialize the device private structure. */
   779				struct octeon_ethernet *priv = netdev_priv(dev);
   780	
   781				SET_NETDEV_DEV(dev, &pdev->dev);
   782				dev->netdev_ops = &cvm_oct_pow_netdev_ops;
   783				priv->imode = CVMX_HELPER_INTERFACE_MODE_DISABLED;
   784				priv->port = CVMX_PIP_NUM_INPUT_PORTS;
   785				priv->queue = -1;
   786				strscpy(dev->name, "pow%d", sizeof(dev->name));
   787				for (qos = 0; qos < 16; qos++)
   788					skb_queue_head_init(&priv->tx_free_list[qos]);
   789				dev->min_mtu = VLAN_ETH_ZLEN - mtu_overhead;
   790				dev->max_mtu = OCTEON_MAX_MTU - mtu_overhead;
   791	
   792				if (register_netdev(dev) < 0) {
   793					pr_err("Failed to register ethernet device for POW\n");
   794					free_netdev(dev);
   795				} else {
   796					cvm_oct_device[CVMX_PIP_NUM_INPUT_PORTS] = dev;
   797					pr_info("%s: POW send group %d, receive group %d\n",
   798						dev->name, pow_send_group,
   799						pow_receive_group);
   800				}
   801			} else {
   802				pr_err("Failed to allocate ethernet device for POW\n");
   803			}
   804		}
   805	
   806		num_interfaces = cvmx_helper_get_number_of_interfaces();
   807		for (interface = 0; interface < num_interfaces; interface++) {
   808			cvmx_helper_interface_mode_t imode =
   809			    cvmx_helper_interface_get_mode(interface);
   810			int num_ports = cvmx_helper_ports_on_interface(interface);
   811			int port;
   812			int port_index;
   813	
   814			for (port_index = 0,
   815			     port = cvmx_helper_get_ipd_port(interface, 0);
   816			     port < cvmx_helper_get_ipd_port(interface, num_ports);
   817			     port_index++, port++) {
   818				struct octeon_ethernet *priv;
   819				struct net_device *dev =
   820				    alloc_etherdev(sizeof(struct octeon_ethernet));
   821				if (!dev) {
   822					pr_err("Failed to allocate ethernet device for port %d\n",
   823					       port);
   824					continue;
   825				}
   826	
   827				/* Initialize the device private structure. */
   828				SET_NETDEV_DEV(dev, &pdev->dev);
   829				priv = netdev_priv(dev);
   830				priv->netdev = dev;
   831				priv->of_node = cvm_oct_node_for_port(pip, interface,
   832								      port_index);
   833	
   834				INIT_DELAYED_WORK(&priv->port_periodic_work,
   835						  cvm_oct_periodic_worker);
   836				priv->imode = imode;
   837				priv->port = port;
   838				priv->queue = cvmx_pko_get_base_queue(priv->port);
   839				priv->fau = fau - cvmx_pko_get_num_queues(port) * 4;
   840				priv->phy_mode = PHY_INTERFACE_MODE_NA;
   841				for (qos = 0; qos < 16; qos++)
   842					skb_queue_head_init(&priv->tx_free_list[qos]);
   843				for (qos = 0; qos < cvmx_pko_get_num_queues(port);
   844				     qos++)
   845					cvmx_fau_atomic_write32(priv->fau + qos * 4, 0);
   846				dev->min_mtu = VLAN_ETH_ZLEN - mtu_overhead;
   847				dev->max_mtu = OCTEON_MAX_MTU - mtu_overhead;
   848	
   849				switch (priv->imode) {
   850				/* These types don't support ports to IPD/PKO */
   851				case CVMX_HELPER_INTERFACE_MODE_DISABLED:
   852				case CVMX_HELPER_INTERFACE_MODE_PCIE:
   853				case CVMX_HELPER_INTERFACE_MODE_PICMG:
   854					break;
   855	
   856				case CVMX_HELPER_INTERFACE_MODE_NPI:
   857					dev->netdev_ops = &cvm_oct_npi_netdev_ops;
   858					strscpy(dev->name, "npi%d", sizeof(dev->name));
   859					break;
   860	
   861				case CVMX_HELPER_INTERFACE_MODE_XAUI:
   862					dev->netdev_ops = &cvm_oct_xaui_netdev_ops;
   863					strscpy(dev->name, "xaui%d", sizeof(dev->name));
   864					break;
   865	
   866				case CVMX_HELPER_INTERFACE_MODE_LOOP:
   867					dev->netdev_ops = &cvm_oct_npi_netdev_ops;
   868					strscpy(dev->name, "loop%d", sizeof(dev->name));
   869					break;
   870	
   871				case CVMX_HELPER_INTERFACE_MODE_SGMII:
   872					priv->phy_mode = PHY_INTERFACE_MODE_SGMII;
   873					dev->netdev_ops = &cvm_oct_sgmii_netdev_ops;
   874					strscpy(dev->name, "eth%d", sizeof(dev->name));
   875					break;
   876	
   877				case CVMX_HELPER_INTERFACE_MODE_SPI:
   878					dev->netdev_ops = &cvm_oct_spi_netdev_ops;
   879					strscpy(dev->name, "spi%d", sizeof(dev->name));
   880					break;
   881	
   882				case CVMX_HELPER_INTERFACE_MODE_GMII:
   883					priv->phy_mode = PHY_INTERFACE_MODE_GMII;
   884					dev->netdev_ops = &cvm_oct_rgmii_netdev_ops;
   885					strscpy(dev->name, "eth%d", sizeof(dev->name));
   886					break;
   887	
   888				case CVMX_HELPER_INTERFACE_MODE_RGMII:
   889					dev->netdev_ops = &cvm_oct_rgmii_netdev_ops;
   890					strscpy(dev->name, "eth%d", sizeof(dev->name));
   891					cvm_set_rgmii_delay(priv, interface,
   892							    port_index);
   893					break;
   894				}
   895	
   896				if (priv->of_node && of_phy_is_fixed_link(priv->of_node)) {
 > 897					r = of_phy_register_fixed_link(priv->of_node);
   898					if (r) {
   899						netdev_err(dev, "Failed to register fixed link for interface %d, port %d\n",
 > 900							   interface, priv->ipd_port);
   901						dev->netdev_ops = NULL;
   902					}
   903				}
   904	
   905				if (!dev->netdev_ops) {
   906					free_netdev(dev);
   907				} else if (register_netdev(dev) < 0) {
   908					pr_err("Failed to register ethernet device for interface %d, port %d\n",
   909					       interface, priv->port);
   910					free_netdev(dev);
   911				} else {
   912					cvm_oct_device[priv->port] = dev;
   913					fau -=
   914					    cvmx_pko_get_num_queues(priv->port) *
   915					    sizeof(u32);
   916					schedule_delayed_work(&priv->port_periodic_work,
   917							      HZ);
   918				}
   919			}
   920		}
   921	
   922		cvm_oct_tx_initialize();
   923		cvm_oct_rx_initialize();
   924	
   925		/*
   926		 * 150 uS: about 10 1500-byte packets at 1GE.
   927		 */
   928		cvm_oct_tx_poll_interval = 150 * (octeon_get_clock_rate() / 1000000);
   929	
   930		schedule_delayed_work(&cvm_oct_rx_refill_work, HZ);
   931	
   932		return 0;
   933	}
   934	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff mbox series

Patch

diff --git a/drivers/staging/octeon/ethernet-mdio.c b/drivers/staging/octeon/ethernet-mdio.c
index cfb673a..0bf54584 100644
--- a/drivers/staging/octeon/ethernet-mdio.c
+++ b/drivers/staging/octeon/ethernet-mdio.c
@@ -147,12 +147,6 @@  int cvm_oct_phy_setup_device(struct net_device *dev)
 
 	phy_node = of_parse_phandle(priv->of_node, "phy-handle", 0);
 	if (!phy_node && of_phy_is_fixed_link(priv->of_node)) {
-		int rc;
-
-		rc = of_phy_register_fixed_link(priv->of_node);
-		if (rc)
-			return rc;
-
 		phy_node = of_node_get(priv->of_node);
 	}
 	if (!phy_node)
diff --git a/drivers/staging/octeon/ethernet.c b/drivers/staging/octeon/ethernet.c
index 204f0b1..2b0d05d 100644
--- a/drivers/staging/octeon/ethernet.c
+++ b/drivers/staging/octeon/ethernet.c
@@ -13,6 +13,7 @@ 
 #include <linux/phy.h>
 #include <linux/slab.h>
 #include <linux/interrupt.h>
+#include <linux/of_mdio.h>
 #include <linux/of_net.h>
 #include <linux/if_ether.h>
 #include <linux/if_vlan.h>
@@ -892,6 +893,15 @@  static int cvm_oct_probe(struct platform_device *pdev)
 				break;
 			}
 
+			if (priv->of_node && of_phy_is_fixed_link(priv->of_node)) {
+				r = of_phy_register_fixed_link(priv->of_node);
+				if (r) {
+					netdev_err(dev, "Failed to register fixed link for interface %d, port %d\n",
+						   interface, priv->ipd_port);
+					dev->netdev_ops = NULL;
+				}
+			}
+
 			if (!dev->netdev_ops) {
 				free_netdev(dev);
 			} else if (register_netdev(dev) < 0) {