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