Skip to contentSkip to conversation

Add the PowerQUICC audio support using the QMC

PATCH Superseded Herve Codina 3 participants 26 messages Jan 6, 2023 – Jan 11, 2023

Subsystems (11)

v2 of 7 Superseded Latest is v7 →

lore
Share & tools
lore

Herve Codina

author maintainer
#0 lore raw

v2 cover Add the PowerQUICC audio support using the QMC

Hi,

This series adds support for audio using the QMC controller available in some Freescale PowerQUICC SoCs.

This series contains three parts in order to show the different blocks hierarchy and their usage in this support.

The first one is related to TSA (Time Slot Assigner). The TSA handles the data present at the pin level (TDM with up to 64 time slots) and dispatchs them to one or more serial controller (SCC).

The second is related to QMC (QUICC Multichannel Controller). The QMC handles the data at the serial controller (SCC) level and splits again the data to creates some virtual channels.

The last one is related to the audio component (QMC audio). It is the glue between the QMC controller and the ASoC component. It handles one or more QMC virtual channels and creates one DAI per QMC virtual channels handled.

Compared to the v1 series, this v2 series fixes errors raised by the test kernel robot.

Best regards,
Herve Codina

Changes v1 -> v2:
- patch 2 and 6
Fix kernel test robot errors

- other patches
No changes

Herve Codina (10):
dt-bindings: soc: fsl: cpm_qe: Add TSA controller
soc: fsl: qe: Add support for TSA
MAINTAINERS: add the Freescale TSA controller entry powerpc/8xx: Use a larger CPM1 command check mask
dt-bindings: soc: fsl: cpm_qe: Add QMC controller
soc: fsl: qe: Add support for QMC
MAINTAINERS: add the Freescale QMC controller entry
dt-bindings: sound: Add support for QMC audio
ASoC: fsl: Add support for QMC audio
MAINTAINERS: add the Freescale QMC audio entry

 .../bindings/soc/fsl/cpm_qe/fsl,qmc.yaml      |  167 ++
 .../bindings/soc/fsl/cpm_qe/fsl,tsa.yaml      |  262 +++
 .../bindings/sound/fsl,qmc-audio.yaml         |  110 ++
 MAINTAINERS                                   |   25 +
 arch/powerpc/platforms/8xx/cpm1.c             |    2 +-
 drivers/soc/fsl/qe/Kconfig                    |   23 +
 drivers/soc/fsl/qe/Makefile                   |    2 +
 drivers/soc/fsl/qe/qmc.c                      | 1493 +++++++++++++++++
 drivers/soc/fsl/qe/tsa.c                      |  783 +++++++++
 drivers/soc/fsl/qe/tsa.h                      |   43 +
 include/dt-bindings/soc/fsl-tsa.h             |   15 +
 include/soc/fsl/qe/qmc.h                      |   71 +
 sound/soc/fsl/Kconfig                         |    9 +
 sound/soc/fsl/Makefile                        |    2 +
 sound/soc/fsl/fsl_qmc_audio.c                 |  731 ++++++++
 15 files changed, 3737 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,qmc.yaml
 create mode 100644 Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml
 create mode 100644 Documentation/devicetree/bindings/sound/fsl,qmc-audio.yaml
 create mode 100644 drivers/soc/fsl/qe/qmc.c
 create mode 100644 drivers/soc/fsl/qe/tsa.c
 create mode 100644 drivers/soc/fsl/qe/tsa.h
 create mode 100644 include/dt-bindings/soc/fsl-tsa.h
 create mode 100644 include/soc/fsl/qe/qmc.h
 create mode 100644 sound/soc/fsl/fsl_qmc_audio.c
Signature · 1 line
2.38.1
author maintainer
#1 lore raw

PATCH v2 1/10 dt-bindings: soc: fsl: cpm_qe: Add TSA controller

Add support for the time slot assigner (TSA)
available in some PowerQUICC SoC such as MPC885
or MPC866.

---
 .../bindings/soc/fsl/cpm_qe/fsl,tsa.yaml      | 262 ++++++++++++++++++
 include/dt-bindings/soc/fsl-tsa.h             |  15 +
 2 files changed, 277 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml
 create mode 100644 include/dt-bindings/soc/fsl-tsa.h
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml new file +262 -0
new file mode 100644
index 000000000000..7542c0fd8435
@@ -0,0 +1,262 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/soc/fsl/cpm_qe/fsl,tsa.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: PowerQUICC CPM Time-slot assigner (TSA) controller
+
+maintainers:
+  - Herve Codina <[email protected]>
+
+description: |
+  The TSA is the time-slot assigner that can be found on some
+  PowerQUICC SoC.
+  Its purpose is to route some TDM time-slots to other internal
+  serial controllers.
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - fsl,mpc885-tsa
+          - fsl,mpc866-tsa
+      - const: fsl,cpm1-tsa
+
+  reg:
+    items:
+      - description: SI (Serial Interface) register base
+      - description: SI RAM base
+
+  reg-names:
+    items:
+      - const: si_regs
+      - const: si_ram
+
+  '#address-cells':
+    const: 1
+
+  '#size-cells':
+    const: 0
+
+patternProperties:
+  "^tdm@[0-1]$":
+    description:
+      The TDM managed by this controller
+    type: object
+
+    properties:
+      reg:
+        minimum: 0
+        maximum: 1
+        description:
+          The TDM number for this TDM, 0 for TDMa and 1 for TDMb
+
+      fsl,common-rxtx-pins:
+        $ref: /schemas/types.yaml#/definitions/flag
+        description:
+          Use common pins for both transmit and receive
+
+      clocks: true
+      clock-names: true
+
+      fsl,mode:
+        $ref: /schemas/types.yaml#/definitions/string
+        enum: [normal, echo, internal-loopback, control-loopback]
+        default: normal
+        description: |
+          Operational mode:
+            - normal:
+                Normal operation
+            - echo:
+                Automatic echo. Rx data is resent on Tx
+            - internal-loopback:
+                The TDM transmitter is connected to the receiver.
+                Data appears on Tx pin.
+            - control-loopback:
+                The TDM transmitter is connected to the receiver.
+                The Tx pin is disconnected.
+
+      fsl,rx-frame-sync-delay:
+        $ref: /schemas/types.yaml#/definitions/uint32
+        enum: [0, 1, 2, 3]
+        default: 0
+        description: |
+          Receive frame sync delay.
+          Indicates the delay between the Rx sync and the first bit of the
+          Rx frame. 0 for no bit delay. 1, 2 or 3 for 1, 2 or 3 bits delay.
+
+      fsl,tx-frame-sync-delay:
+        $ref: /schemas/types.yaml#/definitions/uint32
+        enum: [0, 1, 2, 3]
+        default: 0
+        description: |
+          Transmit frame sync delay.
+          Indicates the delay between the Tx sync and the first bit of the
+          Tx frame. 0 for no bit delay. 1, 2 or 3 for 1, 2 or 3 bits delay.
+
+      fsl,clock-falling-edge:
+        $ref: /schemas/types.yaml#/definitions/flag
+        description: |
+          Data is sent on falling edge of the clock (and received on the
+          rising edge).
+          If 'clock-falling-edge' is not present, data is sent on the
+          rising edge (and received on the falling edge).
+
+      fsl,fsync-rising-edge:
+        $ref: /schemas/types.yaml#/definitions/flag
+        description:
+          Frame sync pulses are sampled with the rising edge of the channel
+          clock. If 'fsync-rising-edge' is not present, pulses are sample
+          with e falling edge.
+
+      fsl,double-speed-clock:
+        $ref: /schemas/types.yaml#/definitions/flag
+        description:
+          The channel clock is twice the data rate.
+
+      fsl,grant-mode:
+        $ref: /schemas/types.yaml#/definitions/flag
+        description:
+          Grant mode enabled.
+
+      tx_ts_routes:
+        $ref: /schemas/types.yaml#/definitions/uint32-matrix
+        description: |
+          A list of tupple that indicates the Tx time-slots routes.
+            tx_ts_routes =
+               < 2 0 0>, /* The first 2 time slots are not used */
+               < 3 1 0>, /* The next 3 ones are route to SCC2 */
+               < 4 0 0>, /* The next 4 ones are not used */
+               < 2 2 0>; /* The nest 2 ones are route to SCC3 */
+        items:
+          items:
+            - description:
+                The number of time-slots
+              minimum: 1
+              maximum: 64
+            - description: |
+                The source serial interface (dt-bindings/soc/fsl-tsa.h
+                defines these values)
+                 - 0: No destination
+                 - 1: SCC2
+                 - 2: SCC3
+                 - 3: SCC4
+                 - 4: SMC1
+                 - 5: SMC2
+              enum: [0, 1, 2, 3, 4, 5]
+            - description:
+                The route flags (reserved)
+              const: 0
+        minItems: 1
+        maxItems: 64
+
+      rx_ts_routes:
+        $ref: /schemas/types.yaml#/definitions/uint32-matrix
+        description: |
+          A list of tupple that indicates the Rx time-slots routes.
+            tx_ts_routes =
+               < 2 0 0>, /* The first 2 time slots are not used */
+               < 3 1 0>, /* The next 3 ones are route from SCC2 */
+               < 4 0 0>, /* The next 4 ones are not used */
+               < 2 2 0>; /* The nest 2 ones are route from SCC3 */
+        items:
+          items:
+            - description:
+                The number of time-slots
+              minimum: 1
+              maximum: 64
+            - description: |
+                The destination serial interface (dt-bindings/soc/fsl-tsa.h
+                defines these values)
+                 - 0: No destination
+                 - 1: SCC2
+                 - 2: SCC3
+                 - 3: SCC4
+                 - 4: SMC1
+                 - 5: SMC2
+              enum: [0, 1, 2, 3, 4, 5]
+            - description:
+                The route flags (reserved)
+              const: 0
+        minItems: 1
+        maxItems: 64
+
+    allOf:
+      - if:
+          properties:
+            fsl,common-rxtx-pins:
+              type: 'null'
+        then:
+          properties:
+            clocks:
+              items:
+                - description: External clock connected to L1RSYNC pin
+                - description: External clock connected to L1RCLK pin
+                - description: External clock connected to L1TSYNC pin
+                - description: External clock connected to L1TCLK pin
+            clock-names:
+              items:
+                - const: l1rsync
+                - const: l1rclk
+                - const: l1tsync
+                - const: l1tclk
+        else:
+          properties:
+            clocks:
+              items:
+                - description: External clock connected to L1RSYNC pin
+                - description: External clock connected to L1RCLK pin
+            clock-names:
+              items:
+                - const: l1rsync
+                - const: l1rclk
+
+    required:
+      - reg
+      - clocks
+      - clock-names
+
+required:
+  - compatible
+  - reg
+  - reg-names
+  - '#address-cells'
+  - '#size-cells'
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/soc/fsl-tsa.h>
+
+    tsa@ae0 {
+        compatible = "fsl,mpc885-tsa", "fsl,cpm1-tsa";
+        reg = <0xae0 0x10>,
+              <0xc00 0x200>;
+        reg-names = "si_regs", "si_ram";
+
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        tdm@0 {
+            /* TDMa */
+            reg = <0>;
+
+            clocks = <&clk_l1rsynca>, <&clk_l1rclka>;
+            clock-names = "l1rsync", "l1rclk";
+
+            fsl,common-rxtx-pins;
+            fsl,fsync-rising-edge;
+
+            tx_ts_routes = < 2 0 0>,                 /* TS 0..1 */
+                           < 24 FSL_CPM_TSA_SCC4 0>, /* TS 2..25 */
+                           < 1 0 0>,                 /* TS 26 */
+                           < 5 FSL_CPM_TSA_SCC3 0>;  /* TS 27..31 */
+
+            rx_ts_routes = < 2 0 0>,                 /* TS 0..1 */
+                           < 24 FSL_CPM_TSA_SCC4 0>, /* 2..25 */
+                           < 1 0 0>,                 /* TS 26 */
+                           < 5 FSL_CPM_TSA_SCC3 0>;  /* TS 27..31 */
+        };
+    };
include/dt-bindings/soc/fsl-tsa.h new file +15 -0
new file mode 100644
index 000000000000..9d09468694a2
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later OR MIT */
+
+#ifndef __DT_BINDINGS_SOC_FSL_TSA_H
+#define __DT_BINDINGS_SOC_FSL_TSA_H
+
+#define FSL_CPM_TSA_NU		0	/* Pseuso Cell Id for not used item */
+#define FSL_CPM_TSA_SCC2	1
+#define FSL_CPM_TSA_SCC3	2
+#define FSL_CPM_TSA_SCC4	3
+#define FSL_CPM_TSA_SMC1	4
+#define FSL_CPM_TSA_SMC2	5
+
+#define FSL_CPM_TSA_NBCELL	6
+
+#endif
Signature · 1 line
2.38.1
author maintainer
#9 lore raw

