diff options
author | Ludovic Desroches <ludovic.desroches@atmel.com> | 2015-01-27 10:30:30 -0500 |
---|---|---|
committer | Vinod Koul <vinod.koul@intel.com> | 2015-02-05 02:12:28 -0500 |
commit | 734bb9a7b3e198ba3b7d12565dce31d1568ab018 (patch) | |
tree | 913f70920b6bb52d472ca83bff836fe3a8e6ac55 /drivers/dma/at_xdmac.c | |
parent | cbb85e672690ad3d02e97aeba33a1e1f722bbacc (diff) |
dmaengine: at_xdmac: introduce save_cc field
When suspending the device, read the channel configuration directly from
the register instead of relying on a software snapshot, it will be
safer.
Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Diffstat (limited to 'drivers/dma/at_xdmac.c')
-rw-r--r-- | drivers/dma/at_xdmac.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c index ed8a576cee7b..8aebf1833284 100644 --- a/drivers/dma/at_xdmac.c +++ b/drivers/dma/at_xdmac.c | |||
@@ -200,6 +200,7 @@ struct at_xdmac_chan { | |||
200 | u8 memif; /* Memory Interface */ | 200 | u8 memif; /* Memory Interface */ |
201 | u32 per_src_addr; | 201 | u32 per_src_addr; |
202 | u32 per_dst_addr; | 202 | u32 per_dst_addr; |
203 | u32 save_cc; | ||
203 | u32 save_cim; | 204 | u32 save_cim; |
204 | u32 save_cnda; | 205 | u32 save_cnda; |
205 | u32 save_cndc; | 206 | u32 save_cndc; |
@@ -1276,6 +1277,7 @@ static int atmel_xdmac_suspend(struct device *dev) | |||
1276 | list_for_each_entry_safe(chan, _chan, &atxdmac->dma.channels, device_node) { | 1277 | list_for_each_entry_safe(chan, _chan, &atxdmac->dma.channels, device_node) { |
1277 | struct at_xdmac_chan *atchan = to_at_xdmac_chan(chan); | 1278 | struct at_xdmac_chan *atchan = to_at_xdmac_chan(chan); |
1278 | 1279 | ||
1280 | atchan->save_cc = at_xdmac_chan_read(atchan, AT_XDMAC_CC); | ||
1279 | if (at_xdmac_chan_is_cyclic(atchan)) { | 1281 | if (at_xdmac_chan_is_cyclic(atchan)) { |
1280 | if (!at_xdmac_chan_is_paused(atchan)) | 1282 | if (!at_xdmac_chan_is_paused(atchan)) |
1281 | at_xdmac_device_pause(chan); | 1283 | at_xdmac_device_pause(chan); |
@@ -1298,7 +1300,6 @@ static int atmel_xdmac_resume(struct device *dev) | |||
1298 | struct at_xdmac_chan *atchan; | 1300 | struct at_xdmac_chan *atchan; |
1299 | struct dma_chan *chan, *_chan; | 1301 | struct dma_chan *chan, *_chan; |
1300 | int i; | 1302 | int i; |
1301 | u32 cfg; | ||
1302 | 1303 | ||
1303 | clk_prepare_enable(atxdmac->clk); | 1304 | clk_prepare_enable(atxdmac->clk); |
1304 | 1305 | ||
@@ -1313,8 +1314,7 @@ static int atmel_xdmac_resume(struct device *dev) | |||
1313 | at_xdmac_write(atxdmac, AT_XDMAC_GE, atxdmac->save_gs); | 1314 | at_xdmac_write(atxdmac, AT_XDMAC_GE, atxdmac->save_gs); |
1314 | list_for_each_entry_safe(chan, _chan, &atxdmac->dma.channels, device_node) { | 1315 | list_for_each_entry_safe(chan, _chan, &atxdmac->dma.channels, device_node) { |
1315 | atchan = to_at_xdmac_chan(chan); | 1316 | atchan = to_at_xdmac_chan(chan); |
1316 | cfg = atchan->cfg[AT_XDMAC_CUR_CFG]; | 1317 | at_xdmac_chan_write(atchan, AT_XDMAC_CC, atchan->save_cc); |
1317 | at_xdmac_chan_write(atchan, AT_XDMAC_CC, cfg); | ||
1318 | if (at_xdmac_chan_is_cyclic(atchan)) { | 1318 | if (at_xdmac_chan_is_cyclic(atchan)) { |
1319 | at_xdmac_chan_write(atchan, AT_XDMAC_CNDA, atchan->save_cnda); | 1319 | at_xdmac_chan_write(atchan, AT_XDMAC_CNDA, atchan->save_cnda); |
1320 | at_xdmac_chan_write(atchan, AT_XDMAC_CNDC, atchan->save_cndc); | 1320 | at_xdmac_chan_write(atchan, AT_XDMAC_CNDC, atchan->save_cndc); |