Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Fields
at24_platform_data Struct Reference

#include <at24.h>

Data Fields

u32 byte_len
u16 page_size
u8 flags
void(* setup )(struct memory_accessor *, void *context)

Detailed Description

struct at24_platform_data - data to set up at24 (generic eeprom) driver : size of eeprom in byte : number of byte which can be written in one go : tunable options, check AT24_FLAG_* defines : an optional callback invoked after eeprom is probed; enables kernel code to access eeprom via memory_accessor, see example : optional parameter passed to setup()

If you set up a custom eeprom type, please double-check the parameters. Especially page_size needs extra care, as you risk data loss if your value is bigger than what the chip actually supports!

An example in pseudo code for a setup() callback:

void get_mac_addr(struct memory_accessor *mem_acc, void *context) { u8 *mac_addr = ethernet_pdata->mac_addr; off_t offset = context;

// Read MAC addr from EEPROM if (mem_acc->read(mem_acc, mac_addr, offset, ETH_ALEN) == ETH_ALEN) pr_info("Read MAC addr from EEPROM: %pM\n", mac_addr); }

This function pointer and context can now be set up in at24_platform_data.

Definition at line 42 of file at24.h.

Field Documentation

u32 byte_len

Definition at line 43 of file at24.h.

Definition at line 52 of file at24.h.

u8 flags

Definition at line 45 of file at24.h.

u16 page_size

Definition at line 44 of file at24.h.

Definition at line 51 of file at24.h.

The documentation for this struct was generated from the following file: