All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/3] Fixes & a new supplementary feature to SPRD mailbox driver
@ 2021-02-13 12:21 Orson Zhai
  2021-02-13 12:21 ` [PATCH v2 1/3] mailbox: sprd: Introduce refcnt when clients requests/free channels Orson Zhai
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Orson Zhai @ 2021-02-13 12:21 UTC (permalink / raw)
  To: Rob Herring, Baolin Wang, Chunyan Zhang, Jassi Brar
  Cc: Orson Zhai, Mark Brown, devicetree, linux-kernel, Haidong Yao

Fix a real problem fot SPRD's mailbox driver in patch 1/3.
Add supplementary inbox support for newly added sc9863a in patch 3/3 and
change dt bindings yaml accordingly in patch 2/3.

Changes Log:
V2:
- Change patches order. (Yaml go to the head of dirver)
- Remove unnecessary initializing refcnt to zero. 
- Add fix of possible crash caused by NULL of chan->cl. (Actually move from
  changes to sprd-mailbox.c of patch v1)
- Remove unnecessary "inline" for do_inbox_isr().
- Fix yaml errors from Rob's robot checking.
- Add sc9863a compatible string for real supplementary inbox usage. (sc9860
  is not supported by supp-inbox)
- Add more details to supp-inbox in commit messages.

Orson Zhai (3):
  mailbox: sprd: Introduce refcnt when clients requests/free channels
  dt-bindings: mailbox: Add interrupt-names to SPRD mailbox
  mailbox: sprd: Add supplementary inbox support

 .../bindings/mailbox/sprd-mailbox.yaml        |  18 ++-
 drivers/mailbox/sprd-mailbox.c                | 135 +++++++++++++-----
 2 files changed, 117 insertions(+), 36 deletions(-)

-- 
2.17.1


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

* [PATCH v2 1/3] mailbox: sprd: Introduce refcnt when clients requests/free channels
  2021-02-13 12:21 [PATCH v2 0/3] Fixes & a new supplementary feature to SPRD mailbox driver Orson Zhai
@ 2021-02-13 12:21 ` Orson Zhai
  2021-03-07 15:23   ` Baolin Wang
  2021-02-13 12:21 ` [PATCH v2 2/3] dt-bindings: mailbox: Add interrupt-names to SPRD mailbox Orson Zhai
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Orson Zhai @ 2021-02-13 12:21 UTC (permalink / raw)
  To: Rob Herring, Baolin Wang, Chunyan Zhang, Jassi Brar
  Cc: Orson Zhai, Mark Brown, devicetree, linux-kernel, Haidong Yao,
	Orson Zhai

From: Orson Zhai <orson.zhai@unisoc.com>

Unisoc mailbox has no way to be enabled/disabled for any single channel.
They can only be set to startup or shutdown as a whole device at same time.

Add a variable to count references to avoid mailbox FIFO being reset
unexpectedly when clients are requesting or freeing channels.

Also add a lock to dismiss possible conflicts from register r/w in
different startup or shutdown threads. And fix the crash problem when early
interrupts come from channel which has not been requested by client yet.

Fixes: ca27fc26cd22 ("mailbox: sprd: Add Spreadtrum mailbox driver")
Signed-off-by: Orson Zhai <orson.zhai@unisoc.com>
---
 drivers/mailbox/sprd-mailbox.c | 43 +++++++++++++++++++++++-----------
 1 file changed, 29 insertions(+), 14 deletions(-)

diff --git a/drivers/mailbox/sprd-mailbox.c b/drivers/mailbox/sprd-mailbox.c
index f6fab24ae8a9..920de7b9dce1 100644
--- a/drivers/mailbox/sprd-mailbox.c
+++ b/drivers/mailbox/sprd-mailbox.c
@@ -60,6 +60,8 @@ struct sprd_mbox_priv {
 	struct clk		*clk;
 	u32			outbox_fifo_depth;
 
+	struct mutex		lock;
+	u32			refcnt;
 	struct mbox_chan	chan[SPRD_MBOX_CHAN_MAX];
 };
 
@@ -115,7 +117,11 @@ static irqreturn_t sprd_mbox_outbox_isr(int irq, void *data)
 		id = readl(priv->outbox_base + SPRD_MBOX_ID);
 
 		chan = &priv->chan[id];
-		mbox_chan_received_data(chan, (void *)msg);
+		if (chan->cl)
+			mbox_chan_received_data(chan, (void *)msg);
+		else
+			dev_warn_ratelimited(priv->dev,
+				    "message's been dropped at ch[%d]\n", id);
 
 		/* Trigger to update outbox FIFO pointer */
 		writel(0x1, priv->outbox_base + SPRD_MBOX_TRIGGER);
@@ -215,18 +221,22 @@ static int sprd_mbox_startup(struct mbox_chan *chan)
 	struct sprd_mbox_priv *priv = to_sprd_mbox_priv(chan->mbox);
 	u32 val;
 
-	/* Select outbox FIFO mode and reset the outbox FIFO status */
-	writel(0x0, priv->outbox_base + SPRD_MBOX_FIFO_RST);
+	mutex_lock(&priv->lock);
+	if (priv->refcnt++ == 0) {
+		/* Select outbox FIFO mode and reset the outbox FIFO status */
+		writel(0x0, priv->outbox_base + SPRD_MBOX_FIFO_RST);
 
-	/* Enable inbox FIFO overflow and delivery interrupt */
-	val = readl(priv->inbox_base + SPRD_MBOX_IRQ_MSK);
-	val &= ~(SPRD_INBOX_FIFO_OVERFLOW_IRQ | SPRD_INBOX_FIFO_DELIVER_IRQ);
-	writel(val, priv->inbox_base + SPRD_MBOX_IRQ_MSK);
+		/* Enable inbox FIFO overflow and delivery interrupt */
+		val = readl(priv->inbox_base + SPRD_MBOX_IRQ_MSK);
+		val &= ~(SPRD_INBOX_FIFO_OVERFLOW_IRQ | SPRD_INBOX_FIFO_DELIVER_IRQ);
+		writel(val, priv->inbox_base + SPRD_MBOX_IRQ_MSK);
 
-	/* Enable outbox FIFO not empty interrupt */
-	val = readl(priv->outbox_base + SPRD_MBOX_IRQ_MSK);
-	val &= ~SPRD_OUTBOX_FIFO_NOT_EMPTY_IRQ;
-	writel(val, priv->outbox_base + SPRD_MBOX_IRQ_MSK);
+		/* Enable outbox FIFO not empty interrupt */
+		val = readl(priv->outbox_base + SPRD_MBOX_IRQ_MSK);
+		val &= ~SPRD_OUTBOX_FIFO_NOT_EMPTY_IRQ;
+		writel(val, priv->outbox_base + SPRD_MBOX_IRQ_MSK);
+	}
+	mutex_unlock(&priv->lock);
 
 	return 0;
 }
