soc: cix: Add the Sky1 AUDSS DMA-350 interrupt path
Subsystems (5)
v5 cover soc: cix: Add the Sky1 AUDSS DMA-350 interrupt path
Hello,
This series adds the CIX Sky1 AUDSS DMA-350 interrupt path through the audio subsystem CRU and restricts DMA channel registration using the optional dma-channel-mask property. No audio client drivers are added. DTS enablement is kept separate from this revision.
It depends on the companion v7 series, "dmaengine: arm-dma350: Add slave support and Sky1 integration". Apply that series first.
The CRU gates eight DMA channel inputs onto a shared GIC interrupt. Implement the irqchip as an auxiliary driver under drivers/irqchip/, following the existing reset auxiliary device pattern. It shares the parent regmap and the same CRU DT node; no new hardware node is needed. The existing reset driver is unchanged.
There is no per-channel pending status in the gate register. Poll enabled children using level flow handling with IRQ_IS_POLLED, retaining masking for disabled and oneshot-threaded children. The domain's PM device is the IRQ child. Its PM callbacks quiesce the parent IRQ around parent CRU power transitions; shared clock, reset and register context remain with the CRU driver. Use noirq ordering for system sleep and dispose mappings before removing the domain. No sleepable resume runs in hard IRQ context.
Changes since v4:
- Split CRU interrupt/reset context preservation into a separate patch. (Brian.)
- Drop the unrelated reset-assert error-handling change from this series. (Brian.)
- Match the IRQ registration helper to the existing reset helper's conditional-compilation pattern and remove the added bits.h include. (Brian.)
- Use the same modern PM macros as the IRQ driver, retaining noirq ordering and the existing pm_ptr() pointer. (Brian.)
- Collect Rob's Reviewed-by for the unchanged CRU binding; retain the existing channel-mask review tags.
Previous version:
https://lore.kernel.org/r/[email protected]
Jelly Jia (6):
dt-bindings: soc: cix: Describe the Sky1 AUDSS DMA IRQ controller
irqchip: Add the Sky1 AUDSS auxiliary interrupt controller
clk: cix: Preserve Sky1 AUDSS interrupt and reset context
clk: cix: Register the Sky1 AUDSS IRQ auxiliary device
dt-bindings: dma: arm,dma-350: Document dma-channel-mask
dmaengine: arm-dma350: Honour dma-channel-mask
.../devicetree/bindings/dma/arm,dma-350.yaml | 3 + .../bindings/soc/cix/cix,sky1-audss-cru.yaml | 31 ++- MAINTAINERS | 1 + drivers/clk/cix/clk-sky1-audss.c | 49 +++- drivers/dma/arm-dma350.c | 16 +- drivers/irqchip/Kconfig | 16 ++ drivers/irqchip/Makefile | 1 + drivers/irqchip/irq-sky1-audss.c | 255 ++++++++++++++++++ 8 files changed, 363 insertions(+), 9 deletions(-) create mode 100644 drivers/irqchip/irq-sky1-audss.c
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
prerequisite-patch-id: aad1bc3c30a4825048143a3e0395e696201548e9
prerequisite-patch-id: 2e9d1a314d10e25bcd4e2285b36471200a9f17e6
prerequisite-patch-id: cf5b4f0b15f7e217ded422fa78c169653004d70b
prerequisite-patch-id: b1a307c60ed1189999dbae31770cc5e4afe569e0
prerequisite-patch-id: b78624ba53dce6857d20b65d3393ca5c77fd2c6e
prerequisite-patch-id: d19a15bf5a6aed8ab078eab07594dbdfd81bbcaf
prerequisite-patch-id: ac650cba94ae1fc52c25e6e1cf67e3af38cf92fa
prerequisite-patch-id: 53807c6c2b9d9deef242023baf70ac7e9f73a87b
prerequisite-patch-id: 62385082b538a0f354f44a70c2c251771238e047
prerequisite-patch-id: caf492d9e693ce5901d8c4512906258607b435a6
Signature · 1 line
2.54.0
PATCH v5 1/6 dt-bindings: soc: cix: Describe the Sky1 AUDSS DMA IRQ controller
The AUDSS CRU contains a separate AP interrupt gate for each of the eight DMA-350 channels. The enabled inputs are combined onto one GIC interrupt. These gates are part of the CRU register block, not the DMA controller.
Describe the CRU as an interrupt-controller in addition to its clock and reset functions. A child interrupt specifier contains the DMA channel index, matching the corresponding gate bit; the parent interrupt is the combined GIC line.
--- .../bindings/soc/cix/cix,sky1-audss-cru.yaml | 31 +++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/soc/cix/cix,sky1-audss-cru.yaml +29 -2
@@ -28,6 +28,12 @@ description: | The SoC syscon NoC (or bus) reset is described via resets. The audio subsystem power domain is described via power-domains. + The same register block contains the eight DMA-350 channel interrupt + gates at offset 0x54. When the node is an interrupt-controller, the + cell is the DMA channel index (0 through 7). The corresponding gate + bit is unmasked while that interrupt is requested, and the eight + inputs are combined onto the parent GIC interrupt. + properties: compatible: const: cix,sky1-audss-cru
@@ -45,6 +51,18 @@ properties: description: Reset indices are defined in include/dt-bindings/reset/cix,sky1-audss-cru.h. + interrupt-controller: true + + '#interrupt-cells': + const: 1 + description: + The cell is the DMA-350 channel index, 0 through 7. + + interrupts: + maxItems: 1 + description: + Combined DMA-350 channel interrupt after the CRU gates. + clocks: items: - description: I2S parent clock for sampling rates multiple of 8kHz.
@@ -75,18 +93,27 @@ required: - power-domains - resets +dependentRequired: + interrupt-controller: [ interrupts ] + additionalProperties: false examples: - | - audss_cru: clock-controller@7110000 { + #include <dt-bindings/interrupt-controller/arm-gic.h> + #include <dt-bindings/interrupt-controller/irq.h> + + clock-controller@7110000 { compatible = "cix,sky1-audss-cru"; reg = <0x7110000 0x10000>; #clock-cells = <1>; - #reset-cells = <1>; clocks = <&scmi_clk 76>, <&scmi_clk 78>, <&scmi_clk 70>, <&scmi_clk 71>; clock-names = "x8k", "x11k", "sys", "48m"; + #interrupt-cells = <1>; + interrupt-controller; + interrupts = <GIC_SPI 230 IRQ_TYPE_LEVEL_HIGH 0>; power-domains = <&smc_devpd 0>; + #reset-cells = <1>; resets = <&s5_syscon 31>; };
Signature · 1 line
2.54.0
PATCH v5 2/6 irqchip: Add the Sky1 AUDSS auxiliary interrupt controller
In reply to Jelly JiaThe AUDSS CRU gates eight DMA channel interrupts onto a shared parent line. Implement its irqchip, domain and chained handler in an auxiliary driver under drivers/irqchip rather than the clock subsystem.
Reuse the parent CRU regmap and firmware node. Retain level/polled child flow, explicit disable masking, mapping disposal and powered teardown. Keep clock/reset control in the parent. Coordinate the parent IRQ's quiescing with runtime PM and noirq system sleep, keeping sleepable power management out of hard IRQ callbacks.
--- MAINTAINERS | 1 + drivers/irqchip/Kconfig | 16 ++ drivers/irqchip/Makefile | 1 + drivers/irqchip/irq-sky1-audss.c | 255 +++++++++++++++++++++++++++++++ 4 files changed, 273 insertions(+) create mode 100644 drivers/irqchip/irq-sky1-audss.c
MAINTAINERS +1 -0
@@ -2904,6 +2904,7 @@ T: git https://github.com/cixtech/linux-mainline.git F: Documentation/devicetree/bindings/arm/cix.yaml F: Documentation/devicetree/bindings/mailbox/cix,sky1-mbox.yaml F: arch/arm64/boot/dts/cix/ +F: drivers/irqchip/irq-sky1-audss.c F: drivers/mailbox/cix-mailbox.c K: \bcix\b
drivers/irqchip/Kconfig +16 -0
@@ -233,6 +233,22 @@ config LAN966X_OIC config MADERA_IRQ tristate +config IRQ_SKY1_AUDSS + tristate "CIX Sky1 AUDSS DMA interrupt controller" + depends on ARCH_CIX || COMPILE_TEST + depends on OF + select AUXILIARY_BUS + select IRQ_DOMAIN + select REGMAP + default CLK_SKY1_AUDSS + help + Support the DMA channel interrupt gates in the CIX Sky1 audio + subsystem CRU. This auxiliary driver shares the clock controller's + register map and combines the channel interrupts onto a parent IRQ. + + To compile this driver as a module, choose M here: the module will + be called irq-sky1-audss. + config IRQ_MIPS_CPU bool select GENERIC_IRQ_CHIP
drivers/irqchip/Makefile +1 -0
@@ -1,5 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 obj-$(CONFIG_IRQCHIP) += irqchip.o +obj-$(CONFIG_IRQ_SKY1_AUDSS) += irq-sky1-audss.o obj-$(CONFIG_AL_FIC) += irq-al-fic.o obj-$(CONFIG_ALPINE_MSI) += irq-alpine-msi.o
drivers/irqchip/irq-sky1-audss.c new file +255 -0
255 lines not on this page · raw message
Signature · 1 line
2.54.0
PATCH v5 3/6 clk: cix: Preserve Sky1 AUDSS interrupt and reset context
In reply to Jelly JiaThe AUDSS CRU saves its clock configuration before runtime suspend, but the save list does not include the AP interrupt gates or software reset state. If that state is lost across a CRU power transition, restoring the clocks alone does not restore the configuration of its consumers.
Add INFO_AP_IRQC and INFO_SW_RESETN to the existing save and restore list so the interrupt gate and reset configuration is preserved with the rest of the CRU context.
--- drivers/clk/cix/clk-sky1-audss.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/clk/cix/clk-sky1-audss.c +4 -0
@@ -18,7 +18,9 @@#define INFO_CLK_GATE 0x10#define INFO_CLK_DIV 0x14#define INFO_CLK_MUX 0x18 +#define INFO_AP_IRQC 0x54#define INFO_MCLK 0x70 +#define INFO_SW_RESETN 0x78#define SKY1_AUDSS_CLK_PARENTS_CNT 4#define SKY1_AUDSS_NUM_CLKS (CLK_MCLK4 + 1)
@@ -28,7 +30,9 @@ static u32 sky1_reg_save[][2] = { { INFO_CLK_GATE, 0 }, { INFO_CLK_DIV, 0 }, { INFO_CLK_MUX, 0 }, + { INFO_AP_IRQC, 0 }, { INFO_MCLK, 0 }, + { INFO_SW_RESETN, 0 }, }; static const char * const sky1_audss_clk_names[SKY1_AUDSS_CLK_PARENTS_CNT] = {
Signature · 1 line
2.54.0
Re: [PATCH v5 3/6] clk: cix: Preserve Sky1 AUDSS interrupt and reset context
Quoted 10 lines
The AUDSS CRU saves its clock configuration before runtime suspend, but the save list does not include the AP interrupt gates or software reset state. If that state is lost across a CRU power transition, restoring the clocks alone does not restore the configuration of its consumers.
Add
INFO_AP_IRQCandINFO_SW_RESETNto the existing save and restore list so the interrupt gate and reset configuration is preserved with the rest of the CRU context.Signed-off-by Jelly Jia <[email protected]>
Signature · 1 line
Brian Masney <[email protected]>
PATCH v5 4/6 clk: cix: Register the Sky1 AUDSS IRQ auxiliary device
In reply to Jelly JiaRegister an auxiliary IRQ device for CRU nodes declaring an interrupt controller, following the existing reset device pattern. Share a raw-lock regmap with the IRQ driver so its hard IRQ callbacks can access the CRU.
Restore the parent before child IRQ delivery resumes using noirq system-sleep ordering. Use the same PM callback macros as the IRQ driver. Auxiliary child teardown must run before parent regmap/runtime-PM cleanup. The existing reset-sky1-audss.c is unchanged.
--- drivers/clk/cix/clk-sky1-audss.c | 45 +++++++++++++++++++++++++++----- 1 file changed, 39 insertions(+), 6 deletions(-)
drivers/clk/cix/clk-sky1-audss.c +39 -6
@@ -523,6 +523,7 @@ static const struct regmap_config sky1_audss_regmap_config = { .reg_bits = 32, .val_bits = 32, .reg_stride = 4, + .use_raw_spinlock = true, };struct sky1_audss_clks_priv {
@@ -932,6 +933,31 @@ static int sky1_audss_clks_enable(struct sky1_audss_clks_priv *priv)return err; } +#if IS_ENABLED (CONFIG_IRQ_SKY1_AUDSS ) + +static int sky1_audss_irq_controller_register (struct device *dev) +{ +struct auxiliary_device *adev; + +if (!of_property_present (dev->of_node,"interrupt-controller" )) +return 0 ; + + adev =devm_auxiliary_device_create (dev,"irq" ,NULL ); +if (!adev) +return -ENODEV ; + +return 0 ; +} + +#else + +static int sky1_audss_irq_controller_register (struct device *dev) +{ +return 0 ; +} + +#endif /* CONFIG_IRQ_SKY1_AUDSS */ +static void sky1_audss_clks_disable (struct sky1_audss_clks_priv *priv) {const struct sky1_audss_clks_devtype_data *devtype_data = priv->devtype_data;
@@ -1114,6 +1140,13 @@ static int sky1_audss_clk_probe(struct platform_device *pdev) goto fail_pm; } +/* Remove auxiliary children before the parent runtime-PM cleanup. */ + ret =sky1_audss_irq_controller_register (dev); +if (ret) { +dev_err_probe (dev, ret,"failed to set up AUDSS DMA IRQs\n" ); + goto fail_pm; + } +pm_runtime_put_sync (dev);return 0 ;
@@ -1123,7 +1156,7 @@ static int sky1_audss_clk_probe(struct platform_device *pdev)return ret; } -static int __maybe_unused sky1_audss_clk_runtime_suspend (struct device *dev) +static int sky1_audss_clk_runtime_suspend (struct device *dev) {struct sky1_audss_clks_priv *priv =dev_get_drvdata (dev);const struct sky1_audss_clks_devtype_data *devtype_data = priv->devtype_data;
@@ -1143,7 +1176,7 @@ static int __maybe_unused sky1_audss_clk_runtime_suspend(struct device *dev)return 0 ; } -static int __maybe_unused sky1_audss_clk_runtime_resume (struct device *dev) +static int sky1_audss_clk_runtime_resume (struct device *dev) {struct sky1_audss_clks_priv *priv =dev_get_drvdata (dev);const struct sky1_audss_clks_devtype_data *devtype_data = priv->devtype_data;
@@ -1172,10 +1205,10 @@ static int __maybe_unused sky1_audss_clk_runtime_resume(struct device *dev) }static const struct dev_pm_ops sky1_audss_clk_pm_ops = { - SET_RUNTIME_PM_OPS(sky1_audss_clk_runtime_suspend, - sky1_audss_clk_runtime_resume, NULL) -SET_SYSTEM_SLEEP_PM_OPS (pm_runtime_force_suspend, - pm_runtime_force_resume) + RUNTIME_PM_OPS(sky1_audss_clk_runtime_suspend, + sky1_audss_clk_runtime_resume, NULL) +NOIRQ_SYSTEM_SLEEP_PM_OPS (pm_runtime_force_suspend, + pm_runtime_force_resume) };static const struct sky1_audss_clks_devtype_data sky1_devtype_data = {
Signature · 1 line
2.54.0
Re: [PATCH v5 4/6] clk: cix: Register the Sky1 AUDSS IRQ auxiliary device
Quoted 10 lines
Register an auxiliary IRQ device for CRU nodes declaring an interrupt controller, following the existing reset device pattern. Share a raw-lock regmap with the IRQ driver so its hard IRQ callbacks can access the CRU.
Restore the parent before child IRQ delivery resumes using noirq system-sleep ordering. Use the same PM callback macros as the IRQ driver. Auxiliary child teardown must run before parent regmap/runtime-PM cleanup. The existing
reset-sky1-audss.cis unchanged.Signed-off-by Jelly Jia <[email protected]>
Signature · 1 line
Brian Masney <[email protected]>
PATCH v5 5/6 dt-bindings: dma: arm,dma-350: Document dma-channel-mask
In reply to Jelly JiaSome DMA-350 integrations reserve channels for firmware or another processor. Allow the standard dma-channel-mask property so firmware can describe which channels Linux may use.
DMA-350 implements at most eight channels, so one 32-bit cell is enough; limit the property to a single cell.
--- Documentation/devicetree/bindings/dma/arm,dma-350.yaml | 3 +++ 1 file changed, 3 insertions(+)
Documentation/devicetree/bindings/dma/arm,dma-350.yaml +3 -0
@@ -47,6 +47,9 @@ properties: description: Optional reset line, where the integration exposes one. + dma-channel-mask: + maxItems: 1 + required: - compatible - reg
Signature · 1 line
2.54.0
PATCH v5 6/6 dmaengine: arm-dma350: Honour dma-channel-mask
In reply to Jelly JiaDMA-350 channels may be reserved for firmware or another processor. Read the optional dma-channel-mask property and register only the channels whose bits are set. If the property is absent, preserve the existing behaviour and expose every hardware channel.
Skip masked channels before accessing their channel registers or initializing their interrupts and virt-dma state. This avoids clearing or configuring channels reserved for firmware or another processor.
DMA-350 supports at most eight channels, so a single u32 covers every hardware channel without an additional 32-channel guard.
--- drivers/dma/arm-dma350.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
drivers/dma/arm-dma350.c +15 -1
@@ -18,6 +18,7 @@#include <linux/of_dma.h> #include <linux/overflow.h> #include <linux/platform_device.h> +#include <linux/property.h> #include <linux/reset.h> #include <linux/scatterlist.h> #include <linux/slab.h>
@@ -1276,9 +1277,10 @@ static int d350_probe(struct platform_device *pdev)struct clk *clk;struct d350 *dmac;void __iomem *base; +u32 chan_mask =U32_MAX ;u32 reg;int ret, nchan, dw, aw, r, p; -bool coherent, memset; +bool coherent, has_chan_mask, memset; clk =devm_clk_get_optional_enabled (dev,NULL );if (IS_ERR (clk))
@@ -1351,6 +1353,15 @@ static int d350_probe(struct platform_device *pdev) dmac->dma.device_caps = d350_device_caps;INIT_LIST_HEAD (&dmac->dma.channels); +/* Firmware-reserved channels must not be accessed or registered. */ + has_chan_mask =device_property_present (dev,"dma-channel-mask" ); +if (has_chan_mask) { + ret =device_property_read_u32 (dev,"dma-channel-mask" , &chan_mask); +if (ret) +return dev_err_probe (dev, ret, +"failed to read dma-channel-mask\n" ); + } + reg =readl_relaxed (base +DMANSECCTRL +NSEC_CTRL );writel_relaxed (reg |INTREN_ANYCHINTR_EN , base +DMANSECCTRL +NSEC_CTRL );
@@ -1360,6 +1371,9 @@ static int d350_probe(struct platform_device *pdev)for (int i =0 ; i < nchan; i++) {struct d350_chan *dch = &dmac->channels[i]; +if (has_chan_mask && !(chan_mask &BIT (i))) +continue ; + dch->base = base +DMACH (i);writel_relaxed (CH_CMD_CLEAR , dch->base +CH_CMD );
Signature · 1 line
2.54.0