#
346547 |
|
22-Apr-2019 |
ian |
MFC r336137-r336138, r336202, r336214, r336216
r336137: Add a manpage for the imx_spi driver.
r336138: Add pnp info to the imx_spi driver.
r336202: Enhancements and fixes for the spigen(4) driver...
- Resources used by spigen_mmap_single() are now tracked using devfs_set_cdevpriv() rather than in the softc.
- Since resources are now tracked per-open-fd, there is no need to try to impose any exclusive-open logic, so flags related to that are removed.
- Flags used to track open status to prevent detach() when the device is open are replaced with calls to device_busy()/device_unbusy(). That extends the protection up the hierarchy so that the spibus and hardware controller drivers also can't be detached while the device is open/in use.
- Arbitrary limits on the maximum size of a transfer are removed, along with the sysctl variables that allowed the limits to be changed. There is just no reason to limit the size of a spi transfer to the machine's page size. Or to any other arbitrary value, really.
- Most of the locking is removed. It was mostly protecting access to flags and fields in the softc that no longer exist. The locking that remains is just to prevent concurrent calls to device_[un]busy().
- The code was calling malloc() with M_WAITOK while holding a mutex in several places. Since most of the locking is gone, that's fixed.
r336214: Add various spi devices to NOTES.
r336216: Actually build and install the spigen.4 manpage.
|
#
346517 |
|
22-Apr-2019 |
ian |
MFC r335506
r335506: Incorporate bus and chip select numbers into spigen(4) cdev names. Rather than assigning spigen device names in order of creation, this uses a device name that corresponds to the owning spibus and chip-select index.
Example: /dev/spigen0.1 would be a child of spibus0, and use cs = 1
The intent is for systems like Raspberry Pi to have a consistent way of using an SPI interface with a specific cs value from a user application. Otherwise, there is no consistent way of knowing which cs pin will be assigned to a particular spigen device. The alternative is to specify everything in "the right order" in an overlay file, which is less than ideal. Additionally, this duplicates (to some extent) the way Linux handles a similar situation with their 'spidev' device, so it would be somewhat familiar to those who also use Linux.
A new kernel config option, SPIGEN_LEGACY_CDEVNAME, causes the driver to also create /dev/spigenN device name aliases, with N incrementing in the order of device instantiation. This is provided to ease the transition for existing systems using the original naming convention (particularly when these changes are MFC'd to stable branches).
Differential Revision: https://reviews.freebsd.org/D15301
|
#
332942 |
|
24-Apr-2018 |
ian |
MFC r331868, r332046, r332194-r332196, r332198, r332219, r332231, r332233, r332240, r332258-r332259, r332261, r332292
r331868: Add opt_platform.h for several modules that have #ifdef FDT in the source.
Submitted by: Andre Albsmeier <Andre.Albsmeier@siemens.com>
r332046: Add a missing MODULE_DEPEND().
r332194: Add support for writing/changing spi device ivars. The SPI mode (polarity and phase) and the maximum bus speed can be changed. The chip select number cannot be changed, because the device instances which are children of spibus are inherently associated with the chip select number they were instantiated for.
r332195: A couple minor improvements to spibus.c...
- Change the description string to "SPI bus" (was "spibus bus").
- This is the default driver for a SPI bus, not a generic implementation, so return the probe value that indicates such.
- Use device_delete_children() at detach time, instead of a local loop to enumerate the children and detach each one individually.
r332196: Return BUS_PROBE_DEFAULT, not zero, because this is not the one driver implementation that must be used, it's just the base system default driver.
Also add a comment noting that we're being more liberal about the bus frequency property than the dts binding documents require.
r332198: Arrange the list of generated sources as 1-per-line alphbetical, and add the files required when building for FDT-based systems.
r332219: Remove the existing identify() hack to force-add a spigen device on FDT-based systems, and instead add proper FDT probe code. Because this driver is freebsd-specific and just provides generic userland access to run spibus transactions, there is no bindings document to mandate a compatible string, so just arbitrarily use "freebsd,spigen".
r332231: Generate a spibus_set_[ivarname]() convenience function for each ivar, now that they can be set.
r332233: Add an ioctl to get/set the SPI transfer mode. Also, make the bus clock frequency ioctl actually set the corresponding ivar instead of just storing the value locally in the softc (and then not using it for anything). Also, return the correct error code if the ioctl cmd is not recognized.
r332240: Add the ioctl definitions for spigen get/set spi mode. Should have been part of r332233.
r332258: Don't check for impossible NULL return from malloc(..., M_WAITOK).
r332259: Cast the data pointer to the correct type for the data being accessed (as opposed to one that accidentally worked on the one arch I test-compiled for on my first try).
Reported by: np@, O. Hartmann <ohartmann@walstatt.org> Pointy hat: ian@
r332261: Add a manpage for spigen(4).
r332292: Allow hinted attachment on FDT-based systems. Instead of returning ENXIO when the FDT data doesn't enable the device instance, return BUS_PROBE_NOWILDCARD, the same as for non-FDT systems.
|