@@ -235,9 +245,13 @@ static void sprd_mbox_shutdown(struct mbox_chan *chan)
 {
 	struct sprd_mbox_priv *priv = to_sprd_mbox_priv(chan->mbox);
 
-	/* Disable inbox & outbox interrupt */
-	writel(SPRD_INBOX_FIFO_IRQ_MASK, priv->inbox_base + SPRD_MBOX_IRQ_MSK);
-	writel(SPRD_OUTBOX_FIFO_IRQ_MASK, priv->outbox_base + SPRD_MBOX_IRQ_MSK);
+	mutex_lock(&priv->lock);
+	if (--priv->refcnt == 0) {
+		/* Disable inbox & outbox interrupt */
+		writel(SPRD_INBOX_FIFO_IRQ_MASK, priv->inbox_base + SPRD_MBOX_IRQ_MSK);
+		writel(SPRD_OUTBOX_FIFO_IRQ_MASK, priv->outbox_base + SPRD_MBOX_IRQ_MSK);
+	}
+	mutex_unlock(&priv->lock);
 }
 
 static const struct mbox_chan_ops sprd_mbox_ops = {
@@ -266,6 +280,7 @@ static int sprd_mbox_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	priv->dev = dev;
+	mutex_init(&priv->lock);
 
 	/*
 	 * The Spreadtrum mailbox uses an inbox to send messages to the target
-- 
2.17.1


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

* [PATCH v2 2/3] dt-bindings: mailbox: Add interrupt-names to SPRD mailbox
  2021-02-13 12:21 [PATCH v2 0/3] Fixes & a new supplementary feature to SPRD mailbox driver Orson Zhai
  2021-02-13 12:21 ` [PATCH v2 1/3] mailbox: sprd: Introduce refcnt when clients requests/free channels Orson Zhai
@ 2021-02-13 12:21 ` Orson Zhai
  2021-03-05 21:22   ` Rob Herring
  2021-02-13 12:21 ` [PATCH v2 3/3] mailbox: sprd: Add supplementary inbox support Orson Zhai
  2021-02-26  1:52 ` [PATCH v2 0/3] Fixes & a new supplementary feature to SPRD mailbox driver Orson Zhai
  3 siblings, 1 reply; 9+ messages in thread
From: Orson Zhai @ 2021-02-13 12:21 UTC (permalink / raw)
  To: Rob Herring, Baolin Wang, Chunyan Zhang, Jassi Brar
  Cc: Orson Zhai, Mark Brown, devicetree, linux-kernel, Haidong Yao,
	Orson Zhai

From: Orson Zhai <orson.zhai@unisoc.com>

We add an optional supp-outbox interrupt support to SPRD mailbox driver
with newly added sc9863a support and change to configure interrupts with
names in device tree files.

Signed-off-by: Orson Zhai <orson.zhai@unisoc.com>
---
 .../bindings/mailbox/sprd-mailbox.yaml         | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/mailbox/sprd-mailbox.yaml b/Documentation/devicetree/bindings/mailbox/sprd-mailbox.yaml
index 26a5cca3f838..67736450ee93 100644
--- a/Documentation/devicetree/bindings/mailbox/sprd-mailbox.yaml
+++ b/Documentation/devicetree/bindings/mailbox/sprd-mailbox.yaml
@@ -15,6 +15,7 @@ properties:
   compatible:
     enum:
       - sprd,sc9860-mailbox
+      - sprd,sc9863a-mailbox
 
   reg:
     items:
@@ -22,9 +23,18 @@ properties:
       - description: outbox registers' base address
 
   interrupts:
-    items:
-      - description: inbox interrupt
-      - description: outbox interrupt
+    minItems: 2
+    maxItems: 3
+
+  interrupt-names:
+    oneOf:
+      - items:
+          - const: inbox
+          - const: outbox
+      - items:
+          - const: inbox
+          - const: outbox
+          - const: supp-outbox
 
   clocks:
     maxItems: 1
@@ -40,6 +50,7 @@ required:
   - compatible
   - reg
   - interrupts
+  - interrupt-names
   - "#mbox-cells"
   - clocks
   - clock-names
@@ -56,5 +67,6 @@ examples:
       clock-names = "enable";
       clocks = <&aon_gate 53>;
       interrupts = <GIC_SPI 28 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>;
+      interrupt-names = "inbox", "outbox";
     };
 ...
-- 
2.17.1


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

* [PATCH v2 3/3] mailbox: sprd: Add supplementary inbox support
  2021-02-13 12:21 [PATCH v2 0/3] Fixes & a new supplementary feature to SPRD mailbox driver Orson Zhai
  2021-02-13 12:21 ` [PATCH v2 1/3] mailbox: sprd: Introduce refcnt when clients requests/free channels Orson Zhai
  2021-02-13 12:21 ` [PATCH v2 2/3] dt-bindings: mailbox: Add interrupt-names to SPRD mailbox Orson Zhai
@ 2021-02-13 12:21 ` Orson Zhai
  2021-03-07 15:23   ` Baolin Wang
  2021-02-26  1:52 ` [PATCH v2 0/3] Fixes & a new supplementary feature to SPRD mailbox driver Orson Zhai
  3 siblings, 1 reply; 9+ messages in thread
From: Orson Zhai @ 2021-02-13 12:21 UTC (permalink / raw)
  To: Rob Herring, Baolin Wang, Chunyan Zhang, Jassi Brar
  Cc: Orson Zhai, Mark Brown, devicetree, linux-kernel, Haidong Yao,
	Orson Zhai

From: Orson Zhai <orson.zhai@unisoc.com>

Some sensors connected to Unisoc mailbox will send data very frequently.
This makes channel 0 very busy and the messages from other remote cores
not able to be handled as soon as possible.

It's a trick (un-documented) from Unisoc ASIC designers to resolve this
special requirement that an inbox assigned to one of the remote cores
before was modified to be exposed to host cpu core.

Then from host side, a supplementary inbox is added for transferring mass
but not emergency messages from the remote cores, such as step counting
sensor, with an independent FIFO and interrupt which is as same as channel
0. Meanwihle, inbox part of this channel is still kept for original remote
core to use.

Signed-off-by: Orson Zhai <orson.zhai@unisoc.com>
---
 drivers/mailbox/sprd-mailbox.c | 88 +++++++++++++++++++++++++++-------
 1 file changed, 71 insertions(+), 17 deletions(-)

diff --git a/drivers/mailbox/sprd-mailbox.c b/drivers/mailbox/sprd-mailbox.c
index 920de7b9dce1..7abd6c6d655d 100644
--- a/drivers/mailbox/sprd-mailbox.c
+++ b/drivers/mailbox/sprd-mailbox.c
@@ -11,6 +11,7 @@
 #include <linux/io.h>
 #include <linux/mailbox_controller.h>
 #include <linux/module.h>
+#include <linux/of_device.h>
 #include <linux/platform_device.h>
 #include <linux/clk.h>
 
@@ -50,13 +51,17 @@
 #define SPRD_OUTBOX_FIFO_NOT_EMPTY_IRQ		BIT(0)
 #define SPRD_OUTBOX_FIFO_IRQ_MASK		GENMASK(4, 0)
 
+#define SPRD_OUTBOX_BASE_SPAN			0x1000
 #define SPRD_MBOX_CHAN_MAX			8
+#define SPRD_SUPP_INBOX_ID_SC9863A		7
 
 struct sprd_mbox_priv {
 	struct mbox_controller	mbox;
 	struct device		*dev;
 	void __iomem		*inbox_base;
 	void __iomem		*outbox_base;
+	/*  Base register address for supplementary outbox */
+	void __iomem		*supp_base;
 	struct clk		*clk;
 	u32			outbox_fifo_depth;
 
@@ -96,14 +101,13 @@ static u32 sprd_mbox_get_fifo_len(struct sprd_mbox_priv *priv, u32 fifo_sts)
 	return fifo_len;
 }
 
