Introduce MEN Board Information EEPROM driver
Subsystems (2)
cover Introduce MEN Board Information EEPROM driver
This patchset adds support for the MEN Board Information EEPROM.
The EEPROM is assembled on almost all of the MEN hardware boards and is the main location to get information about the board.
The driver exports the EEPROM data like production date, board name and serial number as read-only files as well as a user section for read-write access.
There is also a ABI documentation for sysfs description included.
Andreas Werner (2):
drivers/misc/eeprom/men_eeprod: Introduce MEN Board Information EEPROM
driver
Documentation/ABI/testing/men_eeprod: Added sysfs description for
men_eeprod
.../ABI/testing/sysfs-bus-i2c-devices-men_eeprod | 69 +++ MAINTAINERS | 6 + drivers/misc/eeprom/Kconfig | 10 + drivers/misc/eeprom/Makefile | 1 + drivers/misc/eeprom/men_eeprod.c | 560 +++++++++++++++++++++ 5 files changed, 646 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-bus-i2c-devices-men_eeprod create mode 100644 drivers/misc/eeprom/men_eeprod.c
Signature · 1 line
2.1.0
PATCH 1/2 drivers/misc/eeprom/men_eeprod: Introduce MEN Board Information EEPROM driver
Added driver to support the MEN Board Information EEPROM. The driver exports the production information as read only sysfs entries, as well as a user section which is read/write accessible.
Tested on PPC QorIQ and Intel Atom E680.
--- MAINTAINERS | 6 + drivers/misc/eeprom/Kconfig | 10 + drivers/misc/eeprom/Makefile | 1 + drivers/misc/eeprom/men_eeprod.c | 560 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 577 insertions(+) create mode 100644 drivers/misc/eeprom/men_eeprod.c
MAINTAINERS +6 -0
@@ -6029,6 +6029,12 @@ F: drivers/leds/leds-menf21bmc.c F: drivers/hwmon/menf21bmc_hwmon.c F: Documentation/hwmon/menf21bmc +MEN EEPROD (Board information EEPROM) +M: Andreas Werner <[email protected]> +S: Supported +F: drivers/misc/eeprom/men_eeprod.c +F: Documentation/ABI/testing/sysfs-bus-i2c-devices-men_eeprod + METAG ARCHITECTURE M: James Hogan <[email protected]> L: [email protected]
drivers/misc/eeprom/Kconfig +10 -0
@@ -62,6 +62,16 @@ config EEPROM_MAX6875 This driver can also be built as a module. If so, the module will be called max6875. +config EEPROM_MEN_EEPROD + tristate "MEN Board Information EEPROM" + depends on I2C && SYSFS + help + If you say yes here you get support for the MEN Board Information + EEPROM. This driver supports read-only access to the production + data section, and read-write access to the user section. + + This driver can also be built as a module. If so, the module + will be called men_eeprod. config EEPROM_93CX6 tristate "EEPROM 93CX6 support"
drivers/misc/eeprom/Makefile +1 -0
@@ -2,6 +2,7 @@ obj-$(CONFIG_EEPROM_AT24) += at24.o obj-$(CONFIG_EEPROM_AT25) += at25.o obj-$(CONFIG_EEPROM_LEGACY) += eeprom.o obj-$(CONFIG_EEPROM_MAX6875) += max6875.o +obj-$(CONFIG_EEPROM_MEN_EEPROD) += men_eeprod.o obj-$(CONFIG_EEPROM_93CX6) += eeprom_93cx6.o obj-$(CONFIG_EEPROM_93XX46) += eeprom_93xx46.o obj-$(CONFIG_EEPROM_SUNXI_SID) += sunxi_sid.o
drivers/misc/eeprom/men_eeprod.c new file +560 -0
560 lines not on this page · raw message
Signature · 1 line
2.1.0
Greg KH
maintainerRe: [PATCH 1/2] drivers/misc/eeprom/men_eeprod: Introduce MEN Board Information EEPROM driver
drivers/misc/eeprom/men_eeprod.c line 49
Quoted 2 lines · Andreas Werner
drivers/misc/eeprom/men_eeprod.c new file +2
-0+struct eeprom_data { +uint8_t eeprod_id;
Please use the "real" kernel types, "u8" here, and "u32" in other places you use uint32_t (those are userspace types, not kernel types, sorry.)
drivers/misc/eeprom/men_eeprod.c line 369
Quoted 6 lines
drivers/misc/eeprom/men_eeprod.c new file +6
-0+static DEVICE_ATTR(eeprod_id, S_IRUGO, show_eeprod_id, NULL); +static DEVICE_ATTR(revision, S_IRUGO, show_revision, NULL); +static DEVICE_ATTR(serial, S_IRUGO, show_serialnr, NULL); +static DEVICE_ATTR(hw_name, S_IRUGO, show_hw_name, NULL); +static DEVICE_ATTR(prod_date, S_IRUGO, show_prod_date, NULL); +static DEVICE_ATTR(rep_date, S_IRUGO, show_rep_date, NULL);
DEVICE_ATTR_RO() please.
Re: [PATCH 1/2] drivers/misc/eeprom/men_eeprod: Introduce MEN Board Information EEPROM driver
Quoted 7 lines · Greg KH
drivers/misc/eeprom/men_eeprod.c line 49
Quoted 2 lines · Andreas Werner
drivers/misc/eeprom/men_eeprod.c new file +2
-0+struct eeprom_data { +uint8_t eeprod_id;Please use the "real" kernel types, "u8" here, and "u32" in other places you use
uint32_t(those are userspace types, not kernel types, sorry.)
You are right i will change it.
Quoted 8 lines
drivers/misc/eeprom/men_eeprod.c line 369
Quoted 6 lines
drivers/misc/eeprom/men_eeprod.c new file +6
-0+static DEVICE_ATTR(eeprod_id, S_IRUGO, show_eeprod_id, NULL); +static DEVICE_ATTR(revision, S_IRUGO, show_revision, NULL); +static DEVICE_ATTR(serial, S_IRUGO, show_serialnr, NULL); +static DEVICE_ATTR(hw_name, S_IRUGO, show_hw_name, NULL); +static DEVICE_ATTR(prod_date, S_IRUGO, show_prod_date, NULL); +static DEVICE_ATTR(rep_date, S_IRUGO, show_rep_date, NULL);
DEVICE_ATTR_RO()please.
OK no problem, will change it.
Thanks.
Regards
Andy
Re: [PATCH 1/2] drivers/misc/eeprom/men_eeprod: Introduce MEN Board Information EEPROM driver
In reply to Andreas WernerQuoted 8 lines · Andreas Werner
Added driver to support the MEN Board Information EEPROM. The driver exports the production information as read only sysfs entries, as well as a user section which is read/write accessible.
Tested on PPC QorIQ and Intel Atom E680.
Tested-by Johannes Thumshirn <[email protected]>Signed-off-by Andreas Werner <[email protected]>
I guess this is just a standard EEPROM with a well defined layout? Why don't you want to use the standard driver then and parse the thing in userspace?
Consider how bloated the sysfs-ABI might get if every vendor who uses an eeprom wants to expose the data this way?
Quoted 5 lines
drivers/misc/eeprom/men_eeprod.c new file +5
-0+struct eeprom_data { +uint8_t eeprod_id; + +uint8_t revision[3 ]; +uint32_t serialnr;
drivers/misc/eeprom/men_eeprod.c line 62
Quoted 10 lines
drivers/misc/eeprom/men_eeprod.c new file +10
-0+uint8_t board_model; +char hw_name[6 ]; + +uint8_t reserved; + +__be16 prod_date; +__be16 rep_date; + +uint8_t reserved2[4 ]; +};
And what if the compiler reorders?
Re: [PATCH 1/2] drivers/misc/eeprom/men_eeprod: Introduce MEN Board Information EEPROM driver
Quoted 7 lines · Wolfram Sang
* PGP Signed by an unknown key
Quoted 4 lines · Andreas Werner
Added driver to support the MEN Board Information EEPROM. The driver exports the production information as read only sysfs entries, as well as a user section which is read/write accessible.
Quoted 9 lines
Quoted 4 lines
Tested on PPC QorIQ and Intel Atom E680.
Tested-by Johannes Thumshirn <[email protected]>Signed-off-by Andreas Werner <[email protected]>I guess this is just a standard EEPROM with a well defined layout? Why don't you want to use the standard driver then and parse the thing in userspace?
Yes it is a standard 256byte eeprom.
I do not want to parse the things in userspace because this EEPROM data are related to the hardware and i want to give our customer the easiest way to access the data without installing any tool.
The current state to read the eeprom data is, that customer needs to install a big environment where the tool is integrated to have access to those kind of simple data or they have to write their own code.
If our support department get some questions from the customer they always want to have exact information about the board. Therefore I want to use this driver and sysfs to get the informations as fast as possible without installing anything.
Quoted 3 lines
Consider how bloated the sysfs-ABI might get if every vendor who uses an eeprom wants to expose the data this way?
Yes and no. The possible sysfs entries gets bloated if every vendor will do it like this way, but normally there is just one Board EEPROM on the board, therefore only one driver gets loaded.
I mean its the same for every i2c device like a temperature sensor, I can also read it from userspace without any special hwmon driver.
Quoted 9 lines
Quoted 9 lines
drivers/misc/eeprom/men_eeprod.c new file +9
-0+struct eeprom_data { +uint8_t eeprod_id; + +uint8_t revision[3 ]; +uint32_t serialnr; +uint8_t board_model; +char hw_name[6 ]; + +uint8_t reserved;
Quoted 8 lines
drivers/misc/eeprom/men_eeprod.c line 62
Quoted 6 lines
drivers/misc/eeprom/men_eeprod.c new file +6
-0+ +__be16 prod_date; +__be16 rep_date; + +uint8_t reserved2[4 ]; +};And what if the compiler reorders?
Shit you are right, I will pack it.#
Quoted 4 lines
* Unknown Key
*0x14A029B6
Regards
Andy
Re: [PATCH 1/2] drivers/misc/eeprom/men_eeprod: Introduce MEN Board Information EEPROM driver
Quoted 4 lines
I do not want to parse the things in userspace because this EEPROM data are related to the hardware and i want to give our customer the easiest way to access the data without installing any tool.
I understand that point of view. From an upstream point of view, things may look different, though.
Quoted 3 lines
The current state to read the eeprom data is, that customer needs to install a big environment where the tool is integrated to have access to those kind of simple data or they have to write their own code.
i2cget from i2c-tools? You could do a simple shell script to parse the data. Or do a board specific hook which reads the data and prints it to the logfiles...
Quoted 7 lines
Quoted 3 lines
Consider how bloated the sysfs-ABI might get if every vendor who uses an eeprom wants to expose the data this way?
Yes and no. The possible sysfs entries gets bloated if every vendor will do it like this way, but normally there is just one Board EEPROM on the board, therefore only one driver gets loaded.
I am not talking about runtime here, I don't care about that. I am talking about the ABI we create and we have to maintain basically forever. And with vendor specific configuartion data I have doubts with that being stable.
Quoted 2 lines
I mean its the same for every i2c device like a temperature sensor, I can also read it from userspace without any special hwmon driver.
These is a HUGE difference. If I read tempX_input, I don't need to care if the sensor is I2C or SPI or whatever. The kernel abstracts that away. The files you create are for your I2C EEPROM only. Data gets "reformatted" and access gets hidden, but nothing is abstracted away. It would be different if we had a generic convention for "serial_id" or stuff like that. But as configuration data is highly specific I don't see this coming.
Re: [PATCH 1/2] drivers/misc/eeprom/men_eeprod: Introduce MEN Board Information EEPROM driver
Quoted 10 lines · Wolfram Sang
* PGP Signed by an unknown key
Quoted 3 lines
I do not want to parse the things in userspace because this EEPROM data are related to the hardware and i want to give our customer the easiest way to access the data without installing any tool.
I understand that point of view. From an upstream point of view, things may look different, though.
I also understand your point of view :-).
Most customers wants just to have a running system without installing anything. And for me an EEPROM is so simple and should not need a complicated way to access it.
Quoted 8 lines
Quoted 3 lines
The current state to read the eeprom data is, that customer needs to install a big environment where the tool is integrated to have access to those kind of simple data or they have to write their own code.
i2cget from i2c-tools? You could do a simple shell script to parse the data. Or do a board specific hook which reads the data and prints it to the logfiles...
Yes of course there are a lot of possibilities. This was just an example what we currently use and what was developed years ago.
With a driver like this you can also define read only attributes to prevent customer to write or modify the data in the production section. With i2ctools you can just write any data to it you want.
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
Consider how bloated the sysfs-ABI might get if every vendor who uses an eeprom wants to expose the data this way?
Quoted 9 lines
Quoted 3 lines
Yes and no. The possible sysfs entries gets bloated if every vendor will do it like this way, but normally there is just one Board EEPROM on the board, therefore only one driver gets loaded.
I am not talking about runtime here, I don't care about that. I am talking about the ABI we create and we have to maintain basically forever. And with vendor specific configuartion data I have doubts with that being stable.
Ok, but i do not think that we can make a "general" ABI definition for those kind of devices because every vendor will have its own data in the EEPROM which he want to have.
Quoted 11 lines
Quoted 2 lines
I mean its the same for every i2c device like a temperature sensor, I can also read it from userspace without any special hwmon driver.
These is a HUGE difference. If I read
tempX_input, I don't need to care if the sensor is I2C or SPI or whatever. The kernel abstracts that away. The files you create are for your I2C EEPROM only. Data gets "reformatted" and access gets hidden, but nothing is abstracted away. It would be different if we had a generic convention for "serial_id" or stuff like that. But as configuration data is highly specific I don't see this coming.
For a standard sysfs interface it is a huge difference yes. At the point of few from the EEPROM device it is a device like a temp sensor which could be different from vendor to vendor.
Regards
Andy
Quoted 3 lines
* Unknown Key
*0x14A029B6
Re: [PATCH 1/2] drivers/misc/eeprom/men_eeprod: Introduce MEN Board Information EEPROM driver
Quoted 63 lines · Andreas Werner
Quoted 10 lines · Wolfram Sang
* PGP Signed by an unknown key
Quoted 3 lines
I do not want to parse the things in userspace because this EEPROM data are related to the hardware and i want to give our customer the easiest way to access the data without installing any tool.
I understand that point of view. From an upstream point of view, things may look different, though.
I also understand your point of view :-).
Most customers wants just to have a running system without installing anything. And for me an EEPROM is so simple and should not need a complicated way to access it.Quoted 8 lines
Quoted 3 lines
The current state to read the eeprom data is, that customer needs to install a big environment where the tool is integrated to have access to those kind of simple data or they have to write their own code.
i2cget from i2c-tools? You could do a simple shell script to parse the data. Or do a board specific hook which reads the data and prints it to the logfiles...
Yes of course there are a lot of possibilities. This was just an example what we currently use and what was developed years ago.
With a driver like this you can also define read only attributes to prevent customer to write or modify the data in the production section. With i2ctools you can just write any data to it you want.
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
Consider how bloated the sysfs-ABI might get if every vendor who uses an eeprom wants to expose the data this way?
Quoted 9 lines
Quoted 3 lines
Yes and no. The possible sysfs entries gets bloated if every vendor will do it like this way, but normally there is just one Board EEPROM on the board, therefore only one driver gets loaded.
I am not talking about runtime here, I don't care about that. I am talking about the ABI we create and we have to maintain basically forever. And with vendor specific configuartion data I have doubts with that being stable.
Ok, but i do not think that we can make a "general" ABI definition for those kind of devices because every vendor will have its own data in the EEPROM which he want to have.
Quoted 11 lines
Quoted 2 lines
I mean its the same for every i2c device like a temperature sensor, I can also read it from userspace without any special hwmon driver.
These is a HUGE difference. If I read
tempX_input, I don't need to care if the sensor is I2C or SPI or whatever. The kernel abstracts that away. The files you create are for your I2C EEPROM only. Data gets "reformatted" and access gets hidden, but nothing is abstracted away. It would be different if we had a generic convention for "serial_id" or stuff like that. But as configuration data is highly specific I don't see this coming.
Quoted 7 lines
For a standard sysfs interface it is a huge difference yes. At the point of few from the EEPROM device it is a device like a temp sensor which could be different from vendor to vendor.
Regards
Andy
Greg what do you think about that driver as a Maintainer of the sysfs? To we have other ways to get those kind of drivers in the mainline kernel?
Regards
Andy
Quoted 3 lines
Quoted 3 lines
* Unknown Key
*0x14A029B6
Greg KH
maintainerRe: [PATCH 1/2] drivers/misc/eeprom/men_eeprod: Introduce MEN Board Information EEPROM driver
Quoted 68 lines · Andreas Werner
Quoted 67 lines · Andreas Werner
Quoted 10 lines · Wolfram Sang
* PGP Signed by an unknown key
Quoted 3 lines
I do not want to parse the things in userspace because this EEPROM data are related to the hardware and i want to give our customer the easiest way to access the data without installing any tool.
I understand that point of view. From an upstream point of view, things may look different, though.
I also understand your point of view :-).
Most customers wants just to have a running system without installing anything. And for me an EEPROM is so simple and should not need a complicated way to access it.Quoted 8 lines
Quoted 3 lines
The current state to read the eeprom data is, that customer needs to install a big environment where the tool is integrated to have access to those kind of simple data or they have to write their own code.
i2cget from i2c-tools? You could do a simple shell script to parse the data. Or do a board specific hook which reads the data and prints it to the logfiles...
Yes of course there are a lot of possibilities. This was just an example what we currently use and what was developed years ago.
With a driver like this you can also define read only attributes to prevent customer to write or modify the data in the production section. With i2ctools you can just write any data to it you want.
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
Consider how bloated the sysfs-ABI might get if every vendor who uses an eeprom wants to expose the data this way?
Quoted 9 lines
Quoted 3 lines
Yes and no. The possible sysfs entries gets bloated if every vendor will do it like this way, but normally there is just one Board EEPROM on the board, therefore only one driver gets loaded.
I am not talking about runtime here, I don't care about that. I am talking about the ABI we create and we have to maintain basically forever. And with vendor specific configuartion data I have doubts with that being stable.
Ok, but i do not think that we can make a "general" ABI definition for those kind of devices because every vendor will have its own data in the EEPROM which he want to have.
Quoted 11 lines
Quoted 2 lines
I mean its the same for every i2c device like a temperature sensor, I can also read it from userspace without any special hwmon driver.
These is a HUGE difference. If I read
tempX_input, I don't need to care if the sensor is I2C or SPI or whatever. The kernel abstracts that away. The files you create are for your I2C EEPROM only. Data gets "reformatted" and access gets hidden, but nothing is abstracted away. It would be different if we had a generic convention for "serial_id" or stuff like that. But as configuration data is highly specific I don't see this coming.For a standard sysfs interface it is a huge difference yes. At the point of few from the EEPROM device it is a device like a temp sensor which could be different from vendor to vendor.
Quoted 5 lines
Quoted 3 lines
Regards
AndyGreg what do you think about that driver as a Maintainer of the sysfs?
I maintain the sysfs core that drivers use, I don't dictate the policy that those drivers create and send to userspace, that is up to the maintainer of the subsystem. There are some basic rules of sysfs (one value per file), but other than that, please work with the maintainer to come up with an interface that will work for all types of this device, not just a one-off interface which does not scale at all, as Wolfram has pointed out.
Quoted 1 line
To we have other ways to get those kind of drivers in the mainline kernel?
Yes, work on a common interface that your driver can use, and it can be accepted. Why do you not want to do that?
thanks,
greg k-h
Re: [PATCH 1/2] drivers/misc/eeprom/men_eeprod: Introduce MEN Board Information EEPROM driver
Quoted 75 lines · Greg KH
Quoted 68 lines · Andreas Werner
Quoted 67 lines · Andreas Werner
Quoted 10 lines · Wolfram Sang
* PGP Signed by an unknown key
Quoted 3 lines
I do not want to parse the things in userspace because this EEPROM data are related to the hardware and i want to give our customer the easiest way to access the data without installing any tool.
I understand that point of view. From an upstream point of view, things may look different, though.
I also understand your point of view :-).
Most customers wants just to have a running system without installing anything. And for me an EEPROM is so simple and should not need a complicated way to access it.Quoted 8 lines
Quoted 3 lines
The current state to read the eeprom data is, that customer needs to install a big environment where the tool is integrated to have access to those kind of simple data or they have to write their own code.
i2cget from i2c-tools? You could do a simple shell script to parse the data. Or do a board specific hook which reads the data and prints it to the logfiles...
Yes of course there are a lot of possibilities. This was just an example what we currently use and what was developed years ago.
With a driver like this you can also define read only attributes to prevent customer to write or modify the data in the production section. With i2ctools you can just write any data to it you want.
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
Consider how bloated the sysfs-ABI might get if every vendor who uses an eeprom wants to expose the data this way?
Quoted 9 lines
Quoted 3 lines
Yes and no. The possible sysfs entries gets bloated if every vendor will do it like this way, but normally there is just one Board EEPROM on the board, therefore only one driver gets loaded.
I am not talking about runtime here, I don't care about that. I am talking about the ABI we create and we have to maintain basically forever. And with vendor specific configuartion data I have doubts with that being stable.
Ok, but i do not think that we can make a "general" ABI definition for those kind of devices because every vendor will have its own data in the EEPROM which he want to have.
Quoted 11 lines
Quoted 2 lines
I mean its the same for every i2c device like a temperature sensor, I can also read it from userspace without any special hwmon driver.
These is a HUGE difference. If I read
tempX_input, I don't need to care if the sensor is I2C or SPI or whatever. The kernel abstracts that away. The files you create are for your I2C EEPROM only. Data gets "reformatted" and access gets hidden, but nothing is abstracted away. It would be different if we had a generic convention for "serial_id" or stuff like that. But as configuration data is highly specific I don't see this coming.For a standard sysfs interface it is a huge difference yes. At the point of few from the EEPROM device it is a device like a temp sensor which could be different from vendor to vendor.
Quoted 5 lines
Quoted 3 lines
Regards
AndyGreg what do you think about that driver as a Maintainer of the sysfs?
Quoted 8 lines
I maintain the sysfs core that drivers use, I don't dictate the policy that those drivers create and send to userspace, that is up to the maintainer of the subsystem. There are some basic rules of sysfs (one value per file), but other than that, please work with the maintainer to come up with an interface that will work for all types of this device, not just a one-off interface which does not scale at all, as Wolfram has pointed out.
Ok.
Quoted 8 lines
Quoted 1 line
To we have other ways to get those kind of drivers in the mainline kernel?
Yes, work on a common interface that your driver can use, and it can be accepted. Why do you not want to do that?
thanks,
greg k-h
I have never talked about that I do not want to do it. I just want to discuss it with you.
Right now we are at a point that i know that those kind of drivers can't be upstream and i will try to find a way of abstraction to get it upstream.
Thanks
Andy
Re: [PATCH 1/2] drivers/misc/eeprom/men_eeprod: Introduce MEN Board Information EEPROM driver
Quoted 94 lines · Andreas Werner
Quoted 75 lines · Greg KH
Quoted 68 lines · Andreas Werner
Quoted 67 lines · Andreas Werner
Quoted 10 lines · Wolfram Sang
* PGP Signed by an unknown key
Quoted 3 lines
I do not want to parse the things in userspace because this EEPROM data are related to the hardware and i want to give our customer the easiest way to access the data without installing any tool.
I understand that point of view. From an upstream point of view, things may look different, though.
I also understand your point of view :-).
Most customers wants just to have a running system without installing anything. And for me an EEPROM is so simple and should not need a complicated way to access it.Quoted 8 lines
Quoted 3 lines
The current state to read the eeprom data is, that customer needs to install a big environment where the tool is integrated to have access to those kind of simple data or they have to write their own code.
i2cget from i2c-tools? You could do a simple shell script to parse the data. Or do a board specific hook which reads the data and prints it to the logfiles...
Yes of course there are a lot of possibilities. This was just an example what we currently use and what was developed years ago.
With a driver like this you can also define read only attributes to prevent customer to write or modify the data in the production section. With i2ctools you can just write any data to it you want.
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
Consider how bloated the sysfs-ABI might get if every vendor who uses an eeprom wants to expose the data this way?
Quoted 9 lines
Quoted 3 lines
Yes and no. The possible sysfs entries gets bloated if every vendor will do it like this way, but normally there is just one Board EEPROM on the board, therefore only one driver gets loaded.
I am not talking about runtime here, I don't care about that. I am talking about the ABI we create and we have to maintain basically forever. And with vendor specific configuartion data I have doubts with that being stable.
Ok, but i do not think that we can make a "general" ABI definition for those kind of devices because every vendor will have its own data in the EEPROM which he want to have.
Quoted 11 lines
Quoted 2 lines
I mean its the same for every i2c device like a temperature sensor, I can also read it from userspace without any special hwmon driver.
These is a HUGE difference. If I read
tempX_input, I don't need to care if the sensor is I2C or SPI or whatever. The kernel abstracts that away. The files you create are for your I2C EEPROM only. Data gets "reformatted" and access gets hidden, but nothing is abstracted away. It would be different if we had a generic convention for "serial_id" or stuff like that. But as configuration data is highly specific I don't see this coming.For a standard sysfs interface it is a huge difference yes. At the point of few from the EEPROM device it is a device like a temp sensor which could be different from vendor to vendor.
Quoted 5 lines
Quoted 3 lines
Regards
AndyGreg what do you think about that driver as a Maintainer of the sysfs?
Quoted 8 lines
I maintain the sysfs core that drivers use, I don't dictate the policy that those drivers create and send to userspace, that is up to the maintainer of the subsystem. There are some basic rules of sysfs (one value per file), but other than that, please work with the maintainer to come up with an interface that will work for all types of this device, not just a one-off interface which does not scale at all, as Wolfram has pointed out.
Ok.
Quoted 7 lines
Quoted 1 line
To we have other ways to get those kind of drivers in the mainline kernel?
Yes, work on a common interface that your driver can use, and it can be accepted. Why do you not want to do that?
thanks,
Quoted 7 lines
Quoted 1 line
greg k-h
I have never talked about that I do not want to do it. I just want to discuss it with you.
Right now we are at a point that i know that those kind of drivers can't be upstream and i will try to find a way of abstraction to get it upstream.
IMO, at24 provides you a good enough abstraction which you parse from user space with a help of a really small utility or a shell script... That is a really small effort.
If you want to take it further, may it is worth looking at how the DMI stuff is exported on x86 (except that you talk to eeprom directly)?
Signature · 2 lines
Regards, Igor.
Re: [PATCH 1/2] drivers/misc/eeprom/men_eeprod: Introduce MEN Board Information EEPROM driver
In reply to Andreas WernerQuoted 4 lines
Most customers wants just to have a running system without installing anything. And for me an EEPROM is so simple and should not need a complicated way to access it.
As I pointed out, there are ways to do it other than a seperate driver.
Quoted 2 lines
Yes of course there are a lot of possibilities. This was just an example what we currently use and what was developed years ago.
And please notice that this solution you chose is not acceptible for upstream. We can't have n copies of the at24 driver with just some minor differences. This is a maintenance nightmare.
Yes, I know it was easiest to start with and it works, but that does not help here.
Quoted 3 lines
With a driver like this you can also define read only attributes to prevent customer to write or modify the data in the production section. With i2ctools you can just write any data to it you want.
i2cget won't modify any data. i2cset does, if anyone wants to do that. BTW it does that also after you removed your driver, so basically no big difference here.
Quoted 9 lines
Quoted 5 lines
I am not talking about runtime here, I don't care about that. I am talking about the ABI we create and we have to maintain basically forever. And with vendor specific configuartion data I have doubts with that being stable.
Ok, but i do not think that we can make a "general" ABI definition for those kind of devices because every vendor will have its own data in the EEPROM which he want to have.
Exactly, that was what I was saying.
What we probably should have in at24 is regions which should not be exposed to userspace, because they contain config data. That would be nice.
I'm not sure if we can add table based decoding to at24, that needs some experiments. But it will really need such experiments and some more effort.
Quoted 9 lines
Quoted 8 lines
These is a HUGE difference. If I read
tempX_input, I don't need to care if the sensor is I2C or SPI or whatever. The kernel abstracts that away. The files you create are for your I2C EEPROM only. Data gets "reformatted" and access gets hidden, but nothing is abstracted away. It would be different if we had a generic convention for "serial_id" or stuff like that. But as configuration data is highly specific I don't see this coming.
Quoted 3 lines
For a standard sysfs interface it is a huge difference yes. At the point of few from the EEPROM device it is a device like a temp sensor which could be different from vendor to vendor.
Here it gets frustrating. It seems you have no idea what an OS is for, not even after I tried to describe it :(
Re: [PATCH 1/2] drivers/misc/eeprom/men_eeprod: Introduce MEN Board Information EEPROM driver
Quoted 2 lines
Here it gets frustrating. It seems you have no idea what an OS is for, not even after I tried to describe it :(
Sorry, that might have been too strong. Still, we can't map any hardware which is out there 1:1 into userspace, we need abstraction.
If you want to help with this abstraction, this is more than appreciated. If you want to keep your driver, this will have to stay out-of-tree, I'm afraid.
Regards,
Wolfram
Re: [PATCH 1/2] drivers/misc/eeprom/men_eeprod: Introduce MEN Board Information EEPROM driver
Quoted 5 lines · Wolfram Sang
* PGP Signed by an unknown key
Quoted 2 lines
Here it gets frustrating. It seems you have no idea what an OS is for, not even after I tried to describe it :(
I am pretty sure that i know what an OS is for.
Quoted 7 lines
Sorry, that might have been too strong. Still, we can't map any hardware which is out there 1:1 into userspace, we need abstraction.
If you want to help with this abstraction, this is more than appreciated. If you want to keep your driver, this will have to stay out-of-tree, I'm afraid.
Yes, my goal is to find a good way to get hardware support upstream, and it is also nice to discuss my point of view with your upstream point of few.
And yes, i want to help to find a way to develope an abstraction.
Regards
Andy
Quoted 7 lines
Regards,
Wolfram
* Unknown Key
*0x14A029B6
Greg KH
maintainerRe: [PATCH 1/2] drivers/misc/eeprom/men_eeprod: Introduce MEN Board Information EEPROM driver
In reply to Wolfram SangQuoted 9 lines · Wolfram Sang
Quoted 9 lines
drivers/misc/eeprom/men_eeprod.c new file +9
-0+struct eeprom_data { +uint8_t eeprod_id; + +uint8_t revision[3 ]; +uint32_t serialnr; +uint8_t board_model; +char hw_name[6 ]; + +uint8_t reserved;
Quoted 8 lines
drivers/misc/eeprom/men_eeprod.c line 62
Quoted 6 lines
drivers/misc/eeprom/men_eeprod.c new file +6
-0+ +__be16 prod_date; +__be16 rep_date; + +uint8_t reserved2[4 ]; +};And what if the compiler reorders?
It's not allowed to reorder, but it can add padding wherever it wants to, which if this is a on-device structure, can cause problems. Use __packed to prevent that.
thanks,
greg k-h
Re: [PATCH 1/2] drivers/misc/eeprom/men_eeprod: Introduce MEN Board Information EEPROM driver
Quoted 19 lines · Greg KH
Quoted 9 lines · Wolfram Sang
Quoted 9 lines
drivers/misc/eeprom/men_eeprod.c new file +9
-0+struct eeprom_data { +uint8_t eeprod_id; + +uint8_t revision[3 ]; +uint32_t serialnr; +uint8_t board_model; +char hw_name[6 ]; + +uint8_t reserved;Quoted 8 lines
drivers/misc/eeprom/men_eeprod.c line 62
Quoted 6 lines
drivers/misc/eeprom/men_eeprod.c new file +6
-0+ +__be16 prod_date; +__be16 rep_date; + +uint8_t reserved2[4 ]; +};And what if the compiler reorders?
Quoted 3 lines
It's not allowed to reorder, but it can add padding wherever it wants to, which if this is a on-device structure, can cause problems. Use
__packedto prevent that.
Yes, took the wrong word, sorry, I meant __packed.
PATCH 2/2 Documentation/ABI/testing/men_eeprod: Added sysfs description for men_eeprod
In reply to Andreas WernerThis patch adds the description for the men_eeprod. men_eeprod is a driver for the MEN Board Information EEPROM which exports the data using sysfs entries.
--- .../ABI/testing/sysfs-bus-i2c-devices-men_eeprod | 69 ++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-bus-i2c-devices-men_eeprod
Documentation/ABI/testing/sysfs-bus-i2c-devices-men_eeprod new file +69 -0
@@ -0,0 +1,69 @@ +What: /sys/bus/i2c/devices/i2c-<busnr>/<busnr>-<devaddr>/eeprod_id +Date: October 2014 +Contact: Andreas Werner <[email protected]> +Description: + Show the identifier of the EEPROM structure. + There are different layouts of the EEPROM with more or less + information. The ID identifies each of the layouts. + + Currently supported structure is EEPROD2 (0x0E) + +What: /sys/bus/i2c/devices/i2c-<busnr>/<busnr>-<devaddr>/revision +Date: October 2014 +Contact: Andreas Werner <[email protected]> +Description: + Show the revision of the board. + Format of the revision field is XX.XX.XX + +What: /sys/bus/i2c/devices/i2c-<busnr>/<busnr>-<devaddr>/serialnr +Date: October 2014 +Contact: Andreas Werner <[email protected]> +Description: + Show the serialnumber of the board. The serial number is + a decimal number. + +What: /sys/bus/i2c/devices/i2c-<busnr>/<busnr>-<devaddr>/hw_name +Date: October 2014 +Contact: Andreas Werner <[email protected]> +Description: + Show the name of the board including the model. + There are boards which have different features such as + different size of RAM, the model identifies the different + types. + + Format of the hw_name is: <name><model>. + Example: F075P00 where F75P is the hw_name and 00 the model. + +What: /sys/bus/i2c/devices/i2c-<busnr>/<busnr>-<devaddr>/prod_date +Date: October 2014 +Contact: Andreas Werner <[email protected]> +Description: + Show the board production date. + + Format of the date: YYYY-MM-DD + +What: /sys/bus/i2c/devices/i2c-<busnr>/<busnr>-<devaddr>/rep_date +Date: October 2014 +Contact: Andreas Werner <[email protected]> +Description: + Show the last repair date. + If the board returns back to the repair department, this field + will be programmed with the current date. + If the board has never returned, the field will be empty and + the read access to this sysfs entry returns -EINVAL. + + Format of the date: YYYY-MM-DD + +What: /sys/bus/i2c/devices/i2c-<busnr>/<busnr>-<devaddr>/user_section +Date: October 2014 +Contact: Andreas Werner <[email protected]> +Description: + Read or write access to the user section of the EEPROM + This sysfs entry is a binary file where customer can write + there own data to. + The size of this file depends on the EEPROM layout which is + identified by the eeprod_id. + + eeprod_id user_section size + --------------------------------- + 0x0E 232 byte
Signature · 1 line
2.1.0