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