Skip to contentSkip to conversation

drivers: OCC: Update sensors, fix probing, add P8

PATCH Applied Eddie James 2 participants 9 messages Jun 9, 2017 – Jun 16, 2017

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

v2 cover drivers: OCC: Update sensors, fix probing, add P8

From: "Edward A. James" <[email protected]>

This series refactors the OCC hwmon driver to make a number of changes and bug fixes. It also includes bug fixes for the FSI OCC driver. This includes 3 patches that were previously sent individually on the openbmc mailing list.

Edward A. James (5):
drivers: fsi: occ: Fix 1 byte response and rc for O_NONBLOCK
drivers: hwmon: occ: Add new sensor versions and non-hwmon attributes
drivers: hwmon: occ: Add P8 OCC access
drivers: occ: hwmon and fsi probing fix
aspeed: update power9 dts and defconfigs for OCC

 arch/arm/boot/dts/ibm-power9-cfam.dtsi |   9 +
 arch/arm/configs/aspeed_g4_defconfig   |   2 +
 arch/arm/configs/aspeed_g5_defconfig   |   1 +
 drivers/fsi/fsi-sbefifo.c              |   4 +-
 drivers/fsi/occ.c                      |  22 +-
 drivers/hwmon/Makefile                 |   2 +-
 drivers/hwmon/occ/Kconfig              |  19 +-
 drivers/hwmon/occ/Makefile             |  12 +-
 drivers/hwmon/occ/common.c             | 991 ++++++++++++++++++++++++++++++++-
 drivers/hwmon/occ/common.h             |  17 +
 drivers/hwmon/occ/p8_i2c.c             | 270 +++++++++
 drivers/hwmon/occ/p9.c                 | 350 ------------
 drivers/hwmon/occ/p9.h                 |  17 -
 drivers/hwmon/occ/p9_sbe.c             |  60 +-
 14 files changed, 1354 insertions(+), 422 deletions(-)
 create mode 100644 drivers/hwmon/occ/p8_i2c.c
 delete mode 100644 drivers/hwmon/occ/p9.c
 delete mode 100644 drivers/hwmon/occ/p9.h
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH v2 1/5 drivers: fsi: occ: Fix 1 byte response and rc for O_NONBLOCK

From: "Edward A. James" <[email protected]>

Couple of bug fixes.

---
 drivers/fsi/occ.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/fsi/occ.c +8 -6
