diff mbox series

[v3,1/4] dt-bindings: Introduce doorbell binding

Message ID 20170503052929.17422-1-bjorn.andersson@linaro.org
State New
Headers show
Series [v3,1/4] dt-bindings: Introduce doorbell binding | expand

Commit Message

Bjorn Andersson May 3, 2017, 5:29 a.m. UTC
Introduce the generic doorbell binding as well as a binding for the
Qualcomm APCS Global block. This is used to expose doorbell-like devices
in the system.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>

---

Changes since v2:
- New binding

 .../devicetree/bindings/doorbell/doorbell.txt      | 31 +++++++++++++++
 .../bindings/doorbell/qcom,apcs-kpss-global.txt    | 45 ++++++++++++++++++++++
 2 files changed, 76 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/doorbell/doorbell.txt
 create mode 100644 Documentation/devicetree/bindings/doorbell/qcom,apcs-kpss-global.txt

-- 
2.12.0

--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Bjorn Andersson May 4, 2017, 5:45 a.m. UTC | #1
On Wed 03 May 02:55 PDT 2017, Jassi Brar wrote:

> Loic, thanks for adding me.

> 

> On Wed, May 3, 2017 at 2:58 PM, Loic PALLARDY <loic.pallardy@st.com> wrote:

> >

> >

> >> -----Original Message-----

> >> From: linux-remoteproc-owner@vger.kernel.org [mailto:linux-remoteproc-

> >> owner@vger.kernel.org] On Behalf Of Bjorn Andersson

> >> Sent: Wednesday, May 03, 2017 7:29 AM

> >> To: Andy Gross <andy.gross@linaro.org>; Rob Herring

> >> <robh+dt@kernel.org>; Mark Rutland <mark.rutland@arm.com>; Ohad Ben-

> >> Cohen <ohad@wizery.com>

> >> Cc: linux-arm-msm@vger.kernel.org; linux-soc@vger.kernel.org;

> >> devicetree@vger.kernel.org; linux-kernel@vger.kernel.org; linux-

> >> remoteproc@vger.kernel.org

> >> Subject: [PATCH v3 2/4] soc: qcom: Introduce APCS IPC driver

> >>

> >> This implements a driver that exposes the IPC bits found in the APCS Global

> >> block in various Qualcomm platforms. The bits are used to signal inter-

> >> processor communication signals from the application CPU to other masters.

> >>

> >> The driver implements the "doorbell" binding and could be used as basis for a

> >> new Linux framework, if found useful outside Qualcomm.

> >>

> > Hi Bjorn,

> >

> > Even if Qualcom APCS IPC is limited, why don't you rely on existing mailbox framework.

> > It is there to gather all IPC management under the same interface.

> > No need to create a new one from my pov.

> > If you don't provide message data, mailbox framework behaves as doorbell.

> >

> QCOM RPM reinvented the wheel for what mailbox framework already did,

> despite my pointing it out =>

> http://lkml.iu.edu/hypermail//linux/kernel/1406.2/03918.html

> 


The RPM interface works by writing various information in shared DRAM
and then invoking an interrupt on the remote processor. What this patch
does is introduce an abstraction for the invocation of that interrupt.

My argumentation against using the mailbox framework for the RPM case
was that the message model is a software construct and doesn't fit the
mailbox framework.


But the single step of invoking the remote interrupt is essentially a
non-message mailbox. Perhaps this part of the RPM driver is what you're
referring to in your comments on the RPM.

Before "inventing" the function for acquiring a handle to a doorbell I
did look at making this a mailbox controller, but as each mailbox
channel related to a single bit and 1 is the only value we'll ever write
it didn't feel like it matches the mailbox expectations. But as you seem
to object I'll attempt to rewrite it using the mailbox framework
instead.


But which one of these would be appropriate for a "mailbox channel" that
doesn't have any actual messages?

  mbox_send_message(chan, NULL)
or 
  const int one = 1;
  mbox_send_message(chan, (void*)&one);

> The driver bypassed mailbox framework and was pushed via another tree.

> Same is being attempted now, only now it is more expensive to switch

> to generic mailbox framework having spent so much time on QCOM

> specific implementation of controller and protocol drivers inside

> drivers/soc/qcom/


I'm not sure I follow this, there's no extensive rework going on here -
all I'm trying to do is abstract the "writel(BIT(x), ipc_reg)" line of
the RPM driver, because it's being used in other clients as well.

