Skip to contentSkip to conversation

devicetree/bindings: Add binding for operator panel on FSP machines

PATCH Applied Suraj Jitindar Singh 3 participants 7 messages Jun 29, 2016 – Jun 30, 2016

Subsystems (8)
lore
Share & tools
lore

Suraj Jitindar Singh

author maintainer
#0 lore raw

PATCH v5 1/3 devicetree/bindings: Add binding for operator panel on FSP machines

Add a binding to Documentation/devicetree/bindings/powerpc/opal (oppanel-opal.txt) for the operator panel which is present on IBM Power Systems machines with FSPs.

---

Change Log:

V1 -> V2:
- Nothing
V2 -> V3:
- Change "IBM pseries machines" to "IBM Power Systems machines" in the commit message for improved clarity.
V3 -> V5:
- Nothing

---
 .../devicetree/bindings/powerpc/opal/oppanel-opal.txt      | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/powerpc/opal/oppanel-opal.txt
Documentation/devicetree/bindings/powerpc/opal/oppanel-opal.txt new file +14 -0
new file mode 100644
index 0000000..dffb791
@@ -0,0 +1,14 @@
+IBM OPAL Operator Panel Binding
+-------------------------------
+
+Required properties:
+- compatible : Should be "ibm,opal-oppanel".
+- #lines     : Number of lines on the operator panel e.g. <0x2>.
+- #length    : Number of characters per line of the operator panel e.g. <0x10>.
+
+Example:
+	oppanel {
+		compatible = "ibm,opal-oppanel";
+		#lines = <0x2>;
+		#length = <0x10>;
+	};
Signature · 6 lines
2.5.5

_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://lists.ozlabs.org/listinfo/linuxppc-dev
author maintainer
#1 lore raw

PATCH v5 2/3 powerpc/opal: Add inline function to get rc from an ASYNC_COMP opal_msg

An opal_msg of type OPAL_MSG_ASYNC_COMP contains the return code in the params[1] struct member. However this isn't intuitive or obvious when reading the code and requires that a user look at the skiboot documentation or opal-api.h to verify this.

Add an inline function to get the return code from an opal_msg and update call sites accordingly.

---

Change Log:

-> V4:
- Added Patch to Series
V4 -> V5:
- Changed from #define in opal-api.h to inline in opal.h

---
 arch/powerpc/include/asm/opal.h                | 8 ++++++++
 arch/powerpc/platforms/powernv/opal-sensor.c   | 2 +-
 arch/powerpc/platforms/powernv/opal-sysparam.c | 4 ++--
 drivers/i2c/busses/i2c-opal.c                  | 2 +-
 drivers/leds/leds-powernv.c                    | 2 +-
 drivers/mtd/devices/powernv_flash.c            | 2 +-
 drivers/rtc/rtc-opal.c                         | 4 ++--
 7 files changed, 16 insertions(+), 8 deletions(-)
arch/powerpc/include/asm/opal.h +8 -0
index 9d86c66..0d4e690 100644
@@ -276,6 +276,14 @@ extern int opal_error_code(int rc);
 
 ssize_t opal_msglog_copy(char *to, loff_t pos, size_t count);
 
+static inline int opal_get_async_rc(struct opal_msg msg)
+{
+	if (msg.msg_type != OPAL_MSG_ASYNC_COMP)
+		return OPAL_PARAMETER;
+	else
+		return be64_to_cpu(msg.params[1]);
+}
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* _ASM_POWERPC_OPAL_H */
arch/powerpc/platforms/powernv/opal-sensor.c +1 -1
index a06059d..308efd1 100644
@@ -55,7 +55,7 @@ int opal_get_sensor_data(u32 sensor_hndl, u32 *sensor_data)
 			goto out_token;
 		}
 
-		ret = opal_error_code(be64_to_cpu(msg.params[1]));
+		ret = opal_error_code(opal_get_async_rc(msg));
 		*sensor_data = be32_to_cpu(data);
 		break;
 
arch/powerpc/platforms/powernv/opal-sysparam.c +2 -2
index afe66c5..23fb664 100644
@@ -67,7 +67,7 @@ static ssize_t opal_get_sys_param(u32 param_id, u32 length, void *buffer)
 		goto out_token;
 	}
 
