linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] dt-bindings: dma: ti: k3* : Update optional reg regions
@ 2023-08-10 17:43 Vignesh Raghavendra
  2023-08-10 17:43 ` [PATCH 1/3] dt-bindings: dma: ti: k3-bcdma: Describe cfg register regions Vignesh Raghavendra
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Vignesh Raghavendra @ 2023-08-10 17:43 UTC (permalink / raw)
  To: Peter Ujfalusi, Vinod Koul, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley
  Cc: dmaengine, devicetree, linux-kernel, Vignesh Raghavendra,
	linux-arm-kernel

DMAs on TI K3 SoCs have channel configuration registers region which are
usually hidden from Linux and configured via Device Manager Firmware
APIs. But certain early SWs like bootloader which run before Device
Manager is fully up would need to directly configure these registers and
thus require to be in DT description.

This add bindings for such configuration regions.  Backward
compatibility is maintained to existing DT by only mandating existing
regions to be present and this new region as optional.

Vignesh Raghavendra (3):
  dt-bindings: dma: ti: k3-bcdma: Describe cfg register regions
  dt-bindings: dma: ti: k3-pktdma: Describe cfg register regions
  dt-bindings: dma: ti: k3-udma: Describe cfg register regions

 .../devicetree/bindings/dma/ti/k3-bcdma.yaml  | 25 +++++++++++++------
 .../devicetree/bindings/dma/ti/k3-pktdma.yaml | 18 ++++++++++---
 .../devicetree/bindings/dma/ti/k3-udma.yaml   | 14 ++++++++---
 3 files changed, 43 insertions(+), 14 deletions(-)

-- 
2.41.0


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

* [PATCH 1/3] dt-bindings: dma: ti: k3-bcdma: Describe cfg register regions
  2023-08-10 17:43 [PATCH 0/3] dt-bindings: dma: ti: k3* : Update optional reg regions Vignesh Raghavendra
@ 2023-08-10 17:43 ` Vignesh Raghavendra
  2023-08-10 18:35   ` Conor Dooley
  2023-08-27  7:06   ` Péter Ujfalusi
  2023-08-10 17:43 ` [PATCH 2/3] dt-bindings: dma: ti: k3-pktdma: " Vignesh Raghavendra
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 11+ messages in thread
From: Vignesh Raghavendra @ 2023-08-10 17:43 UTC (permalink / raw)
  To: Peter Ujfalusi, Vinod Koul, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley
  Cc: dmaengine, devicetree, linux-kernel, Vignesh Raghavendra,
	linux-arm-kernel

Block copy DMA(BCDMA)module on K3 SoCs have ring cfg, TX and RX
channel cfg register regions which are usually configured by a Device
Management firmware. But certain entities such as bootloader (like
U-Boot) may have to access them directly. Describe this region in the
binding documentation for completeness of module description.

Keep the binding compatible with existing DTS files by requiring first
five regions to be present at least.

Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
---
 .../devicetree/bindings/dma/ti/k3-bcdma.yaml  | 25 +++++++++++++------
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml b/Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml
index 4ca300a42a99..d166e284532b 100644
--- a/Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml
+++ b/Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml
@@ -37,11 +37,11 @@ properties:
 
   reg:
     minItems: 3
-    maxItems: 5
+    maxItems: 8
 
   reg-names:
     minItems: 3
-    maxItems: 5
+    maxItems: 8
 
   "#dma-cells":
     const: 3
@@ -161,14 +161,19 @@ allOf:
       properties:
         reg:
           minItems: 5
+          maxItems: 8
 
         reg-names:
+          minItems: 5
           items:
             - const: gcfg
             - const: bchanrt
             - const: rchanrt
             - const: tchanrt
             - const: ringrt
+            - const: cfg
+            - const: tchan
+            - const: rchan
 
       required:
         - ti,sci-rm-range-bchan
@@ -216,12 +221,16 @@ examples:
             main_bcdma: dma-controller@485c0100 {
                 compatible = "ti,am64-dmss-bcdma";
 
-                reg = <0x0 0x485c0100 0x0 0x100>,
-                      <0x0 0x4c000000 0x0 0x20000>,
-                      <0x0 0x4a820000 0x0 0x20000>,
-                      <0x0 0x4aa40000 0x0 0x20000>,
-                      <0x0 0x4bc00000 0x0 0x100000>;
-                reg-names = "gcfg", "bchanrt", "rchanrt", "tchanrt", "ringrt";
+                reg = <0x00 0x485c0100 0x00 0x100>,
+                      <0x00 0x4c000000 0x00 0x20000>,
+                      <0x00 0x4a820000 0x00 0x20000>,
+                      <0x00 0x4aa40000 0x00 0x20000>,
+                      <0x00 0x4bc00000 0x00 0x100000>,
+                      <0x00 0x48600000 0x00 0x8000>,
+                      <0x00 0x484a4000 0x00 0x2000>,
+                      <0x00 0x484c2000 0x00 0x2000>;
+                reg-names = "gcfg", "bchanrt", "rchanrt", "tchanrt", "ringrt",
+                            "cfg", "tchan", "rchan";
                 msi-parent = <&inta_main_dmss>;
                 #dma-cells = <3>;
 
-- 
2.41.0


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

* [PATCH 2/3] dt-bindings: dma: ti: k3-pktdma: Describe cfg register regions
  2023-08-10 17:43 [PATCH 0/3] dt-bindings: dma: ti: k3* : Update optional reg regions Vignesh Raghavendra
  2023-08-10 17:43 ` [PATCH 1/3] dt-bindings: dma: ti: k3-bcdma: Describe cfg register regions Vignesh Raghavendra
