1.\" 2.\" Copyright (c) 2019 Ian Lepore <ian@freebsd.org> 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 8.\" 1. Redistributions of source code must retain the above copyright 9.\" notice, this list of conditions and the following disclaimer. 10.\" 2. Redistributions in binary form must reproduce the above copyright 11.\" notice, this list of conditions and the following disclaimer in the 12.\" documentation and/or other materials provided with the distribution. 13.\" 14.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 15.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 18.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24.\" 25.Dd February 26, 2019 26.Dt MX25L 4 27.Os 28.Sh NAME 29.Nm mx25l 30.Nd driver for SpiFlash(tm) compatible non-volatile storage devices 31.Sh SYNOPSIS 32To compile this driver into the kernel, 33place the following line in your 34kernel configuration file: 35.Bd -ragged -offset indent 36.Cd "device mx25l" 37.Ed 38.Pp 39Alternatively, to load the driver as a 40module at boot time, place the following line in 41.Xr loader.conf 5 : 42.Bd -literal -offset indent 43mx25l_load="YES" 44.Ed 45.Sh DESCRIPTION 46The 47.Nm 48driver provides support for the family of non-volatile storage 49devices known collectively as SpiFlash(tm). 50SpiFlash chips typically have part numbers beginning with EN25, 51IS25, MX25, S25, SST25, or W25. 52.Pp 53The 54.Nm 55driver uses opcode 0x9f to read the manufacturer and device ID 56data to determine whether the device is supported. 57The device ID is looked up using a table of data within the driver 58which describes the attributes of each supported device, 59such as block size, sector size, and device capacity. 60When a supported device is found, the 61.Nm 62driver creates a disk device and makes it accessible at 63.Pa /dev/flash/mx25l? . 64The new disk device is then tasted by the available 65.Xr geom 4 66modules as with any disk device. 67.Sh HARDWARE 68The 69.Nm 70driver provides support for the following devices: 71.Pp 72.Bl -bullet -compact 73.It 74AT25DF641 75.It 76EN25F32 77.It 78EN25P32 79.It 80EN25P64 81.It 82EN25Q32 83.It 84EN25Q64 85.It 86GD25Q64 87.It 88M25P32 89.It 90M25P64 91.It 92MX25L1606E 93.It 94MX25LL128 95.It 96MX25LL256 97.It 98MX25LL32 99.It 100MX25LL64 101.It 102S25FL032 103.It 104S25FL064 105.It 106S25FL128 107.It 108S25FL256S 109.It 110SST25VF010A 111.It 112SST25VF032B 113.It 114W25Q128 115.It 116W25Q256 117.It 118W25Q32 119.It 120W25Q64 121.It 122W25Q64BV 123.It 124W25X32 125.It 126W25X64 127.El 128.Sh FDT CONFIGURATION 129On an 130.Xr fdt 4 131based system, the 132.Nm 133device is defined as a slave device subnode 134of the SPI bus controller node. 135All properties documented in the 136.Va spibus.txt 137bindings document can be used with the 138.Nm 139device. 140The most commonly-used ones are documented below. 141.Pp 142The following properties are required in the 143.Nm 144device subnode: 145.Bl -tag -width indent 146.It Va compatible 147Must be the string "jedec,spi-nor". 148.It Va reg 149Chip select address of device. 150.It Va spi-max-frequency 151The maximum bus frequency to use when communicating with this slave device. 152Actual bus speed may be lower, depending on the capabilities of the SPI 153bus controller hardware. 154.El 155.Pp 156The following properties are optional for the 157.Nm 158device subnode: 159.Bl -tag -width indent 160.It Va spi-cpha 161Empty property indicating the slave device requires shifted clock 162phase (CPHA) mode. 163.It Va spi-cpol 164Empty property indicating the slave device requires inverse clock 165polarity (CPOL) mode. 166.It Va spi-cs-high 167Empty property indicating the slave device requires chip select active high. 168.El 169.Sh HINTS CONFIGURATION 170On a 171.Xr device.hints 5 172based system, such as 173.Li MIPS , 174these values are configurable for 175.Nm : 176.Bl -tag -width indent 177.It Va hint.mx25l.%d.at 178The spibus the 179.Nm 180instance is attached to. 181.It Va hint.mx25l.%d.clock 182The maximum bus frequency to use when communicating with this device. 183Actual bus speed may be lower, depending on the capabilities of the SPI 184bus controller hardware. 185.It Va hint.mx25l.%d.cs 186The chip-select number to assert when performing I/O for this device. 187Set the high bit (1 << 31) to invert the logic level of the chip select line. 188.It Va hint.mx25l.%d.mode 189The SPI mode (0-3) to use when communicating with this device. 190.El 191.Sh FILES 192.Bl -tag -width /dev/flash/mx25l? 193.It Pa /dev/flash/mx25l? 194Provides read/write access to the storage device. 195.It Pa /dev/flash/spi? 196An alias for the 197.Pa /dev/mx25l? 198device, for backwards compatibility with older versions of the driver. 199.El 200.Sh SEE ALSO 201.Xr fdt 4 , 202.Xr geom 4 203.Sh HISTORY 204The 205.Nm 206driver first appeared in 207.Fx 8.0 . 208