index fc014b6..a1508f2 100644
@@ -188,7 +188,7 @@ static ssize_t occ_read_common(struct occ_client *client, char __user *ubuf,
 
 	if (!test_bit(XFR_COMPLETE, &xfr->flags)) {
 		if (test_bit(CLIENT_NONBLOCKING, &client->flags)) {
-			rc = -ERESTARTSYS;
+			rc = -EAGAIN;
 			goto done;
 		}
 
@@ -593,11 +593,13 @@ static void occ_worker(struct work_struct *work)
 		goto done;
 	}
 
-	/* already got 3 bytes resp, also need 2 bytes checksum */
-	rc = occ_getsram(sbefifo, 0xFFFBF008, &xfr->buf[8],
-			 resp_data_length - 1);
-	if (rc)
-		goto done;
+	if (resp_data_length > 1) {
+		/* already got 3 bytes resp, also need 2 bytes checksum */
+		rc = occ_getsram(sbefifo, 0xFFFBF008, &xfr->buf[8],
+				 resp_data_length - 1);
+		if (rc)
+			goto done;
+	}
 
 	xfr->resp_data_length = resp_data_length + 7;
 
Signature · 1 line
1.8.3.1
maintainer Applied
#2 lore raw

Re: [PATCH linux dev-4.10 v2 1/5] drivers: fsi: occ: Fix 1 byte response and rc for O_NONBLOCK

Quoted 5 lines · Eddie James

From: "Edward A. James" <[email protected]>

Couple of bug fixes.

Applied to dev-4.10.

Quoted 39 lines
---
 drivers/fsi/occ.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/fsi/occ.c +8 -7
index fc014b6..a1508f2 100644
@@ -188,7 +188,7 @@ static ssize_t occ_read_common(struct occ_client *client, char __user *ubuf,
 
        if (!test_bit(XFR_COMPLETE, &xfr->flags)) {
                if (test_bit(CLIENT_NONBLOCKING, &client->flags)) {
-                       rc = -ERESTARTSYS;
+                       rc = -EAGAIN;
                        goto done;
                }
 
@@ -593,11 +593,13 @@ static void occ_worker(struct work_struct *work)
                goto done;
        }
 
-       /* already got 3 bytes resp, also need 2 bytes checksum */
-       rc = occ_getsram(sbefifo, 0xFFFBF008, &xfr->buf[8],
-                        resp_data_length - 1);
-       if (rc)
-               goto done;
+       if (resp_data_length > 1) {
+               /* already got 3 bytes resp, also need 2 bytes checksum */
+               rc = occ_getsram(sbefifo, 0xFFFBF008, &xfr->buf[8],
+                                resp_data_length - 1);
+               if (rc)
+                       goto done;
+       }
 
        xfr->resp_data_length = resp_data_length + 7;
 
--

1.8.3.1

#3 lore raw

PATCH v2 2/5 drivers: hwmon: occ: Add new sensor versions and non-hwmon attributes

In reply to Eddie James

From: "Edward A. James" <[email protected]>

Switch to versioned sensors which can be used for both p8 and p9. This adds more common code and removes the need for the processor-specific functions (other than the OCC access code).

Also add non-hwmon attributes for OCC status.

---
 drivers/hwmon/occ/Makefile |   2 +-
 drivers/hwmon/occ/common.c | 991 ++++++++++++++++++++++++++++++++++++++++++++-
 drivers/hwmon/occ/common.h |  17 +
 drivers/hwmon/occ/p9.c     | 350 ----------------
 drivers/hwmon/occ/p9.h     |  17 -
 drivers/hwmon/occ/p9_sbe.c |  30 +-
 6 files changed, 1020 insertions(+), 387 deletions(-)
 delete mode 100644 drivers/hwmon/occ/p9.c
 delete mode 100644 drivers/hwmon/occ/p9.h
drivers/hwmon/occ/Makefile +1 -1
index 3b0ddc6..6245c25 100644
@@ -1 +1 @@
-obj-y += p9.o p9_sbe.o common.o
+obj-y += p9_sbe.o common.o
drivers/hwmon/occ/common.c +990 -1

1,021 lines not on this page · raw message

drivers/hwmon/occ/common.h +17 -0
index a3d733a..ad21538 100644
@@ -16,6 +16,18 @@
 #define OCC_UPDATE_FREQUENCY		msecs_to_jiffies(1000)
 #define OCC_RESP_DATA_BYTES		4089
 
+#define OCC_TIMEOUT_MS			5000
+#define OCC_CMD_IN_PRG_MS		100
+
+#define RESP_RETURN_CMD_IN_PRG		0xFF
+#define RESP_RETURN_SUCCESS		0
+#define RESP_RETURN_CMD_INVAL		0x11
+#define RESP_RETURN_CMD_LEN		0x12
+#define RESP_RETURN_DATA_INVAL		0x13
+#define RESP_RETURN_CHKSUM		0x14
+#define RESP_RETURN_OCC_ERR		0x15
+#define RESP_RETURN_STATE		0x16
+
 struct occ_response {
 	u8 seq_no;
 	u8 cmd_type;
@@ -63,6 +75,7 @@ struct occ_poll_response {
 
 struct occ_sensor {
 	u8 num_sensors;
+	u8 version;
 	void *data;
 };
 
@@ -71,6 +84,7 @@ struct occ_sensors {
 	struct occ_sensor freq;
 	struct occ_sensor power;
 	struct occ_sensor caps;
+	struct occ_sensor extended;
 };
 
 struct occ_attribute {
@@ -92,6 +106,7 @@ struct occ {
 	struct occ_attribute *attrs;
 	struct attribute_group group;
 	const struct attribute_group *groups[2];
+	struct sensor_device_attribute *status_attrs;
 
 	u8 poll_cmd_data;
 	int (*send_cmd)(struct occ *occ, u8 *cmd);
@@ -120,5 +135,7 @@ struct occ {
 int occ_poll(struct occ *occ);
 int occ_set_user_power_cap(struct occ *occ, u16 user_power_cap);
 int occ_update_response(struct occ *occ);
+int occ_setup_sensor_attrs(struct occ *occ);
+int occ_create_status_attrs(struct occ *occ);
 
 #endif /* __OCC_COMMON_H__ */
drivers/hwmon/occ/p9.c deleted +0 -350

350 lines not on this page · raw message

drivers/hwmon/occ/p9.h deleted +0 -17
deleted file mode 100644
index 12d1bc5..0000000
@@ -1,17 +0,0 @@
-/*
- * Copyright 2017 IBM Corp.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- */
-
-#ifndef __OCC_P9_H__
-#define __OCC_P9_H__
-
-struct occ;
-
-int p9_occ_setup_sensor_attrs(struct occ *occ);
-
-#endif /* __OCC_P9_H__ */
drivers/hwmon/occ/p9_sbe.c +12 -18
index 88f71b1..fe435ef 100644
@@ -15,21 +15,8 @@
 #include <linux/occ.h>
 #include <linux/sched.h>
 #include <linux/workqueue.h>
-#include "p9.h"
 
-#define P9_SBE_OCC_SETUP_DELAY		2500
-
-#define OCC_TIMEOUT_MS			5000
-#define OCC_CMD_IN_PRG_MS		100
-
-#define RESP_RETURN_CMD_IN_PRG		0xFF
-#define RESP_RETURN_SUCCESS		0
-#define RESP_RETURN_CMD_INVAL		0x11
-#define RESP_RETURN_CMD_LEN		0x12
-#define RESP_RETURN_DATA_INVAL		0x13
-#define RESP_RETURN_CHKSUM		0x14
-#define RESP_RETURN_OCC_ERR		0x15
-#define RESP_RETURN_STATE		0x16
+#define P9_SBE_OCC_SETUP_DELAY		5000
 
 struct p9_sbe_occ {
 	struct occ occ;
@@ -66,7 +53,8 @@ static int p9_sbe_occ_send_cmd(struct occ *occ, u8 *cmd)
 
 	switch (resp->return_status) {
 	case RESP_RETURN_CMD_IN_PRG:
-		if (time_after(jiffies, start + msecs_to_jiffies(OCC_TIMEOUT_MS)))
+		if (time_after(jiffies,
+			       start + msecs_to_jiffies(OCC_TIMEOUT_MS)))
 			rc = -EALREADY;
 		else {
 			set_current_state(TASK_INTERRUPTIBLE);
@@ -123,7 +111,7 @@ static void p9_sbe_occ_setup(struct work_struct *work)
 
 	occ_parse_poll_response(occ);
 
-	rc = p9_occ_setup_sensor_attrs(occ);
+	rc = occ_setup_sensor_attrs(occ);
 	if (rc) {
 		dev_err(occ->bus_dev, "failed to setup p9 attrs: %d\n", rc);
 		return;
@@ -137,6 +125,10 @@ static void p9_sbe_occ_setup(struct work_struct *work)
 			PTR_ERR(occ->hwmon));
 		return;
 	}
+
+	rc = occ_create_status_attrs(occ);
+	if (rc)
+		dev_err(occ->bus_dev, "failed to setup p9 status attrs: %d\n", rc);
 }
 
 static int p9_sbe_occ_probe(struct platform_device *pdev)
@@ -157,7 +149,8 @@ static int p9_sbe_occ_probe(struct platform_device *pdev)
 	occ->send_cmd = p9_sbe_occ_send_cmd;
 	mutex_init(&occ->lock);
 	INIT_DELAYED_WORK(&p9_sbe_occ->setup, p9_sbe_occ_setup);
-	platform_set_drvdata(pdev, p9_sbe_occ);
+
+	platform_set_drvdata(pdev, occ);
 
 	schedule_delayed_work(&p9_sbe_occ->setup,
 			      msecs_to_jiffies(P9_SBE_OCC_SETUP_DELAY));
@@ -167,7 +160,8 @@ static int p9_sbe_occ_probe(struct platform_device *pdev)
 
 static int p9_sbe_occ_remove(struct platform_device *pdev)
 {
-	struct p9_sbe_occ *p9_sbe_occ = platform_get_drvdata(pdev);
+	struct occ *occ = platform_get_drvdata(pdev);
+	struct p9_sbe_occ *p9_sbe_occ = to_p9_sbe_occ(occ);
 
 	cancel_delayed_work_sync(&p9_sbe_occ->setup);
 
Signature · 1 line
1.8.3.1
maintainer
#4 lore raw

Re: [PATCH linux dev-4.10 v2 2/5] drivers: hwmon: occ: Add new sensor versions and non-hwmon attributes

Quoted 27 lines · Eddie James
drivers/hwmon/occ/common.c +27 -0
+static ssize_t occ_show_status(struct device *dev,
+                              struct device_attribute *attr, char *buf)
+{
+       int rc;
+       int val;
+       struct occ *occ = dev_get_drvdata(dev);
+       struct occ_poll_response_header *header;
+       struct sensor_device_attribute *sattr = to_sensor_dev_attr(attr);
+
+       rc = occ_update_response(occ);
+       if (rc)
+               return rc;
+
+       header = (struct occ_poll_response_header *)occ->resp.data;
+
+       switch (sattr->index) {
+       case 0:
+               val = header->status & OCC_STAT_ACTIVE;
+               break;
+       case 1:
+               val = header->ext_status & OCC_EXT_STAT_DVFS_OT;
+               break;
+       case 2:
+               val = header->ext_status & OCC_EXT_STAT_DVFS_POWER;
+               break;
+       case 3:
+               val = header->ext_status & OCC_EXT_STAT_MEM_THROTTLE;

drivers/hwmon/occ/common.c int occ_update_response(struct occ *occ) · line 258

Quoted 10 lines
drivers/hwmon/occ/common.c +10 -0
+               break;
+       case 4:
+               val = header->ext_status & OCC_EXT_STAT_QUICK_DROP;
+               break;
+       case 5:
+               val = header->occ_state;
+               break;
+       }
+
+       return snprintf(buf, PAGE_SIZE - 1, "%d\n", val);

drivers/hwmon/occ/common.c: In function ‘occ_show_status’:
drivers/hwmon/occ/common.c:258:9: warning: ‘val’ may be used uninitialized in this function [-Wmaybe-uninitialized]

  return snprintf(buf, PAGE_SIZE - 1, "%d\n", val);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Please fix this.

#5 lore raw

PATCH v2 3/5 drivers: hwmon: occ: Add P8 OCC access

In reply to Eddie James

From: "Edward A. James" <[email protected]>

Access the P8 OCC over I2C bus.

---
 drivers/hwmon/Makefile     |   2 +-
 drivers/hwmon/occ/Kconfig  |  19 +++-
 drivers/hwmon/occ/Makefile |  12 +-
 drivers/hwmon/occ/p8_i2c.c | 270 +++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 300 insertions(+), 3 deletions(-)
 create mode 100644 drivers/hwmon/occ/p8_i2c.c
drivers/hwmon/Makefile +1 -1
index 73d79bc..4b7c15f 100644
@@ -47,7 +47,6 @@ obj-$(CONFIG_SENSORS_APPLESMC)	+= applesmc.o
 obj-$(CONFIG_SENSORS_ARM_SCPI)	+= scpi-hwmon.o
 obj-$(CONFIG_SENSORS_ASC7621)	+= asc7621.o
 obj-$(CONFIG_SENSORS_ASPEED)	+= aspeed-pwm-tacho.o
-obj-$(CONFIG_SENSORS_OCC_P9_SBE) += occ/
 obj-$(CONFIG_SENSORS_ATXP1)	+= atxp1.o
 obj-$(CONFIG_SENSORS_CORETEMP)	+= coretemp.o
 obj-$(CONFIG_SENSORS_DA9052_ADC)+= da9052-hwmon.o
@@ -172,6 +171,7 @@ obj-$(CONFIG_SENSORS_WM831X)	+= wm831x-hwmon.o
 obj-$(CONFIG_SENSORS_WM8350)	+= wm8350-hwmon.o
 obj-$(CONFIG_SENSORS_XGENE)	+= xgene-hwmon.o
 
+obj-$(CONFIG_SENSORS_OCC)	+= occ/
 obj-$(CONFIG_PMBUS)		+= pmbus/
 
 ccflags-$(CONFIG_HWMON_DEBUG_CHIP) := -DDEBUG
drivers/hwmon/occ/Kconfig +18 -1
index 8196b50..4024dc0 100644
@@ -2,9 +2,26 @@
 # On-Chip Controller configuration
 #
 
+config SENSORS_OCC
+	tristate "POWER On-Chip Controller"
+	help
+	  If you say yes here you get support for monitoring the IBM POWER
+	  processor sensors via the On-Chip Controller (OCC).
+
+	  This driver can also be built as a module. If so, the module will be
+	  called occ-hwmon.
+
+config SENSORS_OCC_P8_I2C
+	bool "POWER8 OCC via I2C"
+	depends on I2C && SENSORS_OCC
+	help
+	  If you say yes here you get support for monitoring the POWER8
+	  processor sensors via the OCC, from a service processor, over I2C
+	  bus.
+
 config SENSORS_OCC_P9_SBE
 	bool "POWER9 OCC via SBE"
-	depends on OCCFIFO
+	depends on OCCFIFO && SENSORS_OCC
 	help
 	  If you say yes here you get support for monitoring the POWER9
 	  processor sensors via the OCC, from a service processor, over SBE
drivers/hwmon/occ/Makefile +11 -1
index 6245c25..ab5c3e9 100644
@@ -1 +1,11 @@
-obj-y += p9_sbe.o common.o
+occ-hwmon-objs := common.o
+
+ifeq ($(CONFIG_SENSORS_OCC_P9_SBE), y)
+occ-hwmon-objs += p9_sbe.o
+endif
+
+ifeq ($(CONFIG_SENSORS_OCC_P8_I2C), y)
+occ-hwmon-objs += p8_i2c.o
+endif
+
+obj-$(CONFIG_SENSORS_OCC) += occ-hwmon.o
drivers/hwmon/occ/p8_i2c.c new file +270 -0

270 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#6 lore raw

PATCH v2 4/5 drivers: occ: hwmon and fsi probing fix

In reply to Eddie James

From: "Edward A. James" <[email protected]>

Probe the FSI-based OCC hwmon driver immediately instead of delaying. The probe will fail during FSI scan intentionally, since the OCC is not active when the system is first powering on. The driver can then be manually bound when the OCC becomes active.

---
 drivers/fsi/fsi-sbefifo.c  |  4 ++--
 drivers/fsi/occ.c          |  8 +++++++-
 drivers/hwmon/occ/p9_sbe.c | 38 ++++++++++----------------------------
 3 files changed, 19 insertions(+), 31 deletions(-)
drivers/fsi/fsi-sbefifo.c +2 -2
index fbc8dc5..bcf284c 100644
@@ -839,8 +839,6 @@ static int sbefifo_probe(struct device *dev)
 	setup_timer(&sbefifo->poll_timer, sbefifo_poll_timer,
 			(unsigned long)sbefifo);
 
-	list_add(&sbefifo->link, &sbefifo_fifos);
-
 	if (dev->of_node) {
 		/* create platform devs for dts child nodes (occ, etc) */
 		for_each_child_of_node(dev->of_node, np) {
@@ -852,6 +850,8 @@ static int sbefifo_probe(struct device *dev)
 					 "failed to create child node dev\n");
 		}
 	}
+
+	list_add(&sbefifo->link, &sbefifo_fifos);
 	
 	return misc_register(&sbefifo->mdev);
 }
drivers/fsi/occ.c +7 -1
index a1508f2..f43ae51 100644
@@ -635,6 +635,9 @@ struct occ_client *occ_drv_open(struct device *dev, unsigned long flags)
 {
 	struct occ *occ = dev_get_drvdata(dev);
 
+	if (!occ)
+		return NULL;
+
 	return occ_open_common(occ, flags);
 }
 EXPORT_SYMBOL_GPL(occ_drv_open);
@@ -688,7 +691,8 @@ static int occ_probe(struct platform_device *pdev)
 	mutex_init(&occ->occ_lock);
 	INIT_WORK(&occ->work, occ_worker);
 
-	platform_set_drvdata(pdev, occ);
+	/* ensure NULL before we probe children, so they don't hang FSI */
+	platform_set_drvdata(pdev, NULL);
 
 	if (dev->of_node) {
 		rc = of_property_read_u32(dev->of_node, "reg", &reg);
@@ -715,6 +719,8 @@ static int occ_probe(struct platform_device *pdev)
 	} else
 		occ->idx = ida_simple_get(&occ_ida, 1, INT_MAX, GFP_KERNEL);
 
+	platform_set_drvdata(pdev, occ);
+
 	snprintf(occ->name, sizeof(occ->name), "occ%d", occ->idx);
 	occ->mdev.fops = &occ_fops;
 	occ->mdev.minor = MISC_DYNAMIC_MINOR;
drivers/hwmon/occ/p9_sbe.c +10 -28
index fe435ef..c70858d 100644
@@ -16,11 +16,8 @@
 #include <linux/sched.h>
 #include <linux/workqueue.h>
 
-#define P9_SBE_OCC_SETUP_DELAY		5000
-
 struct p9_sbe_occ {
 	struct occ occ;
-	struct delayed_work setup;
 	struct device *sbe;
 };
 
@@ -93,12 +90,9 @@ static int p9_sbe_occ_send_cmd(struct occ *occ, u8 *cmd)
 	return rc;
 }
 
-static void p9_sbe_occ_setup(struct work_struct *work)
+static int p9_sbe_occ_setup(struct p9_sbe_occ *p9_sbe_occ)
 {
 	int rc;
-	struct delayed_work *dwork = to_delayed_work(work);
-	struct p9_sbe_occ *p9_sbe_occ = container_of(dwork, struct p9_sbe_occ,
-						     setup);
 	struct occ *occ = &p9_sbe_occ->occ;
 
 	/* no need to lock */
@@ -106,7 +100,7 @@ static void p9_sbe_occ_setup(struct work_struct *work)
 	if (rc < 0) {
 		dev_err(occ->bus_dev, "failed to get OCC poll response: %d\n",
 			rc);
-		return;
+		return rc;
 	}
 
 	occ_parse_poll_response(occ);
@@ -114,21 +108,24 @@ static void p9_sbe_occ_setup(struct work_struct *work)
 	rc = occ_setup_sensor_attrs(occ);
 	if (rc) {
 		dev_err(occ->bus_dev, "failed to setup p9 attrs: %d\n", rc);
-		return;
+		return rc;
 	}
 
 	occ->hwmon = devm_hwmon_device_register_with_groups(occ->bus_dev,
 							    "p9_occ", occ,
 							    occ->groups);
 	if (IS_ERR(occ->hwmon)) {
-		dev_err(occ->bus_dev, "failed to register hwmon device: %ld\n",
-			PTR_ERR(occ->hwmon));
-		return;
+		rc = PTR_ERR(occ->hwmon);
+		dev_err(occ->bus_dev, "failed to register hwmon device: %d\n",
+			rc);
+		return rc;
 	}
 
 	rc = occ_create_status_attrs(occ);
 	if (rc)
 		dev_err(occ->bus_dev, "failed to setup p9 status attrs: %d\n", rc);
+
+	return rc;
 }
 
 static int p9_sbe_occ_probe(struct platform_device *pdev)
@@ -148,24 +145,10 @@ static int p9_sbe_occ_probe(struct platform_device *pdev)
 	occ->poll_cmd_data = 0x20;
 	occ->send_cmd = p9_sbe_occ_send_cmd;
 	mutex_init(&occ->lock);
-	INIT_DELAYED_WORK(&p9_sbe_occ->setup, p9_sbe_occ_setup);
 
 	platform_set_drvdata(pdev, occ);
 
-	schedule_delayed_work(&p9_sbe_occ->setup,
-			      msecs_to_jiffies(P9_SBE_OCC_SETUP_DELAY));
-
-	return 0;
-}
-
-static int p9_sbe_occ_remove(struct platform_device *pdev)
-{
-	struct occ *occ = platform_get_drvdata(pdev);
-	struct p9_sbe_occ *p9_sbe_occ = to_p9_sbe_occ(occ);
-
-	cancel_delayed_work_sync(&p9_sbe_occ->setup);
-
-	return 0;
+	return p9_sbe_occ_setup(p9_sbe_occ);
 }
 
 static const struct of_device_id p9_sbe_occ_of_match[] = {
@@ -179,7 +162,6 @@ static int p9_sbe_occ_remove(struct platform_device *pdev)
 		.of_match_table	= p9_sbe_occ_of_match,
 	},
 	.probe	= p9_sbe_occ_probe,
-	.remove = p9_sbe_occ_remove,
 };
 
 module_platform_driver(p9_sbe_occ_driver);
Signature · 1 line
1.8.3.1
#7 lore raw

PATCH v2 5/5 aspeed: update power9 dts and defconfigs for OCC

In reply to Eddie James

From: "Edward A. James" <[email protected]>

---
 arch/arm/boot/dts/ibm-power9-cfam.dtsi | 9 +++++++++
 arch/arm/configs/aspeed_g4_defconfig   | 2 ++
 arch/arm/configs/aspeed_g5_defconfig   | 1 +
 3 files changed, 12 insertions(+)
arch/arm/boot/dts/ibm-power9-cfam.dtsi +9 -0
index 5beb978..f29c6e3 100644
@@ -13,6 +13,10 @@
 			occ@1 {
 				compatible = "ibm,p9-occ";
 				reg = <1>;
+
+				occ-hwmon@1 {
+					compatible = "ibm,p9-occ-hwmon";
+				};
 			};
 		};
 
@@ -37,6 +41,11 @@
 						compatible =
 							"ibm,p9-occ";
 						reg = <2>;
+
+						occ-hwmon@2 {
+							compatible =
+							    "ibm,p9-occ-hwmon";
+						};
 					};
 				};
 			};
arch/arm/configs/aspeed_g4_defconfig +2 -0
index 1dbea59..4766919 100644
@@ -141,6 +141,8 @@ CONFIG_SENSORS_IIO_HWMON=y
 CONFIG_SENSORS_MAX31785=y
 CONFIG_SENSORS_LM75=y
 CONFIG_SENSORS_NCT7904=y
+CONFIG_SENSORS_OCC=y
+CONFIG_SENSORS_OCC_P8_I2C=y
 CONFIG_PMBUS=y
 # CONFIG_SENSORS_PMBUS is not set
 CONFIG_SENSORS_ADM1275=y
arch/arm/configs/aspeed_g5_defconfig +1 -0
index 64e3aed..a8a34bc 100644
@@ -140,6 +140,7 @@ CONFIG_SENSORS_IIO_HWMON=y
 CONFIG_SENSORS_MAX31785=y
 CONFIG_SENSORS_LM75=y
 CONFIG_SENSORS_NCT7904=y
+CONFIG_SENSORS_OCC=y
 CONFIG_SENSORS_OCC_P9_SBE=y
 CONFIG_PMBUS=y
 CONFIG_SENSORS_ADM1275=y
Signature · 1 line
1.8.3.1
maintainer Applied
#8 lore raw
In reply to Eddie James

2017-06-10 3:31 GMT+09:30 Eddie James <[email protected]>:

Quoted 6 lines

From: "Edward A. James" <[email protected]>

This series refactors the OCC hwmon driver to make a number of changes and bug fixes. It also includes bug fixes for the FSI OCC driver. This includes 3 patches that were previously sent individually on the openbmc mailing list.

Quoted 6 lines

Edward A. James (5):
drivers: fsi: occ: Fix 1 byte response and rc for O_NONBLOCK
drivers: hwmon: occ: Add new sensor versions and non-hwmon attributes
drivers: hwmon: occ: Add P8 OCC access
drivers: occ: hwmon and fsi probing fix
aspeed: update power9 dts and defconfigs for OCC

I've applied this series. They look like there is some more work to be done, so please find some reviewers ASAP.

Cheers,

Joel

Quoted 23 lines
 arch/arm/boot/dts/ibm-power9-cfam.dtsi |   9 +
 arch/arm/configs/aspeed_g4_defconfig   |   2 +
 arch/arm/configs/aspeed_g5_defconfig   |   1 +
 drivers/fsi/fsi-sbefifo.c              |   4 +-
 drivers/fsi/occ.c                      |  22 +-
 drivers/hwmon/Makefile                 |   2 +-
 drivers/hwmon/occ/Kconfig              |  19 +-
 drivers/hwmon/occ/Makefile             |  12 +-
 drivers/hwmon/occ/common.c             | 991 ++++++++++++++++++++++++++++++++-
 drivers/hwmon/occ/common.h             |  17 +
 drivers/hwmon/occ/p8_i2c.c             | 270 +++++++++
 drivers/hwmon/occ/p9.c                 | 350 ------------
 drivers/hwmon/occ/p9.h                 |  17 -
 drivers/hwmon/occ/p9_sbe.c             |  60 +-
 14 files changed, 1354 insertions(+), 422 deletions(-)
 create mode 100644 drivers/hwmon/occ/p8_i2c.c
 delete mode 100644 drivers/hwmon/occ/p9.c
 delete mode 100644 drivers/hwmon/occ/p9.h

--
1.8.3.1