diff options
Diffstat (limited to 'arch/powerpc/platforms/82xx/mgcoge.c')
-rw-r--r-- | arch/powerpc/platforms/82xx/mgcoge.c | 129 |
1 files changed, 129 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/82xx/mgcoge.c b/arch/powerpc/platforms/82xx/mgcoge.c new file mode 100644 index 000000000000..c2af169c1d1d --- /dev/null +++ b/arch/powerpc/platforms/82xx/mgcoge.c | |||
@@ -0,0 +1,129 @@ | |||
1 | /* | ||
2 | * Keymile mgcoge support | ||
3 | * Copyright 2008 DENX Software Engineering GmbH | ||
4 | * Author: Heiko Schocher <hs@denx.de> | ||
5 | * | ||
6 | * based on code from: | ||
7 | * Copyright 2007 Freescale Semiconductor, Inc. | ||
8 | * Author: Scott Wood <scottwood@freescale.com> | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify it | ||
11 | * under the terms of the GNU General Public License as published by the | ||
12 | * Free Software Foundation; either version 2 of the License, or (at your | ||
13 | * option) any later version. | ||
14 | */ | ||
15 | |||
16 | #include <linux/init.h> | ||
17 | #include <linux/interrupt.h> | ||
18 | #include <linux/fsl_devices.h> | ||
19 | #include <linux/of_platform.h> | ||
20 | |||
21 | #include <asm/io.h> | ||
22 | #include <asm/cpm2.h> | ||
23 | #include <asm/udbg.h> | ||
24 | #include <asm/machdep.h> | ||
25 | #include <asm/time.h> | ||
26 | #include <asm/mpc8260.h> | ||
27 | #include <asm/prom.h> | ||
28 | |||
29 | #include <sysdev/fsl_soc.h> | ||
30 | #include <sysdev/cpm2_pic.h> | ||
31 | |||
32 | #include "pq2.h" | ||
33 | |||
34 | static void __init mgcoge_pic_init(void) | ||
35 | { | ||
36 | struct device_node *np = of_find_compatible_node(NULL, NULL, "fsl,pq2-pic"); | ||
37 | if (!np) { | ||
38 | printk(KERN_ERR "PIC init: can not find cpm-pic node\n"); | ||
39 | return; | ||
40 | } | ||
41 | |||
42 | cpm2_pic_init(np); | ||
43 | of_node_put(np); | ||
44 | } | ||
45 | |||
46 | struct cpm_pin { | ||
47 | int port, pin, flags; | ||
48 | }; | ||
49 | |||
50 | static __initdata struct cpm_pin mgcoge_pins[] = { | ||
51 | |||
52 | /* SMC2 */ | ||
53 | {1, 8, CPM_PIN_INPUT | CPM_PIN_PRIMARY}, | ||
54 | {1, 9, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY}, | ||
55 | |||
56 | /* SCC4 */ | ||
57 | {3, 25, CPM_PIN_INPUT | CPM_PIN_PRIMARY}, | ||
58 | {3, 24, CPM_PIN_INPUT | CPM_PIN_PRIMARY}, | ||
59 | {3, 9, CPM_PIN_INPUT | CPM_PIN_PRIMARY}, | ||
60 | {3, 8, CPM_PIN_INPUT | CPM_PIN_PRIMARY}, | ||
61 | {4, 22, CPM_PIN_INPUT | CPM_PIN_PRIMARY}, | ||
62 | {4, 21, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY}, | ||
63 | }; | ||
64 | |||
65 | static void __init init_ioports(void) | ||
66 | { | ||
67 | int i; | ||
68 | |||
69 | for (i = 0; i < ARRAY_SIZE(mgcoge_pins); i++) { | ||
70 | const struct cpm_pin *pin = &mgcoge_pins[i]; | ||
71 | cpm2_set_pin(pin->port - 1, pin->pin, pin->flags); | ||
72 | } | ||
73 | |||
74 | cpm2_smc_clk_setup(CPM_CLK_SMC2, CPM_BRG8); | ||
75 | cpm2_clk_setup(CPM_CLK_SCC4, CPM_CLK7, CPM_CLK_RX); | ||
76 | cpm2_clk_setup(CPM_CLK_SCC4, CPM_CLK8, CPM_CLK_TX); | ||
77 | } | ||
78 | |||
79 | static void __init mgcoge_setup_arch(void) | ||
80 | { | ||
81 | if (ppc_md.progress) | ||
82 | ppc_md.progress("mgcoge_setup_arch()", 0); | ||
83 | |||
84 | cpm2_reset(); | ||
85 | |||
86 | /* When this is set, snooping CPM DMA from RAM causes | ||
87 | * machine checks. See erratum SIU18. | ||
88 | */ | ||
89 | clrbits32(&cpm2_immr->im_siu_conf.siu_82xx.sc_bcr, MPC82XX_BCR_PLDP); | ||
90 | |||
91 | init_ioports(); | ||
92 | |||
93 | if (ppc_md.progress) | ||
94 | ppc_md.progress("mgcoge_setup_arch(), finish", 0); | ||
95 | } | ||
96 | |||
97 | static __initdata struct of_device_id of_bus_ids[] = { | ||
98 | { .compatible = "simple-bus", }, | ||
99 | {}, | ||
100 | }; | ||
101 | |||
102 | static int __init declare_of_platform_devices(void) | ||
103 | { | ||
104 | of_platform_bus_probe(NULL, of_bus_ids, NULL); | ||
105 | |||
106 | return 0; | ||
107 | } | ||
108 | machine_device_initcall(mgcoge, declare_of_platform_devices); | ||
109 | |||
110 | /* | ||
111 | * Called very early, device-tree isn't unflattened | ||
112 | */ | ||
113 | static int __init mgcoge_probe(void) | ||
114 | { | ||
115 | unsigned long root = of_get_flat_dt_root(); | ||
116 | return of_flat_dt_is_compatible(root, "keymile,mgcoge"); | ||
117 | } | ||
118 | |||
119 | define_machine(mgcoge) | ||
120 | { | ||
121 | .name = "Keymile MGCOGE", | ||
122 | .probe = mgcoge_probe, | ||
123 | .setup_arch = mgcoge_setup_arch, | ||
124 | .init_IRQ = mgcoge_pic_init, | ||
125 | .get_irq = cpm2_get_irq, | ||
126 | .calibrate_decr = generic_calibrate_decr, | ||
127 | .restart = pq2_restart, | ||
128 | .progress = udbg_progress, | ||
129 | }; | ||