Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1306134 > unrolled thread
| Started by | Andreas Werner <andreas.werner@men.de> |
|---|---|
| First post | 2016-01-11 13:30 +0100 |
| Last post | 2016-01-11 13:30 +0100 |
| Articles | 3 — 1 participant |
Back to article view | Back to linux.kernel
[PATCH v2 0/4] remove auto exit of production and added sysfs interface Andreas Werner <andreas.werner@men.de> - 2016-01-11 13:30 +0100
[PATCH v2 2/4] doc: ABI: Added sysfs description for the menf21bmc MFD driver Andreas Werner <andreas.werner@men.de> - 2016-01-11 13:30 +0100
[PATCH v2 1/4] mfd: menf21bmc: Remove auto exiting of production mode and add sysfs interface Andreas Werner <andreas.werner@men.de> - 2016-01-11 13:30 +0100
| From | Andreas Werner <andreas.werner@men.de> |
|---|---|
| Date | 2016-01-11 13:30 +0100 |
| Subject | [PATCH v2 0/4] remove auto exit of production and added sysfs interface |
| Message-ID | <qPJLH-2jg-9@gated-at.bofh.it> |
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.
Changes in v2:
- added I2C maintainer in CC because this patches
are also I2C related.
- fixed irrelevant changes (alignments) in the mfd driver
- update subject lines
that they match the format of the subsystem
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: 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
--
2.6.2
[toc] | [next] | [standalone]
| From | Andreas Werner <andreas.werner@men.de> |
|---|---|
| Date | 2016-01-11 13:30 +0100 |
| Subject | [PATCH v2 2/4] doc: ABI: Added sysfs description for the menf21bmc MFD driver |
| Message-ID | <qPJLI-2jg-29@gated-at.bofh.it> |
| In reply to | #1306134 |
This patch add the description of the "mode" sysfs interface for the menf21bmc MFD driver. Signed-off-by: Andreas Werner <andreas.werner@men.de> --- 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 diff --git a/Documentation/ABI/testing/sysfs-bus-i2c-devices-menf21bmc b/Documentation/ABI/testing/sysfs-bus-i2c-devices-menf21bmc new file mode 100644 index 0000000..28d1fa2 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-bus-i2c-devices-menf21bmc @@ -0,0 +1,14 @@ +What: /sys/bus/i2c/devices/.../mode +Date: December 2015 +KernelVersion: 4.4 +Contact: Andreas Werner <andreas.werner@men.de> +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 -- 2.6.2
[toc] | [prev] | [next] | [standalone]
| From | Andreas Werner <andreas.werner@men.de> |
|---|---|
| Date | 2016-01-11 13:30 +0100 |
| Subject | [PATCH v2 1/4] mfd: menf21bmc: Remove auto exiting of production mode and add sysfs interface |
| Message-ID | <qPJLJ-2jg-43@gated-at.bofh.it> |
| In reply to | #1306134 |
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.
Signed-off-by: Andreas Werner <andreas.werner@men.de>
---
drivers/mfd/menf21bmc.c | 65 +++++++++++++++++++++++++++++++++----------------
1 file changed, 44 insertions(+), 21 deletions(-)
diff --git a/drivers/mfd/menf21bmc.c b/drivers/mfd/menf21bmc.c
index 1c27434..b11bd6b 100644
--- a/drivers/mfd/menf21bmc.c
+++ b/drivers/mfd/menf21bmc.c
@@ -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;
}
--
2.6.2
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web