aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/flash
Commit message (Collapse)AuthorAgeFilesLines
...
* Make all internal routines return an int error status, and check theIan Lepore2018-03-181-41/+47
| | | | | | | | status at all call points. Combine the get_status and wait_for_ready routines, since waiting for ready is the only reason to ever get status. Notes: svn path=/head/; revision=331138
* Add sc_parent to the softc and use it in place of device_get_parent() callsIan Lepore2018-03-181-46/+33
| | | | | | | | | all over the place. Also pass the softc as the arg to all the internal functions instead of passing a device_t and calling device_get_softc() in each function. Notes: svn path=/head/; revision=331136
* Bugfix: wait for writes/erases to complete after starting them, instead ofIan Lepore2018-03-181-1/+2
| | | | | | | | | | | | | | | before starting them. Using the wait-before logic would make sense if there was useful time- consuming work that could be done between the end of one write and the beginning of the next, but it also requires doing the wait-for-ready before reading, because a prior write or erase could still be in progress. Reading is the far more common case, so adding a whole extra bus transaction to check for ready before each read would soak up any small gains that might be had from doing async writes. Notes: svn path=/head/; revision=331132
* Eliminate some unneeded intermediate variables. Eliminate some redundantIan Lepore2018-03-181-45/+36
| | | | | | | parens in shift-and-mask expressions. Reword and reflow some comments. Notes: svn path=/head/; revision=331129
* Remove a pointless KASSERT and reword a comment a bit. The KASSERT testedIan Lepore2018-03-181-10/+2
| | | | | | | | | for the same condition that the preceeding lines checked for and would have returned EIO, so the assert could never possibly trigger (sc_sectorsize must inherently be an integer multiple of FLASH_PAGE_SIZE). Notes: svn path=/head/; revision=331126
* Do not overwrite the contents of BIO_WRITE buffers. SPI inherentlyIan Lepore2018-03-181-1/+2
| | | | | | | | | | transfers data in both directions at once. When writing to the device, use a dummy buffer for the incoming data, not the same buffer as the outgoing data. Writes are done in FLASH_PAGE_SIZE chunks, which is only 256 bytes, so just put the dummy buffer into the softc. Notes: svn path=/head/; revision=331123
* Add a functional detach() routine, to make things kldunload-friendly.Ian Lepore2018-02-241-2/+40
| | | | Notes: svn path=/head/; revision=329911
* Add missing MODULE_DEPENDS().Ian Lepore2018-02-202-0/+2
| | | | Notes: svn path=/head/; revision=329620
* sys/dev: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-273-0/+6
| | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Notes: svn path=/head/; revision=326255
* Add Microchip 1-MBit SPI flash IDJustin Hibbits2017-10-301-0/+1
| | | | | | | Used on the AmigaOne X5000. Notes: svn path=/head/; revision=325113
* [mx25l] add new device ids.Adrian Chadd2017-05-061-0/+2
| | | | | | | | Submitted by: Hiroki Mori <yamori813@yahoo.co.jp> Differential Revision: https://reviews.freebsd.org/D10621 Notes: svn path=/head/; revision=317870
* [mx25l] add new device id.Adrian Chadd2016-07-211-0/+3
| | | | | | | | | | | Tested: * (submitter) TP-Link TL-WR1043nd v3 Submitted by: tj@enoti.me Notes: svn path=/head/; revision=303150
* Add support for Atmel at25df641 flashBaptiste Daroussin2016-06-081-0/+3
| | | | | | | Submitted by: Grégory Soutadé <soutade@gmail.com> (via github pull request) Notes: svn path=/head/; revision=301632
* [mx25l] add Winbond w25x64 support.Adrian Chadd2016-05-261-0/+1
| | | | | | | | PR: https://github.com/freebsd/freebsd/pull/16 Submitted by: https://github.com/epipenau Notes: svn path=/head/; revision=300704
* Modify mx25l FDT compatible device handlingStanislav Galabov2016-04-201-3/+17
| | | | | | | | | | | | If we cannot establish compatibility by only looking at the compat_data we also check the flash_devices structure's names for a compatible device. Approved by: adrian (mentor) Sponsored by: Smartcom - Bulgaria AD Differential Revision: https://reviews.freebsd.org/D6026 Notes: svn path=/head/; revision=298347
* sys/dev: use our nitems() macro when it is avaliable through param.h.Pedro F. Giffuni2016-04-191-1/+1
| | | | | | | | | | No functional change, only trivial cases are done in this sweep, Drivers that can get further enhancements will be done independently. Discussed in: freebsd-current Notes: svn path=/head/; revision=298307
* undo previous commit - WIP was committed by accident.Adrian Chadd2016-04-171-3/+3
| | | | | | | Noticed by: bz Notes: svn path=/head/; revision=298148
* Only compile the FDT bits when we are using FDT.Adrian Chadd2016-04-172-3/+5
| | | | Notes: svn path=/head/; revision=298136
* Make mx25l compatible with jedec,spi-nor as wellStanislav Galabov2016-04-151-1/+7
| | | | | | | | | | | | | A lot of dts files define the SPI flashes supported by mx25l as compatible with 'jedec,spi-nor', so we add this to the mx25l compat_data. Approved by: adrian (mentor) Sponsored by: Smartcom - Bulgaria AD Differential Revision: https://reviews.freebsd.org/D5962 Notes: svn path=/head/; revision=298060
* Enable 4-byte address support for the mx25l family of SPI flash devices.Stanislav Galabov2016-04-042-18/+93
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce 2 new flags: - FL_ENABLE_4B_ADDR (forces the use of 4-byte addresses) - FL_DISABLE_4B_ADDR (forces the use of 3-byte addresses) If an SPI flash chip is defined with FL_ENABLE_4B_ADDR in its flags, then an 'Enter 4-byte mode' command is sent to the chip at attach time and, later, all commands that require addressing are issued with 4-byte addresses. If an SPI flash chip is defined with FL_DISABLE_4B_ADDR in its flags, then an 'Exit 4-byte mode' command is sent to the chip at attach time and, later, all commands that require addressing are issued with 3-byte addresses. For chips that do not have any of these flags defined the behaviour is unchanged. This change also adds support for the MX25L25735F and MX25L25635E chips (vendor id 0xc2, device id 0x2019), which support 4-byte mode and enables 4-byte mode for them. These are 256Mbit devices (32MiB) and, as such, can only be fully addressed by using 4-byte addresses. Approved by: adrian (mentor) Sponsored by: Smartcom - Bulgaria AD Differential Revision: https://reviews.freebsd.org/D5808 Notes: svn path=/head/; revision=297534
* Add basic FDT support for the mx25l SPI flash.Luiz Otavio O Souza2016-03-301-0/+16
| | | | | | | Sponsored by: Rubicon Communications (Netgate) Notes: svn path=/head/; revision=297423
* [flash] Teach mx25l SPI flash driver to interact with fdt_slicer and ↵Adrian Chadd2016-01-221-0/+23
| | | | | | | | | | | | | | | | | | | | | geom_flashmap This teaches the mx25l driver (sys/dev/flash/mx25l.c) to interact with sys/dev/fdt/fdt_slicer.c and sys/geom/geom_flashmap.c. This allows systems with SPI flash to benefit from the possibility to define flash 'slices' via FDT, just the same way that it's currently possible for CFI and NAND flashes. Tested: * Carambola 2, AR9331 + SPI NOR flash PR: kern/206227 Submitted by: Stanislav Galabov <sgalabov@gmail.com> Notes: svn path=/head/; revision=294544
* Add support for s25fl256s. I /think/ it's a 32mb NOR flash part.Adrian Chadd2015-11-051-0/+1
| | | | | | | | This is submitted by a FreeBSD wifi user who has requested they not be named. Thankyou! Notes: svn path=/head/; revision=290380
* Check the return value of config_intrhook_establish().Kevin Lo2015-03-031-1/+3
| | | | Notes: svn path=/head/; revision=279557
* Fix a few typos for s25fl types.Luiz Otavio O Souza2013-08-281-2/+2
| | | | | | | Approved by: adrian (mentor) Notes: svn path=/head/; revision=254991
* Add support for two new winbond SPI flash parts.Adrian Chadd2013-06-081-1/+5
| | | | | | | | | | | | | | | | | The 8devices carambola 2 board uses the 16MB part. Here's how it looks: spibus0: <spibus bus> on spi0 mx25l0: <M25Pxx Flash Family> at cs 0 on spibus0 mx25l0: w25q128, sector 65536 bytes, 256 sectors Tested: * 8devices Carambola 2 board Notes: svn path=/head/; revision=251550
* Remove duplicate const specifiers in many drivers (I hope I got all ofDimitry Andric2012-11-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | them, please let me know if not). Most of these are of the form: static const struct bzzt_type { [...list of members...] } const bzzt_devs[] = { [...list of initializers...] }; The second const is unnecessary, as arrays cannot be modified anyway, and if the elements are const, the whole thing is const automatically (e.g. it is placed in .rodata). I have verified this does not change the binary output of a full kernel build (except for build timestamps embedded in the object files). Reviewed by: yongari, marius MFC after: 1 week Notes: svn path=/head/; revision=242625
* Add more SPI flash IDs.Aleksandr Rybalko2012-09-251-9/+16
| | | | | | | | | Submitted by: Luiz Otavio O Souza. Submitted by: ZRouter.org project. Approved by: adrian (menthor) Notes: svn path=/head/; revision=240939
* Add a new flash part - 4MB SPI flash from Winbond.Adrian Chadd2012-08-281-0/+1
| | | | Notes: svn path=/head/; revision=239794
* Revert r236529, re-enabling verification of the flashed content asMarius Strobl2012-06-181-2/+0
| | | | | | | | the underlying problem was dealt with in r237239 (in fact, disabling verification also actually only made the problem less likely to occur). Notes: svn path=/head/; revision=237240
* Disable verification of the flashed content for now; for reasons unknownMarius Strobl2012-06-031-0/+2
| | | | | | | it sometimes causes physwr to hang. Notes: svn path=/head/; revision=236529
* - Loop up to 3 seconds when waiting for a device to get ready. [1]Marius Strobl2012-06-031-96/+261
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - Make the device description match the driver name. - Identify the chip variant based on the JEDEC and use that information to use the proper values for page count, offset and size instead of hardcoding a AT45DB642x with 2^N byte page support disabled. - Take advantage of bioq_takefirst(). - Given that CONTINUOUS_ARRAY_READ_HF (0x0b) command isn't even mentioned in Atmel's DataFlash Application Note, as suggested by the previous comment may not work on all all devices and actually doesn't properly on at least AT45DB321D (JEDEC 0x1f2701), rewrite at45d_task() to use CONTINUOUS_ARRAY_READ (0xe8) for reading instead. This rewrite is laid out in a way allowing to easily add support for BIO_DELETE later on. - Add support for reads and writes not starting on a page boundary. - Verify the flash content after writing. - Let at45d_task() gracefully handle errors on SPI transfers and the device not becoming ready afterwards again. [1] - Use DEVMETHOD_END. [1] - Use NULL instead of 0 for pointers. [1] Additional testing by: Ian Lepore Submitted by: Ian Lepore [1] MFC after: 1 week Notes: svn path=/head/; revision=236496
* Add a couple more SPI flash device IDs found in commercialAdrian Chadd2012-01-041-0/+2
| | | | | | | | | consumer wireless kit. Submitted by: Stefan Bethke <stb@lassitu.de> Notes: svn path=/head/; revision=229464
* Modify the spi flash driver to allow smaller read IO sizes, but enforceAdrian Chadd2011-02-161-17/+18
| | | | | | | | | | | | | | | the larger, aligned write+erase sizes the driver currently implements. This preserves write behaviour but makes the flash driver usable for things like a read-only FFS or a geom_uzip/geom_compress . Note that since GEOM will now return the sector size as being smaller, writes of sector size/alignment will now fail with an EIO. Code which writes to the flash device will have to be (for now) manually taught about the flash write blocksize. Notes: svn path=/head/; revision=218747
* Add support for the m25p64; lifted straight from Linux.Adrian Chadd2011-01-301-0/+1
| | | | | | | | This flash chip is found on the Ubiquiti LS-SR71 board. I've successfully tested reading; I've not tried writing to it yet. Notes: svn path=/head/; revision=218088
* Add s25sl064a, an 8mb SPI flash part.Adrian Chadd2010-08-171-0/+1
| | | | Notes: svn path=/head/; revision=211432
* Fix naming to be consistent.Adrian Chadd2010-07-191-2/+2
| | | | Notes: svn path=/head/; revision=210265
* Extend the mx25l erase function to support different erase commands.Adrian Chadd2010-07-191-3/+3
| | | | Notes: svn path=/head/; revision=210264
* Extend the mx25l flash device support to include a set of per-deviceAdrian Chadd2010-07-191-4/+11
| | | | | | | | | | flags. Some of these parts will support 4K/32K block erases rather than a sector erase. This includes (at least) the MX25L128. Notes: svn path=/head/; revision=210262
* Include 4k/32k erase commands.Adrian Chadd2010-07-191-0/+4
| | | | | | | | | | These were sourced from the MX25L128 datasheet and match up with what is used in Linux mtd/devices/m25p80.c . Add a FreeBSD keyword whilst I'm here. Notes: svn path=/head/; revision=210238
* Fix KASSERT() messages to reflect reality.Adrian Chadd2010-07-161-2/+2
| | | | Notes: svn path=/head/; revision=210156
* - Code reorg: extract mx25l_read and mx25l_write methodsOleksandr Tymoshenko2009-11-181-81/+146
| | | | | | | | - Add entry for Spansion flash controller Submitted by: Eric L. Chen <lihong@ieee.org> Notes: svn path=/projects/mips/; revision=199494
* - Add write support for mx25l flash chipOleksandr Tymoshenko2009-10-252-1/+104
| | | | | | | - Some minor style(9) fixes Notes: svn path=/projects/mips/; revision=198465
* o Move the driveid.h fileWarner Losh2009-06-141-259/+0
| | | | | | | | | | o lots of tweaks to header paths. o comment out SMP for the moment # we now make it through the .c make depend, the .s needs more work. Notes: svn path=/projects/mips/; revision=194155
* Part of the cf driver missed.Warner Losh2009-06-141-0/+259
| | | | Notes: svn path=/projects/mips/; revision=194154
* Move dev/flash/ cf driver into octeon dir where it belongs.Warner Losh2009-06-142-654/+0
| | | | Notes: svn path=/projects/mips/; revision=194150
* Merge in Cavium's CF driver. This too is in the wrong place and willWarner Losh2009-06-142-0/+654
| | | | | | | be moved. Notes: svn path=/projects/mips/; revision=194149
* Merge from HEADOleksandr Tymoshenko2009-05-261-1/+0
|\ | | | | | | Notes: svn path=/projects/mips/; revision=192819
| * - Remove nonexistent header file from includes listOleksandr Tymoshenko2009-05-131-1/+0
| | | | | | | | Notes: svn path=/head/; revision=192058
* | - Add support for MX25Lxxx SPI flash (readonly atm)Oleksandr Tymoshenko2009-05-182-0/+369
|/ | | | Notes: svn path=/projects/mips/; revision=192355