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/of_device.h>
28 #include <asm/of_platform.h>
29 #include <asm/system.h>
30 #include <asm/atomic.h>
33 #include <asm/machdep.h>
35 #include <asm/bootinfo.h>
39 #include <sysdev/fsl_soc.h>
41 #include <asm/qe_ic.h>
44 #include "mpc832x_mds.h"
48 #define DBG(fmt...) udbg_printf(fmt)
54 unsigned long isa_io_base = 0;
55 unsigned long isa_mem_base = 0;
58 static u8 *bcsr_regs = NULL;
65 /* ************************************************************************
67 * Setup the architecture
70 static void __init mpc832x_sys_setup_arch(void)
72 struct device_node *np;
75 ppc_md.progress("mpc832x_sys_setup_arch()", 0);
77 np = of_find_node_by_type(NULL, "cpu");
80 (int *)get_property(np, "clock-frequency", NULL);
82 loops_per_jiffy = *fp / HZ;
84 loops_per_jiffy = 50000000 / HZ;
89 np = of_find_node_by_name(NULL, "bcsr");
93 of_address_to_resource(np, 0, &res);
94 bcsr_regs = ioremap(res.start, res.end - res.start +1);
99 for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
101 ppc_md.pci_exclude_device = mpc83xx_exclude_device;
104 #ifdef CONFIG_QUICC_ENGINE
107 if ((np = of_find_node_by_name(NULL, "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 static int __init mpc832x_declare_of_platform_devices(void)
141 struct device_node *np;
143 for (np = NULL; (np = of_find_compatible_node(np, "network",
144 "ucc_geth")) != NULL;) {
146 char bus_id[BUS_ID_SIZE];
148 ucc_num = *((uint *) get_property(np, "device-id", NULL)) - 1;
149 snprintf(bus_id, BUS_ID_SIZE, "ucc_geth.%u", ucc_num);
150 of_platform_device_create(np, bus_id, NULL);
155 device_initcall(mpc832x_declare_of_platform_devices);
157 static void __init mpc832x_sys_init_IRQ(void)
160 struct device_node *np;
162 np = of_find_node_by_type(NULL, "ipic");
168 /* Initialize the default interrupt mapping priorities,
169 * in case the boot rom changed something on us.
171 ipic_set_default_priority();
174 #ifdef CONFIG_QUICC_ENGINE
175 np = of_find_node_by_type(NULL, "qeic");
181 #endif /* CONFIG_QUICC_ENGINE */
184 #if defined(CONFIG_I2C_MPC) && defined(CONFIG_SENSORS_DS1374)
185 extern ulong ds1374_get_rtc_time(void);
186 extern int ds1374_set_rtc_time(ulong);
188 static int __init mpc832x_rtc_hookup(void)
192 ppc_md.get_rtc_time = ds1374_get_rtc_time;
193 ppc_md.set_rtc_time = ds1374_set_rtc_time;
196 tv.tv_sec = (ppc_md.get_rtc_time) ();
197 do_settimeofday(&tv);
202 late_initcall(mpc832x_rtc_hookup);
206 * Called very early, MMU is off, device-tree isn't unflattened
208 static int __init mpc832x_sys_probe(void)
210 char *model = of_get_flat_dt_prop(of_get_flat_dt_root(),
215 if (strcmp(model, "MPC8323EMDS"))
218 DBG("%s found\n", model);
223 define_machine(mpc832x_mds) {
224 .name = "MPC832x MDS",
225 .probe = mpc832x_sys_probe,
226 .setup_arch = mpc832x_sys_setup_arch,
227 .init_IRQ = mpc832x_sys_init_IRQ,
228 .get_irq = ipic_get_irq,
229 .restart = mpc83xx_restart,
230 .time_init = mpc83xx_time_init,
231 .calibrate_decr = generic_calibrate_decr,
232 .progress = udbg_progress,