remove auto exit of production and added sysfs interface
Andreas Werner
maintainercover remove auto exit of production and added sysfs interface
This patch set introduces new sysfs entries for BMC status information as well as the ABI documention.
The mfd core driver now does not exit the production mode automatically. The new sysfs entry allows the userland to exit the production mode if required.
Andreas Werner (4):
mfd/menf21bmc: remove auto exiting of production mode and add sysfs
interface
doc/ABI: added sysfs description for the menf21bmc MFD driver mfd/menf21bmc.c: add additional sysfs entries for BMC status
information
doc/ABI: add documentation for the additional sysfs status information
.../ABI/testing/sysfs-bus-i2c-devices-menf21bmc | 40 ++++++ drivers/mfd/menf21bmc.c | 158 ++++++++++++++++++--- 2 files changed, 177 insertions(+), 21 deletions(-) create mode 100644 Documentation/ABI/testing/sysfs-bus-i2c-devices-menf21bmc
Signature · 1 line
2.6.2
Andreas Werner
maintainerPATCH 1/4 mfd/menf21bmc: remove auto exiting of production mode and add sysfs interface
Changed "exit production mode" from automatic exiting to manually using the sysfs interface.
If the driver exit the production mode automatically, the board will not start anymore if the bootloader does not already have the "BIOS life sign" feature.
This patch remove the auto mechanism and add a sysfs interface to manually exiting the production e.g. during the EOL test of the board.
--- drivers/mfd/menf21bmc.c | 65 +++++++++++++++++++++++++++++++++---------------- 1 file changed, 44 insertions(+), 21 deletions(-)
drivers/mfd/menf21bmc.c +44 -21
@@ -27,31 +27,57 @@ static struct mfd_cell menf21bmc_cell[] = { { .name = "menf21bmc_hwmon", } }; -static int menf21bmc_wdt_exit_prod_mode (struct i2c_client *client) +static ssize_t menf21bmc_mode_show (struct device *dev, +struct device_attribute *attr,char *buf) { -int val, ret; +struct i2c_client *client =to_i2c_client (dev); +int val; val =i2c_smbus_read_byte_data (client,BMC_CMD_WDT_PROD_STAT );if (val <0 )return val; +return sprintf (buf,"%d\n" , val); +} + +static ssize_t menf21bmc_mode_store (struct device *dev, +struct device_attribute *attr, +const char *buf,size_t size) +{ +struct i2c_client *client =to_i2c_client (dev); +unsigned long mode_val; +int ret; + +if (kstrtoul (buf,0 , &mode_val)) +return -EINVAL ; +/* -* Production mode should be not active after delivery of the Board. -* To be sure we check it, inform the user and exit the mode -* if active. +* We cannot set the production mode (0). +* This is the default mode. If exited once, +* it cannot be set anymore. */ -if (val ==0x00 ) { -dev_info (&client->dev, -"BMC in production mode. Exit production mode\n" ); +if (!mode_val) +return -EINVAL ; - ret =i2c_smbus_write_byte (client,BMC_CMD_WDT_EXIT_PROD ); -if (ret <0 ) -return ret; - } + ret =i2c_smbus_write_byte (client,BMC_CMD_WDT_EXIT_PROD ); +if (ret <0 ) +return ret; -return 0 ; +return size; } +static DEVICE_ATTR(mode, S_IRUGO | S_IWUSR, menf21bmc_mode_show, + menf21bmc_mode_store); + +static struct attribute *menf21bmc_attributes[] = { + &dev_attr_mode.attr, +NULL +}; + +static const struct attribute_group menf21bmc_attr_group = { + .attrs = menf21bmc_attributes, +}; +static int menf21bmc_probe (struct i2c_client *client,const struct i2c_device_id *ids) {
@@ -86,20 +112,15 @@ menf21bmc_probe(struct i2c_client *client, const struct i2c_device_id *ids)dev_info (&client->dev,"FW Revision: %02d.%02d.%02d\n" , rev_major, rev_minor, rev_main); -/* -* We have to exit the Production Mode of the BMC to activate the -* Watchdog functionality and the BIOS life sign monitoring. -*/ - ret =menf21bmc_wdt_exit_prod_mode (client); -if (ret <0 ) { -dev_err (&client->dev,"failed to leave production mode\n" ); + ret =sysfs_create_group (&client->dev.kobj, &menf21bmc_attr_group); +if (ret)return ret; - } ret =mfd_add_devices (&client->dev,0 , menf21bmc_cell,ARRAY_SIZE (menf21bmc_cell),NULL ,0 ,NULL );if (ret <0 ) {dev_err (&client->dev,"failed to add BMC sub-devices\n" ); +sysfs_remove_group (&client->dev.kobj, &menf21bmc_attr_group);return ret; }
@@ -108,7 +129,9 @@ menf21bmc_probe(struct i2c_client *client, const struct i2c_device_id *ids)static int menf21bmc_remove (struct i2c_client *client) { +sysfs_remove_group (&client->dev.kobj, &menf21bmc_attr_group);mfd_remove_devices (&client->dev); +return 0 ; }
Signature · 1 line
2.6.2
Re: [PATCH 1/4] mfd/menf21bmc: remove auto exiting of production mode and add sysfs interface
Quoted 7 lines · Andreas Werner
Changed "exit production mode" from automatic exiting to manually using the sysfs interface.
If the driver exit the production mode automatically, the board will not start anymore if the bootloader does not already have the "BIOS life sign" feature.
Quoted 7 lines
This patch remove the auto mechanism and add a sysfs interface to manually exiting the production e.g. during the EOL test of the board.
Signed-off-by Andreas Werner <[email protected]>--- drivers/mfd/menf21bmc.c | 65 +++++++++++++++++++++++++++++++++---------------- 1 file changed, 44 insertions(+), 21 deletions(-)
Quoted 109 lines
drivers/mfd/menf21bmc.c +44
-21@@ -27,31 +27,57 @@ static struct mfd_cell menf21bmc_cell[] = { { .name = "menf21bmc_hwmon", } }; -static int menf21bmc_wdt_exit_prod_mode (struct i2c_client *client) +static ssize_t menf21bmc_mode_show (struct device *dev, +struct device_attribute *attr,char *buf) { -int val, ret; +struct i2c_client *client =to_i2c_client (dev); +int val; val =i2c_smbus_read_byte_data (client,BMC_CMD_WDT_PROD_STAT );if (val <0 )return val; +return sprintf (buf,"%d\n" , val); +} + +static ssize_t menf21bmc_mode_store (struct device *dev, +struct device_attribute *attr, +const char *buf,size_t size) +{ +struct i2c_client *client =to_i2c_client (dev); +unsigned long mode_val; +int ret; + +if (kstrtoul (buf,0 , &mode_val)) +return -EINVAL ; +/* -* Production mode should be not active after delivery of the Board. -* To be sure we check it, inform the user and exit the mode -* if active. +* We cannot set the production mode (0). +* This is the default mode. If exited once, +* it cannot be set anymore. */ -if (val ==0x00 ) { -dev_info (&client->dev, -"BMC in production mode. Exit production mode\n" ); +if (!mode_val) +return -EINVAL ; - ret =i2c_smbus_write_byte (client,BMC_CMD_WDT_EXIT_PROD ); -if (ret <0 ) -return ret; - } + ret =i2c_smbus_write_byte (client,BMC_CMD_WDT_EXIT_PROD ); +if (ret <0 ) +return ret; -return 0 ; +return size; } +static DEVICE_ATTR(mode, S_IRUGO | S_IWUSR, menf21bmc_mode_show, + menf21bmc_mode_store); + +static struct attribute *menf21bmc_attributes[] = { + &dev_attr_mode.attr, +NULL +}; + +static const struct attribute_group menf21bmc_attr_group = { + .attrs = menf21bmc_attributes, +}; +static int menf21bmc_probe (struct i2c_client *client,const struct i2c_device_id *ids) {@@ -86,20 +112,15 @@ menf21bmc_probe(struct i2c_client *client, const struct i2c_device_id *ids)dev_info (&client->dev,"FW Revision: %02d.%02d.%02d\n" , rev_major, rev_minor, rev_main); -/* -* We have to exit the Production Mode of the BMC to activate the -* Watchdog functionality and the BIOS life sign monitoring. -*/ - ret =menf21bmc_wdt_exit_prod_mode (client); -if (ret <0 ) { -dev_err (&client->dev,"failed to leave production mode\n" ); + ret =sysfs_create_group (&client->dev.kobj, &menf21bmc_attr_group); +if (ret)return ret; - } ret =mfd_add_devices (&client->dev,0 , menf21bmc_cell,ARRAY_SIZE (menf21bmc_cell),NULL ,0 ,NULL );if (ret <0 ) {dev_err (&client->dev,"failed to add BMC sub-devices\n" ); +sysfs_remove_group (&client->dev.kobj, &menf21bmc_attr_group);return ret; }@@ -108,7 +129,9 @@ menf21bmc_probe(struct i2c_client *client, const struct i2c_device_id *ids)static int menf21bmc_remove (struct i2c_client *client) { +sysfs_remove_group (&client->dev.kobj, &menf21bmc_attr_group);mfd_remove_devices (&client->dev); +return 0 ; }
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Re: [PATCH 1/4] mfd/menf21bmc: remove auto exiting of production mode and add sysfs interface
When you re-submit this set, with the correct Maintainers CC'ed, please also update the patch subject lines, so they match the format of the subsystem.
Quoted 129 lines · Lee Jones
Quoted 7 lines · Andreas Werner
Changed "exit production mode" from automatic exiting to manually using the sysfs interface.
If the driver exit the production mode automatically, the board will not start anymore if the bootloader does not already have the "BIOS life sign" feature.
Quoted 7 lines
This patch remove the auto mechanism and add a sysfs interface to manually exiting the production e.g. during the EOL test of the board.
Signed-off-by Andreas Werner <[email protected]>--- drivers/mfd/menf21bmc.c | 65 +++++++++++++++++++++++++++++++++---------------- 1 file changed, 44 insertions(+), 21 deletions(-)Acked-by Lee Jones <[email protected]>Quoted 109 lines
drivers/mfd/menf21bmc.c +44
-21@@ -27,31 +27,57 @@ static struct mfd_cell menf21bmc_cell[] = { { .name = "menf21bmc_hwmon", } }; -static int menf21bmc_wdt_exit_prod_mode (struct i2c_client *client) +static ssize_t menf21bmc_mode_show (struct device *dev, +struct device_attribute *attr,char *buf) { -int val, ret; +struct i2c_client *client =to_i2c_client (dev); +int val; val =i2c_smbus_read_byte_data (client,BMC_CMD_WDT_PROD_STAT );if (val <0 )return val; +return sprintf (buf,"%d\n" , val); +} + +static ssize_t menf21bmc_mode_store (struct device *dev, +struct device_attribute *attr, +const char *buf,size_t size) +{ +struct i2c_client *client =to_i2c_client (dev); +unsigned long mode_val; +int ret; + +if (kstrtoul (buf,0 , &mode_val)) +return -EINVAL ; +/* -* Production mode should be not active after delivery of the Board. -* To be sure we check it, inform the user and exit the mode -* if active. +* We cannot set the production mode (0). +* This is the default mode. If exited once, +* it cannot be set anymore. */ -if (val ==0x00 ) { -dev_info (&client->dev, -"BMC in production mode. Exit production mode\n" ); +if (!mode_val) +return -EINVAL ; - ret =i2c_smbus_write_byte (client,BMC_CMD_WDT_EXIT_PROD ); -if (ret <0 ) -return ret; - } + ret =i2c_smbus_write_byte (client,BMC_CMD_WDT_EXIT_PROD ); +if (ret <0 ) +return ret; -return 0 ; +return size; } +static DEVICE_ATTR(mode, S_IRUGO | S_IWUSR, menf21bmc_mode_show, + menf21bmc_mode_store); + +static struct attribute *menf21bmc_attributes[] = { + &dev_attr_mode.attr, +NULL +}; + +static const struct attribute_group menf21bmc_attr_group = { + .attrs = menf21bmc_attributes, +}; +static int menf21bmc_probe (struct i2c_client *client,const struct i2c_device_id *ids) {@@ -86,20 +112,15 @@ menf21bmc_probe(struct i2c_client *client, const struct i2c_device_id *ids)dev_info (&client->dev,"FW Revision: %02d.%02d.%02d\n" , rev_major, rev_minor, rev_main); -/* -* We have to exit the Production Mode of the BMC to activate the -* Watchdog functionality and the BIOS life sign monitoring. -*/ - ret =menf21bmc_wdt_exit_prod_mode (client); -if (ret <0 ) { -dev_err (&client->dev,"failed to leave production mode\n" ); + ret =sysfs_create_group (&client->dev.kobj, &menf21bmc_attr_group); +if (ret)return ret; - } ret =mfd_add_devices (&client->dev,0 , menf21bmc_cell,ARRAY_SIZE (menf21bmc_cell),NULL ,0 ,NULL );if (ret <0 ) {dev_err (&client->dev,"failed to add BMC sub-devices\n" ); +sysfs_remove_group (&client->dev.kobj, &menf21bmc_attr_group);return ret; }@@ -108,7 +129,9 @@ menf21bmc_probe(struct i2c_client *client, const struct i2c_device_id *ids)static int menf21bmc_remove (struct i2c_client *client) { +sysfs_remove_group (&client->dev.kobj, &menf21bmc_attr_group);mfd_remove_devices (&client->dev); +return 0 ; }
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Andreas Werner
maintainerRe: [PATCH 1/4] mfd/menf21bmc: remove auto exiting of production mode and add sysfs interface
Quoted 3 lines · Lee Jones
When you re-submit this set, with the correct Maintainers CC'ed, please also update the patch subject lines, so they match the format of the subsystem.
Just to be sure, do you mean I should update the following.
mfd/menf21bmc: -> mfd: menf21bmc:
Or do you mean I should update the subject lines of the ABI patches?
Regards
Andy
Quoted 1 line
...
Re: [PATCH 1/4] mfd/menf21bmc: remove auto exiting of production mode and add sysfs interface
Quoted 8 lines · Andreas Werner
Quoted 3 lines · Lee Jones
When you re-submit this set, with the correct Maintainers CC'ed, please also update the patch subject lines, so they match the format of the subsystem.
Just to be sure, do you mean I should update the following.
mfd/menf21bmc: -> mfd: menf21bmc:
This please. Then start your summary with an upper case letter.
Quoted 7 lines
Or do you mean I should update the subject lines of the ABI patches?
Regards
AndyQuoted 1 line
...
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Andreas Werner
maintainerPATCH 2/4 doc/ABI: added sysfs description for the menf21bmc MFD driver
In reply to Andreas WernerThis patch add the description of the "mode" sysfs interface for the menf21bmc MFD driver.
--- Documentation/ABI/testing/sysfs-bus-i2c-devices-menf21bmc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-bus-i2c-devices-menf21bmc
Documentation/ABI/testing/sysfs-bus-i2c-devices-menf21bmc new file +14 -0
@@ -0,0 +1,14 @@ +What: /sys/bus/i2c/devices/.../mode +Date: December 2015 +KernelVersion: 4.4 +Contact: Andreas Werner <[email protected]> +Description: Set and get the mode of the device. + The production mode cannot be set again if the device + is set to active once. + + In production mode the BMC does not wait for BIOS life sign, + did not reset the CPU board on Watchdog timeout and allow the + programming of the HW Variant. + + 0 = production mode + 1 = active mode
Signature · 1 line
2.6.2
Re: [PATCH 2/4] doc/ABI: added sysfs description for the menf21bmc MFD driver
Quoted 6 lines · Andreas Werner
This patch add the description of the "mode" sysfs interface for the menf21bmc MFD driver.
Signed-off-by Andreas Werner <[email protected]>--- Documentation/ABI/testing/sysfs-bus-i2c-devices-menf21bmc | 14 ++++++++++++++
These look like I2C changes, so you need to CC the I2C Maintainer.
Quoted 23 lines
1 file changed, 14 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-bus-i2c-devices-menf21bmcDocumentation/ABI/testing/sysfs-bus-i2c-devices-menf21bmc new file +14
-0@@ -0,0 +1,14 @@ +What: /sys/bus/i2c/devices/.../mode +Date: December 2015 +KernelVersion: 4.4 +Contact: Andreas Werner <[email protected]> +Description: Set and get the mode of the device. + The production mode cannot be set again if the device + is set to active once. + + In production mode the BMC does not wait for BIOS life sign, + did not reset the CPU board on Watchdog timeout and allow the + programming of the HW Variant. + + 0 = production mode + 1 = active mode
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Andreas Werner
maintainerRe: [PATCH 2/4] doc/ABI: added sysfs description for the menf21bmc MFD driver
Quoted 10 lines · Lee Jones
Quoted 6 lines · Andreas Werner
This patch add the description of the "mode" sysfs interface for the menf21bmc MFD driver.
Signed-off-by Andreas Werner <[email protected]>--- Documentation/ABI/testing/sysfs-bus-i2c-devices-menf21bmc | 14 ++++++++++++++These look like I2C changes, so you need to CC the I2C Maintainer.
Agree, will resend this one.
Regards
Andy
Quoted 30 lines
Quoted 24 lines
1 file changed, 14 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-bus-i2c-devices-menf21bmcDocumentation/ABI/testing/sysfs-bus-i2c-devices-menf21bmc new file +14
-0@@ -0,0 +1,14 @@ +What: /sys/bus/i2c/devices/.../mode +Date: December 2015 +KernelVersion: 4.4 +Contact: Andreas Werner <[email protected]> +Description: Set and get the mode of the device. + The production mode cannot be set again if the device + is set to active once. + + In production mode the BMC does not wait for BIOS life sign, + did not reset the CPU board on Watchdog timeout and allow the + programming of the HW Variant. + + 0 = production mode + 1 = active modeSignature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Andreas Werner
maintainerPATCH 3/4 mfd/menf21bmc.c: add additional sysfs entries for BMC status information
In reply to Andreas WernerThis patch adds additional sysfs entries to provide status information to the userland.
The following informations are now provided:
- Get operation hours counter
- Get board slot address
- Get powercycle counter
- Set/get Hw Variant
--- drivers/mfd/menf21bmc.c | 99 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 96 insertions(+), 3 deletions(-)
drivers/mfd/menf21bmc.c +96 -3
@@ -20,6 +20,10 @@#define BMC_CMD_REV_MAJOR 0x80#define BMC_CMD_REV_MINOR 0x81#define BMC_CMD_REV_MAIN 0x82 +#define BMC_CMD_SLOT_ADDRESS 0x8c +#define BMC_CMD_HW_VARIANT 0x8f +#define BMC_CMD_PWRCYCL_CNT 0x93 +#define BMC_CMD_OP_HRS_CNT 0x94static struct mfd_cell menf21bmc_cell[] = { { .name ="menf21bmc_wdt" , },
@@ -28,7 +32,7 @@ static struct mfd_cell menf21bmc_cell[] = { };static ssize_t menf21bmc_mode_show (struct device *dev, -struct device_attribute *attr,char *buf) +struct device_attribute *attr,char *buf) {struct i2c_client *client =to_i2c_client (dev);int val;
@@ -41,8 +45,8 @@ static ssize_t menf21bmc_mode_show(struct device *dev, }static ssize_t menf21bmc_mode_store (struct device *dev, -struct device_attribute *attr, -const char *buf,size_t size) +struct device_attribute *attr, +const char *buf,size_t size) {struct i2c_client *client =to_i2c_client (dev);unsigned long mode_val;
@@ -66,11 +70,100 @@ static ssize_t menf21bmc_mode_store(struct device *dev,return size; } +static ssize_t menf21bmc_hw_variant_show (struct device *dev, +struct device_attribute *attr, +char *buf) +{ +struct i2c_client *client =to_i2c_client (dev); +int val; + + val =i2c_smbus_read_word_data (client,BMC_CMD_HW_VARIANT ); +if (val <0 ) +return val; + +return sprintf (buf,"0x%04x\n" , val); + +} + +static ssize_t menf21bmc_hw_variant_store (struct device *dev, +struct device_attribute *attr, +const char *buf,size_t size) +{ +struct i2c_client *client =to_i2c_client (dev); +unsigned long hw_variant; +int ret; + +if (kstrtoul (buf,0 , &hw_variant)) +return -EINVAL ; + +if (hw_variant <0 || hw_variant >0xffff ) +return -EINVAL ; + + ret =i2c_smbus_write_word_data (client,BMC_CMD_HW_VARIANT , + hw_variant); +if (ret <0 ) +return ret; + +return size; + +} + +static ssize_t menf21bmc_pwrcycl_cnt_show (struct device *dev, +struct device_attribute *attr, +char *buf) +{ +struct i2c_client *client =to_i2c_client (dev); +int val; + + val =i2c_smbus_read_word_data (client,BMC_CMD_PWRCYCL_CNT ); +if (val <0 ) +return val; + +return sprintf (buf,"%d\n" , val); +} + +static ssize_t menf21bmc_op_hrs_cnt_show (struct device *dev, +struct device_attribute *attr, +char *buf) +{ +struct i2c_client *client =to_i2c_client (dev); +int val; + + val =i2c_smbus_read_word_data (client,BMC_CMD_OP_HRS_CNT ); +if (val <0 ) +return val; + +return sprintf (buf,"%d\n" , val); +} + +static ssize_t menf21bmc_slot_address_show (struct device *dev, +struct device_attribute *attr, +char *buf) +{ +struct i2c_client *client =to_i2c_client (dev); +int val; + + val =i2c_smbus_read_byte_data (client,BMC_CMD_SLOT_ADDRESS ); +if (val <0 ) +return val; + +return sprintf (buf,"%d\n" , val); +} + static DEVICE_ATTR(mode, S_IRUGO | S_IWUSR, menf21bmc_mode_show, menf21bmc_mode_store); +static DEVICE_ATTR(hw_variant, S_IRUGO | S_IWUSR, menf21bmc_hw_variant_show, + menf21bmc_hw_variant_store); +static DEVICE_ATTR(pwrcycl_cnt, S_IRUGO, menf21bmc_pwrcycl_cnt_show, NULL); +static DEVICE_ATTR(op_hrs_cnt, S_IRUGO, menf21bmc_op_hrs_cnt_show, NULL); +static DEVICE_ATTR(slot_address, S_IRUGO, menf21bmc_slot_address_show, NULL);static struct attribute *menf21bmc_attributes[] = { &dev_attr_mode.attr, + &dev_attr_hw_variant.attr, + &dev_attr_pwrcycl_cnt.attr, + &dev_attr_op_hrs_cnt.attr, + &dev_attr_slot_address.attr,NULL };
Signature · 1 line
2.6.2
Re: [PATCH 3/4] mfd/menf21bmc.c: add additional sysfs entries for BMC status information
Quoted 30 lines · Andreas Werner
This patch adds additional sysfs entries to provide status information to the userland.
The following informations are now provided:
- Get operation hours counter
- Get board slot address
- Get powercycle counter
- Set/get Hw VariantSigned-off-by Andreas Werner <[email protected]>--- drivers/mfd/menf21bmc.c | 99 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 96 insertions(+), 3 deletions(-)drivers/mfd/menf21bmc.c +4
-0@@ -20,6 +20,10 @@#define BMC_CMD_REV_MAJOR 0x80#define BMC_CMD_REV_MINOR 0x81#define BMC_CMD_REV_MAIN 0x82 +#define BMC_CMD_SLOT_ADDRESS 0x8c +#define BMC_CMD_HW_VARIANT 0x8f +#define BMC_CMD_PWRCYCL_CNT 0x93 +#define BMC_CMD_OP_HRS_CNT 0x94static struct mfd_cell menf21bmc_cell[] = { { .name ="menf21bmc_wdt" , },
drivers/mfd/menf21bmc.c static struct mfd_cell menf21bmc_cell[] = { · line 35
Quoted 5 lines
drivers/mfd/menf21bmc.c +1
-1@@ -28,7 +32,7 @@ static struct mfd_cell menf21bmc_cell[] = { };static ssize_t menf21bmc_mode_show (struct device *dev, -struct device_attribute *attr,char *buf) +struct device_attribute *attr,char *buf)
This is an irrelevant change. Please split it out.
drivers/mfd/menf21bmc.c static ssize_t menf21bmc_mode_show(struct device *dev, · line 49
Quoted 11 lines
drivers/mfd/menf21bmc.c +2
-2{struct i2c_client *client =to_i2c_client (dev);int val;@@ -41,8 +45,8 @@ static ssize_t menf21bmc_mode_show(struct device *dev, }static ssize_t menf21bmc_mode_store (struct device *dev, -struct device_attribute *attr, -const char *buf,size_t size) +struct device_attribute *attr, +const char *buf,size_t size)
This is an irrelevant change. Please split it out.
Quoted 104 lines
drivers/mfd/menf21bmc.c +89
-0{struct i2c_client *client =to_i2c_client (dev);unsigned long mode_val;@@ -66,11 +70,100 @@ static ssize_t menf21bmc_mode_store(struct device *dev,return size; } +static ssize_t menf21bmc_hw_variant_show (struct device *dev, +struct device_attribute *attr, +char *buf) +{ +struct i2c_client *client =to_i2c_client (dev); +int val; + + val =i2c_smbus_read_word_data (client,BMC_CMD_HW_VARIANT ); +if (val <0 ) +return val; + +return sprintf (buf,"0x%04x\n" , val); + +} + +static ssize_t menf21bmc_hw_variant_store (struct device *dev, +struct device_attribute *attr, +const char *buf,size_t size) +{ +struct i2c_client *client =to_i2c_client (dev); +unsigned long hw_variant; +int ret; + +if (kstrtoul (buf,0 , &hw_variant)) +return -EINVAL ; + +if (hw_variant <0 || hw_variant >0xffff ) +return -EINVAL ; + + ret =i2c_smbus_write_word_data (client,BMC_CMD_HW_VARIANT , + hw_variant); +if (ret <0 ) +return ret; + +return size; + +} + +static ssize_t menf21bmc_pwrcycl_cnt_show (struct device *dev, +struct device_attribute *attr, +char *buf) +{ +struct i2c_client *client =to_i2c_client (dev); +int val; + + val =i2c_smbus_read_word_data (client,BMC_CMD_PWRCYCL_CNT ); +if (val <0 ) +return val; + +return sprintf (buf,"%d\n" , val); +} + +static ssize_t menf21bmc_op_hrs_cnt_show (struct device *dev, +struct device_attribute *attr, +char *buf) +{ +struct i2c_client *client =to_i2c_client (dev); +int val; + + val =i2c_smbus_read_word_data (client,BMC_CMD_OP_HRS_CNT ); +if (val <0 ) +return val; + +return sprintf (buf,"%d\n" , val); +} + +static ssize_t menf21bmc_slot_address_show (struct device *dev, +struct device_attribute *attr, +char *buf) +{ +struct i2c_client *client =to_i2c_client (dev); +int val; + + val =i2c_smbus_read_byte_data (client,BMC_CMD_SLOT_ADDRESS ); +if (val <0 ) +return val; + +return sprintf (buf,"%d\n" , val); +} + static DEVICE_ATTR(mode, S_IRUGO | S_IWUSR, menf21bmc_mode_show, menf21bmc_mode_store); +static DEVICE_ATTR(hw_variant, S_IRUGO | S_IWUSR, menf21bmc_hw_variant_show, + menf21bmc_hw_variant_store); +static DEVICE_ATTR(pwrcycl_cnt, S_IRUGO, menf21bmc_pwrcycl_cnt_show, NULL); +static DEVICE_ATTR(op_hrs_cnt, S_IRUGO, menf21bmc_op_hrs_cnt_show, NULL); +static DEVICE_ATTR(slot_address, S_IRUGO, menf21bmc_slot_address_show, NULL);static struct attribute *menf21bmc_attributes[] = { &dev_attr_mode.attr, + &dev_attr_hw_variant.attr, + &dev_attr_pwrcycl_cnt.attr, + &dev_attr_op_hrs_cnt.attr, + &dev_attr_slot_address.attr,NULL };
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Andreas Werner
maintainerRe: [PATCH 3/4] mfd/menf21bmc.c: add additional sysfs entries for BMC status information
Quoted 34 lines · Lee Jones
Quoted 32 lines · Andreas Werner
This patch adds additional sysfs entries to provide status information to the userland.
The following informations are now provided:
- Get operation hours counter
- Get board slot address
- Get powercycle counter
- Set/get Hw VariantSigned-off-by Andreas Werner <[email protected]>--- drivers/mfd/menf21bmc.c | 99 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 96 insertions(+), 3 deletions(-)drivers/mfd/menf21bmc.c +4
-0@@ -20,6 +20,10 @@#define BMC_CMD_REV_MAJOR 0x80#define BMC_CMD_REV_MINOR 0x81#define BMC_CMD_REV_MAIN 0x82 +#define BMC_CMD_SLOT_ADDRESS 0x8c +#define BMC_CMD_HW_VARIANT 0x8f +#define BMC_CMD_PWRCYCL_CNT 0x93 +#define BMC_CMD_OP_HRS_CNT 0x94static struct mfd_cell menf21bmc_cell[] = { { .name ="menf21bmc_wdt" , },@@ -28,7 +32,7 @@ static struct mfd_cell menf21bmc_cell[] = { };
Quoted 5 lines
drivers/mfd/menf21bmc.c static struct mfd_cell menf21bmc_cell[] = { · line 35
Quoted 3 lines
drivers/mfd/menf21bmc.c +1
-1static ssize_t menf21bmc_mode_show (struct device *dev, -struct device_attribute *attr,char *buf) +struct device_attribute *attr,char *buf)This is an irrelevant change. Please split it out.
Argh, my mistake. I will fix it and resend this patch.
Quoted 125 lines
drivers/mfd/menf21bmc.c static ssize_t menf21bmc_mode_show(struct device *dev, · line 49
Quoted 12 lines
drivers/mfd/menf21bmc.c +2
-2{struct i2c_client *client =to_i2c_client (dev);int val;@@ -41,8 +45,8 @@ static ssize_t menf21bmc_mode_show(struct device *dev, }static ssize_t menf21bmc_mode_store (struct device *dev, -struct device_attribute *attr, -const char *buf,size_t size) +struct device_attribute *attr, +const char *buf,size_t size)This is an irrelevant change. Please split it out.
Quoted 104 lines
drivers/mfd/menf21bmc.c +89
-0{struct i2c_client *client =to_i2c_client (dev);unsigned long mode_val;@@ -66,11 +70,100 @@ static ssize_t menf21bmc_mode_store(struct device *dev,return size; } +static ssize_t menf21bmc_hw_variant_show (struct device *dev, +struct device_attribute *attr, +char *buf) +{ +struct i2c_client *client =to_i2c_client (dev); +int val; + + val =i2c_smbus_read_word_data (client,BMC_CMD_HW_VARIANT ); +if (val <0 ) +return val; + +return sprintf (buf,"0x%04x\n" , val); + +} + +static ssize_t menf21bmc_hw_variant_store (struct device *dev, +struct device_attribute *attr, +const char *buf,size_t size) +{ +struct i2c_client *client =to_i2c_client (dev); +unsigned long hw_variant; +int ret; + +if (kstrtoul (buf,0 , &hw_variant)) +return -EINVAL ; + +if (hw_variant <0 || hw_variant >0xffff ) +return -EINVAL ; + + ret =i2c_smbus_write_word_data (client,BMC_CMD_HW_VARIANT , + hw_variant); +if (ret <0 ) +return ret; + +return size; + +} + +static ssize_t menf21bmc_pwrcycl_cnt_show (struct device *dev, +struct device_attribute *attr, +char *buf) +{ +struct i2c_client *client =to_i2c_client (dev); +int val; + + val =i2c_smbus_read_word_data (client,BMC_CMD_PWRCYCL_CNT ); +if (val <0 ) +return val; + +return sprintf (buf,"%d\n" , val); +} + +static ssize_t menf21bmc_op_hrs_cnt_show (struct device *dev, +struct device_attribute *attr, +char *buf) +{ +struct i2c_client *client =to_i2c_client (dev); +int val; + + val =i2c_smbus_read_word_data (client,BMC_CMD_OP_HRS_CNT ); +if (val <0 ) +return val; + +return sprintf (buf,"%d\n" , val); +} + +static ssize_t menf21bmc_slot_address_show (struct device *dev, +struct device_attribute *attr, +char *buf) +{ +struct i2c_client *client =to_i2c_client (dev); +int val; + + val =i2c_smbus_read_byte_data (client,BMC_CMD_SLOT_ADDRESS ); +if (val <0 ) +return val; + +return sprintf (buf,"%d\n" , val); +} + static DEVICE_ATTR(mode, S_IRUGO | S_IWUSR, menf21bmc_mode_show, menf21bmc_mode_store); +static DEVICE_ATTR(hw_variant, S_IRUGO | S_IWUSR, menf21bmc_hw_variant_show, + menf21bmc_hw_variant_store); +static DEVICE_ATTR(pwrcycl_cnt, S_IRUGO, menf21bmc_pwrcycl_cnt_show, NULL); +static DEVICE_ATTR(op_hrs_cnt, S_IRUGO, menf21bmc_op_hrs_cnt_show, NULL); +static DEVICE_ATTR(slot_address, S_IRUGO, menf21bmc_slot_address_show, NULL);static struct attribute *menf21bmc_attributes[] = { &dev_attr_mode.attr, + &dev_attr_hw_variant.attr, + &dev_attr_pwrcycl_cnt.attr, + &dev_attr_op_hrs_cnt.attr, + &dev_attr_slot_address.attr,NULL };Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Andreas Werner
maintainerPATCH 4/4 doc/ABI: add documentation for the additional sysfs status information
In reply to Andreas Werner--- .../ABI/testing/sysfs-bus-i2c-devices-menf21bmc | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+)
Documentation/ABI/testing/sysfs-bus-i2c-devices-menf21bmc +26 -0
@@ -12,3 +12,29 @@ Description: Set and get the mode of the device. 0 = production mode 1 = active mode + +What: /sys/bus/i2c/devices/.../hw_variant +Date: December 2015 +KernelVersion: 4.4 +Contact: Andreas Werner <[email protected]> +Description: Set and get the hardware variant ID. + +What: /sys/bus/i2c/devices/.../pwrcycl_cnt +Date: December 2015 +KernelVersion: 4.4 +Contact: Andreas Werner <[email protected]> +Description: Read the BMC powercycle counter. + +What: /sys/bus/i2c/devices/.../op_hrs_cnt +Date: December 2015 +KernelVersion: 4.4 +Contact: Andreas Werner <[email protected]> +Description: Read the operation hours counter + +What: /sys/bus/i2c/devices/.../slot_address +Date: December 2015 +KernelVersion: 4.4 +Contact: Andreas Werner <[email protected]> +Description: Read the slot address of the board. + Slot address is the geographical address + in a CPCI rack/backplane.
Signature · 1 line
2.6.2
Re: [PATCH 4/4] doc/ABI: add documentation for the additional sysfs status information
Quoted 4 lines · Andreas Werner
Signed-off-by Andreas Werner <[email protected]>--- .../ABI/testing/sysfs-bus-i2c-devices-menf21bmc | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+)
These look like I2C changes, so you need to CC the I2C Maintainer.
Quoted 34 lines
Documentation/ABI/testing/sysfs-bus-i2c-devices-menf21bmc +26
-0@@ -12,3 +12,29 @@ Description: Set and get the mode of the device. 0 = production mode 1 = active mode + +What: /sys/bus/i2c/devices/.../hw_variant +Date: December 2015 +KernelVersion: 4.4 +Contact: Andreas Werner <[email protected]> +Description: Set and get the hardware variant ID. + +What: /sys/bus/i2c/devices/.../pwrcycl_cnt +Date: December 2015 +KernelVersion: 4.4 +Contact: Andreas Werner <[email protected]> +Description: Read the BMC powercycle counter. + +What: /sys/bus/i2c/devices/.../op_hrs_cnt +Date: December 2015 +KernelVersion: 4.4 +Contact: Andreas Werner <[email protected]> +Description: Read the operation hours counter + +What: /sys/bus/i2c/devices/.../slot_address +Date: December 2015 +KernelVersion: 4.4 +Contact: Andreas Werner <[email protected]> +Description: Read the slot address of the board. + Slot address is the geographical address + in a CPCI rack/backplane.
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Andreas Werner
maintainerRe: [PATCH 4/4] doc/ABI: add documentation for the additional sysfs status informationj
Quoted 8 lines · Lee Jones
Quoted 4 lines · Andreas Werner
Signed-off-by Andreas Werner <[email protected]>--- .../ABI/testing/sysfs-bus-i2c-devices-menf21bmc | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+)These look like I2C changes, so you need to CC the I2C Maintainer.
Ah ok, i sent it only to you because I thought it is related to the mfd and therefore you are responsible.
But I agree, it is a mfd i2c device which should also go to the i2c maintainer. I will resend this one.
Regards
Andy
Quoted 41 lines
Quoted 35 lines
Documentation/ABI/testing/sysfs-bus-i2c-devices-menf21bmc +26
-0@@ -12,3 +12,29 @@ Description: Set and get the mode of the device. 0 = production mode 1 = active mode + +What: /sys/bus/i2c/devices/.../hw_variant +Date: December 2015 +KernelVersion: 4.4 +Contact: Andreas Werner <[email protected]> +Description: Set and get the hardware variant ID. + +What: /sys/bus/i2c/devices/.../pwrcycl_cnt +Date: December 2015 +KernelVersion: 4.4 +Contact: Andreas Werner <[email protected]> +Description: Read the BMC powercycle counter. + +What: /sys/bus/i2c/devices/.../op_hrs_cnt +Date: December 2015 +KernelVersion: 4.4 +Contact: Andreas Werner <[email protected]> +Description: Read the operation hours counter + +What: /sys/bus/i2c/devices/.../slot_address +Date: December 2015 +KernelVersion: 4.4 +Contact: Andreas Werner <[email protected]> +Description: Read the slot address of the board. + Slot address is the geographical address + in a CPCI rack/backplane.Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Regards
Andy