-static irqreturn_t sprd_mbox_outbox_isr(int irq, void *data)
+static irqreturn_t do_outbox_isr(void __iomem *base, struct sprd_mbox_priv *priv)
 {
-	struct sprd_mbox_priv *priv = data;
 	struct mbox_chan *chan;
 	u32 fifo_sts, fifo_len, msg[2];
 	int i, id;
 
-	fifo_sts = readl(priv->outbox_base + SPRD_MBOX_FIFO_STS);
+	fifo_sts = readl(base + SPRD_MBOX_FIFO_STS);
 
 	fifo_len = sprd_mbox_get_fifo_len(priv, fifo_sts);
 	if (!fifo_len) {
@@ -112,9 +116,9 @@ static irqreturn_t sprd_mbox_outbox_isr(int irq, void *data)
 	}
 
 	for (i = 0; i < fifo_len; i++) {
-		msg[0] = readl(priv->outbox_base + SPRD_MBOX_MSG_LOW);
-		msg[1] = readl(priv->outbox_base + SPRD_MBOX_MSG_HIGH);
-		id = readl(priv->outbox_base + SPRD_MBOX_ID);
+		msg[0] = readl(base + SPRD_MBOX_MSG_LOW);
+		msg[1] = readl(base + SPRD_MBOX_MSG_HIGH);
+		id = readl(base + SPRD_MBOX_ID);
 
 		chan = &priv->chan[id];
 		if (chan->cl)
@@ -124,15 +128,29 @@ static irqreturn_t sprd_mbox_outbox_isr(int irq, void *data)
 				    "message's been dropped at ch[%d]\n", id);
 
 		/* Trigger to update outbox FIFO pointer */
-		writel(0x1, priv->outbox_base + SPRD_MBOX_TRIGGER);
+		writel(0x1, base + SPRD_MBOX_TRIGGER);
 	}
 
 	/* Clear irq status after reading all message. */
-	writel(SPRD_MBOX_IRQ_CLR, priv->outbox_base + SPRD_MBOX_IRQ_STS);
+	writel(SPRD_MBOX_IRQ_CLR, base + SPRD_MBOX_IRQ_STS);
 
 	return IRQ_HANDLED;
 }
 
+static irqreturn_t sprd_mbox_outbox_isr(int irq, void *data)
+{
+	struct sprd_mbox_priv *priv = data;
+
+	return do_outbox_isr(priv->outbox_base, priv);
+}
+
+static irqreturn_t sprd_mbox_supp_isr(int irq, void *data)
+{
+	struct sprd_mbox_priv *priv = data;
+
+	return do_outbox_isr(priv->supp_base, priv);
+}
+
 static irqreturn_t sprd_mbox_inbox_isr(int irq, void *data)
 {
 	struct sprd_mbox_priv *priv = data;
@@ -235,6 +253,14 @@ static int sprd_mbox_startup(struct mbox_chan *chan)
 		val = readl(priv->outbox_base + SPRD_MBOX_IRQ_MSK);
 		val &= ~SPRD_OUTBOX_FIFO_NOT_EMPTY_IRQ;
 		writel(val, priv->outbox_base + SPRD_MBOX_IRQ_MSK);
+
+		/* Enable supplementary outbox as the fundamental one */
+		if (priv->supp_base) {
+			writel(0x0, priv->supp_base + SPRD_MBOX_FIFO_RST);
+			val = readl(priv->supp_base + SPRD_MBOX_IRQ_MSK);
+			val &= ~SPRD_OUTBOX_FIFO_NOT_EMPTY_IRQ;
+			writel(val, priv->supp_base + SPRD_MBOX_IRQ_MSK);
+		}
 	}
 	mutex_unlock(&priv->lock);
 
@@ -250,6 +276,10 @@ static void sprd_mbox_shutdown(struct mbox_chan *chan)
 		/* Disable inbox & outbox interrupt */
 		writel(SPRD_INBOX_FIFO_IRQ_MASK, priv->inbox_base + SPRD_MBOX_IRQ_MSK);
 		writel(SPRD_OUTBOX_FIFO_IRQ_MASK, priv->outbox_base + SPRD_MBOX_IRQ_MSK);
+
+		if (priv->supp_base)
+			writel(SPRD_OUTBOX_FIFO_IRQ_MASK,
+			       priv->supp_base + SPRD_MBOX_IRQ_MSK);
 	}
 	mutex_unlock(&priv->lock);
 }
