This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/AM3358: Add Lan9514 in device tree

Part Number: AM3358

Tool/software: Linux

Hi,

My board is basically based on beaglebone black, I need to add support to Lan9514 ww1.microchip.com/.../00002306a.pdf.

Actually the board support kernel boot with tftp and load root file system with nfs, everything works really well with default Ethernet interface cpws.

Now I'm trying to achieve the same result using the evb9514 https://www.microchip.com/Developmenttools/ProductDetails/EVB9514. The first step was to add support in u-boot and after reading some documentations I did and now I can load the kernel with tftp using the external eth, now is the time to allow kernel nfs load the root filesystem. Of course the la9514 is fully supported in linux4.14 ( using the ti-processor-sdk-linux-am335x-evm-05.01.00.11) if I run the kernel and the root filesystem from default interface and attach the evb, it is fully supported hub+ethernet. 

From u-boot the kernel params are

console=ttyS0,115200n8 root=/dev/nfs nfsroot=${serverip}:/media/ubuntu_ext_ws/tisdk/targetNFS/,nolock,v3,tcp,rsize=4096,wsize=4096 rw ip=dhcp

The most important param is ip=dhcp, from https://www.kernel.org/doc/Documentation/filesystems/nfs/nfsroot.txt it seems in case of multiple interface device the first one that take a good configuration will be

used as default interface, so in theory if the Ethernet cable is only attached to lan9515 it should works.

So the final step is to add the evb statically in the device tree, here is what I done in am335x-boneblack.dts

&usb {
usb1@1 {
compatible = "usb424,9514";
reg = <1>;
#address-cells = <1>;
#size-cells = <0>;

ethernet: usbether@1 {
compatible = "usb424,ec00";
reg = <1>;
};
};
};

Unfortunately the evb is not detect after the kernel is loaded and the kernel nfs drive can't run. I'm quite new with the device tree so I suppose the problem is there.

Thanks

  • Hi,

    This has nothing to do with device tree to use Lan9514 for NFS. If you can use the Lan9514 device in Linux, you are almost there.
    The only steps left are

    - reconfigure the kernel to make *all* usb related modules into kernel zImage, including the Lan9514 driver, because you have to have the Lan9514 interface up before NFS is mounted;

    - to get NFS mount on the Lan9514 interface - you have a couple of options here
    1. specify the Lan9514 interface name on the 'ip=' parameter in bootargs, I used 'ip=<static_ip>:::::eth2', where eth2 in Lan9514 interface. The problem is that I don't know how to use dhcp in this case;
    2. If you have to use dhcp, you can disable cpsw in devicetree, your system has only one network interface - lan9514, then you can use 'ip=dhcp' in bootargs.

    Let me if this works for you.
  • Hi

    Bin Liu said:
    Hi,

    This has nothing to do with device tree to use Lan9514 for NFS. If you can use the Lan9514 device in Linux, you are almost there.
    The only steps left are

    - reconfigure the kernel to make *all* usb related modules into kernel zImage, including the Lan9514 driver, because you have to have the Lan9514 interface up before NFS is mounted;

    This was my first trial, but for some reasons everything is in 

    #
    # Host-side USB support is needed for USB Network Adapter support
    #
    CONFIG_USB_NET_DRIVERS=m

    can be only linked as modules and not statically. I will check again if you are sure.

    Bin Liu said:

    - to get NFS mount on the Lan9514 interface - you have a couple of options here
    1. specify the Lan9514 interface name on the 'ip=' parameter in bootargs, I used 'ip=<static_ip>:::::eth2', where eth2 in Lan9514 interface. The problem is that I don't know how to use dhcp in this case;
    2. If you have to use dhcp, you can disable cpsw in devicetree, your system has only one network interface - lan9514, then you can use 'ip=dhcp' in bootargs.

    1: Same idea and same problem, I will check again to find a way to set interface and autoconfiguration

    2: I can't

    Thanks

  • gzazo said:

    CONFIG_USB_NET_DRIVERS=m

    can be only linked as modules and not statically. I will check again if you are sure.

    This is likely due to dependent module(s) is configured as module. In kernel menuconfig you can move the cursor to this config item then hit the 'Help' button, it will show you what modules the USB_NET_DRIVERS depends on and their configurations (=m or =y), then you can figure out why this option cannot be set to '=y'.

    gzazo said:
    2: I can't

    because you tried but failed or you need cpsw so don't want to disable it?

  • Bin Liu said:

    This is likely due to dependent module(s) is configured as module. In kernel menuconfig you can move the cursor to this config item then hit the 'Help' button, it will show you what modules the USB_NET_DRIVERS depends on and their configurations (=m or =y), then you can figure out why this option cannot be set to '=y'.

    I'm searching the dependency

    Bin Liu said:

    because you tried but failed or you need cpsw so don't want to disable it?

    I'm not so ignorant with device tree :P. I know how to remove or add a device, my device tree is highly modified, we can't because we need of cpsw. I'm still curious to see how attach an hub+ethernet in dts, I saw a lot of example but no one works.
    Asap I will let you know.
    Thanks
  • gzazo said:
    I'm still curious to see how attach an hub+ethernet in dts, I saw a lot of example but no one works.

    I am not sure what examples you saw, but any attached usb device (hub, usb-ethernet, or anything else) has nothing to do with dts, they got supported through usb enumeration.

  • Bin Liu said:

    I am not sure what examples you saw, but any attached usb device (hub, usb-ethernet, or anything else) has nothing to do with dts, they got supported through usb enumeration.

    I totally agree with you, but this is an example how rpi3 give support to lan9514, from bcm283x-rpi-smsc9514.dtsi .
    It seems completely legal to do that from /Documentation/devicetree/bindings/usb/usb-device.txt .What I have to do at the end of day is to attach an hard wired usb device.
    &usb {
    	usb1@1 {
    		compatible = "usb424,9514";
    		reg = <1>;
    		#address-cells = <1>;
    		#size-cells = <0>;
    
    		ethernet: usbether@1 {
    			compatible = "usb424,ec00";
    			reg = <1>;
    		};
    	};
    };



     
  • I am not familiar this usb device bindings for hard wired usb devices, I didn't look it before. In a quick look in the kernel source code, I didn't figure out how this lan9514 dt nodes get used in kernel drivers. But what I believe is that if currently you have got lan9514 working in Linux without this dt node, you will not need it for hard wired case either.
  • I did, it works. The trick was to enable only the right host device controller, in this case MUSB HDRC host driver. Attached my config for the future.tisdk_am335x-evm_defconfig.config

    My question is still valid, in raspberrypi3 device tree the lan9514 has a descriptor. I suppose there is a reason, and if so which is the difference to add an usb device in device tree against to "wait" usb enumeration comes up?

    Thanks

  • Yes, you question is valid, but not to TI, it is out of our support scope.
    I checked the lan9514 driver which is drivers/net/usb/smsc95xx.c, it only get invoked by usb device VID:PID which is populated in the usb device enumeration. I am unable to find out how the dt nodes (compatible='usb424,xxx') is used in kernel. You might want to ask the question to the device vendor or open source community.
  • Hi, do you have any other question regarding this query? If not, I will close this thread. Thanks.
  • No thanks for your help.

    Please close