Regards,
Bjorn
--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jassi Brar May 4, 2017, 7:54 a.m. UTC | #2
On Thu, May 4, 2017 at 11:15 AM, Bjorn Andersson
<bjorn.andersson@linaro.org> wrote:
> On Wed 03 May 02:55 PDT 2017, Jassi Brar wrote:

>

>> Loic, thanks for adding me.

>>

>> On Wed, May 3, 2017 at 2:58 PM, Loic PALLARDY <loic.pallardy@st.com> wrote:

>> >

>> >

>> >> -----Original Message-----

>> >> From: linux-remoteproc-owner@vger.kernel.org [mailto:linux-remoteproc-

>> >> owner@vger.kernel.org] On Behalf Of Bjorn Andersson

>> >> Sent: Wednesday, May 03, 2017 7:29 AM

>> >> To: Andy Gross <andy.gross@linaro.org>; Rob Herring

>> >> <robh+dt@kernel.org>; Mark Rutland <mark.rutland@arm.com>; Ohad Ben-

>> >> Cohen <ohad@wizery.com>

>> >> Cc: linux-arm-msm@vger.kernel.org; linux-soc@vger.kernel.org;

>> >> devicetree@vger.kernel.org; linux-kernel@vger.kernel.org; linux-

>> >> remoteproc@vger.kernel.org

>> >> Subject: [PATCH v3 2/4] soc: qcom: Introduce APCS IPC driver

>> >>

>> >> This implements a driver that exposes the IPC bits found in the APCS Global

>> >> block in various Qualcomm platforms. The bits are used to signal inter-

>> >> processor communication signals from the application CPU to other masters.

>> >>

>> >> The driver implements the "doorbell" binding and could be used as basis for a

>> >> new Linux framework, if found useful outside Qualcomm.

>> >>

>> > Hi Bjorn,

>> >

>> > Even if Qualcom APCS IPC is limited, why don't you rely on existing mailbox framework.

>> > It is there to gather all IPC management under the same interface.

>> > No need to create a new one from my pov.

>> > If you don't provide message data, mailbox framework behaves as doorbell.

>> >

>> QCOM RPM reinvented the wheel for what mailbox framework already did,

>> despite my pointing it out =>

>> http://lkml.iu.edu/hypermail//linux/kernel/1406.2/03918.html

>>

>

> The RPM interface works by writing various information in shared DRAM

> and then invoking an interrupt on the remote processor.

>

This is what _most_ platforms do, and they use mailbox framework. If
mailbox framework doesn't suit RPM, then it doesn't suit most
platforms that use it.

> My argumentation against using the mailbox framework for the RPM case

> was that the message model is a software construct and doesn't fit the

> mailbox framework.

>

Mailbox framework works beneath protocol layer (software construct).
As I said years ago, the h/w bits of the controller should be under
mailbox api, while the message structures and signals are protocol
specific and be in QCOM specific location.


> Before "inventing" the function for acquiring a handle to a doorbell I

> did look at making this a mailbox controller, but as each mailbox

> channel related to a single bit and 1 is the only value we'll ever write

> it didn't feel like it matches the mailbox expectations. But as you seem

> to object I'll attempt to rewrite it using the mailbox framework

> instead.

>

Yes, please. 1-bit messages are just a special case of N-bits messages
that mailbox framework supports.


> But which one of these would be appropriate for a "mailbox channel" that

> doesn't have any actual messages?

>

>   mbox_send_message(chan, NULL)

> or

>   const int one = 1;

>   mbox_send_message(chan, (void*)&one);

>

It depends upon your h/w.
If each physical channel is hardwired to work on a predefined single
bit, then the driver could do without that bit being explicitly
passed.
If a physical channel can be mapped onto any bit(s), then you do need
to pass that info via mbox_send_message().


>> The driver bypassed mailbox framework and was pushed via another tree.

>> Same is being attempted now, only now it is more expensive to switch

>> to generic mailbox framework having spent so much time on QCOM

>> specific implementation of controller and protocol drivers inside

>> drivers/soc/qcom/

>

> I'm not sure I follow this, there's no extensive rework going on here -

> all I'm trying to do is abstract the "writel(BIT(x), ipc_reg)" line of

> the RPM driver, because it's being used in other clients as well.

>

No, I meant ideally RPM should have used mailbox api for the
controller programming, but moving to that now will be expensive
because you already developed huge code base around QCOM specific
mailbox implementation.

