Commit Graph

46 Commits

Author SHA1 Message Date
Ian Lepore
aae18dcc87 Add a functional detach() routine, to make things kldunload-friendly. 2018-02-24 16:28:45 +00:00
Ian Lepore
42c52f36e4 Add missing MODULE_DEPENDS(). 2018-02-20 03:51:09 +00:00
Pedro F. Giffuni
718cf2ccb9 sys/dev: further adoption of SPDX licensing ID tags.
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.
2017-11-27 14:52:40 +00:00
Justin Hibbits
fa68dcb104 Add Microchip 1-MBit SPI flash ID
Used on the AmigaOne X5000.
2017-10-30 02:31:08 +00:00
Adrian Chadd
2f57841ee4 [mx25l] add new device ids.
Submitted by:	Hiroki Mori <yamori813@yahoo.co.jp>
Differential Revision:	https://reviews.freebsd.org/D10621
2017-05-06 06:08:44 +00:00
Adrian Chadd
303c356245 [mx25l] add new device id.
Tested:

* (submitter) TP-Link TL-WR1043nd v3

Submitted by:	tj@enoti.me
2016-07-21 15:48:41 +00:00
Baptiste Daroussin
fe56b741cc Add support for Atmel at25df641 flash
Submitted by:	Grégory Soutadé <soutade@gmail.com> (via github pull request)
2016-06-08 14:22:16 +00:00
Adrian Chadd
40424a256a [mx25l] add Winbond w25x64 support.
PR:		https://github.com/freebsd/freebsd/pull/16
Submitted by:	https://github.com/epipenau
2016-05-26 01:19:13 +00:00
Stanislav Galabov
009e872ef7 Modify mx25l FDT compatible device handling
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
2016-04-20 14:33:00 +00:00
Pedro F. Giffuni
73a1170a8c sys/dev: use our nitems() macro when it is avaliable through param.h.
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
2016-04-19 23:37:24 +00:00
Adrian Chadd
c445ffce22 undo previous commit - WIP was committed by accident.
Noticed by: bz
2016-04-17 15:51:26 +00:00
Adrian Chadd
75b3cfd252 Only compile the FDT bits when we are using FDT. 2016-04-17 02:05:45 +00:00
Stanislav Galabov
1173c20679 Make mx25l compatible with jedec,spi-nor as well
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
2016-04-15 15:26:31 +00:00
Stanislav Galabov
2d46b036a0 Enable 4-byte address support for the mx25l family of SPI flash devices.
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
2016-04-04 06:55:48 +00:00
Luiz Otavio O Souza
8f74c88a73 Add basic FDT support for the mx25l SPI flash.
Sponsored by:	Rubicon Communications (Netgate)
2016-03-30 17:00:33 +00:00
Adrian Chadd
1b46803833 [flash] Teach mx25l SPI flash driver to interact with fdt_slicer and 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>
2016-01-22 03:15:53 +00:00
Adrian Chadd
4a4ae9823a Add support for s25fl256s. I /think/ it's a 32mb NOR flash part.
This is submitted by a FreeBSD wifi user who has requested they not
be named.  Thankyou!
2015-11-05 03:13:10 +00:00
Kevin Lo
429b844ba6 Check the return value of config_intrhook_establish(). 2015-03-03 02:08:17 +00:00
Luiz Otavio O Souza
c6905524b4 Fix a few typos for s25fl types.
Approved by:	adrian (mentor)
2013-08-28 14:49:36 +00:00
Adrian Chadd
70234acbb1 Add support for two new winbond SPI flash parts.
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
2013-06-08 20:12:14 +00:00
Dimitry Andric
29658c96ce Remove duplicate const specifiers in many drivers (I hope I got all of
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
2012-11-05 19:16:27 +00:00
Aleksandr Rybalko
869785b49c Add more SPI flash IDs.
Submitted by:	Luiz Otavio O Souza.
Submitted by:	ZRouter.org project.
Approved by:	adrian (menthor)
2012-09-25 22:12:07 +00:00
Adrian Chadd
8a1e4fa08b Add a new flash part - 4MB SPI flash from Winbond. 2012-08-28 22:17:22 +00:00
Marius Strobl
d80b202dd2 Revert r236529, re-enabling verification of the flashed content as
the underlying problem was dealt with in r237239 (in fact, disabling
verification also actually only made the problem less likely to occur).
2012-06-18 20:19:07 +00:00
Marius Strobl
4c87055c0c Disable verification of the flashed content for now; for reasons unknown
it sometimes causes physwr to hang.
2012-06-03 21:03:16 +00:00
Marius Strobl
7f2107d400 - Loop up to 3 seconds when waiting for a device to get ready. [1]
- 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
2012-06-03 01:00:55 +00:00
Adrian Chadd
450a186c06 Add a couple more SPI flash device IDs found in commercial
consumer wireless kit.

Submitted by:	Stefan Bethke <stb@lassitu.de>
2012-01-04 04:17:03 +00:00
Adrian Chadd
917721a495 Modify the spi flash driver to allow smaller read IO sizes, but enforce
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.
2011-02-16 20:07:44 +00:00
Adrian Chadd
a565668bc5 Add support for the m25p64; lifted straight from Linux.
This flash chip is found on the Ubiquiti LS-SR71 board.
I've successfully tested reading; I've not tried writing to it yet.
2011-01-30 12:14:06 +00:00
Adrian Chadd
a122fea4ff Add s25sl064a, an 8mb SPI flash part. 2010-08-17 16:27:13 +00:00
Adrian Chadd
62c3a412df Fix naming to be consistent. 2010-07-19 21:50:43 +00:00
Adrian Chadd
53436ace02 Extend the mx25l erase function to support different erase commands. 2010-07-19 21:46:40 +00:00
Adrian Chadd
d2cf1fd5e4 Extend the mx25l flash device support to include a set of per-device
flags.

Some of these parts will support 4K/32K block erases rather than
a sector erase. This includes (at least) the MX25L128.
2010-07-19 21:38:15 +00:00
Adrian Chadd
dddd00f6a4 Include 4k/32k erase commands.
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.
2010-07-19 15:05:35 +00:00
Adrian Chadd
e87f728e23 Fix KASSERT() messages to reflect reality. 2010-07-16 04:26:37 +00:00
Oleksandr Tymoshenko
b39188331e - Code reorg: extract mx25l_read and mx25l_write methods
- Add entry for Spansion flash controller
    Submitted by: Eric L. Chen <lihong@ieee.org>
2009-11-18 22:14:36 +00:00
Oleksandr Tymoshenko
c3655ab0d0 - Add write support for mx25l flash chip
- Some minor style(9) fixes
2009-10-25 08:43:38 +00:00
Warner Losh
0d633f654d o Move the driveid.h file
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.
2009-06-14 04:26:56 +00:00
Warner Losh
d0b7b80503 Part of the cf driver missed. 2009-06-14 04:16:58 +00:00
Warner Losh
b02713c7a4 Move dev/flash/ cf driver into octeon dir where it belongs. 2009-06-14 03:55:27 +00:00
Warner Losh
5be117dfac Merge in Cavium's CF driver. This too is in the wrong place and will
be moved.
2009-06-14 03:47:44 +00:00
Oleksandr Tymoshenko
2e370a5c7a Merge from HEAD 2009-05-26 17:01:12 +00:00
Oleksandr Tymoshenko
cd5bdf0367 - Add support for MX25Lxxx SPI flash (readonly atm) 2009-05-18 23:20:56 +00:00
Oleksandr Tymoshenko
ab88d607a5 - Remove nonexistent header file from includes list 2009-05-13 18:31:28 +00:00
Julian Elischer
3745c395ec Rename the kthread_xxx (e.g. kthread_create()) calls
to kproc_xxx as they actually make whole processes.
Thos makes way for us to add REAL kthread_create() and friends
that actually make theads. it turns out that most of these
calls actually end up being moved back to the thread version
when it's added. but we need to make this cosmetic change first.

I'd LOVE to do this rename in 7.0  so that we can eventually MFC the
new kthread_xxx() calls.
2007-10-20 23:23:23 +00:00
Warner Losh
674a914028 MFp4:
Preliminary support for Atmel AT45D series of DataFlash on the
	SPI bus (ok, not really a hardware bus, but a logical
	connection).  This works only for the 8MB version of the part
	due to hard coding.  Both read and write are supported.
2006-11-29 08:05:55 +00:00