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

dma-engine: sun4i: Add has_reset option to quirk

Allwinner suniv F1C100s has a reset bit for DMA in CCU. Sun4i do not
has this bit but in order to support suniv we need to add it. So add
support for reset bit.

Signed-off-by: Mesih Kilinc <mesihkilinc@gmail.com>
[ csokas.bence: Rebased and addressed comments ]
Signed-off-by: Csókás Bence <csokas.bence@prolan.hu>
Link: https://lore.kernel.org/r/20241122161128.2619172-3-csokas.bence@prolan.hu
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Mesih Kilinc and committed by
Vinod Koul
e17ca0ef a2186c2c

+11
+11
drivers/dma/sun4i-dma.c
··· 15 15 #include <linux/of_dma.h> 16 16 #include <linux/of_device.h> 17 17 #include <linux/platform_device.h> 18 + #include <linux/reset.h> 18 19 #include <linux/slab.h> 19 20 #include <linux/spinlock.h> 20 21 ··· 160 159 u8 ddma_drq_sdram; 161 160 162 161 u8 max_burst; 162 + bool has_reset; 163 163 }; 164 164 165 165 struct sun4i_dma_pchan { ··· 210 208 int irq; 211 209 spinlock_t lock; 212 210 const struct sun4i_dma_config *cfg; 211 + struct reset_control *rst; 213 212 }; 214 213 215 214 static struct sun4i_dma_dev *to_sun4i_dma_dev(struct dma_device *dev) ··· 1218 1215 return PTR_ERR(priv->clk); 1219 1216 } 1220 1217 1218 + if (priv->cfg->has_reset) { 1219 + priv->rst = devm_reset_control_get_exclusive_deasserted(&pdev->dev, NULL); 1220 + if (IS_ERR(priv->rst)) 1221 + return dev_err_probe(&pdev->dev, PTR_ERR(priv->rst), 1222 + "Failed to get reset control\n"); 1223 + } 1224 + 1221 1225 platform_set_drvdata(pdev, priv); 1222 1226 spin_lock_init(&priv->lock); 1223 1227 ··· 1365 1355 .ddma_drq_sdram = SUN4I_DDMA_DRQ_TYPE_SDRAM, 1366 1356 1367 1357 .max_burst = SUN4I_MAX_BURST, 1358 + .has_reset = false, 1368 1359 }; 1369 1360 1370 1361 static const struct of_device_id sun4i_dma_match[] = {