summaryrefslogtreecommitdiff
path: root/sys/dev/spi/spiflash.c
AgeCommit message (Collapse)Author
2022-10-26fix various typos in comments and makefs README file.andvar
2022-05-08Trailing whitespaceskrll
2021-08-07Merge thorpej-cfargs2.thorpej
2021-04-24Merge thorpej-cfargs branch:thorpej
Simplify and make extensible the config_search() / config_found() / config_attach() interfaces: rather than having different variants for which arguments you want pass along, just have a single call that takes a variadic list of tag-value arguments. Adjust all call sites: - Simplify wherever possible; don't pass along arguments that aren't actually needed. - Don't be explicit about what interface attribute is attaching if the device only has one. (More simplification.) - Add a config_probe() function to be used in indirect configuiration situations, making is visibly easier to see when indirect config is in play, and allowing for future change in semantics. (As of now, this is just a wrapper around config_match(), but that is an implementation detail.) Remove unnecessary or redundant interface attributes where they're not needed. There are currently 5 "cfargs" defined: - CFARG_SUBMATCH (submatch function for direct config) - CFARG_SEARCH (search function for indirect config) - CFARG_IATTR (interface attribte) - CFARG_LOCATORS (locators array) - CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles) ...and a sentinel value CFARG_EOL. Add some extra sanity checking to ensure that interface attributes aren't ambiguous. Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark ports to associate those device handles with device_t instance. This will trickle trough to more places over time (need back-end for pre-OFW Sun OBP; any others?).
2019-09-14On second thought revert that. Let's open this can of worms some other day.tnn
2019-09-14KB -> kBtnn
2018-09-03Rename min/max -> uimin/uimax for better honesty.riastradh
These functions are defined on unsigned int. The generic name min/max should not silently truncate to 32 bits on 64-bit systems. This is purely a name change -- no functional change intended. HOWEVER! Some subsystems have #define min(a, b) ((a) < (b) ? (a) : (b)) #define max(a, b) ((a) > (b) ? (a) : (b)) even though our standard name for that is MIN/MAX. Although these may invite multiple evaluation bugs, these do _not_ cause integer truncation. To avoid `fixing' these cases, I first changed the name in libkern, and then compile-tested every file where min/max occurred in order to confirm that it failed -- and thus confirm that nothing shadowed min/max -- before changing it. I have left a handful of bootloaders that are too annoying to compile-test, and some dead code: cobalt ews4800mips hp300 hppa ia64 luna68k vax acorn32/if_ie.c (not included in any kernels) macppc/if_gm.c (superseded by gem(4)) It should be easy to fix the fallout once identified -- this way of doing things fails safe, and the goal here, after all, is to _avoid_ silent integer truncations, not introduce them. Maybe one day we can reintroduce min/max as type-generic things that never silently truncate. But we should avoid doing that for a while, so that existing code has a chance to be detected by the compiler for conversion to uimin/uimax without changing the semantics until we can properly audit it all. (Who knows, maybe in some cases integer truncation is actually intended!)
2018-01-12We always need bp->b_resid initialized before we try to toss the transfer.jakllsch
2016-08-19Reset b_resid when tossing transfer with non-zero b_error.jakllsch
2015-07-22need to forward the data pointerryo
2015-04-26Use C99-style initializers for struct dkdriver.mlelstv
2014-10-11use disk_init() wrapper function instead of poking data structures.mlelstv
2014-07-25Add d_discard to all struct cdevsw instances I could find.dholland
All have been set to "nodiscard"; some should get a real implementation.
2014-07-25Add d_discard to all struct bdevsw instances I could find.dholland
I've set them all to nodiscard. Some of them (wd, dk, vnd, ld, raidframe, maybe cgd) should be implemented for real.
2014-03-28Fix printf formating in DPRINTF.hkenken
2014-01-28Remove an unused variablemartin
2013-02-15Fix wrong calculation of destination pointer in writes.rkujawa
Existing calculation of destination pointer was always causing unnecessary erases of SPI Flash memory and was always writing each consecutive 2048 byte blocks of data into the same address of the SPI Flash memory. This commit fixes issue with writes of multiple blocks using 'dd' tool. Patch from Semihalf. Author: Michal Dubiel <md@semihalf.com>
2009-01-13g/c BUFQ_FOO() macros and use bufq_foo() directly.yamt
2008-06-11use device_lookup_private to get softccegger
2008-05-04device_t/softc split.xtraeme
2008-04-05use aprint_*_dev and device_xnamecegger
2007-07-29It's not a good idea for device drivers to modify b_flags, as they don'tad
need to understand the locking around that field. Instead of setting B_ERROR, set b_error instead. b_error is 'owned' by whoever completes the I/O request.
2007-07-19Fix the kthread_create(9) call so this compiles again.dyoung
2007-07-09Merge some of the less invasive changes from the vmlocking branch:ad
- kthread, callout, devsw API changes - select()/poll() improvements - miscellaneous MT safety improvements
2007-03-04Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.christos
2006-10-20This commit provides substantial fixes and functionality for SPI flash.gdamore
Specifically, the SPI flash now operates as a nearly fully functional block device (other than lacking disklabel support). It does some basic translation stuff, so that if you attempt to write a block, the underlying flash sectors (usually 64k in size) will be read, erased and rewritten. To minize thrashing, the spiflash strategy routine attempts to gather writes to the same sector together, so that in the typical case you will not have to repeatedly erase/rewrite the sector. It also attempts to check and verify whether an erase cycle is truly needed. There are still access patterns that will cause multiple erases to occur, and so I heartily discourage the use of these flash devices for storing anything other than small configuration data, or write-once images. If you want to do more than that, then someone should try to write a real flash translation layer. The drivers attempt to provide some level of asynchronous operation, so that while you are erasing or writing to the flash, other things can reasonably take place. Note that spiflash does not do bad block remapping. It also doesn't detect when a device is in read-only mode, or if some sectors are read-only. It only supports uniform sectored NOR flash. It lacks any code to deal with disklabels, and does not offer any disk related ioctls. These limitations aside, it would not be terribly hard, I think, to break out the code I've done to create a generic "norflash" driver, backed by a "common" spiflash module. Then other flash drivers (e.g. athflash, etc.) could benefit from the ability to use this as a block device. I've tried to architect it to support that, if someone else wants to do the work. (Hi Jared!) The primary reason that I've not added code to deal with disklabels is that I had a difficult time figuring out which framework (disklabels or wedges) to use, and which bits of code were necessary to implement. In the case of the flash devices I'm working with, a parser to deal with redboot FIS images (partitions) would need to be added. I was prepared to do this, but gave up owing to the complete and total lack of any API or design documentation pertaining to the requirements for disk drivers and disklabel management or wedges. I would strongly encourage someone who knows something about wedges or disklabels to write a simple document (or even a dummy driver) showing which interfaces should be provided in new mass storage drivers. This work was funded by the Champaign-Urbana Community Wireless Network Project.
2006-10-07Add spiflash driver, and M25P instance, used for STMicro flash devicesgdamore
found on Meraki Mini (for example).