Add the PowerQUICC audio support using the QMC
Subsystems (11)
Herve Codina
maintainerv5 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 previous iteration
https://lore.kernel.org/linux-kernel/[email protected]/
this v5 series mainly:
- fixes bindings,
- removes one left out_8() specific ppc call (missed in v3),
- changes 'depends-on' in case of COMPILE_TEST.
Best regards,
Herve Codina
Changes v4 -> v5
- patch 1
Rename fsl,tsa.yaml to fsl,cpm1-tsa.yaml
Rename #serial-cells to #fsl,serial-cells and add a description Fix typos
Remove examples present in description
Use a pattern property for fsl,[rt]x-ts-routes
- patch 2
Remove one left out_8() ppc specific function call Remove the no more needed PPC dependency in case of COMPILE_TEST
- patch 4
Add 'Acked-by: Michael Ellerman <[email protected]>'
- patch 5
Rename fsl,qmc.yaml to fsl,cpm1-scc-qmc.yaml Rename #chan-cells to #fsl,chan-cells and add a description
- patch 6
Add the SOC_FSL dependency in case of COMPILE_TEST (issue raised by the kernel test robot).
Fix a typo in commit log
Add 'Acked-by: Li Yang <[email protected]>'
Changes v3 -> v4
- patches 2, 6 and 9
Update code comment format.
- patch 1
Fix some description formats.
Add 'additionalProperties: false' in subnode.
Move fsl,mode to fsl,diagnostic-mode.
Change clocks and clock-names properties.
Add '#serial-cells' property related to the newly introduced fsl,tsa-serial phandle.
- patch 2
Move fsl,mode to fsl,diagnostic-mode.
Replace the fsl,tsa phandle and the fsl,tsa-cell-id property by a
fsl,tsa-serial phandle and update the related API. Add missing locks.
- patch 5
Fix some description format.
Replace the fsl,tsa phandle and the fsl,tsa-cell-id property by a fsl,tsa-serial phandle.
Rename fsl,mode to fsl,operational-mode and update its description.
- patch 6
Replace the fsl,tsa phandle and the fsl,tsa-cell-id property by a
fsl,tsa-serial phandle and use the TSA updated API. Rename fsl,mode to fsl,operational-mode.
- patch 8
Add 'Reviewed-by: Krzysztof Kozlowski <[email protected]>'
Changes v2 -> v3
- All bindings
Rename fsl-tsa.h to fsl,tsa.h
Add missing vendor prefix
Various fixes (quotes, node names, upper/lower case)
- patches 1 and 2 (TSA binding specific)
Remove 'reserved' values in the routing tables Remove fsl,grant-mode
Add a better description for 'fsl,common-rxtx-pins' Fix clocks/clocks-name handling against fsl,common-rxtx-pins Add information related to the delays unit
Removed FSL_CPM_TSA_NBCELL
Fix license in binding header file fsl,tsa.h
- patches 5 and 6 (QMC binding specific)
Remove fsl,cpm-command property
Add interrupt property constraint
- patches 8 and 9 (QMC audio binding specific) Remove 'items' in compatible property definition Add missing 'dai-common.yaml' reference Fix the qmc_chan phandle definition
- patch 2 and 6
Use io{read,write}be{32,16}
Change commit subjects and logs
- patch 4
Add 'Acked-by: Christophe Leroy <[email protected]>'
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: cpm1: 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: cpm1: 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
.../soc/fsl/cpm_qe/fsl,cpm1-scc-qmc.yaml | 172 ++ .../bindings/soc/fsl/cpm_qe/fsl,cpm1-tsa.yaml | 234 +++ .../bindings/sound/fsl,qmc-audio.yaml | 117 ++ 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 | 1533 +++++++++++++++++ drivers/soc/fsl/qe/tsa.c | 869 ++++++++++ drivers/soc/fsl/qe/tsa.h | 42 + include/dt-bindings/soc/fsl,tsa.h | 13 + include/soc/fsl/qe/qmc.h | 71 + sound/soc/fsl/Kconfig | 9 + sound/soc/fsl/Makefile | 2 + sound/soc/fsl/fsl_qmc_audio.c | 735 ++++++++ 15 files changed, 3848 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,cpm1-scc-qmc.yaml create mode 100644 Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,cpm1-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.39.1
Herve Codina
maintainerPATCH v5 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,cpm1-tsa.yaml | 234 ++++++++++++++++++ include/dt-bindings/soc/fsl,tsa.h | 13 + 2 files changed, 247 insertions(+) create mode 100644 Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,cpm1-tsa.yaml create mode 100644 include/dt-bindings/soc/fsl,tsa.h
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,cpm1-tsa.yaml new file +234 -0
@@ -0,0 +1,234 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/soc/fsl/cpm_qe/fsl,cpm1-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 + + '#fsl,serial-cells': + $ref: /schemas/types.yaml#/definitions/uint32 + const: 1 + description: + TSA consumers that use a phandle to TSA need to pass the serial identifier + with this phandle (defined in dt-bindings/soc/fsl,tsa.h). + For instance "fsl,tsa-serial = <&tsa FSL_CPM_TSA_SCC4>;". + +patternProperties: + '^tdm@[0-1]$': + description: + The TDM managed by this controller + type: object + + additionalProperties: false + + 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: + The hardware can use four dedicated pins for Tx clock, Tx sync, Rx + clock and Rx sync or use only two pins, Tx/Rx clock and Tx/Rx sync. + Without the 'fsl,common-rxtx-pins' property, the four pins are used. + With the 'fsl,common-rxtx-pins' property, two pins are used. + + clocks: + minItems: 2 + 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: + minItems: 2 + items: + - const: l1rsync + - const: l1rclk + - const: l1tsync + - const: l1tclk + + fsl,diagnostic-mode: + $ref: /schemas/types.yaml#/definitions/string + enum: [disabled, echo, internal-loopback, control-loopback] + default: disabled + description: | + The diagnostic mode can be used to diagnose some communication issues. + It should not be set (or set to 'disabled') when diagnostic is not + needed. + Diagnostic mode: + - disabled: + Diagnostic disabled (ie. 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-bits: + enum: [0, 1, 2, 3] + default: 0 + description: | + Receive frame sync delay in number of bits. + 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-bits: + enum: [0, 1, 2, 3] + default: 0 + description: | + Transmit frame sync delay in number of bits. + 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 sampled with + the falling edge. + + fsl,double-speed-clock: + $ref: /schemas/types.yaml#/definitions/flag + description: + The channel clock is twice the data rate. + + patternProperties: + '^fsl,[rt]x-ts-routes$': + $ref: /schemas/types.yaml#/definitions/uint32-matrix + description: | + A list of tuple that indicates the Tx or Rx time-slots routes. + items: + items: + - description: + The number of time-slots + minimum: 1 + maximum: 64 + - description: | + The source (Tx) or destination (Rx) 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] + minItems: 1 + maxItems: 64 + + allOf: + # If fsl,common-rxtx-pins is present, only 2 clocks are needed. + # Else, the 4 clocks must be present. + - if: + required: + - fsl,common-rxtx-pins + then: + properties: + clocks: + maxItems: 2 + clock-names: + maxItems: 2 + else: + properties: + clocks: + minItems: 4 + clock-names: + minItems: 4 + + required: + - reg + - clocks + - clock-names + +required: + - compatible + - reg + - reg-names + - '#address-cells' + - '#size-cells' + - '#fsl,serial-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>; + #fsl,serial-cells = <1>; + + tdm@0 { + /* TDMa */ + reg = <0>; + + clocks = <&clk_l1rsynca>, <&clk_l1rclka>; + clock-names = "l1rsync", "l1rclk"; + + fsl,common-rxtx-pins; + fsl,fsync-rising-edge; + + fsl,tx-ts-routes = < 2 0 >, /* TS 0..1 */ + < 24 FSL_CPM_TSA_SCC4 >, /* TS 2..25 */ + < 1 0 >, /* TS 26 */ + < 5 FSL_CPM_TSA_SCC3 >; /* TS 27..31 */ + + fsl,rx-ts-routes = < 2 0 >, /* TS 0..1 */ + < 24 FSL_CPM_TSA_SCC4 >, /* 2..25 */ + < 1 0 >, /* TS 26 */ + < 5 FSL_CPM_TSA_SCC3 >; /* TS 27..31 */ + }; + };
include/dt-bindings/soc/fsl,tsa.h new file +13 -0
@@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause */ + +#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 + +#endif
Signature · 1 line
2.39.1
Re: [PATCH v5 01/10] dt-bindings: soc: fsl: cpm_qe: Add TSA controller
Quoted 86 lines · Herve Codina
Add support for the time slot assigner (TSA)
available in some PowerQUICC SoC such as MPC885
or MPC866.Signed-off-by Herve Codina <[email protected]>--- .../bindings/soc/fsl/cpm_qe/fsl,cpm1-tsa.yaml | 234 ++++++++++++++++++ include/dt-bindings/soc/fsl,tsa.h | 13 + 2 files changed, 247 insertions(+) create mode 100644 Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,cpm1-tsa.yaml create mode 100644 include/dt-bindings/soc/fsl,tsa.hDocumentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,cpm1-tsa.yaml new file +68
-0@@ -0,0 +1,234 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/soc/fsl/cpm_qe/fsl,cpm1-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 + + '#fsl,serial-cells': + $ref: /schemas/types.yaml#/definitions/uint32 + const: 1 + description: + TSA consumers that use a phandle to TSA need to pass the serial identifier + with this phandle (defined in dt-bindings/soc/fsl,tsa.h). + For instance "fsl,tsa-serial = <&tsa FSL_CPM_TSA_SCC4>;". + +patternProperties: + '^tdm@[0-1]$': + description: + The TDM managed by this controller + type: object + + additionalProperties: false + + 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: + The hardware can use four dedicated pins for Tx clock, Tx sync, Rx + clock and Rx sync or use only two pins, Tx/Rx clock and Tx/Rx sync.
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,cpm1-tsa.yaml line 78
Quoted 10 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,cpm1-tsa.yaml new file +10
-0+ Without the 'fsl,common-rxtx-pins' property, the four pins are used. + With the 'fsl,common-rxtx-pins' property, two pins are used. + + clocks: + minItems: 2 + 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
Blank line
Quoted 6 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,cpm1-tsa.yaml new file +6
-0+ clock-names: + minItems: 2 + items: + - const: l1rsync + - const: l1rclk + - const: l1tsync
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,cpm1-tsa.yaml line 94
Quoted 10 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,cpm1-tsa.yaml new file +10
-0+ - const: l1tclk + + fsl,diagnostic-mode: + $ref: /schemas/types.yaml#/definitions/string + enum: [disabled, echo, internal-loopback, control-loopback] + default: disabled + description: | + The diagnostic mode can be used to diagnose some communication issues. + It should not be set (or set to 'disabled') when diagnostic is not + needed.
I don't think this is property for DT. Are you going to ship devices to customers with diagnostic mode? As you explained: no, so this can never appear. You might need sysfs/debugfs knob.
You already got a comment for this. Your explanation "I plan" is not an explanation why DT is suitable for such property. So let's make it more
obvious: drop it.
Quoted 4 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,cpm1-tsa.yaml new file +4
-0+ Diagnostic mode: + - disabled: + Diagnostic disabled (ie. normal operation) + - echo:
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,cpm1-tsa.yaml line 108
Quoted 10 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,cpm1-tsa.yaml new file +10
-0+ 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-bits: + enum: [0, 1, 2, 3]
maxItems: 1
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,cpm1-tsa.yaml line 116
Quoted 8 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,cpm1-tsa.yaml new file +8
-0+ default: 0 + description: | + Receive frame sync delay in number of bits. + 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-bits: + enum: [0, 1, 2, 3]
maxItems: 1
Quoted 98 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,cpm1-tsa.yaml new file +98
-0+ default: 0 + description: | + Transmit frame sync delay in number of bits. + 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 sampled with + the falling edge. + + fsl,double-speed-clock: + $ref: /schemas/types.yaml#/definitions/flag + description: + The channel clock is twice the data rate. + + patternProperties: + '^fsl,[rt]x-ts-routes$': + $ref: /schemas/types.yaml#/definitions/uint32-matrix + description: | + A list of tuple that indicates the Tx or Rx time-slots routes. + items: + items: + - description: + The number of time-slots + minimum: 1 + maximum: 64 + - description: | + The source (Tx) or destination (Rx) 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] + minItems: 1 + maxItems: 64 + + allOf: + # If fsl,common-rxtx-pins is present, only 2 clocks are needed. + # Else, the 4 clocks must be present. + - if: + required: + - fsl,common-rxtx-pins + then: + properties: + clocks: + maxItems: 2 + clock-names: + maxItems: 2 + else: + properties: + clocks: + minItems: 4 + clock-names: + minItems: 4 + + required: + - reg + - clocks + - clock-names + +required: + - compatible + - reg + - reg-names + - '#address-cells' + - '#size-cells' + - '#fsl,serial-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>; + #fsl,serial-cells = <1>; + + tdm@0 {
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,cpm1-tsa.yaml line 224
Quoted 10 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,cpm1-tsa.yaml new file +10
-0+ /* TDMa */ + reg = <0>; + + clocks = <&clk_l1rsynca>, <&clk_l1rclka>; + clock-names = "l1rsync", "l1rclk"; + + fsl,common-rxtx-pins; + fsl,fsync-rising-edge; + + fsl,tx-ts-routes = < 2 0 >, /* TS 0..1 */
No spaces after < and before >
include/dt-bindings/soc/fsl,tsa.h
Quoted 15 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,cpm1-tsa.yaml new file +10
-0+ < 24 FSL_CPM_TSA_SCC4 >, /* TS 2..25 */ + < 1 0 >, /* TS 26 */ + < 5 FSL_CPM_TSA_SCC3 >; /* TS 27..31 */ + + fsl,rx-ts-routes = < 2 0 >, /* TS 0..1 */ + < 24 FSL_CPM_TSA_SCC4 >, /* 2..25 */ + < 1 0 >, /* TS 26 */ + < 5 FSL_CPM_TSA_SCC3 >; /* TS 27..31 */ + }; + };include/dt-bindings/soc/fsl,tsa.h new file +0
-0
Use same name as binding file.
include/dt-bindings/soc/fsl,tsa.h line 4
Quoted 5 lines
include/dt-bindings/soc/fsl,tsa.h new file +4
-0@@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause */ + +#ifndef __DT_BINDINGS_SOC_FSL_TSA_H +#define __DT_BINDINGS_SOC_FSL_TSA_H
Best regards,
Krzysztof
Herve Codina
maintainerRe: [PATCH v5 01/10] dt-bindings: soc: fsl: cpm_qe: Add TSA controller
Hi Krzysztof,
Quoted 12 lines · On Fri, 17 Feb 2023 10:14:48 +0100 Krzysztof Kozlowski…
Quoted 11 lines · Herve Codina
Add support for the time slot assigner (TSA)
available in some PowerQUICC SoC such as MPC885
or MPC866.Signed-off-by Herve Codina <[email protected]>--- .../bindings/soc/fsl/cpm_qe/fsl,cpm1-tsa.yaml | 234 ++++++++++++++++++ include/dt-bindings/soc/fsl,tsa.h | 13 + 2 files changed, 247 insertions(+) create mode 100644 Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,cpm1-tsa.yaml create mode 100644 include/dt-bindings/soc/fsl,tsa.h
[...]
Quoted 15 lines
Quoted 15 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,cpm1-tsa.yaml new file +15
-0+ +patternProperties: + '^tdm@[0-1]$': + description: + The TDM managed by this controller + type: object + + additionalProperties: false + + properties: + reg: + minimum: 0 + maximum: 1 + description: + The TDM number for this TDM, 0 for TDMa and 1 for TDMb
[...]
Quoted 5 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,cpm1-tsa.yaml line 108
Quoted 3 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,cpm1-tsa.yaml new file +3
-0+ + fsl,rx-frame-sync-delay-bits: + enum: [0, 1, 2, 3]maxItems: 1
The property is an enum
Why this maxItems value ?
If I add the maxItems value, I've got some dt_binding_check errors:
/xxxx/bindings/soc/fsl/cpm_qe/fsl,cpm1-tsa.yaml:
patternProperties:^tdm@[0-1]$:properties:fsl,rx-frame-sync-delay-bits:
'enum' should not be valid under {'enum': ['const', 'enum', 'exclusiveMaximum', 'exclusiveMinimum', 'minimum', 'maximum', 'multipleOf', 'pattern']}
hint: Scalar and array keywords cannot be mixed
from schema $id: http://devicetree.org/meta-schemas/keywords.yaml#
Quoted 11 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,cpm1-tsa.yaml line 116
Quoted 9 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,cpm1-tsa.yaml new file +8
-0+ default: 0 + description: | + Receive frame sync delay in number of bits. + 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-bits: + enum: [0, 1, 2, 3]maxItems: 1
Same question here.
Thanks for the review,
Hervé
Signature · 3 lines
Hervé Codina, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Re: [PATCH v5 01/10] dt-bindings: soc: fsl: cpm_qe: Add TSA controller
Quoted 35 lines · Herve Codina
Hi Krzysztof,
Quoted 12 lines · On Fri, 17 Feb 2023 10:14:48 +0100 Krzysztof Kozlowski…
Quoted 11 lines · Herve Codina
Add support for the time slot assigner (TSA)
available in some PowerQUICC SoC such as MPC885
or MPC866.Signed-off-by Herve Codina <[email protected]>--- .../bindings/soc/fsl/cpm_qe/fsl,cpm1-tsa.yaml | 234 ++++++++++++++++++ include/dt-bindings/soc/fsl,tsa.h | 13 + 2 files changed, 247 insertions(+) create mode 100644 Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,cpm1-tsa.yaml create mode 100644 include/dt-bindings/soc/fsl,tsa.h[...]
Quoted 15 lines
Quoted 15 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,cpm1-tsa.yaml new file +15
-0+ +patternProperties: + '^tdm@[0-1]$': + description: + The TDM managed by this controller + type: object + + additionalProperties: false + + properties: + reg: + minimum: 0 + maximum: 1 + description: + The TDM number for this TDM, 0 for TDMa and 1 for TDMb[...]
Quoted 8 lines
Quoted 5 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,cpm1-tsa.yaml line 108
Quoted 3 lines
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,cpm1-tsa.yaml new file +3
-0+ + fsl,rx-frame-sync-delay-bits: + enum: [0, 1, 2, 3]maxItems: 1
The property is an enum
Why this maxItems value ?
Hm, it's an array, but you are right that enum forces dtschema to interpret it as scalar value, so your code is correct.
Quoted 7 lines
If I add the maxItems value, I've got some
dt_binding_checkerrors:
/xxxx/bindings/soc/fsl/cpm_qe/fsl,cpm1-tsa.yaml:
patternProperties:^tdm@[0-1]$:properties:fsl,rx-frame-sync-delay-bits:
'enum' should not be valid under {'enum': ['const', 'enum', 'exclusiveMaximum', 'exclusiveMinimum', 'minimum', 'maximum', 'multipleOf', 'pattern']}
hint: Scalar and array keywords cannot be mixed
from schema $id: http://devicetree.org/meta-schemas/keywords.yaml#
Best regards,
Krzysztof
Herve Codina
maintainerPATCH v5 2/10 soc: fsl: cpm1: Add support for TSA
In reply to Herve CodinaThe TSA (Time Slot Assigner) purpose is to route some TDM time-slots to other internal serial controllers.
It is available in some PowerQUICC SoC such as the MPC885 or MPC866.
It is also available on some Quicc Engine SoCs. This current version support CPM1 SoCs only and some enhancement are needed to support Quicc Engine SoCs.
--- drivers/soc/fsl/qe/Kconfig | 11 + drivers/soc/fsl/qe/Makefile | 1 + drivers/soc/fsl/qe/tsa.c | 869 ++++++++++++++++++++++++++++++++++++ drivers/soc/fsl/qe/tsa.h | 42 ++ 4 files changed, 923 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
@@ -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 || 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
@@ -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 +869 -0
869 lines not on this page · raw message
drivers/soc/fsl/qe/tsa.h new file +42 -0
42 lines not on this page · raw message
Signature · 1 line
2.39.1
RE: [PATCH v5 02/10] soc: fsl: cpm1: Add support for TSA
Quoted 23 lines
-----Original Message-----
From: Herve Codina <[email protected]>
Sent: Thursday, February 16, 2023 7:42 AM
To: Herve Codina <[email protected]>; Leo Li <[email protected]>; Rob Herring <[email protected]>; Krzysztof Kozlowski <[email protected]>; Liam Girdwood <[email protected]>; Mark Brown <[email protected]>; Christophe Leroy <[email protected]>; Michael Ellerman <[email protected]>; Nicholas Piggin <[email protected]>; Qiang Zhao <[email protected]>; Jaroslav Kysela <[email protected]>; Takashi Iwai <[email protected]>; Shengjiu Wang <[email protected]>; Xiubo Li <[email protected]>; Fabio Estevam <[email protected]>; Nicolin Chen <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; alsa-devel@alsa- project.org; Thomas Petazzoni <[email protected]>
Subject: [PATCH v5 02/10] soc: fsl: cpm1: Add support for TSAThe TSA (Time Slot Assigner) purpose is to route some TDM time-slots to other internal serial controllers.
Quoted 8 lines
It is available in some PowerQUICC SoC such as the MPC885 or MPC866.
It is also available on some Quicc Engine SoCs. This current version support CPM1 SoCs only and some enhancement are needed to support Quicc Engine SoCs.
Signed-off-by Herve Codina <[email protected]>
Looks good to me
Quoted 1,019 lines
--- drivers/soc/fsl/qe/Kconfig | 11 + drivers/soc/fsl/qe/Makefile | 1 + drivers/soc/fsl/qe/tsa.c | 869 ++++++++++++++++++++++++++++++++++++ drivers/soc/fsl/qe/tsa.h | 42 ++ 4 files changed, 923 insertions(+) create mode 100644 drivers/soc/fsl/qe/tsa.c create mode 100644 drivers/soc/fsl/qe/tsa.hdrivers/soc/fsl/qe/Kconfig +11
-0@@ -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 || 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_HDLCdrivers/soc/fsl/qe/Makefile +1
-0@@ -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.odrivers/soc/fsl/qe/tsa.c new file +184
-0@@ -0,0 +1,869 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* TSA driver +* +* Copyright 2022 CS GROUP France +* +* Author: Herve Codina <[email protected]> +*/ + +#include "tsa.h" +#include <dt-bindings/soc/fsl,tsa.h> +#include <linux/clk.h> +#include <linux/io.h> +#include <linux/module.h> +#include <linux/of.h> +#include <linux/of_platform.h> +#include <linux/platform_device.h> +#include <linux/slab.h> + + +/* TSA SI RAM routing tables entry */ +#define TSA_SIRAM_ENTRY_LAST (1 << 16) +#define TSA_SIRAM_ENTRY_BYTE (1 << 17) +#define TSA_SIRAM_ENTRY_CNT (x) (((x) & 0x0f) << 18) +#define TSA_SIRAM_ENTRY_CSEL_MASK (0x7 << 22) +#define TSA_SIRAM_ENTRY_CSEL_NU (0x0 << 22) +#define TSA_SIRAM_ENTRY_CSEL_SCC2 (0x2 << 22) +#define TSA_SIRAM_ENTRY_CSEL_SCC3 (0x3 << 22) +#define TSA_SIRAM_ENTRY_CSEL_SCC4 (0x4 << 22) +#define TSA_SIRAM_ENTRY_CSEL_SMC1 (0x5 << 22) +#define TSA_SIRAM_ENTRY_CSEL_SMC2 (0x6 << 22) + +/* SI mode register (32 bits) */ +#define TSA_SIMODE 0x00 +#define TSA_SIMODE_SMC2 0x80000000 +#define TSA_SIMODE_SMC1 0x00008000 +#define TSA_SIMODE_TDMA (x) ((x) << 0) +#define TSA_SIMODE_TDMB (x) ((x) << 16) +#define TSA_SIMODE_TDM_MASK 0x0fff +#define TSA_SIMODE_TDM_SDM_MASK 0x0c00 +#define TSA_SIMODE_TDM_SDM_NORM 0x0000 +#define TSA_SIMODE_TDM_SDM_ECHO 0x0400 +#define TSA_SIMODE_TDM_SDM_INTL_LOOP 0x0800 +#define TSA_SIMODE_TDM_SDM_LOOP_CTRL 0x0c00 +#define TSA_SIMODE_TDM_RFSD (x) ((x) << 8) +#define TSA_SIMODE_TDM_DSC 0x0080 +#define TSA_SIMODE_TDM_CRT 0x0040 +#define TSA_SIMODE_TDM_STZ 0x0020 +#define TSA_SIMODE_TDM_CE 0x0010 +#define TSA_SIMODE_TDM_FE 0x0008 +#define TSA_SIMODE_TDM_GM 0x0004 +#define TSA_SIMODE_TDM_TFSD (x) ((x) << 0) + +/* SI global mode register (8 bits) */ +#define TSA_SIGMR 0x04 +#define TSA_SIGMR_ENB (1<<3) +#define TSA_SIGMR_ENA (1<<2) +#define TSA_SIGMR_RDM_MASK 0x03 +#define TSA_SIGMR_RDM_STATIC_TDMA 0x00 +#define TSA_SIGMR_RDM_DYN_TDMA 0x01 +#define TSA_SIGMR_RDM_STATIC_TDMAB 0x02 +#define TSA_SIGMR_RDM_DYN_TDMAB 0x03 + +/* SI status register (8 bits) */ +#define TSA_SISTR 0x06 + +/* SI command register (8 bits) */ +#define TSA_SICMR 0x07 + +/* SI clock route register (32 bits) */ +#define TSA_SICR 0x0C +#define TSA_SICR_SCC2 (x) ((x) << 8) +#define TSA_SICR_SCC3 (x) ((x) << 16) +#define TSA_SICR_SCC4 (x) ((x) << 24) +#define TSA_SICR_SCC_MASK 0x0ff +#define TSA_SICR_SCC_GRX (1 << 7) +#define TSA_SICR_SCC_SCX_TSA (1 << 6) +#define TSA_SICR_SCC_RXCS_MASK (0x7 << 3) +#define TSA_SICR_SCC_RXCS_BRG1 (0x0 << 3) +#define TSA_SICR_SCC_RXCS_BRG2 (0x1 << 3) +#define TSA_SICR_SCC_RXCS_BRG3 (0x2 << 3) +#define TSA_SICR_SCC_RXCS_BRG4 (0x3 << 3) +#define TSA_SICR_SCC_RXCS_CLK15 (0x4 << 3) +#define TSA_SICR_SCC_RXCS_CLK26 (0x5 << 3) +#define TSA_SICR_SCC_RXCS_CLK37 (0x6 << 3) +#define TSA_SICR_SCC_RXCS_CLK48 (0x7 << 3) +#define TSA_SICR_SCC_TXCS_MASK (0x7 << 0) +#define TSA_SICR_SCC_TXCS_BRG1 (0x0 << 0) +#define TSA_SICR_SCC_TXCS_BRG2 (0x1 << 0) +#define TSA_SICR_SCC_TXCS_BRG3 (0x2 << 0) +#define TSA_SICR_SCC_TXCS_BRG4 (0x3 << 0) +#define TSA_SICR_SCC_TXCS_CLK15 (0x4 << 0) +#define TSA_SICR_SCC_TXCS_CLK26 (0x5 << 0) +#define TSA_SICR_SCC_TXCS_CLK37 (0x6 << 0) +#define TSA_SICR_SCC_TXCS_CLK48 (0x7 << 0) + +/* Serial interface RAM pointer register (32 bits) */ +#define TSA_SIRP 0x10 + +struct tsa_entries_area { +void *__iomem entries_start; +void *__iomem entries_next; +void *__iomem last_entry; +}; + +struct tsa_tdm { +bool is_enable; +struct clk *l1rclk_clk; +struct clk *l1rsync_clk; +struct clk *l1tclk_clk; +struct clk *l1tsync_clk; +u32 simode_tdm; +}; + +#define TSA_TDMA 0 +#define TSA_TDMB 1 + +struct tsa { +struct device *dev; +void *__iomem si_regs; +void *__iomem si_ram; +resource_size_t si_ram_sz; +spinlock_t lock; +int tdms;/* TSA_TDMx ORed */ +struct tsa_tdm tdm[2 ];/* TDMa and TDMb */ +struct tsa_serial { +unsigned int id; +struct tsa_serial_info info; + } serials[6 ]; +}; + +static inline struct tsa *tsa_serial_get_tsa (struct tsa_serial *tsa_serial) +{ +/* The serials table is indexed by the serial id */ + return container_of(tsa_serial, struct tsa, serials[tsa_serial->id]); +} + +static inline void tsa_write32 (void *__iomem addr,u32 val) +{ +iowrite32be (val, addr); +} + +static inline void tsa_write8 (void *__iomem addr,u32 val) +{ +iowrite8 (val, addr); +} + +static inline u32 tsa_read32 (void *__iomem addr) +{ +return ioread32be (addr); +} + +static inline void tsa_clrbits32 (void *__iomem addr,u32 clr) +{ +tsa_write32 (addr,tsa_read32 (addr) & ~clr); +} + +static inline void tsa_clrsetbits32 (void *__iomem addr,u32 clr,u32 set) +{ +tsa_write32 (addr, (tsa_read32 (addr) & ~clr) | set); +} + +int tsa_serial_connect (struct tsa_serial *tsa_serial) +{ +struct tsa *tsa =tsa_serial_get_tsa (tsa_serial); +unsigned long flags; +u32 clear; +u32 set; + +switch (tsa_serial->id) { +case FSL_CPM_TSA_SCC2 : + clear =TSA_SICR_SCC2 (TSA_SICR_SCC_MASK ); + set =TSA_SICR_SCC2 (TSA_SICR_SCC_SCX_TSA ); +break ; +case FSL_CPM_TSA_SCC3 : + clear =TSA_SICR_SCC3 (TSA_SICR_SCC_MASK ); + set =TSA_SICR_SCC3 (TSA_SICR_SCC_SCX_TSA ); +break ; +case FSL_CPM_TSA_SCC4 : + clear =TSA_SICR_SCC4 (TSA_SICR_SCC_MASK ); + set =TSA_SICR_SCC4 (TSA_SICR_SCC_SCX_TSA ); +break ; +default : + dev_err(tsa->dev, "Unsupported serial id %u\n", tsa_serial-Quoted 1 line
id);
drivers/soc/fsl/qe/tsa.c new file +29
-0+return -EINVAL ; + } + +spin_lock_irqsave (&tsa->lock, flags); +tsa_clrsetbits32 (tsa->si_regs +TSA_SICR , clear, set); +spin_unlock_irqrestore (&tsa->lock, flags); + +return 0 ; +} +EXPORT_SYMBOL (tsa_serial_connect); + +int tsa_serial_disconnect (struct tsa_serial *tsa_serial) +{ +struct tsa *tsa =tsa_serial_get_tsa (tsa_serial); +unsigned long flags; +u32 clear; + +switch (tsa_serial->id) { +case FSL_CPM_TSA_SCC2 : + clear =TSA_SICR_SCC2 (TSA_SICR_SCC_MASK ); +break ; +case FSL_CPM_TSA_SCC3 : + clear =TSA_SICR_SCC3 (TSA_SICR_SCC_MASK ); +break ; +case FSL_CPM_TSA_SCC4 : + clear =TSA_SICR_SCC4 (TSA_SICR_SCC_MASK ); +break ; +default : + dev_err(tsa->dev, "Unsupported serial id %u\n", tsa_serial-Quoted 1 line
id);
drivers/soc/fsl/qe/tsa.c new file +12
-0+return -EINVAL ; + } + +spin_lock_irqsave (&tsa->lock, flags); +tsa_clrsetbits32 (tsa->si_regs +TSA_SICR , clear,0 ); +spin_unlock_irqrestore (&tsa->lock, flags); + +return 0 ; +} +EXPORT_SYMBOL (tsa_serial_disconnect); + +int tsa_serial_get_info(struct tsa_serial *tsa_serial, struct tsa_serial_info*info)
drivers/soc/fsl/qe/tsa.c new file +7
-0+{ +memcpy (info, &tsa_serial->info,sizeof (*info)); +return 0 ; +} +EXPORT_SYMBOL (tsa_serial_get_info); + +static void tsa_init_entries_area(struct tsa *tsa, struct tsa_entries_area*area,
drivers/soc/fsl/qe/tsa.c new file +28
-0+ u32 tdms, u32 tdm_id, bool is_rx) +{ + resource_size_t quarter; +resource_size_t half; + + quarter = tsa->si_ram_sz/4 ; + half = tsa->si_ram_sz/2 ; + +if (tdms ==BIT (TSA_TDMA )) { +/* Only TDMA */ +if (is_rx) { +/* First half of si_ram */ + area->entries_start = tsa->si_ram; + area->entries_next = area->entries_start + half; + area->last_entry =NULL ; + }else { +/* Second half of si_ram */ + area->entries_start = tsa->si_ram + half; + area->entries_next = area->entries_start + half; + area->last_entry =NULL ; + } + }else { +/* Only TDMB or both TDMs */ +if (tdm_id ==TSA_TDMA ) { +if (is_rx) { +/* First half of first half of si_ram */ + area->entries_start = tsa->si_ram; + area->entries_next = area->entries_start +quarter;
drivers/soc/fsl/qe/tsa.c new file +4
-0+ area->last_entry =NULL ; + }else { +/* First half of second half of si_ram */ + area->entries_start = tsa->si_ram + (2 *quarter);
drivers/soc/fsl/qe/tsa.c new file +1
-0+ area->entries_next = area->entries_start +quarter;
drivers/soc/fsl/qe/tsa.c new file +7
-0+ area->last_entry =NULL ; + } + }else { +if (is_rx) { +/* Second half of first half of si_ram */ + area->entries_start = tsa->si_ram + quarter; + area->entries_next = area->entries_start +quarter;
drivers/soc/fsl/qe/tsa.c new file +4
-0+ area->last_entry =NULL ; + }else { +/* Second half of second half of si_ram */ + area->entries_start = tsa->si_ram + (3 *quarter);
drivers/soc/fsl/qe/tsa.c new file +1
-0+ area->entries_next = area->entries_start +quarter;
drivers/soc/fsl/qe/tsa.c new file +25
-0+ area->last_entry =NULL ; + } + } + } +} + +static const char *tsa_serial_id2name (struct tsa *tsa,u32 serial_id) +{ +switch (serial_id) { +case FSL_CPM_TSA_NU :return "Not used" ; +case FSL_CPM_TSA_SCC2 :return "SCC2" ; +case FSL_CPM_TSA_SCC3 :return "SCC3" ; +case FSL_CPM_TSA_SCC4 :return "SCC4" ; +case FSL_CPM_TSA_SMC1 :return "SMC1" ; +case FSL_CPM_TSA_SMC2 :return "SMC2" ; +default : +break ; + } +return NULL ; +} + +static u32 tsa_serial_id2csel (struct tsa *tsa,u32 serial_id) +{ +switch (serial_id) { +case FSL_CPM_TSA_SCC2 :return
TSA_SIRAM_ENTRY_CSEL_SCC2;drivers/soc/fsl/qe/tsa.c new file +1
-0+case FSL_CPM_TSA_SCC3 :return
TSA_SIRAM_ENTRY_CSEL_SCC3;drivers/soc/fsl/qe/tsa.c new file +1
-0+case FSL_CPM_TSA_SCC4 :return
TSA_SIRAM_ENTRY_CSEL_SCC4;drivers/soc/fsl/qe/tsa.c new file +1
-0+case FSL_CPM_TSA_SMC1 :return
TSA_SIRAM_ENTRY_CSEL_SMC1;drivers/soc/fsl/qe/tsa.c new file +1
-0+case FSL_CPM_TSA_SMC2 :return
TSA_SIRAM_ENTRY_CSEL_SMC2;drivers/soc/fsl/qe/tsa.c new file +31
-0+default : +break ; + } +return TSA_SIRAM_ENTRY_CSEL_NU ; +} + +static int tsa_add_entry (struct tsa *tsa,struct tsa_entries_area *area, +u32 count,u32 serial_id) +{ +void *__iomem addr; +u32 left; +u32 val; +u32 cnt; +u32 nb; + + addr = area->last_entry ? area->last_entry +4 : area->entries_start; + + nb =DIV_ROUND_UP (count,8 ); +if ((addr + (nb *4 )) > area->entries_next) { +dev_err (tsa->dev,"si ram area full\n" ); +return -ENOSPC ; + } + +if (area->last_entry) { +/* Clear last flag */ +tsa_clrbits32 (area->last_entry,TSA_SIRAM_ENTRY_LAST ); + } + + left = count; +while (left) { + val = TSA_SIRAM_ENTRY_BYTE | tsa_serial_id2csel(tsa,
serial_id);drivers/soc/fsl/qe/tsa.c new file +19
-0+ +if (left >16 ) { + cnt =16 ; + }else { + cnt = left; + val |=TSA_SIRAM_ENTRY_LAST ; + area->last_entry = addr; + } + val |=TSA_SIRAM_ENTRY_CNT (cnt -1 ); + +tsa_write32 (addr, val); + addr +=4 ; + left -= cnt; + } + +return 0 ; +} + +static int tsa_of_parse_tdm_route(struct tsa *tsa, struct device_node
*tdm_np,drivers/soc/fsl/qe/tsa.c new file +18
-0+ u32 tdms, u32 tdm_id, bool is_rx) +{ + struct tsa_entries_area area; +const char *route_name; +u32 serial_id; +int len, i; +u32 count; +const char *serial_name; +struct tsa_serial_info *serial_info; +struct tsa_tdm *tdm; +int ret; +u32 ts; + + route_name = is_rx ?"fsl,rx-ts-routes" :"fsl,tx-ts-routes" ; + + len =of_property_count_u32_elems (tdm_np, route_name); +if (len <0 ) { + dev_err(tsa->dev, "%pOF: failed to read %s\n", tdm_np,
route_name);drivers/soc/fsl/qe/tsa.c new file +4
-0+return len; + } +if (len %2 !=0 ) { + dev_err(tsa->dev, "%pOF: wrong %s format\n", tdm_np,
route_name);drivers/soc/fsl/qe/tsa.c new file +7
-0+return -EINVAL ; + } + +tsa_init_entries_area (tsa, &area, tdms, tdm_id, is_rx); + ts =0 ; +for (i =0 ; i < len; i +=2 ) { + of_property_read_u32_index(tdm_np, route_name, i,&count);
drivers/soc/fsl/qe/tsa.c new file +1
-0+ of_property_read_u32_index(tdm_np, route_name, i + 1,
&serial_id);drivers/soc/fsl/qe/tsa.c new file +10
-0+ +if (serial_id >=ARRAY_SIZE (tsa->serials)) { +dev_err (tsa->dev,"%pOF: invalid serial id (%u)\n" , + tdm_np, serial_id); +return -EINVAL ; + } + + serial_name =tsa_serial_id2name (tsa, serial_id); +if (!serial_name) { + dev_err(tsa->dev, "%pOF: unsupported serial id(%u)\n",
drivers/soc/fsl/qe/tsa.c new file +16
-0+ tdm_np, serial_id); +return -EINVAL ; + } + +dev_dbg (tsa->dev,"tdm_id=%u, %s ts %u..%u -> %s\n" , + tdm_id, route_name, ts, ts+count-1 , serial_name); + ts += count; + + ret =tsa_add_entry (tsa, &area, count, serial_id); +if (ret) +return ret; + + serial_info = &tsa->serials[serial_id].info; + tdm = &tsa->tdm[tdm_id]; +if (is_rx) { + serial_info->rx_fs_rate = clk_get_rate(tdm-Quoted 1 line
l1rsync_clk);drivers/soc/fsl/qe/tsa.c new file +1
-0+ serial_info->rx_bit_rate = clk_get_rate(tdm-Quoted 1 line
l1rclk_clk);drivers/soc/fsl/qe/tsa.c new file +46
-0+ serial_info->nb_rx_ts += count; + }else { + serial_info->tx_fs_rate = tdm->l1tsync_clk ? +clk_get_rate (tdm->l1tsync_clk) : +clk_get_rate (tdm->l1rsync_clk); + serial_info->tx_bit_rate = tdm->l1tclk_clk ? +clk_get_rate (tdm->l1tclk_clk) : +clk_get_rate (tdm->l1rclk_clk); + serial_info->nb_tx_ts += count; + } + } +return 0 ; +} + +static inline int tsa_of_parse_tdm_rx_route (struct tsa *tsa, +struct device_node *tdm_np, +u32 tdms,u32 tdm_id) +{ +return tsa_of_parse_tdm_route (tsa, tdm_np, tdms, tdm_id, true); +} + +static inline int tsa_of_parse_tdm_tx_route (struct tsa *tsa, +struct device_node *tdm_np, +u32 tdms,u32 tdm_id) +{ +return tsa_of_parse_tdm_route (tsa, tdm_np, tdms, tdm_id, false); +} + +static int tsa_of_parse_tdms (struct tsa *tsa,struct device_node *np) +{ +struct device_node *tdm_np; +struct tsa_tdm *tdm; +struct clk *clk; +const char *mode; +u32 tdm_id, val; +int ret; +int i; + + tsa->tdms =0 ; + tsa->tdm[0 ].is_enable = false; + tsa->tdm[1 ].is_enable = false; + +for_each_available_child_of_node (np, tdm_np) { + ret =of_property_read_u32 (tdm_np,"reg" , &tdm_id); +if (ret) { + dev_err(tsa->dev, "%pOF: failed to read reg\n",
tdm_np);drivers/soc/fsl/qe/tsa.c new file +12
-0+of_node_put (tdm_np); +return ret; + } +switch (tdm_id) { +case 0 : + tsa->tdms |=BIT (TSA_TDMA ); +break ; +case 1 : + tsa->tdms |=BIT (TSA_TDMB ); +break ; +default : + dev_err(tsa->dev, "%pOF: Invalid tdm_id (%u)\n",
tdm_np,drivers/soc/fsl/qe/tsa.c new file +10
-0+ tdm_id); +of_node_put (tdm_np); +return -EINVAL ; + } + } + +for_each_available_child_of_node (np, tdm_np) { + ret =of_property_read_u32 (tdm_np,"reg" , &tdm_id); +if (ret) { + dev_err(tsa->dev, "%pOF: failed to read reg\n",
tdm_np);drivers/soc/fsl/qe/tsa.c new file +8
-0+of_node_put (tdm_np); +return ret; + } + + tdm = &tsa->tdm[tdm_id]; + + mode ="disabled" ; + ret = of_property_read_string(tdm_np, "fsl,diagnostic-mode", &mode);
drivers/soc/fsl/qe/tsa.c new file +2
-0+if (ret && ret != -EINVAL ) { + dev_err(tsa->dev, "%pOF: failed to readfsl,diagnostic-mode\n",
drivers/soc/fsl/qe/tsa.c new file +6
-0+ tdm_np); +of_node_put (tdm_np); +return ret; + } +if (!strcmp (mode,"disabled" )) { + tdm->simode_tdm |=
TSA_SIMODE_TDM_SDM_NORM;drivers/soc/fsl/qe/tsa.c new file +2
-0+ }else if (!strcmp (mode,"echo" )) { + tdm->simode_tdm |=
TSA_SIMODE_TDM_SDM_ECHO;drivers/soc/fsl/qe/tsa.c new file +2
-0+ }else if (!strcmp (mode,"internal-loopback" )) { + tdm->simode_tdm |=
TSA_SIMODE_TDM_SDM_INTL_LOOP;drivers/soc/fsl/qe/tsa.c new file +2
-0+ }else if (!strcmp (mode,"control-loopback" )) { + tdm->simode_tdm |=
TSA_SIMODE_TDM_SDM_LOOP_CTRL;drivers/soc/fsl/qe/tsa.c new file +2
-0+ }else { + dev_err(tsa->dev, "%pOF: Invalid fsl,diagnostic-mode (%s)\n",
drivers/soc/fsl/qe/tsa.c new file +7
-0+ tdm_np, mode); +of_node_put (tdm_np); +return -EINVAL ; + } + + val =0 ; + ret = of_property_read_u32(tdm_np, "fsl,rx-frame-sync-delay-bits",
drivers/soc/fsl/qe/tsa.c new file +4
-0+ &val); +if (ret && ret != -EINVAL ) { + dev_err(tsa->dev, + "%pOF: failed to read fsl,rx-frame-sync-delay-bits\n",
drivers/soc/fsl/qe/tsa.c new file +7
-0+ tdm_np); +of_node_put (tdm_np); +return ret; + } +if (val >3 ) { + dev_err(tsa->dev, + "%pOF: Invalid fsl,rx-frame-sync-delay-bits(%u)\n",
drivers/soc/fsl/qe/tsa.c new file +8
-0+ tdm_np, val); +of_node_put (tdm_np); +return -EINVAL ; + } + tdm->simode_tdm |=TSA_SIMODE_TDM_RFSD (val); + + val =0 ; + ret = of_property_read_u32(tdm_np, "fsl,tx-frame-sync-delay-bits",
drivers/soc/fsl/qe/tsa.c new file +4
-0+ &val); +if (ret && ret != -EINVAL ) { + dev_err(tsa->dev, + "%pOF: failed to read fsl,tx-frame-sync-delay-bits\n",
drivers/soc/fsl/qe/tsa.c new file +7
-0+ tdm_np); +of_node_put (tdm_np); +return ret; + } +if (val >3 ) { + dev_err(tsa->dev, + "%pOF: Invalid fsl,tx-frame-sync-delay-bits(%u)\n",
drivers/soc/fsl/qe/tsa.c new file +16
-0+ tdm_np, val); +of_node_put (tdm_np); +return -EINVAL ; + } + tdm->simode_tdm |=TSA_SIMODE_TDM_TFSD (val); + +if (of_property_read_bool (tdm_np,"fsl,common-rxtx-pins" )) + tdm->simode_tdm |=TSA_SIMODE_TDM_CRT ; + +if (of_property_read_bool (tdm_np,"fsl,clock-falling-edge" )) + tdm->simode_tdm |=TSA_SIMODE_TDM_CE ; + +if (of_property_read_bool (tdm_np,"fsl,fsync-rising-edge" )) + tdm->simode_tdm |=TSA_SIMODE_TDM_FE ; + + if (of_property_read_bool(tdm_np, "fsl,double-speed-clock"))
drivers/soc/fsl/qe/tsa.c new file +61
-0+ tdm->simode_tdm |=TSA_SIMODE_TDM_DSC ; + + clk =of_clk_get_by_name (tdm_np,"l1rsync" ); +if (IS_ERR (clk)) { + ret =PTR_ERR (clk); +of_node_put (tdm_np); + goto err; + } + ret =clk_prepare_enable (clk); +if (ret) { +clk_put (clk); +of_node_put (tdm_np); + goto err; + } + tdm->l1rsync_clk = clk; + + clk =of_clk_get_by_name (tdm_np,"l1rclk" ); +if (IS_ERR (clk)) { + ret =PTR_ERR (clk); +of_node_put (tdm_np); + goto err; + } + ret =clk_prepare_enable (clk); +if (ret) { +clk_put (clk); +of_node_put (tdm_np); + goto err; + } + tdm->l1rclk_clk = clk; + +if (!(tdm->simode_tdm &TSA_SIMODE_TDM_CRT )) { + clk =of_clk_get_by_name (tdm_np,"l1tsync" ); +if (IS_ERR (clk)) { + ret =PTR_ERR (clk); +of_node_put (tdm_np); + goto err; + } + ret =clk_prepare_enable (clk); +if (ret) { +clk_put (clk); +of_node_put (tdm_np); + goto err; + } + tdm->l1tsync_clk = clk; + + clk =of_clk_get_by_name (tdm_np,"l1tclk" ); +if (IS_ERR (clk)) { + ret =PTR_ERR (clk); +of_node_put (tdm_np); + goto err; + } + ret =clk_prepare_enable (clk); +if (ret) { +clk_put (clk); +of_node_put (tdm_np); + goto err; + } + tdm->l1tclk_clk = clk; + } + + ret = tsa_of_parse_tdm_rx_route(tsa, tdm_np, tsa->tdms,
tdm_id);drivers/soc/fsl/qe/tsa.c new file +6
-0+if (ret) { +of_node_put (tdm_np); + goto err; + } + + ret = tsa_of_parse_tdm_tx_route(tsa, tdm_np, tsa->tdms,
tdm_id);drivers/soc/fsl/qe/tsa.c new file +61
-0+if (ret) { +of_node_put (tdm_np); + goto err; + } + + tdm->is_enable = true; + } +return 0 ; + +err: +for (i =0 ; i <2 ; i++) { +if (tsa->tdm[i].l1rsync_clk) { +clk_disable_unprepare (tsa->tdm[i].l1rsync_clk); +clk_put (tsa->tdm[i].l1rsync_clk); + } +if (tsa->tdm[i].l1rclk_clk) { +clk_disable_unprepare (tsa->tdm[i].l1rclk_clk); +clk_put (tsa->tdm[i].l1rclk_clk); + } +if (tsa->tdm[i].l1tsync_clk) { +clk_disable_unprepare (tsa->tdm[i].l1rsync_clk); +clk_put (tsa->tdm[i].l1rsync_clk); + } +if (tsa->tdm[i].l1tclk_clk) { +clk_disable_unprepare (tsa->tdm[i].l1rclk_clk); +clk_put (tsa->tdm[i].l1rclk_clk); + } + } +return ret; +} + +static void tsa_init_si_ram (struct tsa *tsa) +{ +resource_size_t i; + +/* Fill all entries as the last one */ +for (i =0 ; i < tsa->si_ram_sz; i +=4 ) +tsa_write32 (tsa->si_ram + i,TSA_SIRAM_ENTRY_LAST ); +} + +static int tsa_probe (struct platform_device *pdev) +{ +struct device_node *np = pdev->dev.of_node; +struct resource *res; +struct tsa *tsa; +unsigned int i; +u32 val; +int ret; + + tsa =devm_kzalloc (&pdev->dev,sizeof (*tsa),GFP_KERNEL ); +if (!tsa) +return -ENOMEM ; + + tsa->dev = &pdev->dev; + +for (i =0 ; i <ARRAY_SIZE (tsa->serials); i++) + tsa->serials[i].id = i; + +spin_lock_init (&tsa->lock); + + tsa->si_regs = devm_platform_ioremap_resource_byname(pdev,"
si_regs");drivers/soc/fsl/qe/tsa.c new file +4
-0+if (IS_ERR (tsa->si_regs)) +return PTR_ERR (tsa->si_regs); + + res = platform_get_resource_byname(pdev, IORESOURCE_MEM,"
si_ram");drivers/soc/fsl/qe/tsa.c new file +30
-0+if (!res) { +dev_err (tsa->dev,"si_ram resource missing\n" ); +return -EINVAL ; + } + tsa->si_ram_sz =resource_size (res); + tsa->si_ram =devm_ioremap_resource (&pdev->dev, res); +if (IS_ERR (tsa->si_ram)) +return PTR_ERR (tsa->si_ram); + +tsa_init_si_ram (tsa); + + ret =tsa_of_parse_tdms (tsa, np); +if (ret) +return ret; + +/* Set SIMODE */ + val =0 ; +if (tsa->tdm[0 ].is_enable) + val |=TSA_SIMODE_TDMA (tsa->tdm[0 ].simode_tdm); +if (tsa->tdm[1 ].is_enable) + val |=TSA_SIMODE_TDMB (tsa->tdm[1 ].simode_tdm); + +tsa_clrsetbits32 (tsa->si_regs +TSA_SIMODE , +TSA_SIMODE_TDMA (TSA_SIMODE_TDM_MASK ) | +TSA_SIMODE_TDMB (TSA_SIMODE_TDM_MASK ), + val); + +/* Set SIGMR */ + val = (tsa->tdms ==BIT (TSA_TDMA )) ? + TSA_SIGMR_RDM_STATIC_TDMA :
TSA_SIGMR_RDM_STATIC_TDMAB;drivers/soc/fsl/qe/tsa.c new file +63
-0+if (tsa->tdms &BIT (TSA_TDMA )) + val |=TSA_SIGMR_ENA ; +if (tsa->tdms &BIT (TSA_TDMB )) + val |=TSA_SIGMR_ENB ; +tsa_write8 (tsa->si_regs +TSA_SIGMR , val); + +platform_set_drvdata (pdev, tsa); + +return 0 ; +} + +static int tsa_remove (struct platform_device *pdev) +{ +struct tsa *tsa =platform_get_drvdata (pdev); +int i; + +for (i =0 ; i <2 ; i++) { +if (tsa->tdm[i].l1rsync_clk) { +clk_disable_unprepare (tsa->tdm[i].l1rsync_clk); +clk_put (tsa->tdm[i].l1rsync_clk); + } +if (tsa->tdm[i].l1rclk_clk) { +clk_disable_unprepare (tsa->tdm[i].l1rclk_clk); +clk_put (tsa->tdm[i].l1rclk_clk); + } +if (tsa->tdm[i].l1tsync_clk) { +clk_disable_unprepare (tsa->tdm[i].l1rsync_clk); +clk_put (tsa->tdm[i].l1rsync_clk); + } +if (tsa->tdm[i].l1tclk_clk) { +clk_disable_unprepare (tsa->tdm[i].l1rclk_clk); +clk_put (tsa->tdm[i].l1rclk_clk); + } + } +return 0 ; +} + +static const struct of_device_id tsa_id_table[] = { + { .compatible ="fsl,cpm1-tsa" }, + {}/* sentinel */ +}; +MODULE_DEVICE_TABLE (of, tsa_id_table); + +static struct platform_driver tsa_driver = { + .driver = { + .name ="fsl-tsa" , + .of_match_table =of_match_ptr (tsa_id_table), + }, + .probe = tsa_probe, + .remove = tsa_remove, +}; +module_platform_driver (tsa_driver); + +struct tsa_serial *tsa_serial_get_byphandle (struct device_node *np, +const char *phandle_name) +{ +struct of_phandle_args out_args; +struct platform_device *pdev; +struct tsa_serial *tsa_serial; +struct tsa *tsa; +int ret; + + ret = of_parse_phandle_with_fixed_args(np, phandle_name, 1, 0,
&out_args);drivers/soc/fsl/qe/tsa.c new file +4
-0+if (ret <0 ) +return ERR_PTR (ret); + +if (!of_match_node (tsa_driver.driver.of_match_table, out_args.np)){
drivers/soc/fsl/qe/tsa.c new file +64
-0+of_node_put (out_args.np); +return ERR_PTR (-EINVAL ); + } + + pdev =of_find_device_by_node (out_args.np); +of_node_put (out_args.np); +if (!pdev) +return ERR_PTR (-ENODEV ); + + tsa =platform_get_drvdata (pdev); +if (!tsa) { +platform_device_put (pdev); +return ERR_PTR (-EPROBE_DEFER ); + } + +if (out_args.args_count !=1 ) { +platform_device_put (pdev); +return ERR_PTR (-EINVAL ); + } + +if (out_args.args[0 ] >=ARRAY_SIZE (tsa->serials)) { +platform_device_put (pdev); +return ERR_PTR (-EINVAL ); + } + + tsa_serial = &tsa->serials[out_args.args[0 ]]; + +/* +* Be sure that the serial id matches the phandle arg. +* The tsa_serials table is indexed by serial ids. The serial id is set +* during the probe() call and needs to be coherent. +*/ +if (WARN_ON (tsa_serial->id != out_args.args[0 ])) { +platform_device_put (pdev); +return ERR_PTR (-EINVAL ); + } + +return tsa_serial; +} +EXPORT_SYMBOL (tsa_serial_get_byphandle); + +void tsa_serial_put (struct tsa_serial *tsa_serial) +{ +struct tsa *tsa =tsa_serial_get_tsa (tsa_serial); + +put_device (tsa->dev); +} +EXPORT_SYMBOL (tsa_serial_put); + +static void devm_tsa_serial_release (struct device *dev,void *res) +{ +struct tsa_serial **tsa_serial = res; + +tsa_serial_put (*tsa_serial); +} + +struct tsa_serial *devm_tsa_serial_get_byphandle (struct device *dev, +struct device_node *np, +const char *phandle_name) +{ +struct tsa_serial *tsa_serial; +struct tsa_serial **dr; + + dr = devres_alloc(devm_tsa_serial_release, sizeof(*dr),
GFP_KERNEL);drivers/soc/fsl/qe/tsa.c new file +18
-0+if (!dr) +return ERR_PTR (-ENOMEM ); + + tsa_serial =tsa_serial_get_byphandle (np, phandle_name); +if (!IS_ERR (tsa_serial)) { + *dr = tsa_serial; +devres_add (dev, dr); + }else { +devres_free (dr); + } + +return tsa_serial; +} +EXPORT_SYMBOL (devm_tsa_serial_get_byphandle); + +MODULE_AUTHOR ("Herve Codina <[email protected]>" ); +MODULE_DESCRIPTION ("CPM TSA driver" ); +MODULE_LICENSE ("GPL" );drivers/soc/fsl/qe/tsa.h new file +40
-0@@ -0,0 +1,42 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* TSA management +* +* Copyright 2022 CS GROUP France +* +* Author: Herve Codina <[email protected]> +*/ +#ifndef __SOC_FSL_TSA_H__ +#define __SOC_FSL_TSA_H__ + +#include <linux/types.h> + +struct device_node ; +struct device ; +struct tsa_serial ; + +struct tsa_serial *tsa_serial_get_byphandle (struct device_node *np, +const char *phandle_name); +void tsa_serial_put (struct tsa_serial *tsa_serial); +struct tsa_serial *devm_tsa_serial_get_byphandle (struct device *dev, +struct device_node *np, +const char *phandle_name); + +/* Connect and disconnect the TSA serial */ +int tsa_serial_connect (struct tsa_serial *tsa_serial); +int tsa_serial_disconnect (struct tsa_serial *tsa_serial); + +/* Cell information */ +struct tsa_serial_info { +unsigned long rx_fs_rate; +unsigned long rx_bit_rate; +u8 nb_rx_ts; +unsigned long tx_fs_rate; +unsigned long tx_bit_rate; +u8 nb_tx_ts; +}; + +/* Get information */ +int tsa_serial_get_info(struct tsa_serial *tsa_serial, struct tsa_serial_info*info);
drivers/soc/fsl/qe/tsa.h new file +2
-1+ +#endif /* __SOC_FSL_TSA_H__ */ --2.39.1
Herve Codina
maintainerPATCH v5 3/10 MAINTAINERS: add the Freescale TSA controller entry
In reply to Herve CodinaAfter contributing the driver, add myself as the maintainer for the Freescale TSA controller.
--- MAINTAINERS | 9 +++++++++ 1 file changed, 9 insertions(+)
MAINTAINERS +9 -0
@@ -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,cpm1-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.39.1
Herve Codina
maintainerPATCH v5 4/10 powerpc/8xx: Use a larger CPM1 command check mask
In reply to Herve CodinaThe 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
@@ -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.39.1
Herve Codina
maintainerPATCH v5 5/10 dt-bindings: soc: fsl: cpm_qe: Add QMC controller
In reply to Herve CodinaAdd support for the QMC (QUICC Multichannel Controller) available in some PowerQUICC SoC such as MPC885 or MPC866.
--- .../soc/fsl/cpm_qe/fsl,cpm1-scc-qmc.yaml | 172 ++++++++++++++++++ 1 file changed, 172 insertions(+) create mode 100644 Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,cpm1-scc-qmc.yaml
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,cpm1-scc-qmc.yaml new file +172 -0
@@ -0,0 +1,172 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/soc/fsl/cpm_qe/fsl,cpm1-scc-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: + maxItems: 1 + description: SCC interrupt line in the CPM interrupt controller + + fsl,tsa-serial: + $ref: /schemas/types.yaml#/definitions/phandle-array + items: + - items: + - description: phandle to TSA node + - enum: [1, 2, 3] + description: | + TSA serial interface (dt-bindings/soc/fsl,tsa.h defines these + values) + - 1: SCC2 + - 2: SCC3 + - 3: SCC4 + description: + Should be a phandle/number pair. The phandle to TSA node and the TSA + serial interface to use. + + '#address-cells': + const: 1 + + '#size-cells': + const: 0 + + '#fsl,chan-cells': + $ref: /schemas/types.yaml#/definitions/uint32 + const: 1 + description: + QMC consumers that use a phandle to QMC need to pass the channel number + with this phandle. + For instance "fsl,qmc-chan = <&qmc 16>;". + +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,operational-mode: + $ref: /schemas/types.yaml#/definitions/string + enum: [transparent, hdlc] + default: transparent + description: | + The channel operational mode + - hdlc: The channel handles HDLC frames + - transparent: The channel handles raw data without any processing + + 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. + + fsl,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. + + fsl,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 + - fsl,tx-ts-mask + - fsl,rx-ts-mask + +required: + - compatible + - reg + - reg-names + - interrupts + - fsl,tsa-serial + - '#address-cells' + - '#size-cells' + - '#fsl,chan-cells' + +additionalProperties: false + +examples: + - | + #include <dt-bindings/soc/fsl,tsa.h> + + 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>; + + #address-cells = <1>; + #size-cells = <0>; + #fsl,chan-cells = <1>; + + fsl,tsa-serial = <&tsa FSL_CPM_TSA_SCC4>; + + channel@16 { + /* Ch16 : First 4 even TS from all routed from TSA */ + reg = <16>; + fsl,mode = "transparent"; + fsl,reverse-data; + fsl,tx-ts-mask = <0x00000000 0x000000aa>; + fsl,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; + fsl,tx-ts-mask = <0x00000000 0x00000055>; + fsl,rx-ts-mask = <0x00000000 0x00000055>; + }; + + channel@19 { + /* Ch19 : 8 TS (TS 8..15) from all routed from TSA */ + reg = <19>; + fsl,mode = "hdlc"; + fsl,tx-ts-mask = <0x00000000 0x0000ff00>; + fsl,rx-ts-mask = <0x00000000 0x0000ff00>; + }; + };
Signature · 1 line
2.39.1
Re: [PATCH v5 05/10] dt-bindings: soc: fsl: cpm_qe: Add QMC controller
Quoted 9 lines · Herve Codina
Add support for the QMC (QUICC Multichannel Controller) available in some PowerQUICC SoC such as MPC885 or MPC866.
Signed-off-by Herve Codina <[email protected]>--- .../soc/fsl/cpm_qe/fsl,cpm1-scc-qmc.yaml | 172 ++++++++++++++++++ 1 file changed, 172 insertions(+) create mode 100644 Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,cpm1-scc-qmc.yaml
Best regards,
Krzysztof
Herve Codina
maintainerPATCH v5 6/10 soc: fsl: cpm1: Add support for QMC
In reply to Herve CodinaThe QMC (QUICC Multichannel Controller) emulates up to 64 channels within one serial controller using the same TDM physical interface routed from the TSA.
It is available in some PowerQUICC SoC such as the
MPC885 or MPC866.
It is also available on some Quicc Engine SoCs. This current version support CPM1 SoCs only and some enhancement are needed to support Quicc Engine SoCs.
--- drivers/soc/fsl/qe/Kconfig | 12 + drivers/soc/fsl/qe/Makefile | 1 + drivers/soc/fsl/qe/qmc.c | 1533 +++++++++++++++++++++++++++++++++++ include/soc/fsl/qe/qmc.h | 71 ++ 4 files changed, 1617 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
@@ -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 || (SOC_FSL && 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
@@ -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 +1533 -0
1,533 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.39.1
Herve Codina
maintainerPATCH v5 7/10 MAINTAINERS: add the Freescale QMC controller entry
In reply to Herve CodinaAfter contributing the driver, add myself as the maintainer for the Freescale QMC controller.
--- MAINTAINERS | 8 ++++++++ 1 file changed, 8 insertions(+)
MAINTAINERS +8 -0
@@ -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,cpm1-scc-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.39.1
Herve Codina
maintainerPATCH v5 8/10 dt-bindings: sound: Add support for QMC audio
In reply to Herve CodinaThe 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 | 117 ++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/fsl,qmc-audio.yaml
Documentation/devicetree/bindings/sound/fsl,qmc-audio.yaml new file +117 -0
@@ -0,0 +1,117 @@ +# 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. + +allOf: + - $ref: dai-common.yaml# + +properties: + compatible: + 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 + + fsl,qmc-chan: + $ref: /schemas/types.yaml#/definitions/phandle-array + items: + - items: + - description: phandle to QMC node + - description: Channel number + description: + Should be a phandle/number pair. The phandle to QMC node and the QMC + channel to use for this DAI. + + required: + - reg + - fsl,qmc-chan + +required: + - compatible + - '#address-cells' + - '#size-cells' + - '#sound-dai-cells' + +additionalProperties: false + +examples: + - | + audio_controller: audio-controller { + compatible = "fsl,qmc-audio"; + #address-cells = <1>; + #size-cells = <0>; + #sound-dai-cells = <1>; + dai@16 { + reg = <16>; + fsl,qmc-chan = <&qmc 16>; + }; + dai@17 { + reg = <17>; + fsl,qmc-chan = <&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 = <&audio_controller 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 = <&audio_controller 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.39.1
Herve Codina
maintainerPATCH v5 9/10 ASoC: fsl: Add support for QMC audio
In reply to Herve CodinaThe 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 | 735 ++++++++++++++++++++++++++++++++++ 3 files changed, 746 insertions(+) create mode 100644 sound/soc/fsl/fsl_qmc_audio.c
sound/soc/fsl/Kconfig +9 -0
@@ -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
@@ -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 +735 -0
735 lines not on this page · raw message
Signature · 1 line
2.39.1
Herve Codina
maintainerPATCH v5 10/10 MAINTAINERS: add the Freescale QMC audio entry
In reply to Herve CodinaAfter 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
@@ -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.39.1
Michael Ellerman
reviewerQuoted 4 lines · Herve Codina
Hi,
This series adds support for audio using the QMC controller available in some Freescale PowerQUICC SoCs.
Who's going to take this series?
By lines of code it's mostly in drivers/soc/fsl, so I was expecting it would go via that tree.
Or is it a sound series that should go via one of the sound trees?
cheers
...
Quoted 25 lines
.../soc/fsl/cpm_qe/fsl,cpm1-scc-qmc.yaml | 172 ++ .../bindings/soc/fsl/cpm_qe/fsl,cpm1-tsa.yaml | 234 +++ .../bindings/sound/fsl,qmc-audio.yaml | 117 ++ 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 | 1533 +++++++++++++++++ drivers/soc/fsl/qe/tsa.c | 869 ++++++++++ drivers/soc/fsl/qe/tsa.h | 42 + include/dt-bindings/soc/fsl,tsa.h | 13 + include/soc/fsl/qe/qmc.h | 71 + sound/soc/fsl/Kconfig | 9 + sound/soc/fsl/Makefile | 2 + sound/soc/fsl/fsl_qmc_audio.c | 735 ++++++++ 15 files changed, 3848 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,cpm1-scc-qmc.yaml create mode 100644 Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,cpm1-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
Le 17/02/2023 à 00:52, Michael Ellerman a écrit :
Quoted 6 lines
Quoted 4 lines · Herve Codina
Hi,
This series adds support for audio using the QMC controller available in some Freescale PowerQUICC SoCs.
Quoted 6 lines
Who's going to take this series?
By lines of code it's mostly in
drivers/soc/fsl, so I was expecting it would go via that tree.Or is it a sound series that should go via one of the sound trees?
It is a sound series, I was expecting it to go via sound tree, that's the reason why I asked and got an Acked-by: from fsl soc maintainers.
Mark, is that ok for you or do you expect this series to go via soc tree ?
Thanks
Christophe
Quoted 29 lines
cheers
...
Quoted 25 lines
.../soc/fsl/cpm_qe/fsl,cpm1-scc-qmc.yaml | 172 ++ .../bindings/soc/fsl/cpm_qe/fsl,cpm1-tsa.yaml | 234 +++ .../bindings/sound/fsl,qmc-audio.yaml | 117 ++ 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 | 1533 +++++++++++++++++ drivers/soc/fsl/qe/tsa.c | 869 ++++++++++ drivers/soc/fsl/qe/tsa.h | 42 + include/dt-bindings/soc/fsl,tsa.h | 13 + include/soc/fsl/qe/qmc.h | 71 + sound/soc/fsl/Kconfig | 9 + sound/soc/fsl/Makefile | 2 + sound/soc/fsl/fsl_qmc_audio.c | 735 ++++++++ 15 files changed, 3848 insertions(+), 1 deletion(-)create mode 100644
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,cpm1-scc-qmc.yamlcreate mode 100644Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,cpm1-tsa.yamlcreate mode 100644Documentation/devicetree/bindings/sound/fsl,qmc-audio.yamlcreate mode 100644drivers/soc/fsl/qe/qmc.c
create mode 100644drivers/soc/fsl/qe/tsa.c
create mode 100644drivers/soc/fsl/qe/tsa.h
create mode 100644include/dt-bindings/soc/fsl,tsa.h
create mode 100644include/soc/fsl/qe/qmc.h
create mode 100644sound/soc/fsl/fsl_qmc_audio.c
Mark Brown
maintainerQuoted 1 line · Christophe Leroy
Mark, is that ok for you or do you expect this series to go via soc tree ?
Sure, that sounds good to me. I'll give it another check and then assuming everything is fine apply for -rc1.
Herve Codina
maintainerQuoted 6 lines · On Fri, 17 Feb 2023 19:15:22 +0000 Mark Brown <[email protected]> wrote:
Quoted 1 line · Christophe Leroy
Mark, is that ok for you or do you expect this series to go via soc tree ?
Sure, that sounds good to me. I'll give it another check and then assuming everything is fine apply for -rc1.
Thanks a lot,
Hervé
Signature · 3 lines
Hervé Codina, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Herve Codina
maintainerQuoted 5 lines · On Fri, 17 Feb 2023 21:18:20 +0100 Herve Codina <[email protected]>…
Quoted 2 lines · On Fri, 17 Feb 2023 19:15:22 +0000 Mark Brown <[email protected]> wrote:
On Fri, Feb 17, 2023 at 06:32:03AM +0000, Christophe Leroy wrote:
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Mark, is that ok for you or do you expect this series to go via soc tree ?
Sure, that sounds good to me. I'll give it another check and then assuming everything is fine apply for -rc1.
Thanks a lot,
Hervé
And note that the v6 series is available.
https://lore.kernel.org/linux-kernel/[email protected]/
with the v5 feedbacks from Krzysztof taken into account.
Hervé
Signature · 3 lines
Hervé Codina, Bootlin Embedded Linux and Kernel engineering https://bootlin.com