added 2.6.29.6 aldebaran kernel
[nao-ulib.git] / kernel / 2.6.29.6-aldebaran-rt / arch / powerpc / platforms / 8xx / mgsuvd.c
blobca3cb071772cc609b5495b2cab1b0981e30695da
1 /*
3 * Platform setup for the Keymile mgsuvd board
5 * Heiko Schocher <hs@denx.de>
7 * Copyright 2008 DENX Software Engineering GmbH
9 * This file is licensed under the terms of the GNU General Public License
10 * version 2. This program is licensed "as is" without any warranty of any
11 * kind, whether express or implied.
14 #include <linux/ioport.h>
15 #include <linux/of_platform.h>
17 #include <asm/io.h>
18 #include <asm/machdep.h>
19 #include <asm/processor.h>
20 #include <asm/cpm1.h>
21 #include <asm/prom.h>
22 #include <asm/fs_pd.h>
24 #include "mpc8xx.h"
26 struct cpm_pin {
27 int port, pin, flags;
30 static __initdata struct cpm_pin mgsuvd_pins[] = {
31 /* SMC1 */
32 {CPM_PORTB, 24, CPM_PIN_INPUT}, /* RX */
33 {CPM_PORTB, 25, CPM_PIN_INPUT | CPM_PIN_SECONDARY}, /* TX */
35 /* SCC3 */
36 {CPM_PORTA, 10, CPM_PIN_INPUT},
37 {CPM_PORTA, 11, CPM_PIN_INPUT},
38 {CPM_PORTA, 3, CPM_PIN_INPUT},
39 {CPM_PORTA, 2, CPM_PIN_INPUT},
40 {CPM_PORTC, 13, CPM_PIN_INPUT},
43 static void __init init_ioports(void)
45 int i;
47 for (i = 0; i < ARRAY_SIZE(mgsuvd_pins); i++) {
48 struct cpm_pin *pin = &mgsuvd_pins[i];
49 cpm1_set_pin(pin->port, pin->pin, pin->flags);
52 setbits16(&mpc8xx_immr->im_ioport.iop_pcso, 0x300);
53 cpm1_clk_setup(CPM_CLK_SCC3, CPM_CLK5, CPM_CLK_RX);
54 cpm1_clk_setup(CPM_CLK_SCC3, CPM_CLK6, CPM_CLK_TX);
55 cpm1_clk_setup(CPM_CLK_SMC1, CPM_BRG1, CPM_CLK_RTX);
58 static void __init mgsuvd_setup_arch(void)
60 cpm_reset();
61 init_ioports();
64 static __initdata struct of_device_id of_bus_ids[] = {
65 { .compatible = "simple-bus" },
66 {},
69 static int __init declare_of_platform_devices(void)
71 of_platform_bus_probe(NULL, of_bus_ids, NULL);
72 return 0;
74 machine_device_initcall(mgsuvd, declare_of_platform_devices);
76 static int __init mgsuvd_probe(void)
78 unsigned long root = of_get_flat_dt_root();
79 return of_flat_dt_is_compatible(root, "keymile,mgsuvd");
82 define_machine(mgsuvd) {
83 .name = "MGSUVD",
84 .probe = mgsuvd_probe,
85 .setup_arch = mgsuvd_setup_arch,
86 .init_IRQ = mpc8xx_pics_init,
87 .get_irq = mpc8xx_get_irq,
88 .restart = mpc8xx_restart,
89 .calibrate_decr = mpc8xx_calibrate_decr,
90 .set_rtc_time = mpc8xx_set_rtc_time,
91 .get_rtc_time = mpc8xx_get_rtc_time,