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.\" 255a978eadSIan Lepore.\" $FreeBSD$ 265a978eadSIan Lepore.\" 27*e70ece12SIan Lepore.Dd March 2, 2019 285a978eadSIan Lepore.Dt AT45D 4 295a978eadSIan Lepore.Os 305a978eadSIan Lepore.Sh NAME 315a978eadSIan Lepore.Nm at45d 325a978eadSIan Lepore.Nd driver for DataFlash(tm) non-volatile storage devices 335a978eadSIan Lepore.Sh SYNOPSIS 345a978eadSIan LeporeTo compile this driver into the kernel, 355a978eadSIan Leporeplace the following line in your 365a978eadSIan Leporekernel configuration file: 375a978eadSIan Lepore.Bd -ragged -offset indent 385a978eadSIan Lepore.Cd "device at45d" 395a978eadSIan Lepore.Ed 405a978eadSIan Lepore.Pp 415a978eadSIan LeporeAlternatively, to load the driver as a 425a978eadSIan Leporemodule at boot time, place the following line in 435a978eadSIan Lepore.Xr loader.conf 5 : 445a978eadSIan Lepore.Bd -literal -offset indent 455a978eadSIan Leporeat45d_load="YES" 465a978eadSIan Lepore.Ed 475a978eadSIan Lepore.Sh DESCRIPTION 485a978eadSIan LeporeThe 495a978eadSIan Lepore.Nm 505a978eadSIan Leporedriver provides support for the family of non-volatile storage 515a978eadSIan Leporedevices known collectively as DataFlash(tm). 525a978eadSIan LeporeDataFlash chips typically have part numbers beginning with AT45DB. 535a978eadSIan LeporeThe 545a978eadSIan Lepore.Nm 555a978eadSIan Leporedriver supports only the SPI bus versions of each AT45DB device, 565a978eadSIan Leporeindicated by the last digit of the part number being 1 or 2. 575a978eadSIan Lepore.Pp 585a978eadSIan LeporeThe 595a978eadSIan Lepore.Nm 605a978eadSIan Leporedriver uses opcode 0x9f to read the manufacturer and device ID 615a978eadSIan Leporedata to determine whether the device is supported. 625a978eadSIan LeporeThe device ID is looked up using a table of data within the driver 635a978eadSIan Leporewhich describes the attributes of each supported device, 645a978eadSIan Leporesuch as block size, sector size, and device capacity. 655a978eadSIan LeporeWhen a supported device is found, the 665a978eadSIan Lepore.Nm 675a978eadSIan Leporedriver creates a disk device and makes it accessible at 685a978eadSIan Lepore.Pa /dev/flash/at45d? . 695a978eadSIan LeporeThe new disk device is then tasted by the available 705a978eadSIan Lepore.Xr geom 4 715a978eadSIan Leporemodules as with any disk device. 725a978eadSIan Lepore.Sh HARDWARE 735a978eadSIan LeporeThe 745a978eadSIan Lepore.Nm 755a978eadSIan Leporedriver provides support for the following devices: 765a978eadSIan Lepore.Pp 775a978eadSIan Lepore.Bl -bullet -compact 785a978eadSIan Lepore.It 795a978eadSIan LeporeAT45DB011B 805a978eadSIan Lepore.It 815a978eadSIan LeporeAT45DB021B 825a978eadSIan Lepore.It 835a978eadSIan LeporeAT45DB041x 845a978eadSIan Lepore.It 855a978eadSIan LeporeAT45DB081B 865a978eadSIan Lepore.It 875a978eadSIan LeporeAT45DB161x 885a978eadSIan Lepore.It 895a978eadSIan LeporeAT45DB321x 905a978eadSIan Lepore.It 915a978eadSIan LeporeAT45DB321x 925a978eadSIan Lepore.It 935a978eadSIan LeporeAT45DB641E 945a978eadSIan Lepore.It 955a978eadSIan LeporeAT45DB642x 965a978eadSIan Lepore.El 975a978eadSIan Lepore.Sh FDT CONFIGURATION 985a978eadSIan LeporeOn an 995a978eadSIan Lepore.Xr fdt 4 1005a978eadSIan Leporebased system, the 1015a978eadSIan Lepore.Nm 1025a978eadSIan Leporedevice is defined as a slave device subnode 1035a978eadSIan Leporeof the SPI bus controller node. 1045a978eadSIan LeporeAll properties documented in the 1055a978eadSIan Lepore.Va spibus.txt 1065a978eadSIan Leporebindings document can be used with the 1075a978eadSIan Lepore.Nm 1085a978eadSIan Leporedevice. 1095a978eadSIan LeporeThe most commonly-used ones are documented below. 1105a978eadSIan Lepore.Pp 1115a978eadSIan LeporeThe following properties are required in the 1125a978eadSIan Lepore.Nm 1135a978eadSIan Leporedevice subnode: 1145a978eadSIan Lepore.Bl -tag -width indent 1155a978eadSIan Lepore.It Va compatible 1165a978eadSIan LeporeMust be the string "atmel,at45". 1175a978eadSIan Lepore.It Va reg 1185a978eadSIan LeporeChip select address of device. 1195a978eadSIan Lepore.It Va spi-max-frequency 1205a978eadSIan LeporeThe maximum bus frequency to use when communicating with this slave device. 1215a978eadSIan LeporeActual bus speed may be lower, depending on the capabilities of the SPI 1225a978eadSIan Leporebus controller hardware. 1235a978eadSIan Lepore.El 1245a978eadSIan Lepore.Pp 1255a978eadSIan LeporeThe following properties are optional for the 1265a978eadSIan Lepore.Nm 1275a978eadSIan Leporedevice subnode: 1285a978eadSIan Lepore.Bl -tag -width indent 129*e70ece12SIan Lepore.It Va freebsd,sectorsize 130*e70ece12SIan LeporeThe sector size of the disk created for this storage device. 131*e70ece12SIan LeporeIt must be a multiple of the device's page size. 132*e70ece12SIan LeporeThe default is the device page size. 1335a978eadSIan Lepore.It Va spi-cpha 1345a978eadSIan LeporeEmpty property indicating the slave device requires shifted clock 1355a978eadSIan Leporephase (CPHA) mode. 1365a978eadSIan Lepore.It Va spi-cpol 1375a978eadSIan LeporeEmpty property indicating the slave device requires inverse clock 1385a978eadSIan Leporepolarity (CPOL) mode. 1395a978eadSIan Lepore.It Va spi-cs-high 1405a978eadSIan LeporeEmpty property indicating the slave device requires chip select active high. 1415a978eadSIan Lepore.El 1425a978eadSIan Lepore.Sh HINTS CONFIGURATION 1435a978eadSIan LeporeOn a 1445a978eadSIan Lepore.Xr device.hints 5 1455a978eadSIan Leporebased system, such as 1465a978eadSIan Lepore.Li MIPS , 1475a978eadSIan Leporethese values are configurable for 1485a978eadSIan Lepore.Nm : 1495a978eadSIan Lepore.Bl -tag -width indent 1505a978eadSIan Lepore.It Va hint.at45d.%d.at 1515a978eadSIan LeporeThe spibus the 1525a978eadSIan Lepore.Nm 1535a978eadSIan Leporeinstance is attached to. 1545a978eadSIan Lepore.It Va hint.at45d.%d.clock 1555a978eadSIan LeporeThe maximum bus frequency to use when communicating with this device. 1565a978eadSIan LeporeActual bus speed may be lower, depending on the capabilities of the SPI 1575a978eadSIan Leporebus controller hardware. 1585a978eadSIan Lepore.It Va hint.at45d.%d.cs 1595a978eadSIan LeporeThe chip-select number to assert when performing I/O for this device. 1605a978eadSIan LeporeSet the high bit (1 << 31) to invert the logic level of the chip select line. 1615a978eadSIan Lepore.It Va hint.at45d.%d.mode 1625a978eadSIan LeporeThe SPI mode (0-3) to use when communicating with this device. 163*e70ece12SIan Lepore.It Va hint.at45d.%d.sectorsize 164*e70ece12SIan LeporeThe sector size of the disk created for this storage device. 165*e70ece12SIan LeporeIt must be a multiple of the device's page size. 166*e70ece12SIan LeporeThe default is the device page size. 1675a978eadSIan Lepore.El 1685a978eadSIan Lepore.Sh FILES 1695a978eadSIan Lepore.Bl -tag -width /dev/flash/at45d? 1705a978eadSIan Lepore.It Pa /dev/flash/at45d? 1715a978eadSIan LeporeProvides read/write access to the storage device. 1725a978eadSIan Lepore.It Pa /dev/flash/spi? 1735a978eadSIan LeporeAn alias for the 1745a978eadSIan Lepore.Pa /dev/at45d? 1755a978eadSIan Leporedevice, for backwards compatibility with older versions of the driver. 1765a978eadSIan Lepore.El 1775a978eadSIan Lepore.Sh SEE ALSO 1785a978eadSIan Lepore.Xr fdt 4 , 1795a978eadSIan Lepore.Xr geom 4 1805a978eadSIan Lepore.Sh HISTORY 1815a978eadSIan LeporeThe 1825a978eadSIan Lepore.Nm 1835a978eadSIan Leporedriver first appeared in 1845a978eadSIan Lepore.Fx 6.0 . 185