aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-ep93xx/micro9.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-ep93xx/micro9.c')
-rw-r--r--arch/arm/mach-ep93xx/micro9.c133
1 files changed, 78 insertions, 55 deletions
diff --git a/arch/arm/mach-ep93xx/micro9.c b/arch/arm/mach-ep93xx/micro9.c
index 0a313e82fb74..f3757a1c5a10 100644
--- a/arch/arm/mach-ep93xx/micro9.c
+++ b/arch/arm/mach-ep93xx/micro9.c
@@ -2,7 +2,9 @@
2 * linux/arch/arm/mach-ep93xx/micro9.c 2 * linux/arch/arm/mach-ep93xx/micro9.c
3 * 3 *
4 * Copyright (C) 2006 Contec Steuerungstechnik & Automation GmbH 4 * Copyright (C) 2006 Contec Steuerungstechnik & Automation GmbH
5 * Manfred Gruber <manfred.gruber@contec.at> 5 * Manfred Gruber <m.gruber@tirol.com>
6 * Copyright (C) 2009 Contec Steuerungstechnik & Automation GmbH
7 * Hubert Feurstein <hubert.feurstein@contec.at>
6 * 8 *
7 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as 10 * it under the terms of the GNU General Public License version 2 as
@@ -13,6 +15,7 @@
13#include <linux/init.h> 15#include <linux/init.h>
14#include <linux/platform_device.h> 16#include <linux/platform_device.h>
15#include <linux/mtd/physmap.h> 17#include <linux/mtd/physmap.h>
18#include <linux/io.h>
16 19
17#include <mach/hardware.h> 20#include <mach/hardware.h>
18 21
@@ -20,104 +23,124 @@
20#include <asm/mach/arch.h> 23#include <asm/mach/arch.h>
21 24
22 25
23static struct ep93xx_eth_data micro9_eth_data = { 26/*************************************************************************
24 .phy_id = 0x1f, 27 * Micro9 NOR Flash
25}; 28 *
26 29 * Micro9-High has up to 64MB of 32-bit flash on CS1
27static void __init micro9_init(void) 30 * Micro9-Mid has up to 64MB of either 32-bit or 16-bit flash on CS1
28{ 31 * Micro9-Lite uses a seperate MTD map driver for flash support
29 ep93xx_register_eth(&micro9_eth_data, 1); 32 * Micro9-Slim has up to 64MB of either 32-bit or 16-bit flash on CS1
30} 33 *************************************************************************/
31 34static struct physmap_flash_data micro9_flash_data;
32/* 35
33 * Micro9-H 36static struct resource micro9_flash_resource = {
34 */
35#ifdef CONFIG_MACH_MICRO9H
36static struct physmap_flash_data micro9h_flash_data = {
37 .width = 4,
38};
39
40static struct resource micro9h_flash_resource = {
41 .start = EP93XX_CS1_PHYS_BASE, 37 .start = EP93XX_CS1_PHYS_BASE,
42 .end = EP93XX_CS1_PHYS_BASE + SZ_64M - 1, 38 .end = EP93XX_CS1_PHYS_BASE + SZ_64M - 1,
43 .flags = IORESOURCE_MEM, 39 .flags = IORESOURCE_MEM,
44}; 40};
45 41
46static struct platform_device micro9h_flash = { 42static struct platform_device micro9_flash = {
47 .name = "physmap-flash", 43 .name = "physmap-flash",
48 .id = 0, 44 .id = 0,
49 .dev = { 45 .dev = {
50 .platform_data = &micro9h_flash_data, 46 .platform_data = &micro9_flash_data,
51 }, 47 },
52 .num_resources = 1, 48 .num_resources = 1,
53 .resource = &micro9h_flash_resource, 49 .resource = &micro9_flash_resource,
54}; 50};
55 51
56static void __init micro9h_init(void) 52static void __init __micro9_register_flash(unsigned int width)
53{
54 micro9_flash_data.width = width;
55
56 platform_device_register(&micro9_flash);
57}
58
59static unsigned int __init micro9_detect_bootwidth(void)
60{
61 u32 v;
62
63 /* Detect the bus width of the external flash memory */
64 v = __raw_readl(EP93XX_SYSCON_SYSCFG);
65 if (v & EP93XX_SYSCON_SYSCFG_LCSN7)
66 return 4; /* 32-bit */
67 else
68 return 2; /* 16-bit */
69}
70
71static void __init micro9_register_flash(void)
57{ 72{
58 platform_device_register(&micro9h_flash); 73 if (machine_is_micro9())
74 __micro9_register_flash(4);
75 else if (machine_is_micro9m() || machine_is_micro9s())
76 __micro9_register_flash(micro9_detect_bootwidth());
59} 77}
60 78
61static void __init micro9h_init_machine(void) 79
80/*************************************************************************
81 * Micro9 Ethernet
82 *************************************************************************/
83static struct ep93xx_eth_data micro9_eth_data = {
84 .phy_id = 0x1f,
85};
86
87
88static void __init micro9_init_machine(void)
62{ 89{
63 ep93xx_init_devices(); 90 ep93xx_init_devices();
64 micro9_init(); 91 ep93xx_register_eth(&micro9_eth_data, 1);
65 micro9h_init(); 92 micro9_register_flash();
66} 93}
67 94
68MACHINE_START(MICRO9, "Contec Hypercontrol Micro9-H") 95
69 /* Maintainer: Manfred Gruber <manfred.gruber@contec.at> */ 96#ifdef CONFIG_MACH_MICRO9H
97MACHINE_START(MICRO9, "Contec Micro9-High")
98 /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */
70 .phys_io = EP93XX_APB_PHYS_BASE, 99 .phys_io = EP93XX_APB_PHYS_BASE,
71 .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc, 100 .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
72 .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100, 101 .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
73 .map_io = ep93xx_map_io, 102 .map_io = ep93xx_map_io,
74 .init_irq = ep93xx_init_irq, 103 .init_irq = ep93xx_init_irq,
75 .timer = &ep93xx_timer, 104 .timer = &ep93xx_timer,
76 .init_machine = micro9h_init_machine, 105 .init_machine = micro9_init_machine,
77MACHINE_END 106MACHINE_END
78#endif 107#endif
79 108
80/*
81 * Micro9-M
82 */
83#ifdef CONFIG_MACH_MICRO9M 109#ifdef CONFIG_MACH_MICRO9M
84static void __init micro9m_init_machine(void) 110MACHINE_START(MICRO9M, "Contec Micro9-Mid")
85{ 111 /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */
86 ep93xx_init_devices();
87 micro9_init();
88}
89
90MACHINE_START(MICRO9M, "Contec Hypercontrol Micro9-M")
91 /* Maintainer: Manfred Gruber <manfred.gruber@contec.at> */
92 .phys_io = EP93XX_APB_PHYS_BASE, 112 .phys_io = EP93XX_APB_PHYS_BASE,
93 .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc, 113 .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
94 .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100, 114 .boot_params = EP93XX_SDCE3_PHYS_BASE_ASYNC + 0x100,
95 .map_io = ep93xx_map_io, 115 .map_io = ep93xx_map_io,
96 .init_irq = ep93xx_init_irq, 116 .init_irq = ep93xx_init_irq,
97 .timer = &ep93xx_timer, 117 .timer = &ep93xx_timer,
98 .init_machine = micro9m_init_machine, 118 .init_machine = micro9_init_machine,
99MACHINE_END 119MACHINE_END
100#endif 120#endif
101 121
102/*
103 * Micro9-L
104 */
105#ifdef CONFIG_MACH_MICRO9L 122#ifdef CONFIG_MACH_MICRO9L
106static void __init micro9l_init_machine(void) 123MACHINE_START(MICRO9L, "Contec Micro9-Lite")
107{ 124 /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */
108 ep93xx_init_devices();
109 micro9_init();
110}
111
112MACHINE_START(MICRO9L, "Contec Hypercontrol Micro9-L")
113 /* Maintainer: Manfred Gruber <manfred.gruber@contec.at> */
114 .phys_io = EP93XX_APB_PHYS_BASE, 125 .phys_io = EP93XX_APB_PHYS_BASE,
115 .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc, 126 .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
116 .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100, 127 .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
117 .map_io = ep93xx_map_io, 128 .map_io = ep93xx_map_io,
118 .init_irq = ep93xx_init_irq, 129 .init_irq = ep93xx_init_irq,
119 .timer = &ep93xx_timer, 130 .timer = &ep93xx_timer,
120 .init_machine = micro9l_init_machine, 131 .init_machine = micro9_init_machine,
121MACHINE_END 132MACHINE_END
122#endif 133#endif
123 134
135#ifdef CONFIG_MACH_MICRO9S
136MACHINE_START(MICRO9S, "Contec Micro9-Slim")
137 /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */
138 .phys_io = EP93XX_APB_PHYS_BASE,
139 .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
140 .boot_params = EP93XX_SDCE3_PHYS_BASE_ASYNC + 0x100,
141 .map_io = ep93xx_map_io,
142 .init_irq = ep93xx_init_irq,
143 .timer = &ep93xx_timer,
144 .init_machine = micro9_init_machine,
145MACHINE_END
146#endif