Merge branch 'next' of git://git.monstr.eu/linux-2.6-microblaze
[sfrench/cifs-2.6.git] / arch / arm / mach-ep93xx / micro9.c
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/hardware/vic.h>
22 #include <asm/mach-types.h>
23 #include <asm/mach/arch.h>
24
25 #include "soc.h"
26
27 /*************************************************************************
28  * Micro9 NOR Flash
29  *
30  * Micro9-High has up to 64MB of 32-bit flash on CS1
31  * Micro9-Mid has up to 64MB of either 32-bit or 16-bit flash on CS1
32  * Micro9-Lite uses a separate MTD map driver for flash support
33  * Micro9-Slim has up to 64MB of either 32-bit or 16-bit flash on CS1
34  *************************************************************************/
35 static unsigned int __init micro9_detect_bootwidth(void)
36 {
37         u32 v;
38
39         /* Detect the bus width of the external flash memory */
40         v = __raw_readl(EP93XX_SYSCON_SYSCFG);
41         if (v & EP93XX_SYSCON_SYSCFG_LCSN7)
42                 return 4; /* 32-bit */
43         else
44                 return 2; /* 16-bit */
45 }
46
47 static void __init micro9_register_flash(void)
48 {
49         unsigned int width;
50
51         if (machine_is_micro9())
52                 width = 4;
53         else if (machine_is_micro9m() || machine_is_micro9s())
54                 width = micro9_detect_bootwidth();
55         else
56                 width = 0;
57
58         if (width)
59                 ep93xx_register_flash(width, EP93XX_CS1_PHYS_BASE, SZ_64M);
60 }
61
62
63 /*************************************************************************
64  * Micro9 Ethernet
65  *************************************************************************/
66 static struct ep93xx_eth_data __initdata micro9_eth_data = {
67         .phy_id         = 0x1f,
68 };
69
70
71 static void __init micro9_init_machine(void)
72 {
73         ep93xx_init_devices();
74         ep93xx_register_eth(&micro9_eth_data, 1);
75         micro9_register_flash();
76 }
77
78
79 #ifdef CONFIG_MACH_MICRO9H
80 MACHINE_START(MICRO9, "Contec Micro9-High")
81         /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */
82         .atag_offset    = 0x100,
83         .map_io         = ep93xx_map_io,
84         .init_irq       = ep93xx_init_irq,
85         .handle_irq     = vic_handle_irq,
86         .timer          = &ep93xx_timer,
87         .init_machine   = micro9_init_machine,
88         .init_late      = ep93xx_init_late,
89         .restart        = ep93xx_restart,
90 MACHINE_END
91 #endif
92
93 #ifdef CONFIG_MACH_MICRO9M
94 MACHINE_START(MICRO9M, "Contec Micro9-Mid")
95         /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */
96         .atag_offset    = 0x100,
97         .map_io         = ep93xx_map_io,
98         .init_irq       = ep93xx_init_irq,
99         .handle_irq     = vic_handle_irq,
100         .timer          = &ep93xx_timer,
101         .init_machine   = micro9_init_machine,
102         .init_late      = ep93xx_init_late,
103         .restart        = ep93xx_restart,
104 MACHINE_END
105 #endif
106
107 #ifdef CONFIG_MACH_MICRO9L
108 MACHINE_START(MICRO9L, "Contec Micro9-Lite")
109         /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */
110         .atag_offset    = 0x100,
111         .map_io         = ep93xx_map_io,
112         .init_irq       = ep93xx_init_irq,
113         .handle_irq     = vic_handle_irq,
114         .timer          = &ep93xx_timer,
115         .init_machine   = micro9_init_machine,
116         .init_late      = ep93xx_init_late,
117         .restart        = ep93xx_restart,
118 MACHINE_END
119 #endif
120
121 #ifdef CONFIG_MACH_MICRO9S
122 MACHINE_START(MICRO9S, "Contec Micro9-Slim")
123         /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */
124         .atag_offset    = 0x100,
125         .map_io         = ep93xx_map_io,
126         .init_irq       = ep93xx_init_irq,
127         .handle_irq     = vic_handle_irq,
128         .timer          = &ep93xx_timer,
129         .init_machine   = micro9_init_machine,
130         .init_late      = ep93xx_init_late,
131         .restart        = ep93xx_restart,
132 MACHINE_END
133 #endif