PATCH v2 3/10 MAINTAINERS: add the Freescale TSA controller entry

In reply to Herve Codina

After contributing the driver, add myself as the maintainer for the Freescale TSA controller.

---
 MAINTAINERS | 9 +++++++++
 1 file changed, 9 insertions(+)
MAINTAINERS +9 -0
index 7f86d02cb427..2b4f5fe7ebad 100644
@@ -8372,6 +8372,15 @@ S:	Maintained
 F:	drivers/soc/fsl/qe/
 F:	include/soc/fsl/qe/
 
+FREESCALE QUICC ENGINE TSA DRIVER
+M:	Herve Codina <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml
+F:	drivers/soc/fsl/qe/tsa.c
+F:	drivers/soc/fsl/qe/tsa.h
+F:	include/dt-bindings/soc/fsl-tsa.h
+
 FREESCALE QUICC ENGINE UCC ETHERNET DRIVER
 M:	Li Yang <[email protected]>
 L:	[email protected]
Signature · 1 line
2.38.1
author maintainer
#5 lore raw

PATCH v2 2/10 soc: fsl: qe: Add support for TSA

In reply to Herve Codina

The TSA (Time Slot Assigner) is available in some
PowerQUICC SoC such as the MPC885 or MPC866.

Its purpose is to route some TDM time-slots to other internal serial controllers.

---
 drivers/soc/fsl/qe/Kconfig  |  11 +
 drivers/soc/fsl/qe/Makefile |   1 +
 drivers/soc/fsl/qe/tsa.c    | 783 ++++++++++++++++++++++++++++++++++++
 drivers/soc/fsl/qe/tsa.h    |  43 ++
 4 files changed, 838 insertions(+)
 create mode 100644 drivers/soc/fsl/qe/tsa.c
 create mode 100644 drivers/soc/fsl/qe/tsa.h
drivers/soc/fsl/qe/Kconfig +11 -0
index 357c5800b112..60ec11c9f4d9 100644
@@ -33,6 +33,17 @@ config UCC
 	bool
 	default y if UCC_FAST || UCC_SLOW
 
+config CPM_TSA
+	tristate "CPM TSA support"
+	depends on OF && HAS_IOMEM
+	depends on CPM1 || (PPC && COMPILE_TEST)
+	help
+	  Freescale CPM Time Slot Assigner (TSA)
+	  controller.
+
+	  This option enables support for this
+	  controller
+
 config QE_TDM
 	bool
 	default y if FSL_UCC_HDLC
drivers/soc/fsl/qe/Makefile +1 -0
index 55a555304f3a..45c961acc81b 100644
@@ -4,6 +4,7 @@
 #
 obj-$(CONFIG_QUICC_ENGINE)+= qe.o qe_common.o qe_ic.o qe_io.o
 obj-$(CONFIG_CPM)	+= qe_common.o
+obj-$(CONFIG_CPM_TSA)	+= tsa.o
 obj-$(CONFIG_UCC)	+= ucc.o
 obj-$(CONFIG_UCC_SLOW)	+= ucc_slow.o
 obj-$(CONFIG_UCC_FAST)	+= ucc_fast.o
drivers/soc/fsl/qe/tsa.c new file +783 -0

783 lines not on this page · raw message

drivers/soc/fsl/qe/tsa.h new file +43 -0

43 lines not on this page · raw message

Signature · 1 line
2.38.1
author maintainer
#10 lore raw

PATCH v2 4/10 powerpc/8xx: Use a larger CPM1 command check mask

In reply to Herve Codina

The CPM1 command mask is defined for use with the standard CPM1 command register as described in the user's manual:

  0  |1        3|4    7|8   11|12      14| 15|
  RST|    -     |OPCODE|CH_NUM|     -    |FLG|

