diff options
author | Eric Miao <eric.miao@marvell.com> | 2009-01-20 01:15:18 -0500 |
---|---|---|
committer | Eric Miao <eric.miao@marvell.com> | 2009-03-22 22:11:34 -0400 |
commit | 49cbe78637eb0503f45fc9b556ec08918a616534 (patch) | |
tree | 96de29959c5ef512d8f1e0bea7eae2245b7cc3f9 /arch/arm/mach-mmp/devices.c | |
parent | f8dec04d33b94a4cfa9358fd9666c01480bb164d (diff) |
[ARM] pxa: add base support for Marvell's PXA168 processor line
"""The MarvellĀ® PXA168 processor is the first in a family of application
processors targeted at mass market opportunities in computing and consumer
devices. It balances high computing and multimedia performance with low
power consumption to support extended battery life, and includes a wealth
of integrated peripherals to reduce overall BOM cost .... """
See http://www.marvell.com/featured/pxa168.jsp for more information.
1. Marvell Mohawk core is a hybrid of xscale3 and its own ARM core,
there are many enhancements like instructions for flushing the
whole D-cache, and so on
2. Clock reuses Russell's common clkdev, and added the basic support
for UART1/2.
3. Devices are a bit different from the 'mach-pxa' way, the platform
devices are now dynamically allocated only when necessary (i.e.
when pxa_register_device() is called). Description for each device
are stored in an array of 'struct pxa_device_desc'. Now that:
a. this array of device description is marked with __initdata and
can be freed up system is fully up
b. which means board code has to add all needed devices early in
his initializing function
c. platform specific data can now be marked as __initdata since
they are allocated and copied by platform_device_add_data()
4. only the basic UART1/2/3 are added, more devices will come later.
Signed-off-by: Jason Chagas <chagas@marvell.com>
Signed-off-by: Eric Miao <eric.miao@marvell.com>
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 | } | ||