diff mbox series

[2/3] dt-bindings: serial: tegra-tcu: Document "reg" property

Message ID 20210326174641.1612738-3-thierry.reding@gmail.com
State New
Headers show
Series [1/3] dt-bindings: serial: tegra-tcu: Convert to json-schema | expand

Commit Message

Thierry Reding March 26, 2021, 5:46 p.m. UTC
From: Thierry Reding <treding@nvidia.com>

In order to support early console support with the Tegra TCU, add an
optional "reg" property that points to the TX mailbox.

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 .../devicetree/bindings/serial/nvidia,tegra194-tcu.yaml     | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Rob Herring March 27, 2021, 6:49 p.m. UTC | #1
On Fri, Mar 26, 2021 at 06:46:40PM +0100, Thierry Reding wrote:
> From: Thierry Reding <treding@nvidia.com>

> 

> In order to support early console support with the Tegra TCU, add an

> optional "reg" property that points to the TX mailbox.


This will mean the same address in in DT twice which we try to avoid, 
right? I guess it's fine, we could drop it if we ever enforce that. I'm 
sure there's worse abuses with duplicates than this.

> 

> Signed-off-by: Thierry Reding <treding@nvidia.com>

> ---

>  .../devicetree/bindings/serial/nvidia,tegra194-tcu.yaml     | 6 +++++-

>  1 file changed, 5 insertions(+), 1 deletion(-)

> 

> diff --git a/Documentation/devicetree/bindings/serial/nvidia,tegra194-tcu.yaml b/Documentation/devicetree/bindings/serial/nvidia,tegra194-tcu.yaml

> index 0a321658ccb5..8c9ed7cfaa52 100644

> --- a/Documentation/devicetree/bindings/serial/nvidia,tegra194-tcu.yaml

> +++ b/Documentation/devicetree/bindings/serial/nvidia,tegra194-tcu.yaml

> @@ -24,6 +24,9 @@ properties:

>    compatible:

>      const: nvidia,tegra194-tcu

>  

> +  reg:

> +    maxItems: 1

> +

>    mbox-names:

>      items:

>        - const: rx

> @@ -48,8 +51,9 @@ examples:

>    - |

>      #include <dt-bindings/mailbox/tegra186-hsp.h>

>  

