diff options
author | Santosh Shilimkar <santosh.shilimkar@ti.com> | 2009-03-23 21:07:48 -0400 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2009-03-23 21:51:20 -0400 |
commit | 2263f0222e836c7b2c144e0546a2701661e2f517 (patch) | |
tree | f2438344e9caa2a8418fbb7e73e8377a53fe656d /arch/arm/plat-omap | |
parent | 7954763bb95fd484a76d1151b40956fe331d23b9 (diff) |
ARM: OMAP: Get available DMA channels from cmdline
This patch set up a cmdline option for omap dma for masking the
available channels. It is needed since the OMAP DMA is a system wide
resource and can be used by another software apart from the kernel.
To reserve the omap SDMA channels for kernel dma usage, use cmdline
bootarg "omap_dma_reserve_ch=". The valid range is 1 to 32.
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Acked-by: Nishant Kamat <nskamat@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/plat-omap')
-rw-r--r-- | arch/arm/plat-omap/dma.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c index dcc9e83a61ee..b1d3c7991ffd 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; |
@@ -2321,6 +2322,10 @@ static int __init omap_init_dma(void) | |||
2321 | return -ENODEV; | 2322 | return -ENODEV; |
2322 | } | 2323 | } |
2323 | 2324 | ||
2325 | if (cpu_class_is_omap2() && omap_dma_reserve_channels | ||
2326 | && (omap_dma_reserve_channels <= dma_lch_count)) | ||
2327 | dma_lch_count = omap_dma_reserve_channels; | ||
2328 | |||
2324 | dma_chan = kzalloc(sizeof(struct omap_dma_lch) * dma_lch_count, | 2329 | dma_chan = kzalloc(sizeof(struct omap_dma_lch) * dma_lch_count, |
2325 | GFP_KERNEL); | 2330 | GFP_KERNEL); |
2326 | if (!dma_chan) | 2331 | if (!dma_chan) |
@@ -2371,7 +2376,7 @@ static int __init omap_init_dma(void) | |||
2371 | u8 revision = dma_read(REVISION) & 0xff; | 2376 | u8 revision = dma_read(REVISION) & 0xff; |
2372 | printk(KERN_INFO "OMAP DMA hardware revision %d.%d\n", | 2377 | printk(KERN_INFO "OMAP DMA hardware revision %d.%d\n", |
2373 | revision >> 4, revision & 0xf); | 2378 | revision >> 4, revision & 0xf); |
2374 | dma_chan_count = OMAP_DMA4_LOGICAL_DMA_CH_COUNT; | 2379 | dma_chan_count = dma_lch_count; |
2375 | } else { | 2380 | } else { |
2376 | dma_chan_count = 0; | 2381 | dma_chan_count = 0; |
2377 | return 0; | 2382 | return 0; |
@@ -2437,4 +2442,17 @@ static int __init omap_init_dma(void) | |||
2437 | 2442 | ||
2438 | arch_initcall(omap_init_dma); | 2443 | arch_initcall(omap_init_dma); |
2439 | 2444 | ||
2445 | /* | ||
2446 | * Reserve the omap SDMA channels using cmdline bootarg | ||
2447 | * "omap_dma_reserve_ch=". The valid range is 1 to 32 | ||
2448 | */ | ||
2449 | static int __init omap_dma_cmdline_reserve_ch(char *str) | ||
2450 | { | ||
2451 | if (get_option(&str, &omap_dma_reserve_channels) != 1) | ||
2452 | omap_dma_reserve_channels = 0; | ||
2453 | return 1; | ||
2454 | } | ||
2455 | |||
2456 | __setup("omap_dma_reserve_ch=", omap_dma_cmdline_reserve_ch); | ||
2457 | |||
2440 | 2458 | ||