eeprom Board Information EEPROM
I have a question regarding a driver for a Board Information EEPROM.
I want to give our customer easy access to our Board Information EEPROM which is an 256byte I2C eeprom.
There is a defined structure of information at the beginning of the eeprom which includes board name, serialnumber, production date, repair date and a eeprom structure ident number.
The rest of the eeprom is for user defined settings where customer can write any data to.
I want to have access to the eeprom without any special to and without installing anything just running linux and to a cat/echo to sysfs entries to read/write data to the eeprom.
What i want to do is to create sysfs entries for the pre defined settings and on entrie where customer can access the rest of the eeprom bytes.
Is drivers/misc/eeprom the right place to put those kind of driver in? Or are there any other options to write those kind of driver?
Regards
Andy
A message that is not in the archive (sent off-list or not yet received): CACx5bVzvJ-x7EdnGX+AraNBwKaxKNwRVvBwN1-0DNY3O155U5Q@mail.gmail.com
Quoted 31 lines · kavitha bk
Quoted 22 lines · Andreas Werner
I have a question regarding a driver for a Board Information EEPROM.
I want to give our customer easy access to our Board Information EEPROM which is an 256byte I2C eeprom.
There is a defined structure of information at the beginning of the eeprom which includes board name, serialnumber, production date, repair date and a eeprom structure ident number.
The rest of the eeprom is for user defined settings where customer can write
any data to.I want to have access to the eeprom without any special to and without installing
anything just running linux and to a cat/echo to sysfs entries to read/write
data to the eeprom.Quoted 5 lines
What i want to do is to create sysfs entries for the pre defined settings and
on entrie where customer can access the rest of the eeprom bytes.Is
drivers/misc/eepromthe right place to put those kind of driver in?
Quoted 9 lines
Yes You can add here
Quoted 3 lines
Or are
there any other options to write those kind of driver?Which eeprom are you using? You can explore
CONFIG_EEPROM_AT24driver for writing a sys interface
Ok i will check it out.
Thanks.
Regards
Andy
Quoted 11 lines
Quoted 11 lines
Regards
Andy
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
A message that is not in the archive (sent off-list or not yet received): CACx5bVwUaHXOD0NxOiGzEMVQ0HYF2eLXVBL3nu1s=xAemYP9LQ@mail.gmail.com
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): CACx5bVxpGW=vb8zXLLJ9ewUOfw3ib0g=YBHUcTAS=vMhZ7NnHg@mail.gmail.com
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): CACx5bVwHo4AUN8UXarX1ygCr9jddYWnM8A-BCOF9W97FcMLJuQ@mail.gmail.com
Quoted 79 lines · kavitha bk
Quoted 77 lines · Andreas Werner
Quoted 1 line · kavitha bk
On Wed, Sep 3, 2014 at 8:04 PM, Andreas Werner <[email protected]>
Quoted 8 lines · wrote:
Quoted 3 lines
Is there a way to access the eeprom data from within another driver?
Yes I had to access mac address from eeprom from smsc [ethernet driver] so I exported a function from eeprom driver
Quoted 1 line
I have seen in at24 using the
memory_accessorstruct to allow accesse.g.
Quoted 11 lines
Quoted 11 lines
from platform driver,
but this is not want i want.Current driver sysfs iface:
Predefined sections exported (24byte):
- revision
- serialnr
-prod_date
-rep_date
-hw_nameQuoted 8 lines
Quoted 8 lines
User memory (232 byte):
-user_eeprom(binary)This allows the userland to access the predefined data easily through sysfs without
the need to format the eeprom bytes to get the right data.I also need an interface to have access within another driver e.g. we
have
Quoted 7 lines
Quoted 5 lines
an ethernet
driver which needs to read the serialnumber of the board.How can I do this?
Quoted 8 lines
Easy way is export a function in at24 driver but very bad it is Best way using
memory_accessor.
Explorememory_accessorstruct
memory_accessor*mem_acc=
driver->access_eeprom->serial_noQuoted 15 lines
if (!mem_acc->read || !mem_acc->write) return -EIO; ret = mem_acc->read(mem_acc, serial_no, offset, len); if (ret != len) return -EIO; return 0;Quoted 3 lines
Regards
AndyHi,
i have checked the memory accessor. If i understand it right it is good if I have some platform code.
The problem I have is, if I have some x86 system without platform config (we normally have no BSP for x86)
the solution cannot work.Just a description of my problem.
I have an Ethernet driver which is a driver for a FPGA IP Core. The eth runs at most on x86 systems.
Inside the driver i need a interface to the eeprom were I can access the Serialnumber.
Quoted 7 lines
Quoted 3 lines
For me the solution to export a function in the eeprom driver is the best way to do it, isn´t it?
Yes may be it is appropriate to it this way in your case
Hi,
i have also tried to export a function, but the problem is that the data of the eeprom is stored in a structure of the eeprom driver, and i do not know how to get a pointer/reference to this structure to get access from within another driver.
Does anybody of you have another idea how to access eeprom data from within another driver?
Thanks
Andy
Quoted 144 lines
Quoted 144 lines
I hope it is clear what i want.
Regards
AndyQuoted 46 lines
Quoted 46 lines · kavitha bk
Quoted 45 lines
static
ssize_teeprom_read(struct device *dev,struct device_attribute *attr, char *buf) { struct i2c_client *client = to_i2c_client(dev); int ret = -1,i = 0; unsigned char sn[256]; sn[0] = 0x00; sn[1] = 0x00; ret = i2c_master_send(client, sn, 2); if(ret == -1) pr_info("ERROR: I2C send error\n"); ret = i2c_master_recv(client, sn, 256); if(ret == -1) pr_info("I2C read error\n"); return sprintf(buf, "%s\n", sn); }static
DEVICE_ATTR(eeprom, 0644, eeprom_read, NULL);In probe
err =
device_create_file(&client->dev,&dev_attr_eeprom);
if(err < 0) {
pr_err("%s : failed to device create file\n",__func__); goto err_device_create_file_failed; }Sample code for reference
Kavitha
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
On Tue, Sep 2, 2014 at 3:22 PM, Andreas Werner <[email protected]>
Quoted 3 lines · wrote:
Quoted 3 lines · kavitha bk
Quoted 1 line
On Sat, Aug 30, 2014 at 2:26 AM, Andreas Werner <
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines
Quoted 2 lines · wrote:
Quoted 2 lines
I have a question regarding a driver for a Board Information
EEPROM.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
I want to give our customer easy access to our Board
Information
Quoted 7 lines
Quoted 7 lines
EEPROM
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
which is an 256byte I2C eeprom.
There is a defined structure of information at the beginning
of the
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
eeprom
Quoted 1 line
Quoted 1 line
which includes board name, serialnumber, production date,
repair
Quoted 5 lines
Quoted 5 lines
date
Quoted 4 lines
Quoted 4 lines
and
Quoted 3 lines
Quoted 3 lines
a eeprom structure ident number.
The rest of the eeprom is for user defined settings where
customer
Quoted 8 lines
Quoted 8 lines
can
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
write
any data to.I want to have access to the eeprom without any special to and
without
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
installing
anything just running linux and to a cat/echo to sysfs entriesto
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
read/write
data to the eeprom.What i want to do is to create sysfs entries for the pre
defined
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
settings
Quoted 2 lines
Quoted 2 lines
and
on entrie where customer can access the rest of the eeprombytes.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Is
drivers/misc/eepromthe right place to put those kind ofdriver
Quoted 24 lines
Quoted 24 lines
in?
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Yes You can add here
Quoted 3 lines
Or are
there any other options to write those kind of driver?Which eeprom are you using? You can explore
CONFIG_EEPROM_AT24driver for
Quoted 13 lines
Quoted 13 lines
Quoted 2 lines
writing a sys interface
Ok i will check it out.
Thanks.
Regards
AndyQuoted 3 lines
Quoted 3 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines
Regards
Andy
--
To unsubscribe from this list: send the line "unsubscribelinux-kernel" in
Quoted 2 lines
Quoted 2 lines
the body of a message to [email protected] More majordomo info at
http://vger.kernel.org/majordomo-info.html
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
Quoted 3 lines
Quoted 2 lines
Quoted 2 lines
Please read the FAQ at http://www.tux.org/lkml/