1 /***************************************************************************/
2
3 /*
4 * linux/arch/m68knommu/platform/5272/config.c
5 *
6 * Copyright (C) 1999-2002, Greg Ungerer (gerg@snapgear.com)
7 * Copyright (C) 2001-2002, SnapGear Inc. (www.snapgear.com)
8 */
9
10 /***************************************************************************/
11
12 #include <linux/kernel.h>
13 #include <linux/param.h>
14 #include <linux/init.h>
15 #include <linux/io.h>
16 #include <linux/phy.h>
17 #include <linux/phy_fixed.h>
18 #include <asm/machdep.h>
19 #include <asm/coldfire.h>
20 #include <asm/mcfsim.h>
21 #include <asm/mcfuart.h>
22
23 /***************************************************************************/
24
25 /*
26 * Some platforms need software versions of the GPIO data registers.
27 */
28 unsigned short ppdata;
29 unsigned char ledbank = 0xff;
30
31 /***************************************************************************/
32
m5272_uarts_init(void)33 static void __init m5272_uarts_init(void)
34 {
35 u32 v;
36
37 /* Enable the output lines for the serial ports */
38 v = readl(MCF_MBAR + MCFSIM_PBCNT);
39 v = (v & ~0x000000ff) | 0x00000055;
40 writel(v, MCF_MBAR + MCFSIM_PBCNT);
41
42 v = readl(MCF_MBAR + MCFSIM_PDCNT);
43 v = (v & ~0x000003fc) | 0x000002a8;
44 writel(v, MCF_MBAR + MCFSIM_PDCNT);
45 }
46
47 /***************************************************************************/
48
m5272_cpu_reset(void)49 static void m5272_cpu_reset(void)
50 {
51 local_irq_disable();
52 /* Set watchdog to reset, and enabled */
53 __raw_writew(0, MCF_MBAR + MCFSIM_WIRR);
54 __raw_writew(1, MCF_MBAR + MCFSIM_WRRR);
55 __raw_writew(0, MCF_MBAR + MCFSIM_WCR);
56 for (;;)
57 /* wait for watchdog to timeout */;
58 }
59
60 /***************************************************************************/
61
config_BSP(char * commandp,int size)62 void __init config_BSP(char *commandp, int size)
63 {
64 #if defined (CONFIG_MOD5272)
65 volatile unsigned char *pivrp;
66
67 /* Set base of device vectors to be 64 */
68 pivrp = (volatile unsigned char *) (MCF_MBAR + MCFSIM_PIVR);
69 *pivrp = 0x40;
70 #endif
71
72 #if defined(CONFIG_NETtel) || defined(CONFIG_SCALES)
73 /* Copy command line from FLASH to local buffer... */
74 memcpy(commandp, (char *) 0xf0004000, size);
75 commandp[size-1] = 0;
76 #elif defined(CONFIG_CANCam)
77 /* Copy command line from FLASH to local buffer... */
78 memcpy(commandp, (char *) 0xf0010000, size);
79 commandp[size-1] = 0;
80 #endif
81
82 mach_reset = m5272_cpu_reset;
83 mach_sched_init = hw_timer_init;
84 }
85
86 /***************************************************************************/
87
88 /*
89 * Some 5272 based boards have the FEC ethernet diectly connected to
90 * an ethernet switch. In this case we need to use the fixed phy type,
91 * and we need to declare it early in boot.
92 */
93 static struct fixed_phy_status nettel_fixed_phy_status __initdata = {
94 .link = 1,
95 .speed = 100,
96 .duplex = 0,
97 };
98
99 /***************************************************************************/
100
init_BSP(void)101 static int __init init_BSP(void)
102 {
103 m5272_uarts_init();
104 fixed_phy_add(PHY_POLL, 0, &nettel_fixed_phy_status);
105 return 0;
106 }
107
108 arch_initcall(init_BSP);
109
110 /***************************************************************************/
111