|
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 |
|
@@ -159,6 +160,7 @@ struct sun4i_dma_config {
|
159 | 160 | u8 ddma_drq_sdram;
|
160 | 161 |
|
161 | 162 | u8 max_burst;
|
| 163 | + bool has_reset; |
162 | 164 | };
|
163 | 165 |
|
164 | 166 | struct sun4i_dma_pchan {
|
@@ -208,6 +210,7 @@ struct sun4i_dma_dev {
|
208 | 210 | int irq;
|
209 | 211 | spinlock_t lock;
|
210 | 212 | const struct sun4i_dma_config *cfg;
|
| 213 | + struct reset_control *rst; |
211 | 214 | };
|
212 | 215 |
|
213 | 216 | static struct sun4i_dma_dev *to_sun4i_dma_dev(struct dma_device *dev)
|
@@ -1215,6 +1218,13 @@ static int sun4i_dma_probe(struct platform_device *pdev)
|
1215 | 1218 | return PTR_ERR(priv->clk);
|
1216 | 1219 | }
|
1217 | 1220 |
|
| 1221 | + if (priv->cfg->has_reset) { |
| 1222 | + priv->rst = devm_reset_control_get_exclusive_deasserted(&pdev->dev, NULL); |
| 1223 | + if (IS_ERR(priv->rst)) |
| 1224 | + return dev_err_probe(&pdev->dev, PTR_ERR(priv->rst), |
| 1225 | + "Failed to get reset control\n"); |
| 1226 | + } |
| 1227 | + |
1218 | 1228 | platform_set_drvdata(pdev, priv);
|
1219 | 1229 | spin_lock_init(&priv->lock);
|
1220 | 1230 |
|
@@ -1355,6 +1365,7 @@ static struct sun4i_dma_config sun4i_a10_dma_cfg = {
|
1355 | 1365 | .ddma_drq_sdram = SUN4I_DDMA_DRQ_TYPE_SDRAM,
|
1356 | 1366 |
|
1357 | 1367 | .max_burst = SUN4I_MAX_BURST,
|
| 1368 | + .has_reset = false, |
1358 | 1369 | };
|
1359 | 1370 |
|
1360 | 1371 | static const struct of_device_id sun4i_dma_match[] = {
|
|
0 commit comments