@@ -272,8 +302,8 @@ static int sprd_mbox_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	struct sprd_mbox_priv *priv;
-	int ret, inbox_irq, outbox_irq;
-	unsigned long id;
+	int ret, inbox_irq, outbox_irq, supp_irq;
+	unsigned long id, supp;
 
 	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
 	if (!priv)
@@ -283,11 +313,15 @@ static int sprd_mbox_probe(struct platform_device *pdev)
 	mutex_init(&priv->lock);
 
 	/*
-	 * The Spreadtrum mailbox uses an inbox to send messages to the target
-	 * core, and uses an outbox to receive messages from other cores.
+	 * Unisoc mailbox uses an inbox to send messages to the target
+	 * core, and uses (an) outbox(es) to receive messages from other
+	 * cores.
+	 *
+	 * Thus in general the mailbox controller supplies 2 different
+	 * register addresses and IRQ numbers for inbox and outbox.
 	 *
-	 * Thus the mailbox controller supplies 2 different register addresses
-	 * and IRQ numbers for inbox and outbox.
+	 * If necessary, a supplementary inbox could be enabled optionally
+	 * with an independent FIFO and an extra interrupt.
 	 */
 	priv->inbox_base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(priv->inbox_base))
@@ -313,7 +347,7 @@ static int sprd_mbox_probe(struct platform_device *pdev)
 		return ret;
 	}
 
-	inbox_irq = platform_get_irq(pdev, 0);
+	inbox_irq = platform_get_irq_byname(pdev, "inbox");
 	if (inbox_irq < 0)
 		return inbox_irq;
 
@@ -324,7 +358,7 @@ static int sprd_mbox_probe(struct platform_device *pdev)
 		return ret;
 	}
 
-	outbox_irq = platform_get_irq(pdev, 1);
+	outbox_irq = platform_get_irq_byname(pdev, "outbox");
 	if (outbox_irq < 0)
 		return outbox_irq;
 
@@ -335,6 +369,24 @@ static int sprd_mbox_probe(struct platform_device *pdev)
 		return ret;
 	}
 
+	/* Supplementary outbox IRQ is optional */
+	supp_irq = platform_get_irq_byname(pdev, "supp-outbox");
+	if (supp_irq > 0) {
+		ret = devm_request_irq(dev, supp_irq, sprd_mbox_supp_isr,
+				       IRQF_NO_SUSPEND, dev_name(dev), priv);
+		if (ret) {
+			dev_err(dev, "failed to request outbox IRQ: %d\n", ret);
+			return ret;
+		}
+
+		supp = (unsigned long) of_device_get_match_data(dev);
+		if (!supp) {
+			dev_err(dev, "no supplementary outbox specified\n");
+			return -ENODEV;
+		}
+		priv->supp_base = priv->outbox_base + (SPRD_OUTBOX_BASE_SPAN * supp);
+	}
+
 	/* Get the default outbox FIFO depth */
 	priv->outbox_fifo_depth =
 		readl(priv->outbox_base + SPRD_MBOX_FIFO_DEPTH) + 1;
@@ -357,7 +409,9 @@ static int sprd_mbox_probe(struct platform_device *pdev)
 }
 
 static const struct of_device_id sprd_mbox_of_match[] = {
-	{ .compatible = "sprd,sc9860-mailbox", },
+	{ .compatible = "sprd,sc9860-mailbox" },
+	{ .compatible = "sprd,sc9863a-mailbox",
+	  .data = (void *)SPRD_SUPP_INBOX_ID_SC9863A },
 	{ },
 };
 MODULE_DEVICE_TABLE(of, sprd_mbox_of_match);
-- 
2.17.1


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

* Re: [PATCH v2 0/3] Fixes & a new supplementary feature to SPRD mailbox driver
  2021-02-13 12:21 [PATCH v2 0/3] Fixes & a new supplementary feature to SPRD mailbox driver Orson Zhai
                   ` (2 preceding siblings ...)
  2021-02-13 12:21 ` [PATCH v2 3/3] mailbox: sprd: Add supplementary inbox support Orson Zhai
@ 2021-02-26  1:52 ` Orson Zhai
  3 siblings, 0 replies; 9+ messages in thread
From: Orson Zhai @ 2021-02-26  1:52 UTC (permalink / raw)
  To: Rob Herring, Baolin Wang, Chunyan Zhang, Jassi Brar
  Cc: Mark Brown, devicetree, linux-kernel, Haidong Yao

Hi Baolin,

On Sat, Feb 13, 2021 at 08:21:40PM +0800, Orson Zhai wrote:
> Fix a real problem fot SPRD's mailbox driver in patch 1/3.
> Add supplementary inbox support for newly added sc9863a in patch 3/3 and
> change dt bindings yaml accordingly in patch 2/3.
> 
> Changes Log:
> V2:
> - Change patches order. (Yaml go to the head of dirver)
> - Remove unnecessary initializing refcnt to zero. 
> - Add fix of possible crash caused by NULL of chan->cl. (Actually move from
>   changes to sprd-mailbox.c of patch v1)
> - Remove unnecessary "inline" for do_inbox_isr().
> - Fix yaml errors from Rob's robot checking.
> - Add sc9863a compatible string for real supplementary inbox usage. (sc9860
>   is not supported by supp-inbox)
> - Add more details to supp-inbox in commit messages.

Do you have any comments about this changes to v2?

Thanks,
Orson

> 
> Orson Zhai (3):
>   mailbox: sprd: Introduce refcnt when clients requests/free channels
>   dt-bindings: mailbox: Add interrupt-names to SPRD mailbox
>   mailbox: sprd: Add supplementary inbox support
> 
>  .../bindings/mailbox/sprd-mailbox.yaml        |  18 ++-
>  drivers/mailbox/sprd-mailbox.c                | 135 +++++++++++++-----
>  2 files changed, 117 insertions(+), 36 deletions(-)
> 
> -- 
> 2.17.1
> 

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

* Re: [PATCH v2 2/3] dt-bindings: mailbox: Add interrupt-names to SPRD mailbox
  2021-02-13 12:21 ` [PATCH v2 2/3] dt-bindings: mailbox: Add interrupt-names to SPRD mailbox Orson Zhai
@ 2021-03-05 21:22   ` Rob Herring
  2021-03-08  8:29     ` Orson Zhai
  0 siblings, 1 reply; 9+ messages in thread
