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

From: Rob Herring <[email-masked]>
Date: Tue, 21 Sep 2021 16:07:39 -0500

On Thu, Sep 16, 2021 at 02:35:41PM +0200, Andrew Lunn wrote:
> > >> +	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".

Don't use wildcards in compatible strings.

> 
> 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.

A wildcard doesn't help with this. If some boards are wrong, not any way 
we can fix that short of a DT update. If you can update the DT, then you 
can correct the string then.

Rob