Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
mpc86xads_setup.c
Go to the documentation of this file.
1 /*arch/powerpc/platforms/8xx/mpc86xads_setup.c
2  *
3  * Platform setup for the Freescale mpc86xads board
4  *
5  * Vitaly Bordug <[email protected]>
6  *
7  * Copyright 2005 MontaVista Software Inc.
8  *
9  * Heavily modified by Scott Wood <[email protected]>
10  * Copyright 2007 Freescale Semiconductor, Inc.
11  *
12  * This file is licensed under the terms of the GNU General Public License
13  * version 2. This program is licensed "as is" without any warranty of any
14  * kind, whether express or implied.
15  */
16 
17 #include <linux/init.h>
18 #include <linux/of_platform.h>
19 
20 #include <asm/io.h>
21 #include <asm/machdep.h>
22 #include <asm/time.h>
23 #include <asm/8xx_immap.h>
24 #include <asm/cpm1.h>
25 #include <asm/fs_pd.h>
26 #include <asm/udbg.h>
27 
28 #include "mpc86xads.h"
29 #include "mpc8xx.h"
30 
31 struct cpm_pin {
32  int port, pin, flags;
33 };
34 
35 static struct cpm_pin mpc866ads_pins[] = {
36  /* SMC1 */
37  {CPM_PORTB, 24, CPM_PIN_INPUT}, /* RX */
38  {CPM_PORTB, 25, CPM_PIN_INPUT | CPM_PIN_SECONDARY}, /* TX */
39 
40  /* SMC2 */
41  {CPM_PORTB, 21, CPM_PIN_INPUT}, /* RX */
42  {CPM_PORTB, 20, CPM_PIN_INPUT | CPM_PIN_SECONDARY}, /* TX */
43 
44  /* SCC1 */
45  {CPM_PORTA, 6, CPM_PIN_INPUT}, /* CLK1 */
46  {CPM_PORTA, 7, CPM_PIN_INPUT}, /* CLK2 */
47  {CPM_PORTA, 14, CPM_PIN_INPUT}, /* TX */
48  {CPM_PORTA, 15, CPM_PIN_INPUT}, /* RX */
49  {CPM_PORTB, 19, CPM_PIN_INPUT | CPM_PIN_SECONDARY}, /* TENA */
52 
53  /* MII */
67 
68  /* I2C */
71 };
72 
73 static void __init init_ioports(void)
74 {
75  int i;
76 
77  for (i = 0; i < ARRAY_SIZE(mpc866ads_pins); i++) {
78  struct cpm_pin *pin = &mpc866ads_pins[i];
79  cpm1_set_pin(pin->port, pin->pin, pin->flags);
80  }
81 
86 
87  /* Set FEC1 and FEC2 to MII mode */
88  clrbits32(&mpc8xx_immr->im_cpm.cp_cptr, 0x00000180);
89 }
90 
91 static void __init mpc86xads_setup_arch(void)
92 {
93  struct device_node *np;
94  u32 __iomem *bcsr_io;
95 
96  cpm_reset();
97  init_ioports();
98 
99  np = of_find_compatible_node(NULL, NULL, "fsl,mpc866ads-bcsr");
100  if (!np) {
101  printk(KERN_CRIT "Could not find fsl,mpc866ads-bcsr node\n");
102  return;
103  }
104 
105  bcsr_io = of_iomap(np, 0);
106  of_node_put(np);
107 
108  if (bcsr_io == NULL) {
109  printk(KERN_CRIT "Could not remap BCSR\n");
110  return;
111  }
112 
113  clrbits32(bcsr_io, BCSR1_RS232EN_1 | BCSR1_RS232EN_2 | BCSR1_ETHEN);
114  iounmap(bcsr_io);
115 }
116 
117 static int __init mpc86xads_probe(void)
118 {
119  unsigned long root = of_get_flat_dt_root();
120  return of_flat_dt_is_compatible(root, "fsl,mpc866ads");
121 }
122 
123 static struct of_device_id __initdata of_bus_ids[] = {
124  { .name = "soc", },
125  { .name = "cpm", },
126  { .name = "localbus", },
127  {},
128 };
129 
130 static int __init declare_of_platform_devices(void)
131 {
132  of_platform_bus_probe(NULL, of_bus_ids, NULL);
133 
134  return 0;
135 }
136 machine_device_initcall(mpc86x_ads, declare_of_platform_devices);
137 
138 define_machine(mpc86x_ads) {
139  .name = "MPC86x ADS",
140  .probe = mpc86xads_probe,
141  .setup_arch = mpc86xads_setup_arch,
142  .init_IRQ = mpc8xx_pics_init,
143  .get_irq = mpc8xx_get_irq,
144  .restart = mpc8xx_restart,
145  .calibrate_decr = mpc8xx_calibrate_decr,
146  .set_rtc_time = mpc8xx_set_rtc_time,
147  .get_rtc_time = mpc8xx_get_rtc_time,
148  .progress = udbg_progress,
149 };