xref: /freebsd/share/man/man4/at45d.4 (revision a0b9e2e854027e6ff61fb075a1309dbc71c42b54)
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.\" $FreeBSD$
26.\"
27.Dd March 2, 2019
28.Dt AT45D 4
29.Os
30.Sh NAME
31.Nm at45d
32.Nd driver for DataFlash(tm) non-volatile storage devices
33.Sh SYNOPSIS
34To compile this driver into the kernel,
35place the following line in your
36kernel configuration file:
37.Bd -ragged -offset indent
38.Cd "device at45d"
39.Ed
40.Pp
41Alternatively, to load the driver as a
42module at boot time, place the following line in
43.Xr loader.conf 5 :
44.Bd -literal -offset indent
45at45d_load="YES"
46.Ed
47.Sh DESCRIPTION
48The
49.Nm
50driver provides support for the family of non-volatile storage
51devices known collectively as DataFlash(tm).
52DataFlash chips typically have part numbers beginning with AT45DB.
53The
54.Nm
55driver supports only the SPI bus versions of each AT45DB device,
56indicated by the last digit of the part number being 1 or 2.
57.Pp
58The
59.Nm
60driver uses opcode 0x9f to read the manufacturer and device ID
61data to determine whether the device is supported.
62The device ID is looked up using a table of data within the driver
63which describes the attributes of each supported device,
64such as block size, sector size, and device capacity.
65When a supported device is found, the
66.Nm
67driver creates a disk device and makes it accessible at
68.Pa /dev/flash/at45d? .
69The new disk device is then tasted by the available
70.Xr geom 4
71modules as with any disk device.
72.Sh HARDWARE
73The
74.Nm
75driver provides support for the following devices:
76.Pp
77.Bl -bullet -compact
78.It
79AT45DB011B
80.It
81AT45DB021B
82.It
83AT45DB041x
84.It
85AT45DB081B
86.It
87AT45DB161x
88.It
89AT45DB321x
90.It
91AT45DB321x
92.It
93AT45DB641E
94.It
95AT45DB642x
96.El
97.Sh FDT CONFIGURATION
98On an
99.Xr fdt 4
100based system, the
101.Nm
102device is defined as a slave device subnode
103of the SPI bus controller node.
104All properties documented in the
105.Va spibus.txt
106bindings document can be used with the
107.Nm
108device.
109The most commonly-used ones are documented below.
110.Pp
111The following properties are required in the
112.Nm
113device subnode:
114.Bl -tag -width indent
115.It Va compatible
116Must be the string "atmel,at45".
117.It Va reg
118Chip select address of device.
119.It Va spi-max-frequency
120The maximum bus frequency to use when communicating with this slave device.
121Actual bus speed may be lower, depending on the capabilities of the SPI
122bus controller hardware.
123.El
124.Pp
125The following properties are optional for the
126.Nm
127device subnode:
128.Bl -tag -width indent
129.It Va freebsd,sectorsize
130The sector size of the disk created for this storage device.
131It must be a multiple of the device's page size.
132The default is the device page size.
133.It Va spi-cpha
134Empty property indicating the slave device requires shifted clock
135phase (CPHA) mode.
136.It Va spi-cpol
137Empty property indicating the slave device requires inverse clock
138polarity (CPOL) mode.
139.It Va spi-cs-high
140Empty property indicating the slave device requires chip select active high.
141.El
142.Sh HINTS CONFIGURATION
143On a
144.Xr device.hints 5
145based system, such as
146.Li MIPS ,
147these values are configurable for
148.Nm :
149.Bl -tag -width indent
150.It Va hint.at45d.%d.at
151The spibus the
152.Nm
153instance is attached to.
154.It Va hint.at45d.%d.clock
155The maximum bus frequency to use when communicating with this device.
156Actual bus speed may be lower, depending on the capabilities of the SPI
157bus controller hardware.
158.It Va hint.at45d.%d.cs
159The chip-select number to assert when performing I/O for this device.
160Set the high bit (1 << 31) to invert the logic level of the chip select line.
161.It Va hint.at45d.%d.mode
162The SPI mode (0-3) to use when communicating with this device.
163.It Va hint.at45d.%d.sectorsize
164The sector size of the disk created for this storage device.
165It must be a multiple of the device's page size.
166The default is the device page size.
167.El
168.Sh FILES
169.Bl -tag -width /dev/flash/at45d?
170.It Pa /dev/flash/at45d?
171Provides read/write access to the storage device.
172.It Pa /dev/flash/spi?
173An alias for the
174.Pa /dev/at45d?
175device, for backwards compatibility with older versions of the driver.
176.El
177.Sh SEE ALSO
178.Xr fdt 4 ,
179.Xr geom 4
180.Sh HISTORY
181The
182.Nm
183driver first appeared in
184.Fx 6.0 .
185