xref: /openbmc/linux/include/linux/eeprom_93xx46.h (revision 14374fbb)
1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
206b4501eSAnatolij Gustschin /*
306b4501eSAnatolij Gustschin  * Module: eeprom_93xx46
406b4501eSAnatolij Gustschin  * platform description for 93xx46 EEPROMs.
506b4501eSAnatolij Gustschin  */
6e0552573SFabio Estevam #include <linux/gpio/consumer.h>
73ca9b1acSCory Tusar 
806b4501eSAnatolij Gustschin struct eeprom_93xx46_platform_data {
906b4501eSAnatolij Gustschin 	unsigned char	flags;
1006b4501eSAnatolij Gustschin #define EE_ADDR8	0x01		/*  8 bit addr. cfg */
1106b4501eSAnatolij Gustschin #define EE_ADDR16	0x02		/* 16 bit addr. cfg */
1206b4501eSAnatolij Gustschin #define EE_READONLY	0x08		/* forbid writing */
13*14374fbbSEmmanuel Gil Peyrot #define EE_SIZE1K	0x10		/* 1 kb of data, that is a 93xx46 */
14*14374fbbSEmmanuel Gil Peyrot #define EE_SIZE2K	0x20		/* 2 kb of data, that is a 93xx56 */
15*14374fbbSEmmanuel Gil Peyrot #define EE_SIZE4K	0x40		/* 4 kb of data, that is a 93xx66 */
1606b4501eSAnatolij Gustschin 
17e1379b56SCory Tusar 	unsigned int	quirks;
18e1379b56SCory Tusar /* Single word read transfers only; no sequential read. */
19e1379b56SCory Tusar #define EEPROM_93XX46_QUIRK_SINGLE_WORD_READ		(1 << 0)
20e1379b56SCory Tusar /* Instructions such as EWEN are (addrlen + 2) in length. */
21e1379b56SCory Tusar #define EEPROM_93XX46_QUIRK_INSTRUCTION_LENGTH		(1 << 1)
22f6f1f8e6SAswath Govindraju /* Add extra cycle after address during a read */
23f6f1f8e6SAswath Govindraju #define EEPROM_93XX46_QUIRK_EXTRA_READ_CYCLE		BIT(2)
24e1379b56SCory Tusar 
2506b4501eSAnatolij Gustschin 	/*
2606b4501eSAnatolij Gustschin 	 * optional hooks to control additional logic
2706b4501eSAnatolij Gustschin 	 * before and after spi transfer.
2806b4501eSAnatolij Gustschin 	 */
2906b4501eSAnatolij Gustschin 	void (*prepare)(void *);
3006b4501eSAnatolij Gustschin 	void (*finish)(void *);
313ca9b1acSCory Tusar 	struct gpio_desc *select;
3206b4501eSAnatolij Gustschin };
33