@ 2023-08-10 17:43 ` Vignesh Raghavendra
  2023-08-27  7:10   ` Péter Ujfalusi
  2023-08-10 17:43 ` [PATCH 3/3] dt-bindings: dma: ti: k3-udma: " Vignesh Raghavendra
  2023-08-11 15:16 ` [PATCH 0/3] dt-bindings: dma: ti: k3* : Update optional reg regions Péter Ujfalusi
  3 siblings, 1 reply; 11+ messages in thread
From: Vignesh Raghavendra @ 2023-08-10 17:43 UTC (permalink / raw)
  To: Peter Ujfalusi, Vinod Koul, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley
  Cc: dmaengine, devicetree, linux-kernel, Vignesh Raghavendra,
	linux-arm-kernel

Packet DMA (PKTDMA) module on K3 SoCs have ring cfg, TX and RX channel
cfg and RX flow cfg register regions which are usually configured by a
Device Management firmware. But certain entities such as bootloader
(like U-Boot) may have to access them directly. Describe this region in
the binding documentation for completeness of module description.

Keep the binding compatible with existing DTS files by requiring first
four regions to be present at least.

Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
---
 .../devicetree/bindings/dma/ti/k3-pktdma.yaml  | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/dma/ti/k3-pktdma.yaml b/Documentation/devicetree/bindings/dma/ti/k3-pktdma.yaml
index a69f62f854d8..5f9ba4bb05f6 100644
--- a/Documentation/devicetree/bindings/dma/ti/k3-pktdma.yaml
+++ b/Documentation/devicetree/bindings/dma/ti/k3-pktdma.yaml
@@ -45,14 +45,20 @@ properties:
       The second cell is the ASEL value for the channel
 
   reg:
-    maxItems: 4
+    minItems: 4
+    maxItems: 8
 
   reg-names:
+    minItems: 4
     items:
       - const: gcfg
       - const: rchanrt
       - const: tchanrt
       - const: ringrt
+      - const: cfg
+      - const: tchan
+      - const: rchan
+      - const: rflow
 
   msi-parent: true
 
@@ -136,8 +142,14 @@ examples:
                 reg = <0x0 0x485c0000 0x0 0x100>,
                       <0x0 0x4a800000 0x0 0x20000>,
                       <0x0 0x4aa00000 0x0 0x40000>,
-                      <0x0 0x4b800000 0x0 0x400000>;
-                reg-names = "gcfg", "rchanrt", "tchanrt", "ringrt";
+                      <0x0 0x4b800000 0x0 0x400000>,
+                      <0x00 0x485e0000 0x00 0x20000>,
+                      <0x00 0x484a0000 0x00 0x4000>,
+                      <0x00 0x484c0000 0x00 0x2000>,
+                      <0x00 0x48430000 0x00 0x4000>;
+                reg-names = "gcfg", "rchanrt", "tchanrt", "ringrt",
+                            "cfg", "tchan", "rchan", "rflow";
+
                 msi-parent = <&inta_main_dmss>;
                 #dma-cells = <2>;
 
-- 
2.41.0


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

* [PATCH 3/3] dt-bindings: dma: ti: k3-udma: Describe cfg register regions
  2023-08-10 17:43 [PATCH 0/3] dt-bindings: dma: ti: k3* : Update optional reg regions Vignesh Raghavendra
  2023-08-10 17:43 ` [PATCH 1/3] dt-bindings: dma: ti: k3-bcdma: Describe cfg register regions Vignesh Raghavendra
  2023-08-10 17:43 ` [PATCH 2/3] dt-bindings: dma: ti: k3-pktdma: " Vignesh Raghavendra
