1*5a978eadSIan Lepore.\" 2*5a978eadSIan Lepore.\" Copyright (c) 2019 Ian Lepore <ian@freebsd.org> 3*5a978eadSIan Lepore.\" 4*5a978eadSIan Lepore.\" Redistribution and use in source and binary forms, with or without 5*5a978eadSIan Lepore.\" modification, are permitted provided that the following conditions 6*5a978eadSIan Lepore.\" are met: 7*5a978eadSIan Lepore.\" 8*5a978eadSIan Lepore.\" 1. Redistributions of source code must retain the above copyright 9*5a978eadSIan Lepore.\" notice, this list of conditions and the following disclaimer. 10*5a978eadSIan Lepore.\" 2. Redistributions in binary form must reproduce the above copyright 11*5a978eadSIan Lepore.\" notice, this list of conditions and the following disclaimer in the 12*5a978eadSIan Lepore.\" documentation and/or other materials provided with the distribution. 13*5a978eadSIan Lepore.\" 14*5a978eadSIan Lepore.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 15*5a978eadSIan Lepore.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16*5a978eadSIan Lepore.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17*5a978eadSIan Lepore.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 18*5a978eadSIan Lepore.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19*5a978eadSIan Lepore.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20*5a978eadSIan Lepore.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21*5a978eadSIan Lepore.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22*5a978eadSIan Lepore.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23*5a978eadSIan Lepore.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24*5a978eadSIan Lepore.\" 25*5a978eadSIan Lepore.\" $FreeBSD$ 26*5a978eadSIan Lepore.\" 27*5a978eadSIan Lepore.Dd February 26, 2019 28*5a978eadSIan Lepore.Dt AT45D 4 29*5a978eadSIan Lepore.Os 30*5a978eadSIan Lepore.Sh NAME 31*5a978eadSIan Lepore.Nm at45d 32*5a978eadSIan Lepore.Nd driver for DataFlash(tm) non-volatile storage devices 33*5a978eadSIan Lepore.Sh SYNOPSIS 34*5a978eadSIan LeporeTo compile this driver into the kernel, 35*5a978eadSIan Leporeplace the following line in your 36*5a978eadSIan Leporekernel configuration file: 37*5a978eadSIan Lepore.Bd -ragged -offset indent 38*5a978eadSIan Lepore.Cd "device at45d" 39*5a978eadSIan Lepore.Ed 40*5a978eadSIan Lepore.Pp 41*5a978eadSIan LeporeAlternatively, to load the driver as a 42*5a978eadSIan Leporemodule at boot time, place the following line in 43*5a978eadSIan Lepore.Xr loader.conf 5 : 44*5a978eadSIan Lepore.Bd -literal -offset indent 45*5a978eadSIan Leporeat45d_load="YES" 46*5a978eadSIan Lepore.Ed 47*5a978eadSIan Lepore.Sh DESCRIPTION 48*5a978eadSIan LeporeThe 49*5a978eadSIan Lepore.Nm 50*5a978eadSIan Leporedriver provides support for the family of non-volatile storage 51*5a978eadSIan Leporedevices known collectively as DataFlash(tm). 52*5a978eadSIan LeporeDataFlash chips typically have part numbers beginning with AT45DB. 53*5a978eadSIan LeporeThe 54*5a978eadSIan Lepore.Nm 55*5a978eadSIan Leporedriver supports only the SPI bus versions of each AT45DB device, 56*5a978eadSIan Leporeindicated by the last digit of the part number being 1 or 2. 57*5a978eadSIan Lepore.Pp 58*5a978eadSIan LeporeThe 59*5a978eadSIan Lepore.Nm 60*5a978eadSIan Leporedriver uses opcode 0x9f to read the manufacturer and device ID 61*5a978eadSIan Leporedata to determine whether the device is supported. 62*5a978eadSIan LeporeThe device ID is looked up using a table of data within the driver 63*5a978eadSIan Leporewhich describes the attributes of each supported device, 64*5a978eadSIan Leporesuch as block size, sector size, and device capacity. 65*5a978eadSIan LeporeWhen a supported device is found, the 66*5a978eadSIan Lepore.Nm 67*5a978eadSIan Leporedriver creates a disk device and makes it accessible at 68*5a978eadSIan Lepore.Pa /dev/flash/at45d? . 69*5a978eadSIan LeporeThe new disk device is then tasted by the available 70*5a978eadSIan Lepore.Xr geom 4 71*5a978eadSIan Leporemodules as with any disk device. 72*5a978eadSIan Lepore.Sh HARDWARE 73*5a978eadSIan LeporeThe 74*5a978eadSIan Lepore.Nm 75*5a978eadSIan Leporedriver provides support for the following devices: 76*5a978eadSIan Lepore.Pp 77*5a978eadSIan Lepore.Bl -bullet -compact 78*5a978eadSIan Lepore.It 79*5a978eadSIan LeporeAT45DB011B 80*5a978eadSIan Lepore.It 81*5a978eadSIan LeporeAT45DB021B 82*5a978eadSIan Lepore.It 83*5a978eadSIan LeporeAT45DB041x 84*5a978eadSIan Lepore.It 85*5a978eadSIan LeporeAT45DB081B 86*5a978eadSIan Lepore.It 87*5a978eadSIan LeporeAT45DB161x 88*5a978eadSIan Lepore.It 89*5a978eadSIan LeporeAT45DB321x 90*5a978eadSIan Lepore.It 91*5a978eadSIan LeporeAT45DB321x 92*5a978eadSIan Lepore.It 93*5a978eadSIan LeporeAT45DB641E 94*5a978eadSIan Lepore.It 95*5a978eadSIan LeporeAT45DB642x 96*5a978eadSIan Lepore.El 97*5a978eadSIan Lepore.Sh FDT CONFIGURATION 98*5a978eadSIan LeporeOn an 99*5a978eadSIan Lepore.Xr fdt 4 100*5a978eadSIan Leporebased system, the 101*5a978eadSIan Lepore.Nm 102*5a978eadSIan Leporedevice is defined as a slave device subnode 103*5a978eadSIan Leporeof the SPI bus controller node. 104*5a978eadSIan LeporeAll properties documented in the 105*5a978eadSIan Lepore.Va spibus.txt 106*5a978eadSIan Leporebindings document can be used with the 107*5a978eadSIan Lepore.Nm 108*5a978eadSIan Leporedevice. 109*5a978eadSIan LeporeThe most commonly-used ones are documented below. 110*5a978eadSIan Lepore.Pp 111*5a978eadSIan LeporeThe following properties are required in the 112*5a978eadSIan Lepore.Nm 113*5a978eadSIan Leporedevice subnode: 114*5a978eadSIan Lepore.Bl -tag -width indent 115*5a978eadSIan Lepore.It Va compatible 116*5a978eadSIan LeporeMust be the string "atmel,at45". 117*5a978eadSIan Lepore.It Va reg 118*5a978eadSIan LeporeChip select address of device. 119*5a978eadSIan Lepore.It Va spi-max-frequency 120*5a978eadSIan LeporeThe maximum bus frequency to use when communicating with this slave device. 121*5a978eadSIan LeporeActual bus speed may be lower, depending on the capabilities of the SPI 122*5a978eadSIan Leporebus controller hardware. 123*5a978eadSIan Lepore.El 124*5a978eadSIan Lepore.Pp 125*5a978eadSIan LeporeThe following properties are optional for the 126*5a978eadSIan Lepore.Nm 127*5a978eadSIan Leporedevice subnode: 128*5a978eadSIan Lepore.Bl -tag -width indent 129*5a978eadSIan Lepore.It Va spi-cpha 130*5a978eadSIan LeporeEmpty property indicating the slave device requires shifted clock 131*5a978eadSIan Leporephase (CPHA) mode. 132*5a978eadSIan Lepore.It Va spi-cpol 133*5a978eadSIan LeporeEmpty property indicating the slave device requires inverse clock 134*5a978eadSIan Leporepolarity (CPOL) mode. 135*5a978eadSIan Lepore.It Va spi-cs-high 136*5a978eadSIan LeporeEmpty property indicating the slave device requires chip select active high. 137*5a978eadSIan Lepore.El 138*5a978eadSIan Lepore.Sh HINTS CONFIGURATION 139*5a978eadSIan LeporeOn a 140*5a978eadSIan Lepore.Xr device.hints 5 141*5a978eadSIan Leporebased system, such as 142*5a978eadSIan Lepore.Li MIPS , 143*5a978eadSIan Leporethese values are configurable for 144*5a978eadSIan Lepore.Nm : 145*5a978eadSIan Lepore.Bl -tag -width indent 146*5a978eadSIan Lepore.It Va hint.at45d.%d.at 147*5a978eadSIan LeporeThe spibus the 148*5a978eadSIan Lepore.Nm 149*5a978eadSIan Leporeinstance is attached to. 150*5a978eadSIan Lepore.It Va hint.at45d.%d.clock 151*5a978eadSIan LeporeThe maximum bus frequency to use when communicating with this device. 152*5a978eadSIan LeporeActual bus speed may be lower, depending on the capabilities of the SPI 153*5a978eadSIan Leporebus controller hardware. 154*5a978eadSIan Lepore.It Va hint.at45d.%d.cs 155*5a978eadSIan LeporeThe chip-select number to assert when performing I/O for this device. 156*5a978eadSIan LeporeSet the high bit (1 << 31) to invert the logic level of the chip select line. 157*5a978eadSIan Lepore.It Va hint.at45d.%d.mode 158*5a978eadSIan LeporeThe SPI mode (0-3) to use when communicating with this device. 159*5a978eadSIan Lepore.El 160*5a978eadSIan Lepore.Sh FILES 161*5a978eadSIan Lepore.Bl -tag -width /dev/flash/at45d? 162*5a978eadSIan Lepore.It Pa /dev/flash/at45d? 163*5a978eadSIan LeporeProvides read/write access to the storage device. 164*5a978eadSIan Lepore.It Pa /dev/flash/spi? 165*5a978eadSIan LeporeAn alias for the 166*5a978eadSIan Lepore.Pa /dev/at45d? 167*5a978eadSIan Leporedevice, for backwards compatibility with older versions of the driver. 168*5a978eadSIan Lepore.El 169*5a978eadSIan Lepore.Sh SEE ALSO 170*5a978eadSIan Lepore.Xr fdt 4 , 171*5a978eadSIan Lepore.Xr geom 4 172*5a978eadSIan Lepore.Sh HISTORY 173*5a978eadSIan LeporeThe 174*5a978eadSIan Lepore.Nm 175*5a978eadSIan Leporedriver first appeared in 176*5a978eadSIan Lepore.Fx 6.0 . 177