Regards.
--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jassi Brar May 4, 2017, 5 p.m. UTC | #3
On Thu, May 4, 2017 at 9:40 PM, Bjorn Andersson
<bjorn.andersson@linaro.org> wrote:
> On Thu 04 May 00:54 PDT 2017, Jassi Brar wrote:

>

>> On Thu, May 4, 2017 at 11:15 AM, Bjorn Andersson

>> <bjorn.andersson@linaro.org> wrote:

>> > On Wed 03 May 02:55 PDT 2017, Jassi Brar wrote:

>> >

>> >> Loic, thanks for adding me.

>> >>

>> >> On Wed, May 3, 2017 at 2:58 PM, Loic PALLARDY <loic.pallardy@st.com> wrote:

>> >> >

>> >> >

>> >> >> -----Original Message-----

>> >> >> From: linux-remoteproc-owner@vger.kernel.org [mailto:linux-remoteproc-

>> >> >> owner@vger.kernel.org] On Behalf Of Bjorn Andersson

>> >> >> Sent: Wednesday, May 03, 2017 7:29 AM

>> >> >> To: Andy Gross <andy.gross@linaro.org>; Rob Herring

>> >> >> <robh+dt@kernel.org>; Mark Rutland <mark.rutland@arm.com>; Ohad Ben-

>> >> >> Cohen <ohad@wizery.com>

>> >> >> Cc: linux-arm-msm@vger.kernel.org; linux-soc@vger.kernel.org;

>> >> >> devicetree@vger.kernel.org; linux-kernel@vger.kernel.org; linux-

>> >> >> remoteproc@vger.kernel.org

>> >> >> Subject: [PATCH v3 2/4] soc: qcom: Introduce APCS IPC driver

>> >> >>

>> >> >> This implements a driver that exposes the IPC bits found in the APCS Global

>> >> >> block in various Qualcomm platforms. The bits are used to signal inter-

>> >> >> processor communication signals from the application CPU to other masters.

>> >> >>

>> >> >> The driver implements the "doorbell" binding and could be used as basis for a

>> >> >> new Linux framework, if found useful outside Qualcomm.

>> >> >>

>> >> > Hi Bjorn,

>> >> >

>> >> > Even if Qualcom APCS IPC is limited, why don't you rely on existing mailbox framework.

>> >> > It is there to gather all IPC management under the same interface.

>> >> > No need to create a new one from my pov.

>> >> > If you don't provide message data, mailbox framework behaves as doorbell.

>> >> >

>> >> QCOM RPM reinvented the wheel for what mailbox framework already did,

>> >> despite my pointing it out =>

>> >> http://lkml.iu.edu/hypermail//linux/kernel/1406.2/03918.html

>> >>

>> >

>> > The RPM interface works by writing various information in shared DRAM

>> > and then invoking an interrupt on the remote processor.

>> >

>> This is what _most_ platforms do, and they use mailbox framework. If

>> mailbox framework doesn't suit RPM, then it doesn't suit most

>> platforms that use it.

>>

>> > My argumentation against using the mailbox framework for the RPM case

>> > was that the message model is a software construct and doesn't fit the

>> > mailbox framework.

>> >

>> Mailbox framework works beneath protocol layer (software construct).

>> As I said years ago, the h/w bits of the controller should be under

>> mailbox api, while the message structures and signals are protocol

>> specific and be in QCOM specific location.

>>

>

> Okay, now I finally get what you're saying. The RPM driver handles the

> protocol but the actual triggering of the remote interrupt should be

> done via the mailbox framework.

>

> That makes sense, until now I haven't seen the need for having a driver

> exposing the APCS IPC register (used by among others the RPM driver),

> but I will rewrite this patch as a mailbox controller and turn the RPM

> driver into a mailbox client.

>

Cool, thanks.

>>

>> > But which one of these would be appropriate for a "mailbox channel" that

>> > doesn't have any actual messages?

>> >

>> >   mbox_send_message(chan, NULL)

>> > or

>> >   const int one = 1;

>> >   mbox_send_message(chan, (void*)&one);

>> >

>> It depends upon your h/w.

>> If each physical channel is hardwired to work on a predefined single

>> bit, then the driver could do without that bit being explicitly

>> passed.

>> If a physical channel can be mapped onto any bit(s), then you do need

>> to pass that info via mbox_send_message().

>>

>

> It's a 32-bit register, writing a bit invokes the associated interrupt

> on some remote processor. I.e. bits 0, 1 and 2 represents different