@ 2023-08-10 17:43 ` Vignesh Raghavendra
  2023-08-11 15:16 ` [PATCH 0/3] dt-bindings: dma: ti: k3* : Update optional reg regions Péter Ujfalusi
  3 siblings, 0 replies; 11+ messages in thread
From: Vignesh Raghavendra @ 2023-08-10 17:43 UTC (permalink / raw)
  To: Peter Ujfalusi, Vinod Koul, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley
  Cc: dmaengine, devicetree, linux-kernel, Vignesh Raghavendra,
	linux-arm-kernel

Unified DMA (UDMA) module on K3 SoCs have TX and RX channel cfg and RX
flow cfg register regions which are usually configured by a Device
Management firmware. But certain entities such as bootloader (like
U-Boot) may have to access them directly. Describe this region in the
binding documentation for completeness of module description.

Keep the binding compatible with existing DTS files by requiring first
four regions to be present at least.

Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
---
 .../devicetree/bindings/dma/ti/k3-udma.yaml        | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/dma/ti/k3-udma.yaml b/Documentation/devicetree/bindings/dma/ti/k3-udma.yaml
index 22f6c5e2f7f4..f0d7c3a4d205 100644
--- a/Documentation/devicetree/bindings/dma/ti/k3-udma.yaml
+++ b/Documentation/devicetree/bindings/dma/ti/k3-udma.yaml
@@ -69,13 +69,18 @@ properties:
       - ti,j721e-navss-mcu-udmap
 
   reg:
-    maxItems: 3
+    minItems: 3
+    maxItems: 6
 
   reg-names:
+    minItems: 3
     items:
       - const: gcfg
       - const: rchanrt
       - const: tchanrt
+      - const: tchan
+      - const: rchan
+      - const: rflow
 
   msi-parent: true
 
@@ -158,8 +163,11 @@ examples:
                 compatible = "ti,am654-navss-main-udmap";
                 reg = <0x0 0x31150000 0x0 0x100>,
                       <0x0 0x34000000 0x0 0x100000>,
-                      <0x0 0x35000000 0x0 0x100000>;
-                reg-names = "gcfg", "rchanrt", "tchanrt";
+                      <0x0 0x35000000 0x0 0x100000>,
+                      <0x0 0x30b00000 0x0 0x20000>,
+                      <0x0 0x30c00000 0x0 0x8000>,
+                      <0x0 0x30d00000 0x0 0x4000>;
+                reg-names = "gcfg", "rchanrt", "tchanrt", "tchan", "rchan", "rflow";
                 #dma-cells = <1>;
 
                 ti,ringacc = <&ringacc>;
-- 
2.41.0


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

* Re: [PATCH 1/3] dt-bindings: dma: ti: k3-bcdma: Describe cfg register regions
  2023-08-10 17:43 ` [PATCH 1/3] dt-bindings: dma: ti: k3-bcdma: Describe cfg register regions Vignesh Raghavendra
@ 2023-08-10 18:35   ` Conor Dooley
  2023-08-11  4:38     ` Vignesh Raghavendra
  2023-08-27  7:06   ` Péter Ujfalusi
  1 sibling, 1 reply; 11+ messages in thread
From: Conor Dooley @ 2023-08-10 18:35 UTC (permalink / raw)
  To: Vignesh Raghavendra
  Cc: Peter Ujfalusi, Vinod Koul, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, dmaengine, devicetree, linux-kernel,
	linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 3186 bytes --]

On Thu, Aug 10, 2023 at 11:13:53PM +0530, Vignesh Raghavendra wrote:
> Block copy DMA(BCDMA)module on K3 SoCs have ring cfg, TX and RX
> channel cfg register regions which are usually configured by a Device
> Management firmware. But certain entities such as bootloader (like
> U-Boot) may have to access them directly. Describe this region in the
> binding documentation for completeness of module description.
> 
> Keep the binding compatible with existing DTS files by requiring first
> five regions to be present at least.
> 
> Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
> ---
>  .../devicetree/bindings/dma/ti/k3-bcdma.yaml  | 25 +++++++++++++------
>  1 file changed, 17 insertions(+), 8 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml b/Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml
> index 4ca300a42a99..d166e284532b 100644
> --- a/Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml
> +++ b/Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml
> @@ -37,11 +37,11 @@ properties:
>  
>    reg:
>      minItems: 3
> -    maxItems: 5
> +    maxItems: 8

How come none of these reg entries have a description? What
differentiates a "gcfg" from a "cfg" for example?

