mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] ipmi: ssif_bmc: Add GPIO-based alert mechanism
@ 2024-10-19 15:38 Potin Lai
  2024-10-19 15:38 ` [PATCH 1/2] bindings: ipmi: Add alert GPIO enhancement for SSIF BMC driver Potin Lai
  2024-10-19 15:38 ` [PATCH 2/2] ipmi: ssif_bmc: add GPIO-based alert mechanism Potin Lai
  0 siblings, 2 replies; 4+ messages in thread
From: Potin Lai @ 2024-10-19 15:38 UTC (permalink / raw)
  To: Corey Minyard, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Quan Nguyen, Patrick Williams
  Cc: openipmi-developer, devicetree, linux-kernel, Cosmo Chou,
	Potin Lai, Potin Lai, Cosmo Chou

This patch series introduces a GPIO-based alert mechanism in the SSIF
BMC driver. It allows the BMC to notify the host when a response is
ready, improving communication efficiency between the BMC and host.

Signed-off-by: Potin Lai <potin.lai.pt@gmail.com>
---
Cosmo Chou (1):
      ipmi: ssif_bmc: add GPIO-based alert mechanism

Potin Lai (1):
      bindings: ipmi: Add alert GPIO enhancement for SSIF BMC driver

 Documentation/devicetree/bindings/ipmi/ssif-bmc.yaml |  7 +++++++
 drivers/char/ipmi/ssif_bmc.c                         | 15 +++++++++++++++
 2 files changed, 22 insertions(+)
---
base-commit: 8e929cb546ee42c9a61d24fae60605e9e3192354
change-id: 20241019-ssif-alert-gpios-1b9960f991b1

Best regards,
-- 
Potin Lai <potin.lai.pt@gmail.com>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] bindings: ipmi: Add alert GPIO enhancement for SSIF BMC driver
  2024-10-19 15:38 [PATCH 0/2] ipmi: ssif_bmc: Add GPIO-based alert mechanism Potin Lai
@ 2024-10-19 15:38 ` Potin Lai
  2024-10-19 16:22   ` Rob Herring (Arm)
  2024-10-19 15:38 ` [PATCH 2/2] ipmi: ssif_bmc: add GPIO-based alert mechanism Potin Lai
  1 sibling, 1 reply; 4+ messages in thread
From: Potin Lai @ 2024-10-19 15:38 UTC (permalink / raw)
  To: Corey Minyard, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Quan Nguyen, Patrick Williams
  Cc: openipmi-developer, devicetree, linux-kernel, Cosmo Chou,
	Potin Lai, Potin Lai

Introduce the `alert-gpios` property to define an alert pin, enabling
the BMC to notify the host when a response is available.

Signed-off-by: Potin Lai <potin.lai.pt@gmail.com>
---
 Documentation/devicetree/bindings/ipmi/ssif-bmc.yaml | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/Documentation/devicetree/bindings/ipmi/ssif-bmc.yaml b/Documentation/devicetree/bindings/ipmi/ssif-bmc.yaml
index 02b662d780bb..104283fa851a 100644
--- a/Documentation/devicetree/bindings/ipmi/ssif-bmc.yaml
+++ b/Documentation/devicetree/bindings/ipmi/ssif-bmc.yaml
@@ -19,6 +19,12 @@ properties:
   reg:
     maxItems: 1
 
+  alert-gpios:
+    description:
+      GPIO pin designated for SSIF alert, used by the BMC to notify the
+      host when a response is available.
+    maxItems: 1
+
 required:
   - compatible
   - reg
@@ -34,5 +40,6 @@ examples:
         ssif-bmc@10 {
             compatible = "ssif-bmc";
             reg = <0x10>;
+            alert-gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
         };
     };

-- 
2.31.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/2] ipmi: ssif_bmc: add GPIO-based alert mechanism
  2024-10-19 15:38 [PATCH 0/2] ipmi: ssif_bmc: Add GPIO-based alert mechanism Potin Lai
  2024-10-19 15:38 ` [PATCH 1/2] bindings: ipmi: Add alert GPIO enhancement for SSIF BMC driver Potin Lai
