Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
m528x.c
Go to the documentation of this file.
1 /***************************************************************************/
2 
3 /*
4  * linux/arch/m68knommu/platform/528x/config.c
5  *
6  * Sub-architcture dependent initialization code for the Freescale
7  * 5280, 5281 and 5282 CPUs.
8  *
9  * Copyright (C) 1999-2003, Greg Ungerer ([email protected])
10  * Copyright (C) 2001-2003, SnapGear Inc. (www.snapgear.com)
11  */
12 
13 /***************************************************************************/
14 
15 #include <linux/kernel.h>
16 #include <linux/param.h>
17 #include <linux/init.h>
18 #include <linux/platform_device.h>
19 #include <linux/io.h>
20 #include <asm/machdep.h>
21 #include <asm/coldfire.h>
22 #include <asm/mcfsim.h>
23 #include <asm/mcfuart.h>
24 
25 /***************************************************************************/
26 
27 #if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI)
28 
29 static void __init m528x_qspi_init(void)
30 {
31  /* setup Port QS for QSPI with gpio CS control */
33 }
34 
35 #endif /* IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) */
36 
37 /***************************************************************************/
38 
39 static void __init m528x_uarts_init(void)
40 {
41  u8 port;
42 
43  /* make sure PUAPAR is set for UART0 and UART1 */
44  port = readb(MCF5282_GPIO_PUAPAR);
45  port |= 0x03 | (0x03 << 2);
46  writeb(port, MCFGPIO_PUAPAR);
47 }
48 
49 /***************************************************************************/
50 
51 static void __init m528x_fec_init(void)
52 {
53  u16 v16;
54 
55  /* Set multi-function pins to ethernet mode for fec0 */
56  v16 = readw(MCFGPIO_PASPAR);
57  writew(v16 | 0xf00, MCFGPIO_PASPAR);
58  writeb(0xc0, MCFGPIO_PEHLPAR);
59 }
60 
61 /***************************************************************************/
62 
63 #ifdef CONFIG_WILDFIRE
64 void wildfire_halt(void)
65 {
66  writeb(0, 0x30000007);
67  writeb(0x2, 0x30000007);
68 }
69 #endif
70 
71 #ifdef CONFIG_WILDFIREMOD
72 void 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 
90 void __init config_BSP(char *commandp, int size)
91 {
92 #ifdef CONFIG_WILDFIRE
93  mach_halt = wildfire_halt;
94 #endif
95 #ifdef CONFIG_WILDFIREMOD
96  mach_halt = wildfiremod_halt;
97 #endif
99  m528x_uarts_init();
100  m528x_fec_init();
101 #if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI)
102  m528x_qspi_init();
103 #endif
104 }
105 
106 /***************************************************************************/