From: Rob Herring @ 2021-03-05 21:22 UTC (permalink / raw)
  To: Orson Zhai
  Cc: Baolin Wang, Chunyan Zhang, Jassi Brar, Mark Brown, devicetree,
	linux-kernel, Haidong Yao, Orson Zhai

On Sat, Feb 13, 2021 at 08:21:42PM +0800, Orson Zhai wrote:
> From: Orson Zhai <orson.zhai@unisoc.com>
> 
> We add an optional supp-outbox interrupt support to SPRD mailbox driver
> with newly added sc9863a support and change to configure interrupts with
> names in device tree files.
> 
> Signed-off-by: Orson Zhai <orson.zhai@unisoc.com>
> ---
>  .../bindings/mailbox/sprd-mailbox.yaml         | 18 +++++++++++++++---
>  1 file changed, 15 insertions(+), 3 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/mailbox/sprd-mailbox.yaml b/Documentation/devicetree/bindings/mailbox/sprd-mailbox.yaml
> index 26a5cca3f838..67736450ee93 100644
> --- a/Documentation/devicetree/bindings/mailbox/sprd-mailbox.yaml
> +++ b/Documentation/devicetree/bindings/mailbox/sprd-mailbox.yaml
> @@ -15,6 +15,7 @@ properties:
>    compatible:
>      enum:
>        - sprd,sc9860-mailbox
> +      - sprd,sc9863a-mailbox
>  
>    reg:
>      items:
> @@ -22,9 +23,18 @@ properties:
>        - description: outbox registers' base address
>  
>    interrupts:
> -    items:
> -      - description: inbox interrupt
> -      - description: outbox interrupt
> +    minItems: 2
> +    maxItems: 3
> +
> +  interrupt-names:
> +    oneOf:
> +      - items:
> +          - const: inbox
> +          - const: outbox
> +      - items:
> +          - const: inbox
> +          - const: outbox
> +          - const: supp-outbox

You can do this instead:

interrupt-names:
  minItems: 2
  items:
    - const: inbox
    - const: outbox
    - const: supp-outbox

>  
>    clocks:
>      maxItems: 1
> @@ -40,6 +50,7 @@ required:
>    - compatible
>    - reg
>    - interrupts
> +  - interrupt-names
>    - "#mbox-cells"
>    - clocks
>    - clock-names
> @@ -56,5 +67,6 @@ examples:
>        clock-names = "enable";
>        clocks = <&aon_gate 53>;
>        interrupts = <GIC_SPI 28 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>;
> +      interrupt-names = "inbox", "outbox";
>      };
>  ...
> -- 
> 2.17.1
> 

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

* Re: [PATCH v2 1/3] mailbox: sprd: Introduce refcnt when clients requests/free channels
  2021-02-13 12:21 ` [PATCH v2 1/3] mailbox: sprd: Introduce refcnt when clients requests/free channels Orson Zhai
@ 2021-03-07 15:23   ` Baolin Wang
  0 siblings, 0 replies; 9+ messages in thread
From: Baolin Wang @ 2021-03-07 15:23 UTC (permalink / raw)
  To: Orson Zhai
  Cc: Rob Herring, Chunyan Zhang, Jassi Brar, Mark Brown,
	Devicetree List, LKML, Haidong Yao, Orson Zhai

On Sat, Feb 13, 2021 at 8:22 PM Orson Zhai <orsonzhai@gmail.com> wrote:
>
> From: Orson Zhai <orson.zhai@unisoc.com>
>
> Unisoc mailbox has no way to be enabled/disabled for any single channel.
> They can only be set to startup or shutdown as a whole device at same time.
>
> Add a variable to count references to avoid mailbox FIFO being reset
> unexpectedly when clients are requesting or freeing channels.
>
> Also add a lock to dismiss possible conflicts from register r/w in
> different startup or shutdown threads. And fix the crash problem when early
> interrupts come from channel which has not been requested by client yet.
>
> Fixes: ca27fc26cd22 ("mailbox: sprd: Add Spreadtrum mailbox driver")
> Signed-off-by: Orson Zhai <orson.zhai@unisoc.com>

Sorry for the late reply. LGTM.
Reviewed-by: Baolin Wang <baolin.wang7@gmail.com>

