diff options
Diffstat (limited to 'arch/arm/plat-omap/dma.c')
| -rw-r--r-- | arch/arm/plat-omap/dma.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c index 47ec77af4ccb..21cc0142b97a 100644 --- a/arch/arm/plat-omap/dma.c +++ b/arch/arm/plat-omap/dma.c | |||
| @@ -123,6 +123,7 @@ static struct dma_link_info *dma_linked_lch; | |||
| 123 | 123 | ||
| 124 | static int dma_lch_count; | 124 | static int dma_lch_count; |
| 125 | static int dma_chan_count; | 125 | static int dma_chan_count; |
| 126 | static int omap_dma_reserve_channels; | ||
| 126 | 127 | ||
| 127 | static spinlock_t dma_chan_lock; | 128 | static spinlock_t dma_chan_lock; |
| 128 | static struct omap_dma_lch *dma_chan; | 129 | static struct omap_dma_lch *dma_chan; |
| @@ -737,7 +738,7 @@ int omap_request_dma(int dev_id, const char *dev_name, | |||
| 737 | * id. | 738 | * id. |
| 738 | */ | 739 | */ |
| 739 | dma_write(dev_id | (1 << 10), CCR(free_ch)); | 740 | dma_write(dev_id | (1 << 10), CCR(free_ch)); |
| 740 | } else if (cpu_is_omap730() || cpu_is_omap15xx()) { | 741 | } else if (cpu_is_omap7xx() || cpu_is_omap15xx()) { |
| 741 | dma_write(dev_id, CCR(free_ch)); | 742 | dma_write(dev_id, CCR(free_ch)); |
| 742 | } | 743 | } |
| 743 | 744 | ||
| @@ -1900,7 +1901,7 @@ static int omap2_dma_handle_ch(int ch) | |||
| 1900 | /* STATUS register count is from 1-32 while our is 0-31 */ | 1901 | /* STATUS register count is from 1-32 while our is 0-31 */ |
| 1901 | static irqreturn_t omap2_dma_irq_handler(int irq, void *dev_id) | 1902 | static irqreturn_t omap2_dma_irq_handler(int irq, void *dev_id) |
| 1902 | { | 1903 | { |
| 1903 | u32 val; | 1904 | u32 val, enable_reg; |
| 1904 | int i; | 1905 | int i; |
| 1905 | 1906 | ||
| 1906 | val = dma_read(IRQSTATUS_L0); | 1907 | val = dma_read(IRQSTATUS_L0); |
| @@ -1909,6 +1910,8 @@ static irqreturn_t omap2_dma_irq_handler(int irq, void *dev_id) | |||
| 1909 | printk(KERN_WARNING "Spurious DMA IRQ\n"); | 1910 | printk(KERN_WARNING "Spurious DMA IRQ\n"); |
| 1910 | return IRQ_HANDLED; | 1911 | return IRQ_HANDLED; |
| 1911 | } | 1912 | } |
| 1913 | enable_reg = dma_read(IRQENABLE_L0); | ||
| 1914 | val &= enable_reg; /* Dispatch only relevant interrupts */ | ||
| 1912 | for (i = 0; i < dma_lch_count && val != 0; i++) { | 1915 | for (i = 0; i < dma_lch_count && val != 0; i++) { |
| 1913 | if (val & 1) | 1916 | if (val & 1) |
| 1914 | omap2_dma_handle_ch(i); | 1917 | omap2_dma_handle_ch(i); |
| @@ -2321,6 +2324,10 @@ static int __init omap_init_dma(void) | |||
| 2321 | return -ENODEV; | 2324 | return -ENODEV; |
| 2322 | } | 2325 | } |
| 2323 | 2326 | ||
| 2327 | if (cpu_class_is_omap2() && omap_dma_reserve_channels | ||
| 2328 | && (omap_dma_reserve_channels <= dma_lch_count)) | ||
| 2329 | dma_lch_count = omap_dma_reserve_channels; | ||
| 2330 | |||
| 2324 | dma_chan = kzalloc(sizeof(struct omap_dma_lch) * dma_lch_count, | 2331 | dma_chan = kzalloc(sizeof(struct omap_dma_lch) * dma_lch_count, |
| 2325 | GFP_KERNEL); | 2332 | GFP_KERNEL); |
| 2326 | if (!dma_chan) | 2333 | if (!dma_chan) |
| @@ -2339,7 +2346,7 @@ static int __init omap_init_dma(void) | |||
| 2339 | printk(KERN_INFO "DMA support for OMAP15xx initialized\n"); | 2346 | printk(KERN_INFO "DMA support for OMAP15xx initialized\n"); |
| 2340 | dma_chan_count = 9; | 2347 | dma_chan_count = 9; |
| 2341 | enable_1510_mode = 1; | 2348 | enable_1510_mode = 1; |
| 2342 | } else if (cpu_is_omap16xx() || cpu_is_omap730()) { | 2349 | } else if (cpu_is_omap16xx() || cpu_is_omap7xx()) { |
| 2343 | printk(KERN_INFO "OMAP DMA hardware version %d\n", | 2350 | printk(KERN_INFO "OMAP DMA hardware version %d\n", |
| 2344 | dma_read(HW_ID)); | 2351 | dma_read(HW_ID)); |
| 2345 | printk(KERN_INFO "DMA capabilities: %08x:%08x:%04x:%04x:%04x\n", | 2352 | printk(KERN_INFO "DMA capabilities: %08x:%08x:%04x:%04x:%04x\n", |
| @@ -2371,7 +2378,7 @@ static int __init omap_init_dma(void) | |||
| 2371 | u8 revision = dma_read(REVISION) & 0xff; | 2378 | u8 revision = dma_read(REVISION) & 0xff; |
| 2372 | printk(KERN_INFO "OMAP DMA hardware revision %d.%d\n", | 2379 | printk(KERN_INFO "OMAP DMA hardware revision %d.%d\n", |
| 2373 | revision >> 4, revision & 0xf); | 2380 | revision >> 4, revision & 0xf); |
| 2374 | dma_chan_count = OMAP_DMA4_LOGICAL_DMA_CH_COUNT; | 2381 | dma_chan_count = dma_lch_count; |
| 2375 | } else { | 2382 | } else { |
| 2376 | dma_chan_count = 0; | 2383 | dma_chan_count = 0; |
| 2377 | return 0; | 2384 | return 0; |
| @@ -2437,4 +2444,17 @@ static int __init omap_init_dma(void) | |||
| 2437 | 2444 | ||
| 2438 | arch_initcall(omap_init_dma); | 2445 | arch_initcall(omap_init_dma); |
| 2439 | 2446 | ||
| 2447 | /* | ||
| 2448 | * Reserve the omap SDMA channels using cmdline bootarg | ||
| 2449 | * "omap_dma_reserve_ch=". The valid range is 1 to 32 | ||
| 2450 | */ | ||
| 2451 | static int __init omap_dma_cmdline_reserve_ch(char *str) | ||
| 2452 | { | ||
| 2453 | if (get_option(&str, &omap_dma_reserve_channels) != 1) | ||
| 2454 | omap_dma_reserve_channels = 0; | ||
| 2455 | return 1; | ||
| 2456 | } | ||
| 2457 | |||
| 2458 | __setup("omap_dma_reserve_ch=", omap_dma_cmdline_reserve_ch); | ||
| 2459 | |||
| 2440 | 2460 | ||