> interrupts on the resource-power-management CPU while bit 12, 13, 14 and

> 15 will invoke interrupts on a modem CPU.

>

No problem. For such arrangement, you could have a channel per
interrupt/bit. Have the DT specify which bit goes as what interrupt to
which cpu. The controller driver would then associate each channel to
its 'bit' and a client would always acquire the right channel
(specified by DT) and need not know/pass which bit should be set for
its messages i.e, mbox_send_message(chan, NULL)

> I'll rework the proposed driver and we can look at the actual

> implementation instead.

>

>>

>> >> The driver bypassed mailbox framework and was pushed via another tree.

>> >> Same is being attempted now, only now it is more expensive to switch

>> >> to generic mailbox framework having spent so much time on QCOM

>> >> specific implementation of controller and protocol drivers inside

>> >> drivers/soc/qcom/

>> >

>> > I'm not sure I follow this, there's no extensive rework going on here -

>> > all I'm trying to do is abstract the "writel(BIT(x), ipc_reg)" line of

>> > the RPM driver, because it's being used in other clients as well.

>> >

>> No, I meant ideally RPM should have used mailbox api for the

>> controller programming, but moving to that now will be expensive

>> because you already developed huge code base around QCOM specific

>> mailbox implementation.

>>

>

> The part discussed above was implemented using syscon, so it's a few

> lines of code to grab hold of a handle and instead of

> mbox_send_message() there is a single call to regmap_write(). All the

> other parts of the implementation is protocol-specific, and as you say

> the next layer up. So the transition is quite straight forward!

>

Great!

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/doorbell/doorbell.txt b/Documentation/devicetree/bindings/doorbell/doorbell.txt
new file mode 100644
index 000000000000..8fd814898c3f
--- /dev/null
+++ b/Documentation/devicetree/bindings/doorbell/doorbell.txt
@@ -0,0 +1,31 @@ 
+Doorbell binding
+============================================
+
+The doorbell binding is used to describe a set of doorbells for client blocks
+to ring.
+
+1) Doorbell controller
+----------------------
+
+A doorbell controller is a device that exposes a number of doorbells, that can
+client devices can ring to signal some event to some piece of hardware.
+
+- #doorbell-cells:
+	Usage: required
+	Value type: <u32>
+	Definition: should be 0 for single-doorbell controllers and 1 for
+		    multi-doorbell controllers
+
+2) Doorbell user
+----------------
+
+- doorbells:
+	Usage: required
+	Value type: <prop-encoded-array>
+	Definition: list of doorbell references
+
+- doorbell-names:
+	Usage: optional
+	Value type: <stringlist>
+	Definition: list of strings identifying each entry in the doorbells
+		    property
diff --git a/Documentation/devicetree/bindings/doorbell/qcom,apcs-kpss-global.txt b/Documentation/devicetree/bindings/doorbell/qcom,apcs-kpss-global.txt
new file mode 100644
index 000000000000..6320e1a355cb
--- /dev/null
+++ b/Documentation/devicetree/bindings/doorbell/qcom,apcs-kpss-global.txt
@@ -0,0 +1,45 @@ 
+Binding for the Qualcomm APCS global block
+==========================================
+
+This binding describes the APCS "global" block found in various Qualcomm
+platforms.
+
+- compatible:
+	Usage: required
+	Value type: <string>
+	Definition: must be one of:
+		    "qcom,msm8916-apcs-kpss-global",
+		    "qcom,msm8996-apcs-hmss-global"
+
+- reg:
+	Usage: required
+	Value type: <prop-encoded-array>
+	Definition: must specify the base address and size of the global block
+
+- #doorbell-cells:
+	Usage: required
+	Value type: <u32>
+	Definition: as described in doorbell.txt, must be 1
+
+
+= EXAMPLE
+The following example describes the APCS HMSS found in MSM8996 and part of the
+GLINK RPM referencing the "rpm_hlos" doorbell therein.
+
+	apcs_glb: apcs-glb@9820000 {
+		compatible = "qcom,msm8996-apcs-hmss-global";
+		reg = <0x9820000 0x1000>;
+
+		#doorbell-cells = <1>;
+	};
+
+        rpm-glink {
+                compatible = "qcom,glink-rpm";
+
+                interrupts = <GIC_SPI 168 IRQ_TYPE_EDGE_RISING>;
+
+                qcom,rpm-msg-ram = <&rpm_msg_ram>;
+
+		doorbells = <&apcs_glb 0>;
+	};
+