Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef __LINUX_SPI_EEPROM_H
0003 #define __LINUX_SPI_EEPROM_H
0004 
0005 #include <linux/memory.h>
0006 
0007 /*
0008  * Put one of these structures in platform_data for SPI EEPROMS handled
0009  * by the "at25" driver.  On SPI, most EEPROMS understand the same core
0010  * command set.  If you need to support EEPROMs that don't yet fit, add
0011  * flags to support those protocol options.  These values all come from
0012  * the chip datasheets.
0013  */
0014 struct spi_eeprom {
0015     u32     byte_len;
0016     char        name[10];
0017     u32     page_size;      /* for writes */
0018     u16     flags;
0019 #define EE_ADDR1    0x0001          /*  8 bit addrs */
0020 #define EE_ADDR2    0x0002          /* 16 bit addrs */
0021 #define EE_ADDR3    0x0004          /* 24 bit addrs */
0022 #define EE_READONLY 0x0008          /* disallow writes */
0023 
0024     /*
0025      * Certain EEPROMS have a size that is larger than the number of address
0026      * bytes would allow (e.g. like M95040 from ST that has 512 Byte size
0027      * but uses only one address byte (A0 to A7) for addressing.) For
0028      * the extra address bit (A8, A16 or A24) bit 3 of the instruction byte
0029      * is used. This instruction bit is normally defined as don't care for
0030      * other AT25 like chips.
0031      */
0032 #define EE_INSTR_BIT3_IS_ADDR   0x0010
0033 
0034     void *context;
0035 };
0036 
0037 #endif /* __LINUX_SPI_EEPROM_H */