#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"
struct dma_device dma;
struct device *dev;
__iomem void *base;
+ struct reset_control *rstc;
int irq;
int irq_index;
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);
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) {
free_irq:
free_irq(ad->irq, ad);
+free_reset:
+ reset_control_rearm(ad->rstc);
return err;
}
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;
}