aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/flash
Commit message (Collapse)AuthorAgeFilesLines
* chore: replace {0, 0} with {DEV,KOBJ}METHOD_ENDEnji Cooper2026-02-255-5/+5
| | | | | | | | | | | | | | Both of the aforementioned macros have been present in FreeBSD for well over a decade: 2009 for `KOBJMETHOD_END`; 2011 for `DEVMETHOD_END`. Adapt all hardcoded references of `{0, 0}` with `DEVMETHOD_END` and `KOBJMETHOD_END` as appropriate. This helps ensure that future adaptations to drivers following patterns documented in driver(9) can be made more easily/without issue. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D55414
* Fix TXFIFO register write and timeout messagePremal Gajjar2025-04-281-3/+3
| | | | | | | | | | | Changes: - Fixed incorrect register write for TXFIFO invalidation (FSPI_IPRXFCR → FSPI_IPTXFCR). - Corrected error message for TXFIFO wait timeout (FSPI_INTR_IPRXWA → FSPI_INTR_IPTXWE). - Corrected comment for TXFIFO available (RXFIFO -> TXFIFO) Reviewed-by: imp@FreeBSD.org Reviewed-by: jlduran@FreeBSD.org Pull-request: https://github.com/freebsd/freebsd-src/pull/1604
* flash: add w25n (nand flash) supportAdrian Chadd2025-02-152-0/+688
| | | | | | | | | | | | | | | | | | | This adds read only support for the W25N series of flash parts. Specifically starting with the W25N01GV, a 128MiB SPI NAND flash. This doesn't currently support writing or erasing, as this requires a NAND flash layer that we don't currently have. There are also plenty of other commands that aren't currently supported - notably maintaining the on-chip flash translation layer, flash wear statistics, etc. But read support is fine enough for now; it at least allows for reading the boot / config / calibration flash on my ASUS IPQ4018 based router. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D48979
* Replace calls to bus_generic_attach with bus_attach_childrenJohn Baldwin2024-12-061-1/+1
| | | | | Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D47675
* flexspi: Stop checking for failures from malloc(M_WAITOK)Zhenlei Huang2024-09-031-6/+0
| | | | | MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D45852
* clk: Move clock code in dev/clkEmmanuel Vadot2024-01-101-1/+1
| | | | | | | | | | | We've removed kernel option EXT_RESOURCES almost two years ago. While it was ok to have some code under a common 'extres' subdirectory at first, we now have a lot of consumer of it and we made it mandatory so no need to have it under a cryptic name. Reviewed by: mhorne Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D43191
* sys: Automated cleanup of cdefs and other formattingWarner Losh2023-11-271-1/+0
| | | | | | | | | | | | | | | | Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row. Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/ Sponsored by: Netflix
* sys: Remove $FreeBSD$: one-line sh patternWarner Losh2023-08-161-1/+0
| | | | Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
* sys: Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-165-10/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* sys: Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-162-4/+0
| | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-123-3/+3
| | | | | | | | | The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
* flash: Add "n25q64" to mx25l driverStephen J. Kiernan2023-04-181-0/+1
| | | | | | This is for 64Mb Micron N25Q serial NOR flash memory Obtained from: Juniper Networks, Inc.
* spi flash: Remove unused devclass arguments to DRIVER_MODULE.John Baldwin2022-05-095-14/+5
|
* flash: Remove unused variables.John Baldwin2022-04-132-10/+4
|
* flexspi: In flex_spi_task remove dev, it's write onlyWarner Losh2022-04-061-2/+0
| | | | Sponsored by: Netflix
* mx25l_task: eliminate dev write only variableWarner Losh2022-04-051-2/+0
| | | | Sponsored by: Netflix
* flex_spi: Don't try to destroy disk if it doesn't existKornel Duleba2021-12-071-1/+4
| | | | | | Try to stop and destroy the dist only if the driver has been successfully attached. Otherwise a kernel panic will be triggered from disk_destroy. The issue was observed on a board that missed SPI clock description in DT.
* flex_spi: Support for FlexSPI Flash controller.Wojciech Macek2021-11-302-0/+1327
| | | | | | | | | | | | | | | | NXP FlexSPI is a complex SPI controller which provides full offload for accessing NOR Flash. Create a Flash driver which attaches to existing FreeBSD infrastructure and exports generic READ and WRITE disk commands. The Flash has to be identified first to configure controller internals. For now, only one NOR Flash chip is supported. Future commits shall either increase number of known chips or implement SFDP mechanism which can be used by other Flash drivers. Sponsored by: Alstom Obtained from: Semihalf Differential revision: https://reviews.freebsd.org/D33117
* mx25l: Add support for Integrated Silicon Solution is25wp256Thomas Skibo2021-08-301-0/+3
| | | | | | | | This is used for the on-board flash on the HiFive Unmatched board. Reviewed by: #riscv, jrtc27 MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31562
* Make MAXPHYS tunable. Bump MAXPHYS to 1M.Konstantin Belousov2020-11-281-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace MAXPHYS by runtime variable maxphys. It is initialized from MAXPHYS by default, but can be also adjusted with the tunable kern.maxphys. Make b_pages[] array in struct buf flexible. Size b_pages[] for buffer cache buffers exactly to atop(maxbcachebuf) (currently it is sized to atop(MAXPHYS)), and b_pages[] for pbufs is sized to atop(maxphys) + 1. The +1 for pbufs allow several pbuf consumers, among them vmapbuf(), to use unaligned buffers still sized to maxphys, esp. when such buffers come from userspace (*). Overall, we save significant amount of otherwise wasted memory in b_pages[] for buffer cache buffers, while bumping MAXPHYS to desired high value. Eliminate all direct uses of the MAXPHYS constant in kernel and driver sources, except a place which initialize maxphys. Some random (and arguably weird) uses of MAXPHYS, e.g. in linuxolator, are converted straight. Some drivers, which use MAXPHYS to size embeded structures, get private MAXPHYS-like constant; their convertion is out of scope for this work. Changes to cam/, dev/ahci, dev/ata, dev/mpr, dev/mpt, dev/mvs, dev/siis, where either submitted by, or based on changes by mav. Suggested by: mav (*) Reviewed by: imp, mav, imp, mckusick, scottl (intermediate versions) Tested by: pho Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D27225 Notes: svn path=/head/; revision=368124
* flash: Add support for SPI flash s25fl512sNick O'Brien2020-10-021-0/+1
| | | | | | | | | Reviewed by: kp Approved by: kp (mentor) Sponsored by: Axiado Notes: svn path=/head/; revision=366366
* Enter the network epoch in the xdma interrupt handler if requiredRuslan Bukin2020-02-081-2/+2
| | | | | | | | | by a peripheral device driver. Sponsored by: DARPA, AFRL Notes: svn path=/head/; revision=357686
* Ever since the block layer expanded its command syntax beyond justScott Long2020-02-073-3/+3
| | | | | | | | | | | BIO_READ and BIO_WRITE, we've handled this expanded syntax poorly in drivers when the driver doesn't support a particular command. Do a sweep and fix that. Reported by: imp Notes: svn path=/head/; revision=357647
* zilinx/zy7_qspi: Add a qspi driver for Zynq platforms.Emmanuel Vadot2020-01-191-0/+2
| | | | | | | | | | | | This is a qspi driver for the Xilinx Zynq-7000 chip. It could be useful for anyone wanting to boot a system from flash memory instead of SD cards. Submitted by: Thomas Skibo (thomasskibo@yahoo.com) Differential Revision: https://reviews.freebsd.org/D14698 Notes: svn path=/head/; revision=356895
* Explicitly include sys/rman.h instead of relying on getting it via someIan Lepore2020-01-021-0/+1
| | | | | | | other header. Notes: svn path=/head/; revision=356294
* Regularize my copyright noticeWarner Losh2019-12-043-8/+6
| | | | | | | | | | | | o Remove All Rights Reserved from my notices o imp@FreeBSD.org everywhere o regularize punctiation, eliminate date ranges o Make sure that it's clear that I don't claim All Rights reserved by listing All Rights Reserved on same line as other copyright holders (but not me). Other such holders are also listed last where it's clear. Notes: svn path=/head/; revision=355394
* flash: Add GigaDevice gd25q128 flashEmmanuel Vadot2019-10-251-0/+1
| | | | | | | | | Add this flash chip which is a 128Mb spi flash. MFC after: 1 week Notes: svn path=/head/; revision=354086
* Use the new FDTCOMPAT_PNP_INFO() macro to define SPIBUS_FDT_PNP_INFO().Ian Lepore2019-05-232-2/+2
| | | | | | | | Also rename SPIBUS_PNP_INFO -> SPIBUS_FDT_PNP_INFO because there could be other kinds of pnpinfo for other (non-fdt) bus attachments. Notes: svn path=/head/; revision=348172
* Give the mx25l device sole ownership of the name /dev/flash/spi* instead ofIan Lepore2019-03-102-3/+1
| | | | | | | | | | | | | | | | | | | | trying to use disk_add_alias() to make spi* an alias for mx25l*. It turns out disk_add_alias() works for partitions, but not slices, and that's hard to 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 devices using the /dev/spi* names (because until recently the at45d driver didn't even work reliably). So this change makes mx25l devices the sole owner of the /dev/flash/spi* namespace, which actually makes some sense because it is a SpiFlash(tm) device, so flash/spi isn't a horrible name. Reported by: Mori Hiroki <yamori813@yahoo.co.jp> Notes: svn path=/head/; revision=344981
* Allow the sector size of the disk device to be configured using hints orIan Lepore2019-03-021-6/+34
| | | | | | | | | | | | | | FDT 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 standard filesystems to be used on the device. Of course you wouldn't want to be writing frequently to a SPI flash chip like it was a disk drive, but for data that gets written once (or rarely) and read often, using a standard filesystem is a nice convenient thing. Notes: svn path=/head/; revision=344734
* Add some comments. Give #define'd names to some scattered numbers. ChangeIan Lepore2019-03-021-11/+24
| | | | | | | | | | some #define'd names to be more descriptive. When reporting a post-write compare failure, report the page number, not the byte address of the page. The latter is the only functional change, it makes the number match the words of the error message. Notes: svn path=/head/; revision=344733
* Bugfix: use a dummy buffer for the inactive side of a transfer.Ian Lepore2019-03-021-3/+12
| | | | | | | | | | | | This is especially important for writes. SPI is inherently a bidirectional bus; you receive data (even if it's garbage) while writing. We should not receive 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 the dummy buffer for that as well is pleasingly symmetrical. Notes: svn path=/head/; revision=344728
* Add a module dependency on fdt_slicer. Also, move the PNP_INFO to its moreIan Lepore2019-02-261-1/+5
| | | | | | | usual location, down near the DRIVER_MODULE() stuff. Notes: svn path=/head/; revision=344612
* Add a module dependency on fdt_slicer.Ian Lepore2019-02-261-0/+1
| | | | Notes: svn path=/head/; revision=344611
* Add support for geom_flashmap by providing a getattr() for "SPI:device".Ian Lepore2019-02-261-0/+18
| | | | Notes: svn path=/head/; revision=344606
* Fix a paste-o that broke the build on all arches.Ian Lepore2019-02-251-1/+1
| | | | | | | | Reported by: many Pointy hat: ian@ Notes: svn path=/head/; revision=344529
* Resolve a name conflict when both SpiFlash and DataFlash devices are present.Ian Lepore2019-02-252-2/+4
| | | | | | | | | | | | | | | | | | | | Both SpiFlash (mx25l) and DataFlash (at45d) drivers create a disk device with a name of /dev/flash/spiN where N is the driver's unit number. If both types of devices are present in the same system, this creates a fatal conflict 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 types appear 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 alias can't be created, but both devices are still accessible via their primary names (and there is no need for the spiN name to work for backwards compatibility on such a system, because it has never been possible to use the spiN names when both devices exist). Notes: svn path=/head/; revision=344526
* Add a metadata entry for the AT45DB641E chip. This chip has the same 3-byteIan Lepore2019-02-251-0/+1
| | | | | | | | | | | | jedec 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 has 0 bytes of extended ID info and the new 1E has 1 byte of extended ID. The actual value of the extended ID byte is all zeroes. In other words, it's the presence of the extended info that identifies this chip. (Presumably a future upgrade might define non-zero values for the extended ID byte.) Notes: svn path=/head/; revision=344525
* Include the jedec "extended device information string" in the criteria usedIan Lepore2019-02-251-21/+47
| | | | | | | | | | | | | | | | | | | | | to match a chip to our table of metadata describing the chips. At least one new DataFlash chip has a 3-byte jedec ID identical to its predecessors and differs only in the extended info, and it has different metadata requiring a unique entry in the table. This paves the way for supporting such chips. The metadata table now includes two new fields, extmask and extid. The two bytes of extended info obtained from the chip are ANDed with extmask then compared to extid, so it's possible to use only a subset of the extended info in the matching. We now always read 6 bytes of jedec ID info. Most chips don't return any extended info, and the values read back for those two bytes may be indeterminate, but such chips have extmask and extid values of 0x0000 in the table, so the extid effectively doesn't participate in the matching on those chips and it doesn't matter what they return in the extended info bytes. Notes: svn path=/head/; revision=344523
* Switch to using config_intrhook_oneshot(). That allows the error handlingIan Lepore2019-02-251-46/+40
| | | | | | | | | in the delayed attach to use early returns, which allows reducing the level of indentation. So all in all, what looks like a lot of changes is really no change in behavior, mostly just moving whitespace around. Notes: svn path=/head/; revision=344507
* Add support for probing/attaching on FDT-based systems.Ian Lepore2019-02-241-1/+29
| | | | Notes: svn path=/head/; revision=344506
* Add a functional detach() implementation to make module unloading possible.Ian Lepore2019-02-241-1/+38
| | | | Notes: svn path=/head/; revision=344505
* Remove All Rights ReservedWarner Losh2019-02-052-2/+2
| | | | | | | | Remove the all rights reserved clause from my copyright, and make other minor tweaks needed where that might have created ambiguity. Notes: svn path=/head/; revision=343811
* The device ID tables are used only within the driver, make them static soIan Lepore2018-07-292-2/+2
| | | | | | | that both of these drivers can exist in the same kernel. Notes: svn path=/head/; revision=336869
* mx25l: compat_data is only defined when FDT isEmmanuel Vadot2018-06-141-0/+2
| | | | | | | Reported by: O. Hartmann <ohartmann@walstatt.org> Notes: svn path=/head/; revision=335170
* mx25l: Add pnp infoEmmanuel Vadot2018-06-141-0/+1
| | | | Notes: svn path=/head/; revision=335159
* mx25l: Add mx25l1606eEmmanuel Vadot2018-05-171-0/+1
| | | | | | | | This is a 16Mbits spi flash arranged in 32x64k blocks or 512x4k sectors. Notes: svn path=/head/; revision=333706
* Add driver for Cadence Quad SPI Flash Controller found onRuslan Bukin2018-04-235-0/+1473
| | | | | | | | | | | | | | | | | | Intel® Arria® 10 SoC. Cadence Quad SPI Flash is not generic SPI controller, but SPI flash controller, so don't use spibus here, instead provide quad spi flash interface. Since it is not on spibus, then mx25l flash device driver is not usable here, so provide new n25q flash device driver with quad spi flash interface. Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D10245 Notes: svn path=/head/; revision=332885
* Add the device/chip type to the disk d_descr field, and print more infoIan Lepore2018-03-181-2/+9
| | | | | | | | | | about the chip including the erase block size at attach time. Also add myself to the copyrights since at this point svn blame would point to me as the culprit for much of this. Notes: svn path=/head/; revision=331141
* Add support for 4K and 32K erase block sizes. Many of the supported chipsIan Lepore2018-03-181-12/+23
| | | | | | | | have these flags set in the ident table, but there was no code to support using the smaller erase sizes. Notes: svn path=/head/; revision=331139