diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-03-28 17:03:14 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-03-28 17:03:14 -0400 |
commit | 0fe41b8982001cd14ee2c77cd776735a5024e98b (patch) | |
tree | 83e65d595c413d55259ea14fb97748ce5efe5707 /arch/arm/mach-mmp/devices.c | |
parent | eedf2c5296a8dfaaf9aec1a938c1d3bd73159a30 (diff) | |
parent | 9759d22c8348343b0da4e25d6150c41712686c14 (diff) |
Merge branch 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm
* 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm: (422 commits)
[ARM] 5435/1: fix compile warning in sanity_check_meminfo()
[ARM] 5434/1: ARM: OMAP: Fix mailbox compile for 24xx
[ARM] pxa: fix the bad assumption that PCMCIA sockets always start with 0
[ARM] pxa: fix Colibri PXA300 and PXA320 LCD backlight pins
imxfb: Fix TFT mode
i.MX21/27: remove ifdef CONFIG_FB_IMX
imxfb: add clock support
mxc: add arch_reset() function
clkdev: add possibility to get a clock based on the device name
i.MX1: remove fb support from mach-imx
[ARM] pxa: build arch/arm/plat-pxa/mfp.c only when PXA3xx or ARCH_MMP defined
Gemini: Add support for Teltonika RUT100
Gemini: gpiolib based GPIO support v2
MAINTAINERS: add myself as Gemini architecture maintainer
ARM: Add Gemini architecture v3
[ARM] OMAP: Fix compile for omap2_init_common_hw()
MAINTAINERS: Add myself as Faraday ARM core variant maintainer
ARM: Add support for FA526 v2
[ARM] acorn,ebsa110,footbridge,integrator,sa1100: Convert asm/io.h to linux/io.h
[ARM] collie: fix two minor formatting nits
...
Diffstat (limited to 'arch/arm/mach-mmp/devices.c')
-rw-r--r-- | arch/arm/mach-mmp/devices.c | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/arch/arm/mach-mmp/devices.c b/arch/arm/mach-mmp/devices.c new file mode 100644 index 000000000000..191d9dea8731 --- /dev/null +++ b/arch/arm/mach-mmp/devices.c | |||
@@ -0,0 +1,69 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-mmp/devices.c | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | |||
9 | #include <linux/init.h> | ||
10 | #include <linux/platform_device.h> | ||
11 | #include <linux/dma-mapping.h> | ||
12 | |||
13 | #include <asm/irq.h> | ||
14 | #include <mach/devices.h> | ||
15 | |||
16 | int __init pxa_register_device(struct pxa_device_desc *desc, | ||
17 | void *data, size_t size) | ||
18 | { | ||
19 | struct platform_device *pdev; | ||
20 | struct resource res[2 + MAX_RESOURCE_DMA]; | ||
21 | int i, ret = 0, nres = 0; | ||
22 | |||
23 | pdev = platform_device_alloc(desc->drv_name, desc->id); | ||
24 | if (pdev == NULL) | ||
25 | return -ENOMEM; | ||
26 | |||
27 | pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); | ||
28 | |||
29 | memset(res, 0, sizeof(res)); | ||
30 | |||
31 | if (desc->start != -1ul && desc->size > 0) { | ||
32 | res[nres].start = desc->start; | ||
33 | res[nres].end = desc->start + desc->size - 1; | ||
34 | res[nres].flags = IORESOURCE_MEM; | ||
35 | nres++; | ||
36 | } | ||
37 | |||
38 | if (desc->irq != NO_IRQ) { | ||
39 | res[nres].start = desc->irq; | ||
40 | res[nres].end = desc->irq; | ||
41 | res[nres].flags = IORESOURCE_IRQ; | ||
42 | nres++; | ||
43 | } | ||
44 | |||
45 | for (i = 0; i < MAX_RESOURCE_DMA; i++, nres++) { | ||
46 | if (desc->dma[i] == 0) | ||
47 | break; | ||
48 | |||
49 | res[nres].start = desc->dma[i]; | ||
50 | res[nres].end = desc->dma[i]; | ||
51 | res[nres].flags = IORESOURCE_DMA; | ||
52 | } | ||
53 | |||
54 | ret = platform_device_add_resources(pdev, res, nres); | ||
55 | if (ret) { | ||
56 | platform_device_put(pdev); | ||
57 | return ret; | ||
58 | } | ||
59 | |||
60 | if (data && size) { | ||
61 | ret = platform_device_add_data(pdev, data, size); | ||
62 | if (ret) { | ||
63 | platform_device_put(pdev); | ||
64 | return ret; | ||
65 | } | ||
66 | } | ||
67 | |||
68 | return platform_device_add(pdev); | ||
69 | } | ||