Version:  2.0.40 2.2.26 2.4.37 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 3.15 3.16 3.17 3.18

Linux/arch/powerpc/platforms/8xx/tqm8xx_setup.c

  1 /*
  2  * Platform setup for the MPC8xx based boards from TQM.
  3  *
  4  * Heiko Schocher <hs@denx.de>
  5  * Copyright 2010 DENX Software Engineering GmbH
  6  *
  7  * based on:
  8  * Vitaly Bordug <vbordug@ru.mvista.com>
  9  *
 10  * Copyright 2005 MontaVista Software Inc.
 11  *
 12  * Heavily modified by Scott Wood <scottwood@freescale.com>
 13  * Copyright 2007 Freescale Semiconductor, Inc.
 14  *
 15  * This file is licensed under the terms of the GNU General Public License
 16  * version 2. This program is licensed "as is" without any warranty of any
 17  * kind, whether express or implied.
 18  */
 19 
 20 #include <linux/init.h>
 21 #include <linux/param.h>
 22 #include <linux/string.h>
 23 #include <linux/ioport.h>
 24 #include <linux/device.h>
 25 #include <linux/delay.h>
 26 
 27 #include <linux/fs_enet_pd.h>
 28 #include <linux/fs_uart_pd.h>
 29 #include <linux/fsl_devices.h>
 30 #include <linux/mii.h>
 31 #include <linux/of_fdt.h>
 32 #include <linux/of_platform.h>
 33 
 34 #include <asm/delay.h>
 35 #include <asm/io.h>
 36 #include <asm/machdep.h>
 37 #include <asm/page.h>
 38 #include <asm/processor.h>
 39 #include <asm/time.h>
 40 #include <asm/8xx_immap.h>
 41 #include <asm/cpm1.h>
 42 #include <asm/fs_pd.h>
 43 #include <asm/udbg.h>
 44 
 45 #include "mpc8xx.h"
 46 
 47 struct cpm_pin {
 48         int port, pin, flags;
 49 };
 50 
 51 static struct cpm_pin tqm8xx_pins[] __initdata = {
 52         /* SMC1 */
 53         {CPM_PORTB, 24, CPM_PIN_INPUT}, /* RX */
 54         {CPM_PORTB, 25, CPM_PIN_INPUT | CPM_PIN_SECONDARY}, /* TX */
 55 
 56         /* SCC1 */
 57         {CPM_PORTA, 5, CPM_PIN_INPUT}, /* CLK1 */
 58         {CPM_PORTA, 7, CPM_PIN_INPUT}, /* CLK2 */
 59         {CPM_PORTA, 14, CPM_PIN_INPUT}, /* TX */
 60         {CPM_PORTA, 15, CPM_PIN_INPUT}, /* RX */
 61         {CPM_PORTC, 15, CPM_PIN_INPUT | CPM_PIN_SECONDARY}, /* TENA */
 62         {CPM_PORTC, 10, CPM_PIN_INPUT | CPM_PIN_SECONDARY | CPM_PIN_GPIO},
 63         {CPM_PORTC, 11, CPM_PIN_INPUT | CPM_PIN_SECONDARY | CPM_PIN_GPIO},
 64 };
 65 
 66 static struct cpm_pin tqm8xx_fec_pins[] __initdata = {
 67         /* MII */
 68         {CPM_PORTD, 3, CPM_PIN_OUTPUT},
 69         {CPM_PORTD, 4, CPM_PIN_OUTPUT},
 70         {CPM_PORTD, 5, CPM_PIN_OUTPUT},
 71         {CPM_PORTD, 6, CPM_PIN_OUTPUT},
 72         {CPM_PORTD, 7, CPM_PIN_OUTPUT},
 73         {CPM_PORTD, 8, CPM_PIN_OUTPUT},
 74         {CPM_PORTD, 9, CPM_PIN_OUTPUT},
 75         {CPM_PORTD, 10, CPM_PIN_OUTPUT},
 76         {CPM_PORTD, 11, CPM_PIN_OUTPUT},
 77         {CPM_PORTD, 12, CPM_PIN_OUTPUT},
 78         {CPM_PORTD, 13, CPM_PIN_OUTPUT},
 79         {CPM_PORTD, 14, CPM_PIN_OUTPUT},
 80         {CPM_PORTD, 15, CPM_PIN_OUTPUT},
 81 };
 82 
 83 static void __init init_pins(int n, struct cpm_pin *pin)
 84 {
 85         int i;
 86 
 87         for (i = 0; i < n; i++) {
 88                 cpm1_set_pin(pin->port, pin->pin, pin->flags);
 89                 pin++;
 90         }
 91 }
 92 
 93 static void __init init_ioports(void)
 94 {
 95         struct device_node *dnode;
 96         struct property *prop;
 97         int     len;
 98 
 99         init_pins(ARRAY_SIZE(tqm8xx_pins), &tqm8xx_pins[0]);
100 
101         cpm1_clk_setup(CPM_CLK_SMC1, CPM_BRG1, CPM_CLK_RTX);
102 
103         dnode = of_find_node_by_name(NULL, "aliases");
104         if (dnode == NULL)
105                 return;
106         prop = of_find_property(dnode, "ethernet1", &len);
107         if (prop == NULL)
108                 return;
109 
110         /* init FEC pins */
111         init_pins(ARRAY_SIZE(tqm8xx_fec_pins), &tqm8xx_fec_pins[0]);
112 }
113 
114 static void __init tqm8xx_setup_arch(void)
115 {
116         cpm_reset();
117         init_ioports();
118 }
119 
120 static int __init tqm8xx_probe(void)
121 {
122         unsigned long node = of_get_flat_dt_root();
123 
124         return of_flat_dt_is_compatible(node, "tqc,tqm8xx");
125 }
126 
127 static const struct of_device_id of_bus_ids[] __initconst = {
128         { .name = "soc", },
129         { .name = "cpm", },
130         { .name = "localbus", },
131         { .compatible = "simple-bus" },
132         {},
133 };
134 
135 static int __init declare_of_platform_devices(void)
136 {
137         of_platform_bus_probe(NULL, of_bus_ids, NULL);
138 
139         return 0;
140 }
141 machine_device_initcall(tqm8xx, declare_of_platform_devices);
142 
143 define_machine(tqm8xx) {
144         .name                   = "TQM8xx",
145         .probe                  = tqm8xx_probe,
146         .setup_arch             = tqm8xx_setup_arch,
147         .init_IRQ               = mpc8xx_pics_init,
148         .get_irq                = mpc8xx_get_irq,
149         .restart                = mpc8xx_restart,
150         .calibrate_decr         = mpc8xx_calibrate_decr,
151         .set_rtc_time           = mpc8xx_set_rtc_time,
152         .get_rtc_time           = mpc8xx_get_rtc_time,
153         .progress               = udbg_progress,
154 };
155 

This page was automatically generated by LXR 0.3.1 (source).  •  Linux is a registered trademark of Linus Torvalds  •  Contact us