> ---
>  drivers/mailbox/sprd-mailbox.c | 43 +++++++++++++++++++++++-----------
>  1 file changed, 29 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/mailbox/sprd-mailbox.c b/drivers/mailbox/sprd-mailbox.c
> index f6fab24ae8a9..920de7b9dce1 100644
> --- a/drivers/mailbox/sprd-mailbox.c
> +++ b/drivers/mailbox/sprd-mailbox.c
> @@ -60,6 +60,8 @@ struct sprd_mbox_priv {
>         struct clk              *clk;
>         u32                     outbox_fifo_depth;
>
> +       struct mutex            lock;
> +       u32                     refcnt;
>         struct mbox_chan        chan[SPRD_MBOX_CHAN_MAX];
>  };
>
> @@ -115,7 +117,11 @@ static irqreturn_t sprd_mbox_outbox_isr(int irq, void *data)
>                 id = readl(priv->outbox_base + SPRD_MBOX_ID);
>
>                 chan = &priv->chan[id];
> -               mbox_chan_received_data(chan, (void *)msg);
> +               if (chan->cl)
> +                       mbox_chan_received_data(chan, (void *)msg);
> +               else
> +                       dev_warn_ratelimited(priv->dev,
> +                                   "message's been dropped at ch[%d]\n", id);
>
>                 /* Trigger to update outbox FIFO pointer */
>                 writel(0x1, priv->outbox_base + SPRD_MBOX_TRIGGER);
> @@ -215,18 +221,22 @@ static int sprd_mbox_startup(struct mbox_chan *chan)
>         struct sprd_mbox_priv *priv = to_sprd_mbox_priv(chan->mbox);
>         u32 val;
>
> -       /* Select outbox FIFO mode and reset the outbox FIFO status */
> -       writel(0x0, priv->outbox_base + SPRD_MBOX_FIFO_RST);
> +       mutex_lock(&priv->lock);
> +       if (priv->refcnt++ == 0) {
> +               /* Select outbox FIFO mode and reset the outbox FIFO status */
> +               writel(0x0, priv->outbox_base + SPRD_MBOX_FIFO_RST);
>
> -       /* Enable inbox FIFO overflow and delivery interrupt */
> -       val = readl(priv->inbox_base + SPRD_MBOX_IRQ_MSK);
> -       val &= ~(SPRD_INBOX_FIFO_OVERFLOW_IRQ | SPRD_INBOX_FIFO_DELIVER_IRQ);
> -       writel(val, priv->inbox_base + SPRD_MBOX_IRQ_MSK);
> +               /* Enable inbox FIFO overflow and delivery interrupt */
> +               val = readl(priv->inbox_base + SPRD_MBOX_IRQ_MSK);
> +               val &= ~(SPRD_INBOX_FIFO_OVERFLOW_IRQ | SPRD_INBOX_FIFO_DELIVER_IRQ);
> +               writel(val, priv->inbox_base + SPRD_MBOX_IRQ_MSK);
>
> -       /* Enable outbox FIFO not empty interrupt */
> -       val = readl(priv->outbox_base + SPRD_MBOX_IRQ_MSK);
> -       val &= ~SPRD_OUTBOX_FIFO_NOT_EMPTY_IRQ;
> -       writel(val, priv->outbox_base + SPRD_MBOX_IRQ_MSK);
> +               /* Enable outbox FIFO not empty interrupt */
> +               val = readl(priv->outbox_base + SPRD_MBOX_IRQ_MSK);
> +               val &= ~SPRD_OUTBOX_FIFO_NOT_EMPTY_IRQ;
> +               writel(val, priv->outbox_base + SPRD_MBOX_IRQ_MSK);
> +       }
> +       mutex_unlock(&priv->lock);
>
>         return 0;
>  }
> @@ -235,9 +245,13 @@ static void sprd_mbox_shutdown(struct mbox_chan *chan)
>  {
>         struct sprd_mbox_priv *priv = to_sprd_mbox_priv(chan->mbox);
>
> -       /* Disable inbox & outbox interrupt */
> -       writel(SPRD_INBOX_FIFO_IRQ_MASK, priv->inbox_base + SPRD_MBOX_IRQ_MSK);
> -       writel(SPRD_OUTBOX_FIFO_IRQ_MASK, priv->outbox_base + SPRD_MBOX_IRQ_MSK);
> +       mutex_lock(&priv->lock);
> +       if (--priv->refcnt == 0) {
> +               /* Disable inbox & outbox interrupt */
> +               writel(SPRD_INBOX_FIFO_IRQ_MASK, priv->inbox_base + SPRD_MBOX_IRQ_MSK);
> +               writel(SPRD_OUTBOX_FIFO_IRQ_MASK, priv->outbox_base + SPRD_MBOX_IRQ_MSK);
> +       }
> +       mutex_unlock(&priv->lock);
>  }
>
>  static const struct mbox_chan_ops sprd_mbox_ops = {
> @@ -266,6 +280,7 @@ static int sprd_mbox_probe(struct platform_device *pdev)
>                 return -ENOMEM;
>
>         priv->dev = dev;
> +       mutex_init(&priv->lock);
>
>         /*
>          * The Spreadtrum mailbox uses an inbox to send messages to the target
> --
> 2.17.1
>


-- 
Baolin Wang

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

* Re: [PATCH v2 3/3] mailbox: sprd: Add supplementary inbox support
  2021-02-13 12:21 ` [PATCH v2 3/3] mailbox: sprd: Add supplementary inbox support Orson Zhai
@ 2021-03-07 15:23   ` Baolin Wang
  0 siblings, 0 replies; 9+ messages in thread
From: Baolin Wang @ 2021-03-07 15:23 UTC (permalink / raw)
  To: Orson Zhai
  Cc: Rob Herring, Chunyan Zhang, Jassi Brar, Mark Brown,
	Devicetree List, LKML, Haidong Yao, Orson Zhai

On Sat, Feb 13, 2021 at 8:23 PM Orson Zhai <orsonzhai@gmail.com> wrote:
>
> From: Orson Zhai <orson.zhai@unisoc.com>
>
> Some sensors connected to Unisoc mailbox will send data very frequently.
> This makes channel 0 very busy and the messages from other remote cores
> not able to be handled as soon as possible.
>
> It's a trick (un-documented) from Unisoc ASIC designers to resolve this
> special requirement that an inbox assigned to one of the remote cores
> before was modified to be exposed to host cpu core.
>
> Then from host side, a supplementary inbox is added for transferring mass
> but not emergency messages from the remote cores, such as step counting
> sensor, with an independent FIFO and interrupt which is as same as channel
> 0. Meanwihle, inbox part of this channel is still kept for original remote
> core to use.
>
> Signed-off-by: Orson Zhai <orson.zhai@unisoc.com>

Reviewed-by: Baolin Wang <baolin.wang7@gmail.com>

> ---
>  drivers/mailbox/sprd-mailbox.c | 88 +++++++++++++++++++++++++++-------
>  1 file changed, 71 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/mailbox/sprd-mailbox.c b/drivers/mailbox/sprd-mailbox.c
> index 920de7b9dce1..7abd6c6d655d 100644
> --- a/drivers/mailbox/sprd-mailbox.c
> +++ b/drivers/mailbox/sprd-mailbox.c
> @@ -11,6 +11,7 @@
>  #include <linux/io.h>
>  #include <linux/mailbox_controller.h>
>  #include <linux/module.h>
> +#include <linux/of_device.h>
>  #include <linux/platform_device.h>
>  #include <linux/clk.h>
>
> @@ -50,13 +51,17 @@
>  #define SPRD_OUTBOX_FIFO_NOT_EMPTY_IRQ         BIT(0)
>  #define SPRD_OUTBOX_FIFO_IRQ_MASK              GENMASK(4, 0)
>
> +#define SPRD_OUTBOX_BASE_SPAN                  0x1000
>  #define SPRD_MBOX_CHAN_MAX                     8
> +#define SPRD_SUPP_INBOX_ID_SC9863A             7
>
>  struct sprd_mbox_priv {
>         struct mbox_controller  mbox;
>         struct device           *dev;
>         void __iomem            *inbox_base;
>         void __iomem            *outbox_base;
> +       /*  Base register address for supplementary outbox */
> +       void __iomem            *supp_base;
>         struct clk              *clk;
>         u32                     outbox_fifo_depth;
>
> @@ -96,14 +101,13 @@ static u32 sprd_mbox_get_fifo_len(struct sprd_mbox_priv *priv, u32 fifo_sts)
>         return fifo_len;
>  }
>
> -static irqreturn_t sprd_mbox_outbox_isr(int irq, void *data)
> +static irqreturn_t do_outbox_isr(void __iomem *base, struct sprd_mbox_priv *priv)
>  {
> -       struct sprd_mbox_priv *priv = data;
>         struct mbox_chan *chan;
>         u32 fifo_sts, fifo_len, msg[2];
>         int i, id;
>
> -       fifo_sts = readl(priv->outbox_base + SPRD_MBOX_FIFO_STS);
> +       fifo_sts = readl(base + SPRD_MBOX_FIFO_STS);
>
>         fifo_len = sprd_mbox_get_fifo_len(priv, fifo_sts);
>         if (!fifo_len) {
> @@ -112,9 +116,9 @@ static irqreturn_t sprd_mbox_outbox_isr(int irq, void *data)
>         }
>
>         for (i = 0; i < fifo_len; i++) {
> -               msg[0] = readl(priv->outbox_base + SPRD_MBOX_MSG_LOW);
> -               msg[1] = readl(priv->outbox_base + SPRD_MBOX_MSG_HIGH);
> -               id = readl(priv->outbox_base + SPRD_MBOX_ID);
> +               msg[0] = readl(base + SPRD_MBOX_MSG_LOW);
> +               msg[1] = readl(base + SPRD_MBOX_MSG_HIGH);
> +               id = readl(base + SPRD_MBOX_ID);
>
>                 chan = &priv->chan[id];
>                 if (chan->cl)
> @@ -124,15 +128,29 @@ static irqreturn_t sprd_mbox_outbox_isr(int irq, void *data)
>                                     "message's been dropped at ch[%d]\n", id);
>
>                 /* Trigger to update outbox FIFO pointer */
> -               writel(0x1, priv->outbox_base + SPRD_MBOX_TRIGGER);
> +               writel(0x1, base + SPRD_MBOX_TRIGGER);
>         }
>
>         /* Clear irq status after reading all message. */
> -       writel(SPRD_MBOX_IRQ_CLR, priv->outbox_base + SPRD_MBOX_IRQ_STS);
> +       writel(SPRD_MBOX_IRQ_CLR, base + SPRD_MBOX_IRQ_STS);
>
>         return IRQ_HANDLED;
>  }
>
> +static irqreturn_t sprd_mbox_outbox_isr(int irq, void *data)
> +{
> +       struct sprd_mbox_priv *priv = data;
> +
> +       return do_outbox_isr(priv->outbox_base, priv);
> +}
> +
> +static irqreturn_t sprd_mbox_supp_isr(int irq, void *data)
> +{
> +       struct sprd_mbox_priv *priv = data;
> +
> +       return do_outbox_isr(priv->supp_base, priv);
> +}
> +
>  static irqreturn_t sprd_mbox_inbox_isr(int irq, void *data)
>  {
>         struct sprd_mbox_priv *priv = data;
> @@ -235,6 +253,14 @@ static int sprd_mbox_startup(struct mbox_chan *chan)
>                 val = readl(priv->outbox_base + SPRD_MBOX_IRQ_MSK);
>                 val &= ~SPRD_OUTBOX_FIFO_NOT_EMPTY_IRQ;
>                 writel(val, priv->outbox_base + SPRD_MBOX_IRQ_MSK);
> +
> +               /* Enable supplementary outbox as the fundamental one */
> +               if (priv->supp_base) {
> +                       writel(0x0, priv->supp_base + SPRD_MBOX_FIFO_RST);
> +                       val = readl(priv->supp_base + SPRD_MBOX_IRQ_MSK);
> +                       val &= ~SPRD_OUTBOX_FIFO_NOT_EMPTY_IRQ;
> +                       writel(val, priv->supp_base + SPRD_MBOX_IRQ_MSK);
> +               }
>         }
>         mutex_unlock(&priv->lock);
>
> @@ -250,6 +276,10 @@ static void sprd_mbox_shutdown(struct mbox_chan *chan)
>                 /* Disable inbox & outbox interrupt */
>                 writel(SPRD_INBOX_FIFO_IRQ_MASK, priv->inbox_base + SPRD_MBOX_IRQ_MSK);
>                 writel(SPRD_OUTBOX_FIFO_IRQ_MASK, priv->outbox_base + SPRD_MBOX_IRQ_MSK);
> +
> +               if (priv->supp_base)
> +                       writel(SPRD_OUTBOX_FIFO_IRQ_MASK,
> +                              priv->supp_base + SPRD_MBOX_IRQ_MSK);
>         }
>         mutex_unlock(&priv->lock);
>  }
> @@ -272,8 +302,8 @@ static int sprd_mbox_probe(struct platform_device *pdev)
>  {
>         struct device *dev = &pdev->dev;
>         struct sprd_mbox_priv *priv;
> -       int ret, inbox_irq, outbox_irq;
> -       unsigned long id;
> +       int ret, inbox_irq, outbox_irq, supp_irq;
> +       unsigned long id, supp;
>
>         priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
>         if (!priv)
> @@ -283,11 +313,15 @@ static int sprd_mbox_probe(struct platform_device *pdev)
>         mutex_init(&priv->lock);
>
>         /*
> -        * The Spreadtrum mailbox uses an inbox to send messages to the target
> -        * core, and uses an outbox to receive messages from other cores.
> +        * Unisoc mailbox uses an inbox to send messages to the target
> +        * core, and uses (an) outbox(es) to receive messages from other
> +        * cores.
> +        *
> +        * Thus in general the mailbox controller supplies 2 different
> +        * register addresses and IRQ numbers for inbox and outbox.
>          *
> -        * Thus the mailbox controller supplies 2 different register addresses
> -        * and IRQ numbers for inbox and outbox.
> +        * If necessary, a supplementary inbox could be enabled optionally
> +        * with an independent FIFO and an extra interrupt.
>          */
>         priv->inbox_base = devm_platform_ioremap_resource(pdev, 0);
>         if (IS_ERR(priv->inbox_base))
> @@ -313,7 +347,7 @@ static int sprd_mbox_probe(struct platform_device *pdev)
>                 return ret;
>         }
>
> -       inbox_irq = platform_get_irq(pdev, 0);
> +       inbox_irq = platform_get_irq_byname(pdev, "inbox");
>         if (inbox_irq < 0)
>                 return inbox_irq;
>
> @@ -324,7 +358,7 @@ static int sprd_mbox_probe(struct platform_device *pdev)
>                 return ret;
>         }
>
> -       outbox_irq = platform_get_irq(pdev, 1);
> +       outbox_irq = platform_get_irq_byname(pdev, "outbox");
>         if (outbox_irq < 0)
>                 return outbox_irq;
>
> @@ -335,6 +369,24 @@ static int sprd_mbox_probe(struct platform_device *pdev)
>                 return ret;
>         }
>
> +       /* Supplementary outbox IRQ is optional */
> +       supp_irq = platform_get_irq_byname(pdev, "supp-outbox");
> +       if (supp_irq > 0) {
> +               ret = devm_request_irq(dev, supp_irq, sprd_mbox_supp_isr,
> +                                      IRQF_NO_SUSPEND, dev_name(dev), priv);
> +               if (ret) {
> +                       dev_err(dev, "failed to request outbox IRQ: %d\n", ret);
> +                       return ret;
> +               }
> +
> +               supp = (unsigned long) of_device_get_match_data(dev);
> +               if (!supp) {
> +                       dev_err(dev, "no supplementary outbox specified\n");
> +                       return -ENODEV;
> +               }
> +               priv->supp_base = priv->outbox_base + (SPRD_OUTBOX_BASE_SPAN * supp);
> +       }
> +
>         /* Get the default outbox FIFO depth */
>         priv->outbox_fifo_depth =
>                 readl(priv->outbox_base + SPRD_MBOX_FIFO_DEPTH) + 1;
> @@ -357,7 +409,9 @@ static int sprd_mbox_probe(struct platform_device *pdev)
>  }
>
>  static const struct of_device_id sprd_mbox_of_match[] = {
> -       { .compatible = "sprd,sc9860-mailbox", },
> +       { .compatible = "sprd,sc9860-mailbox" },
> +       { .compatible = "sprd,sc9863a-mailbox",
> +         .data = (void *)SPRD_SUPP_INBOX_ID_SC9863A },
>         { },
>  };
>  MODULE_DEVICE_TABLE(of, sprd_mbox_of_match);
> --
> 2.17.1
>


