devicetree/bindings: Add binding for operator panel on FSP machines
Subsystems (8)
Suraj Jitindar Singh
maintainerPATCH v4 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 -> V4:
- 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
@@ -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 -- 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
Suraj Jitindar Singh
maintainerPATCH v4 2/3 powerpc/opal: Add #define 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 a #define to get the return code from an opal_msg and update call sites accordingly.
---
Change Log:
-> V4:
- Added Patch to Series
--- arch/powerpc/include/asm/opal-api.h | 4 ++++ 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, 12 insertions(+), 8 deletions(-)
arch/powerpc/include/asm/opal-api.h +4 -0
@@ -387,6 +387,10 @@ struct opal_msg {__be64 params[8 ]; }; +#define GET_OPAL_MSG_ASYNC_COMP_RC (msg) (msg.msg_type == OPAL_MSG_ASYNC_COMP ? \ + be64_to_cpu(msg.params[1]) : \ + OPAL_PARAMETER) +/* System parameter permission */ enum OpalSysparamPerm {OPAL_SYSPARAM_READ =0x1 ,
arch/powerpc/platforms/powernv/opal-sensor.c +1 -1
@@ -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 (GET_OPAL_MSG_ASYNC_COMP_RC (msg)); *sensor_data =be32_to_cpu (data);break ;
arch/powerpc/platforms/powernv/opal-sysparam.c +2 -2
@@ -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 (GET_OPAL_MSG_ASYNC_COMP_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 (GET_OPAL_MSG_ASYNC_COMP_RC (msg)); out_token:opal_async_release_token (token);
drivers/i2c/busses/i2c-opal.c +1 -1
@@ -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 =GET_OPAL_MSG_ASYNC_COMP_RC (msg);if (rc !=OPAL_SUCCESS ) { rc =i2c_opal_translate_error (rc); goto exit;
drivers/leds/leds-powernv.c +1 -1
@@ -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 =GET_OPAL_MSG_ASYNC_COMP_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
@@ -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 =GET_OPAL_MSG_ASYNC_COMP_RC (msg);if (rc ==OPAL_SUCCESS ) { rc =0 ;if (retlen)
drivers/rtc/rtc-opal.c +2 -2
@@ -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 =GET_OPAL_MSG_ASYNC_COMP_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 =GET_OPAL_MSG_ASYNC_COMP_RC (msg);if (rc !=OPAL_SUCCESS ) rc = -EIO ;
Signature · 6 lines
2.5.5 -- 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
Michael Ellerman
reviewerRe: [V4, 2/3] powerpc/opal: Add #define to get rc from an ASYNC_COMP opal_msg
Quoted 7 lines · Suraj Jitindar Singh
An
opal_msgof typeOPAL_MSG_ASYNC_COMPcontains 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 oropal-api.hto verify this.Add a #define to get the return code from an
opal_msgand update call sites accordingly.
Thanks for cleaning this up.
Two gripes though :)
Quoted 1 line
arch/powerpc/include/asm/opal-api.h | 4 ++++
opal-api.h is supposed to be a subset of the skiboot version.
So something like this should go in the kernel's opal.h, which has all the kernel prototypes etc. which aren't part of the OPAL API. I think this routine should fall under that.
arch/powerpc/include/asm/opal-api.h struct opal_msg { · line 393
Quoted 12 lines
arch/powerpc/include/asm/opal-api.h +4
-0@@ -387,6 +387,10 @@ struct opal_msg {__be64 params[8 ]; }; +#define GET_OPAL_MSG_ASYNC_COMP_RC (msg) (msg.msg_type == OPAL_MSG_ASYNC_COMP ? \ + be64_to_cpu(msg.params[1]) : \ + OPAL_PARAMETER) +
You forgot the 7th commandment!
"Never use a #define when a static inline would work"
:)
A few reasons:
- it's less shouty.
- you get type checking.
- you don't have to wrap lines with \
etc.
cheers
Suraj Jitindar Singh
maintainerRe: [V4, 2/3] powerpc/opal: Add #define to get rc from an ASYNC_COMP opal_msg
Quoted 13 lines · On Tue, 28 Jun 2016 21:58:28 +1000 (AEST) Michael Ellerman…
Quoted 7 lines · Suraj Jitindar Singh
An
opal_msgof typeOPAL_MSG_ASYNC_COMPcontains 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 oropal-api.hto verify this.Add a #define to get the return code from an
opal_msgand update call sites accordingly.Thanks for cleaning this up.
Two gripes though :)
Quoted 7 lines
Quoted 1 line
arch/powerpc/include/asm/opal-api.h | 4 ++++
opal-api.his supposed to be a subset of the skiboot version.So something like this should go in the kernel's
opal.h, which has all the kernel prototypes etc. which aren't part of the OPAL API. I think this routine should fall under that.
Will move this
Quoted 22 lines
Quoted 6 lines
(quoted diff) +0
-0
b/arch/powerpc/include/asm/opal-api.hindex 9bb8ddf..7433cf0 100644arch/powerpc/include/asm/opal-api.h struct opal_msg { · line 395
Quoted 9 lines
arch/powerpc/include/asm/opal-api.h +4
-0@@ -387,6 +387,10 @@ struct opal_msg {__be64 params[8 ]; }; +#define GET_OPAL_MSG_ASYNC_COMP_RC (msg) (msg.msg_type ==OPAL_MSG_ASYNC_COMP ? \ +be64_to_cpu (msg.params[1 ]) : \ + OPAL_PARAMETER) +You forgot the 7th commandment!
"Never use a #define when a static inline would work"
:)
Quoted 7 lines
A few reasons:
- it's less shouty.
- you get type checking.
- you don't have to wrap lines with \
etc.cheers
Thanks, will change this
--
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
Suraj Jitindar Singh
maintainerPATCH v4 3/3 powerpc/drivers: Add driver for operator panel on FSP machines
In reply to Suraj Jitindar SinghImplement 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
--- 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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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 · 1 line
2.5.5