diff options
| author | Michael Brown | 2006-12-04 21:47:51 +0100 |
|---|---|---|
| committer | Michael Brown | 2006-12-04 21:47:51 +0100 |
| commit | d62c83a35008d65623e630526daa65664d5bebf8 (patch) | |
| tree | e024d75102233852fa47edbf667c72ce38eb810a /src/include | |
| parent | Added the generic block-splitting code to nvs.c (diff) | |
| download | ipxe-d62c83a35008d65623e630526daa65664d5bebf8.tar.gz ipxe-d62c83a35008d65623e630526daa65664d5bebf8.tar.xz ipxe-d62c83a35008d65623e630526daa65664d5bebf8.zip | |
Migrated etherfabric driver to using generic SPI layer.
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/gpxe/spi.h | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/include/gpxe/spi.h b/src/include/gpxe/spi.h index beda2bcd6..fe38cb6bb 100644 --- a/src/include/gpxe/spi.h +++ b/src/include/gpxe/spi.h @@ -193,4 +193,47 @@ extern int spi_read ( struct nvs_device *nvs, unsigned int address, extern int spi_write ( struct nvs_device *nvs, unsigned int address, const void *data, size_t len ); +/** + * @defgroup spidevs SPI device types + * @{ + */ + +static inline __attribute__ (( always_inline )) void +init_spi ( struct spi_device *device ) { + device->nvs.word_len_log2 = 0; + device->command_len = 8, + device->nvs.read = spi_read; + device->nvs.write = spi_write; +} + +/** Atmel AT25F1024 serial flash */ +static inline __attribute__ (( always_inline )) void +init_at25f1024 ( struct spi_device *device ) { + device->address_len = 24; + device->nvs.size = ( 128 * 1024 ); + device->nvs.block_size = 256; + init_spi ( device ); +} + +/** Atmel 25040 serial EEPROM */ +static inline __attribute__ (( always_inline )) void +init_at25040 ( struct spi_device *device ) { + device->address_len = 8; + device->munge_address = 1; + device->nvs.size = 512; + device->nvs.block_size = 8; + init_spi ( device ); +} + +/** Microchip 25XX640 serial EEPROM */ +static inline __attribute__ (( always_inline )) void +init_mc25xx640 ( struct spi_device *device ) { + device->address_len = 16; + device->nvs.size = ( 8 * 1024 ); + device->nvs.block_size = 32; + init_spi ( device ); +} + +/** @} */ + #endif /* _GPXE_SPI_H */ |
