|
@@ -1393,3 +1393,77 @@ static struct s3c2410_dma_chan *s3c2410_dma_map_channel(int channel)
|
|
|
}
|
|
|
|
|
|
if (ord->flags & DMA_CH_NEVER)
|
|
|
+ return NULL;
|
|
|
+ }
|
|
|
+
|
|
|
+ /* second, search the channel map for first free */
|
|
|
+
|
|
|
+ for (ch = 0; ch < dma_channels; ch++) {
|
|
|
+ if (!is_channel_valid(ch_map->channels[ch]))
|
|
|
+ continue;
|
|
|
+
|
|
|
+ if (s3c2410_chans[ch].in_use == 0) {
|
|
|
+ printk("mapped channel %d to %d\n", channel, ch);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (ch >= dma_channels)
|
|
|
+ return NULL;
|
|
|
+
|
|
|
+ /* update our channel mapping */
|
|
|
+
|
|
|
+ found:
|
|
|
+ dmach = &s3c2410_chans[ch];
|
|
|
+ dmach->map = ch_map;
|
|
|
+ dmach->req_ch = channel;
|
|
|
+ s3c_dma_chan_map[channel] = dmach;
|
|
|
+
|
|
|
+ /* select the channel */
|
|
|
+
|
|
|
+ (dma_sel.select)(dmach, ch_map);
|
|
|
+
|
|
|
+ return dmach;
|
|
|
+}
|
|
|
+
|
|
|
+static int s3c24xx_dma_check_entry(struct s3c24xx_dma_map *map, int ch)
|
|
|
+{
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int __init s3c24xx_dma_init_map(struct s3c24xx_dma_selection *sel)
|
|
|
+{
|
|
|
+ struct s3c24xx_dma_map *nmap;
|
|
|
+ size_t map_sz = sizeof(*nmap) * sel->map_size;
|
|
|
+ int ptr;
|
|
|
+
|
|
|
+ nmap = kmemdup(sel->map, map_sz, GFP_KERNEL);
|
|
|
+ if (nmap == NULL)
|
|
|
+ return -ENOMEM;
|
|
|
+
|
|
|
+ memcpy(&dma_sel, sel, sizeof(*sel));
|
|
|
+
|
|
|
+ dma_sel.map = nmap;
|
|
|
+
|
|
|
+ for (ptr = 0; ptr < sel->map_size; ptr++)
|
|
|
+ s3c24xx_dma_check_entry(nmap+ptr, ptr);
|
|
|
+
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int __init s3c24xx_dma_order_set(struct s3c24xx_dma_order *ord)
|
|
|
+{
|
|
|
+ struct s3c24xx_dma_order *nord = dma_order;
|
|
|
+
|
|
|
+ if (nord == NULL)
|
|
|
+ nord = kmalloc(sizeof(struct s3c24xx_dma_order), GFP_KERNEL);
|
|
|
+
|
|
|
+ if (nord == NULL) {
|
|
|
+ printk(KERN_ERR "no memory to store dma channel order\n");
|
|
|
+ return -ENOMEM;
|
|
|
+ }
|
|
|
+
|
|
|
+ dma_order = nord;
|
|
|
+ memcpy(nord, ord, sizeof(struct s3c24xx_dma_order));
|
|
|
+ return 0;
|
|
|
+}
|