23 #define SPI_WRITE 0x02 43 #define ATMEL_SECTOR_ERASE 0x52 46 #define ATMEL_CHIP_ERASE 0x62 49 #define ATMEL_RDID 0x15 61 #define SPI_STATUS_WPEN 0x80 64 #define SPI_STATUS_BP2 0x10 67 #define SPI_STATUS_BP1 0x08 70 #define SPI_STATUS_BP0 0x04 73 #define SPI_STATUS_WEN 0x02 76 #define SPI_STATUS_NRDY 0x01 113 #define SPI_AUTODETECT_ADDRESS_LEN 0 154 const void *data_out,
void *data_in,
size_t len );
163 #define SPI_MODE_CPHA 0x01 169 #define SPI_MODE_CPOL 0x02 178 #define SPI_MODE_SSPOL 0x10 185 #define SPI_MODE_MICROWIRE 1 192 #define SPI_MODE_MICROWIRE_PLUS 0 199 #define SPI_MODE_THREEWIRE ( SPI_MODE_MICROWIRE_PLUS | SPI_MODE_SSPOL ) 204 const void *
data,
size_t len );
213 device->nvs.word_len_log2 = 0;
223 device->nvs.size = ( 128 * 1024 );
224 device->nvs.block_size = 256;
232 device->munge_address = 1;
234 device->nvs.block_size = 8;
242 device->nvs.size = ( 4 * 1024 * 1024 );
243 device->nvs.block_size = 256;
251 device->nvs.size = ( 8 * 1024 );
252 device->nvs.block_size = 32;
unsigned int address_len
Address length, in bits.
int(* rw)(struct spi_bus *bus, struct spi_device *device, unsigned int command, int address, const void *data_out, void *data_in, size_t len)
Read/write data via SPI bus.
A non-volatile storage device.
uint64_t address
Base address.
uint16_t device
Device ID.
unsigned int slave
Slave number.
unsigned int mode
SPI interface mode.
unsigned int munge_address
Address is munged.
int spi_write(struct nvs_device *nvs, unsigned int address, const void *data, size_t len)
Write data to SPI device.
#define container_of(ptr, type, field)
Get containing structure.
int spi_read(struct nvs_device *nvs, unsigned int address, void *data, size_t len)
Read data from SPI device.
static __attribute__((always_inline)) struct spi_device *nvs_to_spi(struct nvs_device *nvs)
Atmel AT25F1024 serial flash.
struct nvs_device nvs
NVS device.
struct spi_bus * bus
SPI bus to which device is attached.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
uint8_t data[48]
Additional event data.
unsigned int command_len
Command length, in bits.