linux/drivers/misc/eeprom/ee1004.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * ee1004 - driver for DDR4 SPD EEPROMs
 *
 * Copyright (C) 2017-2019 Jean Delvare
 *
 * Based on the at24 driver:
 * Copyright (C) 2005-2007 David Brownell
 * Copyright (C) 2008 Wolfram Sang, Pengutronix
 */

#include <linux/device.h>
#include <linux/i2c.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/nvmem-provider.h>

/*
 * DDR4 memory modules use special EEPROMs following the Jedec EE1004
 * specification. These are 512-byte EEPROMs using a single I2C address
 * in the 0x50-0x57 range for data. One of two 256-byte page is selected
 * by writing a command to I2C address 0x36 or 0x37 on the same I2C bus.
 *
 * Therefore we need to request these 2 additional addresses, and serialize
 * access to all such EEPROMs with a single mutex.
 *
 * We assume it is safe to read up to 32 bytes at once from these EEPROMs.
 * We use SMBus access even if I2C is available, these EEPROMs are small
 * enough, and reading from them infrequent enough, that we favor simplicity
 * over performance.
 */

#define EE1004_MAX_BUSSES
#define EE1004_ADDR_SET_PAGE
#define EE1004_NUM_PAGES
#define EE1004_PAGE_SIZE
#define EE1004_PAGE_SHIFT
#define EE1004_EEPROM_SIZE

/*
 * Mutex protects ee1004_set_page and ee1004_dev_count, and must be held
 * from page selection to end of read.
 */
static DEFINE_MUTEX(ee1004_bus_lock);

static struct ee1004_bus_data {} ee1004_bus_data[EE1004_MAX_BUSSES];

static const struct i2c_device_id ee1004_ids[] =;
MODULE_DEVICE_TABLE(i2c, ee1004_ids);

/*-------------------------------------------------------------------------*/

static struct ee1004_bus_data *ee1004_get_bus_data(struct i2c_adapter *adap)
{}

static int ee1004_get_current_page(struct ee1004_bus_data *bd)
{}

static int ee1004_set_current_page(struct i2c_client *client, int page)
{}

static ssize_t ee1004_eeprom_read(struct i2c_client *client, char *buf,
				  unsigned int offset, size_t count)
{}

static int ee1004_read(void *priv, unsigned int off, void *val, size_t count)
{}

static void ee1004_probe_temp_sensor(struct i2c_client *client)
{}

static void ee1004_cleanup(int idx, struct ee1004_bus_data *bd)
{}

static void ee1004_cleanup_bus_data(void *data)
{}

static int ee1004_init_bus_data(struct i2c_client *client)
{}

static int ee1004_probe(struct i2c_client *client)
{}

/*-------------------------------------------------------------------------*/

static struct i2c_driver ee1004_driver =;
module_i2c_driver();

MODULE_DESCRIPTION();
MODULE_AUTHOR();
MODULE_LICENSE();