Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

dmaengine: sh: rz-dmac: Add reset support

Add reset support for DMAC module found on RZ/G2L alike SoCs.

For booting the board, reset release of the DMAC module is required
otherwise we don't get GIC interrupts. Currently the reset release
was done by the bootloader now move this to the driver instead.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Link: https://lore.kernel.org/r/20230315064501.21491-1-biju.das.jz@bp.renesas.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Biju Das and committed by
Vinod Koul
d1e71a3a 4a69516f

+14
+14
drivers/dma/sh/rz-dmac.c
··· 20 20 #include <linux/of_platform.h> 21 21 #include <linux/platform_device.h> 22 22 #include <linux/pm_runtime.h> 23 + #include <linux/reset.h> 23 24 #include <linux/slab.h> 24 25 #include <linux/spinlock.h> 25 26 ··· 93 92 struct rz_dmac { 94 93 struct dma_device engine; 95 94 struct device *dev; 95 + struct reset_control *rstc; 96 96 void __iomem *base; 97 97 void __iomem *ext_base; 98 98 ··· 891 889 /* Initialize the channels. */ 892 890 INIT_LIST_HEAD(&dmac->engine.channels); 893 891 892 + dmac->rstc = devm_reset_control_array_get_exclusive(&pdev->dev); 893 + if (IS_ERR(dmac->rstc)) 894 + return dev_err_probe(&pdev->dev, PTR_ERR(dmac->rstc), 895 + "failed to get resets\n"); 896 + 894 897 pm_runtime_enable(&pdev->dev); 895 898 ret = pm_runtime_resume_and_get(&pdev->dev); 896 899 if (ret < 0) { 897 900 dev_err(&pdev->dev, "pm_runtime_resume_and_get failed\n"); 898 901 goto err_pm_disable; 899 902 } 903 + 904 + ret = reset_control_deassert(dmac->rstc); 905 + if (ret) 906 + goto err_pm_runtime_put; 900 907 901 908 for (i = 0; i < dmac->n_channels; i++) { 902 909 ret = rz_dmac_chan_probe(dmac, &dmac->channels[i], i); ··· 951 940 dma_register_err: 952 941 of_dma_controller_free(pdev->dev.of_node); 953 942 err: 943 + reset_control_assert(dmac->rstc); 954 944 channel_num = i ? i - 1 : 0; 955 945 for (i = 0; i < channel_num; i++) { 956 946 struct rz_dmac_chan *channel = &dmac->channels[i]; ··· 962 950 channel->lmdesc.base_dma); 963 951 } 964 952 953 + err_pm_runtime_put: 965 954 pm_runtime_put(&pdev->dev); 966 955 err_pm_disable: 967 956 pm_runtime_disable(&pdev->dev); ··· 985 972 } 986 973 of_dma_controller_free(pdev->dev.of_node); 987 974 dma_async_device_unregister(&dmac->engine); 975 + reset_control_assert(dmac->rstc); 988 976 pm_runtime_put(&pdev->dev); 989 977 pm_runtime_disable(&pdev->dev); 990 978