>  
>    reg-names:
>      minItems: 3
> -    maxItems: 5
> +    maxItems: 8
>  
>    "#dma-cells":
>      const: 3
> @@ -161,14 +161,19 @@ allOf:
>        properties:
>          reg:
>            minItems: 5
> +          maxItems: 8
>  
>          reg-names:
> +          minItems: 5
>            items:
>              - const: gcfg
>              - const: bchanrt
>              - const: rchanrt
>              - const: tchanrt
>              - const: ringrt
> +            - const: cfg
> +            - const: tchan
> +            - const: rchan
>  
>        required:
>          - ti,sci-rm-range-bchan
> @@ -216,12 +221,16 @@ examples:
>              main_bcdma: dma-controller@485c0100 {
>                  compatible = "ti,am64-dmss-bcdma";
>  
> -                reg = <0x0 0x485c0100 0x0 0x100>,
> -                      <0x0 0x4c000000 0x0 0x20000>,
> -                      <0x0 0x4a820000 0x0 0x20000>,
> -                      <0x0 0x4aa40000 0x0 0x20000>,
> -                      <0x0 0x4bc00000 0x0 0x100000>;
> -                reg-names = "gcfg", "bchanrt", "rchanrt", "tchanrt", "ringrt";
> +                reg = <0x00 0x485c0100 0x00 0x100>,

Why have you added extra zeros? (0x00)

Thanks,
Conor.

> +                      <0x00 0x4c000000 0x00 0x20000>,
> +                      <0x00 0x4a820000 0x00 0x20000>,
> +                      <0x00 0x4aa40000 0x00 0x20000>,
> +                      <0x00 0x4bc00000 0x00 0x100000>,
> +                      <0x00 0x48600000 0x00 0x8000>,
> +                      <0x00 0x484a4000 0x00 0x2000>,
> +                      <0x00 0x484c2000 0x00 0x2000>;
> +                reg-names = "gcfg", "bchanrt", "rchanrt", "tchanrt", "ringrt",
> +                            "cfg", "tchan", "rchan";
>                  msi-parent = <&inta_main_dmss>;
>                  #dma-cells = <3>;
>  
> -- 
> 2.41.0
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [PATCH 1/3] dt-bindings: dma: ti: k3-bcdma: Describe cfg register regions
  2023-08-10 18:35   ` Conor Dooley
@ 2023-08-11  4:38     ` Vignesh Raghavendra
  0 siblings, 0 replies; 11+ messages in thread
From: Vignesh Raghavendra @ 2023-08-11  4:38 UTC (permalink / raw)
  To: Conor Dooley
  Cc: Peter Ujfalusi, Vinod Koul, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, dmaengine, devicetree, linux-kernel,
	linux-arm-kernel



On 11/08/23 00:05, Conor Dooley wrote:
> On Thu, Aug 10, 2023 at 11:13:53PM +0530, Vignesh Raghavendra wrote:
>> Block copy DMA(BCDMA)module on K3 SoCs have ring cfg, TX and RX
>> channel cfg register regions which are usually configured by a Device
>> Management firmware. But certain entities such as bootloader (like
>> U-Boot) may have to access them directly. Describe this region in the
>> binding documentation for completeness of module description.
>>
>> Keep the binding compatible with existing DTS files by requiring first
>> five regions to be present at least.
>>
>> Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
>> ---
>>  .../devicetree/bindings/dma/ti/k3-bcdma.yaml  | 25 +++++++++++++------
>>  1 file changed, 17 insertions(+), 8 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml b/Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml
>> index 4ca300a42a99..d166e284532b 100644
>> --- a/Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml
>> +++ b/Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml
>> @@ -37,11 +37,11 @@ properties:
>>  
>>    reg:
>>      minItems: 3
>> -    maxItems: 5
>> +    maxItems: 8
> 
> How come none of these reg entries have a description? What
> differentiates a "gcfg" from a "cfg" for example?
> 

Ok, I will a patch to describe the regions first before adding new ones.

>>  
>>    reg-names:
>>      minItems: 3
>> -    maxItems: 5
>> +    maxItems: 8
>>  
>>    "#dma-cells":
>>      const: 3
>> @@ -161,14 +161,19 @@ allOf:
>>        properties:
>>          reg:
>>            minItems: 5
>> +          maxItems: 8
>>  
>>          reg-names:
>> +          minItems: 5
>>            items:
>>              - const: gcfg
>>              - const: bchanrt
>>              - const: rchanrt
>>              - const: tchanrt
>>              - const: ringrt
>> +            - const: cfg
>> +            - const: tchan
>> +            - const: rchan
>>  
>>        required:
>>          - ti,sci-rm-range-bchan
>> @@ -216,12 +221,16 @@ examples:
>>              main_bcdma: dma-controller@485c0100 {
>>                  compatible = "ti,am64-dmss-bcdma";
>>  
>> -                reg = <0x0 0x485c0100 0x0 0x100>,
>> -                      <0x0 0x4c000000 0x0 0x20000>,
>> -                      <0x0 0x4a820000 0x0 0x20000>,
>> -                      <0x0 0x4aa40000 0x0 0x20000>,
>> -                      <0x0 0x4bc00000 0x0 0x100000>;
>> -                reg-names = "gcfg", "bchanrt", "rchanrt", "tchanrt", "ringrt";
>> +                reg = <0x00 0x485c0100 0x00 0x100>,
> 
> Why have you added extra zeros? (0x00)

Sorry, copy paste error, was trying to copy example from real DT that
use 0x00. Will fix. Thanks!

> 
> Thanks,
> Conor.
> 
>> +                      <0x00 0x4c000000 0x00 0x20000>,
>> +                      <0x00 0x4a820000 0x00 0x20000>,
>> +                      <0x00 0x4aa40000 0x00 0x20000>,
>> +                      <0x00 0x4bc00000 0x00 0x100000>,
>> +                      <0x00 0x48600000 0x00 0x8000>,
>> +                      <0x00 0x484a4000 0x00 0x2000>,
>> +                      <0x00 0x484c2000 0x00 0x2000>;
>> +                reg-names = "gcfg", "bchanrt", "rchanrt", "tchanrt", "ringrt",
>> +                            "cfg", "tchan", "rchan";
>>                  msi-parent = <&inta_main_dmss>;
>>                  #dma-cells = <3>;
>>  
>> -- 
>> 2.41.0
>>

-- 
Regards
Vignesh

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

* Re: [PATCH 0/3] dt-bindings: dma: ti: k3* : Update optional reg regions
  2023-08-10 17:43 [PATCH 0/3] dt-bindings: dma: ti: k3* : Update optional reg regions Vignesh Raghavendra
                   ` (2 preceding siblings ...)
  2023-08-10 17:43 ` [PATCH 3/3] dt-bindings: dma: ti: k3-udma: " Vignesh Raghavendra
@ 2023-08-11 15:16 ` Péter Ujfalusi
  2023-08-11 16:04   ` Vignesh Raghavendra
  3 siblings, 1 reply; 11+ messages in thread
From: Péter Ujfalusi @ 2023-08-11 15:16 UTC (permalink / raw)
  To: Vignesh Raghavendra, Vinod Koul, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley
  Cc: dmaengine, devicetree, linux-kernel, linux-arm-kernel

Vignesh,

On 10/08/2023 20:43, Vignesh Raghavendra wrote:
> DMAs on TI K3 SoCs have channel configuration registers region which are
> usually hidden from Linux and configured via Device Manager Firmware
> APIs. But certain early SWs like bootloader which run before Device
> Manager is fully up would need to directly configure these registers and
> thus require to be in DT description.
> 
> This add bindings for such configuration regions.  Backward
> compatibility is maintained to existing DT by only mandating existing
> regions to be present and this new region as optional.

These regions were 'hidden' from Linux or other open coded access for a 
reason.
If I recall the main reason is security and the need to make sure that 
the allocation of the channels not been violated.

IMho the boot loader should be no exception and it should be using the 
DM firmware to configure the DMAs.

Or has the security concern been dropped and SW can do whatever it wants?

> 
> Vignesh Raghavendra (3):
>    dt-bindings: dma: ti: k3-bcdma: Describe cfg register regions
>    dt-bindings: dma: ti: k3-pktdma: Describe cfg register regions
>    dt-bindings: dma: ti: k3-udma: Describe cfg register regions
> 
>   .../devicetree/bindings/dma/ti/k3-bcdma.yaml  | 25 +++++++++++++------
>   .../devicetree/bindings/dma/ti/k3-pktdma.yaml | 18 ++++++++++---
>   .../devicetree/bindings/dma/ti/k3-udma.yaml   | 14 ++++++++---
>   3 files changed, 43 insertions(+), 14 deletions(-)
> 

-- 
Péter

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

* Re: [PATCH 0/3] dt-bindings: dma: ti: k3* : Update optional reg regions
  2023-08-11 15:16 ` [PATCH 0/3] dt-bindings: dma: ti: k3* : Update optional reg regions Péter Ujfalusi
@ 2023-08-11 16:04   ` Vignesh Raghavendra
  2023-08-27  7:18     ` Péter Ujfalusi
  0 siblings, 1 reply; 11+ messages in thread
From: Vignesh Raghavendra @ 2023-08-11 16:04 UTC (permalink / raw)
  To: Péter Ujfalusi, Vinod Koul, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley
  Cc: dmaengine, devicetree, linux-kernel, linux-arm-kernel

Hi Peter,

On 11/08/23 20:46, Péter Ujfalusi wrote:
> Vignesh,
> 
> On 10/08/2023 20:43, Vignesh Raghavendra wrote:
>> DMAs on TI K3 SoCs have channel configuration registers region which are
>> usually hidden from Linux and configured via Device Manager Firmware
>> APIs. But certain early SWs like bootloader which run before Device
>> Manager is fully up would need to directly configure these registers and
>> thus require to be in DT description.
>>
>> This add bindings for such configuration regions.  Backward
>> compatibility is maintained to existing DT by only mandating existing
>> regions to be present and this new region as optional.
> 
> These regions were 'hidden' from Linux or other open coded access for a
> reason.
> If I recall the main reason is security and the need to make sure that
> the allocation of the channels not been violated.
> 
> IMho the boot loader should be no exception and it should be using the
> DM firmware to configure the DMAs.
> 
> Or has the security concern been dropped and SW can do whatever it wants?

There is been a relook at the arch post this driver was upstreamed. 
System firmware (SYSFW) is now two separate components:  TI Foundational 
Security (TIFS) running in a secure island and Device Management (DM) 
firmware (runs on boot R5 core) [0] shows boot flow diagram for AM62x.

Security critical items such as PSIL pairing, channel firewalls and 
credential configurations are under TIFS and is handled via TI SCI calls 
at all times.

But, things related to resource configuration (to ensure different cores 
dont step on each other) is under DM. Linux still needs to talk to DM 
for configuring these regions. But, when primary bootloader (R5 SPL) is 
running, there isn't a DM firmware (as it runs on the same core after R5 
SPL), it would need to configure DMA resources on its own. 

This update is mainly to aid R5 SPL to reuse kernel DT as is. 
Hope that helps


[0] https://u-boot.readthedocs.io/en/latest/board/ti/am62x_sk.html?highlight=am62#boot-flow
(Similar boot flow for rest of K3 devices barring am65 and am64)

> 
>>
>> Vignesh Raghavendra (3):
>>    dt-bindings: dma: ti: k3-bcdma: Describe cfg register regions
>>    dt-bindings: dma: ti: k3-pktdma: Describe cfg register regions
>>    dt-bindings: dma: ti: k3-udma: Describe cfg register regions
>>
>>   .../devicetree/bindings/dma/ti/k3-bcdma.yaml  | 25 +++++++++++++------
>>   .../devicetree/bindings/dma/ti/k3-pktdma.yaml | 18 ++++++++++---
>>   .../devicetree/bindings/dma/ti/k3-udma.yaml   | 14 ++++++++---
>>   3 files changed, 43 insertions(+), 14 deletions(-)
>>
> 

-- 
Regards
Vignesh

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

* Re: [PATCH 1/3] dt-bindings: dma: ti: k3-bcdma: Describe cfg register regions
  2023-08-10 17:43 ` [PATCH 1/3] dt-bindings: dma: ti: k3-bcdma: Describe cfg register regions Vignesh Raghavendra
  2023-08-10 18:35   ` Conor Dooley
@ 2023-08-27  7:06   ` Péter Ujfalusi
  1 sibling, 0 replies; 11+ messages in thread
From: Péter Ujfalusi @ 2023-08-27  7:06 UTC (permalink / raw)
  To: Vignesh Raghavendra, Vinod Koul, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley
  Cc: dmaengine, devicetree, linux-kernel, linux-arm-kernel



On 10/08/2023 20:43, Vignesh Raghavendra wrote:
> Block copy DMA(BCDMA)module on K3 SoCs have ring cfg, TX and RX
> channel cfg register regions which are usually configured by a Device
> Management firmware. But certain entities such as bootloader (like
> U-Boot) may have to access them directly. Describe this region in the
> binding documentation for completeness of module description.
> 
> Keep the binding compatible with existing DTS files by requiring first
> five regions to be present at least.
> 
> Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
> ---
>  .../devicetree/bindings/dma/ti/k3-bcdma.yaml  | 25 +++++++++++++------
>  1 file changed, 17 insertions(+), 8 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml b/Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml
> index 4ca300a42a99..d166e284532b 100644
> --- a/Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml
> +++ b/Documentation/devicetree/bindings/dma/ti/k3-bcdma.yaml
> @@ -37,11 +37,11 @@ properties:
>  
>    reg:
>      minItems: 3
> -    maxItems: 5
> +    maxItems: 8
>  
>    reg-names:
>      minItems: 3
> -    maxItems: 5
> +    maxItems: 8
>  
>    "#dma-cells":
>      const: 3
> @@ -161,14 +161,19 @@ allOf:
>        properties:
>          reg:
>            minItems: 5
> +          maxItems: 8
>  
>          reg-names:
> +          minItems: 5
>            items:
>              - const: gcfg
>              - const: bchanrt
>              - const: rchanrt
>              - const: tchanrt
>              - const: ringrt
> +            - const: cfg
> +            - const: tchan
> +            - const: rchan
>  
>        required:
>          - ti,sci-rm-range-bchan
> @@ -216,12 +221,16 @@ examples:
>              main_bcdma: dma-controller@485c0100 {
>                  compatible = "ti,am64-dmss-bcdma";
>  
> -                reg = <0x0 0x485c0100 0x0 0x100>,
> -                      <0x0 0x4c000000 0x0 0x20000>,
> -                      <0x0 0x4a820000 0x0 0x20000>,
> -                      <0x0 0x4aa40000 0x0 0x20000>,
> -                      <0x0 0x4bc00000 0x0 0x100000>;
> -                reg-names = "gcfg", "bchanrt", "rchanrt", "tchanrt", "ringrt";
> +                reg = <0x00 0x485c0100 0x00 0x100>,
> +                      <0x00 0x4c000000 0x00 0x20000>,
> +                      <0x00 0x4a820000 0x00 0x20000>,
> +                      <0x00 0x4aa40000 0x00 0x20000>,
> +                      <0x00 0x4bc00000 0x00 0x100000>,
> +                      <0x00 0x48600000 0x00 0x8000>,

This is BCDMA_RING region and named as 'cfg'?

> +                      <0x00 0x484a4000 0x00 0x2000>,
> +                      <0x00 0x484c2000 0x00 0x2000>;
> +                reg-names = "gcfg", "bchanrt", "rchanrt", "tchanrt", "ringrt",
> +                            "cfg", "tchan", "rchan";

If you do this then add the bchan region also?

>                  msi-parent = <&inta_main_dmss>;
>                  #dma-cells = <3>;
>  

-- 
Péter

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

* Re: [PATCH 2/3] dt-bindings: dma: ti: k3-pktdma: Describe cfg register regions
  2023-08-10 17:43 ` [PATCH 2/3] dt-bindings: dma: ti: k3-pktdma: " Vignesh Raghavendra
@ 2023-08-27  7:10   ` Péter Ujfalusi
  0 siblings, 0 replies; 11+ messages in thread
From: Péter Ujfalusi @ 2023-08-27  7:10 UTC (permalink / raw)
  To: Vignesh Raghavendra, Vinod Koul, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley
  Cc: dmaengine, devicetree, linux-kernel, linux-arm-kernel



On 10/08/2023 20:43, Vignesh Raghavendra wrote:
> Packet DMA (PKTDMA) module on K3 SoCs have ring cfg, TX and RX channel
> cfg and RX flow cfg register regions which are usually configured by a
> Device Management firmware. But certain entities such as bootloader
> (like U-Boot) may have to access them directly. Describe this region in
> the binding documentation for completeness of module description.
> 
> Keep the binding compatible with existing DTS files by requiring first
> four regions to be present at least.
> 
> Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
> ---
>  .../devicetree/bindings/dma/ti/k3-pktdma.yaml  | 18 +++++++++++++++---
>  1 file changed, 15 insertions(+), 3 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/dma/ti/k3-pktdma.yaml b/Documentation/devicetree/bindings/dma/ti/k3-pktdma.yaml
> index a69f62f854d8..5f9ba4bb05f6 100644
> --- a/Documentation/devicetree/bindings/dma/ti/k3-pktdma.yaml
> +++ b/Documentation/devicetree/bindings/dma/ti/k3-pktdma.yaml
> @@ -45,14 +45,20 @@ properties:
>        The second cell is the ASEL value for the channel
>  
>    reg:
> -    maxItems: 4
> +    minItems: 4
> +    maxItems: 8
>  
>    reg-names:
> +    minItems: 4
>      items:
>        - const: gcfg
>        - const: rchanrt
>        - const: tchanrt
>        - const: ringrt
> +      - const: cfg
> +      - const: tchan
> +      - const: rchan
> +      - const: rflow
>  
>    msi-parent: true
>  
> @@ -136,8 +142,14 @@ examples:
>                  reg = <0x0 0x485c0000 0x0 0x100>,
>                        <0x0 0x4a800000 0x0 0x20000>,
>                        <0x0 0x4aa00000 0x0 0x40000>,
> -                      <0x0 0x4b800000 0x0 0x400000>;
> -                reg-names = "gcfg", "rchanrt", "tchanrt", "ringrt";
> +                      <0x0 0x4b800000 0x0 0x400000>,
> +                      <0x00 0x485e0000 0x00 0x20000>,

This is RING (PKTDMA_RING), why it is named cfg?

> +                      <0x00 0x484a0000 0x00 0x4000>,
> +                      <0x00 0x484c0000 0x00 0x2000>,
> +                      <0x00 0x48430000 0x00 0x4000>;
> +                reg-names = "gcfg", "rchanrt", "tchanrt", "ringrt",
> +                            "cfg", "tchan", "rchan", "rflow";
> +
>                  msi-parent = <&inta_main_dmss>;
>                  #dma-cells = <2>;
>  

-- 
Péter

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

* Re: [PATCH 0/3] dt-bindings: dma: ti: k3* : Update optional reg regions
  2023-08-11 16:04   ` Vignesh Raghavendra
@ 2023-08-27  7:18     ` Péter Ujfalusi
  0 siblings, 0 replies; 11+ messages in thread
From: Péter Ujfalusi @ 2023-08-27  7:18 UTC (permalink / raw)
  To: Vignesh Raghavendra, Vinod Koul, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley
  Cc: dmaengine, devicetree, linux-kernel, linux-arm-kernel

Hi Vignesh,

On 11/08/2023 19:04, Vignesh Raghavendra wrote:
> 
> There is been a relook at the arch post this driver was upstreamed. 
> System firmware (SYSFW) is now two separate components:  TI Foundational 
> Security (TIFS) running in a secure island and Device Management (DM) 
> firmware (runs on boot R5 core) [0] shows boot flow diagram for AM62x.

I see, I cannot argue with that.
Is this change affecting the entire K3 family or only the new members?
If the later then I would seek for conditionality for the new regions as
non relooked SoCs these regions are off-limit for the SW.

> Security critical items such as PSIL pairing, channel firewalls and 
> credential configurations are under TIFS and is handled via TI SCI calls 
> at all times.
> 
> But, things related to resource configuration (to ensure different cores 
> dont step on each other) is under DM. Linux still needs to talk to DM 
> for configuring these regions. But, when primary bootloader (R5 SPL) is 
> running, there isn't a DM firmware (as it runs on the same core after R5 
> SPL), it would need to configure DMA resources on its own. 
> 
> This update is mainly to aid R5 SPL to reuse kernel DT as is. 
> Hope that helps

Right, so Linux will need to use these soon ;)

> 
> 
> [0] https://u-boot.readthedocs.io/en/latest/board/ti/am62x_sk.html?highlight=am62#boot-flow
> (Similar boot flow for rest of K3 devices barring am65 and am64)

OK, if the R5 needs to use DMA before DM then surely there is a need to
configure the channel(s).
I expect that R5 or DM will reset things back before booting the main CPU.

> 
>>
>>>
>>> Vignesh Raghavendra (3):
>>>    dt-bindings: dma: ti: k3-bcdma: Describe cfg register regions
>>>    dt-bindings: dma: ti: k3-pktdma: Describe cfg register regions
>>>    dt-bindings: dma: ti: k3-udma: Describe cfg register regions
>>>
>>>   .../devicetree/bindings/dma/ti/k3-bcdma.yaml  | 25 +++++++++++++------
>>>   .../devicetree/bindings/dma/ti/k3-pktdma.yaml | 18 ++++++++++---
>>>   .../devicetree/bindings/dma/ti/k3-udma.yaml   | 14 ++++++++---
>>>   3 files changed, 43 insertions(+), 14 deletions(-)
>>>
>>
> 

-- 
Péter

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

end of thread, other threads:[~2023-08-27  7:20 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-10 17:43 [PATCH 0/3] dt-bindings: dma: ti: k3* : Update optional reg regions Vignesh Raghavendra
2023-08-10 17:43 ` [PATCH 1/3] dt-bindings: dma: ti: k3-bcdma: Describe cfg register regions Vignesh Raghavendra
2023-08-10 18:35   ` Conor Dooley
2023-08-11  4:38     ` Vignesh Raghavendra
2023-08-27  7:06   ` Péter Ujfalusi
2023-08-10 17:43 ` [PATCH 2/3] dt-bindings: dma: ti: k3-pktdma: " Vignesh Raghavendra
2023-08-27  7:10   ` Péter Ujfalusi
2023-08-10 17:43 ` [PATCH 3/3] dt-bindings: dma: ti: k3-udma: " Vignesh Raghavendra
2023-08-11 15:16 ` [PATCH 0/3] dt-bindings: dma: ti: k3* : Update optional reg regions Péter Ujfalusi
2023-08-11 16:04   ` Vignesh Raghavendra
2023-08-27  7:18     ` Péter Ujfalusi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).