blob: f1319e5d25461cb1b90aceadcd1162fafe5e0b55 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/***************************************************************************/
2
3/*
4 * linux/arch/m68knommu/platform/528x/config.c
5 *
Lucas De Marchi25985ed2011-03-30 22:57:33 -03006 * Sub-architcture dependent initialization code for the Freescale
Greg Ungerer980f9232009-04-28 14:24:25 +10007 * 5280, 5281 and 5282 CPUs.
Linus Torvalds1da177e2005-04-16 15:20:36 -07008 *
9 * Copyright (C) 1999-2003, Greg Ungerer (gerg@snapgear.com)
10 * Copyright (C) 2001-2003, SnapGear Inc. (www.snapgear.com)
11 */
12
13/***************************************************************************/
14
Linus Torvalds1da177e2005-04-16 15:20:36 -070015#include <linux/kernel.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070016#include <linux/param.h>
17#include <linux/init.h>
Greg Ungerereb49e902008-02-01 17:34:50 +100018#include <linux/platform_device.h>
Greg Ungerereb49e902008-02-01 17:34:50 +100019#include <linux/io.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070020#include <asm/machdep.h>
21#include <asm/coldfire.h>
22#include <asm/mcfsim.h>
Greg Ungerereb49e902008-02-01 17:34:50 +100023#include <asm/mcfuart.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070024
25/***************************************************************************/
26
Steven King83ca6002012-05-06 12:22:53 -070027#if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI)
Steven King91d60412010-01-22 12:43:03 -080028
29static void __init m528x_qspi_init(void)
30{
31 /* setup Port QS for QSPI with gpio CS control */
32 __raw_writeb(0x07, MCFGPIO_PQSPAR);
33}
Greg Ungererffba3f42009-02-26 22:40:38 -080034
Steven King83ca6002012-05-06 12:22:53 -070035#endif /* IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) */
Greg Ungerereb49e902008-02-01 17:34:50 +100036
37/***************************************************************************/
38
Greg Ungerercae82a82011-12-24 01:00:48 +100039static void __init m528x_uarts_init(void)
Greg Ungerereb49e902008-02-01 17:34:50 +100040{
41 u8 port;
Greg Ungerereb49e902008-02-01 17:34:50 +100042
Greg Ungerereb49e902008-02-01 17:34:50 +100043 /* make sure PUAPAR is set for UART0 and UART1 */
Greg Ungerercae82a82011-12-24 01:00:48 +100044 port = readb(MCF5282_GPIO_PUAPAR);
45 port |= 0x03 | (0x03 << 2);
Steven Kingeac57942012-05-21 13:10:19 -070046 writeb(port, MCFGPIO_PUAPAR);
Greg Ungerereb49e902008-02-01 17:34:50 +100047}
Linus Torvalds1da177e2005-04-16 15:20:36 -070048
49/***************************************************************************/
50
Greg Ungererffba3f42009-02-26 22:40:38 -080051static void __init m528x_fec_init(void)
52{
Greg Ungererffba3f42009-02-26 22:40:38 -080053 u16 v16;
54
Greg Ungererffba3f42009-02-26 22:40:38 -080055 /* Set multi-function pins to ethernet mode for fec0 */
56 v16 = readw(MCF_IPSBAR + 0x100056);
57 writew(v16 | 0xf00, MCF_IPSBAR + 0x100056);
58 writeb(0xc0, MCF_IPSBAR + 0x100058);
59}
60
61/***************************************************************************/
62
Steve Bennett188a9a42008-05-01 12:17:08 +100063#ifdef CONFIG_WILDFIRE
64void wildfire_halt(void)
65{
66 writeb(0, 0x30000007);
67 writeb(0x2, 0x30000007);
68}
69#endif
70
71#ifdef CONFIG_WILDFIREMOD
72void wildfiremod_halt(void)
73{
74 printk(KERN_INFO "WildFireMod hibernating...\n");
75
76 /* Set portE.5 to Digital IO */
77 MCF5282_GPIO_PEPAR &= ~(1 << (5 * 2));
78
79 /* Make portE.5 an output */
80 MCF5282_GPIO_DDRE |= (1 << 5);
81
82 /* Now toggle portE.5 from low to high */
83 MCF5282_GPIO_PORTE &= ~(1 << 5);
84 MCF5282_GPIO_PORTE |= (1 << 5);
85
86 printk(KERN_EMERG "Failed to hibernate. Halting!\n");
87}
88#endif
89
Greg Ungerereb49e902008-02-01 17:34:50 +100090void __init config_BSP(char *commandp, int size)
Linus Torvalds1da177e2005-04-16 15:20:36 -070091{
Steve Bennett188a9a42008-05-01 12:17:08 +100092#ifdef CONFIG_WILDFIRE
93 mach_halt = wildfire_halt;
94#endif
95#ifdef CONFIG_WILDFIREMOD
96 mach_halt = wildfiremod_halt;
97#endif
Greg Ungerer35aefb22012-01-23 15:34:58 +100098 mach_sched_init = hw_timer_init;
Greg Ungerereb49e902008-02-01 17:34:50 +100099 m528x_uarts_init();
Greg Ungererffba3f42009-02-26 22:40:38 -0800100 m528x_fec_init();
Steven King83ca6002012-05-06 12:22:53 -0700101#if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI)
Steven King91d60412010-01-22 12:43:03 -0800102 m528x_qspi_init();
103#endif
Greg Ungerereb49e902008-02-01 17:34:50 +1000104}
105
Greg Ungerereb49e902008-02-01 17:34:50 +1000106/***************************************************************************/