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.

irqchip/renesas-rzv2h: Add rzv2h_icu_register_dma_req()

On the Renesas RZ/V2H(P) family of SoCs, DMAC IPs are connected
to the Interrupt Control Unit (ICU).
For DMA transfers, a request number must be registered with the
ICU, which means that the DMAC driver has to be able to instruct
the ICU driver with the registration of such id.

Export rzv2h_icu_register_dma_req() so that the DMAC driver can
register the DMAC request number.

Signed-off-by: Fabrizio Castro <fabrizio.castro.jz@renesas.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20250423143422.3747702-4-fabrizio.castro.jz@renesas.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Fabrizio Castro and committed by
Vinod Koul
9002b75a 22228b93

+58
+35
drivers/irqchip/irq-renesas-rzv2h.c
··· 15 15 #include <linux/err.h> 16 16 #include <linux/io.h> 17 17 #include <linux/irqchip.h> 18 + #include <linux/irqchip/irq-renesas-rzv2h.h> 18 19 #include <linux/irqdomain.h> 19 20 #include <linux/of_address.h> 20 21 #include <linux/of_platform.h> ··· 42 41 #define ICU_TSCLR 0x24 43 42 #define ICU_TITSR(k) (0x28 + (k) * 4) 44 43 #define ICU_TSSR(k) (0x30 + (k) * 4) 44 + #define ICU_DMkSELy(k, y) (0x420 + (k) * 0x20 + (y) * 4) 45 + #define ICU_DMACKSELk(k) (0x500 + (k) * 4) 45 46 46 47 /* NMI */ 47 48 #define ICU_NMI_EDGE_FALLING 0 ··· 106 103 u8 field_width; 107 104 }; 108 105 106 + /* DMAC */ 107 + #define ICU_DMAC_DkRQ_SEL_MASK GENMASK(9, 0) 108 + 109 + #define ICU_DMAC_DMAREQ_SHIFT(up) ((up) * 16) 110 + #define ICU_DMAC_DMAREQ_MASK(up) (ICU_DMAC_DkRQ_SEL_MASK \ 111 + << ICU_DMAC_DMAREQ_SHIFT(up)) 112 + #define ICU_DMAC_PREP_DMAREQ(sel, up) (FIELD_PREP(ICU_DMAC_DkRQ_SEL_MASK, (sel)) \ 113 + << ICU_DMAC_DMAREQ_SHIFT(up)) 114 + 109 115 /** 110 116 * struct rzv2h_icu_priv - Interrupt Control Unit controller private data structure. 111 117 * @base: Controller's base address ··· 128 116 raw_spinlock_t lock; 129 117 const struct rzv2h_hw_info *info; 130 118 }; 119 + 120 + void rzv2h_icu_register_dma_req(struct platform_device *icu_dev, u8 dmac_index, u8 dmac_channel, 121 + u16 req_no) 122 + { 123 + struct rzv2h_icu_priv *priv = platform_get_drvdata(icu_dev); 124 + u32 icu_dmksely, dmareq, dmareq_mask; 125 + u8 y, upper; 126 + 127 + y = dmac_channel / 2; 128 + upper = dmac_channel % 2; 129 + 130 + dmareq = ICU_DMAC_PREP_DMAREQ(req_no, upper); 131 + dmareq_mask = ICU_DMAC_DMAREQ_MASK(upper); 132 + 133 + guard(raw_spinlock_irqsave)(&priv->lock); 134 + 135 + icu_dmksely = readl(priv->base + ICU_DMkSELy(dmac_index, y)); 136 + icu_dmksely = (icu_dmksely & ~dmareq_mask) | dmareq; 137 + writel(icu_dmksely, priv->base + ICU_DMkSELy(dmac_index, y)); 138 + } 139 + EXPORT_SYMBOL_GPL(rzv2h_icu_register_dma_req); 131 140 132 141 static inline struct rzv2h_icu_priv *irq_data_to_priv(struct irq_data *data) 133 142 { ··· 515 482 rzv2h_icu_data = devm_kzalloc(&pdev->dev, sizeof(*rzv2h_icu_data), GFP_KERNEL); 516 483 if (!rzv2h_icu_data) 517 484 return -ENOMEM; 485 + 486 + platform_set_drvdata(pdev, rzv2h_icu_data); 518 487 519 488 rzv2h_icu_data->base = devm_of_iomap(&pdev->dev, pdev->dev.of_node, 0, NULL); 520 489 if (IS_ERR(rzv2h_icu_data->base))
+23
include/linux/irqchip/irq-renesas-rzv2h.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + /* 3 + * Renesas RZ/V2H(P) Interrupt Control Unit (ICU) 4 + * 5 + * Copyright (C) 2025 Renesas Electronics Corporation. 6 + */ 7 + 8 + #ifndef __LINUX_IRQ_RENESAS_RZV2H 9 + #define __LINUX_IRQ_RENESAS_RZV2H 10 + 11 + #include <linux/platform_device.h> 12 + 13 + #define RZV2H_ICU_DMAC_REQ_NO_DEFAULT 0x3ff 14 + 15 + #ifdef CONFIG_RENESAS_RZV2H_ICU 16 + void rzv2h_icu_register_dma_req(struct platform_device *icu_dev, u8 dmac_index, u8 dmac_channel, 17 + u16 req_no); 18 + #else 19 + static inline void rzv2h_icu_register_dma_req(struct platform_device *icu_dev, u8 dmac_index, 20 + u8 dmac_channel, u16 req_no) { } 21 + #endif 22 + 23 + #endif /* __LINUX_IRQ_RENESAS_RZV2H */