2 * Copyright (C) Freescale Semicondutor, Inc. 2006. All rights reserved.
5 * MPC832xE MDS board specific routines.
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
13 #include <linux/stddef.h>
14 #include <linux/kernel.h>
15 #include <linux/init.h>
16 #include <linux/errno.h>
17 #include <linux/reboot.h>
18 #include <linux/pci.h>
19 #include <linux/kdev_t.h>
20 #include <linux/major.h>
21 #include <linux/console.h>
22 #include <linux/delay.h>
23 #include <linux/seq_file.h>
24 #include <linux/root_dev.h>
25 #include <linux/initrd.h>
27 #include <asm/system.h>
28 #include <asm/atomic.h>
31 #include <asm/machdep.h>
33 #include <asm/bootinfo.h>
37 #include <sysdev/fsl_soc.h>
39 #include <asm/qe_ic.h>
42 #include "mpc832x_mds.h"
46 #define DBG(fmt...) udbg_printf(fmt)
52 unsigned long isa_io_base = 0;
53 unsigned long isa_mem_base = 0;
56 static u8 *bcsr_regs = NULL;
63 /* ************************************************************************
65 * Setup the architecture
68 static void __init mpc832x_sys_setup_arch(void)
70 struct device_node *np;
73 ppc_md.progress("mpc832x_sys_setup_arch()", 0);
75 np = of_find_node_by_type(NULL, "cpu");
78 (int *)get_property(np, "clock-frequency", NULL);
80 loops_per_jiffy = *fp / HZ;
82 loops_per_jiffy = 50000000 / HZ;
87 np = of_find_node_by_name(NULL, "bcsr");
91 of_address_to_resource(np, 0, &res);
92 bcsr_regs = ioremap(res.start, res.end - res.start +1);
97 for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
100 ppc_md.pci_swizzle = common_swizzle;
101 ppc_md.pci_exclude_device = mpc83xx_exclude_device;
104 #ifdef CONFIG_QUICC_ENGINE
107 if ((np = of_find_node_by_name(np, "par_io")) != NULL) {
111 for (np = NULL; (np = of_find_node_by_name(np, "ucc")) != NULL;)
112 par_io_of_config(np);
115 if ((np = of_find_compatible_node(NULL, "network", "ucc_geth"))
117 /* Reset the Ethernet PHY */
118 bcsr_regs[9] &= ~0x20;
120 bcsr_regs[9] |= 0x20;
125 #endif /* CONFIG_QUICC_ENGINE */
127 #ifdef CONFIG_BLK_DEV_INITRD
129 ROOT_DEV = Root_RAM0;
132 #ifdef CONFIG_ROOT_NFS
135 ROOT_DEV = Root_HDA1;
139 void __init mpc832x_sys_init_IRQ(void)
142 struct device_node *np;
144 np = of_find_node_by_type(NULL, "ipic");
150 /* Initialize the default interrupt mapping priorities,
151 * in case the boot rom changed something on us.
153 ipic_set_default_priority();
156 #ifdef CONFIG_QUICC_ENGINE
157 np = of_find_node_by_type(NULL, "qeic");
163 #endif /* CONFIG_QUICC_ENGINE */
166 #if defined(CONFIG_I2C_MPC) && defined(CONFIG_SENSORS_DS1374)
167 extern ulong ds1374_get_rtc_time(void);
168 extern int ds1374_set_rtc_time(ulong);
170 static int __init mpc832x_rtc_hookup(void)
174 ppc_md.get_rtc_time = ds1374_get_rtc_time;
175 ppc_md.set_rtc_time = ds1374_set_rtc_time;
178 tv.tv_sec = (ppc_md.get_rtc_time) ();
179 do_settimeofday(&tv);
184 late_initcall(mpc832x_rtc_hookup);
188 * Called very early, MMU is off, device-tree isn't unflattened
190 static int __init mpc832x_sys_probe(void)
192 char *model = of_get_flat_dt_prop(of_get_flat_dt_root(),
197 if (strcmp(model, "MPC8323EMDS"))
200 DBG("%s found\n", model);
205 define_machine(mpc832x_mds) {
206 .name = "MPC832x MDS",
207 .probe = mpc832x_sys_probe,
208 .setup_arch = mpc832x_sys_setup_arch,
209 .init_IRQ = mpc832x_sys_init_IRQ,
210 .get_irq = ipic_get_irq,
211 .restart = mpc83xx_restart,
212 .time_init = mpc83xx_time_init,
213 .calibrate_decr = generic_calibrate_decr,
214 .progress = udbg_progress,