2 * arch/arm/mach-mcs814x/common.c
4 * Core functions for Moschip MCS814x SoCs
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
11 #include <linux/kernel.h>
12 #include <linux/init.h>
14 #include <linux/gpio.h>
16 #include <asm/setup.h>
17 #include <asm/mach-types.h>
18 #include <asm/mach/arch.h>
19 #include <mach/hardware.h>
21 #include <asm/pgtable.h>
22 #include <asm/mach/map.h>
24 static struct map_desc mcs814x_io_desc[] __initdata = {
26 .virtual = MCS814X_IO_BASE,
27 .pfn = __phys_to_pfn(MCS814X_IO_START),
28 .length = MCS814X_IO_SIZE,
33 #define SYSDBG_BS2 0x04
34 #define CPU_MODE_SHIFT 23
35 #define CPU_MODE_MASK 0x03
43 static const struct cpu_mode cpu_modes[] = {
55 .name = "External MII",
66 void __init mcs814x_init_machine(void)
71 bs2 = __raw_readl(_CONFADDR_SYSDBG + SYSDBG_BS2);
72 cpu_mode = (bs2 >> CPU_MODE_SHIFT) & CPU_MODE_MASK;
74 pr_info("CPU mode: %s\n", cpu_modes[cpu_mode].name);
76 /* request the gpios since the pins are muxed for functionnality */
77 for (gpio = cpu_modes[cpu_mode].gpio_start;
78 gpio == cpu_modes[cpu_mode].gpio_end; gpio++) {
80 gpio_request(gpio, cpu_modes[cpu_mode].name);
84 void __init mcs814x_map_io(void)
86 iotable_init(mcs814x_io_desc, ARRAY_SIZE(mcs814x_io_desc));
89 void mcs814x_restart(char mode, const char *cmd)
91 __raw_writel(~(1 << 31), _CONFADDR_SYSDBG);