blob: e68bc7a148eb1b15f3b511fbfaf1e94bbc9eca77 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/***************************************************************************/
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
Linus Torvalds1da177e2005-04-16 15:20:36 -070012#include <linux/kernel.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070013#include <linux/param.h>
14#include <linux/init.h>
Greg Ungerer84e6def2008-02-01 17:34:32 +100015#include <linux/io.h>
Greg Ungerer41a21592010-10-12 12:24:49 +100016#include <linux/phy.h>
17#include <linux/phy_fixed.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070018#include <asm/machdep.h>
19#include <asm/coldfire.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070020#include <asm/mcfsim.h>
Greg Ungerer84e6def2008-02-01 17:34:32 +100021#include <asm/mcfuart.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070022
23/***************************************************************************/
24
Linus Torvalds1da177e2005-04-16 15:20:36 -070025/*
26 * Some platforms need software versions of the GPIO data registers.
27 */
28unsigned short ppdata;
29unsigned char ledbank = 0xff;
30
31/***************************************************************************/
32
Greg Ungerer6b656e82011-12-24 00:56:52 +100033static void __init m5272_uarts_init(void)
Greg Ungerer84e6def2008-02-01 17:34:32 +100034{
35 u32 v;
36
Greg Ungerer6b656e82011-12-24 00:56:52 +100037 /* 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);
Greg Ungerer84e6def2008-02-01 17:34:32 +100041
Greg Ungerer6b656e82011-12-24 00:56:52 +100042 v = readl(MCF_MBAR + MCFSIM_PDCNT);
43 v = (v & ~0x000003fc) | 0x000002a8;
44 writel(v, MCF_MBAR + MCFSIM_PDCNT);
Greg Ungerer84e6def2008-02-01 17:34:32 +100045}
Linus Torvalds1da177e2005-04-16 15:20:36 -070046
47/***************************************************************************/
48
Greg Ungerer05728ae2009-04-30 23:32:52 +100049static 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
Greg Ungerer84e6def2008-02-01 17:34:32 +100062void __init config_BSP(char *commandp, int size)
Linus Torvalds1da177e2005-04-16 15:20:36 -070063{
Greg Ungerera7962662005-09-09 09:32:14 +100064#if defined (CONFIG_MOD5272)
65 volatile unsigned char *pivrp;
Linus Torvalds1da177e2005-04-16 15:20:36 -070066
67 /* Set base of device vectors to be 64 */
Greg Ungerera7962662005-09-09 09:32:14 +100068 pivrp = (volatile unsigned char *) (MCF_MBAR + MCFSIM_PIVR);
Linus Torvalds1da177e2005-04-16 15:20:36 -070069 *pivrp = 0x40;
70#endif
71
Greg Ungererbc724502007-07-25 22:07:20 +100072#if defined(CONFIG_NETtel) || defined(CONFIG_SCALES)
Linus Torvalds1da177e2005-04-16 15:20:36 -070073 /* Copy command line from FLASH to local buffer... */
74 memcpy(commandp, (char *) 0xf0004000, size);
75 commandp[size-1] = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -070076#elif defined(CONFIG_CANCam)
77 /* Copy command line from FLASH to local buffer... */
78 memcpy(commandp, (char *) 0xf0010000, size);
79 commandp[size-1] = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -070080#endif
81
Greg Ungerer05728ae2009-04-30 23:32:52 +100082 mach_reset = m5272_cpu_reset;
Greg Ungerer35aefb22012-01-23 15:34:58 +100083 mach_sched_init = hw_timer_init;
Linus Torvalds1da177e2005-04-16 15:20:36 -070084}
85
86/***************************************************************************/
Greg Ungerer84e6def2008-02-01 17:34:32 +100087
Greg Ungerer41a21592010-10-12 12:24:49 +100088/*
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 */
93static struct fixed_phy_status nettel_fixed_phy_status __initdata = {
94 .link = 1,
95 .speed = 100,
96 .duplex = 0,
97};
98
99/***************************************************************************/
100
Greg Ungerer84e6def2008-02-01 17:34:32 +1000101static int __init init_BSP(void)
102{
103 m5272_uarts_init();
Greg Ungerer41a21592010-10-12 12:24:49 +1000104 fixed_phy_add(PHY_POLL, 0, &nettel_fixed_phy_status);
Greg Ungerer84e6def2008-02-01 17:34:32 +1000105 return 0;
106}
107
108arch_initcall(init_BSP);
109
110/***************************************************************************/