#include <linux/device.h>
#include <linux/gpio/consumer.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of_device.h>
#include <linux/of_gpio.h>
#include <linux/spi/spi.h>
#include <linux/nvmem-provider.h>
#include <linux/eeprom_93xx46.h>
#define OP_WRITE (OP_START | 0x1)
#define OP_READ (OP_START | 0x2)
struct eeprom_93xx46_devtype_data {
static const struct eeprom_93xx46_devtype_data atmel_at93c46d_data = {
.quirks = EEPROM_93XX46_QUIRK_SINGLE_WORD_READ |
EEPROM_93XX46_QUIRK_INSTRUCTION_LENGTH,
struct eeprom_93xx46_dev {
struct eeprom_93xx46_platform_data *pdata;
struct nvmem_config nvmem_config;
struct nvmem_device *nvmem;
static inline bool has_quirk_single_word_read(struct eeprom_93xx46_dev *edev)
return edev->pdata->quirks & EEPROM_93XX46_QUIRK_SINGLE_WORD_READ;
static inline bool has_quirk_instruction_length(struct eeprom_93xx46_dev *edev)
return edev->pdata->quirks & EEPROM_93XX46_QUIRK_INSTRUCTION_LENGTH;
static int eeprom_93xx46_read(void *priv, unsigned int off,
struct eeprom_93xx46_dev *edev = priv;