1 /*
2 * linux/arch/arm/mach-ep93xx/micro9.c
3 *
4 * Copyright (C) 2006 Contec Steuerungstechnik & Automation GmbH
5 * Manfred Gruber <m.gruber@tirol.com>
6 * Copyright (C) 2009 Contec Steuerungstechnik & Automation GmbH
7 * Hubert Feurstein <hubert.feurstein@contec.at>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14 #include <linux/kernel.h>
15 #include <linux/init.h>
16 #include <linux/platform_device.h>
17 #include <linux/io.h>
18
19 #include <mach/hardware.h>
20
21 #include <asm/mach-types.h>
22 #include <asm/mach/arch.h>
23
24 #include "soc.h"
25
26 /*************************************************************************
27 * Micro9 NOR Flash
28 *
29 * Micro9-High has up to 64MB of 32-bit flash on CS1
30 * Micro9-Mid has up to 64MB of either 32-bit or 16-bit flash on CS1
31 * Micro9-Lite uses a separate MTD map driver for flash support
32 * Micro9-Slim has up to 64MB of either 32-bit or 16-bit flash on CS1
33 *************************************************************************/
micro9_detect_bootwidth(void)34 static unsigned int __init micro9_detect_bootwidth(void)
35 {
36 u32 v;
37
38 /* Detect the bus width of the external flash memory */
39 v = __raw_readl(EP93XX_SYSCON_SYSCFG);
40 if (v & EP93XX_SYSCON_SYSCFG_LCSN7)
41 return 4; /* 32-bit */
42 else
43 return 2; /* 16-bit */
44 }
45
micro9_register_flash(void)46 static void __init micro9_register_flash(void)
47 {
48 unsigned int width;
49
50 if (machine_is_micro9())
51 width = 4;
52 else if (machine_is_micro9m() || machine_is_micro9s())
53 width = micro9_detect_bootwidth();
54 else
55 width = 0;
56
57 if (width)
58 ep93xx_register_flash(width, EP93XX_CS1_PHYS_BASE, SZ_64M);
59 }
60
61
62 /*************************************************************************
63 * Micro9 Ethernet
64 *************************************************************************/
65 static struct ep93xx_eth_data __initdata micro9_eth_data = {
66 .phy_id = 0x1f,
67 };
68
69
micro9_init_machine(void)70 static void __init micro9_init_machine(void)
71 {
72 ep93xx_init_devices();
73 ep93xx_register_eth(µ9_eth_data, 1);
74 micro9_register_flash();
75 }
76
77
78 #ifdef CONFIG_MACH_MICRO9H
79 MACHINE_START(MICRO9, "Contec Micro9-High")
80 /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */
81 .atag_offset = 0x100,
82 .map_io = ep93xx_map_io,
83 .init_irq = ep93xx_init_irq,
84 .init_time = ep93xx_timer_init,
85 .init_machine = micro9_init_machine,
86 .init_late = ep93xx_init_late,
87 .restart = ep93xx_restart,
88 MACHINE_END
89 #endif
90
91 #ifdef CONFIG_MACH_MICRO9M
92 MACHINE_START(MICRO9M, "Contec Micro9-Mid")
93 /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */
94 .atag_offset = 0x100,
95 .map_io = ep93xx_map_io,
96 .init_irq = ep93xx_init_irq,
97 .init_time = ep93xx_timer_init,
98 .init_machine = micro9_init_machine,
99 .init_late = ep93xx_init_late,
100 .restart = ep93xx_restart,
101 MACHINE_END
102 #endif
103
104 #ifdef CONFIG_MACH_MICRO9L
105 MACHINE_START(MICRO9L, "Contec Micro9-Lite")
106 /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */
107 .atag_offset = 0x100,
108 .map_io = ep93xx_map_io,
109 .init_irq = ep93xx_init_irq,
110 .init_time = ep93xx_timer_init,
111 .init_machine = micro9_init_machine,
112 .init_late = ep93xx_init_late,
113 .restart = ep93xx_restart,
114 MACHINE_END
115 #endif
116
117 #ifdef CONFIG_MACH_MICRO9S
118 MACHINE_START(MICRO9S, "Contec Micro9-Slim")
119 /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */
120 .atag_offset = 0x100,
121 .map_io = ep93xx_map_io,
122 .init_irq = ep93xx_init_irq,
123 .init_time = ep93xx_timer_init,
124 .init_machine = micro9_init_machine,
125 .init_late = ep93xx_init_late,
126 .restart = ep93xx_restart,
127 MACHINE_END
128 #endif
129