MFC r344505-r344507, r344523, r344525-r344526, r344529, r344606-r344612,r344614-r344616, r344681, r344684-r344686, r344728, r344733-r344734, r344981A large set of changes that collectively moderni
MFC r344505-r344507, r344523, r344525-r344526, r344529, r344606-r344612,r344614-r344616, r344681, r344684-r344686, r344728, r344733-r344734, r344981A large set of changes that collectively modernize the at45d and mx25l(DataFlash and SpiFlash) drivers, add FDT support, and add geom_flashmap andgeom_label support to them.r344505:Add a functional detach() implementation to make module unloading possible.r344506:Add support for probing/attaching on FDT-based systems.r344507:Switch to using config_intrhook_oneshot(). That allows the error handlingin the delayed attach to use early returns, which allows reducing the levelof indentation. So all in all, what looks like a lot of changes is reallyno change in behavior, mostly just moving whitespace around.r344523:Include the jedec "extended device information string" in the criteria usedto match a chip to our table of metadata describing the chips. At least onenew DataFlash chip has a 3-byte jedec ID identical to its predecessors anddiffers only in the extended info, and it has different metadata requiring aunique entry in the table. This paves the way for supporting such chips.The metadata table now includes two new fields, extmask and extid. The twobytes of extended info obtained from the chip are ANDed with extmask thencompared to extid, so it's possible to use only a subset of the extendedinfo in the matching.We now always read 6 bytes of jedec ID info. Most chips don't return anyextended info, and the values read back for those two bytes may beindeterminate, but such chips have extmask and extid values of 0x0000 in thetable, so the extid effectively doesn't participate in the matching on thosechips and it doesn't matter what they return in the extended info bytes.r344525:Add a metadata entry for the AT45DB641E chip. This chip has the same 3-bytejedec ID as its older cousin the AT45DB642D, but uses a different page size.The only way to distinguish between the two chips is that the 2D chip has0 bytes of extended ID info and the new 1E has 1 byte of extended ID. Theactual value of the extended ID byte is all zeroes. In other words, it'sthe presence of the extended info that identifies this chip. (Presumablya future upgrade might define non-zero values for the extended ID byte.)r344526:Resolve a name conflict when both SpiFlash and DataFlash devices are present.Both SpiFlash (mx25l) and DataFlash (at45d) drivers create a disk devicewith a name of /dev/flash/spiN where N is the driver's unit number. Ifboth types of devices are present in the same system, this creates a fatalconflict that prevents attachment of whichever device attaches second(because mx25l0 and at45d0 both try to create a spi0).This gives each type of device a unique name (mx25lN or at45dN respectively)and also adds an alias of spiN for compatibility. When both device typesappear in the same system, only the first to attach gets the spiN alias.When the second device attaches there is a non-fatal warning that the aliascan't be created, but both devices are still accessible via their primarynames (and there is no need for the spiN name to work for backwardscompatibility on such a system, because it has never been possible to usethe spiN names when both devices exist).r344529:Fix a paste-o that broke the build on all arches.r344606:Add support for geom_flashmap by providing a getattr() for "SPI:device".r344607:Compile fdt_slicer and geom_flashmap when the at45d device is included.r344608:Update a comment to reflect reality; no functional changes.r344609:Make it possible to load fdt_slicer as a module (unloading works too fwiw).r344610:Add manpages for at45d(4) and mx25l(4).r344611:Add a module dependency on fdt_slicer.r344612:Add a module dependency on fdt_slicer. Also, move the PNP_INFO to its moreusual location, down near the DRIVER_MODULE() stuff.r344614:Rename some functions and variables to have shorter names, which allowsunwrapping multiple lines of code. Also, convert some short multilinecomments into single-line comments. Change old-school FALSE to false.All in all, no functional changes, it's just more compact and readable.r344615:Child nodes with a compatible property are not slices, according to thedevicetree/bindings/mtd/partitions.txt document, so just ignore them.r344616:Add support to fdt_slicer for the new style partition data documented indevicetree/bindings/mtd/partition.txt.In the old style, all the children of the device node which did not have acompatible property were the partitions. In the new style, there is a childnode of the device which has a compatible string of "fixed-partitions", andits children are the individual partitions.Also, support the read-only property by setting the corresponding slice flag.r344681:Build fdt support modules on systems that use fdt data.kern.opts.mk sets make var OPT_FDT to a non-empty value if platform.hcontains OPT_FDT.r344684:Undo accidental part of r344681.I think I must have accidentally mouse-click pasted while scrolling anddidn't notice it.Reported by: jhibbits@r344685:Add required header file to SRCS.r344686:Add another required header file.For some reason this seems to be required on aarch64, but I can build armv7from clean without needing this in the list. (The file does get included,so the mystery is why armv7 works.)r344728:Bugfix: use a dummy buffer for the inactive side of a transfer.This is especially important for writes. SPI is inherently a bidirectionalbus; you receive data (even if it's garbage) while writing. We should notreceive that data into the same buffer we're writing to the device.When reading it doesn't matter what we send to the device, but using thedummy buffer for that as well is pleasingly symmetrical.r344733:Add some comments. Give #define'd names to some scattered numbers. Changesome #define'd names to be more descriptive. When reporting a post-writecompare failure, report the page number, not the byte address of the page.The latter is the only functional change, it makes the number match thewords of the error message.r344734:Allow the sector size of the disk device to be configured using hints orFDT data. The sector size must be a multiple of the device's page size.If not configured, use the historical default of the device page size.Setting the disk sector size to 512 or 4096 allows a variety of standardfilesystems to be used on the device. Of course you wouldn't want to bewriting frequently to a SPI flash chip like it was a disk drive, but fordata that gets written once (or rarely) and read often, using a standardfilesystem is a nice convenient thing.r344981:Give the mx25l device sole ownership of the name /dev/flash/spi* instead oftrying to use disk_add_alias() to make spi* an alias for mx25l*. It turnsout disk_add_alias() works for partitions, but not slices, and that's hardto fix.This change is, in effect, a partial revert of r344526.The mips world relies on the existence of flashmap names formatted as/dev/flash/spi0s.name, whereas pretty much nothing relies on at45d devicesusing the /dev/spi* names (because until recently the at45d driver didn'teven work reliably). So this change makes mx25l devices the sole owner ofthe /dev/flash/spi* namespace, which actually makes some sense because it isa SpiFlash(tm) device, so flash/spi isn't a horrible name.
show more ...