diff options
author | Ben Dooks <ben-linux@fluff.org> | 2008-01-28 07:01:21 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-01-28 08:20:51 -0500 |
commit | c58f7a1d36709e50398c05df9419386befef2c59 (patch) | |
tree | d42e95dc2d942073b198cbc2490aaccc91ed01b4 | |
parent | c6709e8ef5752314c22c75bc7575f9be390e215b (diff) |
[ARM] 4781/1: S3C24XX: DMA suspend and resume support
If an DMA channel was active at suspend, then ensure that
it is correctly reconfigured when the system resumes.
Note, the previous policy was for each driver to handle their
own reconfiguration on resume. The policy has been changed to
make the individual driver's job easier.
Signed-off-by: Ben Dooks <ben-linux@flfuf.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r-- | arch/arm/plat-s3c24xx/dma.c | 26 | ||||
-rw-r--r-- | include/asm-arm/arch-s3c2410/dma.h | 1 |
2 files changed, 26 insertions, 1 deletions
diff --git a/arch/arm/plat-s3c24xx/dma.c b/arch/arm/plat-s3c24xx/dma.c index 10ef3995b114..68ce89db17db 100644 --- a/arch/arm/plat-s3c24xx/dma.c +++ b/arch/arm/plat-s3c24xx/dma.c | |||
@@ -1173,6 +1173,7 @@ int s3c2410_dma_devconfig(int channel, | |||
1173 | 1173 | ||
1174 | chan->source = source; | 1174 | chan->source = source; |
1175 | chan->dev_addr = devaddr; | 1175 | chan->dev_addr = devaddr; |
1176 | chan->hw_cfg = hwcfg; | ||
1176 | 1177 | ||
1177 | switch (source) { | 1178 | switch (source) { |
1178 | case S3C2410_DMASRC_HW: | 1179 | case S3C2410_DMASRC_HW: |
@@ -1235,6 +1236,10 @@ int s3c2410_dma_getposition(dmach_t channel, dma_addr_t *src, dma_addr_t *dst) | |||
1235 | 1236 | ||
1236 | EXPORT_SYMBOL(s3c2410_dma_getposition); | 1237 | EXPORT_SYMBOL(s3c2410_dma_getposition); |
1237 | 1238 | ||
1239 | static struct s3c2410_dma_chan *to_dma_chan(struct sys_device *dev) | ||
1240 | { | ||
1241 | return container_of(dev, struct s3c2410_dma_chan, dev); | ||
1242 | } | ||
1238 | 1243 | ||
1239 | /* system device class */ | 1244 | /* system device class */ |
1240 | 1245 | ||
@@ -1242,7 +1247,7 @@ EXPORT_SYMBOL(s3c2410_dma_getposition); | |||
1242 | 1247 | ||
1243 | static int s3c2410_dma_suspend(struct sys_device *dev, pm_message_t state) | 1248 | static int s3c2410_dma_suspend(struct sys_device *dev, pm_message_t state) |
1244 | { | 1249 | { |
1245 | struct s3c2410_dma_chan *cp = container_of(dev, struct s3c2410_dma_chan, dev); | 1250 | struct s3c2410_dma_chan *cp = to_dma_chan(dev); |
1246 | 1251 | ||
1247 | printk(KERN_DEBUG "suspending dma channel %d\n", cp->number); | 1252 | printk(KERN_DEBUG "suspending dma channel %d\n", cp->number); |
1248 | 1253 | ||
@@ -1264,6 +1269,24 @@ static int s3c2410_dma_suspend(struct sys_device *dev, pm_message_t state) | |||
1264 | 1269 | ||
1265 | static int s3c2410_dma_resume(struct sys_device *dev) | 1270 | static int s3c2410_dma_resume(struct sys_device *dev) |
1266 | { | 1271 | { |
1272 | struct s3c2410_dma_chan *cp = to_dma_chan(dev); | ||
1273 | unsigned int no = cp->number | DMACH_LOW_LEVEL; | ||
1274 | |||
1275 | /* restore channel's hardware configuration */ | ||
1276 | |||
1277 | if (!cp->in_use) | ||
1278 | return 0; | ||
1279 | |||
1280 | printk(KERN_INFO "dma%d: restoring configuration\n", cp->number); | ||
1281 | |||
1282 | s3c2410_dma_config(no, cp->xfer_unit, cp->dcon); | ||
1283 | s3c2410_dma_devconfig(no, cp->source, cp->hw_cfg, cp->dev_addr); | ||
1284 | |||
1285 | /* re-select the dma source for this channel */ | ||
1286 | |||
1287 | if (cp->map != NULL) | ||
1288 | dma_sel.select(cp, cp->map); | ||
1289 | |||
1267 | return 0; | 1290 | return 0; |
1268 | } | 1291 | } |
1269 | 1292 | ||
@@ -1453,6 +1476,7 @@ static struct s3c2410_dma_chan *s3c2410_dma_map_channel(int channel) | |||
1453 | 1476 | ||
1454 | found: | 1477 | found: |
1455 | dmach = &s3c2410_chans[ch]; | 1478 | dmach = &s3c2410_chans[ch]; |
1479 | dmach->map = ch_map; | ||
1456 | dma_chan_map[channel] = dmach; | 1480 | dma_chan_map[channel] = dmach; |
1457 | 1481 | ||
1458 | /* select the channel */ | 1482 | /* select the channel */ |
diff --git a/include/asm-arm/arch-s3c2410/dma.h b/include/asm-arm/arch-s3c2410/dma.h index c6e8d8f64938..4f291d9b7d93 100644 --- a/include/asm-arm/arch-s3c2410/dma.h +++ b/include/asm-arm/arch-s3c2410/dma.h | |||
@@ -214,6 +214,7 @@ struct s3c2410_dma_chan { | |||
214 | unsigned long dev_addr; | 214 | unsigned long dev_addr; |
215 | unsigned long load_timeout; | 215 | unsigned long load_timeout; |
216 | unsigned int flags; /* channel flags */ | 216 | unsigned int flags; /* channel flags */ |
217 | unsigned int hw_cfg; /* last hw config */ | ||
217 | 218 | ||
218 | struct s3c24xx_dma_map *map; /* channel hw maps */ | 219 | struct s3c24xx_dma_map *map; /* channel hw maps */ |
219 | 220 | ||