15a978eadSIan Lepore.\" 25a978eadSIan Lepore.\" Copyright (c) 2019 Ian Lepore <ian@freebsd.org> 35a978eadSIan Lepore.\" 45a978eadSIan Lepore.\" Redistribution and use in source and binary forms, with or without 55a978eadSIan Lepore.\" modification, are permitted provided that the following conditions 65a978eadSIan Lepore.\" are met: 75a978eadSIan Lepore.\" 85a978eadSIan Lepore.\" 1. Redistributions of source code must retain the above copyright 95a978eadSIan Lepore.\" notice, this list of conditions and the following disclaimer. 105a978eadSIan Lepore.\" 2. Redistributions in binary form must reproduce the above copyright 115a978eadSIan Lepore.\" notice, this list of conditions and the following disclaimer in the 125a978eadSIan Lepore.\" documentation and/or other materials provided with the distribution. 135a978eadSIan Lepore.\" 145a978eadSIan Lepore.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 155a978eadSIan Lepore.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 165a978eadSIan Lepore.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 175a978eadSIan Lepore.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 185a978eadSIan Lepore.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 195a978eadSIan Lepore.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 205a978eadSIan Lepore.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 215a978eadSIan Lepore.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 225a978eadSIan Lepore.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 235a978eadSIan Lepore.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 245a978eadSIan Lepore.\" 25*703768a2SJessica Clarke.Dd June 11, 2024 265a978eadSIan Lepore.Dt MX25L 4 275a978eadSIan Lepore.Os 285a978eadSIan Lepore.Sh NAME 295a978eadSIan Lepore.Nm mx25l 305a978eadSIan Lepore.Nd driver for SpiFlash(tm) compatible non-volatile storage devices 315a978eadSIan Lepore.Sh SYNOPSIS 325a978eadSIan LeporeTo compile this driver into the kernel, 335a978eadSIan Leporeplace the following line in your 345a978eadSIan Leporekernel configuration file: 355a978eadSIan Lepore.Bd -ragged -offset indent 365a978eadSIan Lepore.Cd "device mx25l" 375a978eadSIan Lepore.Ed 385a978eadSIan Lepore.Pp 395a978eadSIan LeporeAlternatively, to load the driver as a 405a978eadSIan Leporemodule at boot time, place the following line in 415a978eadSIan Lepore.Xr loader.conf 5 : 425a978eadSIan Lepore.Bd -literal -offset indent 435a978eadSIan Leporemx25l_load="YES" 445a978eadSIan Lepore.Ed 455a978eadSIan Lepore.Sh DESCRIPTION 465a978eadSIan LeporeThe 475a978eadSIan Lepore.Nm 485a978eadSIan Leporedriver provides support for the family of non-volatile storage 495a978eadSIan Leporedevices known collectively as SpiFlash(tm). 505a978eadSIan LeporeSpiFlash chips typically have part numbers beginning with EN25, 515a978eadSIan LeporeIS25, MX25, S25, SST25, or W25. 525a978eadSIan Lepore.Pp 535a978eadSIan LeporeThe 545a978eadSIan Lepore.Nm 555a978eadSIan Leporedriver uses opcode 0x9f to read the manufacturer and device ID 565a978eadSIan Leporedata to determine whether the device is supported. 575a978eadSIan LeporeThe device ID is looked up using a table of data within the driver 585a978eadSIan Leporewhich describes the attributes of each supported device, 595a978eadSIan Leporesuch as block size, sector size, and device capacity. 605a978eadSIan LeporeWhen a supported device is found, the 615a978eadSIan Lepore.Nm 625a978eadSIan Leporedriver creates a disk device and makes it accessible at 63*703768a2SJessica Clarke.Pa /dev/flash/spi? . 645a978eadSIan LeporeThe new disk device is then tasted by the available 655a978eadSIan Lepore.Xr geom 4 665a978eadSIan Leporemodules as with any disk device. 675a978eadSIan Lepore.Sh HARDWARE 685a978eadSIan LeporeThe 695a978eadSIan Lepore.Nm 705a978eadSIan Leporedriver provides support for the following devices: 715a978eadSIan Lepore.Pp 725a978eadSIan Lepore.Bl -bullet -compact 735a978eadSIan Lepore.It 745a978eadSIan LeporeAT25DF641 755a978eadSIan Lepore.It 765a978eadSIan LeporeEN25F32 775a978eadSIan Lepore.It 785a978eadSIan LeporeEN25P32 795a978eadSIan Lepore.It 805a978eadSIan LeporeEN25P64 815a978eadSIan Lepore.It 825a978eadSIan LeporeEN25Q32 835a978eadSIan Lepore.It 845a978eadSIan LeporeEN25Q64 855a978eadSIan Lepore.It 865a978eadSIan LeporeGD25Q64 875a978eadSIan Lepore.It 885a978eadSIan LeporeM25P32 895a978eadSIan Lepore.It 905a978eadSIan LeporeM25P64 915a978eadSIan Lepore.It 925a978eadSIan LeporeMX25L1606E 935a978eadSIan Lepore.It 945a978eadSIan LeporeMX25LL128 955a978eadSIan Lepore.It 965a978eadSIan LeporeMX25LL256 975a978eadSIan Lepore.It 985a978eadSIan LeporeMX25LL32 995a978eadSIan Lepore.It 1005a978eadSIan LeporeMX25LL64 1015a978eadSIan Lepore.It 1025a978eadSIan LeporeS25FL032 1035a978eadSIan Lepore.It 1045a978eadSIan LeporeS25FL064 1055a978eadSIan Lepore.It 1065a978eadSIan LeporeS25FL128 1075a978eadSIan Lepore.It 1085a978eadSIan LeporeS25FL256S 1095a978eadSIan Lepore.It 1105a978eadSIan LeporeSST25VF010A 1115a978eadSIan Lepore.It 1125a978eadSIan LeporeSST25VF032B 1135a978eadSIan Lepore.It 1145a978eadSIan LeporeW25Q128 1155a978eadSIan Lepore.It 1165a978eadSIan LeporeW25Q256 1175a978eadSIan Lepore.It 1185a978eadSIan LeporeW25Q32 1195a978eadSIan Lepore.It 1205a978eadSIan LeporeW25Q64 1215a978eadSIan Lepore.It 1225a978eadSIan LeporeW25Q64BV 1235a978eadSIan Lepore.It 1245a978eadSIan LeporeW25X32 1255a978eadSIan Lepore.It 1265a978eadSIan LeporeW25X64 1275a978eadSIan Lepore.El 1285a978eadSIan Lepore.Sh FDT CONFIGURATION 1295a978eadSIan LeporeOn an 1305a978eadSIan Lepore.Xr fdt 4 1315a978eadSIan Leporebased system, the 1325a978eadSIan Lepore.Nm 1335a978eadSIan Leporedevice is defined as a slave device subnode 1345a978eadSIan Leporeof the SPI bus controller node. 1355a978eadSIan LeporeAll properties documented in the 1365a978eadSIan Lepore.Va spibus.txt 1375a978eadSIan Leporebindings document can be used with the 1385a978eadSIan Lepore.Nm 1395a978eadSIan Leporedevice. 1405a978eadSIan LeporeThe most commonly-used ones are documented below. 1415a978eadSIan Lepore.Pp 1425a978eadSIan LeporeThe following properties are required in the 1435a978eadSIan Lepore.Nm 1445a978eadSIan Leporedevice subnode: 1455a978eadSIan Lepore.Bl -tag -width indent 1465a978eadSIan Lepore.It Va compatible 1475a978eadSIan LeporeMust be the string "jedec,spi-nor". 1485a978eadSIan Lepore.It Va reg 1495a978eadSIan LeporeChip select address of device. 1505a978eadSIan Lepore.It Va spi-max-frequency 1515a978eadSIan LeporeThe maximum bus frequency to use when communicating with this slave device. 1525a978eadSIan LeporeActual bus speed may be lower, depending on the capabilities of the SPI 1535a978eadSIan Leporebus controller hardware. 1545a978eadSIan Lepore.El 1555a978eadSIan Lepore.Pp 1565a978eadSIan LeporeThe following properties are optional for the 1575a978eadSIan Lepore.Nm 1585a978eadSIan Leporedevice subnode: 1595a978eadSIan Lepore.Bl -tag -width indent 1605a978eadSIan Lepore.It Va spi-cpha 1615a978eadSIan LeporeEmpty property indicating the slave device requires shifted clock 1625a978eadSIan Leporephase (CPHA) mode. 1635a978eadSIan Lepore.It Va spi-cpol 1645a978eadSIan LeporeEmpty property indicating the slave device requires inverse clock 1655a978eadSIan Leporepolarity (CPOL) mode. 1665a978eadSIan Lepore.It Va spi-cs-high 1675a978eadSIan LeporeEmpty property indicating the slave device requires chip select active high. 1685a978eadSIan Lepore.El 1695a978eadSIan Lepore.Sh HINTS CONFIGURATION 1705a978eadSIan LeporeOn a 1715a978eadSIan Lepore.Xr device.hints 5 1725a978eadSIan Leporebased system, such as 1735a978eadSIan Lepore.Li MIPS , 1745a978eadSIan Leporethese values are configurable for 1755a978eadSIan Lepore.Nm : 1765a978eadSIan Lepore.Bl -tag -width indent 1775a978eadSIan Lepore.It Va hint.mx25l.%d.at 1785a978eadSIan LeporeThe spibus the 1795a978eadSIan Lepore.Nm 1805a978eadSIan Leporeinstance is attached to. 1815a978eadSIan Lepore.It Va hint.mx25l.%d.clock 1825a978eadSIan LeporeThe maximum bus frequency to use when communicating with this device. 1835a978eadSIan LeporeActual bus speed may be lower, depending on the capabilities of the SPI 1845a978eadSIan Leporebus controller hardware. 1855a978eadSIan Lepore.It Va hint.mx25l.%d.cs 1865a978eadSIan LeporeThe chip-select number to assert when performing I/O for this device. 1875a978eadSIan LeporeSet the high bit (1 << 31) to invert the logic level of the chip select line. 1885a978eadSIan Lepore.It Va hint.mx25l.%d.mode 1895a978eadSIan LeporeThe SPI mode (0-3) to use when communicating with this device. 1905a978eadSIan Lepore.El 1915a978eadSIan Lepore.Sh FILES 192*703768a2SJessica Clarke.Bl -tag -width /dev/flash/spi? 1935a978eadSIan Lepore.It Pa /dev/flash/spi? 194*703768a2SJessica ClarkeProvides read/write access to the storage device. 1955a978eadSIan Lepore.El 1965a978eadSIan Lepore.Sh SEE ALSO 1975a978eadSIan Lepore.Xr fdt 4 , 1985a978eadSIan Lepore.Xr geom 4 1995a978eadSIan Lepore.Sh HISTORY 2005a978eadSIan LeporeThe 2015a978eadSIan Lepore.Nm 2025a978eadSIan Leporedriver first appeared in 2035a978eadSIan Lepore.Fx 8.0 . 204