2 * Keymile mgcoge support
3 * Copyright 2008 DENX Software Engineering GmbH
4 * Author: Heiko Schocher <hs@denx.de>
7 * Copyright 2007 Freescale Semiconductor, Inc.
8 * Author: Scott Wood <scottwood@freescale.com>
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.
16 #include <linux/init.h>
17 #include <linux/interrupt.h>
18 #include <linux/fsl_devices.h>
19 #include <linux/of_platform.h>
24 #include <asm/machdep.h>
26 #include <asm/mpc8260.h>
29 #include <sysdev/fsl_soc.h>
30 #include <sysdev/cpm2_pic.h>
34 static void __init mgcoge_pic_init(void)
36 struct device_node *np = of_find_compatible_node(NULL, NULL, "fsl,pq2-pic");
38 printk(KERN_ERR "PIC init: can not find cpm-pic node\n");
50 static __initdata struct cpm_pin mgcoge_pins[] = {
53 {1, 8, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
54 {1, 9, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
57 {3, 25, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
58 {3, 24, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
59 {3, 9, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
60 {3, 8, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
61 {4, 22, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
62 {4, 21, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
65 static void __init init_ioports(void)
69 for (i = 0; i < ARRAY_SIZE(mgcoge_pins); i++) {
70 const struct cpm_pin *pin = &mgcoge_pins[i];
71 cpm2_set_pin(pin->port - 1, pin->pin, pin->flags);
74 cpm2_smc_clk_setup(CPM_CLK_SMC2, CPM_BRG8);
75 cpm2_clk_setup(CPM_CLK_SCC4, CPM_CLK7, CPM_CLK_RX);
76 cpm2_clk_setup(CPM_CLK_SCC4, CPM_CLK8, CPM_CLK_TX);
79 static void __init mgcoge_setup_arch(void)
82 ppc_md.progress("mgcoge_setup_arch()", 0);
86 /* When this is set, snooping CPM DMA from RAM causes
87 * machine checks. See erratum SIU18.
89 clrbits32(&cpm2_immr->im_siu_conf.siu_82xx.sc_bcr, MPC82XX_BCR_PLDP);
94 ppc_md.progress("mgcoge_setup_arch(), finish", 0);
97 static __initdata struct of_device_id of_bus_ids[] = {
98 { .compatible = "simple-bus", },
102 static int __init declare_of_platform_devices(void)
104 of_platform_bus_probe(NULL, of_bus_ids, NULL);
108 machine_device_initcall(mgcoge, declare_of_platform_devices);
111 * Called very early, device-tree isn't unflattened
113 static int __init mgcoge_probe(void)
115 unsigned long root = of_get_flat_dt_root();
116 return of_flat_dt_is_compatible(root, "keymile,mgcoge");
119 define_machine(mgcoge)
121 .name = "Keymile MGCOGE",
122 .probe = mgcoge_probe,
123 .setup_arch = mgcoge_setup_arch,
124 .init_IRQ = mgcoge_pic_init,
125 .get_irq = cpm2_get_irq,
126 .calibrate_decr = generic_calibrate_decr,
127 .restart = pq2_restart,
128 .progress = udbg_progress,