aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/52xx/lite5200.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/platforms/52xx/lite5200.c')
-rw-r--r--arch/powerpc/platforms/52xx/lite5200.c160
1 files changed, 160 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/52xx/lite5200.c b/arch/powerpc/platforms/52xx/lite5200.c
new file mode 100644
index 000000000000..eaff71e74fb0
--- /dev/null
+++ b/arch/powerpc/platforms/52xx/lite5200.c
@@ -0,0 +1,160 @@
1/*
2 * Freescale Lite5200 board support
3 *
4 * Written by: Grant Likely <grant.likely@secretlab.ca>
5 *
6 * Copyright (C) Secret Lab Technologies Ltd. 2006. All rights reserved.
7 * Copyright (C) Freescale Semicondutor, Inc. 2006. All rights reserved.
8 *
9 * Description:
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.
14 */
15
16#undef DEBUG
17
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>
31
32#include <asm/system.h>
33#include <asm/atomic.h>
34#include <asm/time.h>
35#include <asm/io.h>
36#include <asm/machdep.h>
37#include <asm/ipic.h>
38#include <asm/bootinfo.h>
39#include <asm/irq.h>
40#include <asm/prom.h>
41#include <asm/udbg.h>
42#include <sysdev/fsl_soc.h>
43#include <asm/of_platform.h>
44
45#include <asm/mpc52xx.h>
46
47/* ************************************************************************
48 *
49 * Setup the architecture
50 *
51 */
52
53static void __init
54lite52xx_setup_cpu(void)
55{
56 struct mpc52xx_gpio __iomem *gpio;
57 u32 port_config;
58
59 /* Map zones */
60 gpio = mpc52xx_find_and_map("mpc52xx-gpio");
61 if (!gpio) {
62 printk(KERN_ERR __FILE__ ": "
63 "Error while mapping GPIO register for port config. "
64 "Expect some abnormal behavior\n");
65 goto error;
66 }
67
68 /* Set port config */
69 port_config = in_be32(&gpio->port_config);
70
71 port_config &= ~0x00800000; /* 48Mhz internal, pin is GPIO */
72
73 port_config &= ~0x00007000; /* USB port : Differential mode */
74 port_config |= 0x00001000; /* USB 1 only */
75
76 port_config &= ~0x03000000; /* ATA CS is on csb_4/5 */
77 port_config |= 0x01000000;
78
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);
82
83 /* Unmap zone */
84error:
85 iounmap(gpio);
86}
87
88static void __init lite52xx_setup_arch(void)
89{
90 struct device_node *np;
91
92 if (ppc_md.progress)
93 ppc_md.progress("lite52xx_setup_arch()", 0);
94
95 np = of_find_node_by_type(NULL, "cpu");
96 if (np) {
97 unsigned int *fp =
98 (int *)get_property(np, "clock-frequency", NULL);
99 if (fp != 0)
100 loops_per_jiffy = *fp / HZ;
101 else
102 loops_per_jiffy = 50000000 / HZ;
103 of_node_put(np);
104 }
105
106 /* CPU & Port mux setup */
107 mpc52xx_setup_cpu(); /* Generic */
108 lite52xx_setup_cpu(); /* Platorm specific */
109
110#ifdef CONFIG_BLK_DEV_INITRD
111 if (initrd_start)
112 ROOT_DEV = Root_RAM0;
113 else
114#endif
115#ifdef CONFIG_ROOT_NFS
116 ROOT_DEV = Root_NFS;
117#else
118 ROOT_DEV = Root_HDA1;
119#endif
120
121}
122
123void lite52xx_show_cpuinfo(struct seq_file *m)
124{
125 struct device_node* np = of_find_all_nodes(NULL);
126 const char *model = NULL;
127
128 if (np)
129 model = get_property(np, "model", NULL);
130
131 seq_printf(m, "vendor\t\t: Freescale Semiconductor\n");
132 seq_printf(m, "machine\t\t: %s\n", model ? model : "unknown");
133
134 of_node_put(np);
135}
136
137/*
138 * Called very early, MMU is off, device-tree isn't unflattened
139 */
140static int __init lite52xx_probe(void)
141{
142 unsigned long node = of_get_flat_dt_root();
143 const char *model = of_get_flat_dt_prop(node, "model", NULL);
144
145 if (!of_flat_dt_is_compatible(node, "lite52xx"))
146 return 0;
147 pr_debug("%s board w/ mpc52xx found\n", model ? model : "unknown");
148
149 return 1;
150}
151
152define_machine(lite52xx) {
153 .name = "lite52xx",
154 .probe = lite52xx_probe,
155 .setup_arch = lite52xx_setup_arch,
156 .init_IRQ = mpc52xx_init_irq,
157 .get_irq = mpc52xx_get_irq,
158 .show_cpuinfo = lite52xx_show_cpuinfo,
159 .calibrate_decr = generic_calibrate_decr,
160};