-- 
Baolin Wang

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

* Re: [PATCH v2 2/3] dt-bindings: mailbox: Add interrupt-names to SPRD mailbox
  2021-03-05 21:22   ` Rob Herring
@ 2021-03-08  8:29     ` Orson Zhai
  0 siblings, 0 replies; 9+ messages in thread
From: Orson Zhai @ 2021-03-08  8:29 UTC (permalink / raw)
  To: Rob Herring
  Cc: Baolin Wang, Chunyan Zhang, Jassi Brar, Mark Brown, devicetree,
	linux-kernel, Haidong Yao, Orson Zhai

Hi Rob,

On Fri, Mar 05, 2021 at 03:22:21PM -0600, Rob Herring wrote:
> On Sat, Feb 13, 2021 at 08:21:42PM +0800, Orson Zhai wrote:
> > From: Orson Zhai <orson.zhai@unisoc.com>
> > 
> > We add an optional supp-outbox interrupt support to SPRD mailbox driver
> > with newly added sc9863a support and change to configure interrupts with
> > names in device tree files.
> > 
> > Signed-off-by: Orson Zhai <orson.zhai@unisoc.com>
> > ---
> >  .../bindings/mailbox/sprd-mailbox.yaml         | 18 +++++++++++++++---
> >  1 file changed, 15 insertions(+), 3 deletions(-)
> > 
> > diff --git a/Documentation/devicetree/bindings/mailbox/sprd-mailbox.yaml b/Documentation/devicetree/bindings/mailbox/sprd-mailbox.yaml
> > index 26a5cca3f838..67736450ee93 100644
> > --- a/Documentation/devicetree/bindings/mailbox/sprd-mailbox.yaml
> > +++ b/Documentation/devicetree/bindings/mailbox/sprd-mailbox.yaml
> > @@ -15,6 +15,7 @@ properties:
> >    compatible:
> >      enum:
> >        - sprd,sc9860-mailbox
> > +      - sprd,sc9863a-mailbox
> >  
> >    reg:
> >      items:
> > @@ -22,9 +23,18 @@ properties:
> >        - description: outbox registers' base address
> >  
> >    interrupts:
> > -    items:
> > -      - description: inbox interrupt
> > -      - description: outbox interrupt
> > +    minItems: 2
> > +    maxItems: 3
> > +
> > +  interrupt-names:
> > +    oneOf:
> > +      - items:
> > +          - const: inbox
> > +          - const: outbox
> > +      - items:
> > +          - const: inbox
> > +          - const: outbox
> > +          - const: supp-outbox
> 
> You can do this instead:
> 
> interrupt-names:
>   minItems: 2
>   items:
>     - const: inbox
>     - const: outbox
>     - const: supp-outbox