-	ret = opal_error_code(be64_to_cpu(msg.params[1]));
+	ret = opal_error_code(opal_get_async_rc(msg));
 
 out_token:
 	opal_async_release_token(token);
@@ -103,7 +103,7 @@ static int opal_set_sys_param(u32 param_id, u32 length, void *buffer)
 		goto out_token;
 	}
 
-	ret = opal_error_code(be64_to_cpu(msg.params[1]));
+	ret = opal_error_code(opal_get_async_rc(msg));
 
 out_token:
 	opal_async_release_token(token);
drivers/i2c/busses/i2c-opal.c +1 -1
index 75dd6d0..11e2a1f 100644
@@ -71,7 +71,7 @@ static int i2c_opal_send_request(u32 bus_id, struct opal_i2c_request *req)
 	if (rc)
 		goto exit;
 
-	rc = be64_to_cpu(msg.params[1]);
+	rc = opal_get_async_rc(msg);
 	if (rc != OPAL_SUCCESS) {
 		rc = i2c_opal_translate_error(rc);
 		goto exit;
drivers/leds/leds-powernv.c +1 -1
index dfb8bd3..b2a98c7 100644
@@ -118,7 +118,7 @@ static int powernv_led_set(struct powernv_led_data *powernv_led,
 		goto out_token;
 	}
 
-	rc = be64_to_cpu(msg.params[1]);
+	rc = opal_get_async_rc(msg);
 	if (rc != OPAL_SUCCESS)
 		dev_err(dev, "%s : OAPL async call returned failed [rc=%d]\n",
 			__func__, rc);
drivers/mtd/devices/powernv_flash.c +1 -1
index d5b870b..f5396f2 100644
@@ -95,7 +95,7 @@ static int powernv_flash_async_op(struct mtd_info *mtd, enum flash_op op,
 		return -EIO;
 	}
 
-	rc = be64_to_cpu(msg.params[1]);
+	rc = opal_get_async_rc(msg);
 	if (rc == OPAL_SUCCESS) {
 		rc = 0;
 		if (retlen)
drivers/rtc/rtc-opal.c +2 -2
index 9c18d6f..ea20f62 100644
@@ -134,7 +134,7 @@ static int opal_get_tpo_time(struct device *dev, struct rtc_wkalrm *alarm)
 		goto exit;
 	}
 
-	rc = be64_to_cpu(msg.params[1]);
+	rc = opal_get_async_rc(msg);
 	if (rc != OPAL_SUCCESS) {
 		rc = -EIO;
 		goto exit;
@@ -181,7 +181,7 @@ static int opal_set_tpo_time(struct device *dev, struct rtc_wkalrm *alarm)
 		goto exit;
 	}
 
-	rc = be64_to_cpu(msg.params[1]);
+	rc = opal_get_async_rc(msg);
 	if (rc != OPAL_SUCCESS)
 		rc = -EIO;
 
Signature · 6 lines
2.5.5

_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://lists.ozlabs.org/listinfo/linuxppc-dev
Acked-by on v5 2/3
#2 lore raw

Re: [PATCH V5 2/3] powerpc/opal: Add inline function to get rc from an ASYNC_COMP opal_msg

arch/powerpc/include/asm/opal.h extern int opal_error_code(int rc); · line 282

Quoted 10 lines · Suraj Jitindar Singh
arch/powerpc/include/asm/opal.h +4 -0
@@ -276,6 +276,14 @@ extern int opal_error_code(int rc);
 
 ssize_t opal_msglog_copy(char *to, loff_t pos, size_t count);
 
+static inline int opal_get_async_rc(struct opal_msg msg)
+{
+	if (msg.msg_type != OPAL_MSG_ASYNC_COMP)
+		return OPAL_PARAMETER;

Should instead be WARN_ON or BUG_ON ? Is there *ever* a situation where calling opal_get_async_rc on a non-OPAL_MSG_ASYNC_COMP is a not both a dumb idea and a bug?

otherwise (including if above change is made)

Signature · 7 lines
Stewart Smith
OPAL Architect, IBM.

_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://lists.ozlabs.org/listinfo/linuxppc-dev
reviewer Applied
#3 lore raw

Re: [V5, 2/3] powerpc/opal: Add inline function to get rc from an ASYNC_COMP opal_msg

In reply to Suraj Jitindar Singh
Quoted 9 lines · Suraj Jitindar Singh

An opal_msg of type OPAL_MSG_ASYNC_COMP contains the return code in the params[1] struct member. However this isn't intuitive or obvious when reading the code and requires that a user look at the skiboot documentation or opal-api.h to verify this.

Add an inline function to get the return code from an opal_msg and update call sites accordingly.

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/d0226d315dba5e401a124b394a

cheers

author maintainer
#4 lore raw

PATCH v5 3/3 powerpc/drivers: Add driver for operator panel on FSP machines

In reply to Suraj Jitindar Singh

Implement new character device driver to allow access from user space to the operator panel display present on IBM Power Systems machines with FSPs.

This will allow status information to be presented on the display which is visible to a user.

The driver implements a character buffer which a user can read/write by accessing the device (/dev/op_panel). This buffer is then displayed on the operator panel display. Any attempt to write past the last character position will have no effect and attempts to write more characters than the size of the display will be truncated. The device may only be accessed by a single process at a time.

---

Change Log:

V1 -> V2:
- Replace "IBM pSeries machines" with "IBM Power Systems machines with FSPs" for improved clarity
- Basic wording/grammar fixes
V2 -> V3:
- Nothing
V3 -> V4:
- Various style changes and non-functional code updates
V4 -> V5:
- Nothing

---
 MAINTAINERS                                    |   6 +
 arch/powerpc/configs/powernv_defconfig         |   1 +
 arch/powerpc/include/asm/opal.h                |   2 +
 arch/powerpc/platforms/powernv/opal-wrappers.S |   1 +
 arch/powerpc/platforms/powernv/opal.c          |   5 +
 drivers/char/Kconfig                           |  14 ++
 drivers/char/Makefile                          |   1 +
 drivers/char/powernv-op-panel.c                | 223 +++++++++++++++++++++++++
 8 files changed, 253 insertions(+)
 create mode 100644 drivers/char/powernv-op-panel.c
MAINTAINERS +6 -0
index 952fd2a..42ace38 100644
@@ -9094,6 +9094,12 @@ F:	drivers/firmware/psci.c
 F:	include/linux/psci.h
 F:	include/uapi/linux/psci.h
 
+POWERNV OPERATOR PANEL LCD DISPLAY DRIVER
+M:	Suraj Jitindar Singh <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	drivers/char/powernv-op-panel.c
+
 PNP SUPPORT
 M:	"Rafael J. Wysocki" <[email protected]>
 S:	Maintained
arch/powerpc/configs/powernv_defconfig +1 -0
index 0450310..959d32b 100644
@@ -181,6 +181,7 @@ CONFIG_SERIAL_8250=y
 CONFIG_SERIAL_8250_CONSOLE=y
 CONFIG_SERIAL_JSM=m
 CONFIG_VIRTIO_CONSOLE=m
+CONFIG_POWERNV_OP_PANEL=m
 CONFIG_IPMI_HANDLER=y
 CONFIG_IPMI_DEVICE_INTERFACE=y
 CONFIG_IPMI_POWERNV=y
arch/powerpc/include/asm/opal.h +2 -0
index 0d4e690..ea9e7f4 100644
@@ -178,6 +178,8 @@ int64_t opal_dump_ack(uint32_t dump_id);
 int64_t opal_dump_resend_notification(void);
 
 int64_t opal_get_msg(uint64_t buffer, uint64_t size);
+int64_t opal_write_oppanel_async(uint64_t token, oppanel_line_t *lines,
+					uint64_t num_lines);
 int64_t opal_check_completion(uint64_t buffer, uint64_t size, uint64_t token);
 int64_t opal_sync_host_reboot(void);
 int64_t opal_get_param(uint64_t token, uint32_t param_id, uint64_t buffer,
arch/powerpc/platforms/powernv/opal-wrappers.S +1 -0
index e45b88a..ddba8bf 100644
@@ -278,6 +278,7 @@ OPAL_CALL(opal_dump_info2,			OPAL_DUMP_INFO2);
 OPAL_CALL(opal_dump_read,			OPAL_DUMP_READ);
 OPAL_CALL(opal_dump_ack,			OPAL_DUMP_ACK);
 OPAL_CALL(opal_get_msg,				OPAL_GET_MSG);
+OPAL_CALL(opal_write_oppanel_async,		OPAL_WRITE_OPPANEL_ASYNC);
 OPAL_CALL(opal_check_completion,		OPAL_CHECK_ASYNC_COMPLETION);
 OPAL_CALL(opal_dump_resend_notification,	OPAL_DUMP_RESEND);
 OPAL_CALL(opal_sync_host_reboot,		OPAL_SYNC_HOST_REBOOT);
arch/powerpc/platforms/powernv/opal.c +5 -0
index 0256d07..228751a 100644
@@ -751,6 +751,9 @@ static int __init opal_init(void)
 	opal_pdev_init(opal_node, "ibm,opal-flash");
 	opal_pdev_init(opal_node, "ibm,opal-prd");
 
+	/* Initialise platform device: oppanel interface */
+	opal_pdev_init(opal_node, "ibm,opal-oppanel");
+
 	/* Initialise OPAL kmsg dumper for flushing console on panic */
 	opal_kmsg_init();
 
@@ -885,3 +888,5 @@ EXPORT_SYMBOL_GPL(opal_i2c_request);
 /* Export these symbols for PowerNV LED class driver */
 EXPORT_SYMBOL_GPL(opal_leds_get_ind);
 EXPORT_SYMBOL_GPL(opal_leds_set_ind);
+/* Export this symbol for PowerNV Operator Panel class driver */
+EXPORT_SYMBOL_GPL(opal_write_oppanel_async);
drivers/char/Kconfig +14 -0
index 601f64f..fdb8f3e 100644
@@ -178,6 +178,20 @@ config IBM_BSR
 	  of threads across a large system which avoids bouncing a cacheline
 	  between several cores on a system
 
+config POWERNV_OP_PANEL
+	tristate "IBM POWERNV Operator Panel Display support"
+	depends on PPC_POWERNV
+	default m
+	help
+	  If you say Y here, a special character device node, /dev/op_panel,
+	  will be created which exposes the operator panel display on IBM
+	  Power Systems machines with FSPs.
+
+	  If you don't require access to the operator panel display from user
+	  space, say N.
+
+	  If unsure, say M here to build it as a module called powernv-op-panel.
+
 source "drivers/char/ipmi/Kconfig"
 
 config DS1620
drivers/char/Makefile +1 -0
index d8a7579..55d16bf 100644
@@ -60,3 +60,4 @@ js-rtc-y = rtc.o
 
 obj-$(CONFIG_TILE_SROM)		+= tile-srom.o
 obj-$(CONFIG_XILLYBUS)		+= xillybus/
+obj-$(CONFIG_POWERNV_OP_PANEL)	+= powernv-op-panel.o
drivers/char/powernv-op-panel.c new file +223 -0

223 lines not on this page · raw message

Signature · 6 lines
2.5.5

_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://lists.ozlabs.org/listinfo/linuxppc-dev
reviewer Applied
#5 lore raw

Re: [V5, 3/3] powerpc/drivers: Add driver for operator panel on FSP machines

Quoted 14 lines · Suraj Jitindar Singh

Implement new character device driver to allow access from user space to the operator panel display present on IBM Power Systems machines with FSPs.

This will allow status information to be presented on the display which is visible to a user.

The driver implements a character buffer which a user can read/write by accessing the device (/dev/op_panel). This buffer is then displayed on the operator panel display. Any attempt to write past the last character position will have no effect and attempts to write more characters than the size of the display will be truncated. The device may only be accessed by a single process at a time.

Quoted 2 lines

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/43a1dd9b5fc64184e578ac1570

cheers

reviewer Applied
#6 lore raw
In reply to Suraj Jitindar Singh
Quoted 7 lines · Suraj Jitindar Singh

Add a binding to Documentation/devicetree/bindings/powerpc/opal (oppanel-opal.txt) for the operator panel which is present on IBM Power Systems machines with FSPs.

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/1ae88fd54c3ac31f68f91e37f7

cheers
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html