2 * misc setup functions for MPC83xx
4 * Maintainer: Kumar Gala <galak@kernel.crashing.org>
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
12 #include <linux/stddef.h>
13 #include <linux/kernel.h>
14 #include <linux/of_platform.h>
15 #include <linux/pci.h>
18 #include <asm/hw_irq.h>
20 #include <asm/qe_ic.h>
21 #include <sysdev/fsl_soc.h>
22 #include <sysdev/fsl_pci.h>
26 static __be32 __iomem
*restart_reg_base
;
28 static int __init
mpc83xx_restart_init(void)
30 /* map reset restart_reg_baseister space */
31 restart_reg_base
= ioremap(get_immrbase() + 0x900, 0xff);
36 arch_initcall(mpc83xx_restart_init
);
38 void mpc83xx_restart(char *cmd
)
40 #define RST_OFFSET 0x00000900
41 #define RST_PROT_REG 0x00000018
42 #define RST_CTRL_REG 0x0000001c
46 if (restart_reg_base
) {
47 /* enable software reset "RSTE" */
48 out_be32(restart_reg_base
+ (RST_PROT_REG
>> 2), 0x52535445);
50 /* set software hard reset */
51 out_be32(restart_reg_base
+ (RST_CTRL_REG
>> 2), 0x2);
53 printk (KERN_EMERG
"Error: Restart registers not mapped, spinning!\n");
59 long __init
mpc83xx_time_init(void)
61 #define SPCR_OFFSET 0x00000110
62 #define SPCR_TBEN 0x00400000
63 __be32 __iomem
*spcr
= ioremap(get_immrbase() + SPCR_OFFSET
, 4);
67 out_be32(spcr
, tmp
| SPCR_TBEN
);
74 void __init
mpc83xx_ipic_init_IRQ(void)
76 struct device_node
*np
;
78 /* looking for fsl,pq2pro-pic which is asl compatible with fsl,ipic */
79 np
= of_find_compatible_node(NULL
, NULL
, "fsl,ipic");
81 np
= of_find_node_by_type(NULL
, "ipic");
89 /* Initialize the default interrupt mapping priorities,
90 * in case the boot rom changed something on us.
92 ipic_set_default_priority();
95 #ifdef CONFIG_QUICC_ENGINE
96 void __init
mpc83xx_qe_init_IRQ(void)
98 struct device_node
*np
;
100 np
= of_find_compatible_node(NULL
, NULL
, "fsl,qe-ic");
102 np
= of_find_node_by_type(NULL
, "qeic");
106 qe_ic_init(np
, 0, qe_ic_cascade_low_ipic
, qe_ic_cascade_high_ipic
);
110 void __init
mpc83xx_ipic_and_qe_init_IRQ(void)
112 mpc83xx_ipic_init_IRQ();
113 mpc83xx_qe_init_IRQ();
115 #endif /* CONFIG_QUICC_ENGINE */
117 static struct of_device_id __initdata of_bus_ids
[] = {
119 { .compatible
= "soc", },
120 { .compatible
= "simple-bus" },
121 { .compatible
= "gianfar" },
122 { .compatible
= "gpio-leds", },
124 { .compatible
= "fsl,qe", },
128 int __init
mpc83xx_declare_of_platform_devices(void)
130 of_platform_bus_probe(NULL
, of_bus_ids
, NULL
);
135 void __init
mpc83xx_setup_pci(void)
137 struct device_node
*np
;
139 for_each_compatible_node(np
, "pci", "fsl,mpc8349-pci")
140 mpc83xx_add_bridge(np
);
141 for_each_compatible_node(np
, "pci", "fsl,mpc8314-pcie")
142 mpc83xx_add_bridge(np
);