Subject: Re: [PATCH RFC 3/3] net: vertexcom: Add MSE102x SPI support

From: Andrew Lunn <[email-masked]>
Date: Thu, 16 Sep 2021 14:35:41 +0200

> >> +	netif_carrier_off(mse->ndev);
> >> +	ndev->if_port = IF_PORT_10BASET;
> > That is not correct. Maybe you should add a IF_PORT_HOMEPLUG ?

> There is already a driver (qca_spi, qcauart) for a similiar Homeplug
> device (QCA7000), which also uses IF_PORT_10BASET. Should i change this
> too or leave it because of resulting changes to userspace?

Technically, it would be an ABI change. But ifmap seems pretty loosely
defined. See man 7 netdevice:

       SIOCGIFMAP, SIOCSIFMAP
              Get or set the interface's hardware parameters using ifr_map.
	      Setting the parameters is a privileged operation.

                  struct ifmap {
                      unsigned long   mem_start;
                      unsigned long   mem_end;
                      unsigned short  base_addr;
                      unsigned char   irq;
                      unsigned char   dma;
                      unsigned char   port;
                  };

              The interpretation of the ifmap structure depends on the device driver
	      and the architecture.

The if_port value ends up in port. And i've no idea where it is
actually available in user space. iproute2 does not use it, nor
ethtool. So, i would say, submit a separate patch for the other
drivers, and we will see if anybody notices.

> >> +static const struct of_device_id mse102x_match_table[] = {
> >> +	{ .compatible = "vertexcom,mse1021" },
> >> +	{ .compatible = "vertexcom,mse1022" },
> > Is there an ID register you can read to determine what device you
> > actually have? If so, i suggest you verify the correct compatible is
> > used.
> 
> AFAIK the device doesn't have any kind of ID register.

Then i would suggest changing the compatible to "vertexcom,mse102x".

If you cannot verify it, and it makes no actual difference, then 50%
of the boards will use the wrong one. Which means you can then later
not actually make use of it to enable features specific to a
compatible string.

	   Andrew