PC-BSD/trueos 051d65csys/conf files, sys/dev/usb usb_fdt_support.c usb_fdt_support.h

Add common support functions for USB devices configured via FDT data.

FDT data is sometimes used to configure usb devices which are hardwired into
an embedded system. Because the devices are instantiated by the usb
enumeration process rather than by ofwbus iterating through the fdt data, it
is somewhat difficult for a usb driver to locate fdt data that belongs to
it. In the past, various ad-hoc methods have been used, which can lead to
errors such applying configuration that should apply only to a hardwired
device onto a similar device attached by the user at runtime. For example,
if the user adds an ethernet device that uses the same driver as the builtin
ethernet, both devices might end up with the same MAC address.

These changes add a new usb_fdt_get_node() helper function that a driver can
use to locate FDT data that belongs to a single unique instance of the
device. This function locates the proper FDT data using the mechanism
detailed in the standard "usb-device.txt" binding document [1].

There is also a new usb_fdt_get_mac_addr() function, used to retrieve the
mac address for a given device instance from the fdt data. It uses
usb_fdt_get_node() to locate the right node in the FDT data, and attempts to
obtain the mac-address or local-mac-address property (in that order, the
same as linux does it).

The existing if_smsc driver is modified to use the new functions, both as an
example and for testing the new functions. Rpi and rpi2 boards use this
driver and provide the mac address via the fdt data.

[1] https://github.com/torvalds/linux/blob/master/Documentation/devicetree/bindings/usb/usb-device.txt

Differential Revision:  https://reviews.freebsd.org/D20262
DeltaFile
+168-0sys/dev/usb/usb_fdt_support.c
+2-142sys/dev/usb/net/if_smsc.c
+48-0sys/dev/usb/usb_fdt_support.h
+4-0sys/modules/usb/usb/Makefile
+1-0sys/conf/files
+223-1425 files

UnifiedSplitRaw