diff options
author | Mark A. Greer <mgreer@mvista.com> | 2009-04-15 15:38:58 -0400 |
---|---|---|
committer | Kevin Hilman <khilman@deeprootsystems.com> | 2009-05-26 11:14:04 -0400 |
commit | 79c3c0b729647a6246c120408f36e6804dab244e (patch) | |
tree | 5662bf481043b99b13951aaafd44d45a7903fa8b /arch/arm | |
parent | ac7b75b5bbbfd60b752869a22daa3be99b5b4f99 (diff) |
davinci: Encapsulate SoC-specific data in a structure
Create a structure to encapsulate SoC-specific information.
This will assist in generalizing code so it can be used by
different SoCs that have similar hardware but with minor
differences such as having a different base address.
The idea is that the code for each SoC fills out a structure
with the correct information. The board-specific code then
calls the SoC init routine which in turn will call a common
init routine that makes a copy of the structure, maps in I/O
regions, etc.
After initialization, code can get a pointer to the structure
by calling davinci_get_soc_info(). Eventually, the common
init routine will make a copy of all of the data pointed to
by the structure so the original data can be made __init_data.
That way the data for SoC's that aren't being used won't consume
memory for the entire life of the kernel.
The structure will be extended in subsequent patches but
initially, it holds the map_desc structure for any I/O
regions the SoC/board wants statically mapped.
Signed-off-by: Mark A. Greer <mgreer@mvista.com>
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-davinci/Makefile | 2 | ||||
-rw-r--r-- | arch/arm/mach-davinci/board-dm355-evm.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-davinci/board-dm355-leopard.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-davinci/board-dm644x-evm.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-davinci/board-dm646x-evm.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-davinci/board-sffsdr.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-davinci/common.c | 55 | ||||
-rw-r--r-- | arch/arm/mach-davinci/dm355.c | 18 | ||||
-rw-r--r-- | arch/arm/mach-davinci/dm644x.c | 18 | ||||
-rw-r--r-- | arch/arm/mach-davinci/dm646x.c | 18 | ||||
-rw-r--r-- | arch/arm/mach-davinci/include/mach/common.h | 12 | ||||
-rw-r--r-- | arch/arm/mach-davinci/include/mach/dm355.h | 3 | ||||
-rw-r--r-- | arch/arm/mach-davinci/io.c | 38 |
13 files changed, 127 insertions, 47 deletions
diff --git a/arch/arm/mach-davinci/Makefile b/arch/arm/mach-davinci/Makefile index 2873149da7f0..74d25f69934e 100644 --- a/arch/arm/mach-davinci/Makefile +++ b/arch/arm/mach-davinci/Makefile | |||
@@ -5,7 +5,7 @@ | |||
5 | 5 | ||
6 | # Common objects | 6 | # Common objects |
7 | obj-y := time.o irq.o clock.o serial.o io.o id.o psc.o \ | 7 | obj-y := time.o irq.o clock.o serial.o io.o id.o psc.o \ |
8 | gpio.o devices.o dma.o usb.o | 8 | gpio.o devices.o dma.o usb.o common.o |
9 | 9 | ||
10 | obj-$(CONFIG_DAVINCI_MUX) += mux.o | 10 | obj-$(CONFIG_DAVINCI_MUX) += mux.o |
11 | obj-$(CONFIG_CP_INTC) += cp_intc.o | 11 | obj-$(CONFIG_CP_INTC) += cp_intc.o |
diff --git a/arch/arm/mach-davinci/board-dm355-evm.c b/arch/arm/mach-davinci/board-dm355-evm.c index 087441313dd7..5ac2f565d860 100644 --- a/arch/arm/mach-davinci/board-dm355-evm.c +++ b/arch/arm/mach-davinci/board-dm355-evm.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <mach/serial.h> | 37 | #include <mach/serial.h> |
38 | #include <mach/nand.h> | 38 | #include <mach/nand.h> |
39 | #include <mach/mmc.h> | 39 | #include <mach/mmc.h> |
40 | #include <mach/common.h> | ||
40 | 41 | ||
41 | #define DAVINCI_ASYNC_EMIF_CONTROL_BASE 0x01e10000 | 42 | #define DAVINCI_ASYNC_EMIF_CONTROL_BASE 0x01e10000 |
42 | #define DAVINCI_ASYNC_EMIF_DATA_CE0_BASE 0x02000000 | 43 | #define DAVINCI_ASYNC_EMIF_DATA_CE0_BASE 0x02000000 |
@@ -188,7 +189,6 @@ static struct davinci_uart_config uart_config __initdata = { | |||
188 | 189 | ||
189 | static void __init dm355_evm_map_io(void) | 190 | static void __init dm355_evm_map_io(void) |
190 | { | 191 | { |
191 | davinci_map_common_io(); | ||
192 | dm355_init(); | 192 | dm355_init(); |
193 | } | 193 | } |
194 | 194 | ||
diff --git a/arch/arm/mach-davinci/board-dm355-leopard.c b/arch/arm/mach-davinci/board-dm355-leopard.c index d4562f5ff93b..28c9008df4f4 100644 --- a/arch/arm/mach-davinci/board-dm355-leopard.c +++ b/arch/arm/mach-davinci/board-dm355-leopard.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <mach/serial.h> | 36 | #include <mach/serial.h> |
37 | #include <mach/nand.h> | 37 | #include <mach/nand.h> |
38 | #include <mach/mmc.h> | 38 | #include <mach/mmc.h> |
39 | #include <mach/common.h> | ||
39 | 40 | ||
40 | #define DAVINCI_ASYNC_EMIF_CONTROL_BASE 0x01e10000 | 41 | #define DAVINCI_ASYNC_EMIF_CONTROL_BASE 0x01e10000 |
41 | #define DAVINCI_ASYNC_EMIF_DATA_CE0_BASE 0x02000000 | 42 | #define DAVINCI_ASYNC_EMIF_DATA_CE0_BASE 0x02000000 |
@@ -187,7 +188,6 @@ static struct davinci_uart_config uart_config __initdata = { | |||
187 | 188 | ||
188 | static void __init dm355_leopard_map_io(void) | 189 | static void __init dm355_leopard_map_io(void) |
189 | { | 190 | { |
190 | davinci_map_common_io(); | ||
191 | dm355_init(); | 191 | dm355_init(); |
192 | } | 192 | } |
193 | 193 | ||
diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c b/arch/arm/mach-davinci/board-dm644x-evm.c index 02e7cdaf8daa..cfe89c409735 100644 --- a/arch/arm/mach-davinci/board-dm644x-evm.c +++ b/arch/arm/mach-davinci/board-dm644x-evm.c | |||
@@ -45,6 +45,7 @@ | |||
45 | #include <mach/psc.h> | 45 | #include <mach/psc.h> |
46 | #include <mach/nand.h> | 46 | #include <mach/nand.h> |
47 | #include <mach/mmc.h> | 47 | #include <mach/mmc.h> |
48 | #include <mach/common.h> | ||
48 | 49 | ||
49 | #define DM644X_EVM_PHY_MASK (0x2) | 50 | #define DM644X_EVM_PHY_MASK (0x2) |
50 | #define DM644X_EVM_MDIO_FREQUENCY (2200000) /* PHY bus frequency */ | 51 | #define DM644X_EVM_MDIO_FREQUENCY (2200000) /* PHY bus frequency */ |
@@ -609,7 +610,6 @@ static struct davinci_uart_config uart_config __initdata = { | |||
609 | static void __init | 610 | static void __init |
610 | davinci_evm_map_io(void) | 611 | davinci_evm_map_io(void) |
611 | { | 612 | { |
612 | davinci_map_common_io(); | ||
613 | dm644x_init(); | 613 | dm644x_init(); |
614 | } | 614 | } |
615 | 615 | ||
diff --git a/arch/arm/mach-davinci/board-dm646x-evm.c b/arch/arm/mach-davinci/board-dm646x-evm.c index aedde3cdb82f..becae51d6dd1 100644 --- a/arch/arm/mach-davinci/board-dm646x-evm.c +++ b/arch/arm/mach-davinci/board-dm646x-evm.c | |||
@@ -47,6 +47,7 @@ | |||
47 | #include <mach/i2c.h> | 47 | #include <mach/i2c.h> |
48 | #include <mach/mmc.h> | 48 | #include <mach/mmc.h> |
49 | #include <mach/emac.h> | 49 | #include <mach/emac.h> |
50 | #include <mach/common.h> | ||
50 | 51 | ||
51 | #define DM646X_EVM_PHY_MASK (0x2) | 52 | #define DM646X_EVM_PHY_MASK (0x2) |
52 | #define DM646X_EVM_MDIO_FREQUENCY (2200000) /* PHY bus frequency */ | 53 | #define DM646X_EVM_MDIO_FREQUENCY (2200000) /* PHY bus frequency */ |
@@ -265,7 +266,6 @@ static void __init evm_init_i2c(void) | |||
265 | 266 | ||
266 | static void __init davinci_map_io(void) | 267 | static void __init davinci_map_io(void) |
267 | { | 268 | { |
268 | davinci_map_common_io(); | ||
269 | dm646x_init(); | 269 | dm646x_init(); |
270 | } | 270 | } |
271 | 271 | ||
diff --git a/arch/arm/mach-davinci/board-sffsdr.c b/arch/arm/mach-davinci/board-sffsdr.c index 913dad93540b..938b4467809e 100644 --- a/arch/arm/mach-davinci/board-sffsdr.c +++ b/arch/arm/mach-davinci/board-sffsdr.c | |||
@@ -53,6 +53,7 @@ | |||
53 | #include <mach/serial.h> | 53 | #include <mach/serial.h> |
54 | #include <mach/psc.h> | 54 | #include <mach/psc.h> |
55 | #include <mach/mux.h> | 55 | #include <mach/mux.h> |
56 | #include <mach/common.h> | ||
56 | 57 | ||
57 | #define SFFSDR_PHY_MASK (0x2) | 58 | #define SFFSDR_PHY_MASK (0x2) |
58 | #define SFFSDR_MDIO_FREQUENCY (2200000) /* PHY bus frequency */ | 59 | #define SFFSDR_MDIO_FREQUENCY (2200000) /* PHY bus frequency */ |
@@ -152,7 +153,6 @@ static struct davinci_uart_config uart_config __initdata = { | |||
152 | 153 | ||
153 | static void __init davinci_sffsdr_map_io(void) | 154 | static void __init davinci_sffsdr_map_io(void) |
154 | { | 155 | { |
155 | davinci_map_common_io(); | ||
156 | dm644x_init(); | 156 | dm644x_init(); |
157 | } | 157 | } |
158 | 158 | ||
diff --git a/arch/arm/mach-davinci/common.c b/arch/arm/mach-davinci/common.c new file mode 100644 index 000000000000..9a5486f5519c --- /dev/null +++ b/arch/arm/mach-davinci/common.c | |||
@@ -0,0 +1,55 @@ | |||
1 | /* | ||
2 | * Code commons to all DaVinci SoCs. | ||
3 | * | ||
4 | * Author: Mark A. Greer <mgreer@mvista.com> | ||
5 | * | ||
6 | * 2009 (c) MontaVista Software, Inc. This file is licensed under | ||
7 | * the terms of the GNU General Public License version 2. This program | ||
8 | * is licensed "as is" without any warranty of any kind, whether express | ||
9 | * or implied. | ||
10 | */ | ||
11 | #include <linux/module.h> | ||
12 | #include <linux/io.h> | ||
13 | |||
14 | #include <asm/tlb.h> | ||
15 | #include <asm/mach/map.h> | ||
16 | |||
17 | #include <mach/common.h> | ||
18 | |||
19 | struct davinci_soc_info davinci_soc_info; | ||
20 | EXPORT_SYMBOL(davinci_soc_info); | ||
21 | |||
22 | void __init davinci_common_init(struct davinci_soc_info *soc_info) | ||
23 | { | ||
24 | int ret; | ||
25 | |||
26 | if (!soc_info) { | ||
27 | ret = -EINVAL; | ||
28 | goto err; | ||
29 | } | ||
30 | |||
31 | memcpy(&davinci_soc_info, soc_info, sizeof(struct davinci_soc_info)); | ||
32 | |||
33 | if (davinci_soc_info.io_desc && (davinci_soc_info.io_desc_num > 0)) | ||
34 | iotable_init(davinci_soc_info.io_desc, | ||
35 | davinci_soc_info.io_desc_num); | ||
36 | |||
37 | /* | ||
38 | * Normally devicemaps_init() would flush caches and tlb after | ||
39 | * mdesc->map_io(), but we must also do it here because of the CPU | ||
40 | * revision check below. | ||
41 | */ | ||
42 | local_flush_tlb_all(); | ||
43 | flush_cache_all(); | ||
44 | |||
45 | /* | ||
46 | * We want to check CPU revision early for cpu_is_xxxx() macros. | ||
47 | * IO space mapping must be initialized before we can do that. | ||
48 | */ | ||
49 | davinci_check_revision(); | ||
50 | |||
51 | return; | ||
52 | |||
53 | err: | ||
54 | pr_err("davinci_common_init: SoC Initialization failed\n"); | ||
55 | } | ||
diff --git a/arch/arm/mach-davinci/dm355.c b/arch/arm/mach-davinci/dm355.c index c02115f1eb9b..6d1abfdcfb72 100644 --- a/arch/arm/mach-davinci/dm355.c +++ b/arch/arm/mach-davinci/dm355.c | |||
@@ -16,6 +16,8 @@ | |||
16 | 16 | ||
17 | #include <linux/spi/spi.h> | 17 | #include <linux/spi/spi.h> |
18 | 18 | ||
19 | #include <asm/mach/map.h> | ||
20 | |||
19 | #include <mach/dm355.h> | 21 | #include <mach/dm355.h> |
20 | #include <mach/clock.h> | 22 | #include <mach/clock.h> |
21 | #include <mach/cputype.h> | 23 | #include <mach/cputype.h> |
@@ -23,6 +25,7 @@ | |||
23 | #include <mach/psc.h> | 25 | #include <mach/psc.h> |
24 | #include <mach/mux.h> | 26 | #include <mach/mux.h> |
25 | #include <mach/irqs.h> | 27 | #include <mach/irqs.h> |
28 | #include <mach/common.h> | ||
26 | 29 | ||
27 | #include "clock.h" | 30 | #include "clock.h" |
28 | #include "mux.h" | 31 | #include "mux.h" |
@@ -522,8 +525,23 @@ static struct platform_device dm355_edma_device = { | |||
522 | 525 | ||
523 | /*----------------------------------------------------------------------*/ | 526 | /*----------------------------------------------------------------------*/ |
524 | 527 | ||
528 | static struct map_desc dm355_io_desc[] = { | ||
529 | { | ||
530 | .virtual = IO_VIRT, | ||
531 | .pfn = __phys_to_pfn(IO_PHYS), | ||
532 | .length = IO_SIZE, | ||
533 | .type = MT_DEVICE | ||
534 | }, | ||
535 | }; | ||
536 | |||
537 | static struct davinci_soc_info davinci_soc_info_dm355 = { | ||
538 | .io_desc = dm355_io_desc, | ||
539 | .io_desc_num = ARRAY_SIZE(dm355_io_desc), | ||
540 | }; | ||
541 | |||
525 | void __init dm355_init(void) | 542 | void __init dm355_init(void) |
526 | { | 543 | { |
544 | davinci_common_init(&davinci_soc_info_dm355); | ||
527 | davinci_clk_init(dm355_clks); | 545 | davinci_clk_init(dm355_clks); |
528 | davinci_mux_register(dm355_pins, ARRAY_SIZE(dm355_pins));; | 546 | davinci_mux_register(dm355_pins, ARRAY_SIZE(dm355_pins));; |
529 | } | 547 | } |
diff --git a/arch/arm/mach-davinci/dm644x.c b/arch/arm/mach-davinci/dm644x.c index 0419d571bdca..79f113698b0b 100644 --- a/arch/arm/mach-davinci/dm644x.c +++ b/arch/arm/mach-davinci/dm644x.c | |||
@@ -13,6 +13,8 @@ | |||
13 | #include <linux/clk.h> | 13 | #include <linux/clk.h> |
14 | #include <linux/platform_device.h> | 14 | #include <linux/platform_device.h> |
15 | 15 | ||
16 | #include <asm/mach/map.h> | ||
17 | |||
16 | #include <mach/dm644x.h> | 18 | #include <mach/dm644x.h> |
17 | #include <mach/clock.h> | 19 | #include <mach/clock.h> |
18 | #include <mach/cputype.h> | 20 | #include <mach/cputype.h> |
@@ -20,6 +22,7 @@ | |||
20 | #include <mach/irqs.h> | 22 | #include <mach/irqs.h> |
21 | #include <mach/psc.h> | 23 | #include <mach/psc.h> |
22 | #include <mach/mux.h> | 24 | #include <mach/mux.h> |
25 | #include <mach/common.h> | ||
23 | 26 | ||
24 | #include "clock.h" | 27 | #include "clock.h" |
25 | #include "mux.h" | 28 | #include "mux.h" |
@@ -463,8 +466,23 @@ void dm644x_init_emac(struct emac_platform_data *unused) {} | |||
463 | 466 | ||
464 | #endif | 467 | #endif |
465 | 468 | ||
469 | static struct map_desc dm644x_io_desc[] = { | ||
470 | { | ||
471 | .virtual = IO_VIRT, | ||
472 | .pfn = __phys_to_pfn(IO_PHYS), | ||
473 | .length = IO_SIZE, | ||
474 | .type = MT_DEVICE | ||
475 | }, | ||
476 | }; | ||
477 | |||
478 | static struct davinci_soc_info davinci_soc_info_dm644x = { | ||
479 | .io_desc = dm644x_io_desc, | ||
480 | .io_desc_num = ARRAY_SIZE(dm644x_io_desc), | ||
481 | }; | ||
482 | |||
466 | void __init dm644x_init(void) | 483 | void __init dm644x_init(void) |
467 | { | 484 | { |
485 | davinci_common_init(&davinci_soc_info_dm644x); | ||
468 | davinci_clk_init(dm644x_clks); | 486 | davinci_clk_init(dm644x_clks); |
469 | davinci_mux_register(dm644x_pins, ARRAY_SIZE(dm644x_pins)); | 487 | davinci_mux_register(dm644x_pins, ARRAY_SIZE(dm644x_pins)); |
470 | } | 488 | } |
diff --git a/arch/arm/mach-davinci/dm646x.c b/arch/arm/mach-davinci/dm646x.c index 975ed062ce24..8547ec02c9e1 100644 --- a/arch/arm/mach-davinci/dm646x.c +++ b/arch/arm/mach-davinci/dm646x.c | |||
@@ -13,6 +13,8 @@ | |||
13 | #include <linux/clk.h> | 13 | #include <linux/clk.h> |
14 | #include <linux/platform_device.h> | 14 | #include <linux/platform_device.h> |
15 | 15 | ||
16 | #include <asm/mach/map.h> | ||
17 | |||
16 | #include <mach/dm646x.h> | 18 | #include <mach/dm646x.h> |
17 | #include <mach/clock.h> | 19 | #include <mach/clock.h> |
18 | #include <mach/cputype.h> | 20 | #include <mach/cputype.h> |
@@ -20,6 +22,7 @@ | |||
20 | #include <mach/irqs.h> | 22 | #include <mach/irqs.h> |
21 | #include <mach/psc.h> | 23 | #include <mach/psc.h> |
22 | #include <mach/mux.h> | 24 | #include <mach/mux.h> |
25 | #include <mach/common.h> | ||
23 | 26 | ||
24 | #include "clock.h" | 27 | #include "clock.h" |
25 | #include "mux.h" | 28 | #include "mux.h" |
@@ -442,8 +445,23 @@ void dm646x_init_emac(struct emac_platform_data *unused) {} | |||
442 | 445 | ||
443 | #endif | 446 | #endif |
444 | 447 | ||
448 | static struct map_desc dm646x_io_desc[] = { | ||
449 | { | ||
450 | .virtual = IO_VIRT, | ||
451 | .pfn = __phys_to_pfn(IO_PHYS), | ||
452 | .length = IO_SIZE, | ||
453 | .type = MT_DEVICE | ||
454 | }, | ||
455 | }; | ||
456 | |||
457 | static struct davinci_soc_info davinci_soc_info_dm646x = { | ||
458 | .io_desc = dm646x_io_desc, | ||
459 | .io_desc_num = ARRAY_SIZE(dm646x_io_desc), | ||
460 | }; | ||
461 | |||
445 | void __init dm646x_init(void) | 462 | void __init dm646x_init(void) |
446 | { | 463 | { |
464 | davinci_common_init(&davinci_soc_info_dm646x); | ||
447 | davinci_clk_init(dm646x_clks); | 465 | davinci_clk_init(dm646x_clks); |
448 | davinci_mux_register(dm646x_pins, ARRAY_SIZE(dm646x_pins)); | 466 | davinci_mux_register(dm646x_pins, ARRAY_SIZE(dm646x_pins)); |
449 | } | 467 | } |
diff --git a/arch/arm/mach-davinci/include/mach/common.h b/arch/arm/mach-davinci/include/mach/common.h index 191770976250..770a1baa97dc 100644 --- a/arch/arm/mach-davinci/include/mach/common.h +++ b/arch/arm/mach-davinci/include/mach/common.h | |||
@@ -17,7 +17,6 @@ struct sys_timer; | |||
17 | extern struct sys_timer davinci_timer; | 17 | extern struct sys_timer davinci_timer; |
18 | 18 | ||
19 | extern void davinci_irq_init(void); | 19 | extern void davinci_irq_init(void); |
20 | extern void davinci_map_common_io(void); | ||
21 | 20 | ||
22 | /* parameters describe VBUS sourcing for host mode */ | 21 | /* parameters describe VBUS sourcing for host mode */ |
23 | extern void setup_usb(unsigned mA, unsigned potpgt_msec); | 22 | extern void setup_usb(unsigned mA, unsigned potpgt_msec); |
@@ -25,4 +24,15 @@ extern void setup_usb(unsigned mA, unsigned potpgt_msec); | |||
25 | /* parameters describe VBUS sourcing for host mode */ | 24 | /* parameters describe VBUS sourcing for host mode */ |
26 | extern void setup_usb(unsigned mA, unsigned potpgt_msec); | 25 | extern void setup_usb(unsigned mA, unsigned potpgt_msec); |
27 | 26 | ||
27 | /* SoC specific init support */ | ||
28 | struct davinci_soc_info { | ||
29 | struct map_desc *io_desc; | ||
30 | unsigned long io_desc_num; | ||
31 | }; | ||
32 | |||
33 | extern struct davinci_soc_info davinci_soc_info; | ||
34 | |||
35 | extern void davinci_common_init(struct davinci_soc_info *soc_info); | ||
36 | extern void davinci_check_revision(void); | ||
37 | |||
28 | #endif /* __ARCH_ARM_MACH_DAVINCI_COMMON_H */ | 38 | #endif /* __ARCH_ARM_MACH_DAVINCI_COMMON_H */ |
diff --git a/arch/arm/mach-davinci/include/mach/dm355.h b/arch/arm/mach-davinci/include/mach/dm355.h index f7100b658992..54903b72438e 100644 --- a/arch/arm/mach-davinci/include/mach/dm355.h +++ b/arch/arm/mach-davinci/include/mach/dm355.h | |||
@@ -13,10 +13,9 @@ | |||
13 | 13 | ||
14 | #include <mach/hardware.h> | 14 | #include <mach/hardware.h> |
15 | 15 | ||
16 | void __init dm355_init(void); | ||
17 | |||
18 | struct spi_board_info; | 16 | struct spi_board_info; |
19 | 17 | ||
18 | void __init dm355_init(void); | ||
20 | void dm355_init_spi0(unsigned chipselect_mask, | 19 | void dm355_init_spi0(unsigned chipselect_mask, |
21 | struct spi_board_info *info, unsigned len); | 20 | struct spi_board_info *info, unsigned len); |
22 | 21 | ||
diff --git a/arch/arm/mach-davinci/io.c b/arch/arm/mach-davinci/io.c index a548abb513e2..49912b48b1b0 100644 --- a/arch/arm/mach-davinci/io.c +++ b/arch/arm/mach-davinci/io.c | |||
@@ -9,47 +9,9 @@ | |||
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <linux/module.h> | 11 | #include <linux/module.h> |
12 | #include <linux/kernel.h> | ||
13 | #include <linux/init.h> | ||
14 | #include <linux/io.h> | 12 | #include <linux/io.h> |
15 | 13 | ||
16 | #include <asm/tlb.h> | 14 | #include <asm/tlb.h> |
17 | #include <asm/memory.h> | ||
18 | |||
19 | #include <asm/mach/map.h> | ||
20 | #include <mach/clock.h> | ||
21 | |||
22 | extern void davinci_check_revision(void); | ||
23 | |||
24 | /* | ||
25 | * The machine specific code may provide the extra mapping besides the | ||
26 | * default mapping provided here. | ||
27 | */ | ||
28 | static struct map_desc davinci_io_desc[] __initdata = { | ||
29 | { | ||
30 | .virtual = IO_VIRT, | ||
31 | .pfn = __phys_to_pfn(IO_PHYS), | ||
32 | .length = IO_SIZE, | ||
33 | .type = MT_DEVICE | ||
34 | }, | ||
35 | }; | ||
36 | |||
37 | void __init davinci_map_common_io(void) | ||
38 | { | ||
39 | iotable_init(davinci_io_desc, ARRAY_SIZE(davinci_io_desc)); | ||
40 | |||
41 | /* Normally devicemaps_init() would flush caches and tlb after | ||
42 | * mdesc->map_io(), but we must also do it here because of the CPU | ||
43 | * revision check below. | ||
44 | */ | ||
45 | local_flush_tlb_all(); | ||
46 | flush_cache_all(); | ||
47 | |||
48 | /* We want to check CPU revision early for cpu_is_xxxx() macros. | ||
49 | * IO space mapping must be initialized before we can do that. | ||
50 | */ | ||
51 | davinci_check_revision(); | ||
52 | } | ||
53 | 15 | ||
54 | #define BETWEEN(p, st, sz) ((p) >= (st) && (p) < ((st) + (sz))) | 16 | #define BETWEEN(p, st, sz) ((p) >= (st) && (p) < ((st) + (sz))) |
55 | #define XLATE(p, pst, vst) ((void __iomem *)((p) - (pst) + (vst))) | 17 | #define XLATE(p, pst, vst) ((void __iomem *)((p) - (pst) + (vst))) |