* [PATCH 0/4] Apple ADMAC peripheral reset clean-up
@ 2022-09-18 9:58 Martin Povišer
2022-09-18 9:58 ` [PATCH 1/4] dt-bindings: dma: apple,admac: Add reset Martin Povišer
` (4 more replies)
0 siblings, 5 replies; 9+ messages in thread
From: Martin Povišer @ 2022-09-18 9:58 UTC (permalink / raw)
To: Hector Martin, Sven Peter, Vinod Koul, Rob Herring,
Krzysztof Kozlowski, Philipp Zabel
Cc: Alyssa Rosenzweig, asahi, dmaengine, devicetree, linux-kernel,
Martin Povišer
On Apple SoCs the ADMAC peripheral shares a reset line with another
audio-related peripheral which is the MCA.
On the side of the MCA, the reset is described in binding (staged in
broonie-sound/for-6.1) and in the soon-to-be-merged series adding new
nodes to t8103/t600x SoC device trees [1]. The staged MCA driver does
make use of the reset, knowing it's a shared one.
This series catches up on the ADMAC side, adds the reset to the binding
and describes it in the t8103/t600x DTs (on top of [1]). It also pulls
the shared reset from the driver.
Since [1] already includes another ADMAC binding change and will
probably be fully merged into Hector's asahi-soc tree, I propose the
binding change here takes the same route. Leaving patches #3 and #4 to
go into dmaengine.
[1] https://lore.kernel.org/asahi/87pmful5r4.wl-maz@kernel.org/T/#t
Martin Povišer (4):
dt-bindings: dma: apple,admac: Add reset
arm64: dts: apple: Add ADMAC resets on t8103/t600x
dmaengine: apple-admac: Do not use devres for IRQs
dmaengine: apple-admac: Trigger shared reset
--
2.33.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/4] dt-bindings: dma: apple,admac: Add reset
2022-09-18 9:58 [PATCH 0/4] Apple ADMAC peripheral reset clean-up Martin Povišer
@ 2022-09-18 9:58 ` Martin Povišer
2022-09-18 10:00 ` Krzysztof Kozlowski
2022-09-18 9:58 ` [PATCH 2/4] arm64: dts: apple: Add ADMAC resets on t8103/t600x Martin Povišer
` (3 subsequent siblings)
4 siblings, 1 reply; 9+ messages in thread
From: Martin Povišer @ 2022-09-18 9:58 UTC (permalink / raw)
To: Hector Martin, Sven Peter, Vinod Koul, Rob Herring,
Krzysztof Kozlowski, Philipp Zabel
Cc: Alyssa Rosenzweig, asahi, dmaengine, devicetree, linux-kernel,
Martin Povišer
On the SoCs there is usually a shared audio reset line, so add
a property for that.
Signed-off-by: Martin Povišer <povik+lin@cutebit.org>
---
Documentation/devicetree/bindings/dma/apple,admac.yaml | 3 +++
1 file changed, 3 insertions(+)
diff --git a/Documentation/devicetree/bindings/dma/apple,admac.yaml b/Documentation/devicetree/bindings/dma/apple,admac.yaml
index 3b1e667f7ea0..97282469e4af 100644
--- a/Documentation/devicetree/bindings/dma/apple,admac.yaml
+++ b/Documentation/devicetree/bindings/dma/apple,admac.yaml
@@ -56,6 +56,9 @@ properties:
power-domains:
maxItems: 1
+ resets:
+ maxItems: 1
+
required:
- compatible
- reg
--
2.33.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/4] arm64: dts: apple: Add ADMAC resets on t8103/t600x
2022-09-18 9:58 [PATCH 0/4] Apple ADMAC peripheral reset clean-up Martin Povišer
2022-09-18 9:58 ` [PATCH 1/4] dt-bindings: dma: apple,admac: Add reset Martin Povišer
@ 2022-09-18 9:58 ` Martin Povišer
2022-09-18 9:58 ` [PATCH 3/4] dmaengine: apple-admac: Do not use devres for IRQs Martin Povišer
` (2 subsequent siblings)
4 siblings, 0 replies; 9+ messages in thread
From: Martin Povišer @ 2022-09-18 9:58 UTC (permalink / raw)
To: Hector Martin, Sven Peter, Vinod Koul, Rob Herring,
Krzysztof Kozlowski, Philipp Zabel
Cc: Alyssa Rosenzweig, asahi, dmaengine, devicetree, linux-kernel,
Martin Povišer
There's a shared reset for the ADMAC and MCA peripherals. The MCA node
already describes it, and being a shared reset it is important we
describe it on the ADMAC node too.
Signed-off-by: Martin Povišer <povik+lin@cutebit.org>
---
arch/arm64/boot/dts/apple/t600x-die0.dtsi | 1 +
arch/arm64/boot/dts/apple/t8103.dtsi | 1 +
2 files changed, 2 insertions(+)
diff --git a/arch/arm64/boot/dts/apple/t600x-die0.dtsi b/arch/arm64/boot/dts/apple/t600x-die0.dtsi
index 639c90e108a7..0b8958a8db77 100644
--- a/arch/arm64/boot/dts/apple/t600x-die0.dtsi
+++ b/arch/arm64/boot/dts/apple/t600x-die0.dtsi
@@ -181,6 +181,7 @@ admac: dma-controller@39b400000 {
<0>;
iommus = <&dart_sio_0 2>, <&dart_sio_1 2>;
power-domains = <&ps_sio_adma>;
+ resets = <&ps_audio_p>;
};
mca: mca@39b600000 {
diff --git a/arch/arm64/boot/dts/apple/t8103.dtsi b/arch/arm64/boot/dts/apple/t8103.dtsi
index 51bc901482db..358906a9274d 100644
--- a/arch/arm64/boot/dts/apple/t8103.dtsi
+++ b/arch/arm64/boot/dts/apple/t8103.dtsi
@@ -249,6 +249,7 @@ admac: dma-controller@238200000 {
#dma-cells = <1>;
iommus = <&dart_sio 2>;
power-domains = <&ps_sio_adma>;
+ resets = <&ps_audio_p>;
};
mca: i2s@238400000 {
--
2.33.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/4] dmaengine: apple-admac: Do not use devres for IRQs
2022-09-18 9:58 [PATCH 0/4] Apple ADMAC peripheral reset clean-up Martin Povišer
2022-09-18 9:58 ` [PATCH 1/4] dt-bindings: dma: apple,admac: Add reset Martin Povišer
2022-09-18 9:58 ` [PATCH 2/4] arm64: dts: apple: Add ADMAC resets on t8103/t600x Martin Povišer
@ 2022-09-18 9:58 ` Martin Povišer
2022-09-29 16:14 ` Vinod Koul
2022-09-18 9:58 ` [PATCH 4/4] dmaengine: apple-admac: Trigger shared reset Martin Povišer
2022-09-22 13:44 ` [PATCH 0/4] Apple ADMAC peripheral reset clean-up Hector Martin
4 siblings, 1 reply; 9+ messages in thread
From: Martin Povišer @ 2022-09-18 9:58 UTC (permalink / raw)
To: Hector Martin, Sven Peter, Vinod Koul, Rob Herring,
Krzysztof Kozlowski, Philipp Zabel
Cc: Alyssa Rosenzweig, asahi, dmaengine, devicetree, linux-kernel,
Martin Povišer
This is in advance of adding support for triggering the reset signal to
the peripheral, since registering the IRQ handler will have to be
sequenced with it.
Signed-off-by: Martin Povišer <povik+lin@cutebit.org>
---
drivers/dma/apple-admac.c | 27 ++++++++++++++++++---------
1 file changed, 18 insertions(+), 9 deletions(-)
diff --git a/drivers/dma/apple-admac.c b/drivers/dma/apple-admac.c
index d1f74a3aa999..7d1b76678032 100644
--- a/drivers/dma/apple-admac.c
+++ b/drivers/dma/apple-admac.c
@@ -96,6 +96,7 @@ struct admac_data {
struct device *dev;
__iomem void *base;
+ int irq;
int irq_index;
int nchannels;
struct admac_chan channels[];
@@ -724,12 +725,7 @@ static int admac_probe(struct platform_device *pdev)
if (irq < 0)
return dev_err_probe(&pdev->dev, irq, "no usable interrupt\n");
-
- err = devm_request_irq(&pdev->dev, irq, admac_interrupt,
- 0, dev_name(&pdev->dev), ad);
- if (err)
- return dev_err_probe(&pdev->dev, err,
- "unable to register interrupt\n");
+ ad->irq = irq;
ad->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(ad->base))
@@ -774,17 +770,29 @@ static int admac_probe(struct platform_device *pdev)
tasklet_setup(&adchan->tasklet, admac_chan_tasklet);
}
- err = dma_async_device_register(&ad->dma);
+ err = request_irq(irq, admac_interrupt, 0, dev_name(&pdev->dev), ad);
if (err)
- return dev_err_probe(&pdev->dev, err, "failed to register DMA device\n");
+ return dev_err_probe(&pdev->dev, err,
+ "unable to register interrupt\n");
+
+ err = dma_async_device_register(&ad->dma);
+ if (err) {
+ dev_err_probe(&pdev->dev, err, "failed to register DMA device\n");
+ goto free_irq;
+ }
err = of_dma_controller_register(pdev->dev.of_node, admac_dma_of_xlate, ad);
if (err) {
dma_async_device_unregister(&ad->dma);
- return dev_err_probe(&pdev->dev, err, "failed to register with OF\n");
+ dev_err_probe(&pdev->dev, err, "failed to register with OF\n");
+ goto free_irq;
}
return 0;
+
+free_irq:
+ free_irq(ad->irq, ad);
+ return err;
}
static int admac_remove(struct platform_device *pdev)
@@ -793,6 +801,7 @@ static int admac_remove(struct platform_device *pdev)
of_dma_controller_free(pdev->dev.of_node);
dma_async_device_unregister(&ad->dma);
+ free_irq(ad->irq, ad);
return 0;
}
--
2.33.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 4/4] dmaengine: apple-admac: Trigger shared reset
2022-09-18 9:58 [PATCH 0/4] Apple ADMAC peripheral reset clean-up Martin Povišer
` (2 preceding siblings ...)
2022-09-18 9:58 ` [PATCH 3/4] dmaengine: apple-admac: Do not use devres for IRQs Martin Povišer
@ 2022-09-18 9:58 ` Martin Povišer
2022-09-30 9:01 ` Philipp Zabel
2022-09-22 13:44 ` [PATCH 0/4] Apple ADMAC peripheral reset clean-up Hector Martin
4 siblings, 1 reply; 9+ messages in thread
From: Martin Povišer @ 2022-09-18 9:58 UTC (permalink / raw)
To: Hector Martin, Sven Peter, Vinod Koul, Rob Herring,
Krzysztof Kozlowski, Philipp Zabel
Cc: Alyssa Rosenzweig, asahi, dmaengine, devicetree, linux-kernel,
Martin Povišer
If a reset domain is attached to the device, obtain a shared reference
to it and trigger it. Typically on a chip the ADMAC controller will
share a reset domain with the MCA peripheral.
Signed-off-by: Martin Povišer <povik+lin@cutebit.org>
---
drivers/dma/apple-admac.c | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/drivers/dma/apple-admac.c b/drivers/dma/apple-admac.c
index 7d1b76678032..317ca76ccafd 100644
--- a/drivers/dma/apple-admac.c
+++ b/drivers/dma/apple-admac.c
@@ -12,8 +12,9 @@
#include <linux/module.h>
#include <linux/of_device.h>
#include <linux/of_dma.h>
-#include <linux/interrupt.h>
+#include <linux/reset.h>
#include <linux/spinlock.h>
+#include <linux/interrupt.h>
#include "dmaengine.h"
@@ -95,6 +96,7 @@ struct admac_data {
struct dma_device dma;
struct device *dev;
__iomem void *base;
+ struct reset_control *rstc;
int irq;
int irq_index;
@@ -732,6 +734,10 @@ static int admac_probe(struct platform_device *pdev)
return dev_err_probe(&pdev->dev, PTR_ERR(ad->base),
"unable to obtain MMIO resource\n");
+ ad->rstc = devm_reset_control_get_optional_shared(&pdev->dev, NULL);
+ if (IS_ERR(ad->rstc))
+ return PTR_ERR(ad->rstc);
+
dma = &ad->dma;
dma_cap_set(DMA_PRIVATE, dma->cap_mask);
@@ -770,10 +776,17 @@ static int admac_probe(struct platform_device *pdev)
tasklet_setup(&adchan->tasklet, admac_chan_tasklet);
}
- err = request_irq(irq, admac_interrupt, 0, dev_name(&pdev->dev), ad);
+ err = reset_control_reset(ad->rstc);
if (err)
return dev_err_probe(&pdev->dev, err,
- "unable to register interrupt\n");
+ "unable to trigger reset\n");
+
+ err = request_irq(irq, admac_interrupt, 0, dev_name(&pdev->dev), ad);
+ if (err) {
+ dev_err_probe(&pdev->dev, err,
+ "unable to register interrupt\n");
+ goto free_reset;
+ }
err = dma_async_device_register(&ad->dma);
if (err) {
@@ -792,6 +805,8 @@ static int admac_probe(struct platform_device *pdev)
free_irq:
free_irq(ad->irq, ad);
+free_reset:
+ reset_control_rearm(ad->rstc);
return err;
}
@@ -802,6 +817,7 @@ static int admac_remove(struct platform_device *pdev)
of_dma_controller_free(pdev->dev.of_node);
dma_async_device_unregister(&ad->dma);
free_irq(ad->irq, ad);
+ reset_control_rearm(ad->rstc);
return 0;
}
--
2.33.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/4] dt-bindings: dma: apple,admac: Add reset
2022-09-18 9:58 ` [PATCH 1/4] dt-bindings: dma: apple,admac: Add reset Martin Povišer
@ 2022-09-18 10:00 ` Krzysztof Kozlowski
0 siblings, 0 replies; 9+ messages in thread
From: Krzysztof Kozlowski @ 2022-09-18 10:00 UTC (permalink / raw)
To: Martin Povišer, Hector Martin, Sven Peter, Vinod Koul,
Rob Herring, Krzysztof Kozlowski, Philipp Zabel
Cc: Alyssa Rosenzweig, asahi, dmaengine, devicetree, linux-kernel
On 18/09/2022 10:58, Martin Povišer wrote:
> On the SoCs there is usually a shared audio reset line, so add
> a property for that.
>
> Signed-off-by: Martin Povišer <povik+lin@cutebit.org>
> ---
> Documentation/devicetree/bindings/dma/apple,admac.yaml | 3 +++
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 0/4] Apple ADMAC peripheral reset clean-up
2022-09-18 9:58 [PATCH 0/4] Apple ADMAC peripheral reset clean-up Martin Povišer
` (3 preceding siblings ...)
2022-09-18 9:58 ` [PATCH 4/4] dmaengine: apple-admac: Trigger shared reset Martin Povišer
@ 2022-09-22 13:44 ` Hector Martin
4 siblings, 0 replies; 9+ messages in thread
From: Hector Martin @ 2022-09-22 13:44 UTC (permalink / raw)
To: Martin Povišer, Sven Peter, Vinod Koul, Rob Herring,
Krzysztof Kozlowski, Philipp Zabel
Cc: Alyssa Rosenzweig, asahi, dmaengine, devicetree, linux-kernel
On 18/09/2022 18.58, Martin Povišer wrote:
> On Apple SoCs the ADMAC peripheral shares a reset line with another
> audio-related peripheral which is the MCA.
>
> On the side of the MCA, the reset is described in binding (staged in
> broonie-sound/for-6.1) and in the soon-to-be-merged series adding new
> nodes to t8103/t600x SoC device trees [1]. The staged MCA driver does
> make use of the reset, knowing it's a shared one.
>
> This series catches up on the ADMAC side, adds the reset to the binding
> and describes it in the t8103/t600x DTs (on top of [1]). It also pulls
> the shared reset from the driver.
>
> Since [1] already includes another ADMAC binding change and will
> probably be fully merged into Hector's asahi-soc tree, I propose the
> binding change here takes the same route. Leaving patches #3 and #4 to
> go into dmaengine.
>
> [1] https://lore.kernel.org/asahi/87pmful5r4.wl-maz@kernel.org/T/#t
>
> Martin Povišer (4):
> dt-bindings: dma: apple,admac: Add reset
> arm64: dts: apple: Add ADMAC resets on t8103/t600x
> dmaengine: apple-admac: Do not use devres for IRQs
> dmaengine: apple-admac: Trigger shared reset
>
Applied patches #1-#2 to asahi-soc/dt, thanks!
- Hector
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 3/4] dmaengine: apple-admac: Do not use devres for IRQs
2022-09-18 9:58 ` [PATCH 3/4] dmaengine: apple-admac: Do not use devres for IRQs Martin Povišer
@ 2022-09-29 16:14 ` Vinod Koul
0 siblings, 0 replies; 9+ messages in thread
From: Vinod Koul @ 2022-09-29 16:14 UTC (permalink / raw)
To: Martin Povišer
Cc: Hector Martin, Sven Peter, Rob Herring, Krzysztof Kozlowski,
Philipp Zabel, Alyssa Rosenzweig, asahi, dmaengine, devicetree,
linux-kernel
On 18-09-22, 11:58, Martin Povišer wrote:
> This is in advance of adding support for triggering the reset signal to
> the peripheral, since registering the IRQ handler will have to be
> sequenced with it.
Applied 3-4, thanks
--
~Vinod
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 4/4] dmaengine: apple-admac: Trigger shared reset
2022-09-18 9:58 ` [PATCH 4/4] dmaengine: apple-admac: Trigger shared reset Martin Povišer
@ 2022-09-30 9:01 ` Philipp Zabel
0 siblings, 0 replies; 9+ messages in thread
From: Philipp Zabel @ 2022-09-30 9:01 UTC (permalink / raw)
To: Martin Povišer, Hector Martin, Sven Peter, Vinod Koul,
Rob Herring, Krzysztof Kozlowski
Cc: Alyssa Rosenzweig, asahi, dmaengine, devicetree, linux-kernel
Hi Martin,
On So, 2022-09-18 at 11:58 +0200, Martin Povišer wrote:
> If a reset domain is attached to the device, obtain a shared reference
> to it and trigger it. Typically on a chip the ADMAC controller will
> share a reset domain with the MCA peripheral.
>
> Signed-off-by: Martin Povišer <povik+lin@cutebit.org>
> ---
> drivers/dma/apple-admac.c | 22 +++++++++++++++++++---
> 1 file changed, 19 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/dma/apple-admac.c b/drivers/dma/apple-admac.c
> index 7d1b76678032..317ca76ccafd 100644
> --- a/drivers/dma/apple-admac.c
> +++ b/drivers/dma/apple-admac.c
> @@ -12,8 +12,9 @@
> #include <linux/module.h>
> #include <linux/of_device.h>
> #include <linux/of_dma.h>
> -#include <linux/interrupt.h>
> +#include <linux/reset.h>
> #include <linux/spinlock.h>
> +#include <linux/interrupt.h>
Moving around the linux/interrupt.h include doesn't belong in this
patch. Otherwise this looks good to me, assuming the MCA driver does
the same reset/rearm dance.
regards
Philipp
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2022-09-30 9:01 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-18 9:58 [PATCH 0/4] Apple ADMAC peripheral reset clean-up Martin Povišer
2022-09-18 9:58 ` [PATCH 1/4] dt-bindings: dma: apple,admac: Add reset Martin Povišer
2022-09-18 10:00 ` Krzysztof Kozlowski
2022-09-18 9:58 ` [PATCH 2/4] arm64: dts: apple: Add ADMAC resets on t8103/t600x Martin Povišer
2022-09-18 9:58 ` [PATCH 3/4] dmaengine: apple-admac: Do not use devres for IRQs Martin Povišer
2022-09-29 16:14 ` Vinod Koul
2022-09-18 9:58 ` [PATCH 4/4] dmaengine: apple-admac: Trigger shared reset Martin Povišer
2022-09-30 9:01 ` Philipp Zabel
2022-09-22 13:44 ` [PATCH 0/4] Apple ADMAC peripheral reset clean-up Hector Martin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).