Does this mean only the first 2 items in the minimum range?

For example, "inbox" + "supp-outbox" is not supposed to be a valid combination. 

Only "supp-outbox" is optional and the other two are mandatory.

Best,
Orson

> 
> >  
> >    clocks:
> >      maxItems: 1
> > @@ -40,6 +50,7 @@ required:
> >    - compatible
> >    - reg
> >    - interrupts
> > +  - interrupt-names
> >    - "#mbox-cells"
> >    - clocks
> >    - clock-names
> > @@ -56,5 +67,6 @@ examples:
> >        clock-names = "enable";
> >        clocks = <&aon_gate 53>;
> >        interrupts = <GIC_SPI 28 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>;
> > +      interrupt-names = "inbox", "outbox";
> >      };
> >  ...
> > -- 
> > 2.17.1
> > 

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

end of thread, other threads:[~2021-03-08  8:30 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-13 12:21 [PATCH v2 0/3] Fixes & a new supplementary feature to SPRD mailbox driver Orson Zhai
2021-02-13 12:21 ` [PATCH v2 1/3] mailbox: sprd: Introduce refcnt when clients requests/free channels Orson Zhai
2021-03-07 15:23   ` Baolin Wang
2021-02-13 12:21 ` [PATCH v2 2/3] dt-bindings: mailbox: Add interrupt-names to SPRD mailbox Orson Zhai
2021-03-05 21:22   ` Rob Herring
2021-03-08  8:29     ` Orson Zhai
2021-02-13 12:21 ` [PATCH v2 3/3] mailbox: sprd: Add supplementary inbox support Orson Zhai
2021-03-07 15:23   ` Baolin Wang
2021-02-26  1:52 ` [PATCH v2 0/3] Fixes & a new supplementary feature to SPRD mailbox driver Orson Zhai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.