@ 2024-10-19 15:38 ` Potin Lai
  1 sibling, 0 replies; 4+ messages in thread
From: Potin Lai @ 2024-10-19 15:38 UTC (permalink / raw)
  To: Corey Minyard, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Quan Nguyen, Patrick Williams
  Cc: openipmi-developer, devicetree, linux-kernel, Cosmo Chou,
	Potin Lai, Potin Lai, Cosmo Chou

From: Cosmo Chou <chou.cosmo@gmail.com>

Implement GPIO-based alert mechanism in the SSIF BMC driver to notify
the host when a response is ready.

This improves host-BMC communication efficiency by providing immediate
notification, potentially reducing host polling overhead.

Signed-off-by: Cosmo Chou <chou.cosmo@gmail.com>
---
 drivers/char/ipmi/ssif_bmc.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/char/ipmi/ssif_bmc.c b/drivers/char/ipmi/ssif_bmc.c
index a14fafc583d4..73be166b0042 100644
--- a/drivers/char/ipmi/ssif_bmc.c
+++ b/drivers/char/ipmi/ssif_bmc.c
@@ -17,6 +17,7 @@
 #include <linux/spinlock.h>
 #include <linux/timer.h>
 #include <linux/jiffies.h>
+#include <linux/gpio/consumer.h>
 #include <linux/ipmi_ssif_bmc.h>
 
 #define DEVICE_NAME                             "ipmi-ssif-host"
@@ -102,6 +103,7 @@ struct ssif_bmc_ctx {
 	struct ssif_part_buffer part_buf;
 	struct ipmi_ssif_msg    response;
 	struct ipmi_ssif_msg    request;
+	struct gpio_desc        *alert;
 };
 
 static inline struct ssif_bmc_ctx *to_ssif_bmc(struct file *file)
@@ -222,6 +224,9 @@ static ssize_t ssif_bmc_write(struct file *file, const char __user *buf, size_t
 
 	/* Clean old request buffer */
 	memset(&ssif_bmc->request, 0, sizeof(struct ipmi_ssif_msg));
+
+	if (!IS_ERR(ssif_bmc->alert))
+		gpiod_set_value(ssif_bmc->alert, 1);
 exit:
 	spin_unlock_irqrestore(&ssif_bmc->lock, flags);
 
@@ -584,6 +589,9 @@ static void process_smbus_cmd(struct ssif_bmc_ctx *ssif_bmc, u8 *val)
 	memset(&ssif_bmc->part_buf.payload[0], 0, MAX_PAYLOAD_PER_TRANSACTION);
 
 	if (*val == SSIF_IPMI_SINGLEPART_WRITE || *val == SSIF_IPMI_MULTIPART_WRITE_START) {
+		if (!IS_ERR(ssif_bmc->alert))
+			gpiod_set_value(ssif_bmc->alert, 0);
+
 		/*
 		 * The response maybe not come in-time, causing host SSIF driver
 		 * to timeout and resend a new request. In such case check for
@@ -640,6 +648,8 @@ static void on_read_requested_event(struct ssif_bmc_ctx *ssif_bmc, u8 *val)
 	calculate_response_part_pec(&ssif_bmc->part_buf);
 	ssif_bmc->part_buf.index = 0;
 	*val = ssif_bmc->part_buf.length;
+	if (!IS_ERR(ssif_bmc->alert))
+		gpiod_set_value(ssif_bmc->alert, 0);
 }
 
 static void on_read_processed_event(struct ssif_bmc_ctx *ssif_bmc, u8 *val)
@@ -808,6 +818,11 @@ static int ssif_bmc_probe(struct i2c_client *client)
 	if (!ssif_bmc)
 		return -ENOMEM;
 
+	/* Request GPIO for alerting the host that response is ready */
+	ssif_bmc->alert = devm_gpiod_get(&client->dev, "alert", GPIOD_ASIS);
+	if (!IS_ERR(ssif_bmc->alert))
+		gpiod_direction_output(ssif_bmc->alert, 0);
+
 	spin_lock_init(&ssif_bmc->lock);
 
 	init_waitqueue_head(&ssif_bmc->wait_queue);

-- 
2.31.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] bindings: ipmi: Add alert GPIO enhancement for SSIF BMC driver
  2024-10-19 15:38 ` [PATCH 1/2] bindings: ipmi: Add alert GPIO enhancement for SSIF BMC driver Potin Lai
@ 2024-10-19 16:22   ` Rob Herring (Arm)
  0 siblings, 0 replies; 4+ messages in thread
From: Rob Herring (Arm) @ 2024-10-19 16:22 UTC (permalink / raw)
  To: Potin Lai
  Cc: Potin Lai, Quan Nguyen, devicetree, Cosmo Chou, Corey Minyard,
	Krzysztof Kozlowski, Conor Dooley, openipmi-developer,
	linux-kernel, Patrick Williams


On Sat, 19 Oct 2024 23:38:04 +0800, Potin Lai wrote:
> Introduce the `alert-gpios` property to define an alert pin, enabling
> the BMC to notify the host when a response is available.
> 
> Signed-off-by: Potin Lai <potin.lai.pt@gmail.com>
> ---
>  Documentation/devicetree/bindings/ipmi/ssif-bmc.yaml | 7 +++++++
>  1 file changed, 7 insertions(+)
> 

My bot found errors running 'make dt_binding_check' on your patch:

yamllint warnings/errors:

dtschema/dtc warnings/errors:
Error: Documentation/devicetree/bindings/ipmi/ssif-bmc.example.dts:25.40-41 syntax error
FATAL ERROR: Unable to parse input tree
make[2]: *** [scripts/Makefile.dtbs:129: Documentation/devicetree/bindings/ipmi/ssif-bmc.example.dtb] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [/builds/robherring/dt-review-ci/linux/Makefile:1442: dt_binding_check] Error 2
make: *** [Makefile:224: __sub-make] Error 2

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20241019-ssif-alert-gpios-v1-1-483eee5f99d3@gmail.com

The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-10-19 16:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-19 15:38 [PATCH 0/2] ipmi: ssif_bmc: Add GPIO-based alert mechanism Potin Lai
2024-10-19 15:38 ` [PATCH 1/2] bindings: ipmi: Add alert GPIO enhancement for SSIF BMC driver Potin Lai
2024-10-19 16:22   ` Rob Herring (Arm)
2024-10-19 15:38 ` [PATCH 2/2] ipmi: ssif_bmc: add GPIO-based alert mechanism Potin Lai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®