In the QMC extension the CPM1 command register is redefined (QMC supplement user's manuel) with the following mapping:

  0  |1        3|4    7|8           13|14| 15|
  RST|QMC OPCODE|  1110|CHANNEL_NUMBER| -|FLG|

Extend the check command mask in order to support both the standard CH_NUM field and the QMC extension CHANNEL_NUMBER field.

---
 arch/powerpc/platforms/8xx/cpm1.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/platforms/8xx/cpm1.c +1 -1
index 8ef1f4392086..6b828b9f90d9 100644
@@ -100,7 +100,7 @@ int cpm_command(u32 command, u8 opcode)
 	int i, ret;
 	unsigned long flags;
 
-	if (command & 0xffffff0f)
+	if (command & 0xffffff03)
 		return -EINVAL;
 
 	spin_lock_irqsave(&cmd_lock, flags);
Signature · 1 line
2.38.1
author maintainer
#12 lore raw

PATCH v2 5/10 dt-bindings: soc: fsl: cpm_qe: Add QMC controller

In reply to Herve Codina

Add support for the QMC (QUICC Multichannel Controller) available in some PowerQUICC SoC such as MPC885 or MPC866.

---
 .../bindings/soc/fsl/cpm_qe/fsl,qmc.yaml      | 167 ++++++++++++++++++
 1 file changed, 167 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,qmc.yaml
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,qmc.yaml new file +167 -0
new file mode 100644
index 000000000000..caf71f3a3f3f
@@ -0,0 +1,167 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/soc/fsl/cpm_qe/fsl,qmc.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: PowerQUICC CPM QUICC Multichannel Controller (QMC)
+
+maintainers:
+  - Herve Codina <[email protected]>
+
+description: |
+  The QMC (QUICC Multichannel Controller) emulates up to 64 channels within
+  one serial controller using the same TDM physical interface routed from
+  TSA.
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - fsl,mpc885-scc-qmc
+          - fsl,mpc866-scc-qmc
+      - const: fsl,cpm1-scc-qmc
+
+  reg:
+    items:
+      - description: SCC (Serial communication controller) register base
+      - description: SCC parameter ram base
+      - description: Dual port ram base
+
+  reg-names:
+    items:
+      - const: scc_regs
+      - const: scc_pram
+      - const: dpram
+
+  interrupts:
+    description: SCC interrupt line in the CPM interrupt controller
+
+  fsl,cpm-command:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: Cf. soc/fsl/cpm_qe/cpm.txt
+
+  tsa:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description: phandle to the TSA
+
+  tsa-cell-id:
+    enum: [1, 2, 3]
+    description: |
+      TSA cell ID (dt-bindings/soc/fsl-tsa.h defines these values)
+       - 1: SCC2
+       - 2: SCC3
+       - 3: SCC4
+
+  '#address-cells':
+    const: 1
+
+  '#size-cells':
+    const: 0
+
+  '#chan-cells':
+    const: 1
+
+patternProperties:
+  "^channel@([0-9]|[1-5][0-9]|6[0-3])$":
+    description:
+      A channel managed by this controller
+    type: object
+
+    properties:
+      reg:
+        minimum: 0
+        maximum: 63
+        description:
+          The channel number
+
+      fsl,mode:
+        $ref: /schemas/types.yaml#/definitions/string
+        enum: [transparent, hdlc]
+        default: transparent
+        description: Operational mode
+
+      fsl,reverse-data:
+        $ref: /schemas/types.yaml#/definitions/flag
+        description:
+          The bit order as seen on the channels is reversed,
+          transmitting/receiving the MSB of each octet first.
+          This flag is used only in 'transparent' mode.
+
+      tx-ts-mask:
+        $ref: /schemas/types.yaml#/definitions/uint64
+        description:
+          Channel assigned Tx time-slots within the Tx time-slots routed
+          by the TSA to this cell.
+
+      rx-ts-mask:
+        $ref: /schemas/types.yaml#/definitions/uint64
+        description:
+          Channel assigned Rx time-slots within the Rx time-slots routed
+          by the TSA to this cell.
+
+    required:
+      - reg
+      - tx-ts-mask
+      - rx-ts-mask
+
+required:
+  - compatible
+  - reg
+  - reg-names
+  - interrupts
+  - tsa
+  - tsa-cell-id
+  - '#address-cells'
+  - '#size-cells'
+  - '#chan-cells'
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/soc/fsl-tsa.h>
+
+    scc_qmc@a60 {
+        compatible = "fsl,mpc885-scc-qmc", "fsl,cpm1-scc-qmc";
+        reg = <0xa60 0x20>,
+              <0x3f00 0xc0>,
+              <0x2000 0x1000>;
+        reg-names = "scc_regs", "scc_pram", "dpram";
+        interrupts = <27>;
+        interrupt-parent = <&CPM_PIC>;
+        fsl,cpm-command = <0xc0>;
+
+        #address-cells = <1>;
+        #size-cells = <0>;
+        #chan-cells = <1>;
+
+        tsa = <&tsa>;
+        tsa-cell-id = <FSL_CPM_TSA_SCC4>;
+
+        channel@16 {
+            /* Ch16 : First 4 even TS from all routed from TSA */
+            reg = <16>;
+            fsl,mode = "transparent";
+            fsl,reverse-data;
+            tx-ts-mask = <0x00000000 0x000000AA>;
+            rx-ts-mask = <0x00000000 0x000000AA>;
+        };
+
+        channel@17 {
+            /* Ch17 : First 4 odd TS from all routed from TSA */
+            reg = <17>;
+            fsl,mode = "transparent";
+            fsl,reverse-data;
+            tx-ts-mask = <0x00000000 0x00000055>;
+            rx-ts-mask = <0x00000000 0x00000055>;
+        };
+
+        channel@19 {
+            /* Ch19 : 8 TS (TS 8..15) from all routed from TSA */
+            reg = <19>;
+            fsl,mode = "hdlc";
+            tx-ts-mask = <0x00000000 0x0000FF00>;
+            rx-ts-mask = <0x00000000 0x0000FF00>;
+        };
+    };
Signature · 1 line
2.38.1
author maintainer
#15 lore raw

PATCH v2 6/10 soc: fsl: qe: Add support for QMC

In reply to Herve Codina

The QMC (QUICC Multichannel Controller) is available on some PowerQUICC SoC such as the MPC885 or MPC866.

It emulates up to 64 channels within one serial controller using the same TDM physical interface routed from the TSA.

---
 drivers/soc/fsl/qe/Kconfig  |   12 +
 drivers/soc/fsl/qe/Makefile |    1 +
 drivers/soc/fsl/qe/qmc.c    | 1493 +++++++++++++++++++++++++++++++++++
 include/soc/fsl/qe/qmc.h    |   71 ++
 4 files changed, 1577 insertions(+)
 create mode 100644 drivers/soc/fsl/qe/qmc.c
 create mode 100644 include/soc/fsl/qe/qmc.h
drivers/soc/fsl/qe/Kconfig +12 -0
index 60ec11c9f4d9..25b218351ae3 100644
@@ -44,6 +44,18 @@ config CPM_TSA
 	  This option enables support for this
 	  controller
 
+config CPM_QMC
+	tristate "CPM QMC support"
+	depends on OF && HAS_IOMEM
+	depends on CPM1 || (PPC && COMPILE_TEST)
+	depends on CPM_TSA
+	help
+	  Freescale CPM QUICC Multichannel Controller
+	  (QMC)
+
+	  This option enables support for this
+	  controller
+
 config QE_TDM
 	bool
 	default y if FSL_UCC_HDLC
drivers/soc/fsl/qe/Makefile +1 -0
index 45c961acc81b..ec8506e13113 100644
@@ -5,6 +5,7 @@
 obj-$(CONFIG_QUICC_ENGINE)+= qe.o qe_common.o qe_ic.o qe_io.o
 obj-$(CONFIG_CPM)	+= qe_common.o
 obj-$(CONFIG_CPM_TSA)	+= tsa.o
+obj-$(CONFIG_CPM_QMC)	+= qmc.o
 obj-$(CONFIG_UCC)	+= ucc.o
 obj-$(CONFIG_UCC_SLOW)	+= ucc_slow.o
 obj-$(CONFIG_UCC_FAST)	+= ucc_fast.o
drivers/soc/fsl/qe/qmc.c new file +1493 -0

1,493 lines not on this page · raw message

include/soc/fsl/qe/qmc.h new file +71 -0

71 lines not on this page · raw message

Signature · 1 line
2.38.1
author maintainer
#19 lore raw

PATCH v2 7/10 MAINTAINERS: add the Freescale QMC controller entry

In reply to Herve Codina

After contributing the driver, add myself as the maintainer for the Freescale QMC controller.

---
 MAINTAINERS | 8 ++++++++
 1 file changed, 8 insertions(+)
MAINTAINERS +8 -0
index 2b4f5fe7ebad..480f90db699d 100644
@@ -8372,6 +8372,14 @@ S:	Maintained
 F:	drivers/soc/fsl/qe/
 F:	include/soc/fsl/qe/
 
+FREESCALE QUICC ENGINE QMC DRIVER
+M:	Herve Codina <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,qmc.yaml
+F:	drivers/soc/fsl/qe/qmc.c
+F:	include/soc/fsl/qe/qmc.h
+
 FREESCALE QUICC ENGINE TSA DRIVER
 M:	Herve Codina <[email protected]>
 L:	[email protected]
Signature · 1 line
2.38.1
author maintainer
#20 lore raw

PATCH v2 8/10 dt-bindings: sound: Add support for QMC audio

In reply to Herve Codina

The QMC (QUICC mutichannel controller) is a controller present in some PowerQUICC SoC such as MPC885. The QMC audio is an ASoC component that uses the QMC controller to transfer the audio data.

---
 .../bindings/sound/fsl,qmc-audio.yaml         | 110 ++++++++++++++++++
 1 file changed, 110 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/fsl,qmc-audio.yaml
Documentation/devicetree/bindings/sound/fsl,qmc-audio.yaml new file +110 -0
new file mode 100644
index 000000000000..b3774be36c19
@@ -0,0 +1,110 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sound/fsl,qmc-audio.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: QMC audio
+
+maintainers:
+  - Herve Codina <[email protected]>
+
+description: |
+  The QMC audio is an ASoC component which uses QMC (QUICC Multichannel
+  Controller) channels to transfer the audio data.
+  It provides as many DAI as the number of QMC channel used.
+
+properties:
+  compatible:
+    items:
+      - const: fsl,qmc-audio
+
+  '#address-cells':
+    const: 1
+  '#size-cells':
+    const: 0
+  '#sound-dai-cells':
+    const: 1
+
+patternProperties:
+  "^dai@([0-9]|[1-5][0-9]|6[0-3])$":
+    description:
+      A DAI managed by this controller
+    type: object
+
+    properties:
+      reg:
+        minimum: 0
+        maximum: 63
+        description:
+          The DAI number
+
+      qmc-chan:
+        $ref: /schemas/types.yaml#/definitions/phandle-array
+        description: phandle to the QMC channel
+        maxItems: 1
+
+    required:
+      - reg
+      - qmc-chan
+
+required:
+  - compatible
+  - '#address-cells'
+  - '#size-cells'
+  - '#sound-dai-cells'
+
+additionalProperties: false
+
+examples:
+  - |
+    qmc_audio: qmc_audio {
+        compatible = "fsl,qmc-audio";
+        #address-cells = <1>;
+        #size-cells = <0>;
+        #sound-dai-cells = <1>;
+        dai@16 {
+            reg = <16>;
+            qmc-chan = <&scc_qmc 16>;
+        };
+        dai@17 {
+            reg = <17>;
+            qmc-chan = <&scc_qmc 17>;
+        };
+    };
+
+    sound {
+        compatible = "simple-audio-card";
+        #address-cells = <1>;
+        #size-cells = <0>;
+        simple-audio-card,dai-link@0 {
+            reg = <0>;
+            format = "dsp_b";
+            cpu {
+                sound-dai = <&qmc_audio 16>;
+            };
+            codec {
+                sound-dai = <&codec1>;
+                dai-tdm-slot-num = <4>;
+                dai-tdm-slot-width = <8>;
+                /* TS 3, 5, 7, 9 */
+                dai-tdm-slot-tx-mask = <0 0 0 1 0 1 0 1 0 1>;
+                dai-tdm-slot-rx-mask = <0 0 0 1 0 1 0 1 0 1>;
+            };
+        };
+        simple-audio-card,dai-link@1 {
+            reg = <1>;
+            format = "dsp_b";
+            cpu {
+                sound-dai = <&qmc_audio 17>;
+            };
+            codec {
+                sound-dai = <&codec2>;
+                dai-tdm-slot-num = <4>;
+                dai-tdm-slot-width = <8>;
+                /* TS 2, 4, 6, 8 */
+                dai-tdm-slot-tx-mask = <0 0 1 0 1 0 1 0 1>;
+                dai-tdm-slot-rx-mask = <0 0 1 0 1 0 1 0 1>;
+            };
+        };
+    };
Signature · 1 line
2.38.1
author maintainer
#24 lore raw

PATCH v2 9/10 ASoC: fsl: Add support for QMC audio

In reply to Herve Codina

The QMC audio is an ASoC component which provides DAIs that use the QMC (QUICC Multichannel Controller) to transfer the audio data.

It provides as many DAIs as the number of QMC channels it references.

---
 sound/soc/fsl/Kconfig         |   9 +
 sound/soc/fsl/Makefile        |   2 +
 sound/soc/fsl/fsl_qmc_audio.c | 731 ++++++++++++++++++++++++++++++++++
 3 files changed, 742 insertions(+)
 create mode 100644 sound/soc/fsl/fsl_qmc_audio.c
sound/soc/fsl/Kconfig +9 -0
index 614eceda6b9e..17db29c25d96 100644
@@ -172,6 +172,15 @@ config SND_MPC52xx_DMA
 config SND_SOC_POWERPC_DMA
 	tristate
 
+config SND_SOC_POWERPC_QMC_AUDIO
+	tristate "QMC ALSA SoC support"
+	depends on CPM_QMC
+	help
+	  ALSA SoC Audio support using the Freescale QUICC Multichannel
+	  Controller (QMC).
+	  Say Y or M if you want to add support for SoC audio using Freescale
+	  QMC.
+
 comment "SoC Audio support for Freescale PPC boards:"
 
 config SND_SOC_MPC8610_HPCD
sound/soc/fsl/Makefile +2 -0
index b54beb1a66fa..8db7e97d0bd5 100644
@@ -28,6 +28,7 @@ snd-soc-fsl-easrc-objs := fsl_easrc.o
 snd-soc-fsl-xcvr-objs := fsl_xcvr.o
 snd-soc-fsl-aud2htx-objs := fsl_aud2htx.o
 snd-soc-fsl-rpmsg-objs := fsl_rpmsg.o
+snd-soc-fsl-qmc-audio-objs := fsl_qmc_audio.o
 
 obj-$(CONFIG_SND_SOC_FSL_AUDMIX) += snd-soc-fsl-audmix.o
 obj-$(CONFIG_SND_SOC_FSL_ASOC_CARD) += snd-soc-fsl-asoc-card.o
@@ -44,6 +45,7 @@ obj-$(CONFIG_SND_SOC_POWERPC_DMA) += snd-soc-fsl-dma.o
 obj-$(CONFIG_SND_SOC_FSL_XCVR) += snd-soc-fsl-xcvr.o
 obj-$(CONFIG_SND_SOC_FSL_AUD2HTX) += snd-soc-fsl-aud2htx.o
 obj-$(CONFIG_SND_SOC_FSL_RPMSG) += snd-soc-fsl-rpmsg.o
+obj-$(CONFIG_SND_SOC_POWERPC_QMC_AUDIO) += snd-soc-fsl-qmc-audio.o
 
 # MPC5200 Platform Support
 obj-$(CONFIG_SND_MPC52xx_DMA) += mpc5200_dma.o
sound/soc/fsl/fsl_qmc_audio.c new file +731 -0

731 lines not on this page · raw message

Signature · 1 line
2.38.1
author maintainer
#25 lore raw

PATCH v2 10/10 MAINTAINERS: add the Freescale QMC audio entry

In reply to Herve Codina

After contributing the component, add myself as the maintainer for the Freescale QMC audio ASoC component.

---
 MAINTAINERS | 8 ++++++++
 1 file changed, 8 insertions(+)
MAINTAINERS +8 -0
index 480f90db699d..a15997c2cc05 100644
@@ -8440,6 +8440,14 @@ F:	sound/soc/fsl/fsl*
 F:	sound/soc/fsl/imx*
 F:	sound/soc/fsl/mpc8610_hpcd.c
 
+FREESCALE SOC SOUND QMC DRIVER
+M:	Herve Codina <[email protected]>
+L:	[email protected] (moderated for non-subscribers)
+L:	[email protected]
+S:	Maintained
+F:	Documentation/devicetree/bindings/sound/fsl,qmc-audio.yaml
+F:	sound/soc/fsl/fsl_qmc_audio.c
+
 FREESCALE USB PERIPHERAL DRIVERS
 M:	Li Yang <[email protected]>
 L:	[email protected]
Signature · 1 line
2.38.1
#2 lore raw

Re: [PATCH v2 01/10] dt-bindings: soc: fsl: cpm_qe: Add TSA controller

In reply to Herve Codina
Quoted 51 lines · Herve Codina

Add support for the time slot assigner (TSA)
available in some PowerQUICC SoC such as MPC885
or MPC866.

---
 .../bindings/soc/fsl/cpm_qe/fsl,tsa.yaml      | 262 ++++++++++++++++++
 include/dt-bindings/soc/fsl-tsa.h             |  15 +
 2 files changed, 277 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml
 create mode 100644 include/dt-bindings/soc/fsl-tsa.h
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml new file +33 -0
new file mode 100644
index 000000000000..7542c0fd8435
@@ -0,0 +1,262 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/soc/fsl/cpm_qe/fsl,tsa.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: PowerQUICC CPM Time-slot assigner (TSA) controller
+
+maintainers:
+  - Herve Codina <[email protected]>
+
+description: |
+  The TSA is the time-slot assigner that can be found on some
+  PowerQUICC SoC.
+  Its purpose is to route some TDM time-slots to other internal
+  serial controllers.
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - fsl,mpc885-tsa
+          - fsl,mpc866-tsa
+      - const: fsl,cpm1-tsa
+
+  reg:
+    items:
+      - description: SI (Serial Interface) register base
+      - description: SI RAM base
+
+  reg-names:
+    items:
+      - const: si_regs

Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml line 43

Quoted 10 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml new file +10 -0
+      - const: si_ram
+
+  '#address-cells':
+    const: 1
+
+  '#size-cells':
+    const: 0
+
+patternProperties:
+  "^tdm@[0-1]$":

Use consistent quotes - either ' or "

Quoted 5 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml new file +5 -0
+    description:
+      The TDM managed by this controller
+    type: object
+
+    properties:

Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml line 58

Quoted 10 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml new file +10 -0
+      reg:
+        minimum: 0
+        maximum: 1
+        description:
+          The TDM number for this TDM, 0 for TDMa and 1 for TDMb
+
+      fsl,common-rxtx-pins:
+        $ref: /schemas/types.yaml#/definitions/flag
+        description:
+          Use common pins for both transmit and receive

What are the "common" pins? Without this property device is using uncommon pins? This does not make sense...

Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml line 61

Quoted 3 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml new file +3 -0
+
+      clocks: true
+      clock-names: true

Both need constraints.

Quoted 14 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml new file +14 -0
+
+      fsl,mode:
+        $ref: /schemas/types.yaml#/definitions/string
+        enum: [normal, echo, internal-loopback, control-loopback]
+        default: normal
+        description: |
+          Operational mode:
+            - normal:
+                Normal operation
+            - echo:
+                Automatic echo. Rx data is resent on Tx
+            - internal-loopback:
+                The TDM transmitter is connected to the receiver.
+                Data appears on Tx pin.

Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml line 85

Quoted 10 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml new file +10 -0
+            - control-loopback:
+                The TDM transmitter is connected to the receiver.
+                The Tx pin is disconnected.
+
+      fsl,rx-frame-sync-delay:
+        $ref: /schemas/types.yaml#/definitions/uint32
+        enum: [0, 1, 2, 3]
+        default: 0
+        description: |
+          Receive frame sync delay.

Delay in what units?

Quoted 26 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml new file +26 -0
+          Indicates the delay between the Rx sync and the first bit of the
+          Rx frame. 0 for no bit delay. 1, 2 or 3 for 1, 2 or 3 bits delay.
+
+      fsl,tx-frame-sync-delay:
+        $ref: /schemas/types.yaml#/definitions/uint32
+        enum: [0, 1, 2, 3]
+        default: 0
+        description: |
+          Transmit frame sync delay.
+          Indicates the delay between the Tx sync and the first bit of the
+          Tx frame. 0 for no bit delay. 1, 2 or 3 for 1, 2 or 3 bits delay.
+
+      fsl,clock-falling-edge:
+        $ref: /schemas/types.yaml#/definitions/flag
+        description: |
+          Data is sent on falling edge of the clock (and received on the
+          rising edge).
+          If 'clock-falling-edge' is not present, data is sent on the
+          rising edge (and received on the falling edge).
+
+      fsl,fsync-rising-edge:
+        $ref: /schemas/types.yaml#/definitions/flag
+        description:
+          Frame sync pulses are sampled with the rising edge of the channel
+          clock. If 'fsync-rising-edge' is not present, pulses are sample
+          with e falling edge.

Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml line 121

Quoted 10 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml new file +10 -0
+
+      fsl,double-speed-clock:
+        $ref: /schemas/types.yaml#/definitions/flag
+        description:
+          The channel clock is twice the data rate.
+
+      fsl,grant-mode:
+        $ref: /schemas/types.yaml#/definitions/flag
+        description:
+          Grant mode enabled.

This we know from property name. You need to describe what it is and what it does.

Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml line 123

Quoted 2 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml new file +2 -0
+
+      tx_ts_routes:

No underscores, missing vendor prefix.

Quoted 16 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml new file +16 -0
+        $ref: /schemas/types.yaml#/definitions/uint32-matrix
+        description: |
+          A list of tupple that indicates the Tx time-slots routes.
+            tx_ts_routes =
+               < 2 0 0>, /* The first 2 time slots are not used */
+               < 3 1 0>, /* The next 3 ones are route to SCC2 */
+               < 4 0 0>, /* The next 4 ones are not used */
+               < 2 2 0>; /* The nest 2 ones are route to SCC3 */
+        items:
+          items:
+            - description:
+                The number of time-slots
+              minimum: 1
+              maximum: 64
+            - description: |
+                The source serial interface (dt-bindings/soc/fsl-tsa.h

Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml line 149

Quoted 10 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml new file +10 -0
+                defines these values)
+                 - 0: No destination
+                 - 1: SCC2
+                 - 2: SCC3
+                 - 3: SCC4
+                 - 4: SMC1
+                 - 5: SMC2
+              enum: [0, 1, 2, 3, 4, 5]
+            - description:
+                The route flags (reserved)

Why part of binding is reserved?

Quoted 30 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml new file +30 -0
+              const: 0
+        minItems: 1
+        maxItems: 64
+
+      rx_ts_routes:
+        $ref: /schemas/types.yaml#/definitions/uint32-matrix
+        description: |
+          A list of tupple that indicates the Rx time-slots routes.
+            tx_ts_routes =
+               < 2 0 0>, /* The first 2 time slots are not used */
+               < 3 1 0>, /* The next 3 ones are route from SCC2 */
+               < 4 0 0>, /* The next 4 ones are not used */
+               < 2 2 0>; /* The nest 2 ones are route from SCC3 */
+        items:
+          items:
+            - description:
+                The number of time-slots
+              minimum: 1
+              maximum: 64
+            - description: |
+                The destination serial interface (dt-bindings/soc/fsl-tsa.h
+                defines these values)
+                 - 0: No destination
+                 - 1: SCC2
+                 - 2: SCC3
+                 - 3: SCC4
+                 - 4: SMC1
+                 - 5: SMC2
+              enum: [0, 1, 2, 3, 4, 5]
+            - description:

Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml line 189

Quoted 10 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml new file +10 -0
+                The route flags (reserved)
+              const: 0
+        minItems: 1
+        maxItems: 64
+
+    allOf:
+      - if:
+          properties:
+            fsl,common-rxtx-pins:
+              type: 'null'

What is this exactly? If check for property present, it's wrong. Should be test if it is in required.

include/dt-bindings/soc/fsl-tsa.h

Quoted 78 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml new file +73 -0
+        then:
+          properties:
+            clocks:
+              items:
+                - description: External clock connected to L1RSYNC pin
+                - description: External clock connected to L1RCLK pin
+                - description: External clock connected to L1TSYNC pin
+                - description: External clock connected to L1TCLK pin
+            clock-names:
+              items:
+                - const: l1rsync
+                - const: l1rclk
+                - const: l1tsync
+                - const: l1tclk
+        else:
+          properties:
+            clocks:
+              items:
+                - description: External clock connected to L1RSYNC pin
+                - description: External clock connected to L1RCLK pin
+            clock-names:
+              items:
+                - const: l1rsync
+                - const: l1rclk
+
+    required:
+      - reg
+      - clocks
+      - clock-names
+
+required:
+  - compatible
+  - reg
+  - reg-names
+  - '#address-cells'
+  - '#size-cells'
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/soc/fsl-tsa.h>
+
+    tsa@ae0 {
+        compatible = "fsl,mpc885-tsa", "fsl,cpm1-tsa";
+        reg = <0xae0 0x10>,
+              <0xc00 0x200>;
+        reg-names = "si_regs", "si_ram";
+
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        tdm@0 {
+            /* TDMa */
+            reg = <0>;
+
+            clocks = <&clk_l1rsynca>, <&clk_l1rclka>;
+            clock-names = "l1rsync", "l1rclk";
+
+            fsl,common-rxtx-pins;
+            fsl,fsync-rising-edge;
+
+            tx_ts_routes = < 2 0 0>,                 /* TS 0..1 */
+                           < 24 FSL_CPM_TSA_SCC4 0>, /* TS 2..25 */
+                           < 1 0 0>,                 /* TS 26 */
+                           < 5 FSL_CPM_TSA_SCC3 0>;  /* TS 27..31 */
+
+            rx_ts_routes = < 2 0 0>,                 /* TS 0..1 */
+                           < 24 FSL_CPM_TSA_SCC4 0>, /* 2..25 */
+                           < 1 0 0>,                 /* TS 26 */
+                           < 5 FSL_CPM_TSA_SCC3 0>;  /* TS 27..31 */
+        };
+    };
include/dt-bindings/soc/fsl-tsa.h new file +0 -0
new file mode 100644
index 000000000000..9d09468694a2

Filename should match binding filename.

include/dt-bindings/soc/fsl-tsa.h line 1

Quoted 2 lines
include/dt-bindings/soc/fsl-tsa.h new file +1 -0
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later OR MIT */

A bit weird license... cannot be the same as binding?

include/dt-bindings/soc/fsl-tsa.h line 6

Quoted 5 lines
include/dt-bindings/soc/fsl-tsa.h new file +5 -0
+
+#ifndef __DT_BINDINGS_SOC_FSL_TSA_H
+#define __DT_BINDINGS_SOC_FSL_TSA_H
+
+#define FSL_CPM_TSA_NU		0	/* Pseuso Cell Id for not used item */

Why defining unused IDs in binding header? These are IDs, not some hardware/register values.

include/dt-bindings/soc/fsl-tsa.h line 13

Quoted 7 lines
include/dt-bindings/soc/fsl-tsa.h new file +7 -0
+#define FSL_CPM_TSA_SCC2	1
+#define FSL_CPM_TSA_SCC3	2
+#define FSL_CPM_TSA_SCC4	3
+#define FSL_CPM_TSA_SMC1	4
+#define FSL_CPM_TSA_SMC2	5
+
+#define FSL_CPM_TSA_NBCELL	6

Drop.

include/dt-bindings/soc/fsl-tsa.h line 15

Quoted 2 lines
include/dt-bindings/soc/fsl-tsa.h new file +2 -0
+
+#endif

Best regards,
Krzysztof

#13 lore raw

Re: [PATCH v2 05/10] dt-bindings: soc: fsl: cpm_qe: Add QMC controller

In reply to Herve Codina
Quoted 43 lines · Herve Codina

Add support for the QMC (QUICC Multichannel Controller) available in some PowerQUICC SoC such as MPC885 or MPC866.

---
 .../bindings/soc/fsl/cpm_qe/fsl,qmc.yaml      | 167 ++++++++++++++++++
 1 file changed, 167 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,qmc.yaml
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,qmc.yaml new file +28 -0
new file mode 100644
index 000000000000..caf71f3a3f3f
@@ -0,0 +1,167 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/soc/fsl/cpm_qe/fsl,qmc.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: PowerQUICC CPM QUICC Multichannel Controller (QMC)
+
+maintainers:
+  - Herve Codina <[email protected]>
+
+description: |
+  The QMC (QUICC Multichannel Controller) emulates up to 64 channels within
+  one serial controller using the same TDM physical interface routed from
+  TSA.
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - fsl,mpc885-scc-qmc
+          - fsl,mpc866-scc-qmc
+      - const: fsl,cpm1-scc-qmc
+
+  reg:
+    items:
+      - description: SCC (Serial communication controller) register base
+      - description: SCC parameter ram base

Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,qmc.yaml line 38

Quoted 10 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,qmc.yaml new file +10 -0
+      - description: Dual port ram base
+
+  reg-names:
+    items:
+      - const: scc_regs
+      - const: scc_pram
+      - const: dpram
+
+  interrupts:
+    description: SCC interrupt line in the CPM interrupt controller

Missing constraints.

Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,qmc.yaml line 42

Quoted 4 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,qmc.yaml new file +4 -0
+
+  fsl,cpm-command:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: Cf. soc/fsl/cpm_qe/cpm.txt

Missing description.

Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,qmc.yaml line 46

Quoted 4 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,qmc.yaml new file +4 -0
+
+  tsa:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description: phandle to the TSA

Missing vendor prefix. Does not look like a generic property.

Quoted 26 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,qmc.yaml new file +26 -0
+
+  tsa-cell-id:
+    enum: [1, 2, 3]
+    description: |
+      TSA cell ID (dt-bindings/soc/fsl-tsa.h defines these values)
+       - 1: SCC2
+       - 2: SCC3
+       - 3: SCC4
+
+  '#address-cells':
+    const: 1
+
+  '#size-cells':
+    const: 0
+
+  '#chan-cells':
+    const: 1
+
+patternProperties:
+  "^channel@([0-9]|[1-5][0-9]|6[0-3])$":
+    description:
+      A channel managed by this controller
+    type: object
+
+    properties:
+      reg:

Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,qmc.yaml line 82

Quoted 10 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,qmc.yaml new file +10 -0
+        minimum: 0
+        maximum: 63
+        description:
+          The channel number
+
+      fsl,mode:
+        $ref: /schemas/types.yaml#/definitions/string
+        enum: [transparent, hdlc]
+        default: transparent
+        description: Operational mode

And what do they mean?

Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,qmc.yaml line 91

Quoted 9 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,qmc.yaml new file +9 -0
+
+      fsl,reverse-data:
+        $ref: /schemas/types.yaml#/definitions/flag
+        description:
+          The bit order as seen on the channels is reversed,
+          transmitting/receiving the MSB of each octet first.
+          This flag is used only in 'transparent' mode.
+
+      tx-ts-mask:

Missing vendor prefix.

Quoted 24 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,qmc.yaml new file +24 -0
+        $ref: /schemas/types.yaml#/definitions/uint64
+        description:
+          Channel assigned Tx time-slots within the Tx time-slots routed
+          by the TSA to this cell.
+
+      rx-ts-mask:
+        $ref: /schemas/types.yaml#/definitions/uint64
+        description:
+          Channel assigned Rx time-slots within the Rx time-slots routed
+          by the TSA to this cell.
+
+    required:
+      - reg
+      - tx-ts-mask
+      - rx-ts-mask
+
+required:
+  - compatible
+  - reg
+  - reg-names
+  - interrupts
+  - tsa
+  - tsa-cell-id
+  - '#address-cells'

Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,qmc.yaml line 125

Quoted 10 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,qmc.yaml new file +10 -0
+  - '#size-cells'
+  - '#chan-cells'
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/soc/fsl-tsa.h>
+
+    scc_qmc@a60 {

No underscores in node names.

Node names should be generic.
https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation

Quoted 13 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,qmc.yaml new file +13 -0
+        compatible = "fsl,mpc885-scc-qmc", "fsl,cpm1-scc-qmc";
+        reg = <0xa60 0x20>,
+              <0x3f00 0xc0>,
+              <0x2000 0x1000>;
+        reg-names = "scc_regs", "scc_pram", "dpram";
+        interrupts = <27>;
+        interrupt-parent = <&CPM_PIC>;
+        fsl,cpm-command = <0xc0>;
+
+        #address-cells = <1>;
+        #size-cells = <0>;
+        #chan-cells = <1>;
+

Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,qmc.yaml line 148

Quoted 10 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,qmc.yaml new file +10 -0
+        tsa = <&tsa>;
+        tsa-cell-id = <FSL_CPM_TSA_SCC4>;
+
+        channel@16 {
+            /* Ch16 : First 4 even TS from all routed from TSA */
+            reg = <16>;
+            fsl,mode = "transparent";
+            fsl,reverse-data;
+            tx-ts-mask = <0x00000000 0x000000AA>;
+            rx-ts-mask = <0x00000000 0x000000AA>;

Keep case consistent. lower-case hex.

Best regards,
Krzysztof

#21 lore raw

Re: [PATCH v2 08/10] dt-bindings: sound: Add support for QMC audio

In reply to Herve Codina
Quoted 26 lines · Herve Codina

The QMC (QUICC mutichannel controller) is a controller present in some PowerQUICC SoC such as MPC885. The QMC audio is an ASoC component that uses the QMC controller to transfer the audio data.

---
 .../bindings/sound/fsl,qmc-audio.yaml         | 110 ++++++++++++++++++
 1 file changed, 110 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/fsl,qmc-audio.yaml
Documentation/devicetree/bindings/sound/fsl,qmc-audio.yaml new file +9 -0
new file mode 100644
index 000000000000..b3774be36c19
@@ -0,0 +1,110 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sound/fsl,qmc-audio.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: QMC audio
+
+maintainers:

Documentation/devicetree/bindings/sound/fsl,qmc-audio.yaml line 19

Quoted 10 lines
Documentation/devicetree/bindings/sound/fsl,qmc-audio.yaml new file +10 -0
+  - Herve Codina <[email protected]>
+
+description: |
+  The QMC audio is an ASoC component which uses QMC (QUICC Multichannel
+  Controller) channels to transfer the audio data.
+  It provides as many DAI as the number of QMC channel used.
+
+properties:
+  compatible:
+    items:

Drop items.

Quoted 13 lines
Documentation/devicetree/bindings/sound/fsl,qmc-audio.yaml new file +13 -0
+      - const: fsl,qmc-audio
+
+  '#address-cells':
+    const: 1
+  '#size-cells':
+    const: 0
+  '#sound-dai-cells':
+    const: 1
+
+patternProperties:
+  "^dai@([0-9]|[1-5][0-9]|6[0-3])$":
+    description:
+      A DAI managed by this controller

Documentation/devicetree/bindings/sound/fsl,qmc-audio.yaml line 42

Quoted 10 lines
Documentation/devicetree/bindings/sound/fsl,qmc-audio.yaml new file +10 -0
+    type: object
+
+    properties:
+      reg:
+        minimum: 0
+        maximum: 63
+        description:
+          The DAI number
+
+      qmc-chan:

Missing vendor prefix.

Documentation/devicetree/bindings/sound/fsl,qmc-audio.yaml line 43

Quoted 1 line
Documentation/devicetree/bindings/sound/fsl,qmc-audio.yaml new file +1 -0
+        $ref: /schemas/types.yaml#/definitions/phandle-array

Why this is not a phandle?

Quoted 7 lines
Documentation/devicetree/bindings/sound/fsl,qmc-audio.yaml new file +7 -0
+        description: phandle to the QMC channel> +        maxItems: 1
+
+    required:
+      - reg
+      - qmc-chan
+
+required:

Documentation/devicetree/bindings/sound/fsl,qmc-audio.yaml line 61

Quoted 10 lines
Documentation/devicetree/bindings/sound/fsl,qmc-audio.yaml new file +10 -0
+  - compatible
+  - '#address-cells'
+  - '#size-cells'
+  - '#sound-dai-cells'
+
+additionalProperties: false
+
+examples:
+  - |
+    qmc_audio: qmc_audio {

Same problem as in previous patch.

Documentation/devicetree/bindings/sound/fsl,qmc-audio.yaml line 74

Quoted 13 lines
Documentation/devicetree/bindings/sound/fsl,qmc-audio.yaml new file +13 -0
+        compatible = "fsl,qmc-audio";
+        #address-cells = <1>;
+        #size-cells = <0>;
+        #sound-dai-cells = <1>;
+        dai@16 {
+            reg = <16>;
+            qmc-chan = <&scc_qmc 16>;
+        };
+        dai@17 {
+            reg = <17>;
+            qmc-chan = <&scc_qmc 17>;
+        };
+    };

Best regards,
Krzysztof

author maintainer
#3 lore raw

Re: [PATCH v2 01/10] dt-bindings: soc: fsl: cpm_qe: Add TSA controller

In reply to Krzysztof Kozlowski

Hi Krzysztof,

On Sun, 8 Jan 2023 16:10:38 +0100
Krzysztof Kozlowski <[email protected]> wrote:

[...]

Quoted 7 lines

Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml line 43

Quoted 5 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml new file +5 -0
+  '#size-cells':
+    const: 0
+
+patternProperties:
+  "^tdm@[0-1]$":  

Use consistent quotes - either ' or "

Ok, I will change on v3.
I will also change them on the other bindings present in the series.

Quoted 11 lines
Quoted 11 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml new file +10 -0
+    description:
+      The TDM managed by this controller
+    type: object
+
+    properties:
+      reg:
+        minimum: 0
+        maximum: 1
+        description:
+          The TDM number for this TDM, 0 for TDMa and 1 for TDMb
Quoted 8 lines

Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml line 58

Quoted 5 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml new file +5 -0
+
+      fsl,common-rxtx-pins:
+        $ref: /schemas/types.yaml#/definitions/flag
+        description:
+          Use common pins for both transmit and receive  

What are the "common" pins? Without this property device is using uncommon pins? This does not make sense...

Common in the "shared" sense.
The hardware can use dedicated pins for Tx clock, Tx sync, Rx clock and Rx sync or use only 2 pins, Tx/Rx clock and Rx/Rx sync.

Without the property, we use the 4 pins and with the property, we use 2 pins.

Quoted 6 lines

Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml line 61

Quoted 4 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml new file +3 -0
+
+      clocks: true
+      clock-names: true  

Both need constraints.

The constraints are present later in the file as the number of clocks depends on the 'fsl,common-rxtx-pins' property.

I will remove these two lines in the v3 series as they are not needed. 'clocks' and 'clock-names' are handled in the conditional part.

Quoted 1 line

[...]

Quoted 9 lines

Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml line 85

Quoted 7 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml new file +7 -0
+
+      fsl,rx-frame-sync-delay:
+        $ref: /schemas/types.yaml#/definitions/uint32
+        enum: [0, 1, 2, 3]
+        default: 0
+        description: |
+          Receive frame sync delay.  

Delay in what units?

The unit is a number of bits.
I will rename to fsl,rx-frame-sync-delay-bits and change the description to 'Receive frame sync delay in number of bits'

I will do also the same for fsl,tx-frame-sync-delay property.

Quoted 32 lines
Quoted 32 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml new file +31 -0
+          Indicates the delay between the Rx sync and the first bit of the
+          Rx frame. 0 for no bit delay. 1, 2 or 3 for 1, 2 or 3 bits delay.
+
+      fsl,tx-frame-sync-delay:
+        $ref: /schemas/types.yaml#/definitions/uint32
+        enum: [0, 1, 2, 3]
+        default: 0
+        description: |
+          Transmit frame sync delay.
+          Indicates the delay between the Tx sync and the first bit of the
+          Tx frame. 0 for no bit delay. 1, 2 or 3 for 1, 2 or 3 bits delay.
+
+      fsl,clock-falling-edge:
+        $ref: /schemas/types.yaml#/definitions/flag
+        description: |
+          Data is sent on falling edge of the clock (and received on the
+          rising edge).
+          If 'clock-falling-edge' is not present, data is sent on the
+          rising edge (and received on the falling edge).
+
+      fsl,fsync-rising-edge:
+        $ref: /schemas/types.yaml#/definitions/flag
+        description:
+          Frame sync pulses are sampled with the rising edge of the channel
+          clock. If 'fsync-rising-edge' is not present, pulses are sample
+          with e falling edge.
+
+      fsl,double-speed-clock:
+        $ref: /schemas/types.yaml#/definitions/flag
+        description:
+          The channel clock is twice the data rate.
Quoted 8 lines

Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml line 121

Quoted 5 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml new file +5 -0
+
+      fsl,grant-mode:
+        $ref: /schemas/types.yaml#/definitions/flag
+        description:
+          Grant mode enabled.  

This we know from property name. You need to describe what it is and what it does.

Instead of describing it, I will simply remove the property (I should have done already).
I cannot test the 'grant mode' enabled with my hardware and so I prefer keeping it disabled.
This property, if needed, could be add later setting it optional with default to 'disabled'.

Quoted 5 lines

Review

Quoted 3 lines
(quoted diff) +2 -0
+
+      tx_ts_routes:  

No underscores, missing vendor prefix.

Indeed, will be change to fsl,tx-ts-routes (idem for rx_ts_routes).

Quoted 28 lines
Quoted 17 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml new file +16 -0
+        $ref: /schemas/types.yaml#/definitions/uint32-matrix
+        description: |
+          A list of tupple that indicates the Tx time-slots routes.
+            tx_ts_routes =
+               < 2 0 0>, /* The first 2 time slots are not used */
+               < 3 1 0>, /* The next 3 ones are route to SCC2 */
+               < 4 0 0>, /* The next 4 ones are not used */
+               < 2 2 0>; /* The nest 2 ones are route to SCC3 */
+        items:
+          items:
+            - description:
+                The number of time-slots
+              minimum: 1
+              maximum: 64
+            - description: |
+                The source serial interface (dt-bindings/soc/fsl-tsa.h

Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml line 149

Quoted 10 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml new file +10 -0
+                defines these values)
+                 - 0: No destination
+                 - 1: SCC2
+                 - 2: SCC3
+                 - 3: SCC4
+                 - 4: SMC1
+                 - 5: SMC2
+              enum: [0, 1, 2, 3, 4, 5]
+            - description:
+                The route flags (reserved)  
Quoted 1 line

Why part of binding is reserved?

The 'reserved' part will be removed in v3.
Same for the rx route table.

Quoted 36 lines
Quoted 36 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml new file +35 -0
+              const: 0
+        minItems: 1
+        maxItems: 64
+
+      rx_ts_routes:
+        $ref: /schemas/types.yaml#/definitions/uint32-matrix
+        description: |
+          A list of tupple that indicates the Rx time-slots routes.
+            tx_ts_routes =
+               < 2 0 0>, /* The first 2 time slots are not used */
+               < 3 1 0>, /* The next 3 ones are route from SCC2 */
+               < 4 0 0>, /* The next 4 ones are not used */
+               < 2 2 0>; /* The nest 2 ones are route from SCC3 */
+        items:
+          items:
+            - description:
+                The number of time-slots
+              minimum: 1
+              maximum: 64
+            - description: |
+                The destination serial interface (dt-bindings/soc/fsl-tsa.h
+                defines these values)
+                 - 0: No destination
+                 - 1: SCC2
+                 - 2: SCC3
+                 - 3: SCC4
+                 - 4: SMC1
+                 - 5: SMC2
+              enum: [0, 1, 2, 3, 4, 5]
+            - description:
+                The route flags (reserved)
+              const: 0
+        minItems: 1
+        maxItems: 64
+
Quoted 8 lines

Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml line 189

Quoted 5 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml new file +5 -0
+    allOf:
+      - if:
+          properties:
+            fsl,common-rxtx-pins:
+              type: 'null'  

What is this exactly? If check for property present, it's wrong. Should be test if it is in required.

Yes, it was a check for the property presence.

If we not use the 'fsl,common-rxtx-pins', we need 4 clocks. If we use the 'fsl,common-rxtx-pins', we need 2 clocks (Rx part and Tx part use the same CLK and SYNC clocks).

How can I describe this ?
Is the check for the property presence incorrect ?

Should I always describe 4 clocks even if only 2 are used ?

Quoted 73 lines
Quoted 73 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml new file +72 -0
+        then:
+          properties:
+            clocks:
+              items:
+                - description: External clock connected to L1RSYNC pin
+                - description: External clock connected to L1RCLK pin
+                - description: External clock connected to L1TSYNC pin
+                - description: External clock connected to L1TCLK pin
+            clock-names:
+              items:
+                - const: l1rsync
+                - const: l1rclk
+                - const: l1tsync
+                - const: l1tclk
+        else:
+          properties:
+            clocks:
+              items:
+                - description: External clock connected to L1RSYNC pin
+                - description: External clock connected to L1RCLK pin
+            clock-names:
+              items:
+                - const: l1rsync
+                - const: l1rclk
+
+    required:
+      - reg
+      - clocks
+      - clock-names
+
+required:
+  - compatible
+  - reg
+  - reg-names
+  - '#address-cells'
+  - '#size-cells'
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/soc/fsl-tsa.h>
+
+    tsa@ae0 {
+        compatible = "fsl,mpc885-tsa", "fsl,cpm1-tsa";
+        reg = <0xae0 0x10>,
+              <0xc00 0x200>;
+        reg-names = "si_regs", "si_ram";
+
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        tdm@0 {
+            /* TDMa */
+            reg = <0>;
+
+            clocks = <&clk_l1rsynca>, <&clk_l1rclka>;
+            clock-names = "l1rsync", "l1rclk";
+
+            fsl,common-rxtx-pins;
+            fsl,fsync-rising-edge;
+
+            tx_ts_routes = < 2 0 0>,                 /* TS 0..1 */
+                           < 24 FSL_CPM_TSA_SCC4 0>, /* TS 2..25 */
+                           < 1 0 0>,                 /* TS 26 */
+                           < 5 FSL_CPM_TSA_SCC3 0>;  /* TS 27..31 */
+
+            rx_ts_routes = < 2 0 0>,                 /* TS 0..1 */
+                           < 24 FSL_CPM_TSA_SCC4 0>, /* 2..25 */
+                           < 1 0 0>,                 /* TS 26 */
+                           < 5 FSL_CPM_TSA_SCC3 0>;  /* TS 27..31 */
+        };
Quoted 8 lines

include/dt-bindings/soc/fsl-tsa.h

Quoted 6 lines
(quoted diff) +1 -0
+    };
include/dt-bindings/soc/fsl-tsa.h new file +0 -0
new file mode 100644
index 000000000000..9d09468694a2

Filename should match binding filename.

Right, I will rename to fsl,tsa.h

Quoted 5 lines

include/dt-bindings/soc/fsl-tsa.h line 1

Quoted 3 lines
include/dt-bindings/soc/fsl-tsa.h new file +1 -0
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later OR MIT */  

A bit weird license... cannot be the same as binding?

Yes, will be change to GPL-2.0-only OR BSD-2-Clause

Quoted 9 lines

include/dt-bindings/soc/fsl-tsa.h line 6

Quoted 6 lines
include/dt-bindings/soc/fsl-tsa.h new file +5 -0
+
+#ifndef __DT_BINDINGS_SOC_FSL_TSA_H
+#define __DT_BINDINGS_SOC_FSL_TSA_H
+
+#define FSL_CPM_TSA_NU		0	/* Pseuso Cell Id for not used item */  

Why defining unused IDs in binding header? These are IDs, not some hardware/register values.

It is the binding value for 'No destination' in the tx and rx route table. This binding value means 'not used' or 'discard' the time-slot. The data related to an item in the routing table with this value will be discarded and not used.

Quoted 10 lines

include/dt-bindings/soc/fsl-tsa.h line 13

Quoted 8 lines
include/dt-bindings/soc/fsl-tsa.h new file +7 -0
+#define FSL_CPM_TSA_SCC2	1
+#define FSL_CPM_TSA_SCC3	2
+#define FSL_CPM_TSA_SCC4	3
+#define FSL_CPM_TSA_SMC1	4
+#define FSL_CPM_TSA_SMC2	5
+
+#define FSL_CPM_TSA_NBCELL	6  

Drop.

Ok, will be removed in v3.

Quoted 7 lines

include/dt-bindings/soc/fsl-tsa.h line 15

Quoted 3 lines
include/dt-bindings/soc/fsl-tsa.h new file +2 -0
+
+#endif  

Best regards,
Krzysztof

Thanks for your review.

Best regards,
Hervé

Signature · 3 lines
Hervé Codina, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
author maintainer
#14 lore raw

Re: [PATCH v2 05/10] dt-bindings: soc: fsl: cpm_qe: Add QMC controller

In reply to Krzysztof Kozlowski

Hi Krzysztof,

On Sun, 8 Jan 2023 16:14:47 +0100
Krzysztof Kozlowski <[email protected]> wrote:

[...]

Quoted 5 lines

Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,qmc.yaml line 38

Quoted 3 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,qmc.yaml new file +3 -0
+
+  interrupts:
+    description: SCC interrupt line in the CPM interrupt controller  

Missing constraints.

'maxItems: 1' will be added in v3

Quoted 7 lines

Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,qmc.yaml line 42

Quoted 5 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,qmc.yaml new file +4 -0
+
+  fsl,cpm-command:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: Cf. soc/fsl/cpm_qe/cpm.txt  

Missing description.

'fsl,cpm-command' will be removed in v3.
The value needed is determined based on other information. This is not needed in the DT.

Quoted 7 lines

Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,qmc.yaml line 46

Quoted 5 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,qmc.yaml new file +4 -0
+
+  tsa:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description: phandle to the TSA  

Missing vendor prefix. Does not look like a generic property.

Will be be changed to 'fsl,tsa'
and also 'tsa-cell-id' will be changed to 'fsl,tsa-cell-id'

Quoted 1 line

[...]

Quoted 13 lines
Quoted 13 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,qmc.yaml new file +13 -0
+
+patternProperties:
+  "^channel@([0-9]|[1-5][0-9]|6[0-3])$":
+    description:
+      A channel managed by this controller
+    type: object
+
+    properties:
+      reg:
+        minimum: 0
+        maximum: 63
+        description:
+          The channel number
Quoted 8 lines

Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,qmc.yaml line 82

Quoted 6 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,qmc.yaml new file +6 -0
+
+      fsl,mode:
+        $ref: /schemas/types.yaml#/definitions/string
+        enum: [transparent, hdlc]
+        default: transparent
+        description: Operational mode  

And what do they mean?

I will change with
description: |
The channel operational mode
- hdlc: The channel handles HDLC frames
- transparent: The channel handles raw data without any processing

Quoted 12 lines

Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,qmc.yaml line 91

Quoted 10 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,qmc.yaml new file +9 -0
+
+      fsl,reverse-data:
+        $ref: /schemas/types.yaml#/definitions/flag
+        description:
+          The bit order as seen on the channels is reversed,
+          transmitting/receiving the MSB of each octet first.
+          This flag is used only in 'transparent' mode.
+
+      tx-ts-mask:  

Missing vendor prefix.

Will be added, also on rx-ts-mask.

Quoted 38 lines
Quoted 25 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,qmc.yaml new file +24 -0
+        $ref: /schemas/types.yaml#/definitions/uint64
+        description:
+          Channel assigned Tx time-slots within the Tx time-slots routed
+          by the TSA to this cell.
+
+      rx-ts-mask:
+        $ref: /schemas/types.yaml#/definitions/uint64
+        description:
+          Channel assigned Rx time-slots within the Rx time-slots routed
+          by the TSA to this cell.
+
+    required:
+      - reg
+      - tx-ts-mask
+      - rx-ts-mask
+
+required:
+  - compatible
+  - reg
+  - reg-names
+  - interrupts
+  - tsa
+  - tsa-cell-id
+  - '#address-cells'

Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,qmc.yaml line 125

Quoted 10 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,qmc.yaml new file +10 -0
+  - '#size-cells'
+  - '#chan-cells'
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/soc/fsl-tsa.h>
+
+    scc_qmc@a60 {  

No underscores in node names.

Quoted 2 lines

Node names should be generic.
https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation

Will be changed to qmc@a60

Quoted 18 lines
Quoted 18 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,qmc.yaml new file +17 -0
+        compatible = "fsl,mpc885-scc-qmc", "fsl,cpm1-scc-qmc";
+        reg = <0xa60 0x20>,
+              <0x3f00 0xc0>,
+              <0x2000 0x1000>;
+        reg-names = "scc_regs", "scc_pram", "dpram";
+        interrupts = <27>;
+        interrupt-parent = <&CPM_PIC>;
+        fsl,cpm-command = <0xc0>;
+
+        #address-cells = <1>;
+        #size-cells = <0>;
+        #chan-cells = <1>;
+
+        tsa = <&tsa>;
+        tsa-cell-id = <FSL_CPM_TSA_SCC4>;
+
+        channel@16 {
Quoted 8 lines

Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,qmc.yaml line 148

Quoted 6 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,qmc.yaml new file +6 -0
+            /* Ch16 : First 4 even TS from all routed from TSA */
+            reg = <16>;
+            fsl,mode = "transparent";
+            fsl,reverse-data;
+            tx-ts-mask = <0x00000000 0x000000AA>;
+            rx-ts-mask = <0x00000000 0x000000AA>;  

Keep case consistent. lower-case hex.

Will be fixed

Quoted 4 lines

Best regards,
Krzysztof

Thanks for the review,

Best regards,
Hervé

Signature · 3 lines
Hervé Codina, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
author maintainer
#22 lore raw

Re: [PATCH v2 08/10] dt-bindings: sound: Add support for QMC audio

In reply to Krzysztof Kozlowski

Hi Krzysztof,

Quoted 31 lines · On Sun, 8 Jan 2023 16:16:24 +0100 Krzysztof Kozlowski…
Quoted 30 lines · Herve Codina

The QMC (QUICC mutichannel controller) is a controller present in some PowerQUICC SoC such as MPC885. The QMC audio is an ASoC component that uses the QMC controller to transfer the audio data.

---
 .../bindings/sound/fsl,qmc-audio.yaml         | 110 ++++++++++++++++++
 1 file changed, 110 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/fsl,qmc-audio.yaml
Documentation/devicetree/bindings/sound/fsl,qmc-audio.yaml new file +13 -0
new file mode 100644
index 000000000000..b3774be36c19
@@ -0,0 +1,110 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sound/fsl,qmc-audio.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: QMC audio
+
+maintainers:
+  - Herve Codina <[email protected]>
+
+description: |
+  The QMC audio is an ASoC component which uses QMC (QUICC Multichannel
Quoted 8 lines

Documentation/devicetree/bindings/sound/fsl,qmc-audio.yaml line 19

Quoted 6 lines
Documentation/devicetree/bindings/sound/fsl,qmc-audio.yaml new file +6 -0
+  Controller) channels to transfer the audio data.
+  It provides as many DAI as the number of QMC channel used.
+
+properties:
+  compatible:
+    items:  

Drop items.

Will be dropped.

Quoted 18 lines
Quoted 18 lines
Documentation/devicetree/bindings/sound/fsl,qmc-audio.yaml new file +17 -0
+      - const: fsl,qmc-audio
+
+  '#address-cells':
+    const: 1
+  '#size-cells':
+    const: 0
+  '#sound-dai-cells':
+    const: 1
+
+patternProperties:
+  "^dai@([0-9]|[1-5][0-9]|6[0-3])$":
+    description:
+      A DAI managed by this controller
+    type: object
+
+    properties:
+      reg:
Quoted 8 lines

Documentation/devicetree/bindings/sound/fsl,qmc-audio.yaml line 42

Quoted 6 lines
Documentation/devicetree/bindings/sound/fsl,qmc-audio.yaml new file +6 -0
+        minimum: 0
+        maximum: 63
+        description:
+          The DAI number
+
+      qmc-chan:  

Missing vendor prefix.

Will be changed to 'fsl,qmc-chan'

Quoted 4 lines

Documentation/devicetree/bindings/sound/fsl,qmc-audio.yaml line 43

Quoted 2 lines
Documentation/devicetree/bindings/sound/fsl,qmc-audio.yaml new file +1 -0
+        $ref: /schemas/types.yaml#/definitions/phandle-array  

Why this is not a phandle?

I have try '$ref: /schemas/types.yaml#/definitions/phandle'

I have an error from make dt_binding_check:
dai@16:fsl,qmc-chan:0: [4294967295, 16] is too long

I need a phandle with an argument ie <&qmc 16>.
Is there an alternative to phandle-array to handle this case ?

Quoted 12 lines
Quoted 12 lines
Documentation/devicetree/bindings/sound/fsl,qmc-audio.yaml new file +11 -0
+        description: phandle to the QMC channel> +        maxItems: 1
+
+    required:
+      - reg
+      - qmc-chan
+
+required:
+  - compatible
+  - '#address-cells'
+  - '#size-cells'
+  - '#sound-dai-cells'
Quoted 8 lines

Documentation/devicetree/bindings/sound/fsl,qmc-audio.yaml line 61

Quoted 6 lines
Documentation/devicetree/bindings/sound/fsl,qmc-audio.yaml new file +6 -0
+
+additionalProperties: false
+
+examples:
+  - |
+    qmc_audio: qmc_audio {  

Same problem as in previous patch.

Changed to 'audio-controller'.

Quoted 15 lines
Quoted 4 lines
Documentation/devicetree/bindings/sound/fsl,qmc-audio.yaml new file +3 -0
+        compatible = "fsl,qmc-audio";
+        #address-cells = <1>;
+        #size-cells = <0>;

Documentation/devicetree/bindings/sound/fsl,qmc-audio.yaml line 74

Quoted 10 lines
Documentation/devicetree/bindings/sound/fsl,qmc-audio.yaml new file +10 -0
+        #sound-dai-cells = <1>;
+        dai@16 {
+            reg = <16>;
+            qmc-chan = <&scc_qmc 16>;
+        };
+        dai@17 {
+            reg = <17>;
+            qmc-chan = <&scc_qmc 17>;
+        };
+    };  
Quoted 3 lines

Best regards,
Krzysztof

Thanks for the review.

Best regards,
Hervé

Signature · 3 lines
Hervé Codina, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Acked-by on v2 4/10
#11 lore raw

Re: [PATCH v2 04/10] powerpc/8xx: Use a larger CPM1 command check mask

In reply to Herve Codina

Le 06/01/2023 à 17:37, Herve Codina a écrit :

Quoted 7 lines

The CPM1 command mask is defined for use with the standard CPM1 command register as described in the user's manual:

   0  |1        3|4    7|8   11|12      14| 15|
   RST|    -     |OPCODE|CH_NUM|     -    |FLG|

In the QMC extension the CPM1 command register is redefined (QMC supplement user's manuel) with the following mapping:

Quoted 8 lines
   0  |1        3|4    7|8           13|14| 15|
   RST|QMC OPCODE|  1110|CHANNEL_NUMBER| -|FLG|

Extend the check command mask in order to support both the standard CH_NUM field and the QMC extension CHANNEL_NUMBER field.

of LINUX FOR POWERPC EMBEDDED PPC8XX)

Quoted 17 lines
---
  arch/powerpc/platforms/8xx/cpm1.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/platforms/8xx/cpm1.c +1 -1
index 8ef1f4392086..6b828b9f90d9 100644
@@ -100,7 +100,7 @@ int cpm_command(u32 command, u8 opcode)
  	int i, ret;
  	unsigned long flags;
 
-	if (command & 0xffffff0f)
+	if (command & 0xffffff03)
  		return -EINVAL;
 
  	spin_lock_irqsave(&cmd_lock, flags);
#4 lore raw

Re: [PATCH v2 01/10] dt-bindings: soc: fsl: cpm_qe: Add TSA controller

In reply to Herve Codina
Quoted 39 lines · Herve Codina

Hi Krzysztof,

On Sun, 8 Jan 2023 16:10:38 +0100
Krzysztof Kozlowski <[email protected]> wrote:

[...]

Quoted 7 lines

Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml line 43

Quoted 5 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml new file +5 -0
+  '#size-cells':
+    const: 0
+
+patternProperties:
+  "^tdm@[0-1]$":  

Use consistent quotes - either ' or "

Ok, I will change on v3.
I will also change them on the other bindings present in the series.

Quoted 11 lines
Quoted 11 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml new file +10 -0
+    description:
+      The TDM managed by this controller
+    type: object
+
+    properties:
+      reg:
+        minimum: 0
+        maximum: 1
+        description:
+          The TDM number for this TDM, 0 for TDMa and 1 for TDMb
Quoted 8 lines

Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml line 58

Quoted 5 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml new file +5 -0
+
+      fsl,common-rxtx-pins:
+        $ref: /schemas/types.yaml#/definitions/flag
+        description:
+          Use common pins for both transmit and receive  

What are the "common" pins? Without this property device is using uncommon pins? This does not make sense...

Quoted 7 lines

Common in the "shared" sense.
The hardware can use dedicated pins for Tx clock, Tx sync, Rx clock and Rx sync or use only 2 pins, Tx/Rx clock and Rx/Rx sync.

Without the property, we use the 4 pins and with the property, we use 2 pins.

Just use this as description.

Quoted 10 lines
Quoted 7 lines

Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml line 61

Quoted 5 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml new file +3 -0
+
+      clocks: true
+      clock-names: true  

Both need constraints.

The constraints are present later in the file as the number of clocks depends on the 'fsl,common-rxtx-pins' property.

OK, but still top level properties need widest constraints.

Quoted 4 lines

I will remove these two lines in the v3 series as they are not needed. 'clocks' and 'clock-names' are handled in the conditional part.

No, top level properties must contain them.

Quoted 11 lines
Quoted 2 lines

[...]

Quoted 8 lines
Quoted 7 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml new file +7 -0
+
+      fsl,rx-frame-sync-delay:
+        $ref: /schemas/types.yaml#/definitions/uint32
+        enum: [0, 1, 2, 3]
+        default: 0
+        description: |
+          Receive frame sync delay.  
Quoted 7 lines
Quoted 1 line

Delay in what units?

The unit is a number of bits.
I will rename to fsl,rx-frame-sync-delay-bits and change the description to 'Receive frame sync delay in number of bits'

I will do also the same for fsl,tx-frame-sync-delay property.

OK

Quoted 135 lines
Quoted 33 lines
Quoted 33 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml new file +31 -0
+          Indicates the delay between the Rx sync and the first bit of the
+          Rx frame. 0 for no bit delay. 1, 2 or 3 for 1, 2 or 3 bits delay.
+
+      fsl,tx-frame-sync-delay:
+        $ref: /schemas/types.yaml#/definitions/uint32
+        enum: [0, 1, 2, 3]
+        default: 0
+        description: |
+          Transmit frame sync delay.
+          Indicates the delay between the Tx sync and the first bit of the
+          Tx frame. 0 for no bit delay. 1, 2 or 3 for 1, 2 or 3 bits delay.
+
+      fsl,clock-falling-edge:
+        $ref: /schemas/types.yaml#/definitions/flag
+        description: |
+          Data is sent on falling edge of the clock (and received on the
+          rising edge).
+          If 'clock-falling-edge' is not present, data is sent on the
+          rising edge (and received on the falling edge).
+
+      fsl,fsync-rising-edge:
+        $ref: /schemas/types.yaml#/definitions/flag
+        description:
+          Frame sync pulses are sampled with the rising edge of the channel
+          clock. If 'fsync-rising-edge' is not present, pulses are sample
+          with e falling edge.
+
+      fsl,double-speed-clock:
+        $ref: /schemas/types.yaml#/definitions/flag
+        description:
+          The channel clock is twice the data rate.
Quoted 8 lines

Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml line 121

Quoted 5 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml new file +5 -0
+
+      fsl,grant-mode:
+        $ref: /schemas/types.yaml#/definitions/flag
+        description:
+          Grant mode enabled.  

This we know from property name. You need to describe what it is and what it does.

Instead of describing it, I will simply remove the property (I should have done already).
I cannot test the 'grant mode' enabled with my hardware and so I prefer keeping it disabled.
This property, if needed, could be add later setting it optional with default to 'disabled'.

Quoted 5 lines

Review

Quoted 3 lines
(quoted diff) +2 -0
+
+      tx_ts_routes:  

No underscores, missing vendor prefix.

Indeed, will be change to fsl,tx-ts-routes (idem for rx_ts_routes).

Quoted 28 lines
Quoted 17 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml new file +16 -0
+        $ref: /schemas/types.yaml#/definitions/uint32-matrix
+        description: |
+          A list of tupple that indicates the Tx time-slots routes.
+            tx_ts_routes =
+               < 2 0 0>, /* The first 2 time slots are not used */
+               < 3 1 0>, /* The next 3 ones are route to SCC2 */
+               < 4 0 0>, /* The next 4 ones are not used */
+               < 2 2 0>; /* The nest 2 ones are route to SCC3 */
+        items:
+          items:
+            - description:
+                The number of time-slots
+              minimum: 1
+              maximum: 64
+            - description: |
+                The source serial interface (dt-bindings/soc/fsl-tsa.h

Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml line 149

Quoted 10 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml new file +10 -0
+                defines these values)
+                 - 0: No destination
+                 - 1: SCC2
+                 - 2: SCC3
+                 - 3: SCC4
+                 - 4: SMC1
+                 - 5: SMC2
+              enum: [0, 1, 2, 3, 4, 5]
+            - description:
+                The route flags (reserved)  
Quoted 1 line

Why part of binding is reserved?

The 'reserved' part will be removed in v3.
Same for the rx route table.

Quoted 36 lines
Quoted 36 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml new file +35 -0
+              const: 0
+        minItems: 1
+        maxItems: 64
+
+      rx_ts_routes:
+        $ref: /schemas/types.yaml#/definitions/uint32-matrix
+        description: |
+          A list of tupple that indicates the Rx time-slots routes.
+            tx_ts_routes =
+               < 2 0 0>, /* The first 2 time slots are not used */
+               < 3 1 0>, /* The next 3 ones are route from SCC2 */
+               < 4 0 0>, /* The next 4 ones are not used */
+               < 2 2 0>; /* The nest 2 ones are route from SCC3 */
+        items:
+          items:
+            - description:
+                The number of time-slots
+              minimum: 1
+              maximum: 64
+            - description: |
+                The destination serial interface (dt-bindings/soc/fsl-tsa.h
+                defines these values)
+                 - 0: No destination
+                 - 1: SCC2
+                 - 2: SCC3
+                 - 3: SCC4
+                 - 4: SMC1
+                 - 5: SMC2
+              enum: [0, 1, 2, 3, 4, 5]
+            - description:
+                The route flags (reserved)
+              const: 0
+        minItems: 1
+        maxItems: 64
+
Quoted 8 lines

Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml line 189

Quoted 5 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml new file +5 -0
+    allOf:
+      - if:
+          properties:
+            fsl,common-rxtx-pins:
+              type: 'null'  

What is this exactly? If check for property present, it's wrong. Should be test if it is in required.

Quoted 5 lines

Yes, it was a check for the property presence.

If we not use the 'fsl,common-rxtx-pins', we need 4 clocks. If we use the 'fsl,common-rxtx-pins', we need 2 clocks (Rx part and Tx part use the same CLK and SYNC clocks).

https://elixir.bootlin.com/linux/v6.2-rc3/source/Documentation/devicetree/bindings/net/qcom,ipa.yaml#L174

Quoted 89 lines

How can I describe this ?
Is the check for the property presence incorrect ?

Should I always describe 4 clocks even if only 2 are used ?

Quoted 73 lines
Quoted 73 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,tsa.yaml new file +72 -0
+        then:
+          properties:
+            clocks:
+              items:
+                - description: External clock connected to L1RSYNC pin
+                - description: External clock connected to L1RCLK pin
+                - description: External clock connected to L1TSYNC pin
+                - description: External clock connected to L1TCLK pin
+            clock-names:
+              items:
+                - const: l1rsync
+                - const: l1rclk
+                - const: l1tsync
+                - const: l1tclk
+        else:
+          properties:
+            clocks:
+              items:
+                - description: External clock connected to L1RSYNC pin
+                - description: External clock connected to L1RCLK pin
+            clock-names:
+              items:
+                - const: l1rsync
+                - const: l1rclk
+
+    required:
+      - reg
+      - clocks
+      - clock-names
+
+required:
+  - compatible
+  - reg
+  - reg-names
+  - '#address-cells'
+  - '#size-cells'
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/soc/fsl-tsa.h>
+
+    tsa@ae0 {
+        compatible = "fsl,mpc885-tsa", "fsl,cpm1-tsa";
+        reg = <0xae0 0x10>,
+              <0xc00 0x200>;
+        reg-names = "si_regs", "si_ram";
+
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        tdm@0 {
+            /* TDMa */
+            reg = <0>;
+
+            clocks = <&clk_l1rsynca>, <&clk_l1rclka>;
+            clock-names = "l1rsync", "l1rclk";
+
+            fsl,common-rxtx-pins;
+            fsl,fsync-rising-edge;
+
+            tx_ts_routes = < 2 0 0>,                 /* TS 0..1 */
+                           < 24 FSL_CPM_TSA_SCC4 0>, /* TS 2..25 */
+                           < 1 0 0>,                 /* TS 26 */
+                           < 5 FSL_CPM_TSA_SCC3 0>;  /* TS 27..31 */
+
+            rx_ts_routes = < 2 0 0>,                 /* TS 0..1 */
+                           < 24 FSL_CPM_TSA_SCC4 0>, /* 2..25 */
+                           < 1 0 0>,                 /* TS 26 */
+                           < 5 FSL_CPM_TSA_SCC3 0>;  /* TS 27..31 */
+        };
Quoted 8 lines

include/dt-bindings/soc/fsl-tsa.h

Quoted 6 lines
(quoted diff) +1 -0
+    };
include/dt-bindings/soc/fsl-tsa.h new file +0 -0
new file mode 100644
index 000000000000..9d09468694a2

Filename should match binding filename.

Quoted 1 line

Right, I will rename to fsl,tsa.h

If your binding was fsl,tsa.yaml.

Best regards,
Krzysztof

#23 lore raw

Re: [PATCH v2 08/10] dt-bindings: sound: Add support for QMC audio

In reply to Herve Codina
Quoted 11 lines · Herve Codina
Quoted 3 lines
Quoted 1 line

+ qmc-chan:

Missing vendor prefix.

Will be changed to 'fsl,qmc-chan'

Quoted 4 lines
Quoted 2 lines

+ $ref: /schemas/types.yaml#/definitions/phandle-array

Why this is not a phandle?

Quoted 7 lines

I have try '$ref: /schemas/types.yaml#/definitions/phandle'

I have an error from make dt_binding_check:
dai@16:fsl,qmc-chan:0: [4294967295, 16] is too long

I need a phandle with an argument ie <&qmc 16>.
Is there an alternative to phandle-array to handle this case ?

OK, then you need items like here:
https://elixir.bootlin.com/linux/v5.18-rc1/source/Documentation/devicetree/bindings/soc/samsung/exynos-usi.yaml#L42

Best regards,
Krzysztof

#6 lore raw

Re: [PATCH v2 02/10] soc: fsl: qe: Add support for TSA

In reply to Herve Codina

Le 06/01/2023 à 17:37, Herve Codina a écrit :

Quoted 5 lines

The TSA (Time Slot Assigner) is available in some
PowerQUICC SoC such as the MPC885 or MPC866.

Its purpose is to route some TDM time-slots to other internal serial controllers.

Is the subject correct ? As far as I understand this patch adds support for the TSA on the CPM (exactly on CPM1), not on the QE.

By the way, there are already some embryo for handling TSA on QE in drivers/soc/fsl/qe/qe-tdm.c

Quoted 2 lines

Christophe

#16 lore raw

Re: [PATCH v2 06/10] soc: fsl: qe: Add support for QMC

In reply to Herve Codina

Le 06/01/2023 à 17:37, Herve Codina a écrit :

Quoted 2 lines

The QMC (QUICC Multichannel Controller) is available on some PowerQUICC SoC such as the MPC885 or MPC866.

Same, that's QMC for CPM for the time being, should that be made clear in the subject ?

QE also has QMC and this driver might be used for QE QMC as well with some enhancement, maybe that could be explained here ?

I see you are using in_be16(), out_be16() etc ....
That's specific to powerpc arch, maybe it is better to use ioread16be, iowrite16be() etc ....
See commit 3f39f38ea91d ("soc: fsl: qe: replace qe_io{read,write}* wrappers by generic io{read,write}*") and commit 6ac9b61786cc ("soc:
fsl: qe: introduce qe_io{read,write}* wrappers") for information.

Quoted 5 lines

It emulates up to 64 channels within one serial controller using the same TDM physical interface routed from the TSA.

In some places, you comments use the network style, not the generic style.

Christophe

author maintainer
#7 lore raw

Re: [PATCH v2 02/10] soc: fsl: qe: Add support for TSA

In reply to Christophe Leroy

Hi Christophe,

Quoted 9 lines · On Wed, 11 Jan 2023 13:47:23 +0000 Christophe Leroy…

Le 06/01/2023 à 17:37, Herve Codina a écrit :

Quoted 5 lines

The TSA (Time Slot Assigner) is available in some
PowerQUICC SoC such as the MPC885 or MPC866.

Its purpose is to route some TDM time-slots to other internal serial controllers.

Is the subject correct ? As far as I understand this patch adds support for the TSA on the CPM (exactly on CPM1), not on the QE.

Yes exactly, it is a CPM1 support (kind of previous version of QE).

Do you think that fixing the subject is enough or do I need also to create a new directory drivers/soc/fsl/cpm/ and move these drivers (TSA and QMC) in this new directory.

The alternative could be to leave this driver in drivers/soc/qe/ and rename it to cpm-tsa.c.

For information, we have some plan to have this driver working with QE (not done yet).

Quoted 3 lines

By the way, there are already some embryo for handling TSA on QE in drivers/soc/fsl/qe/qe-tdm.c

Yes but this can be seen as an extension only used by drivers/net/wan/fsl_ucc_hdlc.c and it supports QE only.

Not sure that qe-tdm.c will fit well if several other drivers instances use it.

Quoted 5 lines
Quoted 3 lines

Christophe

Thanks for the review,
Hervé

Signature · 3 lines
Hervé Codina, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
author maintainer
#17 lore raw

Re: [PATCH v2 06/10] soc: fsl: qe: Add support for QMC

In reply to Christophe Leroy

Hi Christophe,

Quoted 6 lines · On Wed, 11 Jan 2023 13:58:03 +0000 Christophe Leroy…

Le 06/01/2023 à 17:37, Herve Codina a écrit :

Quoted 2 lines

The QMC (QUICC Multichannel Controller) is available on some PowerQUICC SoC such as the MPC885 or MPC866.

Same, that's QMC for CPM for the time being, should that be made clear in the subject ?

Also same answer:
Will changing the subject be enough or do I need to move it to new created drivers/soc/fsl/cpm/ directory ?

Quoted 3 lines

QE also has QMC and this driver might be used for QE QMC as well with some enhancement, maybe that could be explained here ?

Yes and we plan to have it working on QE too.

What do you think if I add the following:
The QMC is also available on some Quicc Engine SoC. This current version support CPM1 SoC only. Some enhancement are needed to support Quicc Engine SoC.

Quoted 7 lines

I see you are using in_be16(), out_be16() etc ....
That's specific to powerpc arch, maybe it is better to use ioread16be, iowrite16be() etc ....
See commit 3f39f38ea91d ("soc: fsl: qe: replace qe_io{read,write}* wrappers by generic io{read,write}*") and commit 6ac9b61786cc ("soc:
fsl: qe: introduce qe_io{read,write}* wrappers") for information.

You're right.
I will switch to io{read,write}{16,32}be.

I prefer avoid the use of qe_* wrappers as the driver is not (yet) compatible with QE.

Quoted 8 lines
Quoted 6 lines

It emulates up to 64 channels within one serial controller using the same TDM physical interface routed from the TSA.

In some places, you comments use the network style, not the generic style.

I will fix them.

Quoted 2 lines

Christophe

Thanks for the review,
Hervé

Signature · 3 lines
Hervé Codina, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#8 lore raw

Re: [PATCH v2 02/10] soc: fsl: qe: Add support for TSA

In reply to Herve Codina

Le 11/01/2023 à 16:06, Herve Codina a écrit :

Quoted 12 lines

Hi Christophe,

Quoted 7 lines · On Wed, 11 Jan 2023 13:47:23 +0000 Christophe Leroy…

Le 06/01/2023 à 17:37, Herve Codina a écrit :

Quoted 5 lines

The TSA (Time Slot Assigner) is available in some
PowerQUICC SoC such as the MPC885 or MPC866.

Its purpose is to route some TDM time-slots to other internal serial controllers.

Quoted 8 lines
Quoted 2 lines

Is the subject correct ? As far as I understand this patch adds support for the TSA on the CPM (exactly on CPM1), not on the QE.

Yes exactly, it is a CPM1 support (kind of previous version of QE).

Do you think that fixing the subject is enough or do I need also to create a new directory drivers/soc/fsl/cpm/ and move these drivers (TSA and QMC) in this new directory.

I think fixing the subject should be good enough.

Today we already have in that drivers/soc/fsl/qe/ directory some code which is common between CPM and QE, mainly in qe_common.c

Not sure qe_common.c is the best name ever, but it has been given that name in commit 1291e49e8937 ("QE/CPM: move muram management functions to qe_common")

So let's things as they are, just be precise in the subject, and if the final intention is to have some TSA common to CPM and QE, let's just call it tsa.c . If it's dedicated to CPM at the end, then maybe call it cpm-tsa.c.

Maybe one day we should rename drivers/soc/fsl/qe/ to drivers/soc/fsl/cpm-qe/

Quoted 8 lines

The alternative could be to leave this driver in drivers/soc/qe/ and rename it to cpm-tsa.c.

For information, we have some plan to have this driver working with QE (not done yet).

Quoted 1 line
Quoted 8 lines
Quoted 2 lines

By the way, there are already some embryo for handling TSA on QE in drivers/soc/fsl/qe/qe-tdm.c

Yes but this can be seen as an extension only used by drivers/net/wan/fsl_ucc_hdlc.c and it supports QE only.

Not sure that qe-tdm.c will fit well if several other drivers instances use it.

Fair enough.

Quoted 10 lines
Quoted 6 lines
Quoted 4 lines

Christophe

Thanks for the review,
Hervé

#18 lore raw

Re: [PATCH v2 06/10] soc: fsl: qe: Add support for QMC

In reply to Herve Codina

Le 11/01/2023 à 16:40, Herve Codina a écrit :

Quoted 19 lines

Hi Christophe,

Quoted 6 lines · On Wed, 11 Jan 2023 13:58:03 +0000 Christophe Leroy…

Le 06/01/2023 à 17:37, Herve Codina a écrit :

Quoted 2 lines

The QMC (QUICC Multichannel Controller) is available on some PowerQUICC SoC such as the MPC885 or MPC866.

Same, that's QMC for CPM for the time being, should that be made clear in the subject ?

Also same answer:
Will changing the subject be enough or do I need to move it to new created drivers/soc/fsl/cpm/ directory ?

Quoted 3 lines

QE also has QMC and this driver might be used for QE QMC as well with some enhancement, maybe that could be explained here ?

Quoted 7 lines

Yes and we plan to have it working on QE too.

What do you think if I add the following:
The QMC is also available on some Quicc Engine SoC. This current version support CPM1 SoC only. Some enhancement are needed to support Quicc Engine SoC.

That's look good.

Quoted 8 lines
Quoted 7 lines

I see you are using in_be16(), out_be16() etc ....
That's specific to powerpc arch, maybe it is better to use ioread16be, iowrite16be() etc ....
See commit 3f39f38ea91d ("soc: fsl: qe: replace qe_io{read,write}* wrappers by generic io{read,write}*") and commit 6ac9b61786cc ("soc:
fsl: qe: introduce qe_io{read,write}* wrappers") for information.

Quoted 5 lines

You're right.
I will switch to io{read,write}{16,32}be.

I prefer avoid the use of qe_* wrappers as the driver is not (yet) compatible with QE.

By the way that was the purpose of commit 3f39f38ea91d ("soc: fsl: qe:
replace qe_io{read,write}* wrappers by generic io{read,write}*"), replace qe_* wrappers by direct use of io{read,write}{16,32}be

So yes, using io{read,write}{16,32}be directly is preferable.

Quoted 18 lines
Quoted 9 lines
Quoted 7 lines

It emulates up to 64 channels within one serial controller using the same TDM physical interface routed from the TSA.

In some places, you comments use the network style, not the generic style.

I will fix them.

Quoted 2 lines

Christophe

Thanks for the review,
Hervé