aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2007-10-11 18:40:13 -0400
committerPaul Mackerras <paulus@samba.org>2007-10-11 18:40:13 -0400
commit895532a166010d8d8b4d58d63d21012eced22492 (patch)
tree708097789ac9cb2670407b12ee37b8653385b5e6 /arch
parentad656887e22390c64276e0a0057541aec701422c (diff)
parente1eea9fa00da50ed3dfb64ce669e9ae0b70c0629 (diff)
Merge branch 'for-2.6.24' of git://git.secretlab.ca/git/linux-2.6-mpc52xx into for-2.6.24
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/platforms/52xx/efika.c19
-rw-r--r--arch/powerpc/platforms/52xx/lite5200.c95
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_common.c38
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_pic.c11
4 files changed, 65 insertions, 98 deletions
diff --git a/arch/powerpc/platforms/52xx/efika.c b/arch/powerpc/platforms/52xx/efika.c
index 0b1e60a010ba..a0da70c8b502 100644
--- a/arch/powerpc/platforms/52xx/efika.c
+++ b/arch/powerpc/platforms/52xx/efika.c
@@ -9,33 +9,16 @@
9 * kind, whether express or implied. 9 * kind, whether express or implied.
10 */ 10 */
11 11
12#include <linux/errno.h>
13#include <linux/kernel.h>
14#include <linux/slab.h>
15#include <linux/reboot.h>
16#include <linux/init.h> 12#include <linux/init.h>
17#include <linux/utsrelease.h> 13#include <linux/utsrelease.h>
18#include <linux/seq_file.h>
19#include <linux/string.h>
20#include <linux/root_dev.h>
21#include <linux/initrd.h>
22#include <linux/timer.h>
23#include <linux/pci.h> 14#include <linux/pci.h>
24 15#include <linux/of.h>
25#include <asm/io.h>
26#include <asm/irq.h>
27#include <asm/sections.h>
28#include <asm/pci-bridge.h>
29#include <asm/pgtable.h>
30#include <asm/prom.h> 16#include <asm/prom.h>
31#include <asm/time.h> 17#include <asm/time.h>
32#include <asm/machdep.h> 18#include <asm/machdep.h>
33#include <asm/rtas.h> 19#include <asm/rtas.h>
34#include <asm/of_device.h>
35#include <asm/of_platform.h>
36#include <asm/mpc52xx.h> 20#include <asm/mpc52xx.h>
37 21
38
39#define EFIKA_PLATFORM_NAME "Efika" 22#define EFIKA_PLATFORM_NAME "Efika"
40 23
41 24
diff --git a/arch/powerpc/platforms/52xx/lite5200.c b/arch/powerpc/platforms/52xx/lite5200.c
index e11d27f9c4f0..0caa3d955c3b 100644
--- a/arch/powerpc/platforms/52xx/lite5200.c
+++ b/arch/powerpc/platforms/52xx/lite5200.c
@@ -15,32 +15,13 @@
15 15
16#undef DEBUG 16#undef DEBUG
17 17
18#include <linux/stddef.h>
19#include <linux/kernel.h>
20#include <linux/init.h> 18#include <linux/init.h>
21#include <linux/errno.h>
22#include <linux/reboot.h>
23#include <linux/pci.h> 19#include <linux/pci.h>
24#include <linux/kdev_t.h> 20#include <linux/of.h>
25#include <linux/major.h>
26#include <linux/console.h>
27#include <linux/delay.h>
28#include <linux/seq_file.h>
29#include <linux/root_dev.h>
30#include <linux/initrd.h>
31
32#include <asm/system.h>
33#include <asm/atomic.h>
34#include <asm/time.h> 21#include <asm/time.h>
35#include <asm/io.h> 22#include <asm/io.h>
36#include <asm/machdep.h> 23#include <asm/machdep.h>
37#include <asm/ipic.h>
38#include <asm/irq.h>
39#include <asm/prom.h> 24#include <asm/prom.h>
40#include <asm/udbg.h>
41#include <sysdev/fsl_soc.h>
42#include <asm/of_platform.h>
43
44#include <asm/mpc52xx.h> 25#include <asm/mpc52xx.h>
45 26
46/* ************************************************************************ 27/* ************************************************************************
@@ -49,19 +30,56 @@
49 * 30 *
50 */ 31 */
51 32
33/*
34 * Fix clock configuration.
35 *
36 * Firmware is supposed to be responsible for this. If you are creating a
37 * new board port, do *NOT* duplicate this code. Fix your boot firmware
38 * to set it correctly in the first place
39 */
52static void __init 40static void __init
53lite5200_setup_cpu(void) 41lite5200_fix_clock_config(void)
42{
43 struct mpc52xx_cdm __iomem *cdm;
44
45 /* Map zones */
46 cdm = mpc52xx_find_and_map("mpc5200-cdm");
47 if (!cdm) {
48 printk(KERN_ERR "%s() failed; expect abnormal behaviour\n",
49 __FUNCTION__);
50 return;
51 }
52
53 /* Use internal 48 Mhz */
54 out_8(&cdm->ext_48mhz_en, 0x00);
55 out_8(&cdm->fd_enable, 0x01);
56 if (in_be32(&cdm->rstcfg) & 0x40) /* Assumes 33Mhz clock */
57 out_be16(&cdm->fd_counters, 0x0001);
58 else
59 out_be16(&cdm->fd_counters, 0x5555);
60
61 /* Unmap the regs */
62 iounmap(cdm);
63}
64
65/*
66 * Fix setting of port_config register.
67 *
68 * Firmware is supposed to be responsible for this. If you are creating a
69 * new board port, do *NOT* duplicate this code. Fix your boot firmware
70 * to set it correctly in the first place
71 */
72static void __init
73lite5200_fix_port_config(void)
54{ 74{
55 struct mpc52xx_gpio __iomem *gpio; 75 struct mpc52xx_gpio __iomem *gpio;
56 u32 port_config; 76 u32 port_config;
57 77
58 /* Map zones */
59 gpio = mpc52xx_find_and_map("mpc5200-gpio"); 78 gpio = mpc52xx_find_and_map("mpc5200-gpio");
60 if (!gpio) { 79 if (!gpio) {
61 printk(KERN_ERR __FILE__ ": " 80 printk(KERN_ERR "%s() failed. expect abnormal behavior\n",
62 "Error while mapping GPIO register for port config. " 81 __FUNCTION__);
63 "Expect some abnormal behavior\n"); 82 return;
64 goto error;
65 } 83 }
66 84
67 /* Set port config */ 85 /* Set port config */
@@ -80,7 +98,6 @@ lite5200_setup_cpu(void)
80 out_be32(&gpio->port_config, port_config); 98 out_be32(&gpio->port_config, port_config);
81 99
82 /* Unmap zone */ 100 /* Unmap zone */
83error:
84 iounmap(gpio); 101 iounmap(gpio);
85} 102}
86 103
@@ -119,9 +136,12 @@ static void __init lite5200_setup_arch(void)
119 if (ppc_md.progress) 136 if (ppc_md.progress)
120 ppc_md.progress("lite5200_setup_arch()", 0); 137 ppc_md.progress("lite5200_setup_arch()", 0);
121 138
122 /* CPU & Port mux setup */ 139 /* Fix things that firmware should have done. */
123 mpc52xx_setup_cpu(); /* Generic */ 140 lite5200_fix_clock_config();
124 lite5200_setup_cpu(); /* Platorm specific */ 141 lite5200_fix_port_config();
142
143 /* Some mpc5200 & mpc5200b related configuration */
144 mpc5200_setup_xlb_arbiter();
125 145
126#ifdef CONFIG_PM 146#ifdef CONFIG_PM
127 mpc52xx_suspend.board_suspend_prepare = lite5200_suspend_prepare; 147 mpc52xx_suspend.board_suspend_prepare = lite5200_suspend_prepare;
@@ -150,20 +170,6 @@ static void __init lite5200_setup_arch(void)
150 170
151} 171}
152 172
153static void lite5200_show_cpuinfo(struct seq_file *m)
154{
155 struct device_node* np = of_find_all_nodes(NULL);
156 const char *model = NULL;
157
158 if (np)
159 model = of_get_property(np, "model", NULL);
160
161 seq_printf(m, "vendor\t\t: Freescale Semiconductor\n");
162 seq_printf(m, "machine\t\t: %s\n", model ? model : "unknown");
163
164 of_node_put(np);
165}
166
167/* 173/*
168 * Called very early, MMU is off, device-tree isn't unflattened 174 * Called very early, MMU is off, device-tree isn't unflattened
169 */ 175 */
@@ -187,6 +193,5 @@ define_machine(lite5200) {
187 .init = mpc52xx_declare_of_platform_devices, 193 .init = mpc52xx_declare_of_platform_devices,
188 .init_IRQ = mpc52xx_init_irq, 194 .init_IRQ = mpc52xx_init_irq,
189 .get_irq = mpc52xx_get_irq, 195 .get_irq = mpc52xx_get_irq,
190 .show_cpuinfo = lite5200_show_cpuinfo,
191 .calibrate_decr = generic_calibrate_decr, 196 .calibrate_decr = generic_calibrate_decr,
192}; 197};
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_common.c b/arch/powerpc/platforms/52xx/mpc52xx_common.c
index 2dd415ff55a9..3bc201e07e6b 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_common.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_common.c
@@ -13,10 +13,9 @@
13#undef DEBUG 13#undef DEBUG
14 14
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16 16#include <linux/of_platform.h>
17#include <asm/io.h> 17#include <asm/io.h>
18#include <asm/prom.h> 18#include <asm/prom.h>
19#include <asm/of_platform.h>
20#include <asm/mpc52xx.h> 19#include <asm/mpc52xx.h>
21 20
22 21
@@ -76,44 +75,33 @@ mpc52xx_find_ipb_freq(struct device_node *node)
76EXPORT_SYMBOL(mpc52xx_find_ipb_freq); 75EXPORT_SYMBOL(mpc52xx_find_ipb_freq);
77 76
78 77
78/*
79 * Configure the XLB arbiter settings to match what Linux expects.
80 */
79void __init 81void __init
80mpc52xx_setup_cpu(void) 82mpc5200_setup_xlb_arbiter(void)
81{ 83{
82 struct mpc52xx_cdm __iomem *cdm;
83 struct mpc52xx_xlb __iomem *xlb; 84 struct mpc52xx_xlb __iomem *xlb;
84 85
85 /* Map zones */
86 cdm = mpc52xx_find_and_map("mpc5200-cdm");
87 xlb = mpc52xx_find_and_map("mpc5200-xlb"); 86 xlb = mpc52xx_find_and_map("mpc5200-xlb");
88 87 if (!xlb) {
89 if (!cdm || !xlb) {
90 printk(KERN_ERR __FILE__ ": " 88 printk(KERN_ERR __FILE__ ": "
91 "Error while mapping CDM/XLB during mpc52xx_setup_cpu. " 89 "Error mapping XLB in mpc52xx_setup_cpu(). "
92 "Expect some abnormal behavior\n"); 90 "Expect some abnormal behavior\n");
93 goto unmap_regs; 91 return;
94 } 92 }
95 93
96 /* Use internal 48 Mhz */
97 out_8(&cdm->ext_48mhz_en, 0x00);
98 out_8(&cdm->fd_enable, 0x01);
99 if (in_be32(&cdm->rstcfg) & 0x40) /* Assumes 33Mhz clock */
100 out_be16(&cdm->fd_counters, 0x0001);
101 else
102 out_be16(&cdm->fd_counters, 0x5555);
103
104 /* Configure the XLB Arbiter priorities */ 94 /* Configure the XLB Arbiter priorities */
105 out_be32(&xlb->master_pri_enable, 0xff); 95 out_be32(&xlb->master_pri_enable, 0xff);
106 out_be32(&xlb->master_priority, 0x11111111); 96 out_be32(&xlb->master_priority, 0x11111111);
107 97
108 /* Disable XLB pipelining */ 98 /* Disable XLB pipelining
109 /* (cfr errate 292. We could do this only just before ATA PIO 99 * (cfr errate 292. We could do this only just before ATA PIO
110 transaction and re-enable it afterwards ...) */ 100 * transaction and re-enable it afterwards ...)
101 */
111 out_be32(&xlb->config, in_be32(&xlb->config) | MPC52xx_XLB_CFG_PLDIS); 102 out_be32(&xlb->config, in_be32(&xlb->config) | MPC52xx_XLB_CFG_PLDIS);
112 103
113 /* Unmap zones */ 104 iounmap(xlb);
114unmap_regs:
115 if (cdm) iounmap(cdm);
116 if (xlb) iounmap(xlb);
117} 105}
118 106
119void __init 107void __init
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_pic.c b/arch/powerpc/platforms/52xx/mpc52xx_pic.c
index 0f4ca8a2b777..61100f270c68 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_pic.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_pic.c
@@ -18,18 +18,9 @@
18 18
19#undef DEBUG 19#undef DEBUG
20 20
21#include <linux/stddef.h>
22#include <linux/init.h>
23#include <linux/sched.h>
24#include <linux/signal.h>
25#include <linux/delay.h>
26#include <linux/irq.h> 21#include <linux/irq.h>
27#include <linux/hardirq.h> 22#include <linux/of.h>
28
29#include <asm/io.h> 23#include <asm/io.h>
30#include <asm/processor.h>
31#include <asm/system.h>
32#include <asm/irq.h>
33#include <asm/prom.h> 24#include <asm/prom.h>
34#include <asm/mpc52xx.h> 25#include <asm/mpc52xx.h>
35#include "mpc52xx_pic.h" 26#include "mpc52xx_pic.h"