diff options
-rw-r--r-- | arch/powerpc/platforms/512x/Kconfig | 15 | ||||
-rw-r--r-- | arch/powerpc/platforms/512x/Makefile | 3 | ||||
-rw-r--r-- | arch/powerpc/platforms/512x/mpc5121_ads.c | 64 | ||||
-rw-r--r-- | arch/powerpc/platforms/512x/mpc5121_generic.c | 58 | ||||
-rw-r--r-- | arch/powerpc/platforms/512x/mpc512x.h | 17 | ||||
-rw-r--r-- | arch/powerpc/platforms/512x/mpc512x_shared.c | 83 |
6 files changed, 177 insertions, 63 deletions
diff --git a/arch/powerpc/platforms/512x/Kconfig b/arch/powerpc/platforms/512x/Kconfig index 162af067d128..5d72dc3435af 100644 --- a/arch/powerpc/platforms/512x/Kconfig +++ b/arch/powerpc/platforms/512x/Kconfig | |||
@@ -3,12 +3,10 @@ config PPC_MPC512x | |||
3 | select FSL_SOC | 3 | select FSL_SOC |
4 | select IPIC | 4 | select IPIC |
5 | select PPC_CLOCK | 5 | select PPC_CLOCK |
6 | default n | ||
7 | 6 | ||
8 | config PPC_MPC5121 | 7 | config PPC_MPC5121 |
9 | bool | 8 | bool |
10 | select PPC_MPC512x | 9 | select PPC_MPC512x |
11 | default n | ||
12 | 10 | ||
13 | config MPC5121_ADS | 11 | config MPC5121_ADS |
14 | bool "Freescale MPC5121E ADS" | 12 | bool "Freescale MPC5121E ADS" |
@@ -17,4 +15,15 @@ config MPC5121_ADS | |||
17 | select PPC_MPC5121 | 15 | select PPC_MPC5121 |
18 | help | 16 | help |
19 | This option enables support for the MPC5121E ADS board. | 17 | This option enables support for the MPC5121E ADS board. |
20 | default n | 18 | |
19 | config MPC5121_GENERIC | ||
20 | bool "Generic support for simple MPC5121 based boards" | ||
21 | depends on PPC_MULTIPLATFORM && PPC32 | ||
22 | select DEFAULT_UIMAGE | ||
23 | select PPC_MPC5121 | ||
24 | help | ||
25 | This option enables support for simple MPC5121 based boards | ||
26 | which do not need custom platform specific setup. | ||
27 | |||
28 | Compatible boards include: Protonic LVT base boards (ZANMCU | ||
29 | and VICVT2). | ||
diff --git a/arch/powerpc/platforms/512x/Makefile b/arch/powerpc/platforms/512x/Makefile index 90910c1f725b..8090e222a2dd 100644 --- a/arch/powerpc/platforms/512x/Makefile +++ b/arch/powerpc/platforms/512x/Makefile | |||
@@ -1,5 +1,6 @@ | |||
1 | # | 1 | # |
2 | # Makefile for the Freescale PowerPC 512x linux kernel. | 2 | # Makefile for the Freescale PowerPC 512x linux kernel. |
3 | # | 3 | # |
4 | obj-y += clock.o | 4 | obj-y += clock.o mpc512x_shared.o |
5 | obj-$(CONFIG_MPC5121_ADS) += mpc5121_ads.o | 5 | obj-$(CONFIG_MPC5121_ADS) += mpc5121_ads.o |
6 | obj-$(CONFIG_MPC5121_GENERIC) += mpc5121_generic.o | ||
diff --git a/arch/powerpc/platforms/512x/mpc5121_ads.c b/arch/powerpc/platforms/512x/mpc5121_ads.c index 50bd3a319022..3ec9ca34d8e8 100644 --- a/arch/powerpc/platforms/512x/mpc5121_ads.c +++ b/arch/powerpc/platforms/512x/mpc5121_ads.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2007 Freescale Semiconductor, Inc. All rights reserved. | 2 | * Copyright (C) 2007, 2008 Freescale Semiconductor, Inc. All rights reserved. |
3 | * | 3 | * |
4 | * Author: John Rigby, <jrigby@freescale.com>, Thur Mar 29 2007 | 4 | * Author: John Rigby, <jrigby@freescale.com>, Thur Mar 29 2007 |
5 | * | 5 | * |
@@ -15,7 +15,6 @@ | |||
15 | 15 | ||
16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
17 | #include <linux/io.h> | 17 | #include <linux/io.h> |
18 | #include <linux/irq.h> | ||
19 | #include <linux/of_platform.h> | 18 | #include <linux/of_platform.h> |
20 | 19 | ||
21 | #include <asm/machdep.h> | 20 | #include <asm/machdep.h> |
@@ -23,65 +22,11 @@ | |||
23 | #include <asm/prom.h> | 22 | #include <asm/prom.h> |
24 | #include <asm/time.h> | 23 | #include <asm/time.h> |
25 | 24 | ||
26 | /** | 25 | #include "mpc512x.h" |
27 | * mpc512x_find_ips_freq - Find the IPS bus frequency for a device | ||
28 | * @node: device node | ||
29 | * | ||
30 | * Returns IPS bus frequency, or 0 if the bus frequency cannot be found. | ||
31 | */ | ||
32 | unsigned long | ||
33 | mpc512x_find_ips_freq(struct device_node *node) | ||
34 | { | ||
35 | struct device_node *np; | ||
36 | const unsigned int *p_ips_freq = NULL; | ||
37 | |||
38 | of_node_get(node); | ||
39 | while (node) { | ||
40 | p_ips_freq = of_get_property(node, "bus-frequency", NULL); | ||
41 | if (p_ips_freq) | ||
42 | break; | ||
43 | |||
44 | np = of_get_parent(node); | ||
45 | of_node_put(node); | ||
46 | node = np; | ||
47 | } | ||
48 | if (node) | ||
49 | of_node_put(node); | ||
50 | |||
51 | return p_ips_freq ? *p_ips_freq : 0; | ||
52 | } | ||
53 | EXPORT_SYMBOL(mpc512x_find_ips_freq); | ||
54 | |||
55 | static struct of_device_id __initdata of_bus_ids[] = { | ||
56 | { .name = "soc", }, | ||
57 | { .name = "localbus", }, | ||
58 | {}, | ||
59 | }; | ||
60 | |||
61 | static void __init mpc5121_ads_declare_of_platform_devices(void) | ||
62 | { | ||
63 | /* Find every child of the SOC node and add it to of_platform */ | ||
64 | if (of_platform_bus_probe(NULL, of_bus_ids, NULL)) | ||
65 | printk(KERN_ERR __FILE__ ": " | ||
66 | "Error while probing of_platform bus\n"); | ||
67 | } | ||
68 | 26 | ||
69 | static void __init mpc5121_ads_init_IRQ(void) | 27 | static void __init mpc5121_ads_init_IRQ(void) |
70 | { | 28 | { |
71 | struct device_node *np; | 29 | mpc512x_init_IRQ(); |
72 | |||
73 | np = of_find_compatible_node(NULL, NULL, "fsl,ipic"); | ||
74 | if (!np) | ||
75 | return; | ||
76 | |||
77 | ipic_init(np, 0); | ||
78 | of_node_put(np); | ||
79 | |||
80 | /* | ||
81 | * Initialize the default interrupt mapping priorities, | ||
82 | * in case the boot rom changed something on us. | ||
83 | */ | ||
84 | ipic_set_default_priority(); | ||
85 | } | 30 | } |
86 | 31 | ||
87 | /* | 32 | /* |
@@ -97,7 +42,8 @@ static int __init mpc5121_ads_probe(void) | |||
97 | define_machine(mpc5121_ads) { | 42 | define_machine(mpc5121_ads) { |
98 | .name = "MPC5121 ADS", | 43 | .name = "MPC5121 ADS", |
99 | .probe = mpc5121_ads_probe, | 44 | .probe = mpc5121_ads_probe, |
100 | .init = mpc5121_ads_declare_of_platform_devices, | 45 | .setup_arch = mpc5121_ads_setup_arch, |
46 | .init = mpc512x_declare_of_platform_devices, | ||
101 | .init_IRQ = mpc5121_ads_init_IRQ, | 47 | .init_IRQ = mpc5121_ads_init_IRQ, |
102 | .get_irq = ipic_get_irq, | 48 | .get_irq = ipic_get_irq, |
103 | .calibrate_decr = generic_calibrate_decr, | 49 | .calibrate_decr = generic_calibrate_decr, |
diff --git a/arch/powerpc/platforms/512x/mpc5121_generic.c b/arch/powerpc/platforms/512x/mpc5121_generic.c new file mode 100644 index 000000000000..2479de9e2d12 --- /dev/null +++ b/arch/powerpc/platforms/512x/mpc5121_generic.c | |||
@@ -0,0 +1,58 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2007,2008 Freescale Semiconductor, Inc. All rights reserved. | ||
3 | * | ||
4 | * Author: John Rigby, <jrigby@freescale.com> | ||
5 | * | ||
6 | * Description: | ||
7 | * MPC5121 SoC setup | ||
8 | * | ||
9 | * This is free software; you can redistribute it and/or modify it | ||
10 | * under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | */ | ||
15 | |||
16 | #include <linux/kernel.h> | ||
17 | #include <linux/of_platform.h> | ||
18 | |||
19 | #include <asm/machdep.h> | ||
20 | #include <asm/ipic.h> | ||
21 | #include <asm/prom.h> | ||
22 | #include <asm/time.h> | ||
23 | |||
24 | #include "mpc512x.h" | ||
25 | |||
26 | /* | ||
27 | * list of supported boards | ||
28 | */ | ||
29 | static char *board[] __initdata = { | ||
30 | "prt,prtlvt", | ||
31 | NULL | ||
32 | }; | ||
33 | |||
34 | /* | ||
35 | * Called very early, MMU is off, device-tree isn't unflattened | ||
36 | */ | ||
37 | static int __init mpc5121_generic_probe(void) | ||
38 | { | ||
39 | unsigned long node = of_get_flat_dt_root(); | ||
40 | int i = 0; | ||
41 | |||
42 | while (board[i]) { | ||
43 | if (of_flat_dt_is_compatible(node, board[i])) | ||
44 | break; | ||
45 | i++; | ||
46 | } | ||
47 | |||
48 | return board[i] != NULL; | ||
49 | } | ||
50 | |||
51 | define_machine(mpc5121_generic) { | ||
52 | .name = "MPC5121 generic", | ||
53 | .probe = mpc5121_generic_probe, | ||
54 | .init = mpc512x_declare_of_platform_devices, | ||
55 | .init_IRQ = mpc512x_init_IRQ, | ||
56 | .get_irq = ipic_get_irq, | ||
57 | .calibrate_decr = generic_calibrate_decr, | ||
58 | }; | ||
diff --git a/arch/powerpc/platforms/512x/mpc512x.h b/arch/powerpc/platforms/512x/mpc512x.h new file mode 100644 index 000000000000..9c03693cb009 --- /dev/null +++ b/arch/powerpc/platforms/512x/mpc512x.h | |||
@@ -0,0 +1,17 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2007 Freescale Semiconductor, Inc. All rights reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms of the GNU General Public License as published by the | ||
6 | * Free Software Foundation; either version 2 of the License, or (at your | ||
7 | * option) any later version. | ||
8 | * | ||
9 | * Prototypes for MPC512x shared code | ||
10 | */ | ||
11 | |||
12 | #ifndef __MPC512X_H__ | ||
13 | #define __MPC512X_H__ | ||
14 | extern unsigned long mpc512x_find_ips_freq(struct device_node *node); | ||
15 | extern void __init mpc512x_init_IRQ(void); | ||
16 | void __init mpc512x_declare_of_platform_devices(void); | ||
17 | #endif /* __MPC512X_H__ */ | ||
diff --git a/arch/powerpc/platforms/512x/mpc512x_shared.c b/arch/powerpc/platforms/512x/mpc512x_shared.c new file mode 100644 index 000000000000..d8cd579f3191 --- /dev/null +++ b/arch/powerpc/platforms/512x/mpc512x_shared.c | |||
@@ -0,0 +1,83 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2007,2008 Freescale Semiconductor, Inc. All rights reserved. | ||
3 | * | ||
4 | * Author: John Rigby <jrigby@freescale.com> | ||
5 | * | ||
6 | * Description: | ||
7 | * MPC512x Shared code | ||
8 | * | ||
9 | * This is free software; you can redistribute it and/or modify it | ||
10 | * under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | */ | ||
14 | |||
15 | #include <linux/kernel.h> | ||
16 | #include <linux/io.h> | ||
17 | #include <linux/irq.h> | ||
18 | #include <linux/of_platform.h> | ||
19 | |||
20 | #include <asm/machdep.h> | ||
21 | #include <asm/ipic.h> | ||
22 | #include <asm/prom.h> | ||
23 | #include <asm/time.h> | ||
24 | |||
25 | #include "mpc512x.h" | ||
26 | |||
27 | unsigned long | ||
28 | mpc512x_find_ips_freq(struct device_node *node) | ||
29 | { | ||
30 | struct device_node *np; | ||
31 | const unsigned int *p_ips_freq = NULL; | ||
32 | |||
33 | of_node_get(node); | ||
34 | while (node) { | ||
35 | p_ips_freq = of_get_property(node, "bus-frequency", NULL); | ||
36 | if (p_ips_freq) | ||
37 | break; | ||
38 | |||
39 | np = of_get_parent(node); | ||
40 | of_node_put(node); | ||
41 | node = np; | ||
42 | } | ||
43 | if (node) | ||
44 | of_node_put(node); | ||
45 | |||
46 | return p_ips_freq ? *p_ips_freq : 0; | ||
47 | } | ||
48 | EXPORT_SYMBOL(mpc512x_find_ips_freq); | ||
49 | |||
50 | void __init mpc512x_init_IRQ(void) | ||
51 | { | ||
52 | struct device_node *np; | ||
53 | |||
54 | np = of_find_compatible_node(NULL, NULL, "fsl,mpc5121-ipic"); | ||
55 | if (!np) | ||
56 | return; | ||
57 | |||
58 | ipic_init(np, 0); | ||
59 | of_node_put(np); | ||
60 | |||
61 | /* | ||
62 | * Initialize the default interrupt mapping priorities, | ||
63 | * in case the boot rom changed something on us. | ||
64 | */ | ||
65 | ipic_set_default_priority(); | ||
66 | } | ||
67 | |||
68 | /* | ||
69 | * Nodes to do bus probe on, soc and localbus | ||
70 | */ | ||
71 | static struct of_device_id __initdata of_bus_ids[] = { | ||
72 | { .compatible = "fsl,mpc5121-immr", }, | ||
73 | { .compatible = "fsl,mpc5121-localbus", }, | ||
74 | {}, | ||
75 | }; | ||
76 | |||
77 | void __init mpc512x_declare_of_platform_devices(void) | ||
78 | { | ||
79 | if (of_platform_bus_probe(NULL, of_bus_ids, NULL)) | ||
80 | printk(KERN_ERR __FILE__ ": " | ||
81 | "Error while probing of_platform bus\n"); | ||
82 | } | ||
83 | |||