> -    tcu: tcu {

> +    tcu: tcu@c168000 {


While you're here:

serial@...

>          compatible = "nvidia,tegra194-tcu";

> +        reg = <0x0c168000 0x4>;

>          mboxes = <&hsp_top0 TEGRA_HSP_MBOX_TYPE_SM 0>,

>                   <&hsp_aon TEGRA_HSP_MBOX_TYPE_SM 1>;

>          mbox-names = "rx", "tx";

> -- 

> 2.30.2

>
Thierry Reding March 29, 2021, 7:23 a.m. UTC | #2
On Sat, Mar 27, 2021 at 12:49:25PM -0600, Rob Herring wrote:
> On Fri, Mar 26, 2021 at 06:46:40PM +0100, Thierry Reding wrote:

> > From: Thierry Reding <treding@nvidia.com>

> > 

> > In order to support early console support with the Tegra TCU, add an

> > optional "reg" property that points to the TX mailbox.

> 

> This will mean the same address in in DT twice which we try to avoid, 

> right? I guess it's fine, we could drop it if we ever enforce that. I'm 

> sure there's worse abuses with duplicates than this.


It doesn't end up being the exact same address, but it'll be an address
that is part of the I/O memory region defined by the HSP block that
provides the mailbox. In practice this isn't going to cause a problem
because by the time the mailbox address is being used, the early console
will have been replaced by the proper TCU console. But yeah, I'm not
particularly thrilled by this, either.

I had spent a bit of time trying to code up a setup function that would
parse the necessary information from DT, but this unfortunately required
a bunch of ->setup() callbacks to be changed because we don't currently
pass in the FDT node offset, which we'd need in order for this to work.
An additional negative side-effect is that we'd need to duplicate a
bunch of logic to determine the offset to add onto the HSP base address
and that's something that depends on the particular configuration of the
HSP instance, which means lots of hard-coded conditionals.

All of that added up and at some point this slight abuse seemed like the
lesser evil.

> > Signed-off-by: Thierry Reding <treding@nvidia.com>

> > ---

> >  .../devicetree/bindings/serial/nvidia,tegra194-tcu.yaml     | 6 +++++-

> >  1 file changed, 5 insertions(+), 1 deletion(-)

> > 

> > diff --git a/Documentation/devicetree/bindings/serial/nvidia,tegra194-tcu.yaml b/Documentation/devicetree/bindings/serial/nvidia,tegra194-tcu.yaml

> > index 0a321658ccb5..8c9ed7cfaa52 100644

> > --- a/Documentation/devicetree/bindings/serial/nvidia,tegra194-tcu.yaml

> > +++ b/Documentation/devicetree/bindings/serial/nvidia,tegra194-tcu.yaml

> > @@ -24,6 +24,9 @@ properties:

> >    compatible:

> >      const: nvidia,tegra194-tcu

> >  

> > +  reg:

> > +    maxItems: 1

> > +

> >    mbox-names:

> >      items:

> >        - const: rx

> > @@ -48,8 +51,9 @@ examples:

> >    - |

> >      #include <dt-bindings/mailbox/tegra186-hsp.h>

> >  

> > -    tcu: tcu {

> > +    tcu: tcu@c168000 {

> 

> While you're here:

> 

> serial@...


Okay, will do. It's not a very traditional serial port, so that might
perhaps be confusing, but we're using it like a serial port, so for all
intents and purposes this really is a serial port, so renaming makes
sense, I think.

Thierry
Thierry Reding March 29, 2021, 7:26 a.m. UTC | #3
On Sat, Mar 27, 2021 at 12:49:25PM -0600, Rob Herring wrote:
> On Fri, Mar 26, 2021 at 06:46:40PM +0100, Thierry Reding wrote:

> > From: Thierry Reding <treding@nvidia.com>

> > 

> > In order to support early console support with the Tegra TCU, add an

> > optional "reg" property that points to the TX mailbox.

> 

> This will mean the same address in in DT twice which we try to avoid, 

> right? I guess it's fine, we could drop it if we ever enforce that. I'm 

> sure there's worse abuses with duplicates than this.

> 

> > 

> > Signed-off-by: Thierry Reding <treding@nvidia.com>

> > ---

> >  .../devicetree/bindings/serial/nvidia,tegra194-tcu.yaml     | 6 +++++-

> >  1 file changed, 5 insertions(+), 1 deletion(-)

> > 

> > diff --git a/Documentation/devicetree/bindings/serial/nvidia,tegra194-tcu.yaml b/Documentation/devicetree/bindings/serial/nvidia,tegra194-tcu.yaml

> > index 0a321658ccb5..8c9ed7cfaa52 100644

> > --- a/Documentation/devicetree/bindings/serial/nvidia,tegra194-tcu.yaml

> > +++ b/Documentation/devicetree/bindings/serial/nvidia,tegra194-tcu.yaml

> > @@ -24,6 +24,9 @@ properties:

> >    compatible:

> >      const: nvidia,tegra194-tcu

> >  

> > +  reg:

> > +    maxItems: 1

> > +


After looking at this again, I think I may add a comment here to clarify
the restrictions of this property.

Thierry
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/serial/nvidia,tegra194-tcu.yaml b/Documentation/devicetree/bindings/serial/nvidia,tegra194-tcu.yaml
index 0a321658ccb5..8c9ed7cfaa52 100644
--- a/Documentation/devicetree/bindings/serial/nvidia,tegra194-tcu.yaml
+++ b/Documentation/devicetree/bindings/serial/nvidia,tegra194-tcu.yaml
@@ -24,6 +24,9 @@  properties:
   compatible:
     const: nvidia,tegra194-tcu
 
+  reg:
+    maxItems: 1
+
   mbox-names:
     items:
       - const: rx
@@ -48,8 +51,9 @@  examples:
   - |
     #include <dt-bindings/mailbox/tegra186-hsp.h>
 
-    tcu: tcu {
+    tcu: tcu@c168000 {
         compatible = "nvidia,tegra194-tcu";
+        reg = <0x0c168000 0x4>;
         mboxes = <&hsp_top0 TEGRA_HSP_MBOX_TYPE_SM 0>,
                  <&hsp_aon TEGRA_HSP_MBOX_TYPE_SM 1>;
         mbox-names = "rx", "tx";