AT45D(4)

πŸ’Ύ AT45D(4) β€” the at45d driver, bestie edition ✨

okay so real talk, this is section 4 of the Kernel Interfaces Manual, and today's main character is at45d β€” the driver for DataFlash(tm) non-volatile storage devices. no cap, she's giving flash storage but make it SPI. let's get into it πŸ’…


πŸŽ€ NAME πŸŽ€

at45d β€” driver for DataFlash(tm) non-volatile storage devices

like. the whole vibe. she's the driver for DataFlash(tm) non-volatile storage devices. that's the job. that's the assignment. 🫢


✨ SYNOPSIS ✨

okay so you wanna get her into your kernel? two ways, babes, pick your fighter:

Option one β€” compile it in. drop this line into your kernel configuration file:

device at45d

Option two β€” module girl. load the driver as a module at boot time instead, and this line goes in loader.conf(5):

at45d_load="YES"

literally pick one, you don't need both. slay. πŸ”₯


🌸 DESCRIPTION 🌸

The at45d driver provides support for the family of non-volatile storage devices known collectively as DataFlash(tm). these chips typically have part numbers beginning with AT45DB. super important: at45d supports only the SPI bus versions of each AT45DB device β€” and you can spot those because the last digit of the part number is 1 or 2. iykyk. πŸ‘‘

so how does she even know what she's talking to? okay so the at45d driver uses opcode 0x9f to read the manufacturer and device ID data, and that's how she determines whether the device is supported. the device ID gets looked up using a table of data within the driver, and that table describes the attributes of each supported device β€” think block size, sector size, and device capacity. πŸ“‹

and then the magic moment: when a supported device is found, the at45d driver creates a disk device and makes it accessible at /dev/flash/at45d?. that new disk device is then tasted by the available geom(4) modules, just like any other disk device would be. main character energy from start to finish. ✨


πŸ”₯ HARDWARE πŸ”₯

The at45d driver provides support for the following devices:

  • AT45DB011B
  • AT45DB021B
  • AT45DB041x
  • AT45DB081B
  • AT45DB161x
  • AT45DB321x
  • AT45DB321x
  • AT45DB641E
  • AT45DB642x

(yes, AT45DB321x is listed twice. we don't ask questions, we just respect the list. πŸ’€)


πŸ¦‹ FDT CONFIGURATION πŸ¦‹

On an fdt(4) based system, the at45d device is defined as a slave device subnode of the SPI bus controller node. and here's the tea: all properties documented in the spibus.txt bindings document can be used with the at45d device. but the most commonly-used ones are documented below, because we're nice like that. πŸ’–

the required ones (no skipping these, bestie)

  • compatible β€” Must be the string "atmel,at45".
  • reg β€” Chip select address of device.
  • spi-max-frequency β€” The maximum bus frequency to use when communicating with this slave device. heads up: the actual bus speed may be lower, depending on the capabilities of the SPI bus controller hardware.

the optional ones (glow-up extras)

  • freebsd,sectorsize β€” The sector size of the disk created for this storage device. it must be a multiple of the device's page size. the default is the device page size.
  • spi-cpha β€” Empty property indicating the slave device requires shifted clock phase (CPHA) mode.
  • spi-cpol β€” Empty property indicating the slave device requires inverse clock polarity (CPOL) mode.
  • spi-cs-high β€” Empty property indicating the slave device requires chip select active high.

πŸ“ HINTS CONFIGURATION πŸ“

On a device.hints(5) based system β€” think MIPS β€” these values are configurable for at45d:

  • hint.at45d.%d.at β€” The spibus the at45d instance is attached to.
  • hint.at45d.%d.clock β€” The maximum bus frequency to use when communicating with this device. again, actual bus speed may be lower, depending on the capabilities of the SPI bus controller hardware.
  • hint.at45d.%d.cs β€” The chip-select number to assert when performing I/O for this device. pro tip: set the high bit (1 << 31) to invert the logic level of the chip select line.
  • hint.at45d.%d.mode β€” The SPI mode (0-3) to use when communicating with this device.
  • hint.at45d.%d.sectorsize β€” The sector size of the disk created for this storage device. it must be a multiple of the device's page size. the default is the device page size.

πŸ’œ FILES πŸ’œ

  • /dev/flash/at45d? β€” Provides read/write access to the storage device.
  • /dev/flash/spi? β€” An alias for the /dev/at45d? device, for backwards compatibility with older versions of the driver.

🌈 SEE ALSO 🌈

fdt(4), geom(4)


⭐ HISTORY ⭐

The at45d driver first appeared in FreeBSD 6.0. an icon, a legend, a moment in history. πŸ‘‘


okay that's the whole page, bestie, you're officially educated on at45d πŸ’– go forth and flash responsibly ✨

this lil masterpiece came from the Debian crew, dated March 2, 2019 β€” mwah, sending love to whoever typed it up πŸŽ€πŸ’…

πŸ“¦ where this page comes from