2 * Freescale Lite5200 board support
4 * Written by: Grant Likely <grant.likely@secretlab.ca>
6 * Copyright (C) Secret Lab Technologies Ltd. 2006. All rights reserved.
7 * Copyright (C) Freescale Semicondutor, Inc. 2006. All rights reserved.
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.
18 #include <linux/stddef.h>
19 #include <linux/kernel.h>
20 #include <linux/init.h>
21 #include <linux/errno.h>
22 #include <linux/reboot.h>
23 #include <linux/pci.h>
24 #include <linux/kdev_t.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>
32 #include <asm/system.h>
33 #include <asm/atomic.h>
36 #include <asm/machdep.h>
38 #include <asm/bootinfo.h>
42 #include <sysdev/fsl_soc.h>
43 #include <asm/of_platform.h>
45 #include <asm/mpc52xx.h>
47 /* ************************************************************************
49 * Setup the architecture
54 lite5200_setup_cpu(void)
56 struct mpc52xx_gpio __iomem *gpio;
60 gpio = mpc52xx_find_and_map("mpc5200-gpio");
62 printk(KERN_ERR __FILE__ ": "
63 "Error while mapping GPIO register for port config. "
64 "Expect some abnormal behavior\n");
69 port_config = in_be32(&gpio->port_config);
71 port_config &= ~0x00800000; /* 48Mhz internal, pin is GPIO */
73 port_config &= ~0x00007000; /* USB port : Differential mode */
74 port_config |= 0x00001000; /* USB 1 only */
76 port_config &= ~0x03000000; /* ATA CS is on csb_4/5 */
77 port_config |= 0x01000000;
79 pr_debug("port_config: old:%x new:%x\n",
80 in_be32(&gpio->port_config), port_config);
81 out_be32(&gpio->port_config, port_config);
90 static void lite5200_suspend_prepare(void __iomem *mbar)
92 u8 pin = 1; /* GPIO_WKUP_1 (GPIO_PSC2_4) */
93 u8 level = 0; /* wakeup on low level */
94 mpc52xx_set_wakeup_gpio(pin, level);
98 * this needs to be called before of-ohci suspend code
100 descr_a = in_be32(mbar + 0x1048);
101 out_be32(mbar + 0x1048, (descr_a & ~0x200) | 0x100);
104 static void lite5200_resume_finish(void __iomem *mbar)
106 out_be32(mbar + 0x1048, descr_a);
110 static void __init lite5200_setup_arch(void)
112 struct device_node *np;
115 ppc_md.progress("lite5200_setup_arch()", 0);
117 np = of_find_node_by_type(NULL, "cpu");
119 const unsigned int *fp =
120 of_get_property(np, "clock-frequency", NULL);
122 loops_per_jiffy = *fp / HZ;
124 loops_per_jiffy = 50000000 / HZ;
128 /* CPU & Port mux setup */
129 mpc52xx_setup_cpu(); /* Generic */
130 lite5200_setup_cpu(); /* Platorm specific */
133 mpc52xx_suspend.board_suspend_prepare = lite5200_suspend_prepare;
134 mpc52xx_suspend.board_resume_finish = lite5200_resume_finish;
139 np = of_find_node_by_type(NULL, "pci");
141 mpc52xx_add_bridge(np);
146 #ifdef CONFIG_BLK_DEV_INITRD
148 ROOT_DEV = Root_RAM0;
151 #ifdef CONFIG_ROOT_NFS
154 ROOT_DEV = Root_HDA1;
159 static void lite5200_show_cpuinfo(struct seq_file *m)
161 struct device_node* np = of_find_all_nodes(NULL);
162 const char *model = NULL;
165 model = of_get_property(np, "model", NULL);
167 seq_printf(m, "vendor\t\t: Freescale Semiconductor\n");
168 seq_printf(m, "machine\t\t: %s\n", model ? model : "unknown");
174 * Called very early, MMU is off, device-tree isn't unflattened
176 static int __init lite5200_probe(void)
178 unsigned long node = of_get_flat_dt_root();
179 const char *model = of_get_flat_dt_prop(node, "model", NULL);
181 if (!of_flat_dt_is_compatible(node, "fsl,lite5200") &&
182 !of_flat_dt_is_compatible(node, "fsl,lite5200b"))
184 pr_debug("%s board found\n", model ? model : "unknown");
189 define_machine(lite5200) {
191 .probe = lite5200_probe,
192 .setup_arch = lite5200_setup_arch,
193 .init = mpc52xx_declare_of_platform_devices,
194 .init_IRQ = mpc52xx_init_irq,
195 .get_irq = mpc52xx_get_irq,
196 .show_cpuinfo = lite5200_show_cpuinfo,
197 .calibrate_decr = generic_calibrate_decr,