wl1251: use wiphy_dev instead of wl->spi->dev
[linux/fpc-iii.git] / arch / powerpc / platforms / 82xx / mgcoge.c
blobc2af169c1d1dd743a385d9dbc9823b41b517a7ce
1 /*
2 * Keymile mgcoge support
3 * Copyright 2008 DENX Software Engineering GmbH
4 * Author: Heiko Schocher <hs@denx.de>
6 * based on code from:
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>
21 #include <asm/io.h>
22 #include <asm/cpm2.h>
23 #include <asm/udbg.h>
24 #include <asm/machdep.h>
25 #include <asm/time.h>
26 #include <asm/mpc8260.h>
27 #include <asm/prom.h>
29 #include <sysdev/fsl_soc.h>
30 #include <sysdev/cpm2_pic.h>
32 #include "pq2.h"
34 static void __init mgcoge_pic_init(void)
36 struct device_node *np = of_find_compatible_node(NULL, NULL, "fsl,pq2-pic");
37 if (!np) {
38 printk(KERN_ERR "PIC init: can not find cpm-pic node\n");
39 return;
42 cpm2_pic_init(np);
43 of_node_put(np);
46 struct cpm_pin {
47 int port, pin, flags;
50 static __initdata struct cpm_pin mgcoge_pins[] = {
52 /* SMC2 */
53 {1, 8, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
54 {1, 9, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
56 /* SCC4 */
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)
67 int i;
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)
81 if (ppc_md.progress)
82 ppc_md.progress("mgcoge_setup_arch()", 0);
84 cpm2_reset();
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);
91 init_ioports();
93 if (ppc_md.progress)
94 ppc_md.progress("mgcoge_setup_arch(), finish", 0);
97 static __initdata struct of_device_id of_bus_ids[] = {
98 { .compatible = "simple-bus", },
99 {},
102 static int __init declare_of_platform_devices(void)
104 of_platform_bus_probe(NULL, of_bus_ids, NULL);
106 return 0;
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,