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