aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/Kconfig53
-rw-r--r--arch/arm/boot/dts/exynos4210-pinctrl.dtsi457
-rw-r--r--arch/arm/boot/dts/exynos4210.dtsi37
-rw-r--r--arch/arm/boot/dts/exynos5250.dtsi28
-rw-r--r--arch/arm/boot/dts/omap4.dtsi8
-rw-r--r--arch/arm/configs/afeb9260_defconfig1
-rw-r--r--arch/arm/configs/at91rm9200_defconfig2
-rw-r--r--arch/arm/configs/at91sam9261_defconfig2
-rw-r--r--arch/arm/configs/at91sam9263_defconfig3
-rw-r--r--arch/arm/configs/at91sam9g20_defconfig2
-rw-r--r--arch/arm/configs/at91sam9rl_defconfig2
-rw-r--r--arch/arm/configs/cpu9260_defconfig2
-rw-r--r--arch/arm/configs/cpu9g20_defconfig2
-rw-r--r--arch/arm/configs/qil-a9260_defconfig3
-rw-r--r--arch/arm/configs/stamp9g20_defconfig1
-rw-r--r--arch/arm/configs/usb-a9260_defconfig1
-rw-r--r--arch/arm/include/asm/leds.h50
-rw-r--r--arch/arm/kernel/Makefile1
-rw-r--r--arch/arm/kernel/leds.c121
-rw-r--r--arch/arm/kernel/process.c6
-rw-r--r--arch/arm/kernel/time.c17
-rw-r--r--arch/arm/mach-at91/at91rm9200_devices.c92
-rw-r--r--arch/arm/mach-at91/at91sam9260_devices.c84
-rw-r--r--arch/arm/mach-at91/at91sam9261_devices.c60
-rw-r--r--arch/arm/mach-at91/at91sam9263.c4
-rw-r--r--arch/arm/mach-at91/at91sam9263_devices.c161
-rw-r--r--arch/arm/mach-at91/at91sam9rl_devices.c60
-rw-r--r--arch/arm/mach-at91/board-afeb-9260v1.c14
-rw-r--r--arch/arm/mach-at91/board-carmeva.c14
-rw-r--r--arch/arm/mach-at91/board-cpu9krea.c17
-rw-r--r--arch/arm/mach-at91/board-cpuat91.c13
-rw-r--r--arch/arm/mach-at91/board-csb337.c16
-rw-r--r--arch/arm/mach-at91/board-eb9200.c14
-rw-r--r--arch/arm/mach-at91/board-ecbat91.c32
-rw-r--r--arch/arm/mach-at91/board-eco920.c36
-rw-r--r--arch/arm/mach-at91/board-flexibity.c14
-rw-r--r--arch/arm/mach-at91/board-foxg20.c16
-rw-r--r--arch/arm/mach-at91/board-kafa.c17
-rw-r--r--arch/arm/mach-at91/board-kb9202.c37
-rw-r--r--arch/arm/mach-at91/board-neocore926.c13
-rw-r--r--arch/arm/mach-at91/board-picotux200.c14
-rw-r--r--arch/arm/mach-at91/board-qil-a9260.c14
-rw-r--r--arch/arm/mach-at91/board-rm9200dk.c17
-rw-r--r--arch/arm/mach-at91/board-rm9200ek.c17
-rw-r--r--arch/arm/mach-at91/board-rsi-ews.c16
-rw-r--r--arch/arm/mach-at91/board-sam9-l9260.c39
-rw-r--r--arch/arm/mach-at91/board-sam9260ek.c16
-rw-r--r--arch/arm/mach-at91/board-sam9261ek.c16
-rw-r--r--arch/arm/mach-at91/board-sam9263ek.c13
-rw-r--r--arch/arm/mach-at91/board-sam9g20ek.c16
-rw-r--r--arch/arm/mach-at91/board-sam9rlek.c13
-rw-r--r--arch/arm/mach-at91/board-stamp9g20.c14
-rw-r--r--arch/arm/mach-at91/board-usb-a926x.c2
-rw-r--r--arch/arm/mach-at91/board-yl-9200.c16
-rw-r--r--arch/arm/mach-at91/include/mach/board.h1
-rw-r--r--arch/arm/mach-at91/leds.c105
-rw-r--r--arch/arm/mach-clps711x/Makefile2
-rw-r--r--arch/arm/mach-clps711x/p720t-leds.c63
-rw-r--r--arch/arm/mach-clps711x/p720t.c62
-rw-r--r--arch/arm/mach-ebsa110/Makefile4
-rw-r--r--arch/arm/mach-ebsa110/leds.c81
-rw-r--r--arch/arm/mach-exynos/Kconfig2
-rw-r--r--arch/arm/mach-exynos/clock-exynos5.c86
-rw-r--r--arch/arm/mach-exynos/common.c26
-rw-r--r--arch/arm/mach-exynos/include/mach/map.h5
-rw-r--r--arch/arm/mach-exynos/mach-exynos5-dt.c8
-rw-r--r--arch/arm/mach-footbridge/Makefile4
-rw-r--r--arch/arm/mach-footbridge/ebsa285-leds.c138
-rw-r--r--arch/arm/mach-footbridge/ebsa285.c81
-rw-r--r--arch/arm/mach-footbridge/netwinder-hw.c112
-rw-r--r--arch/arm/mach-footbridge/netwinder-leds.c138
-rw-r--r--arch/arm/mach-integrator/Makefile3
-rw-r--r--arch/arm/mach-integrator/core.c3
-rw-r--r--arch/arm/mach-integrator/include/mach/cm.h2
-rw-r--r--arch/arm/mach-integrator/leds.c161
-rw-r--r--arch/arm/mach-ks8695/Makefile3
-rw-r--r--arch/arm/mach-ks8695/devices.c21
-rw-r--r--arch/arm/mach-ks8695/include/mach/devices.h5
-rw-r--r--arch/arm/mach-ks8695/leds.c92
-rw-r--r--arch/arm/mach-omap1/Makefile8
-rw-r--r--arch/arm/mach-omap1/board-h2.c32
-rw-r--r--arch/arm/mach-omap1/board-h3.c32
-rw-r--r--arch/arm/mach-omap1/board-osk.c33
-rw-r--r--arch/arm/mach-omap1/leds-h2p2-debug.c169
-rw-r--r--arch/arm/mach-omap1/leds-innovator.c98
-rw-r--r--arch/arm/mach-omap1/leds-osk.c113
-rw-r--r--arch/arm/mach-omap1/leds.c70
-rw-r--r--arch/arm/mach-omap1/leds.h3
-rw-r--r--arch/arm/mach-omap1/time.c1
-rw-r--r--arch/arm/mach-omap1/timer32k.c1
-rw-r--r--arch/arm/mach-omap2/Kconfig2
-rw-r--r--arch/arm/mach-omap2/Makefile5
-rw-r--r--arch/arm/mach-omap2/omap_l3_noc.c267
-rw-r--r--arch/arm/mach-omap2/omap_l3_noc.h176
-rw-r--r--arch/arm/mach-omap2/omap_l3_smx.c297
-rw-r--r--arch/arm/mach-omap2/omap_l3_smx.h338
-rw-r--r--arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c1
-rw-r--r--arch/arm/mach-orion5x/rd88f5181l-ge-setup.c1
-rw-r--r--arch/arm/mach-orion5x/rd88f5182-setup.c72
-rw-r--r--arch/arm/mach-orion5x/rd88f6183ap-ge-setup.c1
-rw-r--r--arch/arm/mach-pxa/Makefile8
-rw-r--r--arch/arm/mach-pxa/idp.c81
-rw-r--r--arch/arm/mach-pxa/leds-idp.c115
-rw-r--r--arch/arm/mach-pxa/leds-lubbock.c124
-rw-r--r--arch/arm/mach-pxa/leds-mainstone.c119
-rw-r--r--arch/arm/mach-pxa/leds.c32
-rw-r--r--arch/arm/mach-pxa/leds.h13
-rw-r--r--arch/arm/mach-pxa/lubbock.c95
-rw-r--r--arch/arm/mach-pxa/mainstone.c94
-rw-r--r--arch/arm/mach-realview/core.c39
-rw-r--r--arch/arm/mach-realview/core.h2
-rw-r--r--arch/arm/mach-realview/realview_eb.c5
-rw-r--r--arch/arm/mach-realview/realview_pb1176.c5
-rw-r--r--arch/arm/mach-realview/realview_pb11mp.c5
-rw-r--r--arch/arm/mach-realview/realview_pba8.c5
-rw-r--r--arch/arm/mach-realview/realview_pbx.c5
-rw-r--r--arch/arm/mach-sa1100/Makefile9
-rw-r--r--arch/arm/mach-sa1100/assabet.c85
-rw-r--r--arch/arm/mach-sa1100/badge4.c30
-rw-r--r--arch/arm/mach-sa1100/cerf.c42
-rw-r--r--arch/arm/mach-sa1100/hackkit.c32
-rw-r--r--arch/arm/mach-sa1100/lart.c26
-rw-r--r--arch/arm/mach-sa1100/leds-assabet.c113
-rw-r--r--arch/arm/mach-sa1100/leds-badge4.c110
-rw-r--r--arch/arm/mach-sa1100/leds-cerf.c110
-rw-r--r--arch/arm/mach-sa1100/leds-hackkit.c112
-rw-r--r--arch/arm/mach-sa1100/leds-lart.c101
-rw-r--r--arch/arm/mach-sa1100/leds.c50
-rw-r--r--arch/arm/mach-sa1100/leds.h13
-rw-r--r--arch/arm/mach-shark/Makefile4
-rw-r--r--arch/arm/mach-shark/core.c1
-rw-r--r--arch/arm/mach-shark/leds.c220
-rw-r--r--arch/arm/mach-tegra/tegra20_clocks_data.c20
-rw-r--r--arch/arm/mach-tegra/tegra30_clocks_data.c15
-rw-r--r--arch/arm/mach-versatile/core.c5
-rw-r--r--arch/arm/plat-omap/Kconfig3
-rw-r--r--arch/arm/plat-omap/debug-leds.c293
-rw-r--r--arch/arm/plat-samsung/time.c1
-rw-r--r--arch/arm/plat-versatile/Kconfig4
-rw-r--r--arch/arm/plat-versatile/leds.c8
140 files changed, 2312 insertions, 4506 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index ad790fc25ed4..2201ff3002a7 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1768,59 +1768,6 @@ config FORCE_MAX_ZONEORDER
1768 This config option is actually maximum order plus one. For example, 1768 This config option is actually maximum order plus one. For example,
1769 a value of 11 means that the largest free memory block is 2^10 pages. 1769 a value of 11 means that the largest free memory block is 2^10 pages.
1770 1770
1771config LEDS
1772 bool "Timer and CPU usage LEDs"
1773 depends on ARCH_CDB89712 || ARCH_EBSA110 || \
1774 ARCH_EBSA285 || ARCH_INTEGRATOR || \
1775 ARCH_LUBBOCK || MACH_MAINSTONE || ARCH_NETWINDER || \
1776 ARCH_OMAP || ARCH_P720T || ARCH_PXA_IDP || \
1777 ARCH_SA1100 || ARCH_SHARK || ARCH_VERSATILE || \
1778 ARCH_AT91 || ARCH_DAVINCI || \
1779 ARCH_KS8695 || MACH_RD88F5182 || ARCH_REALVIEW
1780 help
1781 If you say Y here, the LEDs on your machine will be used
1782 to provide useful information about your current system status.
1783
1784 If you are compiling a kernel for a NetWinder or EBSA-285, you will
1785 be able to select which LEDs are active using the options below. If
1786 you are compiling a kernel for the EBSA-110 or the LART however, the
1787 red LED will simply flash regularly to indicate that the system is
1788 still functional. It is safe to say Y here if you have a CATS
1789 system, but the driver will do nothing.
1790
1791config LEDS_TIMER
1792 bool "Timer LED" if (!ARCH_CDB89712 && !ARCH_OMAP) || \
1793 OMAP_OSK_MISTRAL || MACH_OMAP_H2 \
1794 || MACH_OMAP_PERSEUS2
1795 depends on LEDS
1796 depends on !GENERIC_CLOCKEVENTS
1797 default y if ARCH_EBSA110
1798 help
1799 If you say Y here, one of the system LEDs (the green one on the
1800 NetWinder, the amber one on the EBSA285, or the red one on the LART)
1801 will flash regularly to indicate that the system is still
1802 operational. This is mainly useful to kernel hackers who are
1803 debugging unstable kernels.
1804
1805 The LART uses the same LED for both Timer LED and CPU usage LED
1806 functions. You may choose to use both, but the Timer LED function
1807 will overrule the CPU usage LED.
1808
1809config LEDS_CPU
1810 bool "CPU usage LED" if (!ARCH_CDB89712 && !ARCH_EBSA110 && \
1811 !ARCH_OMAP) \
1812 || OMAP_OSK_MISTRAL || MACH_OMAP_H2 \
1813 || MACH_OMAP_PERSEUS2
1814 depends on LEDS
1815 help
1816 If you say Y here, the red LED will be used to give a good real
1817 time indication of CPU usage, by lighting whenever the idle task
1818 is not currently executing.
1819
1820 The LART uses the same LED for both Timer LED and CPU usage LED
1821 functions. You may choose to use both, but the Timer LED function
1822 will overrule the CPU usage LED.
1823
1824config ALIGNMENT_TRAP 1771config ALIGNMENT_TRAP
1825 bool 1772 bool
1826 depends on CPU_CP15_MMU 1773 depends on CPU_CP15_MMU
diff --git a/arch/arm/boot/dts/exynos4210-pinctrl.dtsi b/arch/arm/boot/dts/exynos4210-pinctrl.dtsi
new file mode 100644
index 000000000000..b12cf272ad0d
--- /dev/null
+++ b/arch/arm/boot/dts/exynos4210-pinctrl.dtsi
@@ -0,0 +1,457 @@
1/*
2 * Samsung's Exynos4210 SoC pin-mux and pin-config device tree source
3 *
4 * Copyright (c) 2011-2012 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com
6 * Copyright (c) 2011-2012 Linaro Ltd.
7 * www.linaro.org
8 *
9 * Samsung's Exynos4210 SoC pin-mux and pin-config optiosn are listed as device
10 * tree nodes are listed in this file.
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2 as
14 * published by the Free Software Foundation.
15*/
16
17/ {
18 pinctrl@11400000 {
19 uart0_data: uart0-data {
20 samsung,pins = "gpa0-0", "gpa0-1";
21 samsung,pin-function = <0x2>;
22 samsung,pin-pud = <0>;
23 samsung,pin-drv = <0>;
24 };
25
26 uart0_fctl: uart0-fctl {
27 samsung,pins = "gpa0-2", "gpa0-3";
28 samsung,pin-function = <2>;
29 samsung,pin-pud = <0>;
30 samsung,pin-drv = <0>;
31 };
32
33 uart1_data: uart1-data {
34 samsung,pins = "gpa0-4", "gpa0-5";
35 samsung,pin-function = <2>;
36 samsung,pin-pud = <0>;
37 samsung,pin-drv = <0>;
38 };
39
40 uart1_fctl: uart1-fctl {
41 samsung,pins = "gpa0-6", "gpa0-7";
42 samsung,pin-function = <2>;
43 samsung,pin-pud = <0>;
44 samsung,pin-drv = <0>;
45 };
46
47 i2c2_bus: i2c2-bus {
48 samsung,pins = "gpa0-6", "gpa0-7";
49 samsung,pin-function = <3>;
50 samsung,pin-pud = <3>;
51 samsung,pin-drv = <0>;
52 };
53
54 uart2_data: uart2-data {
55 samsung,pins = "gpa1-0", "gpa1-1";
56 samsung,pin-function = <2>;
57 samsung,pin-pud = <0>;
58 samsung,pin-drv = <0>;
59 };
60
61 uart2_fctl: uart2-fctl {
62 samsung,pins = "gpa1-2", "gpa1-3";
63 samsung,pin-function = <2>;
64 samsung,pin-pud = <0>;
65 samsung,pin-drv = <0>;
66 };
67
68 uart_audio_a: uart-audio-a {
69 samsung,pins = "gpa1-0", "gpa1-1";
70 samsung,pin-function = <4>;
71 samsung,pin-pud = <0>;
72 samsung,pin-drv = <0>;
73 };
74
75 i2c3_bus: i2c3-bus {
76 samsung,pins = "gpa1-2", "gpa1-3";
77 samsung,pin-function = <3>;
78 samsung,pin-pud = <3>;
79 samsung,pin-drv = <0>;
80 };
81
82 uart3_data: uart3-data {
83 samsung,pins = "gpa1-4", "gpa1-5";
84 samsung,pin-function = <2>;
85 samsung,pin-pud = <0>;
86 samsung,pin-drv = <0>;
87 };
88
89 uart_audio_b: uart-audio-b {
90 samsung,pins = "gpa1-4", "gpa1-5";
91 samsung,pin-function = <4>;
92 samsung,pin-pud = <0>;
93 samsung,pin-drv = <0>;
94 };
95
96 spi0_bus: spi0-bus {
97 samsung,pins = "gpb-0", "gpb-2", "gpb-3";
98 samsung,pin-function = <2>;
99 samsung,pin-pud = <3>;
100 samsung,pin-drv = <0>;
101 };
102
103 i2c4_bus: i2c4-bus {
104 samsung,pins = "gpb-2", "gpb-3";
105 samsung,pin-function = <3>;
106 samsung,pin-pud = <3>;
107 samsung,pin-drv = <0>;
108 };
109
110 spi1_bus: spi1-bus {
111 samsung,pins = "gpb-4", "gpb-6", "gpb-7";
112 samsung,pin-function = <2>;
113 samsung,pin-pud = <3>;
114 samsung,pin-drv = <0>;
115 };
116
117 i2c5_bus: i2c5-bus {
118 samsung,pins = "gpb-6", "gpb-7";
119 samsung,pin-function = <3>;
120 samsung,pin-pud = <3>;
121 samsung,pin-drv = <0>;
122 };
123
124 i2s1_bus: i2s1-bus {
125 samsung,pins = "gpc0-0", "gpc0-1", "gpc0-2", "gpc0-3",
126 "gpc0-4";
127 samsung,pin-function = <2>;
128 samsung,pin-pud = <0>;
129 samsung,pin-drv = <0>;
130 };
131
132 pcm1_bus: pcm1-bus {
133 samsung,pins = "gpc0-0", "gpc0-1", "gpc0-2", "gpc0-3",
134 "gpc0-4";
135 samsung,pin-function = <3>;
136 samsung,pin-pud = <0>;
137 samsung,pin-drv = <0>;
138 };
139
140 ac97_bus: ac97-bus {
141 samsung,pins = "gpc0-0", "gpc0-1", "gpc0-2", "gpc0-3",
142 "gpc0-4";
143 samsung,pin-function = <4>;
144 samsung,pin-pud = <0>;
145 samsung,pin-drv = <0>;
146 };
147
148 i2s2_bus: i2s2-bus {
149 samsung,pins = "gpc1-0", "gpc1-1", "gpc1-2", "gpc1-3",
150 "gpc1-4";
151 samsung,pin-function = <2>;
152 samsung,pin-pud = <0>;
153 samsung,pin-drv = <0>;
154 };
155
156 pcm2_bus: pcm2-bus {
157 samsung,pins = "gpc1-0", "gpc1-1", "gpc1-2", "gpc1-3",
158 "gpc1-4";
159 samsung,pin-function = <3>;
160 samsung,pin-pud = <0>;
161 samsung,pin-drv = <0>;
162 };
163
164 spdif_bus: spdif-bus {
165 samsung,pins = "gpc1-0", "gpc1-1";
166 samsung,pin-function = <4>;
167 samsung,pin-pud = <0>;
168 samsung,pin-drv = <0>;
169 };
170
171 i2c6_bus: i2c6-bus {
172 samsung,pins = "gpc1-3", "gpc1-4";
173 samsung,pin-function = <4>;
174 samsung,pin-pud = <3>;
175 samsung,pin-drv = <0>;
176 };
177
178 spi2_bus: spi2-bus {
179 samsung,pins = "gpc1-1", "gpc1-2", "gpc1-3", "gpc1-4";
180 samsung,pin-function = <5>;
181 samsung,pin-pud = <3>;
182 samsung,pin-drv = <0>;
183 };
184
185 i2c7_bus: i2c7-bus {
186 samsung,pins = "gpd0-2", "gpd0-3";
187 samsung,pin-function = <3>;
188 samsung,pin-pud = <3>;
189 samsung,pin-drv = <0>;
190 };
191
192 i2c0_bus: i2c0-bus {
193 samsung,pins = "gpd1-0", "gpd1-1";
194 samsung,pin-function = <2>;
195 samsung,pin-pud = <3>;
196 samsung,pin-drv = <0>;
197 };
198
199 i2c1_bus: i2c1-bus {
200 samsung,pins = "gpd1-2", "gpd1-3";
201 samsung,pin-function = <2>;
202 samsung,pin-pud = <3>;
203 samsung,pin-drv = <0>;
204 };
205 };
206
207 pinctrl@11000000 {
208 sd0_clk: sd0-clk {
209 samsung,pins = "gpk0-0";
210 samsung,pin-function = <2>;
211 samsung,pin-pud = <0>;
212 samsung,pin-drv = <0>;
213 };
214
215 sd0_cmd: sd0-cmd {
216 samsung,pins = "gpk0-1";
217 samsung,pin-function = <2>;
218 samsung,pin-pud = <0>;
219 samsung,pin-drv = <0>;
220 };
221
222 sd0_cd: sd0-cd {
223 samsung,pins = "gpk0-2";
224 samsung,pin-function = <2>;
225 samsung,pin-pud = <3>;
226 samsung,pin-drv = <0>;
227 };
228
229 sd0_bus1: sd0-bus-width1 {
230 samsung,pins = "gpk0-3";
231 samsung,pin-function = <2>;
232 samsung,pin-pud = <3>;
233 samsung,pin-drv = <0>;
234 };
235
236 sd0_bus4: sd0-bus-width4 {
237 samsung,pins = "gpk0-3", "gpk0-4", "gpk0-5", "gpk0-6";
238 samsung,pin-function = <2>;
239 samsung,pin-pud = <3>;
240 samsung,pin-drv = <0>;
241 };
242
243 sd0_bus8: sd0-bus-width8 {
244 samsung,pins = "gpk1-3", "gpk1-4", "gpk1-5", "gpk1-6";
245 samsung,pin-function = <3>;
246 samsung,pin-pud = <3>;
247 samsung,pin-drv = <0>;
248 };
249
250 sd4_clk: sd4-clk {
251 samsung,pins = "gpk0-0";
252 samsung,pin-function = <3>;
253 samsung,pin-pud = <0>;
254 samsung,pin-drv = <0>;
255 };
256
257 sd4_cmd: sd4-cmd {
258 samsung,pins = "gpk0-1";
259 samsung,pin-function = <3>;
260 samsung,pin-pud = <0>;
261 samsung,pin-drv = <0>;
262 };
263
264 sd4_cd: sd4-cd {
265 samsung,pins = "gpk0-2";
266 samsung,pin-function = <3>;
267 samsung,pin-pud = <3>;
268 samsung,pin-drv = <0>;
269 };
270
271 sd4_bus1: sd4-bus-width1 {
272 samsung,pins = "gpk0-3";
273 samsung,pin-function = <3>;
274 samsung,pin-pud = <3>;
275 samsung,pin-drv = <0>;
276 };
277
278 sd4_bus4: sd4-bus-width4 {
279 samsung,pins = "gpk0-3", "gpk0-4", "gpk0-5", "gpk0-6";
280 samsung,pin-function = <3>;
281 samsung,pin-pud = <3>;
282 samsung,pin-drv = <0>;
283 };
284
285 sd4_bus8: sd4-bus-width8 {
286 samsung,pins = "gpk1-3", "gpk1-4", "gpk1-5", "gpk1-6";
287 samsung,pin-function = <3>;
288 samsung,pin-pud = <4>;
289 samsung,pin-drv = <0>;
290 };
291
292 sd1_clk: sd1-clk {
293 samsung,pins = "gpk1-0";
294 samsung,pin-function = <2>;
295 samsung,pin-pud = <0>;
296 samsung,pin-drv = <0>;
297 };
298
299 sd1_cmd: sd1-cmd {
300 samsung,pins = "gpk1-1";
301 samsung,pin-function = <2>;
302 samsung,pin-pud = <0>;
303 samsung,pin-drv = <0>;
304 };
305
306 sd1_cd: sd1-cd {
307 samsung,pins = "gpk1-2";
308 samsung,pin-function = <2>;
309 samsung,pin-pud = <3>;
310 samsung,pin-drv = <0>;
311 };
312
313 sd1_bus1: sd1-bus-width1 {
314 samsung,pins = "gpk1-3";
315 samsung,pin-function = <2>;
316 samsung,pin-pud = <3>;
317 samsung,pin-drv = <0>;
318 };
319
320 sd1_bus4: sd1-bus-width4 {
321 samsung,pins = "gpk1-3", "gpk1-4", "gpk1-5", "gpk1-6";
322 samsung,pin-function = <2>;
323 samsung,pin-pud = <3>;
324 samsung,pin-drv = <0>;
325 };
326
327 sd2_clk: sd2-clk {
328 samsung,pins = "gpk2-0";
329 samsung,pin-function = <2>;
330 samsung,pin-pud = <0>;
331 samsung,pin-drv = <0>;
332 };
333
334 sd2_cmd: sd2-cmd {
335 samsung,pins = "gpk2-1";
336 samsung,pin-function = <2>;
337 samsung,pin-pud = <0>;
338 samsung,pin-drv = <0>;
339 };
340
341 sd2_cd: sd2-cd {
342 samsung,pins = "gpk2-2";
343 samsung,pin-function = <2>;
344 samsung,pin-pud = <3>;
345 samsung,pin-drv = <0>;
346 };
347
348 sd2_bus1: sd2-bus-width1 {
349 samsung,pins = "gpk2-3";
350 samsung,pin-function = <2>;
351 samsung,pin-pud = <3>;
352 samsung,pin-drv = <0>;
353 };
354
355 sd2_bus4: sd2-bus-width4 {
356 samsung,pins = "gpk2-3", "gpk2-4", "gpk2-5", "gpk2-6";
357 samsung,pin-function = <2>;
358 samsung,pin-pud = <3>;
359 samsung,pin-drv = <0>;
360 };
361
362 sd2_bus8: sd2-bus-width8 {
363 samsung,pins = "gpk3-3", "gpk3-4", "gpk3-5", "gpk3-6";
364 samsung,pin-function = <3>;
365 samsung,pin-pud = <3>;
366 samsung,pin-drv = <0>;
367 };
368
369 sd3_clk: sd3-clk {
370 samsung,pins = "gpk3-0";
371 samsung,pin-function = <2>;
372 samsung,pin-pud = <0>;
373 samsung,pin-drv = <0>;
374 };
375
376 sd3_cmd: sd3-cmd {
377 samsung,pins = "gpk3-1";
378 samsung,pin-function = <2>;
379 samsung,pin-pud = <0>;
380 samsung,pin-drv = <0>;
381 };
382
383 sd3_cd: sd3-cd {
384 samsung,pins = "gpk3-2";
385 samsung,pin-function = <2>;
386 samsung,pin-pud = <3>;
387 samsung,pin-drv = <0>;
388 };
389
390 sd3_bus1: sd3-bus-width1 {
391 samsung,pins = "gpk3-3";
392 samsung,pin-function = <2>;
393 samsung,pin-pud = <3>;
394 samsung,pin-drv = <0>;
395 };
396
397 sd3_bus4: sd3-bus-width4 {
398 samsung,pins = "gpk3-3", "gpk3-4", "gpk3-5", "gpk3-6";
399 samsung,pin-function = <2>;
400 samsung,pin-pud = <3>;
401 samsung,pin-drv = <0>;
402 };
403
404 eint0: ext-int0 {
405 samsung,pins = "gpx0-0";
406 samsung,pin-function = <0xf>;
407 samsung,pin-pud = <0>;
408 samsung,pin-drv = <0>;
409 };
410
411 eint8: ext-int8 {
412 samsung,pins = "gpx1-0";
413 samsung,pin-function = <0xf>;
414 samsung,pin-pud = <0>;
415 samsung,pin-drv = <0>;
416 };
417
418 eint15: ext-int15 {
419 samsung,pins = "gpx1-7";
420 samsung,pin-function = <0xf>;
421 samsung,pin-pud = <0>;
422 samsung,pin-drv = <0>;
423 };
424
425 eint16: ext-int16 {
426 samsung,pins = "gpx2-0";
427 samsung,pin-function = <0xf>;
428 samsung,pin-pud = <0>;
429 samsung,pin-drv = <0>;
430 };
431
432 eint31: ext-int31 {
433 samsung,pins = "gpx3-7";
434 samsung,pin-function = <0xf>;
435 samsung,pin-pud = <0>;
436 samsung,pin-drv = <0>;
437 };
438 };
439
440 pinctrl@03860000 {
441 i2s0_bus: i2s0-bus {
442 samsung,pins = "gpz-0", "gpz-1", "gpz-2", "gpz-3",
443 "gpz-4", "gpz-5", "gpz-6";
444 samsung,pin-function = <0x2>;
445 samsung,pin-pud = <0>;
446 samsung,pin-drv = <0>;
447 };
448
449 pcm0_bus: pcm0-bus {
450 samsung,pins = "gpz-0", "gpz-1", "gpz-2", "gpz-3",
451 "gpz-4";
452 samsung,pin-function = <0x3>;
453 samsung,pin-pud = <0>;
454 samsung,pin-drv = <0>;
455 };
456 };
457};
diff --git a/arch/arm/boot/dts/exynos4210.dtsi b/arch/arm/boot/dts/exynos4210.dtsi
index 02891fe876e4..a4bd0c9a206e 100644
--- a/arch/arm/boot/dts/exynos4210.dtsi
+++ b/arch/arm/boot/dts/exynos4210.dtsi
@@ -20,6 +20,7 @@
20*/ 20*/
21 21
22/include/ "skeleton.dtsi" 22/include/ "skeleton.dtsi"
23/include/ "exynos4210-pinctrl.dtsi"
23 24
24/ { 25/ {
25 compatible = "samsung,exynos4210"; 26 compatible = "samsung,exynos4210";
@@ -29,6 +30,9 @@
29 spi0 = &spi_0; 30 spi0 = &spi_0;
30 spi1 = &spi_1; 31 spi1 = &spi_1;
31 spi2 = &spi_2; 32 spi2 = &spi_2;
33 pinctrl0 = &pinctrl_0;
34 pinctrl1 = &pinctrl_1;
35 pinctrl2 = &pinctrl_2;
32 }; 36 };
33 37
34 gic:interrupt-controller@10490000 { 38 gic:interrupt-controller@10490000 {
@@ -50,6 +54,39 @@
50 <0 12 0>, <0 13 0>, <0 14 0>, <0 15 0>; 54 <0 12 0>, <0 13 0>, <0 14 0>, <0 15 0>;
51 }; 55 };
52 56
57 pinctrl_0: pinctrl@11400000 {
58 compatible = "samsung,pinctrl-exynos4210";
59 reg = <0x11400000 0x1000>;
60 interrupts = <0 47 0>;
61 interrupt-controller;
62 #interrupt-cells = <2>;
63 };
64
65 pinctrl_1: pinctrl@11000000 {
66 compatible = "samsung,pinctrl-exynos4210";
67 reg = <0x11000000 0x1000>;
68 interrupts = <0 46 0>;
69 interrupt-controller;
70 #interrupt-cells = <2>;
71
72 wakup_eint: wakeup-interrupt-controller {
73 compatible = "samsung,exynos4210-wakeup-eint";
74 interrupt-parent = <&gic>;
75 interrupt-controller;
76 #interrupt-cells = <2>;
77 interrupts = <0 16 0>, <0 17 0>, <0 18 0>, <0 19 0>,
78 <0 20 0>, <0 21 0>, <0 22 0>, <0 23 0>,
79 <0 24 0>, <0 25 0>, <0 26 0>, <0 27 0>,
80 <0 28 0>, <0 29 0>, <0 30 0>, <0 31 0>,
81 <0 32 0>;
82 };
83 };
84
85 pinctrl_2: pinctrl@03860000 {
86 compatible = "samsung,pinctrl-exynos4210";
87 reg = <0x03860000 0x1000>;
88 };
89
53 watchdog@10060000 { 90 watchdog@10060000 {
54 compatible = "samsung,s3c2410-wdt"; 91 compatible = "samsung,s3c2410-wdt";
55 reg = <0x10060000 0x100>; 92 reg = <0x10060000 0x100>;
diff --git a/arch/arm/boot/dts/exynos5250.dtsi b/arch/arm/boot/dts/exynos5250.dtsi
index 004aaa8d123c..b55794b494b4 100644
--- a/arch/arm/boot/dts/exynos5250.dtsi
+++ b/arch/arm/boot/dts/exynos5250.dtsi
@@ -27,6 +27,10 @@
27 spi0 = &spi_0; 27 spi0 = &spi_0;
28 spi1 = &spi_1; 28 spi1 = &spi_1;
29 spi2 = &spi_2; 29 spi2 = &spi_2;
30 gsc0 = &gsc_0;
31 gsc1 = &gsc_1;
32 gsc2 = &gsc_2;
33 gsc3 = &gsc_3;
30 }; 34 };
31 35
32 gic:interrupt-controller@10481000 { 36 gic:interrupt-controller@10481000 {
@@ -460,4 +464,28 @@
460 #gpio-cells = <4>; 464 #gpio-cells = <4>;
461 }; 465 };
462 }; 466 };
467
468 gsc_0: gsc@0x13e00000 {
469 compatible = "samsung,exynos5-gsc";
470 reg = <0x13e00000 0x1000>;
471 interrupts = <0 85 0>;
472 };
473
474 gsc_1: gsc@0x13e10000 {
475 compatible = "samsung,exynos5-gsc";
476 reg = <0x13e10000 0x1000>;
477 interrupts = <0 86 0>;
478 };
479
480 gsc_2: gsc@0x13e20000 {
481 compatible = "samsung,exynos5-gsc";
482 reg = <0x13e20000 0x1000>;
483 interrupts = <0 87 0>;
484 };
485
486 gsc_3: gsc@0x13e30000 {
487 compatible = "samsung,exynos5-gsc";
488 reg = <0x13e30000 0x1000>;
489 interrupts = <0 88 0>;
490 };
463}; 491};
diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index 5d1c48459e6e..3883f94fdbd0 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -430,5 +430,13 @@
430 hw-caps-ll-interface; 430 hw-caps-ll-interface;
431 hw-caps-temp-alert; 431 hw-caps-temp-alert;
432 }; 432 };
433
434 ocp2scp {
435 compatible = "ti,omap-ocp2scp";
436 #address-cells = <1>;
437 #size-cells = <1>;
438 ranges;
439 ti,hwmods = "ocp2scp_usb_phy";
440 };
433 }; 441 };
434}; 442};
diff --git a/arch/arm/configs/afeb9260_defconfig b/arch/arm/configs/afeb9260_defconfig
index 2afdf67c2127..c285a9d777d9 100644
--- a/arch/arm/configs/afeb9260_defconfig
+++ b/arch/arm/configs/afeb9260_defconfig
@@ -39,7 +39,6 @@ CONFIG_MTD_BLOCK=y
39CONFIG_MTD_DATAFLASH=y 39CONFIG_MTD_DATAFLASH=y
40CONFIG_MTD_NAND=y 40CONFIG_MTD_NAND=y
41CONFIG_MTD_NAND_ATMEL=y 41CONFIG_MTD_NAND_ATMEL=y
42CONFIG_MTD_NAND_ATMEL_ECC_SOFT=y
43CONFIG_BLK_DEV_RAM=y 42CONFIG_BLK_DEV_RAM=y
44CONFIG_BLK_DEV_RAM_SIZE=8192 43CONFIG_BLK_DEV_RAM_SIZE=8192
45CONFIG_ATMEL_SSC=y 44CONFIG_ATMEL_SSC=y
diff --git a/arch/arm/configs/at91rm9200_defconfig b/arch/arm/configs/at91rm9200_defconfig
index d54e2acd3ab1..4ae57a34a582 100644
--- a/arch/arm/configs/at91rm9200_defconfig
+++ b/arch/arm/configs/at91rm9200_defconfig
@@ -232,7 +232,7 @@ CONFIG_USB_GADGET=y
232CONFIG_USB_ETH=m 232CONFIG_USB_ETH=m
233CONFIG_USB_MASS_STORAGE=m 233CONFIG_USB_MASS_STORAGE=m
234CONFIG_MMC=y 234CONFIG_MMC=y
235CONFIG_MMC_AT91=y 235CONFIG_MMC_ATMELMCI=y
236CONFIG_NEW_LEDS=y 236CONFIG_NEW_LEDS=y
237CONFIG_LEDS_CLASS=y 237CONFIG_LEDS_CLASS=y
238CONFIG_LEDS_GPIO=y 238CONFIG_LEDS_GPIO=y
diff --git a/arch/arm/configs/at91sam9261_defconfig b/arch/arm/configs/at91sam9261_defconfig
index ade6b2f23116..1e8712ef062e 100644
--- a/arch/arm/configs/at91sam9261_defconfig
+++ b/arch/arm/configs/at91sam9261_defconfig
@@ -128,7 +128,7 @@ CONFIG_USB_GADGETFS=m
128CONFIG_USB_FILE_STORAGE=m 128CONFIG_USB_FILE_STORAGE=m
129CONFIG_USB_G_SERIAL=m 129CONFIG_USB_G_SERIAL=m
130CONFIG_MMC=y 130CONFIG_MMC=y
131CONFIG_MMC_AT91=m 131CONFIG_MMC_ATMELMCI=m
132CONFIG_NEW_LEDS=y 132CONFIG_NEW_LEDS=y
133CONFIG_LEDS_CLASS=y 133CONFIG_LEDS_CLASS=y
134CONFIG_LEDS_GPIO=y 134CONFIG_LEDS_GPIO=y
diff --git a/arch/arm/configs/at91sam9263_defconfig b/arch/arm/configs/at91sam9263_defconfig
index 1cf96264cba1..d2050cada82d 100644
--- a/arch/arm/configs/at91sam9263_defconfig
+++ b/arch/arm/configs/at91sam9263_defconfig
@@ -61,7 +61,6 @@ CONFIG_MTD_DATAFLASH=y
61CONFIG_MTD_BLOCK2MTD=y 61CONFIG_MTD_BLOCK2MTD=y
62CONFIG_MTD_NAND=y 62CONFIG_MTD_NAND=y
63CONFIG_MTD_NAND_ATMEL=y 63CONFIG_MTD_NAND_ATMEL=y
64CONFIG_MTD_NAND_ATMEL_ECC_SOFT=y
65CONFIG_MTD_UBI=y 64CONFIG_MTD_UBI=y
66CONFIG_MTD_UBI_GLUEBI=y 65CONFIG_MTD_UBI_GLUEBI=y
67CONFIG_BLK_DEV_LOOP=y 66CONFIG_BLK_DEV_LOOP=y
@@ -138,7 +137,7 @@ CONFIG_USB_FILE_STORAGE=m
138CONFIG_USB_G_SERIAL=m 137CONFIG_USB_G_SERIAL=m
139CONFIG_MMC=y 138CONFIG_MMC=y
140CONFIG_SDIO_UART=m 139CONFIG_SDIO_UART=m
141CONFIG_MMC_AT91=m 140CONFIG_MMC_ATMELMCI=m
142CONFIG_NEW_LEDS=y 141CONFIG_NEW_LEDS=y
143CONFIG_LEDS_CLASS=y 142CONFIG_LEDS_CLASS=y
144CONFIG_LEDS_ATMEL_PWM=y 143CONFIG_LEDS_ATMEL_PWM=y
diff --git a/arch/arm/configs/at91sam9g20_defconfig b/arch/arm/configs/at91sam9g20_defconfig
index 994d331b2319..e1b0e80b54a5 100644
--- a/arch/arm/configs/at91sam9g20_defconfig
+++ b/arch/arm/configs/at91sam9g20_defconfig
@@ -99,7 +99,7 @@ CONFIG_USB_GADGETFS=m
99CONFIG_USB_FILE_STORAGE=m 99CONFIG_USB_FILE_STORAGE=m
100CONFIG_USB_G_SERIAL=m 100CONFIG_USB_G_SERIAL=m
101CONFIG_MMC=y 101CONFIG_MMC=y
102CONFIG_MMC_AT91=m 102CONFIG_MMC_ATMELMCI=m
103CONFIG_NEW_LEDS=y 103CONFIG_NEW_LEDS=y
104CONFIG_LEDS_CLASS=y 104CONFIG_LEDS_CLASS=y
105CONFIG_LEDS_GPIO=y 105CONFIG_LEDS_GPIO=y
diff --git a/arch/arm/configs/at91sam9rl_defconfig b/arch/arm/configs/at91sam9rl_defconfig
index ad562ee64209..7cf87856d63c 100644
--- a/arch/arm/configs/at91sam9rl_defconfig
+++ b/arch/arm/configs/at91sam9rl_defconfig
@@ -60,7 +60,7 @@ CONFIG_AT91SAM9X_WATCHDOG=y
60CONFIG_FB=y 60CONFIG_FB=y
61CONFIG_FB_ATMEL=y 61CONFIG_FB_ATMEL=y
62CONFIG_MMC=y 62CONFIG_MMC=y
63CONFIG_MMC_AT91=m 63CONFIG_MMC_ATMELMCI=m
64CONFIG_RTC_CLASS=y 64CONFIG_RTC_CLASS=y
65CONFIG_RTC_DRV_AT91SAM9=y 65CONFIG_RTC_DRV_AT91SAM9=y
66CONFIG_EXT2_FS=y 66CONFIG_EXT2_FS=y
diff --git a/arch/arm/configs/cpu9260_defconfig b/arch/arm/configs/cpu9260_defconfig
index bbf729e2fb6f..921480c23b98 100644
--- a/arch/arm/configs/cpu9260_defconfig
+++ b/arch/arm/configs/cpu9260_defconfig
@@ -82,7 +82,7 @@ CONFIG_USB_STORAGE=y
82CONFIG_USB_GADGET=y 82CONFIG_USB_GADGET=y
83CONFIG_USB_ETH=m 83CONFIG_USB_ETH=m
84CONFIG_MMC=y 84CONFIG_MMC=y
85CONFIG_MMC_AT91=m 85CONFIG_MMC_ATMELMCI=m
86CONFIG_NEW_LEDS=y 86CONFIG_NEW_LEDS=y
87CONFIG_LEDS_CLASS=y 87CONFIG_LEDS_CLASS=y
88CONFIG_LEDS_GPIO=y 88CONFIG_LEDS_GPIO=y
diff --git a/arch/arm/configs/cpu9g20_defconfig b/arch/arm/configs/cpu9g20_defconfig
index e7d7942927f3..ea116cbdffa1 100644
--- a/arch/arm/configs/cpu9g20_defconfig
+++ b/arch/arm/configs/cpu9g20_defconfig
@@ -82,7 +82,7 @@ CONFIG_USB_STORAGE=y
82CONFIG_USB_GADGET=y 82CONFIG_USB_GADGET=y
83CONFIG_USB_ETH=m 83CONFIG_USB_ETH=m
84CONFIG_MMC=y 84CONFIG_MMC=y
85CONFIG_MMC_AT91=m 85CONFIG_MMC_ATMELMCI=m
86CONFIG_NEW_LEDS=y 86CONFIG_NEW_LEDS=y
87CONFIG_LEDS_CLASS=y 87CONFIG_LEDS_CLASS=y
88CONFIG_LEDS_GPIO=y 88CONFIG_LEDS_GPIO=y
diff --git a/arch/arm/configs/qil-a9260_defconfig b/arch/arm/configs/qil-a9260_defconfig
index 9160f3b7751f..42d5db1876ab 100644
--- a/arch/arm/configs/qil-a9260_defconfig
+++ b/arch/arm/configs/qil-a9260_defconfig
@@ -50,7 +50,6 @@ CONFIG_MTD_BLOCK=y
50CONFIG_MTD_DATAFLASH=y 50CONFIG_MTD_DATAFLASH=y
51CONFIG_MTD_NAND=y 51CONFIG_MTD_NAND=y
52CONFIG_MTD_NAND_ATMEL=y 52CONFIG_MTD_NAND_ATMEL=y
53CONFIG_MTD_NAND_ATMEL_ECC_SOFT=y
54CONFIG_BLK_DEV_LOOP=y 53CONFIG_BLK_DEV_LOOP=y
55# CONFIG_MISC_DEVICES is not set 54# CONFIG_MISC_DEVICES is not set
56CONFIG_SCSI=y 55CONFIG_SCSI=y
@@ -87,7 +86,7 @@ CONFIG_USB_STORAGE=y
87CONFIG_USB_GADGET=y 86CONFIG_USB_GADGET=y
88CONFIG_USB_ETH=m 87CONFIG_USB_ETH=m
89CONFIG_MMC=y 88CONFIG_MMC=y
90CONFIG_MMC_AT91=m 89CONFIG_MMC_ATMELMCI=m
91CONFIG_NEW_LEDS=y 90CONFIG_NEW_LEDS=y
92CONFIG_LEDS_CLASS=y 91CONFIG_LEDS_CLASS=y
93CONFIG_LEDS_GPIO=y 92CONFIG_LEDS_GPIO=y
diff --git a/arch/arm/configs/stamp9g20_defconfig b/arch/arm/configs/stamp9g20_defconfig
index d5e260b8b160..52f1488591c7 100644
--- a/arch/arm/configs/stamp9g20_defconfig
+++ b/arch/arm/configs/stamp9g20_defconfig
@@ -100,7 +100,6 @@ CONFIG_USB_ETH=m
100CONFIG_USB_FILE_STORAGE=m 100CONFIG_USB_FILE_STORAGE=m
101CONFIG_USB_G_SERIAL=m 101CONFIG_USB_G_SERIAL=m
102CONFIG_MMC=y 102CONFIG_MMC=y
103# CONFIG_MMC_AT91 is not set
104CONFIG_MMC_ATMELMCI=y 103CONFIG_MMC_ATMELMCI=y
105CONFIG_NEW_LEDS=y 104CONFIG_NEW_LEDS=y
106CONFIG_LEDS_CLASS=y 105CONFIG_LEDS_CLASS=y
diff --git a/arch/arm/configs/usb-a9260_defconfig b/arch/arm/configs/usb-a9260_defconfig
index 2e39f38b9627..a1501e1e1a90 100644
--- a/arch/arm/configs/usb-a9260_defconfig
+++ b/arch/arm/configs/usb-a9260_defconfig
@@ -49,7 +49,6 @@ CONFIG_MTD_BLOCK=y
49CONFIG_MTD_DATAFLASH=y 49CONFIG_MTD_DATAFLASH=y
50CONFIG_MTD_NAND=y 50CONFIG_MTD_NAND=y
51CONFIG_MTD_NAND_ATMEL=y 51CONFIG_MTD_NAND_ATMEL=y
52CONFIG_MTD_NAND_ATMEL_ECC_SOFT=y
53CONFIG_BLK_DEV_LOOP=y 52CONFIG_BLK_DEV_LOOP=y
54# CONFIG_MISC_DEVICES is not set 53# CONFIG_MISC_DEVICES is not set
55CONFIG_SCSI=y 54CONFIG_SCSI=y
diff --git a/arch/arm/include/asm/leds.h b/arch/arm/include/asm/leds.h
deleted file mode 100644
index c545739f39b7..000000000000
--- a/arch/arm/include/asm/leds.h
+++ /dev/null
@@ -1,50 +0,0 @@
1/*
2 * arch/arm/include/asm/leds.h
3 *
4 * Copyright (C) 1998 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * Event-driven interface for LEDs on machines
11 * Added led_start and led_stop- Alex Holden, 28th Dec 1998.
12 */
13#ifndef ASM_ARM_LEDS_H
14#define ASM_ARM_LEDS_H
15
16
17typedef enum {
18 led_idle_start,
19 led_idle_end,
20 led_timer,
21 led_start,
22 led_stop,
23 led_claim, /* override idle & timer leds */
24 led_release, /* restore idle & timer leds */
25 led_start_timer_mode,
26 led_stop_timer_mode,
27 led_green_on,
28 led_green_off,
29 led_amber_on,
30 led_amber_off,
31 led_red_on,
32 led_red_off,
33 led_blue_on,
34 led_blue_off,
35 /*
36 * I want this between led_timer and led_start, but
37 * someone has decided to export this to user space
38 */
39 led_halted
40} led_event_t;
41
42/* Use this routine to handle LEDs */
43
44#ifdef CONFIG_LEDS
45extern void (*leds_event)(led_event_t);
46#else
47#define leds_event(e)
48#endif
49
50#endif
diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile
index 1c4321430737..d81f3a6d9ad8 100644
--- a/arch/arm/kernel/Makefile
+++ b/arch/arm/kernel/Makefile
@@ -21,7 +21,6 @@ obj-y := elf.o entry-armv.o entry-common.o irq.o opcodes.o \
21 21
22obj-$(CONFIG_DEPRECATED_PARAM_STRUCT) += compat.o 22obj-$(CONFIG_DEPRECATED_PARAM_STRUCT) += compat.o
23 23
24obj-$(CONFIG_LEDS) += leds.o
25obj-$(CONFIG_OC_ETM) += etm.o 24obj-$(CONFIG_OC_ETM) += etm.o
26obj-$(CONFIG_CPU_IDLE) += cpuidle.o 25obj-$(CONFIG_CPU_IDLE) += cpuidle.o
27obj-$(CONFIG_ISA_DMA_API) += dma.o 26obj-$(CONFIG_ISA_DMA_API) += dma.o
diff --git a/arch/arm/kernel/leds.c b/arch/arm/kernel/leds.c
deleted file mode 100644
index 1911dae19e4f..000000000000
--- a/arch/arm/kernel/leds.c
+++ /dev/null
@@ -1,121 +0,0 @@
1/*
2 * LED support code, ripped out of arch/arm/kernel/time.c
3 *
4 * Copyright (C) 1994-2001 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#include <linux/export.h>
11#include <linux/init.h>
12#include <linux/device.h>
13#include <linux/syscore_ops.h>
14#include <linux/string.h>
15
16#include <asm/leds.h>
17
18static void dummy_leds_event(led_event_t evt)
19{
20}
21
22void (*leds_event)(led_event_t) = dummy_leds_event;
23
24struct leds_evt_name {
25 const char name[8];
26 int on;
27 int off;
28};
29
30static const struct leds_evt_name evt_names[] = {
31 { "amber", led_amber_on, led_amber_off },
32 { "blue", led_blue_on, led_blue_off },
33 { "green", led_green_on, led_green_off },
34 { "red", led_red_on, led_red_off },
35};
36
37static ssize_t leds_store(struct device *dev,
38 struct device_attribute *attr,
39 const char *buf, size_t size)
40{
41 int ret = -EINVAL, len = strcspn(buf, " ");
42
43 if (len > 0 && buf[len] == '\0')
44 len--;
45
46 if (strncmp(buf, "claim", len) == 0) {
47 leds_event(led_claim);
48 ret = size;
49 } else if (strncmp(buf, "release", len) == 0) {
50 leds_event(led_release);
51 ret = size;
52 } else {
53 int i;
54
55 for (i = 0; i < ARRAY_SIZE(evt_names); i++) {
56 if (strlen(evt_names[i].name) != len ||
57 strncmp(buf, evt_names[i].name, len) != 0)
58 continue;
59 if (strncmp(buf+len, " on", 3) == 0) {
60 leds_event(evt_names[i].on);
61 ret = size;
62 } else if (strncmp(buf+len, " off", 4) == 0) {
63 leds_event(evt_names[i].off);
64 ret = size;
65 }
66 break;
67 }
68 }
69 return ret;
70}
71
72static DEVICE_ATTR(event, 0200, NULL, leds_store);
73
74static struct bus_type leds_subsys = {
75 .name = "leds",
76 .dev_name = "leds",
77};
78
79static struct device leds_device = {
80 .id = 0,
81 .bus = &leds_subsys,
82};
83
84static int leds_suspend(void)
85{
86 leds_event(led_stop);
87 return 0;
88}
89
90static void leds_resume(void)
91{
92 leds_event(led_start);
93}
94
95static void leds_shutdown(void)
96{
97 leds_event(led_halted);
98}
99
100static struct syscore_ops leds_syscore_ops = {
101 .shutdown = leds_shutdown,
102 .suspend = leds_suspend,
103 .resume = leds_resume,
104};
105
106static int __init leds_init(void)
107{
108 int ret;
109 ret = subsys_system_register(&leds_subsys, NULL);
110 if (ret == 0)
111 ret = device_register(&leds_device);
112 if (ret == 0)
113 ret = device_create_file(&leds_device, &dev_attr_event);
114 if (ret == 0)
115 register_syscore_ops(&leds_syscore_ops);
116 return ret;
117}
118
119device_initcall(leds_init);
120
121EXPORT_SYMBOL(leds_event);
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index 693b744fd572..04eea22d7958 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -31,9 +31,9 @@
31#include <linux/random.h> 31#include <linux/random.h>
32#include <linux/hw_breakpoint.h> 32#include <linux/hw_breakpoint.h>
33#include <linux/cpuidle.h> 33#include <linux/cpuidle.h>
34#include <linux/leds.h>
34 35
35#include <asm/cacheflush.h> 36#include <asm/cacheflush.h>
36#include <asm/leds.h>
37#include <asm/processor.h> 37#include <asm/processor.h>
38#include <asm/thread_notify.h> 38#include <asm/thread_notify.h>
39#include <asm/stacktrace.h> 39#include <asm/stacktrace.h>
@@ -189,7 +189,7 @@ void cpu_idle(void)
189 while (1) { 189 while (1) {
190 tick_nohz_idle_enter(); 190 tick_nohz_idle_enter();
191 rcu_idle_enter(); 191 rcu_idle_enter();
192 leds_event(led_idle_start); 192 ledtrig_cpu(CPU_LED_IDLE_START);
193 while (!need_resched()) { 193 while (!need_resched()) {
194#ifdef CONFIG_HOTPLUG_CPU 194#ifdef CONFIG_HOTPLUG_CPU
195 if (cpu_is_offline(smp_processor_id())) 195 if (cpu_is_offline(smp_processor_id()))
@@ -220,7 +220,7 @@ void cpu_idle(void)
220 } else 220 } else
221 local_irq_enable(); 221 local_irq_enable();
222 } 222 }
223 leds_event(led_idle_end); 223 ledtrig_cpu(CPU_LED_IDLE_END);
224 rcu_idle_exit(); 224 rcu_idle_exit();
225 tick_nohz_idle_exit(); 225 tick_nohz_idle_exit();
226 schedule_preempt_disabled(); 226 schedule_preempt_disabled();
diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c
index af2afb019672..09be0c3c9069 100644
--- a/arch/arm/kernel/time.c
+++ b/arch/arm/kernel/time.c
@@ -25,7 +25,6 @@
25#include <linux/timer.h> 25#include <linux/timer.h>
26#include <linux/irq.h> 26#include <linux/irq.h>
27 27
28#include <asm/leds.h>
29#include <asm/thread_info.h> 28#include <asm/thread_info.h>
30#include <asm/sched_clock.h> 29#include <asm/sched_clock.h>
31#include <asm/stacktrace.h> 30#include <asm/stacktrace.h>
@@ -80,21 +79,6 @@ u32 arch_gettimeoffset(void)
80} 79}
81#endif /* CONFIG_ARCH_USES_GETTIMEOFFSET */ 80#endif /* CONFIG_ARCH_USES_GETTIMEOFFSET */
82 81
83#ifdef CONFIG_LEDS_TIMER
84static inline void do_leds(void)
85{
86 static unsigned int count = HZ/2;
87
88 if (--count == 0) {
89 count = HZ/2;
90 leds_event(led_timer);
91 }
92}
93#else
94#define do_leds()
95#endif
96
97
98#ifndef CONFIG_GENERIC_CLOCKEVENTS 82#ifndef CONFIG_GENERIC_CLOCKEVENTS
99/* 83/*
100 * Kernel system timer support. 84 * Kernel system timer support.
@@ -102,7 +86,6 @@ static inline void do_leds(void)
102void timer_tick(void) 86void timer_tick(void)
103{ 87{
104 profile_tick(CPU_PROFILING); 88 profile_tick(CPU_PROFILING);
105 do_leds();
106 xtime_update(1); 89 xtime_update(1);
107#ifndef CONFIG_SMP 90#ifndef CONFIG_SMP
108 update_process_times(user_mode(get_irq_regs())); 91 update_process_times(user_mode(get_irq_regs()));
diff --git a/arch/arm/mach-at91/at91rm9200_devices.c b/arch/arm/mach-at91/at91rm9200_devices.c
index 01fb7325fecc..9ac427a702da 100644
--- a/arch/arm/mach-at91/at91rm9200_devices.c
+++ b/arch/arm/mach-at91/at91rm9200_devices.c
@@ -294,9 +294,9 @@ void __init at91_add_device_cf(struct at91_cf_data *data) {}
294 * MMC / SD 294 * MMC / SD
295 * -------------------------------------------------------------------- */ 295 * -------------------------------------------------------------------- */
296 296
297#if defined(CONFIG_MMC_AT91) || defined(CONFIG_MMC_AT91_MODULE) 297#if IS_ENABLED(CONFIG_MMC_ATMELMCI)
298static u64 mmc_dmamask = DMA_BIT_MASK(32); 298static u64 mmc_dmamask = DMA_BIT_MASK(32);
299static struct at91_mmc_data mmc_data; 299static struct mci_platform_data mmc_data;
300 300
301static struct resource mmc_resources[] = { 301static struct resource mmc_resources[] = {
302 [0] = { 302 [0] = {
@@ -312,7 +312,7 @@ static struct resource mmc_resources[] = {
312}; 312};
313 313
314static struct platform_device at91rm9200_mmc_device = { 314static struct platform_device at91rm9200_mmc_device = {
315 .name = "at91_mci", 315 .name = "atmel_mci",
316 .id = -1, 316 .id = -1,
317 .dev = { 317 .dev = {
318 .dma_mask = &mmc_dmamask, 318 .dma_mask = &mmc_dmamask,
@@ -323,53 +323,69 @@ static struct platform_device at91rm9200_mmc_device = {
323 .num_resources = ARRAY_SIZE(mmc_resources), 323 .num_resources = ARRAY_SIZE(mmc_resources),
324}; 324};
325 325
326void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) 326void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data)
327{ 327{
328 unsigned int i;
329 unsigned int slot_count = 0;
330
328 if (!data) 331 if (!data)
329 return; 332 return;
330 333
331 /* input/irq */ 334 for (i = 0; i < ATMCI_MAX_NR_SLOTS; i++) {
332 if (gpio_is_valid(data->det_pin)) {
333 at91_set_gpio_input(data->det_pin, 1);
334 at91_set_deglitch(data->det_pin, 1);
335 }
336 if (gpio_is_valid(data->wp_pin))
337 at91_set_gpio_input(data->wp_pin, 1);
338 if (gpio_is_valid(data->vcc_pin))
339 at91_set_gpio_output(data->vcc_pin, 0);
340
341 /* CLK */
342 at91_set_A_periph(AT91_PIN_PA27, 0);
343 335
344 if (data->slot_b) { 336 if (!data->slot[i].bus_width)
345 /* CMD */ 337 continue;
346 at91_set_B_periph(AT91_PIN_PA8, 1);
347 338
348 /* DAT0, maybe DAT1..DAT3 */ 339 /* input/irq */
349 at91_set_B_periph(AT91_PIN_PA9, 1); 340 if (gpio_is_valid(data->slot[i].detect_pin)) {
350 if (data->wire4) { 341 at91_set_gpio_input(data->slot[i].detect_pin, 1);
351 at91_set_B_periph(AT91_PIN_PA10, 1); 342 at91_set_deglitch(data->slot[i].detect_pin, 1);
352 at91_set_B_periph(AT91_PIN_PA11, 1);
353 at91_set_B_periph(AT91_PIN_PA12, 1);
354 } 343 }
355 } else { 344 if (gpio_is_valid(data->slot[i].wp_pin))
356 /* CMD */ 345 at91_set_gpio_input(data->slot[i].wp_pin, 1);
357 at91_set_A_periph(AT91_PIN_PA28, 1); 346
358 347 switch (i) {
359 /* DAT0, maybe DAT1..DAT3 */ 348 case 0: /* slot A */
360 at91_set_A_periph(AT91_PIN_PA29, 1); 349 /* CMD */
361 if (data->wire4) { 350 at91_set_A_periph(AT91_PIN_PA28, 1);
362 at91_set_B_periph(AT91_PIN_PB3, 1); 351 /* DAT0, maybe DAT1..DAT3 */
363 at91_set_B_periph(AT91_PIN_PB4, 1); 352 at91_set_A_periph(AT91_PIN_PA29, 1);
364 at91_set_B_periph(AT91_PIN_PB5, 1); 353 if (data->slot[i].bus_width == 4) {
354 at91_set_B_periph(AT91_PIN_PB3, 1);
355 at91_set_B_periph(AT91_PIN_PB4, 1);
356 at91_set_B_periph(AT91_PIN_PB5, 1);
357 }
358 slot_count++;
359 break;
360 case 1: /* slot B */
361 /* CMD */
362 at91_set_B_periph(AT91_PIN_PA8, 1);
363 /* DAT0, maybe DAT1..DAT3 */
364 at91_set_B_periph(AT91_PIN_PA9, 1);
365 if (data->slot[i].bus_width == 4) {
366 at91_set_B_periph(AT91_PIN_PA10, 1);
367 at91_set_B_periph(AT91_PIN_PA11, 1);
368 at91_set_B_periph(AT91_PIN_PA12, 1);
369 }
370 slot_count++;
371 break;
372 default:
373 printk(KERN_ERR
374 "AT91: SD/MMC slot %d not available\n", i);
375 break;
376 }
377 if (slot_count) {
378 /* CLK */
379 at91_set_A_periph(AT91_PIN_PA27, 0);
380
381 mmc_data = *data;
382 platform_device_register(&at91rm9200_mmc_device);
365 } 383 }
366 } 384 }
367 385
368 mmc_data = *data;
369 platform_device_register(&at91rm9200_mmc_device);
370} 386}
371#else 387#else
372void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {} 388void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data) {}
373#endif 389#endif
374 390
375 391
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c
index bce572a530ef..af50ff3281c7 100644
--- a/arch/arm/mach-at91/at91sam9260_devices.c
+++ b/arch/arm/mach-at91/at91sam9260_devices.c
@@ -209,92 +209,10 @@ void __init at91_add_device_eth(struct macb_platform_data *data) {}
209 209
210 210
211/* -------------------------------------------------------------------- 211/* --------------------------------------------------------------------
212 * MMC / SD
213 * -------------------------------------------------------------------- */
214
215#if defined(CONFIG_MMC_AT91) || defined(CONFIG_MMC_AT91_MODULE)
216static u64 mmc_dmamask = DMA_BIT_MASK(32);
217static struct at91_mmc_data mmc_data;
218
219static struct resource mmc_resources[] = {
220 [0] = {
221 .start = AT91SAM9260_BASE_MCI,
222 .end = AT91SAM9260_BASE_MCI + SZ_16K - 1,
223 .flags = IORESOURCE_MEM,
224 },
225 [1] = {
226 .start = NR_IRQS_LEGACY + AT91SAM9260_ID_MCI,
227 .end = NR_IRQS_LEGACY + AT91SAM9260_ID_MCI,
228 .flags = IORESOURCE_IRQ,
229 },
230};
231
232static struct platform_device at91sam9260_mmc_device = {
233 .name = "at91_mci",
234 .id = -1,
235 .dev = {
236 .dma_mask = &mmc_dmamask,
237 .coherent_dma_mask = DMA_BIT_MASK(32),
238 .platform_data = &mmc_data,
239 },
240 .resource = mmc_resources,
241 .num_resources = ARRAY_SIZE(mmc_resources),
242};
243
244void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data)
245{
246 if (!data)
247 return;
248
249 /* input/irq */
250 if (gpio_is_valid(data->det_pin)) {
251 at91_set_gpio_input(data->det_pin, 1);
252 at91_set_deglitch(data->det_pin, 1);
253 }
254 if (gpio_is_valid(data->wp_pin))
255 at91_set_gpio_input(data->wp_pin, 1);
256 if (gpio_is_valid(data->vcc_pin))
257 at91_set_gpio_output(data->vcc_pin, 0);
258
259 /* CLK */
260 at91_set_A_periph(AT91_PIN_PA8, 0);
261
262 if (data->slot_b) {
263 /* CMD */
264 at91_set_B_periph(AT91_PIN_PA1, 1);
265
266 /* DAT0, maybe DAT1..DAT3 */
267 at91_set_B_periph(AT91_PIN_PA0, 1);
268 if (data->wire4) {
269 at91_set_B_periph(AT91_PIN_PA5, 1);
270 at91_set_B_periph(AT91_PIN_PA4, 1);
271 at91_set_B_periph(AT91_PIN_PA3, 1);
272 }
273 } else {
274 /* CMD */
275 at91_set_A_periph(AT91_PIN_PA7, 1);
276
277 /* DAT0, maybe DAT1..DAT3 */
278 at91_set_A_periph(AT91_PIN_PA6, 1);
279 if (data->wire4) {
280 at91_set_A_periph(AT91_PIN_PA9, 1);
281 at91_set_A_periph(AT91_PIN_PA10, 1);
282 at91_set_A_periph(AT91_PIN_PA11, 1);
283 }
284 }
285
286 mmc_data = *data;
287 platform_device_register(&at91sam9260_mmc_device);
288}
289#else
290void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {}
291#endif
292
293/* --------------------------------------------------------------------
294 * MMC / SD Slot for Atmel MCI Driver 212 * MMC / SD Slot for Atmel MCI Driver
295 * -------------------------------------------------------------------- */ 213 * -------------------------------------------------------------------- */
296 214
297#if defined(CONFIG_MMC_ATMELMCI) || defined(CONFIG_MMC_ATMELMCI_MODULE) 215#if IS_ENABLED(CONFIG_MMC_ATMELMCI)
298static u64 mmc_dmamask = DMA_BIT_MASK(32); 216static u64 mmc_dmamask = DMA_BIT_MASK(32);
299static struct mci_platform_data mmc_data; 217static struct mci_platform_data mmc_data;
300 218
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c
index bc2590d712d0..11e9fa835cde 100644
--- a/arch/arm/mach-at91/at91sam9261_devices.c
+++ b/arch/arm/mach-at91/at91sam9261_devices.c
@@ -137,9 +137,9 @@ void __init at91_add_device_udc(struct at91_udc_data *data) {}
137 * MMC / SD 137 * MMC / SD
138 * -------------------------------------------------------------------- */ 138 * -------------------------------------------------------------------- */
139 139
140#if defined(CONFIG_MMC_AT91) || defined(CONFIG_MMC_AT91_MODULE) 140#if IS_ENABLED(CONFIG_MMC_ATMELMCI)
141static u64 mmc_dmamask = DMA_BIT_MASK(32); 141static u64 mmc_dmamask = DMA_BIT_MASK(32);
142static struct at91_mmc_data mmc_data; 142static struct mci_platform_data mmc_data;
143 143
144static struct resource mmc_resources[] = { 144static struct resource mmc_resources[] = {
145 [0] = { 145 [0] = {
@@ -155,7 +155,7 @@ static struct resource mmc_resources[] = {
155}; 155};
156 156
157static struct platform_device at91sam9261_mmc_device = { 157static struct platform_device at91sam9261_mmc_device = {
158 .name = "at91_mci", 158 .name = "atmel_mci",
159 .id = -1, 159 .id = -1,
160 .dev = { 160 .dev = {
161 .dma_mask = &mmc_dmamask, 161 .dma_mask = &mmc_dmamask,
@@ -166,40 +166,40 @@ static struct platform_device at91sam9261_mmc_device = {
166 .num_resources = ARRAY_SIZE(mmc_resources), 166 .num_resources = ARRAY_SIZE(mmc_resources),
167}; 167};
168 168
169void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) 169void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data)
170{ 170{
171 if (!data) 171 if (!data)
172 return; 172 return;
173 173
174 /* input/irq */ 174 if (data->slot[0].bus_width) {
175 if (gpio_is_valid(data->det_pin)) { 175 /* input/irq */
176 at91_set_gpio_input(data->det_pin, 1); 176 if (gpio_is_valid(data->slot[0].detect_pin)) {
177 at91_set_deglitch(data->det_pin, 1); 177 at91_set_gpio_input(data->slot[0].detect_pin, 1);
178 } 178 at91_set_deglitch(data->slot[0].detect_pin, 1);
179 if (gpio_is_valid(data->wp_pin)) 179 }
180 at91_set_gpio_input(data->wp_pin, 1); 180 if (gpio_is_valid(data->slot[0].wp_pin))
181 if (gpio_is_valid(data->vcc_pin)) 181 at91_set_gpio_input(data->slot[0].wp_pin, 1);
182 at91_set_gpio_output(data->vcc_pin, 0); 182
183 183 /* CLK */
184 /* CLK */ 184 at91_set_B_periph(AT91_PIN_PA2, 0);
185 at91_set_B_periph(AT91_PIN_PA2, 0);
186
187 /* CMD */
188 at91_set_B_periph(AT91_PIN_PA1, 1);
189
190 /* DAT0, maybe DAT1..DAT3 */
191 at91_set_B_periph(AT91_PIN_PA0, 1);
192 if (data->wire4) {
193 at91_set_B_periph(AT91_PIN_PA4, 1);
194 at91_set_B_periph(AT91_PIN_PA5, 1);
195 at91_set_B_periph(AT91_PIN_PA6, 1);
196 }
197 185
198 mmc_data = *data; 186 /* CMD */
199 platform_device_register(&at91sam9261_mmc_device); 187 at91_set_B_periph(AT91_PIN_PA1, 1);
188
189 /* DAT0, maybe DAT1..DAT3 */
190 at91_set_B_periph(AT91_PIN_PA0, 1);
191 if (data->slot[0].bus_width == 4) {
192 at91_set_B_periph(AT91_PIN_PA4, 1);
193 at91_set_B_periph(AT91_PIN_PA5, 1);
194 at91_set_B_periph(AT91_PIN_PA6, 1);
195 }
196
197 mmc_data = *data;
198 platform_device_register(&at91sam9261_mmc_device);
199 }
200} 200}
201#else 201#else
202void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {} 202void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data) {}
203#endif 203#endif
204 204
205 205
diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-at91/at91sam9263.c
index 84b38105231e..144ef5de51b6 100644
--- a/arch/arm/mach-at91/at91sam9263.c
+++ b/arch/arm/mach-at91/at91sam9263.c
@@ -188,8 +188,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
188 CLKDEV_CON_ID("hclk", &macb_clk), 188 CLKDEV_CON_ID("hclk", &macb_clk),
189 CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk), 189 CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk),
190 CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk), 190 CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk),
191 CLKDEV_CON_DEV_ID("mci_clk", "at91_mci.0", &mmc0_clk), 191 CLKDEV_CON_DEV_ID("mci_clk", "atmel_mci.0", &mmc0_clk),
192 CLKDEV_CON_DEV_ID("mci_clk", "at91_mci.1", &mmc1_clk), 192 CLKDEV_CON_DEV_ID("mci_clk", "atmel_mci.1", &mmc1_clk),
193 CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.0", &spi0_clk), 193 CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.0", &spi0_clk),
194 CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.1", &spi1_clk), 194 CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.1", &spi1_clk),
195 CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tcb_clk), 195 CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tcb_clk),
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c
index 9b6ca734f1a9..7c0898fe20fa 100644
--- a/arch/arm/mach-at91/at91sam9263_devices.c
+++ b/arch/arm/mach-at91/at91sam9263_devices.c
@@ -218,9 +218,9 @@ void __init at91_add_device_eth(struct macb_platform_data *data) {}
218 * MMC / SD 218 * MMC / SD
219 * -------------------------------------------------------------------- */ 219 * -------------------------------------------------------------------- */
220 220
221#if defined(CONFIG_MMC_AT91) || defined(CONFIG_MMC_AT91_MODULE) 221#if IS_ENABLED(CONFIG_MMC_ATMELMCI)
222static u64 mmc_dmamask = DMA_BIT_MASK(32); 222static u64 mmc_dmamask = DMA_BIT_MASK(32);
223static struct at91_mmc_data mmc0_data, mmc1_data; 223static struct mci_platform_data mmc0_data, mmc1_data;
224 224
225static struct resource mmc0_resources[] = { 225static struct resource mmc0_resources[] = {
226 [0] = { 226 [0] = {
@@ -236,7 +236,7 @@ static struct resource mmc0_resources[] = {
236}; 236};
237 237
238static struct platform_device at91sam9263_mmc0_device = { 238static struct platform_device at91sam9263_mmc0_device = {
239 .name = "at91_mci", 239 .name = "atmel_mci",
240 .id = 0, 240 .id = 0,
241 .dev = { 241 .dev = {
242 .dma_mask = &mmc_dmamask, 242 .dma_mask = &mmc_dmamask,
@@ -261,7 +261,7 @@ static struct resource mmc1_resources[] = {
261}; 261};
262 262
263static struct platform_device at91sam9263_mmc1_device = { 263static struct platform_device at91sam9263_mmc1_device = {
264 .name = "at91_mci", 264 .name = "atmel_mci",
265 .id = 1, 265 .id = 1,
266 .dev = { 266 .dev = {
267 .dma_mask = &mmc_dmamask, 267 .dma_mask = &mmc_dmamask,
@@ -272,85 +272,110 @@ static struct platform_device at91sam9263_mmc1_device = {
272 .num_resources = ARRAY_SIZE(mmc1_resources), 272 .num_resources = ARRAY_SIZE(mmc1_resources),
273}; 273};
274 274
275void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) 275void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data)
276{ 276{
277 unsigned int i;
278 unsigned int slot_count = 0;
279
277 if (!data) 280 if (!data)
278 return; 281 return;
279 282
280 /* input/irq */ 283 for (i = 0; i < ATMCI_MAX_NR_SLOTS; i++) {
281 if (gpio_is_valid(data->det_pin)) {
282 at91_set_gpio_input(data->det_pin, 1);
283 at91_set_deglitch(data->det_pin, 1);
284 }
285 if (gpio_is_valid(data->wp_pin))
286 at91_set_gpio_input(data->wp_pin, 1);
287 if (gpio_is_valid(data->vcc_pin))
288 at91_set_gpio_output(data->vcc_pin, 0);
289 284
290 if (mmc_id == 0) { /* MCI0 */ 285 if (!data->slot[i].bus_width)
291 /* CLK */ 286 continue;
292 at91_set_A_periph(AT91_PIN_PA12, 0);
293 287
294 if (data->slot_b) { 288 /* input/irq */
295 /* CMD */ 289 if (gpio_is_valid(data->slot[i].detect_pin)) {
296 at91_set_A_periph(AT91_PIN_PA16, 1); 290 at91_set_gpio_input(data->slot[i].detect_pin,
291 1);
292 at91_set_deglitch(data->slot[i].detect_pin,
293 1);
294 }
295 if (gpio_is_valid(data->slot[i].wp_pin))
296 at91_set_gpio_input(data->slot[i].wp_pin, 1);
297
298 if (mmc_id == 0) { /* MCI0 */
299 switch (i) {
300 case 0: /* slot A */
301 /* CMD */
302 at91_set_A_periph(AT91_PIN_PA1, 1);
303 /* DAT0, maybe DAT1..DAT3 */
304 at91_set_A_periph(AT91_PIN_PA0, 1);
305 if (data->slot[i].bus_width == 4) {
306 at91_set_A_periph(AT91_PIN_PA3, 1);
307 at91_set_A_periph(AT91_PIN_PA4, 1);
308 at91_set_A_periph(AT91_PIN_PA5, 1);
309 }
310 slot_count++;
311 break;
312 case 1: /* slot B */
313 /* CMD */
314 at91_set_A_periph(AT91_PIN_PA16, 1);
315 /* DAT0, maybe DAT1..DAT3 */
316 at91_set_A_periph(AT91_PIN_PA17, 1);
317 if (data->slot[i].bus_width == 4) {
318 at91_set_A_periph(AT91_PIN_PA18, 1);
319 at91_set_A_periph(AT91_PIN_PA19, 1);
320 at91_set_A_periph(AT91_PIN_PA20, 1);
321 }
322 slot_count++;
323 break;
324 default:
325 printk(KERN_ERR
326 "AT91: SD/MMC slot %d not available\n", i);
327 break;
328 }
329 if (slot_count) {
330 /* CLK */
331 at91_set_A_periph(AT91_PIN_PA12, 0);
297 332
298 /* DAT0, maybe DAT1..DAT3 */ 333 mmc0_data = *data;
299 at91_set_A_periph(AT91_PIN_PA17, 1); 334 platform_device_register(&at91sam9263_mmc0_device);
300 if (data->wire4) {
301 at91_set_A_periph(AT91_PIN_PA18, 1);
302 at91_set_A_periph(AT91_PIN_PA19, 1);
303 at91_set_A_periph(AT91_PIN_PA20, 1);
304 } 335 }
305 } else { 336 } else if (mmc_id == 1) { /* MCI1 */
306 /* CMD */ 337 switch (i) {
307 at91_set_A_periph(AT91_PIN_PA1, 1); 338 case 0: /* slot A */
308 339 /* CMD */
309 /* DAT0, maybe DAT1..DAT3 */ 340 at91_set_A_periph(AT91_PIN_PA7, 1);
310 at91_set_A_periph(AT91_PIN_PA0, 1); 341 /* DAT0, maybe DAT1..DAT3 */
311 if (data->wire4) { 342 at91_set_A_periph(AT91_PIN_PA8, 1);
312 at91_set_A_periph(AT91_PIN_PA3, 1); 343 if (data->slot[i].bus_width == 4) {
313 at91_set_A_periph(AT91_PIN_PA4, 1); 344 at91_set_A_periph(AT91_PIN_PA9, 1);
314 at91_set_A_periph(AT91_PIN_PA5, 1); 345 at91_set_A_periph(AT91_PIN_PA10, 1);
346 at91_set_A_periph(AT91_PIN_PA11, 1);
347 }
348 slot_count++;
349 break;
350 case 1: /* slot B */
351 /* CMD */
352 at91_set_A_periph(AT91_PIN_PA21, 1);
353 /* DAT0, maybe DAT1..DAT3 */
354 at91_set_A_periph(AT91_PIN_PA22, 1);
355 if (data->slot[i].bus_width == 4) {
356 at91_set_A_periph(AT91_PIN_PA23, 1);
357 at91_set_A_periph(AT91_PIN_PA24, 1);
358 at91_set_A_periph(AT91_PIN_PA25, 1);
359 }
360 slot_count++;
361 break;
362 default:
363 printk(KERN_ERR
364 "AT91: SD/MMC slot %d not available\n", i);
365 break;
315 } 366 }
316 } 367 if (slot_count) {
368 /* CLK */
369 at91_set_A_periph(AT91_PIN_PA6, 0);
317 370
318 mmc0_data = *data; 371 mmc1_data = *data;
319 platform_device_register(&at91sam9263_mmc0_device); 372 platform_device_register(&at91sam9263_mmc1_device);
320 } else { /* MCI1 */
321 /* CLK */
322 at91_set_A_periph(AT91_PIN_PA6, 0);
323
324 if (data->slot_b) {
325 /* CMD */
326 at91_set_A_periph(AT91_PIN_PA21, 1);
327
328 /* DAT0, maybe DAT1..DAT3 */
329 at91_set_A_periph(AT91_PIN_PA22, 1);
330 if (data->wire4) {
331 at91_set_A_periph(AT91_PIN_PA23, 1);
332 at91_set_A_periph(AT91_PIN_PA24, 1);
333 at91_set_A_periph(AT91_PIN_PA25, 1);
334 }
335 } else {
336 /* CMD */
337 at91_set_A_periph(AT91_PIN_PA7, 1);
338
339 /* DAT0, maybe DAT1..DAT3 */
340 at91_set_A_periph(AT91_PIN_PA8, 1);
341 if (data->wire4) {
342 at91_set_A_periph(AT91_PIN_PA9, 1);
343 at91_set_A_periph(AT91_PIN_PA10, 1);
344 at91_set_A_periph(AT91_PIN_PA11, 1);
345 } 373 }
346 } 374 }
347
348 mmc1_data = *data;
349 platform_device_register(&at91sam9263_mmc1_device);
350 } 375 }
351} 376}
352#else 377#else
353void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {} 378void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data) {}
354#endif 379#endif
355 380
356/* -------------------------------------------------------------------- 381/* --------------------------------------------------------------------
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c
index b3d365dadef5..1fad22f7e21f 100644
--- a/arch/arm/mach-at91/at91sam9rl_devices.c
+++ b/arch/arm/mach-at91/at91sam9rl_devices.c
@@ -161,9 +161,9 @@ void __init at91_add_device_usba(struct usba_platform_data *data) {}
161 * MMC / SD 161 * MMC / SD
162 * -------------------------------------------------------------------- */ 162 * -------------------------------------------------------------------- */
163 163
164#if defined(CONFIG_MMC_AT91) || defined(CONFIG_MMC_AT91_MODULE) 164#if IS_ENABLED(CONFIG_MMC_ATMELMCI)
165static u64 mmc_dmamask = DMA_BIT_MASK(32); 165static u64 mmc_dmamask = DMA_BIT_MASK(32);
166static struct at91_mmc_data mmc_data; 166static struct mci_platform_data mmc_data;
167 167
168static struct resource mmc_resources[] = { 168static struct resource mmc_resources[] = {
169 [0] = { 169 [0] = {
@@ -179,7 +179,7 @@ static struct resource mmc_resources[] = {
179}; 179};
180 180
181static struct platform_device at91sam9rl_mmc_device = { 181static struct platform_device at91sam9rl_mmc_device = {
182 .name = "at91_mci", 182 .name = "atmel_mci",
183 .id = -1, 183 .id = -1,
184 .dev = { 184 .dev = {
185 .dma_mask = &mmc_dmamask, 185 .dma_mask = &mmc_dmamask,
@@ -190,40 +190,40 @@ static struct platform_device at91sam9rl_mmc_device = {
190 .num_resources = ARRAY_SIZE(mmc_resources), 190 .num_resources = ARRAY_SIZE(mmc_resources),
191}; 191};
192 192
193void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) 193void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data)
194{ 194{
195 if (!data) 195 if (!data)
196 return; 196 return;
197 197
198 /* input/irq */ 198 if (data->slot[0].bus_width) {
199 if (gpio_is_valid(data->det_pin)) { 199 /* input/irq */
200 at91_set_gpio_input(data->det_pin, 1); 200 if (gpio_is_valid(data->slot[0].detect_pin)) {
201 at91_set_deglitch(data->det_pin, 1); 201 at91_set_gpio_input(data->slot[0].detect_pin, 1);
202 } 202 at91_set_deglitch(data->slot[0].detect_pin, 1);
203 if (gpio_is_valid(data->wp_pin)) 203 }
204 at91_set_gpio_input(data->wp_pin, 1); 204 if (gpio_is_valid(data->slot[0].wp_pin))
205 if (gpio_is_valid(data->vcc_pin)) 205 at91_set_gpio_input(data->slot[0].wp_pin, 1);
206 at91_set_gpio_output(data->vcc_pin, 0); 206
207 207 /* CLK */
208 /* CLK */ 208 at91_set_A_periph(AT91_PIN_PA2, 0);
209 at91_set_A_periph(AT91_PIN_PA2, 0); 209
210 210 /* CMD */
211 /* CMD */ 211 at91_set_A_periph(AT91_PIN_PA1, 1);
212 at91_set_A_periph(AT91_PIN_PA1, 1); 212
213 213 /* DAT0, maybe DAT1..DAT3 */
214 /* DAT0, maybe DAT1..DAT3 */ 214 at91_set_A_periph(AT91_PIN_PA0, 1);
215 at91_set_A_periph(AT91_PIN_PA0, 1); 215 if (data->slot[0].bus_width == 4) {
216 if (data->wire4) { 216 at91_set_A_periph(AT91_PIN_PA3, 1);
217 at91_set_A_periph(AT91_PIN_PA3, 1); 217 at91_set_A_periph(AT91_PIN_PA4, 1);
218 at91_set_A_periph(AT91_PIN_PA4, 1); 218 at91_set_A_periph(AT91_PIN_PA5, 1);
219 at91_set_A_periph(AT91_PIN_PA5, 1); 219 }
220
221 mmc_data = *data;
222 platform_device_register(&at91sam9rl_mmc_device);
220 } 223 }
221
222 mmc_data = *data;
223 platform_device_register(&at91sam9rl_mmc_device);
224} 224}
225#else 225#else
226void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {} 226void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data) {}
227#endif 227#endif
228 228
229 229
diff --git a/arch/arm/mach-at91/board-afeb-9260v1.c b/arch/arm/mach-at91/board-afeb-9260v1.c
index de7be1931817..93a832f70232 100644
--- a/arch/arm/mach-at91/board-afeb-9260v1.c
+++ b/arch/arm/mach-at91/board-afeb-9260v1.c
@@ -133,12 +133,12 @@ static struct atmel_nand_data __initdata afeb9260_nand_data = {
133/* 133/*
134 * MCI (SD/MMC) 134 * MCI (SD/MMC)
135 */ 135 */
136static struct at91_mmc_data __initdata afeb9260_mmc_data = { 136static struct mci_platform_data __initdata afeb9260_mci0_data = {
137 .det_pin = AT91_PIN_PC9, 137 .slot[1] = {
138 .wp_pin = AT91_PIN_PC4, 138 .bus_width = 4,
139 .slot_b = 1, 139 .detect_pin = AT91_PIN_PC9,
140 .wire4 = 1, 140 .wp_pin = AT91_PIN_PC4,
141 .vcc_pin = -EINVAL, 141 },
142}; 142};
143 143
144 144
@@ -199,7 +199,7 @@ static void __init afeb9260_board_init(void)
199 at91_set_B_periph(AT91_PIN_PA10, 0); /* ETX2 */ 199 at91_set_B_periph(AT91_PIN_PA10, 0); /* ETX2 */
200 at91_set_B_periph(AT91_PIN_PA11, 0); /* ETX3 */ 200 at91_set_B_periph(AT91_PIN_PA11, 0); /* ETX3 */
201 /* MMC */ 201 /* MMC */
202 at91_add_device_mmc(0, &afeb9260_mmc_data); 202 at91_add_device_mci(0, &afeb9260_mci0_data);
203 /* I2C */ 203 /* I2C */
204 at91_add_device_i2c(afeb9260_i2c_devices, 204 at91_add_device_i2c(afeb9260_i2c_devices,
205 ARRAY_SIZE(afeb9260_i2c_devices)); 205 ARRAY_SIZE(afeb9260_i2c_devices));
diff --git a/arch/arm/mach-at91/board-carmeva.c b/arch/arm/mach-at91/board-carmeva.c
index a5b002f32a61..71d8f362a1d5 100644
--- a/arch/arm/mach-at91/board-carmeva.c
+++ b/arch/arm/mach-at91/board-carmeva.c
@@ -71,12 +71,12 @@ static struct at91_udc_data __initdata carmeva_udc_data = {
71 // .vcc_pin = -EINVAL, 71 // .vcc_pin = -EINVAL,
72// }; 72// };
73 73
74static struct at91_mmc_data __initdata carmeva_mmc_data = { 74static struct mci_platform_data __initdata carmeva_mci0_data = {
75 .slot_b = 0, 75 .slot[0] = {
76 .wire4 = 1, 76 .bus_width = 4,
77 .det_pin = AT91_PIN_PB10, 77 .detect_pin = AT91_PIN_PB10,
78 .wp_pin = AT91_PIN_PC14, 78 .wp_pin = AT91_PIN_PC14,
79 .vcc_pin = -EINVAL, 79 },
80}; 80};
81 81
82static struct spi_board_info carmeva_spi_devices[] = { 82static struct spi_board_info carmeva_spi_devices[] = {
@@ -150,7 +150,7 @@ static void __init carmeva_board_init(void)
150 /* Compact Flash */ 150 /* Compact Flash */
151// at91_add_device_cf(&carmeva_cf_data); 151// at91_add_device_cf(&carmeva_cf_data);
152 /* MMC */ 152 /* MMC */
153 at91_add_device_mmc(0, &carmeva_mmc_data); 153 at91_add_device_mci(0, &carmeva_mci0_data);
154 /* LEDs */ 154 /* LEDs */
155 at91_gpio_leds(carmeva_leds, ARRAY_SIZE(carmeva_leds)); 155 at91_gpio_leds(carmeva_leds, ARRAY_SIZE(carmeva_leds));
156} 156}
diff --git a/arch/arm/mach-at91/board-cpu9krea.c b/arch/arm/mach-at91/board-cpu9krea.c
index ecbc13b594de..e71c473316e3 100644
--- a/arch/arm/mach-at91/board-cpu9krea.c
+++ b/arch/arm/mach-at91/board-cpu9krea.c
@@ -254,8 +254,7 @@ static struct gpio_led cpu9krea_leds[] = {
254 254
255static struct i2c_board_info __initdata cpu9krea_i2c_devices[] = { 255static struct i2c_board_info __initdata cpu9krea_i2c_devices[] = {
256 { 256 {
257 I2C_BOARD_INFO("rtc-ds1307", 0x68), 257 I2C_BOARD_INFO("ds1339", 0x68),
258 .type = "ds1339",
259 }, 258 },
260}; 259};
261 260
@@ -312,12 +311,12 @@ static void __init cpu9krea_add_device_buttons(void)
312/* 311/*
313 * MCI (SD/MMC) 312 * MCI (SD/MMC)
314 */ 313 */
315static struct at91_mmc_data __initdata cpu9krea_mmc_data = { 314static struct mci_platform_data __initdata cpu9krea_mci0_data = {
316 .slot_b = 0, 315 .slot[0] = {
317 .wire4 = 1, 316 .bus_width = 4,
318 .det_pin = AT91_PIN_PA29, 317 .detect_pin = AT91_PIN_PA29,
319 .wp_pin = -EINVAL, 318 .wp_pin = -EINVAL,
320 .vcc_pin = -EINVAL, 319 },
321}; 320};
322 321
323static void __init cpu9krea_board_init(void) 322static void __init cpu9krea_board_init(void)
@@ -359,7 +358,7 @@ static void __init cpu9krea_board_init(void)
359 /* Ethernet */ 358 /* Ethernet */
360 at91_add_device_eth(&cpu9krea_macb_data); 359 at91_add_device_eth(&cpu9krea_macb_data);
361 /* MMC */ 360 /* MMC */
362 at91_add_device_mmc(0, &cpu9krea_mmc_data); 361 at91_add_device_mci(0, &cpu9krea_mci0_data);
363 /* I2C */ 362 /* I2C */
364 at91_add_device_i2c(cpu9krea_i2c_devices, 363 at91_add_device_i2c(cpu9krea_i2c_devices,
365 ARRAY_SIZE(cpu9krea_i2c_devices)); 364 ARRAY_SIZE(cpu9krea_i2c_devices));
diff --git a/arch/arm/mach-at91/board-cpuat91.c b/arch/arm/mach-at91/board-cpuat91.c
index 2e6d043c82f2..2cbd1a2b6c35 100644
--- a/arch/arm/mach-at91/board-cpuat91.c
+++ b/arch/arm/mach-at91/board-cpuat91.c
@@ -78,11 +78,12 @@ static struct at91_udc_data __initdata cpuat91_udc_data = {
78 .pullup_pin = AT91_PIN_PC14, 78 .pullup_pin = AT91_PIN_PC14,
79}; 79};
80 80
81static struct at91_mmc_data __initdata cpuat91_mmc_data = { 81static struct mci_platform_data __initdata cpuat91_mci0_data = {
82 .det_pin = AT91_PIN_PC2, 82 .slot[0] = {
83 .wire4 = 1, 83 .bus_width = 4,
84 .wp_pin = -EINVAL, 84 .detect_pin = AT91_PIN_PC2,
85 .vcc_pin = -EINVAL, 85 .wp_pin = -EINVAL,
86 },
86}; 87};
87 88
88static struct physmap_flash_data cpuat91_flash_data = { 89static struct physmap_flash_data cpuat91_flash_data = {
@@ -168,7 +169,7 @@ static void __init cpuat91_board_init(void)
168 /* USB Device */ 169 /* USB Device */
169 at91_add_device_udc(&cpuat91_udc_data); 170 at91_add_device_udc(&cpuat91_udc_data);
170 /* MMC */ 171 /* MMC */
171 at91_add_device_mmc(0, &cpuat91_mmc_data); 172 at91_add_device_mci(0, &cpuat91_mci0_data);
172 /* I2C */ 173 /* I2C */
173 at91_add_device_i2c(NULL, 0); 174 at91_add_device_i2c(NULL, 0);
174 /* Platform devices */ 175 /* Platform devices */
diff --git a/arch/arm/mach-at91/board-csb337.c b/arch/arm/mach-at91/board-csb337.c
index 462bc319cbc5..3e37437a7a61 100644
--- a/arch/arm/mach-at91/board-csb337.c
+++ b/arch/arm/mach-at91/board-csb337.c
@@ -87,12 +87,12 @@ static struct at91_cf_data __initdata csb337_cf_data = {
87 .rst_pin = AT91_PIN_PD2, 87 .rst_pin = AT91_PIN_PD2,
88}; 88};
89 89
90static struct at91_mmc_data __initdata csb337_mmc_data = { 90static struct mci_platform_data __initdata csb337_mci0_data = {
91 .det_pin = AT91_PIN_PD5, 91 .slot[0] = {
92 .slot_b = 0, 92 .bus_width = 4,
93 .wire4 = 1, 93 .detect_pin = AT91_PIN_PD5,
94 .wp_pin = AT91_PIN_PD6, 94 .wp_pin = AT91_PIN_PD6,
95 .vcc_pin = -EINVAL, 95 },
96}; 96};
97 97
98static struct spi_board_info csb337_spi_devices[] = { 98static struct spi_board_info csb337_spi_devices[] = {
@@ -220,8 +220,6 @@ static struct gpio_led csb_leds[] = {
220 220
221static void __init csb337_board_init(void) 221static void __init csb337_board_init(void)
222{ 222{
223 /* Setup the LEDs */
224 at91_init_leds(AT91_PIN_PB0, AT91_PIN_PB1);
225 /* Serial */ 223 /* Serial */
226 /* DBGU on ttyS0 */ 224 /* DBGU on ttyS0 */
227 at91_register_uart(0, 0, 0); 225 at91_register_uart(0, 0, 0);
@@ -240,7 +238,7 @@ static void __init csb337_board_init(void)
240 /* SPI */ 238 /* SPI */
241 at91_add_device_spi(csb337_spi_devices, ARRAY_SIZE(csb337_spi_devices)); 239 at91_add_device_spi(csb337_spi_devices, ARRAY_SIZE(csb337_spi_devices));
242 /* MMC */ 240 /* MMC */
243 at91_add_device_mmc(0, &csb337_mmc_data); 241 at91_add_device_mci(0, &csb337_mci0_data);
244 /* NOR flash */ 242 /* NOR flash */
245 platform_device_register(&csb_flash); 243 platform_device_register(&csb_flash);
246 /* LEDs */ 244 /* LEDs */
diff --git a/arch/arm/mach-at91/board-eb9200.c b/arch/arm/mach-at91/board-eb9200.c
index d1e1f3fc0a47..0cfac16ee9d5 100644
--- a/arch/arm/mach-at91/board-eb9200.c
+++ b/arch/arm/mach-at91/board-eb9200.c
@@ -70,12 +70,12 @@ static struct at91_cf_data __initdata eb9200_cf_data = {
70 .rst_pin = AT91_PIN_PC5, 70 .rst_pin = AT91_PIN_PC5,
71}; 71};
72 72
73static struct at91_mmc_data __initdata eb9200_mmc_data = { 73static struct mci_platform_data __initdata eb9200_mci0_data = {
74 .slot_b = 0, 74 .slot[0] = {
75 .wire4 = 1, 75 .bus_width = 4,
76 .det_pin = -EINVAL, 76 .detect_pin = -EINVAL,
77 .wp_pin = -EINVAL, 77 .wp_pin = -EINVAL,
78 .vcc_pin = -EINVAL, 78 },
79}; 79};
80 80
81static struct i2c_board_info __initdata eb9200_i2c_devices[] = { 81static struct i2c_board_info __initdata eb9200_i2c_devices[] = {
@@ -113,7 +113,7 @@ static void __init eb9200_board_init(void)
113 at91_add_device_spi(NULL, 0); 113 at91_add_device_spi(NULL, 0);
114 /* MMC */ 114 /* MMC */
115 /* only supports 1 or 4 bit interface, not wired through to SPI */ 115 /* only supports 1 or 4 bit interface, not wired through to SPI */
116 at91_add_device_mmc(0, &eb9200_mmc_data); 116 at91_add_device_mci(0, &eb9200_mci0_data);
117} 117}
118 118
119MACHINE_START(ATEB9200, "Embest ATEB9200") 119MACHINE_START(ATEB9200, "Embest ATEB9200")
diff --git a/arch/arm/mach-at91/board-ecbat91.c b/arch/arm/mach-at91/board-ecbat91.c
index 9c24cb25707c..3d931ffac4bf 100644
--- a/arch/arm/mach-at91/board-ecbat91.c
+++ b/arch/arm/mach-at91/board-ecbat91.c
@@ -64,12 +64,12 @@ static struct at91_usbh_data __initdata ecb_at91usbh_data = {
64 .overcurrent_pin= {-EINVAL, -EINVAL}, 64 .overcurrent_pin= {-EINVAL, -EINVAL},
65}; 65};
66 66
67static struct at91_mmc_data __initdata ecb_at91mmc_data = { 67static struct mci_platform_data __initdata ecbat91_mci0_data = {
68 .slot_b = 0, 68 .slot[0] = {
69 .wire4 = 1, 69 .bus_width = 4,
70 .det_pin = -EINVAL, 70 .detect_pin = -EINVAL,
71 .wp_pin = -EINVAL, 71 .wp_pin = -EINVAL,
72 .vcc_pin = -EINVAL, 72 },
73}; 73};
74 74
75 75
@@ -138,11 +138,20 @@ static struct spi_board_info __initdata ecb_at91spi_devices[] = {
138 }, 138 },
139}; 139};
140 140
141/*
142 * LEDs
143 */
144static struct gpio_led ecb_leds[] = {
145 { /* D1 */
146 .name = "led1",
147 .gpio = AT91_PIN_PC7,
148 .active_low = 1,
149 .default_trigger = "heartbeat",
150 }
151};
152
141static void __init ecb_at91board_init(void) 153static void __init ecb_at91board_init(void)
142{ 154{
143 /* Setup the LEDs */
144 at91_init_leds(AT91_PIN_PC7, AT91_PIN_PC7);
145
146 /* Serial */ 155 /* Serial */
147 /* DBGU on ttyS0. (Rx & Tx only) */ 156 /* DBGU on ttyS0. (Rx & Tx only) */
148 at91_register_uart(0, 0, 0); 157 at91_register_uart(0, 0, 0);
@@ -161,10 +170,13 @@ static void __init ecb_at91board_init(void)
161 at91_add_device_i2c(NULL, 0); 170 at91_add_device_i2c(NULL, 0);
162 171
163 /* MMC */ 172 /* MMC */
164 at91_add_device_mmc(0, &ecb_at91mmc_data); 173 at91_add_device_mci(0, &ecbat91_mci0_data);
165 174
166 /* SPI */ 175 /* SPI */
167 at91_add_device_spi(ecb_at91spi_devices, ARRAY_SIZE(ecb_at91spi_devices)); 176 at91_add_device_spi(ecb_at91spi_devices, ARRAY_SIZE(ecb_at91spi_devices));
177
178 /* LEDs */
179 at91_gpio_leds(ecb_leds, ARRAY_SIZE(ecb_leds));
168} 180}
169 181
170MACHINE_START(ECBAT91, "emQbit's ECB_AT91") 182MACHINE_START(ECBAT91, "emQbit's ECB_AT91")
diff --git a/arch/arm/mach-at91/board-eco920.c b/arch/arm/mach-at91/board-eco920.c
index 82bdfde3405f..d93658a2b128 100644
--- a/arch/arm/mach-at91/board-eco920.c
+++ b/arch/arm/mach-at91/board-eco920.c
@@ -56,12 +56,12 @@ static struct at91_udc_data __initdata eco920_udc_data = {
56 .pullup_pin = AT91_PIN_PB13, 56 .pullup_pin = AT91_PIN_PB13,
57}; 57};
58 58
59static struct at91_mmc_data __initdata eco920_mmc_data = { 59static struct mci_platform_data __initdata eco920_mci0_data = {
60 .slot_b = 0, 60 .slot[0] = {
61 .wire4 = 0, 61 .bus_width = 1,
62 .det_pin = -EINVAL, 62 .detect_pin = -EINVAL,
63 .wp_pin = -EINVAL, 63 .wp_pin = -EINVAL,
64 .vcc_pin = -EINVAL, 64 },
65}; 65};
66 66
67static struct physmap_flash_data eco920_flash_data = { 67static struct physmap_flash_data eco920_flash_data = {
@@ -93,10 +93,26 @@ static struct spi_board_info eco920_spi_devices[] = {
93 }, 93 },
94}; 94};
95 95
96/*
97 * LEDs
98 */
99static struct gpio_led eco920_leds[] = {
100 { /* D1 */
101 .name = "led1",
102 .gpio = AT91_PIN_PB0,
103 .active_low = 1,
104 .default_trigger = "heartbeat",
105 },
106 { /* D2 */
107 .name = "led2",
108 .gpio = AT91_PIN_PB1,
109 .active_low = 1,
110 .default_trigger = "timer",
111 }
112};
113
96static void __init eco920_board_init(void) 114static void __init eco920_board_init(void)
97{ 115{
98 /* Setup the LEDs */
99 at91_init_leds(AT91_PIN_PB0, AT91_PIN_PB1);
100 /* DBGU on ttyS0. (Rx & Tx only */ 116 /* DBGU on ttyS0. (Rx & Tx only */
101 at91_register_uart(0, 0, 0); 117 at91_register_uart(0, 0, 0);
102 at91_add_device_serial(); 118 at91_add_device_serial();
@@ -104,7 +120,7 @@ static void __init eco920_board_init(void)
104 at91_add_device_usbh(&eco920_usbh_data); 120 at91_add_device_usbh(&eco920_usbh_data);
105 at91_add_device_udc(&eco920_udc_data); 121 at91_add_device_udc(&eco920_udc_data);
106 122
107 at91_add_device_mmc(0, &eco920_mmc_data); 123 at91_add_device_mci(0, &eco920_mci0_data);
108 platform_device_register(&eco920_flash); 124 platform_device_register(&eco920_flash);
109 125
110 at91_ramc_write(0, AT91_SMC_CSR(7), AT91_SMC_RWHOLD_(1) 126 at91_ramc_write(0, AT91_SMC_CSR(7), AT91_SMC_RWHOLD_(1)
@@ -127,6 +143,8 @@ static void __init eco920_board_init(void)
127 ); 143 );
128 144
129 at91_add_device_spi(eco920_spi_devices, ARRAY_SIZE(eco920_spi_devices)); 145 at91_add_device_spi(eco920_spi_devices, ARRAY_SIZE(eco920_spi_devices));
146 /* LEDs */
147 at91_gpio_leds(eco920_leds, ARRAY_SIZE(eco920_leds));
130} 148}
131 149
132MACHINE_START(ECO920, "eco920") 150MACHINE_START(ECO920, "eco920")
diff --git a/arch/arm/mach-at91/board-flexibity.c b/arch/arm/mach-at91/board-flexibity.c
index 6cc83a87d77c..fa98abacb1ba 100644
--- a/arch/arm/mach-at91/board-flexibity.c
+++ b/arch/arm/mach-at91/board-flexibity.c
@@ -75,12 +75,12 @@ static struct spi_board_info flexibity_spi_devices[] = {
75}; 75};
76 76
77/* MCI (SD/MMC) */ 77/* MCI (SD/MMC) */
78static struct at91_mmc_data __initdata flexibity_mmc_data = { 78static struct mci_platform_data __initdata flexibity_mci0_data = {
79 .slot_b = 0, 79 .slot[0] = {
80 .wire4 = 1, 80 .bus_width = 4,
81 .det_pin = AT91_PIN_PC9, 81 .detect_pin = AT91_PIN_PC9,
82 .wp_pin = AT91_PIN_PC4, 82 .wp_pin = AT91_PIN_PC4,
83 .vcc_pin = -EINVAL, 83 },
84}; 84};
85 85
86/* LEDs */ 86/* LEDs */
@@ -152,7 +152,7 @@ static void __init flexibity_board_init(void)
152 at91_add_device_spi(flexibity_spi_devices, 152 at91_add_device_spi(flexibity_spi_devices,
153 ARRAY_SIZE(flexibity_spi_devices)); 153 ARRAY_SIZE(flexibity_spi_devices));
154 /* MMC */ 154 /* MMC */
155 at91_add_device_mmc(0, &flexibity_mmc_data); 155 at91_add_device_mci(0, &flexibity_mci0_data);
156 /* LEDs */ 156 /* LEDs */
157 at91_gpio_leds(flexibity_leds, ARRAY_SIZE(flexibity_leds)); 157 at91_gpio_leds(flexibity_leds, ARRAY_SIZE(flexibity_leds));
158} 158}
diff --git a/arch/arm/mach-at91/board-foxg20.c b/arch/arm/mach-at91/board-foxg20.c
index 69ab1247ef81..6e47071d8206 100644
--- a/arch/arm/mach-at91/board-foxg20.c
+++ b/arch/arm/mach-at91/board-foxg20.c
@@ -86,7 +86,7 @@ static struct at91_udc_data __initdata foxg20_udc_data = {
86 * SPI devices. 86 * SPI devices.
87 */ 87 */
88static struct spi_board_info foxg20_spi_devices[] = { 88static struct spi_board_info foxg20_spi_devices[] = {
89#if !defined(CONFIG_MMC_AT91) 89#if !IS_ENABLED(CONFIG_MMC_ATMELMCI)
90 { 90 {
91 .modalias = "mtd_dataflash", 91 .modalias = "mtd_dataflash",
92 .chip_select = 1, 92 .chip_select = 1,
@@ -109,12 +109,12 @@ static struct macb_platform_data __initdata foxg20_macb_data = {
109 * MCI (SD/MMC) 109 * MCI (SD/MMC)
110 * det_pin, wp_pin and vcc_pin are not connected 110 * det_pin, wp_pin and vcc_pin are not connected
111 */ 111 */
112static struct at91_mmc_data __initdata foxg20_mmc_data = { 112static struct mci_platform_data __initdata foxg20_mci0_data = {
113 .slot_b = 1, 113 .slot[1] = {
114 .wire4 = 1, 114 .bus_width = 4,
115 .det_pin = -EINVAL, 115 .detect_pin = -EINVAL,
116 .wp_pin = -EINVAL, 116 .wp_pin = -EINVAL,
117 .vcc_pin = -EINVAL, 117 },
118}; 118};
119 119
120 120
@@ -247,7 +247,7 @@ static void __init foxg20_board_init(void)
247 /* Ethernet */ 247 /* Ethernet */
248 at91_add_device_eth(&foxg20_macb_data); 248 at91_add_device_eth(&foxg20_macb_data);
249 /* MMC */ 249 /* MMC */
250 at91_add_device_mmc(0, &foxg20_mmc_data); 250 at91_add_device_mci(0, &foxg20_mci0_data);
251 /* I2C */ 251 /* I2C */
252 at91_add_device_i2c(foxg20_i2c_devices, ARRAY_SIZE(foxg20_i2c_devices)); 252 at91_add_device_i2c(foxg20_i2c_devices, ARRAY_SIZE(foxg20_i2c_devices));
253 /* LEDs */ 253 /* LEDs */
diff --git a/arch/arm/mach-at91/board-kafa.c b/arch/arm/mach-at91/board-kafa.c
index 64c1dbf88a07..86050da3ba53 100644
--- a/arch/arm/mach-at91/board-kafa.c
+++ b/arch/arm/mach-at91/board-kafa.c
@@ -66,11 +66,20 @@ static struct at91_udc_data __initdata kafa_udc_data = {
66 .pullup_pin = AT91_PIN_PB7, 66 .pullup_pin = AT91_PIN_PB7,
67}; 67};
68 68
69/*
70 * LEDs
71 */
72static struct gpio_led kafa_leds[] = {
73 { /* D1 */
74 .name = "led1",
75 .gpio = AT91_PIN_PB4,
76 .active_low = 1,
77 .default_trigger = "heartbeat",
78 },
79};
80
69static void __init kafa_board_init(void) 81static void __init kafa_board_init(void)
70{ 82{
71 /* Set up the LEDs */
72 at91_init_leds(AT91_PIN_PB4, AT91_PIN_PB4);
73
74 /* Serial */ 83 /* Serial */
75 /* DBGU on ttyS0. (Rx & Tx only) */ 84 /* DBGU on ttyS0. (Rx & Tx only) */
76 at91_register_uart(0, 0, 0); 85 at91_register_uart(0, 0, 0);
@@ -88,6 +97,8 @@ static void __init kafa_board_init(void)
88 at91_add_device_i2c(NULL, 0); 97 at91_add_device_i2c(NULL, 0);
89 /* SPI */ 98 /* SPI */
90 at91_add_device_spi(NULL, 0); 99 at91_add_device_spi(NULL, 0);
100 /* LEDs */
101 at91_gpio_leds(kafa_leds, ARRAY_SIZE(kafa_leds));
91} 102}
92 103
93MACHINE_START(KAFA, "Sperry-Sun KAFA") 104MACHINE_START(KAFA, "Sperry-Sun KAFA")
diff --git a/arch/arm/mach-at91/board-kb9202.c b/arch/arm/mach-at91/board-kb9202.c
index 5d96cb85175f..abe9fed7a3e0 100644
--- a/arch/arm/mach-at91/board-kb9202.c
+++ b/arch/arm/mach-at91/board-kb9202.c
@@ -69,12 +69,12 @@ static struct at91_udc_data __initdata kb9202_udc_data = {
69 .pullup_pin = AT91_PIN_PB22, 69 .pullup_pin = AT91_PIN_PB22,
70}; 70};
71 71
72static struct at91_mmc_data __initdata kb9202_mmc_data = { 72static struct mci_platform_data __initdata kb9202_mci0_data = {
73 .det_pin = AT91_PIN_PB2, 73 .slot[0] = {
74 .slot_b = 0, 74 .bus_width = 4,
75 .wire4 = 1, 75 .detect_pin = AT91_PIN_PB2,
76 .wp_pin = -EINVAL, 76 .wp_pin = -EINVAL,
77 .vcc_pin = -EINVAL, 77 },
78}; 78};
79 79
80static struct mtd_partition __initdata kb9202_nand_partition[] = { 80static struct mtd_partition __initdata kb9202_nand_partition[] = {
@@ -96,11 +96,26 @@ static struct atmel_nand_data __initdata kb9202_nand_data = {
96 .num_parts = ARRAY_SIZE(kb9202_nand_partition), 96 .num_parts = ARRAY_SIZE(kb9202_nand_partition),
97}; 97};
98 98
99/*
100 * LEDs
101 */
102static struct gpio_led kb9202_leds[] = {
103 { /* D1 */
104 .name = "led1",
105 .gpio = AT91_PIN_PC19,
106 .active_low = 1,
107 .default_trigger = "heartbeat",
108 },
109 { /* D2 */
110 .name = "led2",
111 .gpio = AT91_PIN_PC18,
112 .active_low = 1,
113 .default_trigger = "timer",
114 }
115};
116
99static void __init kb9202_board_init(void) 117static void __init kb9202_board_init(void)
100{ 118{
101 /* Set up the LEDs */
102 at91_init_leds(AT91_PIN_PC19, AT91_PIN_PC18);
103
104 /* Serial */ 119 /* Serial */
105 /* DBGU on ttyS0. (Rx & Tx only) */ 120 /* DBGU on ttyS0. (Rx & Tx only) */
106 at91_register_uart(0, 0, 0); 121 at91_register_uart(0, 0, 0);
@@ -121,13 +136,15 @@ static void __init kb9202_board_init(void)
121 /* USB Device */ 136 /* USB Device */
122 at91_add_device_udc(&kb9202_udc_data); 137 at91_add_device_udc(&kb9202_udc_data);
123 /* MMC */ 138 /* MMC */
124 at91_add_device_mmc(0, &kb9202_mmc_data); 139 at91_add_device_mci(0, &kb9202_mci0_data);
125 /* I2C */ 140 /* I2C */
126 at91_add_device_i2c(NULL, 0); 141 at91_add_device_i2c(NULL, 0);
127 /* SPI */ 142 /* SPI */
128 at91_add_device_spi(NULL, 0); 143 at91_add_device_spi(NULL, 0);
129 /* NAND */ 144 /* NAND */
130 at91_add_device_nand(&kb9202_nand_data); 145 at91_add_device_nand(&kb9202_nand_data);
146 /* LEDs */
147 at91_gpio_leds(kb9202_leds, ARRAY_SIZE(kb9202_leds));
131} 148}
132 149
133MACHINE_START(KB9200, "KB920x") 150MACHINE_START(KB9200, "KB920x")
diff --git a/arch/arm/mach-at91/board-neocore926.c b/arch/arm/mach-at91/board-neocore926.c
index 18103c5d993c..9cda3fd346ae 100644
--- a/arch/arm/mach-at91/board-neocore926.c
+++ b/arch/arm/mach-at91/board-neocore926.c
@@ -138,11 +138,12 @@ static struct spi_board_info neocore926_spi_devices[] = {
138/* 138/*
139 * MCI (SD/MMC) 139 * MCI (SD/MMC)
140 */ 140 */
141static struct at91_mmc_data __initdata neocore926_mmc_data = { 141static struct mci_platform_data __initdata neocore926_mci0_data = {
142 .wire4 = 1, 142 .slot[0] = {
143 .det_pin = AT91_PIN_PE18, 143 .bus_width = 4,
144 .wp_pin = AT91_PIN_PE19, 144 .detect_pin = AT91_PIN_PE18,
145 .vcc_pin = -EINVAL, 145 .wp_pin = AT91_PIN_PE19,
146 },
146}; 147};
147 148
148 149
@@ -354,7 +355,7 @@ static void __init neocore926_board_init(void)
354 neocore926_add_device_ts(); 355 neocore926_add_device_ts();
355 356
356 /* MMC */ 357 /* MMC */
357 at91_add_device_mmc(1, &neocore926_mmc_data); 358 at91_add_device_mci(0, &neocore926_mci0_data);
358 359
359 /* Ethernet */ 360 /* Ethernet */
360 at91_add_device_eth(&neocore926_macb_data); 361 at91_add_device_eth(&neocore926_macb_data);
diff --git a/arch/arm/mach-at91/board-picotux200.c b/arch/arm/mach-at91/board-picotux200.c
index 127065504508..f83e1de699e6 100644
--- a/arch/arm/mach-at91/board-picotux200.c
+++ b/arch/arm/mach-at91/board-picotux200.c
@@ -62,12 +62,12 @@ static struct at91_usbh_data __initdata picotux200_usbh_data = {
62 .overcurrent_pin= {-EINVAL, -EINVAL}, 62 .overcurrent_pin= {-EINVAL, -EINVAL},
63}; 63};
64 64
65static struct at91_mmc_data __initdata picotux200_mmc_data = { 65static struct mci_platform_data __initdata picotux200_mci0_data = {
66 .det_pin = AT91_PIN_PB27, 66 .slot[0] = {
67 .slot_b = 0, 67 .bus_width = 4,
68 .wire4 = 1, 68 .detect_pin = AT91_PIN_PB27,
69 .wp_pin = AT91_PIN_PA17, 69 .wp_pin = AT91_PIN_PA17,
70 .vcc_pin = -EINVAL, 70 },
71}; 71};
72 72
73#define PICOTUX200_FLASH_BASE AT91_CHIPSELECT_0 73#define PICOTUX200_FLASH_BASE AT91_CHIPSELECT_0
@@ -112,7 +112,7 @@ static void __init picotux200_board_init(void)
112 at91_add_device_i2c(NULL, 0); 112 at91_add_device_i2c(NULL, 0);
113 /* MMC */ 113 /* MMC */
114 at91_set_gpio_output(AT91_PIN_PB22, 1); /* this MMC card slot can optionally use SPI signaling (CS3). */ 114 at91_set_gpio_output(AT91_PIN_PB22, 1); /* this MMC card slot can optionally use SPI signaling (CS3). */
115 at91_add_device_mmc(0, &picotux200_mmc_data); 115 at91_add_device_mci(0, &picotux200_mci0_data);
116 /* NOR Flash */ 116 /* NOR Flash */
117 platform_device_register(&picotux200_flash); 117 platform_device_register(&picotux200_flash);
118} 118}
diff --git a/arch/arm/mach-at91/board-qil-a9260.c b/arch/arm/mach-at91/board-qil-a9260.c
index bf351e285422..799f214edebe 100644
--- a/arch/arm/mach-at91/board-qil-a9260.c
+++ b/arch/arm/mach-at91/board-qil-a9260.c
@@ -156,12 +156,12 @@ static void __init ek_add_device_nand(void)
156/* 156/*
157 * MCI (SD/MMC) 157 * MCI (SD/MMC)
158 */ 158 */
159static struct at91_mmc_data __initdata ek_mmc_data = { 159static struct mci_platform_data __initdata ek_mci0_data = {
160 .slot_b = 0, 160 .slot[0] = {
161 .wire4 = 1, 161 .bus_width = 4,
162 .det_pin = -EINVAL, 162 .detect_pin = -EINVAL,
163 .wp_pin = -EINVAL, 163 .wp_pin = -EINVAL,
164 .vcc_pin = -EINVAL, 164 },
165}; 165};
166 166
167/* 167/*
@@ -245,7 +245,7 @@ static void __init ek_board_init(void)
245 /* Ethernet */ 245 /* Ethernet */
246 at91_add_device_eth(&ek_macb_data); 246 at91_add_device_eth(&ek_macb_data);
247 /* MMC */ 247 /* MMC */
248 at91_add_device_mmc(0, &ek_mmc_data); 248 at91_add_device_mci(0, &ek_mci0_data);
249 /* Push Buttons */ 249 /* Push Buttons */
250 ek_add_device_buttons(); 250 ek_add_device_buttons();
251 /* LEDs */ 251 /* LEDs */
diff --git a/arch/arm/mach-at91/board-rm9200dk.c b/arch/arm/mach-at91/board-rm9200dk.c
index cc2bf9796073..66338e7ebfba 100644
--- a/arch/arm/mach-at91/board-rm9200dk.c
+++ b/arch/arm/mach-at91/board-rm9200dk.c
@@ -77,12 +77,12 @@ static struct at91_cf_data __initdata dk_cf_data = {
77}; 77};
78 78
79#ifndef CONFIG_MTD_AT91_DATAFLASH_CARD 79#ifndef CONFIG_MTD_AT91_DATAFLASH_CARD
80static struct at91_mmc_data __initdata dk_mmc_data = { 80static struct mci_platform_data __initdata dk_mci0_data = {
81 .slot_b = 0, 81 .slot[0] = {
82 .wire4 = 1, 82 .bus_width = 4,
83 .det_pin = -EINVAL, 83 .detect_pin = -EINVAL,
84 .wp_pin = -EINVAL, 84 .wp_pin = -EINVAL,
85 .vcc_pin = -EINVAL, 85 },
86}; 86};
87#endif 87#endif
88 88
@@ -177,9 +177,6 @@ static struct gpio_led dk_leds[] = {
177 177
178static void __init dk_board_init(void) 178static void __init dk_board_init(void)
179{ 179{
180 /* Setup the LEDs */
181 at91_init_leds(AT91_PIN_PB2, AT91_PIN_PB2);
182
183 /* Serial */ 180 /* Serial */
184 /* DBGU on ttyS0. (Rx & Tx only) */ 181 /* DBGU on ttyS0. (Rx & Tx only) */
185 at91_register_uart(0, 0, 0); 182 at91_register_uart(0, 0, 0);
@@ -208,7 +205,7 @@ static void __init dk_board_init(void)
208#else 205#else
209 /* MMC */ 206 /* MMC */
210 at91_set_gpio_output(AT91_PIN_PB7, 1); /* this MMC card slot can optionally use SPI signaling (CS3). */ 207 at91_set_gpio_output(AT91_PIN_PB7, 1); /* this MMC card slot can optionally use SPI signaling (CS3). */
211 at91_add_device_mmc(0, &dk_mmc_data); 208 at91_add_device_mci(0, &dk_mci0_data);
212#endif 209#endif
213 /* NAND */ 210 /* NAND */
214 at91_add_device_nand(&dk_nand_data); 211 at91_add_device_nand(&dk_nand_data);
diff --git a/arch/arm/mach-at91/board-rm9200ek.c b/arch/arm/mach-at91/board-rm9200ek.c
index 62e19e64c9d3..5d1b5729dc69 100644
--- a/arch/arm/mach-at91/board-rm9200ek.c
+++ b/arch/arm/mach-at91/board-rm9200ek.c
@@ -70,12 +70,12 @@ static struct at91_udc_data __initdata ek_udc_data = {
70}; 70};
71 71
72#ifndef CONFIG_MTD_AT91_DATAFLASH_CARD 72#ifndef CONFIG_MTD_AT91_DATAFLASH_CARD
73static struct at91_mmc_data __initdata ek_mmc_data = { 73static struct mci_platform_data __initdata ek_mci0_data = {
74 .det_pin = AT91_PIN_PB27, 74 .slot[0] = {
75 .slot_b = 0, 75 .bus_width = 4,
76 .wire4 = 1, 76 .detect_pin = AT91_PIN_PB27,
77 .wp_pin = AT91_PIN_PA17, 77 .wp_pin = AT91_PIN_PA17,
78 .vcc_pin = -EINVAL, 78 }
79}; 79};
80#endif 80#endif
81 81
@@ -148,9 +148,6 @@ static struct gpio_led ek_leds[] = {
148 148
149static void __init ek_board_init(void) 149static void __init ek_board_init(void)
150{ 150{
151 /* Setup the LEDs */
152 at91_init_leds(AT91_PIN_PB1, AT91_PIN_PB2);
153
154 /* Serial */ 151 /* Serial */
155 /* DBGU on ttyS0. (Rx & Tx only) */ 152 /* DBGU on ttyS0. (Rx & Tx only) */
156 at91_register_uart(0, 0, 0); 153 at91_register_uart(0, 0, 0);
@@ -177,7 +174,7 @@ static void __init ek_board_init(void)
177#else 174#else
178 /* MMC */ 175 /* MMC */
179 at91_set_gpio_output(AT91_PIN_PB22, 1); /* this MMC card slot can optionally use SPI signaling (CS3). */ 176 at91_set_gpio_output(AT91_PIN_PB22, 1); /* this MMC card slot can optionally use SPI signaling (CS3). */
180 at91_add_device_mmc(0, &ek_mmc_data); 177 at91_add_device_mci(0, &ek_mci0_data);
181#endif 178#endif
182 /* NOR Flash */ 179 /* NOR Flash */
183 platform_device_register(&ek_flash); 180 platform_device_register(&ek_flash);
diff --git a/arch/arm/mach-at91/board-rsi-ews.c b/arch/arm/mach-at91/board-rsi-ews.c
index c3b43aefdb75..a0ecf04e9ae3 100644
--- a/arch/arm/mach-at91/board-rsi-ews.c
+++ b/arch/arm/mach-at91/board-rsi-ews.c
@@ -58,11 +58,12 @@ static struct at91_usbh_data rsi_ews_usbh_data __initdata = {
58/* 58/*
59 * SD/MC 59 * SD/MC
60 */ 60 */
61static struct at91_mmc_data rsi_ews_mmc_data __initdata = { 61static struct mci_platform_data __initdata rsi_ews_mci0_data = {
62 .slot_b = 0, 62 .slot[0] = {
63 .wire4 = 1, 63 .bus_width = 4,
64 .det_pin = AT91_PIN_PB27, 64 .detect_pin = AT91_PIN_PB27,
65 .wp_pin = AT91_PIN_PB29, 65 .wp_pin = AT91_PIN_PB29,
66 },
66}; 67};
67 68
68/* 69/*
@@ -185,9 +186,6 @@ static struct platform_device rsiews_nor_flash = {
185 */ 186 */
186static void __init rsi_ews_board_init(void) 187static void __init rsi_ews_board_init(void)
187{ 188{
188 /* Setup the LEDs */
189 at91_init_leds(AT91_PIN_PB6, AT91_PIN_PB9);
190
191 /* Serial */ 189 /* Serial */
192 /* DBGU on ttyS0. (Rx & Tx only) */ 190 /* DBGU on ttyS0. (Rx & Tx only) */
193 /* This one is for debugging */ 191 /* This one is for debugging */
@@ -215,7 +213,7 @@ static void __init rsi_ews_board_init(void)
215 at91_add_device_spi(rsi_ews_spi_devices, 213 at91_add_device_spi(rsi_ews_spi_devices,
216 ARRAY_SIZE(rsi_ews_spi_devices)); 214 ARRAY_SIZE(rsi_ews_spi_devices));
217 /* MMC */ 215 /* MMC */
218 at91_add_device_mmc(0, &rsi_ews_mmc_data); 216 at91_add_device_mci(0, &rsi_ews_mci0_data);
219 /* NOR Flash */ 217 /* NOR Flash */
220 platform_device_register(&rsiews_nor_flash); 218 platform_device_register(&rsiews_nor_flash);
221 /* LEDs */ 219 /* LEDs */
diff --git a/arch/arm/mach-at91/board-sam9-l9260.c b/arch/arm/mach-at91/board-sam9-l9260.c
index 7bf6da70d7d5..c5f01acce3c0 100644
--- a/arch/arm/mach-at91/board-sam9-l9260.c
+++ b/arch/arm/mach-at91/board-sam9-l9260.c
@@ -73,7 +73,7 @@ static struct at91_udc_data __initdata ek_udc_data = {
73 * SPI devices. 73 * SPI devices.
74 */ 74 */
75static struct spi_board_info ek_spi_devices[] = { 75static struct spi_board_info ek_spi_devices[] = {
76#if !defined(CONFIG_MMC_AT91) 76#if !IS_ENABLED(CONFIG_MMC_ATMELMCI)
77 { /* DataFlash chip */ 77 { /* DataFlash chip */
78 .modalias = "mtd_dataflash", 78 .modalias = "mtd_dataflash",
79 .chip_select = 1, 79 .chip_select = 1,
@@ -158,19 +158,34 @@ static void __init ek_add_device_nand(void)
158/* 158/*
159 * MCI (SD/MMC) 159 * MCI (SD/MMC)
160 */ 160 */
161static struct at91_mmc_data __initdata ek_mmc_data = { 161static struct mci_platform_data __initdata ek_mci0_data = {
162 .slot_b = 1, 162 .slot[1] = {
163 .wire4 = 1, 163 .bus_width = 4,
164 .det_pin = AT91_PIN_PC8, 164 .detect_pin = AT91_PIN_PC8,
165 .wp_pin = AT91_PIN_PC4, 165 .wp_pin = AT91_PIN_PC4,
166 .vcc_pin = -EINVAL, 166 },
167};
168
169/*
170 * LEDs
171 */
172static struct gpio_led ek_leds[] = {
173 { /* D1 */
174 .name = "led1",
175 .gpio = AT91_PIN_PA9,
176 .active_low = 1,
177 .default_trigger = "heartbeat",
178 },
179 { /* D2 */
180 .name = "led2",
181 .gpio = AT91_PIN_PA6,
182 .active_low = 1,
183 .default_trigger = "timer",
184 }
167}; 185};
168 186
169static void __init ek_board_init(void) 187static void __init ek_board_init(void)
170{ 188{
171 /* Setup the LEDs */
172 at91_init_leds(AT91_PIN_PA9, AT91_PIN_PA6);
173
174 /* Serial */ 189 /* Serial */
175 /* DBGU on ttyS0. (Rx & Tx only) */ 190 /* DBGU on ttyS0. (Rx & Tx only) */
176 at91_register_uart(0, 0, 0); 191 at91_register_uart(0, 0, 0);
@@ -194,9 +209,11 @@ static void __init ek_board_init(void)
194 /* Ethernet */ 209 /* Ethernet */
195 at91_add_device_eth(&ek_macb_data); 210 at91_add_device_eth(&ek_macb_data);
196 /* MMC */ 211 /* MMC */
197 at91_add_device_mmc(0, &ek_mmc_data); 212 at91_add_device_mci(0, &ek_mci0_data);
198 /* I2C */ 213 /* I2C */
199 at91_add_device_i2c(NULL, 0); 214 at91_add_device_i2c(NULL, 0);
215 /* LEDs */
216 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
200} 217}
201 218
202MACHINE_START(SAM9_L9260, "Olimex SAM9-L9260") 219MACHINE_START(SAM9_L9260, "Olimex SAM9-L9260")
diff --git a/arch/arm/mach-at91/board-sam9260ek.c b/arch/arm/mach-at91/board-sam9260ek.c
index 889c1bf71eb5..8cd6e679fbe0 100644
--- a/arch/arm/mach-at91/board-sam9260ek.c
+++ b/arch/arm/mach-at91/board-sam9260ek.c
@@ -108,7 +108,7 @@ static void __init at73c213_set_clk(struct at73c213_board_info *info) {}
108 * SPI devices. 108 * SPI devices.
109 */ 109 */
110static struct spi_board_info ek_spi_devices[] = { 110static struct spi_board_info ek_spi_devices[] = {
111#if !defined(CONFIG_MMC_AT91) 111#if !IS_ENABLED(CONFIG_MMC_ATMELMCI)
112 { /* DataFlash chip */ 112 { /* DataFlash chip */
113 .modalias = "mtd_dataflash", 113 .modalias = "mtd_dataflash",
114 .chip_select = 1, 114 .chip_select = 1,
@@ -211,12 +211,12 @@ static void __init ek_add_device_nand(void)
211/* 211/*
212 * MCI (SD/MMC) 212 * MCI (SD/MMC)
213 */ 213 */
214static struct at91_mmc_data __initdata ek_mmc_data = { 214static struct mci_platform_data __initdata ek_mci0_data = {
215 .slot_b = 1, 215 .slot[1] = {
216 .wire4 = 1, 216 .bus_width = 4,
217 .det_pin = -EINVAL, 217 .detect_pin = -EINVAL,
218 .wp_pin = -EINVAL, 218 .wp_pin = -EINVAL,
219 .vcc_pin = -EINVAL, 219 },
220}; 220};
221 221
222 222
@@ -329,7 +329,7 @@ static void __init ek_board_init(void)
329 /* Ethernet */ 329 /* Ethernet */
330 at91_add_device_eth(&ek_macb_data); 330 at91_add_device_eth(&ek_macb_data);
331 /* MMC */ 331 /* MMC */
332 at91_add_device_mmc(0, &ek_mmc_data); 332 at91_add_device_mci(0, &ek_mci0_data);
333 /* I2C */ 333 /* I2C */
334 at91_add_device_i2c(ek_i2c_devices, ARRAY_SIZE(ek_i2c_devices)); 334 at91_add_device_i2c(ek_i2c_devices, ARRAY_SIZE(ek_i2c_devices));
335 /* SSC (to AT73C213) */ 335 /* SSC (to AT73C213) */
diff --git a/arch/arm/mach-at91/board-sam9261ek.c b/arch/arm/mach-at91/board-sam9261ek.c
index 2269be5fa384..27b3af1a3047 100644
--- a/arch/arm/mach-at91/board-sam9261ek.c
+++ b/arch/arm/mach-at91/board-sam9261ek.c
@@ -340,11 +340,12 @@ static struct spi_board_info ek_spi_devices[] = {
340 * MCI (SD/MMC) 340 * MCI (SD/MMC)
341 * det_pin, wp_pin and vcc_pin are not connected 341 * det_pin, wp_pin and vcc_pin are not connected
342 */ 342 */
343static struct at91_mmc_data __initdata ek_mmc_data = { 343static struct mci_platform_data __initdata mci0_data = {
344 .wire4 = 1, 344 .slot[0] = {
345 .det_pin = -EINVAL, 345 .bus_width = 4,
346 .wp_pin = -EINVAL, 346 .detect_pin = -EINVAL,
347 .vcc_pin = -EINVAL, 347 .wp_pin = -EINVAL,
348 },
348}; 349};
349 350
350#endif /* CONFIG_SPI_ATMEL_* */ 351#endif /* CONFIG_SPI_ATMEL_* */
@@ -569,9 +570,6 @@ static struct gpio_led ek_leds[] = {
569 570
570static void __init ek_board_init(void) 571static void __init ek_board_init(void)
571{ 572{
572 /* Setup the LEDs */
573 at91_init_leds(AT91_PIN_PA13, AT91_PIN_PA14);
574
575 /* Serial */ 573 /* Serial */
576 /* DBGU on ttyS0. (Rx & Tx only) */ 574 /* DBGU on ttyS0. (Rx & Tx only) */
577 at91_register_uart(0, 0, 0); 575 at91_register_uart(0, 0, 0);
@@ -598,7 +596,7 @@ static void __init ek_board_init(void)
598 at91_add_device_ssc(AT91SAM9261_ID_SSC1, ATMEL_SSC_TX); 596 at91_add_device_ssc(AT91SAM9261_ID_SSC1, ATMEL_SSC_TX);
599#else 597#else
600 /* MMC */ 598 /* MMC */
601 at91_add_device_mmc(0, &ek_mmc_data); 599 at91_add_device_mci(0, &mci0_data);
602#endif 600#endif
603 /* LCD Controller */ 601 /* LCD Controller */
604 at91_add_device_lcdc(&ek_lcdc_data); 602 at91_add_device_lcdc(&ek_lcdc_data);
diff --git a/arch/arm/mach-at91/board-sam9263ek.c b/arch/arm/mach-at91/board-sam9263ek.c
index 82adf581afc2..073e17403d98 100644
--- a/arch/arm/mach-at91/board-sam9263ek.c
+++ b/arch/arm/mach-at91/board-sam9263ek.c
@@ -141,11 +141,12 @@ static struct spi_board_info ek_spi_devices[] = {
141/* 141/*
142 * MCI (SD/MMC) 142 * MCI (SD/MMC)
143 */ 143 */
144static struct at91_mmc_data __initdata ek_mmc_data = { 144static struct mci_platform_data __initdata mci1_data = {
145 .wire4 = 1, 145 .slot[0] = {
146 .det_pin = AT91_PIN_PE18, 146 .bus_width = 4,
147 .wp_pin = AT91_PIN_PE19, 147 .detect_pin = AT91_PIN_PE18,
148 .vcc_pin = -EINVAL, 148 .wp_pin = AT91_PIN_PE19,
149 },
149}; 150};
150 151
151 152
@@ -420,7 +421,7 @@ static void __init ek_board_init(void)
420 /* Touchscreen */ 421 /* Touchscreen */
421 ek_add_device_ts(); 422 ek_add_device_ts();
422 /* MMC */ 423 /* MMC */
423 at91_add_device_mmc(1, &ek_mmc_data); 424 at91_add_device_mci(1, &mci1_data);
424 /* Ethernet */ 425 /* Ethernet */
425 at91_add_device_eth(&ek_macb_data); 426 at91_add_device_eth(&ek_macb_data);
426 /* NAND */ 427 /* NAND */
diff --git a/arch/arm/mach-at91/board-sam9g20ek.c b/arch/arm/mach-at91/board-sam9g20ek.c
index 4ea4ee00364b..3ab2b86a3762 100644
--- a/arch/arm/mach-at91/board-sam9g20ek.c
+++ b/arch/arm/mach-at91/board-sam9g20ek.c
@@ -92,7 +92,7 @@ static struct at91_udc_data __initdata ek_udc_data = {
92 * SPI devices. 92 * SPI devices.
93 */ 93 */
94static struct spi_board_info ek_spi_devices[] = { 94static struct spi_board_info ek_spi_devices[] = {
95#if !(defined(CONFIG_MMC_ATMELMCI) || defined(CONFIG_MMC_AT91)) 95#if !IS_ENABLED(CONFIG_MMC_ATMELMCI)
96 { /* DataFlash chip */ 96 { /* DataFlash chip */
97 .modalias = "mtd_dataflash", 97 .modalias = "mtd_dataflash",
98 .chip_select = 1, 98 .chip_select = 1,
@@ -199,7 +199,6 @@ static void __init ek_add_device_nand(void)
199 * MCI (SD/MMC) 199 * MCI (SD/MMC)
200 * wp_pin and vcc_pin are not connected 200 * wp_pin and vcc_pin are not connected
201 */ 201 */
202#if defined(CONFIG_MMC_ATMELMCI) || defined(CONFIG_MMC_ATMELMCI_MODULE)
203static struct mci_platform_data __initdata ek_mmc_data = { 202static struct mci_platform_data __initdata ek_mmc_data = {
204 .slot[1] = { 203 .slot[1] = {
205 .bus_width = 4, 204 .bus_width = 4,
@@ -208,28 +207,15 @@ static struct mci_platform_data __initdata ek_mmc_data = {
208 }, 207 },
209 208
210}; 209};
211#else
212static struct at91_mmc_data __initdata ek_mmc_data = {
213 .slot_b = 1, /* Only one slot so use slot B */
214 .wire4 = 1,
215 .det_pin = AT91_PIN_PC9,
216 .wp_pin = -EINVAL,
217 .vcc_pin = -EINVAL,
218};
219#endif
220 210
221static void __init ek_add_device_mmc(void) 211static void __init ek_add_device_mmc(void)
222{ 212{
223#if defined(CONFIG_MMC_ATMELMCI) || defined(CONFIG_MMC_ATMELMCI_MODULE)
224 if (ek_have_2mmc()) { 213 if (ek_have_2mmc()) {
225 ek_mmc_data.slot[0].bus_width = 4; 214 ek_mmc_data.slot[0].bus_width = 4;
226 ek_mmc_data.slot[0].detect_pin = AT91_PIN_PC2; 215 ek_mmc_data.slot[0].detect_pin = AT91_PIN_PC2;
227 ek_mmc_data.slot[0].wp_pin = -1; 216 ek_mmc_data.slot[0].wp_pin = -1;
228 } 217 }
229 at91_add_device_mci(0, &ek_mmc_data); 218 at91_add_device_mci(0, &ek_mmc_data);
230#else
231 at91_add_device_mmc(0, &ek_mmc_data);
232#endif
233} 219}
234 220
235/* 221/*
diff --git a/arch/arm/mach-at91/board-sam9rlek.c b/arch/arm/mach-at91/board-sam9rlek.c
index e7dc3ead7045..fb89ea92e3f2 100644
--- a/arch/arm/mach-at91/board-sam9rlek.c
+++ b/arch/arm/mach-at91/board-sam9rlek.c
@@ -56,11 +56,12 @@ static struct usba_platform_data __initdata ek_usba_udc_data = {
56/* 56/*
57 * MCI (SD/MMC) 57 * MCI (SD/MMC)
58 */ 58 */
59static struct at91_mmc_data __initdata ek_mmc_data = { 59static struct mci_platform_data __initdata mci0_data = {
60 .wire4 = 1, 60 .slot[0] = {
61 .det_pin = AT91_PIN_PA15, 61 .bus_width = 4,
62 .wp_pin = -EINVAL, 62 .detect_pin = AT91_PIN_PA15,
63 .vcc_pin = -EINVAL, 63 .wp_pin = -EINVAL,
64 },
64}; 65};
65 66
66 67
@@ -303,7 +304,7 @@ static void __init ek_board_init(void)
303 /* SPI */ 304 /* SPI */
304 at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices)); 305 at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));
305 /* MMC */ 306 /* MMC */
306 at91_add_device_mmc(0, &ek_mmc_data); 307 at91_add_device_mci(0, &mci0_data);
307 /* LCD Controller */ 308 /* LCD Controller */
308 at91_add_device_lcdc(&ek_lcdc_data); 309 at91_add_device_lcdc(&ek_lcdc_data);
309 /* AC97 */ 310 /* AC97 */
diff --git a/arch/arm/mach-at91/board-stamp9g20.c b/arch/arm/mach-at91/board-stamp9g20.c
index 29eae1626bf7..c3fb31d5116e 100644
--- a/arch/arm/mach-at91/board-stamp9g20.c
+++ b/arch/arm/mach-at91/board-stamp9g20.c
@@ -83,7 +83,6 @@ static void __init add_device_nand(void)
83 * MCI (SD/MMC) 83 * MCI (SD/MMC)
84 * det_pin, wp_pin and vcc_pin are not connected 84 * det_pin, wp_pin and vcc_pin are not connected
85 */ 85 */
86#if defined(CONFIG_MMC_ATMELMCI) || defined(CONFIG_MMC_ATMELMCI_MODULE)
87static struct mci_platform_data __initdata mmc_data = { 86static struct mci_platform_data __initdata mmc_data = {
88 .slot[0] = { 87 .slot[0] = {
89 .bus_width = 4, 88 .bus_width = 4,
@@ -91,15 +90,6 @@ static struct mci_platform_data __initdata mmc_data = {
91 .wp_pin = -1, 90 .wp_pin = -1,
92 }, 91 },
93}; 92};
94#else
95static struct at91_mmc_data __initdata mmc_data = {
96 .slot_b = 0,
97 .wire4 = 1,
98 .det_pin = -EINVAL,
99 .wp_pin = -EINVAL,
100 .vcc_pin = -EINVAL,
101};
102#endif
103 93
104 94
105/* 95/*
@@ -223,11 +213,7 @@ void __init stamp9g20_board_init(void)
223 /* NAND */ 213 /* NAND */
224 add_device_nand(); 214 add_device_nand();
225 /* MMC */ 215 /* MMC */
226#if defined(CONFIG_MMC_ATMELMCI) || defined(CONFIG_MMC_ATMELMCI_MODULE)
227 at91_add_device_mci(0, &mmc_data); 216 at91_add_device_mci(0, &mmc_data);
228#else
229 at91_add_device_mmc(0, &mmc_data);
230#endif
231 /* W1 */ 217 /* W1 */
232 add_w1(); 218 add_w1();
233} 219}
diff --git a/arch/arm/mach-at91/board-usb-a926x.c b/arch/arm/mach-at91/board-usb-a926x.c
index c1476b9fe7b9..6ea069b57335 100644
--- a/arch/arm/mach-at91/board-usb-a926x.c
+++ b/arch/arm/mach-at91/board-usb-a926x.c
@@ -109,14 +109,12 @@ static struct mmc_spi_platform_data at91_mmc_spi_pdata = {
109 * SPI devices. 109 * SPI devices.
110 */ 110 */
111static struct spi_board_info usb_a9263_spi_devices[] = { 111static struct spi_board_info usb_a9263_spi_devices[] = {
112#if !defined(CONFIG_MMC_AT91)
113 { /* DataFlash chip */ 112 { /* DataFlash chip */
114 .modalias = "mtd_dataflash", 113 .modalias = "mtd_dataflash",
115 .chip_select = 0, 114 .chip_select = 0,
116 .max_speed_hz = 15 * 1000 * 1000, 115 .max_speed_hz = 15 * 1000 * 1000,
117 .bus_num = 0, 116 .bus_num = 0,
118 } 117 }
119#endif
120}; 118};
121 119
122static struct spi_board_info usb_a9g20_spi_devices[] = { 120static struct spi_board_info usb_a9g20_spi_devices[] = {
diff --git a/arch/arm/mach-at91/board-yl-9200.c b/arch/arm/mach-at91/board-yl-9200.c
index 516d340549d8..f162fdfd66eb 100644
--- a/arch/arm/mach-at91/board-yl-9200.c
+++ b/arch/arm/mach-at91/board-yl-9200.c
@@ -119,11 +119,12 @@ static struct at91_udc_data __initdata yl9200_udc_data = {
119/* 119/*
120 * MMC 120 * MMC
121 */ 121 */
122static struct at91_mmc_data __initdata yl9200_mmc_data = { 122static struct mci_platform_data __initdata yl9200_mci0_data = {
123 .det_pin = AT91_PIN_PB9, 123 .slot[0] = {
124 .wire4 = 1, 124 .bus_width = 4,
125 .wp_pin = -EINVAL, 125 .detect_pin = AT91_PIN_PB9,
126 .vcc_pin = -EINVAL, 126 .wp_pin = -EINVAL,
127 },
127}; 128};
128 129
129/* 130/*
@@ -541,9 +542,6 @@ void __init yl9200_add_device_video(void) {}
541 542
542static void __init yl9200_board_init(void) 543static void __init yl9200_board_init(void)
543{ 544{
544 /* Setup the LEDs D2=PB17 (timer), D3=PB16 (cpu) */
545 at91_init_leds(AT91_PIN_PB16, AT91_PIN_PB17);
546
547 /* Serial */ 545 /* Serial */
548 /* DBGU on ttyS0. (Rx & Tx only) */ 546 /* DBGU on ttyS0. (Rx & Tx only) */
549 at91_register_uart(0, 0, 0); 547 at91_register_uart(0, 0, 0);
@@ -568,7 +566,7 @@ static void __init yl9200_board_init(void)
568 /* I2C */ 566 /* I2C */
569 at91_add_device_i2c(yl9200_i2c_devices, ARRAY_SIZE(yl9200_i2c_devices)); 567 at91_add_device_i2c(yl9200_i2c_devices, ARRAY_SIZE(yl9200_i2c_devices));
570 /* MMC */ 568 /* MMC */
571 at91_add_device_mmc(0, &yl9200_mmc_data); 569 at91_add_device_mci(0, &yl9200_mci0_data);
572 /* NAND */ 570 /* NAND */
573 at91_add_device_nand(&yl9200_nand_data); 571 at91_add_device_nand(&yl9200_nand_data);
574 /* NOR Flash */ 572 /* NOR Flash */
diff --git a/arch/arm/mach-at91/include/mach/board.h b/arch/arm/mach-at91/include/mach/board.h
index 369afc2ffc5b..c55a4364ffb4 100644
--- a/arch/arm/mach-at91/include/mach/board.h
+++ b/arch/arm/mach-at91/include/mach/board.h
@@ -187,7 +187,6 @@ struct at91_can_data {
187extern void __init at91_add_device_can(struct at91_can_data *data); 187extern void __init at91_add_device_can(struct at91_can_data *data);
188 188
189 /* LEDs */ 189 /* LEDs */
190extern void __init at91_init_leds(u8 cpu_led, u8 timer_led);
191extern void __init at91_gpio_leds(struct gpio_led *leds, int nr); 190extern void __init at91_gpio_leds(struct gpio_led *leds, int nr);
192extern void __init at91_pwm_leds(struct gpio_led *leds, int nr); 191extern void __init at91_pwm_leds(struct gpio_led *leds, int nr);
193 192
diff --git a/arch/arm/mach-at91/leds.c b/arch/arm/mach-at91/leds.c
index 8dfafe76ffe6..1b1e62b5f41b 100644
--- a/arch/arm/mach-at91/leds.c
+++ b/arch/arm/mach-at91/leds.c
@@ -90,108 +90,3 @@ void __init at91_pwm_leds(struct gpio_led *leds, int nr)
90#else 90#else
91void __init at91_pwm_leds(struct gpio_led *leds, int nr){} 91void __init at91_pwm_leds(struct gpio_led *leds, int nr){}
92#endif 92#endif
93
94
95/* ------------------------------------------------------------------------- */
96
97#if defined(CONFIG_LEDS)
98
99#include <asm/leds.h>
100
101/*
102 * Old ARM-specific LED framework; not fully functional when generic time is
103 * in use.
104 */
105
106static u8 at91_leds_cpu;
107static u8 at91_leds_timer;
108
109static inline void at91_led_on(unsigned int led)
110{
111 at91_set_gpio_value(led, 0);
112}
113
114static inline void at91_led_off(unsigned int led)
115{
116 at91_set_gpio_value(led, 1);
117}
118
119static inline void at91_led_toggle(unsigned int led)
120{
121 unsigned long is_off = at91_get_gpio_value(led);
122 if (is_off)
123 at91_led_on(led);
124 else
125 at91_led_off(led);
126}
127
128
129/*
130 * Handle LED events.
131 */
132static void at91_leds_event(led_event_t evt)
133{
134 unsigned long flags;
135
136 local_irq_save(flags);
137
138 switch(evt) {
139 case led_start: /* System startup */
140 at91_led_on(at91_leds_cpu);
141 break;
142
143 case led_stop: /* System stop / suspend */
144 at91_led_off(at91_leds_cpu);
145 break;
146
147#ifdef CONFIG_LEDS_TIMER
148 case led_timer: /* Every 50 timer ticks */
149 at91_led_toggle(at91_leds_timer);
150 break;
151#endif
152
153#ifdef CONFIG_LEDS_CPU
154 case led_idle_start: /* Entering idle state */
155 at91_led_off(at91_leds_cpu);
156 break;
157
158 case led_idle_end: /* Exit idle state */
159 at91_led_on(at91_leds_cpu);
160 break;
161#endif
162
163 default:
164 break;
165 }
166
167 local_irq_restore(flags);
168}
169
170
171static int __init leds_init(void)
172{
173 if (!at91_leds_timer || !at91_leds_cpu)
174 return -ENODEV;
175
176 leds_event = at91_leds_event;
177
178 leds_event(led_start);
179 return 0;
180}
181
182__initcall(leds_init);
183
184
185void __init at91_init_leds(u8 cpu_led, u8 timer_led)
186{
187 /* Enable GPIO to access the LEDs */
188 at91_set_gpio_output(cpu_led, 1);
189 at91_set_gpio_output(timer_led, 1);
190
191 at91_leds_cpu = cpu_led;
192 at91_leds_timer = timer_led;
193}
194
195#else
196void __init at91_init_leds(u8 cpu_led, u8 timer_led) {}
197#endif
diff --git a/arch/arm/mach-clps711x/Makefile b/arch/arm/mach-clps711x/Makefile
index aed9eb664499..6da6940b3656 100644
--- a/arch/arm/mach-clps711x/Makefile
+++ b/arch/arm/mach-clps711x/Makefile
@@ -15,5 +15,3 @@ obj-$(CONFIG_ARCH_CLEP7312) += clep7312.o
15obj-$(CONFIG_ARCH_EDB7211) += edb7211-arch.o edb7211-mm.o 15obj-$(CONFIG_ARCH_EDB7211) += edb7211-arch.o edb7211-mm.o
16obj-$(CONFIG_ARCH_FORTUNET) += fortunet.o 16obj-$(CONFIG_ARCH_FORTUNET) += fortunet.o
17obj-$(CONFIG_ARCH_P720T) += p720t.o 17obj-$(CONFIG_ARCH_P720T) += p720t.o
18leds-$(CONFIG_ARCH_P720T) += p720t-leds.o
19obj-$(CONFIG_LEDS) += $(leds-y)
diff --git a/arch/arm/mach-clps711x/p720t-leds.c b/arch/arm/mach-clps711x/p720t-leds.c
deleted file mode 100644
index bbc449fbe14a..000000000000
--- a/arch/arm/mach-clps711x/p720t-leds.c
+++ /dev/null
@@ -1,63 +0,0 @@
1/*
2 * linux/arch/arm/mach-clps711x/leds.c
3 *
4 * Integrator LED control routines
5 *
6 * Copyright (C) 2000 Deep Blue Solutions Ltd
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22#include <linux/kernel.h>
23#include <linux/init.h>
24#include <linux/io.h>
25
26#include <mach/hardware.h>
27#include <asm/leds.h>
28#include <asm/mach-types.h>
29
30static void p720t_leds_event(led_event_t ledevt)
31{
32 unsigned long flags;
33 u32 pddr;
34
35 local_irq_save(flags);
36 switch(ledevt) {
37 case led_idle_start:
38 break;
39
40 case led_idle_end:
41 break;
42
43 case led_timer:
44 pddr = clps_readb(PDDR);
45 clps_writeb(pddr ^ 1, PDDR);
46 break;
47
48 default:
49 break;
50 }
51
52 local_irq_restore(flags);
53}
54
55static int __init leds_init(void)
56{
57 if (machine_is_p720t())
58 leds_event = p720t_leds_event;
59
60 return 0;
61}
62
63arch_initcall(leds_init);
diff --git a/arch/arm/mach-clps711x/p720t.c b/arch/arm/mach-clps711x/p720t.c
index f266d90b9efc..b752b586fc2f 100644
--- a/arch/arm/mach-clps711x/p720t.c
+++ b/arch/arm/mach-clps711x/p720t.c
@@ -23,6 +23,8 @@
23#include <linux/string.h> 23#include <linux/string.h>
24#include <linux/mm.h> 24#include <linux/mm.h>
25#include <linux/io.h> 25#include <linux/io.h>
26#include <linux/slab.h>
27#include <linux/leds.h>
26 28
27#include <mach/hardware.h> 29#include <mach/hardware.h>
28#include <asm/pgtable.h> 30#include <asm/pgtable.h>
@@ -34,6 +36,8 @@
34#include <asm/mach/map.h> 36#include <asm/mach/map.h>
35#include <mach/syspld.h> 37#include <mach/syspld.h>
36 38
39#include <asm/hardware/clps7111.h>
40
37#include "common.h" 41#include "common.h"
38 42
39/* 43/*
@@ -107,6 +111,64 @@ static void __init p720t_init_early(void)
107 } 111 }
108} 112}
109 113
114/*
115 * LED controled by CPLD
116 */
117#if defined(CONFIG_NEW_LEDS) && defined(CONFIG_LEDS_CLASS)
118static void p720t_led_set(struct led_classdev *cdev,
119 enum led_brightness b)
120{
121 u8 reg = clps_readb(PDDR);
122
123 if (b != LED_OFF)
124 reg |= 0x1;
125 else
126 reg &= ~0x1;
127
128 clps_writeb(reg, PDDR);
129}
130
131static enum led_brightness p720t_led_get(struct led_classdev *cdev)
132{
133 u8 reg = clps_readb(PDDR);
134
135 return (reg & 0x1) ? LED_FULL : LED_OFF;
136}
137
138static int __init p720t_leds_init(void)
139{
140
141 struct led_classdev *cdev;
142 int ret;
143
144 if (!machine_is_p720t())
145 return -ENODEV;
146
147 cdev = kzalloc(sizeof(*cdev), GFP_KERNEL);
148 if (!cdev)
149 return -ENOMEM;
150
151 cdev->name = "p720t:0";
152 cdev->brightness_set = p720t_led_set;
153 cdev->brightness_get = p720t_led_get;
154 cdev->default_trigger = "heartbeat";
155
156 ret = led_classdev_register(NULL, cdev);
157 if (ret < 0) {
158 kfree(cdev);
159 return ret;
160 }
161
162 return 0;
163}
164
165/*
166 * Since we may have triggers on any subsystem, defer registration
167 * until after subsystem_init.
168 */
169fs_initcall(p720t_leds_init);
170#endif
171
110MACHINE_START(P720T, "ARM-Prospector720T") 172MACHINE_START(P720T, "ARM-Prospector720T")
111 /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */ 173 /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
112 .atag_offset = 0x100, 174 .atag_offset = 0x100,
diff --git a/arch/arm/mach-ebsa110/Makefile b/arch/arm/mach-ebsa110/Makefile
index 6520ac835802..935e4af01a27 100644
--- a/arch/arm/mach-ebsa110/Makefile
+++ b/arch/arm/mach-ebsa110/Makefile
@@ -4,9 +4,7 @@
4 4
5# Object file lists. 5# Object file lists.
6 6
7obj-y := core.o io.o 7obj-y := core.o io.o leds.o
8obj-m := 8obj-m :=
9obj-n := 9obj-n :=
10obj- := 10obj- :=
11
12obj-$(CONFIG_LEDS) += leds.o
diff --git a/arch/arm/mach-ebsa110/leds.c b/arch/arm/mach-ebsa110/leds.c
index 99e14e362500..0398258c20cd 100644
--- a/arch/arm/mach-ebsa110/leds.c
+++ b/arch/arm/mach-ebsa110/leds.c
@@ -1,52 +1,71 @@
1/* 1/*
2 * linux/arch/arm/mach-ebsa110/leds.c 2 * Driver for the LED found on the EBSA110 machine
3 * Based on Versatile and RealView machine LED code
3 * 4 *
4 * Copyright (C) 1998 Russell King 5 * License terms: GNU General Public License (GPL) version 2
5 * 6 * Author: Bryan Wu <bryan.wu@canonical.com>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * EBSA-110 LED control routines. We use the led as follows:
11 *
12 * - Red - toggles state every 50 timer interrupts
13 */ 7 */
14#include <linux/module.h> 8#include <linux/kernel.h>
15#include <linux/spinlock.h>
16#include <linux/init.h> 9#include <linux/init.h>
10#include <linux/io.h>
11#include <linux/slab.h>
12#include <linux/leds.h>
17 13
18#include <mach/hardware.h>
19#include <asm/leds.h>
20#include <asm/mach-types.h> 14#include <asm/mach-types.h>
21 15
22#include "core.h" 16#include "core.h"
23 17
24static spinlock_t leds_lock; 18#if defined(CONFIG_NEW_LEDS) && defined(CONFIG_LEDS_CLASS)
25 19static void ebsa110_led_set(struct led_classdev *cdev,
26static void ebsa110_leds_event(led_event_t ledevt) 20 enum led_brightness b)
27{ 21{
28 unsigned long flags; 22 u8 reg = __raw_readb(SOFT_BASE);
29 23
30 spin_lock_irqsave(&leds_lock, flags); 24 if (b != LED_OFF)
25 reg |= 0x80;
26 else
27 reg &= ~0x80;
31 28
32 switch(ledevt) { 29 __raw_writeb(reg, SOFT_BASE);
33 case led_timer: 30}
34 *(volatile unsigned char *)SOFT_BASE ^= 128;
35 break;
36 31
37 default: 32static enum led_brightness ebsa110_led_get(struct led_classdev *cdev)
38 break; 33{
39 } 34 u8 reg = __raw_readb(SOFT_BASE);
40 35
41 spin_unlock_irqrestore(&leds_lock, flags); 36 return (reg & 0x80) ? LED_FULL : LED_OFF;
42} 37}
43 38
44static int __init leds_init(void) 39static int __init ebsa110_leds_init(void)
45{ 40{
46 if (machine_is_ebsa110()) 41
47 leds_event = ebsa110_leds_event; 42 struct led_classdev *cdev;
43 int ret;
44
45 if (!machine_is_ebsa110())
46 return -ENODEV;
47
48 cdev = kzalloc(sizeof(*cdev), GFP_KERNEL);
49 if (!cdev)
50 return -ENOMEM;
51
52 cdev->name = "ebsa110:0";
53 cdev->brightness_set = ebsa110_led_set;
54 cdev->brightness_get = ebsa110_led_get;
55 cdev->default_trigger = "heartbeat";
56
57 ret = led_classdev_register(NULL, cdev);
58 if (ret < 0) {
59 kfree(cdev);
60 return ret;
61 }
48 62
49 return 0; 63 return 0;
50} 64}
51 65
52__initcall(leds_init); 66/*
67 * Since we may have triggers on any subsystem, defer registration
68 * until after subsystem_init.
69 */
70fs_initcall(ebsa110_leds_init);
71#endif
diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
index 6c3299ebbfc5..412884dafa6c 100644
--- a/arch/arm/mach-exynos/Kconfig
+++ b/arch/arm/mach-exynos/Kconfig
@@ -405,6 +405,8 @@ config MACH_EXYNOS4_DT
405 select USE_OF 405 select USE_OF
406 select ARM_AMBA 406 select ARM_AMBA
407 select HAVE_SAMSUNG_KEYPAD if INPUT_KEYBOARD 407 select HAVE_SAMSUNG_KEYPAD if INPUT_KEYBOARD
408 select PINCTRL
409 select PINCTRL_EXYNOS4
408 help 410 help
409 Machine support for Samsung Exynos4 machine with device tree enabled. 411 Machine support for Samsung Exynos4 machine with device tree enabled.
410 Select this if a fdt blob is available for the Exynos4 SoC based board. 412 Select this if a fdt blob is available for the Exynos4 SoC based board.
diff --git a/arch/arm/mach-exynos/clock-exynos5.c b/arch/arm/mach-exynos/clock-exynos5.c
index 618d0aaaa599..f3171c3f3d94 100644
--- a/arch/arm/mach-exynos/clock-exynos5.c
+++ b/arch/arm/mach-exynos/clock-exynos5.c
@@ -547,6 +547,68 @@ static struct clksrc_clk exynos5_clk_aclk_66 = {
547 .reg_div = { .reg = EXYNOS5_CLKDIV_TOP0, .shift = 0, .size = 3 }, 547 .reg_div = { .reg = EXYNOS5_CLKDIV_TOP0, .shift = 0, .size = 3 },
548}; 548};
549 549
550static struct clksrc_clk exynos5_clk_mout_aclk_300_gscl_mid = {
551 .clk = {
552 .name = "mout_aclk_300_gscl_mid",
553 },
554 .sources = &exynos5_clkset_aclk,
555 .reg_src = { .reg = EXYNOS5_CLKSRC_TOP0, .shift = 24, .size = 1 },
556};
557
558static struct clk *exynos5_clkset_aclk_300_mid1_list[] = {
559 [0] = &exynos5_clk_sclk_vpll.clk,
560 [1] = &exynos5_clk_mout_cpll.clk,
561};
562
563static struct clksrc_sources exynos5_clkset_aclk_300_gscl_mid1 = {
564 .sources = exynos5_clkset_aclk_300_mid1_list,
565 .nr_sources = ARRAY_SIZE(exynos5_clkset_aclk_300_mid1_list),
566};
567
568static struct clksrc_clk exynos5_clk_mout_aclk_300_gscl_mid1 = {
569 .clk = {
570 .name = "mout_aclk_300_gscl_mid1",
571 },
572 .sources = &exynos5_clkset_aclk_300_gscl_mid1,
573 .reg_src = { .reg = EXYNOS5_CLKSRC_TOP1, .shift = 12, .size = 1 },
574};
575
576static struct clk *exynos5_clkset_aclk_300_gscl_list[] = {
577 [0] = &exynos5_clk_mout_aclk_300_gscl_mid.clk,
578 [1] = &exynos5_clk_mout_aclk_300_gscl_mid1.clk,
579};
580
581static struct clksrc_sources exynos5_clkset_aclk_300_gscl = {
582 .sources = exynos5_clkset_aclk_300_gscl_list,
583 .nr_sources = ARRAY_SIZE(exynos5_clkset_aclk_300_gscl_list),
584};
585
586static struct clksrc_clk exynos5_clk_mout_aclk_300_gscl = {
587 .clk = {
588 .name = "mout_aclk_300_gscl",
589 },
590 .sources = &exynos5_clkset_aclk_300_gscl,
591 .reg_src = { .reg = EXYNOS5_CLKSRC_TOP0, .shift = 25, .size = 1 },
592};
593
594static struct clk *exynos5_clk_src_gscl_300_list[] = {
595 [0] = &clk_ext_xtal_mux,
596 [1] = &exynos5_clk_mout_aclk_300_gscl.clk,
597};
598
599static struct clksrc_sources exynos5_clk_src_gscl_300 = {
600 .sources = exynos5_clk_src_gscl_300_list,
601 .nr_sources = ARRAY_SIZE(exynos5_clk_src_gscl_300_list),
602};
603
604static struct clksrc_clk exynos5_clk_aclk_300_gscl = {
605 .clk = {
606 .name = "aclk_300_gscl",
607 },
608 .sources = &exynos5_clk_src_gscl_300,
609 .reg_src = { .reg = EXYNOS5_CLKSRC_TOP3, .shift = 10, .size = 1 },
610};
611
550static struct clk exynos5_init_clocks_off[] = { 612static struct clk exynos5_init_clocks_off[] = {
551 { 613 {
552 .name = "timers", 614 .name = "timers",
@@ -755,6 +817,26 @@ static struct clk exynos5_init_clocks_off[] = {
755 .enable = exynos5_clk_ip_peric_ctrl, 817 .enable = exynos5_clk_ip_peric_ctrl,
756 .ctrlbit = (1 << 18), 818 .ctrlbit = (1 << 18),
757 }, { 819 }, {
820 .name = "gscl",
821 .devname = "exynos-gsc.0",
822 .enable = exynos5_clk_ip_gscl_ctrl,
823 .ctrlbit = (1 << 0),
824 }, {
825 .name = "gscl",
826 .devname = "exynos-gsc.1",
827 .enable = exynos5_clk_ip_gscl_ctrl,
828 .ctrlbit = (1 << 1),
829 }, {
830 .name = "gscl",
831 .devname = "exynos-gsc.2",
832 .enable = exynos5_clk_ip_gscl_ctrl,
833 .ctrlbit = (1 << 2),
834 }, {
835 .name = "gscl",
836 .devname = "exynos-gsc.3",
837 .enable = exynos5_clk_ip_gscl_ctrl,
838 .ctrlbit = (1 << 3),
839 }, {
758 .name = SYSMMU_CLOCK_NAME, 840 .name = SYSMMU_CLOCK_NAME,
759 .devname = SYSMMU_CLOCK_DEVNAME(mfc_l, 0), 841 .devname = SYSMMU_CLOCK_DEVNAME(mfc_l, 0),
760 .enable = &exynos5_clk_ip_mfc_ctrl, 842 .enable = &exynos5_clk_ip_mfc_ctrl,
@@ -1225,6 +1307,10 @@ static struct clksrc_clk *exynos5_sysclks[] = {
1225 &exynos5_clk_aclk_266, 1307 &exynos5_clk_aclk_266,
1226 &exynos5_clk_aclk_200, 1308 &exynos5_clk_aclk_200,
1227 &exynos5_clk_aclk_166, 1309 &exynos5_clk_aclk_166,
1310 &exynos5_clk_aclk_300_gscl,
1311 &exynos5_clk_mout_aclk_300_gscl,
1312 &exynos5_clk_mout_aclk_300_gscl_mid,
1313 &exynos5_clk_mout_aclk_300_gscl_mid1,
1228 &exynos5_clk_aclk_66_pre, 1314 &exynos5_clk_aclk_66_pre,
1229 &exynos5_clk_aclk_66, 1315 &exynos5_clk_aclk_66,
1230 &exynos5_clk_dout_mmc0, 1316 &exynos5_clk_dout_mmc0,
diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c
index 4eb39cdf75ea..715b690e5009 100644
--- a/arch/arm/mach-exynos/common.c
+++ b/arch/arm/mach-exynos/common.c
@@ -980,6 +980,32 @@ static int __init exynos_init_irq_eint(void)
980{ 980{
981 int irq; 981 int irq;
982 982
983#ifdef CONFIG_PINCTRL_SAMSUNG
984 /*
985 * The Samsung pinctrl driver provides an integrated gpio/pinmux/pinconf
986 * functionality along with support for external gpio and wakeup
987 * interrupts. If the samsung pinctrl driver is enabled and includes
988 * the wakeup interrupt support, then the setting up external wakeup
989 * interrupts here can be skipped. This check here is temporary to
990 * allow exynos4 platforms that do not use Samsung pinctrl driver to
991 * co-exist with platforms that do. When all of the Samsung Exynos4
992 * platforms switch over to using the pinctrl driver, the wakeup
993 * interrupt support code here can be completely removed.
994 */
995 struct device_node *pctrl_np, *wkup_np;
996 const char *pctrl_compat = "samsung,pinctrl-exynos4210";
997 const char *wkup_compat = "samsung,exynos4210-wakeup-eint";
998
999 for_each_compatible_node(pctrl_np, NULL, pctrl_compat) {
1000 if (of_device_is_available(pctrl_np)) {
1001 wkup_np = of_find_compatible_node(pctrl_np, NULL,
1002 wkup_compat);
1003 if (wkup_np)
1004 return -ENODEV;
1005 }
1006 }
1007#endif
1008
983 if (soc_is_exynos5250()) 1009 if (soc_is_exynos5250())
984 exynos_eint_base = ioremap(EXYNOS5_PA_GPIO1, SZ_4K); 1010 exynos_eint_base = ioremap(EXYNOS5_PA_GPIO1, SZ_4K);
985 else 1011 else
diff --git a/arch/arm/mach-exynos/include/mach/map.h b/arch/arm/mach-exynos/include/mach/map.h
index 6d33f50c2e56..5aa77f996e59 100644
--- a/arch/arm/mach-exynos/include/mach/map.h
+++ b/arch/arm/mach-exynos/include/mach/map.h
@@ -121,6 +121,11 @@
121#define EXYNOS4_PA_SYSMMU_MFC_L 0x13620000 121#define EXYNOS4_PA_SYSMMU_MFC_L 0x13620000
122#define EXYNOS4_PA_SYSMMU_MFC_R 0x13630000 122#define EXYNOS4_PA_SYSMMU_MFC_R 0x13630000
123 123
124#define EXYNOS5_PA_GSC0 0x13E00000
125#define EXYNOS5_PA_GSC1 0x13E10000
126#define EXYNOS5_PA_GSC2 0x13E20000
127#define EXYNOS5_PA_GSC3 0x13E30000
128
124#define EXYNOS5_PA_SYSMMU_MDMA1 0x10A40000 129#define EXYNOS5_PA_SYSMMU_MDMA1 0x10A40000
125#define EXYNOS5_PA_SYSMMU_SSS 0x10A50000 130#define EXYNOS5_PA_SYSMMU_SSS 0x10A50000
126#define EXYNOS5_PA_SYSMMU_2D 0x10A60000 131#define EXYNOS5_PA_SYSMMU_2D 0x10A60000
diff --git a/arch/arm/mach-exynos/mach-exynos5-dt.c b/arch/arm/mach-exynos/mach-exynos5-dt.c
index ef770bc2318f..e707eb1b1eab 100644
--- a/arch/arm/mach-exynos/mach-exynos5-dt.c
+++ b/arch/arm/mach-exynos/mach-exynos5-dt.c
@@ -56,6 +56,14 @@ static const struct of_dev_auxdata exynos5250_auxdata_lookup[] __initconst = {
56 OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA0, "dma-pl330.0", NULL), 56 OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA0, "dma-pl330.0", NULL),
57 OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA1, "dma-pl330.1", NULL), 57 OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA1, "dma-pl330.1", NULL),
58 OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_MDMA1, "dma-pl330.2", NULL), 58 OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_MDMA1, "dma-pl330.2", NULL),
59 OF_DEV_AUXDATA("samsung,exynos5-gsc", EXYNOS5_PA_GSC0,
60 "exynos-gsc.0", NULL),
61 OF_DEV_AUXDATA("samsung,exynos5-gsc", EXYNOS5_PA_GSC1,
62 "exynos-gsc.1", NULL),
63 OF_DEV_AUXDATA("samsung,exynos5-gsc", EXYNOS5_PA_GSC2,
64 "exynos-gsc.2", NULL),
65 OF_DEV_AUXDATA("samsung,exynos5-gsc", EXYNOS5_PA_GSC3,
66 "exynos-gsc.3", NULL),
59 {}, 67 {},
60}; 68};
61 69
diff --git a/arch/arm/mach-footbridge/Makefile b/arch/arm/mach-footbridge/Makefile
index 3afb1b25946f..0b64dd430d61 100644
--- a/arch/arm/mach-footbridge/Makefile
+++ b/arch/arm/mach-footbridge/Makefile
@@ -14,15 +14,11 @@ pci-$(CONFIG_ARCH_EBSA285_HOST) += ebsa285-pci.o
14pci-$(CONFIG_ARCH_NETWINDER) += netwinder-pci.o 14pci-$(CONFIG_ARCH_NETWINDER) += netwinder-pci.o
15pci-$(CONFIG_ARCH_PERSONAL_SERVER) += personal-pci.o 15pci-$(CONFIG_ARCH_PERSONAL_SERVER) += personal-pci.o
16 16
17leds-$(CONFIG_ARCH_EBSA285) += ebsa285-leds.o
18leds-$(CONFIG_ARCH_NETWINDER) += netwinder-leds.o
19
20obj-$(CONFIG_ARCH_CATS) += cats-hw.o isa-timer.o 17obj-$(CONFIG_ARCH_CATS) += cats-hw.o isa-timer.o
21obj-$(CONFIG_ARCH_EBSA285) += ebsa285.o dc21285-timer.o 18obj-$(CONFIG_ARCH_EBSA285) += ebsa285.o dc21285-timer.o
22obj-$(CONFIG_ARCH_NETWINDER) += netwinder-hw.o isa-timer.o 19obj-$(CONFIG_ARCH_NETWINDER) += netwinder-hw.o isa-timer.o
23obj-$(CONFIG_ARCH_PERSONAL_SERVER) += personal.o dc21285-timer.o 20obj-$(CONFIG_ARCH_PERSONAL_SERVER) += personal.o dc21285-timer.o
24 21
25obj-$(CONFIG_PCI) +=$(pci-y) 22obj-$(CONFIG_PCI) +=$(pci-y)
26obj-$(CONFIG_LEDS) +=$(leds-y)
27 23
28obj-$(CONFIG_ISA) += isa.o isa-rtc.o 24obj-$(CONFIG_ISA) += isa.o isa-rtc.o
diff --git a/arch/arm/mach-footbridge/ebsa285-leds.c b/arch/arm/mach-footbridge/ebsa285-leds.c
deleted file mode 100644
index 5bd266754b95..000000000000
--- a/arch/arm/mach-footbridge/ebsa285-leds.c
+++ /dev/null
@@ -1,138 +0,0 @@
1/*
2 * linux/arch/arm/mach-footbridge/ebsa285-leds.c
3 *
4 * Copyright (C) 1998-1999 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 * EBSA-285 control routines.
10 *
11 * The EBSA-285 uses the leds as follows:
12 * - Green - toggles state every 50 timer interrupts
13 * - Amber - On if system is not idle
14 * - Red - currently unused
15 *
16 * Changelog:
17 * 02-05-1999 RMK Various cleanups
18 */
19#include <linux/module.h>
20#include <linux/kernel.h>
21#include <linux/init.h>
22#include <linux/spinlock.h>
23
24#include <mach/hardware.h>
25#include <asm/leds.h>
26#include <asm/mach-types.h>
27
28#define LED_STATE_ENABLED 1
29#define LED_STATE_CLAIMED 2
30static char led_state;
31static char hw_led_state;
32
33static DEFINE_SPINLOCK(leds_lock);
34
35static void ebsa285_leds_event(led_event_t evt)
36{
37 unsigned long flags;
38
39 spin_lock_irqsave(&leds_lock, flags);
40
41 switch (evt) {
42 case led_start:
43 hw_led_state = XBUS_LED_RED | XBUS_LED_GREEN;
44#ifndef CONFIG_LEDS_CPU
45 hw_led_state |= XBUS_LED_AMBER;
46#endif
47 led_state |= LED_STATE_ENABLED;
48 break;
49
50 case led_stop:
51 led_state &= ~LED_STATE_ENABLED;
52 break;
53
54 case led_claim:
55 led_state |= LED_STATE_CLAIMED;
56 hw_led_state = XBUS_LED_RED | XBUS_LED_GREEN | XBUS_LED_AMBER;
57 break;
58
59 case led_release:
60 led_state &= ~LED_STATE_CLAIMED;
61 hw_led_state = XBUS_LED_RED | XBUS_LED_GREEN | XBUS_LED_AMBER;
62 break;
63
64#ifdef CONFIG_LEDS_TIMER
65 case led_timer:
66 if (!(led_state & LED_STATE_CLAIMED))
67 hw_led_state ^= XBUS_LED_GREEN;
68 break;
69#endif
70
71#ifdef CONFIG_LEDS_CPU
72 case led_idle_start:
73 if (!(led_state & LED_STATE_CLAIMED))
74 hw_led_state |= XBUS_LED_AMBER;
75 break;
76
77 case led_idle_end:
78 if (!(led_state & LED_STATE_CLAIMED))
79 hw_led_state &= ~XBUS_LED_AMBER;
80 break;
81#endif
82
83 case led_halted:
84 if (!(led_state & LED_STATE_CLAIMED))
85 hw_led_state &= ~XBUS_LED_RED;
86 break;
87
88 case led_green_on:
89 if (led_state & LED_STATE_CLAIMED)
90 hw_led_state &= ~XBUS_LED_GREEN;
91 break;
92
93 case led_green_off:
94 if (led_state & LED_STATE_CLAIMED)
95 hw_led_state |= XBUS_LED_GREEN;
96 break;
97
98 case led_amber_on:
99 if (led_state & LED_STATE_CLAIMED)
100 hw_led_state &= ~XBUS_LED_AMBER;
101 break;
102
103 case led_amber_off:
104 if (led_state & LED_STATE_CLAIMED)
105 hw_led_state |= XBUS_LED_AMBER;
106 break;
107
108 case led_red_on:
109 if (led_state & LED_STATE_CLAIMED)
110 hw_led_state &= ~XBUS_LED_RED;
111 break;
112
113 case led_red_off:
114 if (led_state & LED_STATE_CLAIMED)
115 hw_led_state |= XBUS_LED_RED;
116 break;
117
118 default:
119 break;
120 }
121
122 if (led_state & LED_STATE_ENABLED)
123 *XBUS_LEDS = hw_led_state;
124
125 spin_unlock_irqrestore(&leds_lock, flags);
126}
127
128static int __init leds_init(void)
129{
130 if (machine_is_ebsa285())
131 leds_event = ebsa285_leds_event;
132
133 leds_event(led_start);
134
135 return 0;
136}
137
138__initcall(leds_init);
diff --git a/arch/arm/mach-footbridge/ebsa285.c b/arch/arm/mach-footbridge/ebsa285.c
index 27716a7e5fc1..b09551ef89ca 100644
--- a/arch/arm/mach-footbridge/ebsa285.c
+++ b/arch/arm/mach-footbridge/ebsa285.c
@@ -5,6 +5,8 @@
5 */ 5 */
6#include <linux/init.h> 6#include <linux/init.h>
7#include <linux/spinlock.h> 7#include <linux/spinlock.h>
8#include <linux/slab.h>
9#include <linux/leds.h>
8 10
9#include <asm/hardware/dec21285.h> 11#include <asm/hardware/dec21285.h>
10#include <asm/mach-types.h> 12#include <asm/mach-types.h>
@@ -13,6 +15,85 @@
13 15
14#include "common.h" 16#include "common.h"
15 17
18/* LEDs */
19#if defined(CONFIG_NEW_LEDS) && defined(CONFIG_LEDS_CLASS)
20struct ebsa285_led {
21 struct led_classdev cdev;
22 u8 mask;
23};
24
25/*
26 * The triggers lines up below will only be used if the
27 * LED triggers are compiled in.
28 */
29static const struct {
30 const char *name;
31 const char *trigger;
32} ebsa285_leds[] = {
33 { "ebsa285:amber", "heartbeat", },
34 { "ebsa285:green", "cpu0", },
35 { "ebsa285:red",},
36};
37
38static void ebsa285_led_set(struct led_classdev *cdev,
39 enum led_brightness b)
40{
41 struct ebsa285_led *led = container_of(cdev,
42 struct ebsa285_led, cdev);
43
44 if (b != LED_OFF)
45 *XBUS_LEDS |= led->mask;
46 else
47 *XBUS_LEDS &= ~led->mask;
48}
49
50static enum led_brightness ebsa285_led_get(struct led_classdev *cdev)
51{
52 struct ebsa285_led *led = container_of(cdev,
53 struct ebsa285_led, cdev);
54
55 return (*XBUS_LEDS & led->mask) ? LED_FULL : LED_OFF;
56}
57
58static int __init ebsa285_leds_init(void)
59{
60 int i;
61
62 if (machine_is_ebsa285())
63 return -ENODEV;
64
65 /* 3 LEDS All ON */
66 *XBUS_LEDS |= XBUS_LED_AMBER | XBUS_LED_GREEN | XBUS_LED_RED;
67
68 for (i = 0; i < ARRAY_SIZE(ebsa285_leds); i++) {
69 struct ebsa285_led *led;
70
71 led = kzalloc(sizeof(*led), GFP_KERNEL);
72 if (!led)
73 break;
74
75 led->cdev.name = ebsa285_leds[i].name;
76 led->cdev.brightness_set = ebsa285_led_set;
77 led->cdev.brightness_get = ebsa285_led_get;
78 led->cdev.default_trigger = ebsa285_leds[i].trigger;
79 led->mask = BIT(i);
80
81 if (led_classdev_register(NULL, &led->cdev) < 0) {
82 kfree(led);
83 break;
84 }
85 }
86
87 return 0;
88}
89
90/*
91 * Since we may have triggers on any subsystem, defer registration
92 * until after subsystem_init.
93 */
94fs_initcall(ebsa285_leds_init);
95#endif
96
16MACHINE_START(EBSA285, "EBSA285") 97MACHINE_START(EBSA285, "EBSA285")
17 /* Maintainer: Russell King */ 98 /* Maintainer: Russell King */
18 .atag_offset = 0x100, 99 .atag_offset = 0x100,
diff --git a/arch/arm/mach-footbridge/netwinder-hw.c b/arch/arm/mach-footbridge/netwinder-hw.c
index cac9f67e7da7..d2d14339c6c4 100644
--- a/arch/arm/mach-footbridge/netwinder-hw.c
+++ b/arch/arm/mach-footbridge/netwinder-hw.c
@@ -12,9 +12,10 @@
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/io.h> 13#include <linux/io.h>
14#include <linux/spinlock.h> 14#include <linux/spinlock.h>
15#include <linux/slab.h>
16#include <linux/leds.h>
15 17
16#include <asm/hardware/dec21285.h> 18#include <asm/hardware/dec21285.h>
17#include <asm/leds.h>
18#include <asm/mach-types.h> 19#include <asm/mach-types.h>
19#include <asm/setup.h> 20#include <asm/setup.h>
20#include <asm/system_misc.h> 21#include <asm/system_misc.h>
@@ -27,13 +28,6 @@
27#define GP1_IO_BASE 0x338 28#define GP1_IO_BASE 0x338
28#define GP2_IO_BASE 0x33a 29#define GP2_IO_BASE 0x33a
29 30
30
31#ifdef CONFIG_LEDS
32#define DEFAULT_LEDS 0
33#else
34#define DEFAULT_LEDS GPIO_GREEN_LED
35#endif
36
37/* 31/*
38 * Winbond WB83977F accessibility stuff 32 * Winbond WB83977F accessibility stuff
39 */ 33 */
@@ -611,15 +605,9 @@ static void __init rwa010_init(void)
611static int __init nw_hw_init(void) 605static int __init nw_hw_init(void)
612{ 606{
613 if (machine_is_netwinder()) { 607 if (machine_is_netwinder()) {
614 unsigned long flags;
615
616 wb977_init(); 608 wb977_init();
617 cpld_init(); 609 cpld_init();
618 rwa010_init(); 610 rwa010_init();
619
620 raw_spin_lock_irqsave(&nw_gpio_lock, flags);
621 nw_gpio_modify_op(GPIO_RED_LED|GPIO_GREEN_LED, DEFAULT_LEDS);
622 raw_spin_unlock_irqrestore(&nw_gpio_lock, flags);
623 } 611 }
624 return 0; 612 return 0;
625} 613}
@@ -672,6 +660,102 @@ static void netwinder_restart(char mode, const char *cmd)
672 } 660 }
673} 661}
674 662
663/* LEDs */
664#if defined(CONFIG_NEW_LEDS) && defined(CONFIG_LEDS_CLASS)
665struct netwinder_led {
666 struct led_classdev cdev;
667 u8 mask;
668};
669
670/*
671 * The triggers lines up below will only be used if the
672 * LED triggers are compiled in.
673 */
674static const struct {
675 const char *name;
676 const char *trigger;
677} netwinder_leds[] = {
678 { "netwinder:green", "heartbeat", },
679 { "netwinder:red", "cpu0", },
680};
681
682/*
683 * The LED control in Netwinder is reversed:
684 * - setting bit means turn off LED
685 * - clearing bit means turn on LED
686 */
687static void netwinder_led_set(struct led_classdev *cdev,
688 enum led_brightness b)
689{
690 struct netwinder_led *led = container_of(cdev,
691 struct netwinder_led, cdev);
692 unsigned long flags;
693 u32 reg;
694
695 spin_lock_irqsave(&nw_gpio_lock, flags);
696 reg = nw_gpio_read();
697 if (b != LED_OFF)
698 reg &= ~led->mask;
699 else
700 reg |= led->mask;
701 nw_gpio_modify_op(led->mask, reg);
702 spin_unlock_irqrestore(&nw_gpio_lock, flags);
703}
704
705static enum led_brightness netwinder_led_get(struct led_classdev *cdev)
706{
707 struct netwinder_led *led = container_of(cdev,
708 struct netwinder_led, cdev);
709 unsigned long flags;
710 u32 reg;
711
712 spin_lock_irqsave(&nw_gpio_lock, flags);
713 reg = nw_gpio_read();
714 spin_unlock_irqrestore(&nw_gpio_lock, flags);
715
716 return (reg & led->mask) ? LED_OFF : LED_FULL;
717}
718
719static int __init netwinder_leds_init(void)
720{
721 int i;
722
723 if (!machine_is_netwinder())
724 return -ENODEV;
725
726 for (i = 0; i < ARRAY_SIZE(netwinder_leds); i++) {
727 struct netwinder_led *led;
728
729 led = kzalloc(sizeof(*led), GFP_KERNEL);
730 if (!led)
731 break;
732
733 led->cdev.name = netwinder_leds[i].name;
734 led->cdev.brightness_set = netwinder_led_set;
735 led->cdev.brightness_get = netwinder_led_get;
736 led->cdev.default_trigger = netwinder_leds[i].trigger;
737
738 if (i == 0)
739 led->mask = GPIO_GREEN_LED;
740 else
741 led->mask = GPIO_RED_LED;
742
743 if (led_classdev_register(NULL, &led->cdev) < 0) {
744 kfree(led);
745 break;
746 }
747 }
748
749 return 0;
750}
751
752/*
753 * Since we may have triggers on any subsystem, defer registration
754 * until after subsystem_init.
755 */
756fs_initcall(netwinder_leds_init);
757#endif
758
675MACHINE_START(NETWINDER, "Rebel-NetWinder") 759MACHINE_START(NETWINDER, "Rebel-NetWinder")
676 /* Maintainer: Russell King/Rebel.com */ 760 /* Maintainer: Russell King/Rebel.com */
677 .atag_offset = 0x100, 761 .atag_offset = 0x100,
diff --git a/arch/arm/mach-footbridge/netwinder-leds.c b/arch/arm/mach-footbridge/netwinder-leds.c
deleted file mode 100644
index 5a2bd89cbdca..000000000000
--- a/arch/arm/mach-footbridge/netwinder-leds.c
+++ /dev/null
@@ -1,138 +0,0 @@
1/*
2 * linux/arch/arm/mach-footbridge/netwinder-leds.c
3 *
4 * Copyright (C) 1998-1999 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * NetWinder LED control routines.
11 *
12 * The Netwinder uses the leds as follows:
13 * - Green - toggles state every 50 timer interrupts
14 * - Red - On if the system is not idle
15 *
16 * Changelog:
17 * 02-05-1999 RMK Various cleanups
18 */
19#include <linux/module.h>
20#include <linux/kernel.h>
21#include <linux/init.h>
22#include <linux/spinlock.h>
23
24#include <mach/hardware.h>
25#include <asm/leds.h>
26#include <asm/mach-types.h>
27
28#define LED_STATE_ENABLED 1
29#define LED_STATE_CLAIMED 2
30static char led_state;
31static char hw_led_state;
32
33static DEFINE_RAW_SPINLOCK(leds_lock);
34
35static void netwinder_leds_event(led_event_t evt)
36{
37 unsigned long flags;
38
39 raw_spin_lock_irqsave(&leds_lock, flags);
40
41 switch (evt) {
42 case led_start:
43 led_state |= LED_STATE_ENABLED;
44 hw_led_state = GPIO_GREEN_LED;
45 break;
46
47 case led_stop:
48 led_state &= ~LED_STATE_ENABLED;
49 break;
50
51 case led_claim:
52 led_state |= LED_STATE_CLAIMED;
53 hw_led_state = 0;
54 break;
55
56 case led_release:
57 led_state &= ~LED_STATE_CLAIMED;
58 hw_led_state = 0;
59 break;
60
61#ifdef CONFIG_LEDS_TIMER
62 case led_timer:
63 if (!(led_state & LED_STATE_CLAIMED))
64 hw_led_state ^= GPIO_GREEN_LED;
65 break;
66#endif
67
68#ifdef CONFIG_LEDS_CPU
69 case led_idle_start:
70 if (!(led_state & LED_STATE_CLAIMED))
71 hw_led_state &= ~GPIO_RED_LED;
72 break;
73
74 case led_idle_end:
75 if (!(led_state & LED_STATE_CLAIMED))
76 hw_led_state |= GPIO_RED_LED;
77 break;
78#endif
79
80 case led_halted:
81 if (!(led_state & LED_STATE_CLAIMED))
82 hw_led_state |= GPIO_RED_LED;
83 break;
84
85 case led_green_on:
86 if (led_state & LED_STATE_CLAIMED)
87 hw_led_state |= GPIO_GREEN_LED;
88 break;
89
90 case led_green_off:
91 if (led_state & LED_STATE_CLAIMED)
92 hw_led_state &= ~GPIO_GREEN_LED;
93 break;
94
95 case led_amber_on:
96 if (led_state & LED_STATE_CLAIMED)
97 hw_led_state |= GPIO_GREEN_LED | GPIO_RED_LED;
98 break;
99
100 case led_amber_off:
101 if (led_state & LED_STATE_CLAIMED)
102 hw_led_state &= ~(GPIO_GREEN_LED | GPIO_RED_LED);
103 break;
104
105 case led_red_on:
106 if (led_state & LED_STATE_CLAIMED)
107 hw_led_state |= GPIO_RED_LED;
108 break;
109
110 case led_red_off:
111 if (led_state & LED_STATE_CLAIMED)
112 hw_led_state &= ~GPIO_RED_LED;
113 break;
114
115 default:
116 break;
117 }
118
119 raw_spin_unlock_irqrestore(&leds_lock, flags);
120
121 if (led_state & LED_STATE_ENABLED) {
122 raw_spin_lock_irqsave(&nw_gpio_lock, flags);
123 nw_gpio_modify_op(GPIO_RED_LED | GPIO_GREEN_LED, hw_led_state);
124 raw_spin_unlock_irqrestore(&nw_gpio_lock, flags);
125 }
126}
127
128static int __init leds_init(void)
129{
130 if (machine_is_netwinder())
131 leds_event = netwinder_leds_event;
132
133 leds_event(led_start);
134
135 return 0;
136}
137
138__initcall(leds_init);
diff --git a/arch/arm/mach-integrator/Makefile b/arch/arm/mach-integrator/Makefile
index ebeef966e1f5..5521d18bf19a 100644
--- a/arch/arm/mach-integrator/Makefile
+++ b/arch/arm/mach-integrator/Makefile
@@ -4,11 +4,10 @@
4 4
5# Object file lists. 5# Object file lists.
6 6
7obj-y := core.o lm.o 7obj-y := core.o lm.o leds.o
8obj-$(CONFIG_ARCH_INTEGRATOR_AP) += integrator_ap.o 8obj-$(CONFIG_ARCH_INTEGRATOR_AP) += integrator_ap.o
9obj-$(CONFIG_ARCH_INTEGRATOR_CP) += integrator_cp.o 9obj-$(CONFIG_ARCH_INTEGRATOR_CP) += integrator_cp.o
10 10
11obj-$(CONFIG_LEDS) += leds.o
12obj-$(CONFIG_PCI) += pci_v3.o pci.o 11obj-$(CONFIG_PCI) += pci_v3.o pci.o
13obj-$(CONFIG_CPU_FREQ_INTEGRATOR) += cpu.o 12obj-$(CONFIG_CPU_FREQ_INTEGRATOR) += cpu.o
14obj-$(CONFIG_INTEGRATOR_IMPD1) += impd1.o 13obj-$(CONFIG_INTEGRATOR_IMPD1) += impd1.o
diff --git a/arch/arm/mach-integrator/core.c b/arch/arm/mach-integrator/core.c
index a432d4325f89..dad3cb74ed31 100644
--- a/arch/arm/mach-integrator/core.c
+++ b/arch/arm/mach-integrator/core.c
@@ -28,7 +28,6 @@
28#include <mach/cm.h> 28#include <mach/cm.h>
29#include <mach/irqs.h> 29#include <mach/irqs.h>
30 30
31#include <asm/leds.h>
32#include <asm/mach-types.h> 31#include <asm/mach-types.h>
33#include <asm/mach/time.h> 32#include <asm/mach/time.h>
34#include <asm/pgtable.h> 33#include <asm/pgtable.h>
@@ -128,8 +127,6 @@ static struct amba_pl010_data integrator_uart_data = {
128 .set_mctrl = integrator_uart_set_mctrl, 127 .set_mctrl = integrator_uart_set_mctrl,
129}; 128};
130 129
131#define CM_CTRL IO_ADDRESS(INTEGRATOR_HDR_CTRL)
132
133static DEFINE_RAW_SPINLOCK(cm_lock); 130static DEFINE_RAW_SPINLOCK(cm_lock);
134 131
135/** 132/**
diff --git a/arch/arm/mach-integrator/include/mach/cm.h b/arch/arm/mach-integrator/include/mach/cm.h
index 445d57adb043..1a78692e32a4 100644
--- a/arch/arm/mach-integrator/include/mach/cm.h
+++ b/arch/arm/mach-integrator/include/mach/cm.h
@@ -3,6 +3,8 @@
3 */ 3 */
4void cm_control(u32, u32); 4void cm_control(u32, u32);
5 5
6#define CM_CTRL IO_ADDRESS(INTEGRATOR_HDR_CTRL)
7
6#define CM_CTRL_LED (1 << 0) 8#define CM_CTRL_LED (1 << 0)
7#define CM_CTRL_nMBDET (1 << 1) 9#define CM_CTRL_nMBDET (1 << 1)
8#define CM_CTRL_REMAP (1 << 2) 10#define CM_CTRL_REMAP (1 << 2)
diff --git a/arch/arm/mach-integrator/leds.c b/arch/arm/mach-integrator/leds.c
index 466defa97842..7a7f6d3273bf 100644
--- a/arch/arm/mach-integrator/leds.c
+++ b/arch/arm/mach-integrator/leds.c
@@ -1,90 +1,125 @@
1/* 1/*
2 * linux/arch/arm/mach-integrator/leds.c 2 * Driver for the 4 user LEDs found on the Integrator AP/CP baseboard
3 * Based on Versatile and RealView machine LED code
3 * 4 *
4 * Integrator/AP and Integrator/CP LED control routines 5 * License terms: GNU General Public License (GPL) version 2
5 * 6 * Author: Bryan Wu <bryan.wu@canonical.com>
6 * Copyright (C) 1999 ARM Limited
7 * Copyright (C) 2000 Deep Blue Solutions Ltd
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 as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */ 7 */
23#include <linux/kernel.h> 8#include <linux/kernel.h>
24#include <linux/init.h> 9#include <linux/init.h>
25#include <linux/smp.h>
26#include <linux/spinlock.h>
27#include <linux/io.h> 10#include <linux/io.h>
11#include <linux/slab.h>
12#include <linux/leds.h>
28 13
14#include <mach/cm.h>
29#include <mach/hardware.h> 15#include <mach/hardware.h>
30#include <mach/platform.h> 16#include <mach/platform.h>
31#include <asm/leds.h>
32#include <asm/mach-types.h>
33#include <mach/cm.h>
34 17
35static int saved_leds; 18#if defined(CONFIG_NEW_LEDS) && defined(CONFIG_LEDS_CLASS)
19
20#define ALPHA_REG __io_address(INTEGRATOR_DBG_BASE)
21#define LEDREG (__io_address(INTEGRATOR_DBG_BASE) + INTEGRATOR_DBG_LEDS_OFFSET)
36 22
37static void integrator_leds_event(led_event_t ledevt) 23struct integrator_led {
24 struct led_classdev cdev;
25 u8 mask;
26};
27
28/*
29 * The triggers lines up below will only be used if the
30 * LED triggers are compiled in.
31 */
32static const struct {
33 const char *name;
34 const char *trigger;
35} integrator_leds[] = {
36 { "integrator:green0", "heartbeat", },
37 { "integrator:yellow", },
38 { "integrator:red", },
39 { "integrator:green1", },
40 { "integrator:core_module", "cpu0", },
41};
42
43static void integrator_led_set(struct led_classdev *cdev,
44 enum led_brightness b)
38{ 45{
39 unsigned long flags; 46 struct integrator_led *led = container_of(cdev,
40 const unsigned int dbg_base = IO_ADDRESS(INTEGRATOR_DBG_BASE); 47 struct integrator_led, cdev);
41 unsigned int update_alpha_leds; 48 u32 reg = __raw_readl(LEDREG);
42 49
43 // yup, change the LEDs 50 if (b != LED_OFF)
44 local_irq_save(flags); 51 reg |= led->mask;
45 update_alpha_leds = 0; 52 else
53 reg &= ~led->mask;
46 54
47 switch(ledevt) { 55 while (__raw_readl(ALPHA_REG) & 1)
48 case led_idle_start: 56 cpu_relax();
49 cm_control(CM_CTRL_LED, 0);
50 break;
51 57
52 case led_idle_end: 58 __raw_writel(reg, LEDREG);
53 cm_control(CM_CTRL_LED, CM_CTRL_LED); 59}
54 break;
55 60
56 case led_timer: 61static enum led_brightness integrator_led_get(struct led_classdev *cdev)
57 saved_leds ^= GREEN_LED; 62{
58 update_alpha_leds = 1; 63 struct integrator_led *led = container_of(cdev,
59 break; 64 struct integrator_led, cdev);
65 u32 reg = __raw_readl(LEDREG);
60 66
61 case led_red_on: 67 return (reg & led->mask) ? LED_FULL : LED_OFF;
62 saved_leds |= RED_LED; 68}
63 update_alpha_leds = 1;
64 break;
65 69
66 case led_red_off: 70static void cm_led_set(struct led_classdev *cdev,
67 saved_leds &= ~RED_LED; 71 enum led_brightness b)
68 update_alpha_leds = 1; 72{
69 break; 73 if (b != LED_OFF)
74 cm_control(CM_CTRL_LED, CM_CTRL_LED);
75 else
76 cm_control(CM_CTRL_LED, 0);
77}
70 78
71 default: 79static enum led_brightness cm_led_get(struct led_classdev *cdev)
72 break; 80{
73 } 81 u32 reg = readl(CM_CTRL);
74 82
75 if (update_alpha_leds) { 83 return (reg & CM_CTRL_LED) ? LED_FULL : LED_OFF;
76 while (__raw_readl(dbg_base + INTEGRATOR_DBG_ALPHA_OFFSET) & 1);
77 __raw_writel(saved_leds, dbg_base + INTEGRATOR_DBG_LEDS_OFFSET);
78 }
79 local_irq_restore(flags);
80} 84}
81 85
82static int __init leds_init(void) 86static int __init integrator_leds_init(void)
83{ 87{
84 if (machine_is_integrator() || machine_is_cintegrator()) 88 int i;
85 leds_event = integrator_leds_event; 89
90 for (i = 0; i < ARRAY_SIZE(integrator_leds); i++) {
91 struct integrator_led *led;
92
93 led = kzalloc(sizeof(*led), GFP_KERNEL);
94 if (!led)
95 break;
96
97
98 led->cdev.name = integrator_leds[i].name;
99
100 if (i == 4) { /* Setting for LED in core module */
101 led->cdev.brightness_set = cm_led_set;
102 led->cdev.brightness_get = cm_led_get;
103 } else {
104 led->cdev.brightness_set = integrator_led_set;
105 led->cdev.brightness_get = integrator_led_get;
106 }
107
108 led->cdev.default_trigger = integrator_leds[i].trigger;
109 led->mask = BIT(i);
110
111 if (led_classdev_register(NULL, &led->cdev) < 0) {
112 kfree(led);
113 break;
114 }
115 }
86 116
87 return 0; 117 return 0;
88} 118}
89 119
90core_initcall(leds_init); 120/*
121 * Since we may have triggers on any subsystem, defer registration
122 * until after subsystem_init.
123 */
124fs_initcall(integrator_leds_init);
125#endif
diff --git a/arch/arm/mach-ks8695/Makefile b/arch/arm/mach-ks8695/Makefile
index 853efd9133c6..9324ef965c26 100644
--- a/arch/arm/mach-ks8695/Makefile
+++ b/arch/arm/mach-ks8695/Makefile
@@ -11,9 +11,6 @@ obj- :=
11# PCI support is optional 11# PCI support is optional
12obj-$(CONFIG_PCI) += pci.o 12obj-$(CONFIG_PCI) += pci.o
13 13
14# LEDs
15obj-$(CONFIG_LEDS) += leds.o
16
17# Board-specific support 14# Board-specific support
18obj-$(CONFIG_MACH_KS8695) += board-micrel.o 15obj-$(CONFIG_MACH_KS8695) += board-micrel.o
19obj-$(CONFIG_MACH_DSM320) += board-dsm320.o 16obj-$(CONFIG_MACH_DSM320) += board-dsm320.o
diff --git a/arch/arm/mach-ks8695/devices.c b/arch/arm/mach-ks8695/devices.c
index 73bd63812878..47399bc3c024 100644
--- a/arch/arm/mach-ks8695/devices.c
+++ b/arch/arm/mach-ks8695/devices.c
@@ -182,27 +182,6 @@ static void __init ks8695_add_device_watchdog(void)
182} 182}
183 183
184 184
185/* --------------------------------------------------------------------
186 * LEDs
187 * -------------------------------------------------------------------- */
188
189#if defined(CONFIG_LEDS)
190short ks8695_leds_cpu = -1;
191short ks8695_leds_timer = -1;
192
193void __init ks8695_init_leds(u8 cpu_led, u8 timer_led)
194{
195 /* Enable GPIO to access the LEDs */
196 gpio_direction_output(cpu_led, 1);
197 gpio_direction_output(timer_led, 1);
198
199 ks8695_leds_cpu = cpu_led;
200 ks8695_leds_timer = timer_led;
201}
202#else
203void __init ks8695_init_leds(u8 cpu_led, u8 timer_led) {}
204#endif
205
206/* -------------------------------------------------------------------- */ 185/* -------------------------------------------------------------------- */
207 186
208/* 187/*
diff --git a/arch/arm/mach-ks8695/include/mach/devices.h b/arch/arm/mach-ks8695/include/mach/devices.h
index 85a3c9aa7d13..1e6594a0f297 100644
--- a/arch/arm/mach-ks8695/include/mach/devices.h
+++ b/arch/arm/mach-ks8695/include/mach/devices.h
@@ -18,11 +18,6 @@ extern void __init ks8695_add_device_wan(void);
18extern void __init ks8695_add_device_lan(void); 18extern void __init ks8695_add_device_lan(void);
19extern void __init ks8695_add_device_hpna(void); 19extern void __init ks8695_add_device_hpna(void);
20 20
21 /* LEDs */
22extern short ks8695_leds_cpu;
23extern short ks8695_leds_timer;
24extern void __init ks8695_init_leds(u8 cpu_led, u8 timer_led);
25
26 /* PCI */ 21 /* PCI */
27#define KS8695_MODE_PCI 0 22#define KS8695_MODE_PCI 0
28#define KS8695_MODE_MINIPCI 1 23#define KS8695_MODE_MINIPCI 1
diff --git a/arch/arm/mach-ks8695/leds.c b/arch/arm/mach-ks8695/leds.c
deleted file mode 100644
index 4bd707547293..000000000000
--- a/arch/arm/mach-ks8695/leds.c
+++ /dev/null
@@ -1,92 +0,0 @@
1/*
2 * LED driver for KS8695-based boards.
3 *
4 * Copyright (C) Andrew Victor
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#include <linux/gpio.h>
11#include <linux/kernel.h>
12#include <linux/module.h>
13#include <linux/init.h>
14
15#include <asm/leds.h>
16#include <mach/devices.h>
17
18
19static inline void ks8695_led_on(unsigned int led)
20{
21 gpio_set_value(led, 0);
22}
23
24static inline void ks8695_led_off(unsigned int led)
25{
26 gpio_set_value(led, 1);
27}
28
29static inline void ks8695_led_toggle(unsigned int led)
30{
31 unsigned long is_off = gpio_get_value(led);
32 if (is_off)
33 ks8695_led_on(led);
34 else
35 ks8695_led_off(led);
36}
37
38
39/*
40 * Handle LED events.
41 */
42static void ks8695_leds_event(led_event_t evt)
43{
44 unsigned long flags;
45
46 local_irq_save(flags);
47
48 switch(evt) {
49 case led_start: /* System startup */
50 ks8695_led_on(ks8695_leds_cpu);
51 break;
52
53 case led_stop: /* System stop / suspend */
54 ks8695_led_off(ks8695_leds_cpu);
55 break;
56
57#ifdef CONFIG_LEDS_TIMER
58 case led_timer: /* Every 50 timer ticks */
59 ks8695_led_toggle(ks8695_leds_timer);
60 break;
61#endif
62
63#ifdef CONFIG_LEDS_CPU
64 case led_idle_start: /* Entering idle state */
65 ks8695_led_off(ks8695_leds_cpu);
66 break;
67
68 case led_idle_end: /* Exit idle state */
69 ks8695_led_on(ks8695_leds_cpu);
70 break;
71#endif
72
73 default:
74 break;
75 }
76
77 local_irq_restore(flags);
78}
79
80
81static int __init leds_init(void)
82{
83 if ((ks8695_leds_timer == -1) || (ks8695_leds_cpu == -1))
84 return -ENODEV;
85
86 leds_event = ks8695_leds_event;
87
88 leds_event(led_start);
89 return 0;
90}
91
92__initcall(leds_init);
diff --git a/arch/arm/mach-omap1/Makefile b/arch/arm/mach-omap1/Makefile
index 398e9e53e189..cd169c386161 100644
--- a/arch/arm/mach-omap1/Makefile
+++ b/arch/arm/mach-omap1/Makefile
@@ -61,14 +61,6 @@ obj-$(CONFIG_ARCH_OMAP850) += gpio7xx.o
61obj-$(CONFIG_ARCH_OMAP15XX) += gpio15xx.o 61obj-$(CONFIG_ARCH_OMAP15XX) += gpio15xx.o
62obj-$(CONFIG_ARCH_OMAP16XX) += gpio16xx.o 62obj-$(CONFIG_ARCH_OMAP16XX) += gpio16xx.o
63 63
64# LEDs support
65led-$(CONFIG_MACH_OMAP_H2) += leds-h2p2-debug.o
66led-$(CONFIG_MACH_OMAP_H3) += leds-h2p2-debug.o
67led-$(CONFIG_MACH_OMAP_INNOVATOR) += leds-innovator.o
68led-$(CONFIG_MACH_OMAP_PERSEUS2) += leds-h2p2-debug.o
69led-$(CONFIG_MACH_OMAP_OSK) += leds-osk.o
70obj-$(CONFIG_LEDS) += $(led-y)
71
72ifneq ($(CONFIG_FB_OMAP),) 64ifneq ($(CONFIG_FB_OMAP),)
73obj-y += lcd_dma.o 65obj-y += lcd_dma.o
74endif 66endif
diff --git a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c
index af283a2bc7c7..376f7f29ef77 100644
--- a/arch/arm/mach-omap1/board-h2.c
+++ b/arch/arm/mach-omap1/board-h2.c
@@ -32,6 +32,7 @@
32#include <linux/smc91x.h> 32#include <linux/smc91x.h>
33#include <linux/omapfb.h> 33#include <linux/omapfb.h>
34#include <linux/platform_data/gpio-omap.h> 34#include <linux/platform_data/gpio-omap.h>
35#include <linux/leds.h>
35 36
36#include <asm/mach-types.h> 37#include <asm/mach-types.h>
37#include <asm/mach/arch.h> 38#include <asm/mach/arch.h>
@@ -307,12 +308,39 @@ static struct platform_device h2_irda_device = {
307 .resource = h2_irda_resources, 308 .resource = h2_irda_resources,
308}; 309};
309 310
311static struct gpio_led h2_gpio_led_pins[] = {
312 {
313 .name = "h2:red",
314 .default_trigger = "heartbeat",
315 .gpio = 3,
316 },
317 {
318 .name = "h2:green",
319 .default_trigger = "cpu0",
320 .gpio = OMAP_MPUIO(4),
321 },
322};
323
324static struct gpio_led_platform_data h2_gpio_led_data = {
325 .leds = h2_gpio_led_pins,
326 .num_leds = ARRAY_SIZE(h2_gpio_led_pins),
327};
328
329static struct platform_device h2_gpio_leds = {
330 .name = "leds-gpio",
331 .id = -1,
332 .dev = {
333 .platform_data = &h2_gpio_led_data,
334 },
335};
336
310static struct platform_device *h2_devices[] __initdata = { 337static struct platform_device *h2_devices[] __initdata = {
311 &h2_nor_device, 338 &h2_nor_device,
312 &h2_nand_device, 339 &h2_nand_device,
313 &h2_smc91x_device, 340 &h2_smc91x_device,
314 &h2_irda_device, 341 &h2_irda_device,
315 &h2_kp_device, 342 &h2_kp_device,
343 &h2_gpio_leds,
316}; 344};
317 345
318static void __init h2_init_smc91x(void) 346static void __init h2_init_smc91x(void)
@@ -407,6 +435,10 @@ static void __init h2_init(void)
407 omap_cfg_reg(E19_1610_KBR4); 435 omap_cfg_reg(E19_1610_KBR4);
408 omap_cfg_reg(N19_1610_KBR5); 436 omap_cfg_reg(N19_1610_KBR5);
409 437
438 /* GPIO based LEDs */
439 omap_cfg_reg(P18_1610_GPIO3);
440 omap_cfg_reg(MPUIO4);
441
410 h2_smc91x_resources[1].start = gpio_to_irq(0); 442 h2_smc91x_resources[1].start = gpio_to_irq(0);
411 h2_smc91x_resources[1].end = gpio_to_irq(0); 443 h2_smc91x_resources[1].end = gpio_to_irq(0);
412 platform_add_devices(h2_devices, ARRAY_SIZE(h2_devices)); 444 platform_add_devices(h2_devices, ARRAY_SIZE(h2_devices));
diff --git a/arch/arm/mach-omap1/board-h3.c b/arch/arm/mach-omap1/board-h3.c
index 06d11b1ee9c6..ededdb7ef28c 100644
--- a/arch/arm/mach-omap1/board-h3.c
+++ b/arch/arm/mach-omap1/board-h3.c
@@ -32,6 +32,7 @@
32#include <linux/smc91x.h> 32#include <linux/smc91x.h>
33#include <linux/omapfb.h> 33#include <linux/omapfb.h>
34#include <linux/platform_data/gpio-omap.h> 34#include <linux/platform_data/gpio-omap.h>
35#include <linux/leds.h>
35 36
36#include <asm/setup.h> 37#include <asm/setup.h>
37#include <asm/page.h> 38#include <asm/page.h>
@@ -325,6 +326,32 @@ static struct spi_board_info h3_spi_board_info[] __initdata = {
325 }, 326 },
326}; 327};
327 328
329static struct gpio_led h3_gpio_led_pins[] = {
330 {
331 .name = "h3:red",
332 .default_trigger = "heartbeat",
333 .gpio = 3,
334 },
335 {
336 .name = "h3:green",
337 .default_trigger = "cpu0",
338 .gpio = OMAP_MPUIO(4),
339 },
340};
341
342static struct gpio_led_platform_data h3_gpio_led_data = {
343 .leds = h3_gpio_led_pins,
344 .num_leds = ARRAY_SIZE(h3_gpio_led_pins),
345};
346
347static struct platform_device h3_gpio_leds = {
348 .name = "leds-gpio",
349 .id = -1,
350 .dev = {
351 .platform_data = &h3_gpio_led_data,
352 },
353};
354
328static struct platform_device *devices[] __initdata = { 355static struct platform_device *devices[] __initdata = {
329 &nor_device, 356 &nor_device,
330 &nand_device, 357 &nand_device,
@@ -332,6 +359,7 @@ static struct platform_device *devices[] __initdata = {
332 &intlat_device, 359 &intlat_device,
333 &h3_kp_device, 360 &h3_kp_device,
334 &h3_lcd_device, 361 &h3_lcd_device,
362 &h3_gpio_leds,
335}; 363};
336 364
337static struct omap_usb_config h3_usb_config __initdata = { 365static struct omap_usb_config h3_usb_config __initdata = {
@@ -399,6 +427,10 @@ static void __init h3_init(void)
399 omap_cfg_reg(E19_1610_KBR4); 427 omap_cfg_reg(E19_1610_KBR4);
400 omap_cfg_reg(N19_1610_KBR5); 428 omap_cfg_reg(N19_1610_KBR5);
401 429
430 /* GPIO based LEDs */
431 omap_cfg_reg(P18_1610_GPIO3);
432 omap_cfg_reg(MPUIO4);
433
402 smc91x_resources[1].start = gpio_to_irq(40); 434 smc91x_resources[1].start = gpio_to_irq(40);
403 smc91x_resources[1].end = gpio_to_irq(40); 435 smc91x_resources[1].end = gpio_to_irq(40);
404 platform_add_devices(devices, ARRAY_SIZE(devices)); 436 platform_add_devices(devices, ARRAY_SIZE(devices));
diff --git a/arch/arm/mach-omap1/board-osk.c b/arch/arm/mach-omap1/board-osk.c
index 2f1f9b967576..5973945a8741 100644
--- a/arch/arm/mach-omap1/board-osk.c
+++ b/arch/arm/mach-omap1/board-osk.c
@@ -382,10 +382,37 @@ static struct platform_device osk5912_lcd_device = {
382 .id = -1, 382 .id = -1,
383}; 383};
384 384
385static struct gpio_led mistral_gpio_led_pins[] = {
386 {
387 .name = "mistral:red",
388 .default_trigger = "heartbeat",
389 .gpio = 3,
390 },
391 {
392 .name = "mistral:green",
393 .default_trigger = "cpu0",
394 .gpio = OMAP_MPUIO(4),
395 },
396};
397
398static struct gpio_led_platform_data mistral_gpio_led_data = {
399 .leds = mistral_gpio_led_pins,
400 .num_leds = ARRAY_SIZE(mistral_gpio_led_pins),
401};
402
403static struct platform_device mistral_gpio_leds = {
404 .name = "leds-gpio",
405 .id = -1,
406 .dev = {
407 .platform_data = &mistral_gpio_led_data,
408 },
409};
410
385static struct platform_device *mistral_devices[] __initdata = { 411static struct platform_device *mistral_devices[] __initdata = {
386 &osk5912_kp_device, 412 &osk5912_kp_device,
387 &mistral_bl_device, 413 &mistral_bl_device,
388 &osk5912_lcd_device, 414 &osk5912_lcd_device,
415 &mistral_gpio_leds,
389}; 416};
390 417
391static int mistral_get_pendown_state(void) 418static int mistral_get_pendown_state(void)
@@ -510,6 +537,12 @@ static void __init osk_mistral_init(void)
510 if (gpio_request(2, "lcd_pwr") == 0) 537 if (gpio_request(2, "lcd_pwr") == 0)
511 gpio_direction_output(2, 1); 538 gpio_direction_output(2, 1);
512 539
540 /*
541 * GPIO based LEDs
542 */
543 omap_cfg_reg(P18_1610_GPIO3);
544 omap_cfg_reg(MPUIO4);
545
513 i2c_register_board_info(1, mistral_i2c_board_info, 546 i2c_register_board_info(1, mistral_i2c_board_info,
514 ARRAY_SIZE(mistral_i2c_board_info)); 547 ARRAY_SIZE(mistral_i2c_board_info));
515 548
diff --git a/arch/arm/mach-omap1/leds-h2p2-debug.c b/arch/arm/mach-omap1/leds-h2p2-debug.c
deleted file mode 100644
index 6f958aec9459..000000000000
--- a/arch/arm/mach-omap1/leds-h2p2-debug.c
+++ /dev/null
@@ -1,169 +0,0 @@
1/*
2 * linux/arch/arm/mach-omap1/leds-h2p2-debug.c
3 *
4 * Copyright 2003 by Texas Instruments Incorporated
5 *
6 * There are 16 LEDs on the debug board (all green); four may be used
7 * for logical 'green', 'amber', 'red', and 'blue' (after "claiming").
8 *
9 * The "surfer" expansion board and H2 sample board also have two-color
10 * green+red LEDs (in parallel), used here for timer and idle indicators.
11 */
12#include <linux/gpio.h>
13#include <linux/init.h>
14#include <linux/kernel_stat.h>
15#include <linux/sched.h>
16#include <linux/io.h>
17#include <linux/platform_data/gpio-omap.h>
18
19#include <mach/hardware.h>
20#include <asm/leds.h>
21#include <asm/mach-types.h>
22
23#include <plat/fpga.h>
24
25#include "leds.h"
26
27
28#define GPIO_LED_RED 3
29#define GPIO_LED_GREEN OMAP_MPUIO(4)
30
31
32#define LED_STATE_ENABLED 0x01
33#define LED_STATE_CLAIMED 0x02
34#define LED_TIMER_ON 0x04
35
36#define GPIO_IDLE GPIO_LED_GREEN
37#define GPIO_TIMER GPIO_LED_RED
38
39
40void h2p2_dbg_leds_event(led_event_t evt)
41{
42 unsigned long flags;
43
44 static struct h2p2_dbg_fpga __iomem *fpga;
45 static u16 led_state, hw_led_state;
46
47 local_irq_save(flags);
48
49 if (!(led_state & LED_STATE_ENABLED) && evt != led_start)
50 goto done;
51
52 switch (evt) {
53 case led_start:
54 if (!fpga)
55 fpga = ioremap(H2P2_DBG_FPGA_START,
56 H2P2_DBG_FPGA_SIZE);
57 if (fpga) {
58 led_state |= LED_STATE_ENABLED;
59 __raw_writew(~0, &fpga->leds);
60 }
61 break;
62
63 case led_stop:
64 case led_halted:
65 /* all leds off during suspend or shutdown */
66
67 if (! machine_is_omap_perseus2()) {
68 gpio_set_value(GPIO_TIMER, 0);
69 gpio_set_value(GPIO_IDLE, 0);
70 }
71
72 led_state &= ~LED_STATE_ENABLED;
73 if (fpga) {
74 __raw_writew(~0, &fpga->leds);
75 if (evt == led_halted) {
76 iounmap(fpga);
77 fpga = NULL;
78 }
79 }
80
81 goto done;
82
83 case led_claim:
84 led_state |= LED_STATE_CLAIMED;
85 hw_led_state = 0;
86 break;
87
88 case led_release:
89 led_state &= ~LED_STATE_CLAIMED;
90 break;
91
92#ifdef CONFIG_LEDS_TIMER
93 case led_timer:
94 led_state ^= LED_TIMER_ON;
95
96 if (machine_is_omap_perseus2())
97 hw_led_state ^= H2P2_DBG_FPGA_P2_LED_TIMER;
98 else {
99 gpio_set_value(GPIO_TIMER, led_state & LED_TIMER_ON);
100 goto done;
101 }
102
103 break;
104#endif
105
106#ifdef CONFIG_LEDS_CPU
107 case led_idle_start:
108 if (machine_is_omap_perseus2())
109 hw_led_state |= H2P2_DBG_FPGA_P2_LED_IDLE;
110 else {
111 gpio_set_value(GPIO_IDLE, 1);
112 goto done;
113 }
114
115 break;
116
117 case led_idle_end:
118 if (machine_is_omap_perseus2())
119 hw_led_state &= ~H2P2_DBG_FPGA_P2_LED_IDLE;
120 else {
121 gpio_set_value(GPIO_IDLE, 0);
122 goto done;
123 }
124
125 break;
126#endif
127
128 case led_green_on:
129 hw_led_state |= H2P2_DBG_FPGA_LED_GREEN;
130 break;
131 case led_green_off:
132 hw_led_state &= ~H2P2_DBG_FPGA_LED_GREEN;
133 break;
134
135 case led_amber_on:
136 hw_led_state |= H2P2_DBG_FPGA_LED_AMBER;
137 break;
138 case led_amber_off:
139 hw_led_state &= ~H2P2_DBG_FPGA_LED_AMBER;
140 break;
141
142 case led_red_on:
143 hw_led_state |= H2P2_DBG_FPGA_LED_RED;
144 break;
145 case led_red_off:
146 hw_led_state &= ~H2P2_DBG_FPGA_LED_RED;
147 break;
148
149 case led_blue_on:
150 hw_led_state |= H2P2_DBG_FPGA_LED_BLUE;
151 break;
152 case led_blue_off:
153 hw_led_state &= ~H2P2_DBG_FPGA_LED_BLUE;
154 break;
155
156 default:
157 break;
158 }
159
160
161 /*
162 * Actually burn the LEDs
163 */
164 if (led_state & LED_STATE_ENABLED && fpga)
165 __raw_writew(~hw_led_state, &fpga->leds);
166
167done:
168 local_irq_restore(flags);
169}
diff --git a/arch/arm/mach-omap1/leds-innovator.c b/arch/arm/mach-omap1/leds-innovator.c
deleted file mode 100644
index 3a066ee8d02c..000000000000
--- a/arch/arm/mach-omap1/leds-innovator.c
+++ /dev/null
@@ -1,98 +0,0 @@
1/*
2 * linux/arch/arm/mach-omap1/leds-innovator.c
3 */
4#include <linux/init.h>
5
6#include <mach/hardware.h>
7#include <asm/leds.h>
8
9#include "leds.h"
10
11
12#define LED_STATE_ENABLED 1
13#define LED_STATE_CLAIMED 2
14
15static unsigned int led_state;
16static unsigned int hw_led_state;
17
18void innovator_leds_event(led_event_t evt)
19{
20 unsigned long flags;
21
22 local_irq_save(flags);
23
24 switch (evt) {
25 case led_start:
26 hw_led_state = 0;
27 led_state = LED_STATE_ENABLED;
28 break;
29
30 case led_stop:
31 led_state &= ~LED_STATE_ENABLED;
32 hw_led_state = 0;
33 break;
34
35 case led_claim:
36 led_state |= LED_STATE_CLAIMED;
37 hw_led_state = 0;
38 break;
39
40 case led_release:
41 led_state &= ~LED_STATE_CLAIMED;
42 hw_led_state = 0;
43 break;
44
45#ifdef CONFIG_LEDS_TIMER
46 case led_timer:
47 if (!(led_state & LED_STATE_CLAIMED))
48 hw_led_state ^= 0;
49 break;
50#endif
51
52#ifdef CONFIG_LEDS_CPU
53 case led_idle_start:
54 if (!(led_state & LED_STATE_CLAIMED))
55 hw_led_state |= 0;
56 break;
57
58 case led_idle_end:
59 if (!(led_state & LED_STATE_CLAIMED))
60 hw_led_state &= ~0;
61 break;
62#endif
63
64 case led_halted:
65 break;
66
67 case led_green_on:
68 if (led_state & LED_STATE_CLAIMED)
69 hw_led_state &= ~0;
70 break;
71
72 case led_green_off:
73 if (led_state & LED_STATE_CLAIMED)
74 hw_led_state |= 0;
75 break;
76
77 case led_amber_on:
78 break;
79
80 case led_amber_off:
81 break;
82
83 case led_red_on:
84 if (led_state & LED_STATE_CLAIMED)
85 hw_led_state &= ~0;
86 break;
87
88 case led_red_off:
89 if (led_state & LED_STATE_CLAIMED)
90 hw_led_state |= 0;
91 break;
92
93 default:
94 break;
95 }
96
97 local_irq_restore(flags);
98}
diff --git a/arch/arm/mach-omap1/leds-osk.c b/arch/arm/mach-omap1/leds-osk.c
deleted file mode 100644
index 936ed426b84f..000000000000
--- a/arch/arm/mach-omap1/leds-osk.c
+++ /dev/null
@@ -1,113 +0,0 @@
1/*
2 * linux/arch/arm/mach-omap1/leds-osk.c
3 *
4 * LED driver for OSK with optional Mistral QVGA board
5 */
6#include <linux/gpio.h>
7#include <linux/init.h>
8
9#include <mach/hardware.h>
10#include <asm/leds.h>
11
12#include "leds.h"
13
14
15#define LED_STATE_ENABLED (1 << 0)
16#define LED_STATE_CLAIMED (1 << 1)
17static u8 led_state;
18
19#define TIMER_LED (1 << 3) /* Mistral board */
20#define IDLE_LED (1 << 4) /* Mistral board */
21static u8 hw_led_state;
22
23
24#ifdef CONFIG_OMAP_OSK_MISTRAL
25
26/* For now, all system indicators require the Mistral board, since that
27 * LED can be manipulated without a task context. This LED is either red,
28 * or green, but not both; it can't give the full "disco led" effect.
29 */
30
31#define GPIO_LED_RED 3
32#define GPIO_LED_GREEN OMAP_MPUIO(4)
33
34static void mistral_setled(void)
35{
36 int red = 0;
37 int green = 0;
38
39 if (hw_led_state & TIMER_LED)
40 red = 1;
41 else if (hw_led_state & IDLE_LED)
42 green = 1;
43 /* else both sides are disabled */
44
45 gpio_set_value(GPIO_LED_GREEN, green);
46 gpio_set_value(GPIO_LED_RED, red);
47}
48
49#endif
50
51void osk_leds_event(led_event_t evt)
52{
53 unsigned long flags;
54 u16 leds;
55
56 local_irq_save(flags);
57
58 if (!(led_state & LED_STATE_ENABLED) && evt != led_start)
59 goto done;
60
61 leds = hw_led_state;
62 switch (evt) {
63 case led_start:
64 led_state |= LED_STATE_ENABLED;
65 hw_led_state = 0;
66 leds = ~0;
67 break;
68
69 case led_halted:
70 case led_stop:
71 led_state &= ~LED_STATE_ENABLED;
72 hw_led_state = 0;
73 break;
74
75 case led_claim:
76 led_state |= LED_STATE_CLAIMED;
77 hw_led_state = 0;
78 leds = ~0;
79 break;
80
81 case led_release:
82 led_state &= ~LED_STATE_CLAIMED;
83 hw_led_state = 0;
84 break;
85
86#ifdef CONFIG_OMAP_OSK_MISTRAL
87
88 case led_timer:
89 hw_led_state ^= TIMER_LED;
90 mistral_setled();
91 break;
92
93 case led_idle_start: /* idle == off */
94 hw_led_state &= ~IDLE_LED;
95 mistral_setled();
96 break;
97
98 case led_idle_end:
99 hw_led_state |= IDLE_LED;
100 mistral_setled();
101 break;
102
103#endif /* CONFIG_OMAP_OSK_MISTRAL */
104
105 default:
106 break;
107 }
108
109 leds ^= hw_led_state;
110
111done:
112 local_irq_restore(flags);
113}
diff --git a/arch/arm/mach-omap1/leds.c b/arch/arm/mach-omap1/leds.c
deleted file mode 100644
index 4071479f7106..000000000000
--- a/arch/arm/mach-omap1/leds.c
+++ /dev/null
@@ -1,70 +0,0 @@
1/*
2 * linux/arch/arm/mach-omap1/leds.c
3 *
4 * OMAP LEDs dispatcher
5 */
6#include <linux/gpio.h>
7#include <linux/kernel.h>
8#include <linux/init.h>
9#include <linux/platform_data/gpio-omap.h>
10
11#include <asm/leds.h>
12#include <asm/mach-types.h>
13
14#include <mach/mux.h>
15
16#include "leds.h"
17
18static int __init
19omap_leds_init(void)
20{
21 if (!cpu_class_is_omap1())
22 return -ENODEV;
23
24 if (machine_is_omap_innovator())
25 leds_event = innovator_leds_event;
26
27 else if (machine_is_omap_h2()
28 || machine_is_omap_h3()
29 || machine_is_omap_perseus2())
30 leds_event = h2p2_dbg_leds_event;
31
32 else if (machine_is_omap_osk())
33 leds_event = osk_leds_event;
34
35 else
36 return -1;
37
38 if (machine_is_omap_h2()
39 || machine_is_omap_h3()
40#ifdef CONFIG_OMAP_OSK_MISTRAL
41 || machine_is_omap_osk()
42#endif
43 ) {
44
45 /* LED1/LED2 pins can be used as GPIO (as done here), or by
46 * the LPG (works even in deep sleep!), to drive a bicolor
47 * LED on the H2 sample board, and another on the H2/P2
48 * "surfer" expansion board.
49 *
50 * The same pins drive a LED on the OSK Mistral board, but
51 * that's a different kind of LED (just one color at a time).
52 */
53 omap_cfg_reg(P18_1610_GPIO3);
54 if (gpio_request(3, "LED red") == 0)
55 gpio_direction_output(3, 1);
56 else
57 printk(KERN_WARNING "LED: can't get GPIO3/red?\n");
58
59 omap_cfg_reg(MPUIO4);
60 if (gpio_request(OMAP_MPUIO(4), "LED green") == 0)
61 gpio_direction_output(OMAP_MPUIO(4), 1);
62 else
63 printk(KERN_WARNING "LED: can't get MPUIO4/green?\n");
64 }
65
66 leds_event(led_start);
67 return 0;
68}
69
70__initcall(omap_leds_init);
diff --git a/arch/arm/mach-omap1/leds.h b/arch/arm/mach-omap1/leds.h
deleted file mode 100644
index a1e9fedc376c..000000000000
--- a/arch/arm/mach-omap1/leds.h
+++ /dev/null
@@ -1,3 +0,0 @@
1extern void innovator_leds_event(led_event_t evt);
2extern void h2p2_dbg_leds_event(led_event_t evt);
3extern void osk_leds_event(led_event_t evt);
diff --git a/arch/arm/mach-omap1/time.c b/arch/arm/mach-omap1/time.c
index 4062480bfec7..4d4816fd6fc9 100644
--- a/arch/arm/mach-omap1/time.c
+++ b/arch/arm/mach-omap1/time.c
@@ -44,7 +44,6 @@
44#include <linux/clockchips.h> 44#include <linux/clockchips.h>
45#include <linux/io.h> 45#include <linux/io.h>
46 46
47#include <asm/leds.h>
48#include <asm/irq.h> 47#include <asm/irq.h>
49#include <asm/sched_clock.h> 48#include <asm/sched_clock.h>
50 49
diff --git a/arch/arm/mach-omap1/timer32k.c b/arch/arm/mach-omap1/timer32k.c
index eae49c3980c9..74529549130c 100644
--- a/arch/arm/mach-omap1/timer32k.c
+++ b/arch/arm/mach-omap1/timer32k.c
@@ -46,7 +46,6 @@
46#include <linux/clockchips.h> 46#include <linux/clockchips.h>
47#include <linux/io.h> 47#include <linux/io.h>
48 48
49#include <asm/leds.h>
50#include <asm/irq.h> 49#include <asm/irq.h>
51#include <asm/mach/irq.h> 50#include <asm/mach/irq.h>
52#include <asm/mach/time.h> 51#include <asm/mach/time.h>
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index edc30b8b77ed..a6219eaf1f68 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -48,6 +48,7 @@ config ARCH_OMAP3
48 select ARM_CPU_SUSPEND if PM 48 select ARM_CPU_SUSPEND if PM
49 select MULTI_IRQ_HANDLER 49 select MULTI_IRQ_HANDLER
50 select SOC_HAS_OMAP2_SDRC 50 select SOC_HAS_OMAP2_SDRC
51 select OMAP_INTERCONNECT
51 52
52config ARCH_OMAP4 53config ARCH_OMAP4
53 bool "TI OMAP4" 54 bool "TI OMAP4"
@@ -67,6 +68,7 @@ config ARCH_OMAP4
67 select USB_ARCH_HAS_EHCI if USB_SUPPORT 68 select USB_ARCH_HAS_EHCI if USB_SUPPORT
68 select ARM_CPU_SUSPEND if PM 69 select ARM_CPU_SUSPEND if PM
69 select ARCH_NEEDS_CPU_IDLE_COUPLED if SMP 70 select ARCH_NEEDS_CPU_IDLE_COUPLED if SMP
71 select OMAP_INTERCONNECT
70 72
71config SOC_OMAP5 73config SOC_OMAP5
72 bool "TI OMAP5" 74 bool "TI OMAP5"
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 845202358ddc..7d6abda3b74e 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -180,11 +180,6 @@ obj-$(CONFIG_ARCH_OMAP4) += omap_hwmod_44xx_data.o
180# EMU peripherals 180# EMU peripherals
181obj-$(CONFIG_OMAP3_EMU) += emu.o 181obj-$(CONFIG_OMAP3_EMU) += emu.o
182 182
183# L3 interconnect
184obj-$(CONFIG_ARCH_OMAP3) += omap_l3_smx.o
185obj-$(CONFIG_ARCH_OMAP4) += omap_l3_noc.o
186obj-$(CONFIG_SOC_OMAP5) += omap_l3_noc.o
187
188obj-$(CONFIG_OMAP_MBOX_FWK) += mailbox_mach.o 183obj-$(CONFIG_OMAP_MBOX_FWK) += mailbox_mach.o
189mailbox_mach-objs := mailbox.o 184mailbox_mach-objs := mailbox.o
190 185
diff --git a/arch/arm/mach-omap2/omap_l3_noc.c b/arch/arm/mach-omap2/omap_l3_noc.c
deleted file mode 100644
index f447e02102bb..000000000000
--- a/arch/arm/mach-omap2/omap_l3_noc.c
+++ /dev/null
@@ -1,267 +0,0 @@
1/*
2 * OMAP4XXX L3 Interconnect error handling driver
3 *
4 * Copyright (C) 2011 Texas Corporation
5 * Santosh Shilimkar <santosh.shilimkar@ti.com>
6 * Sricharan <r.sricharan@ti.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
21 * USA
22 */
23#include <linux/module.h>
24#include <linux/init.h>
25#include <linux/io.h>
26#include <linux/platform_device.h>
27#include <linux/interrupt.h>
28#include <linux/kernel.h>
29#include <linux/slab.h>
30
31#include "soc.h"
32#include "omap_l3_noc.h"
33
34/*
35 * Interrupt Handler for L3 error detection.
36 * 1) Identify the L3 clockdomain partition to which the error belongs to.
37 * 2) Identify the slave where the error information is logged
38 * 3) Print the logged information.
39 * 4) Add dump stack to provide kernel trace.
40 *
41 * Two Types of errors :
42 * 1) Custom errors in L3 :
43 * Target like DMM/FW/EMIF generates SRESP=ERR error
44 * 2) Standard L3 error:
45 * - Unsupported CMD.
46 * L3 tries to access target while it is idle
47 * - OCP disconnect.
48 * - Address hole error:
49 * If DSS/ISS/FDIF/USBHOSTFS access a target where they
50 * do not have connectivity, the error is logged in
51 * their default target which is DMM2.
52 *
53 * On High Secure devices, firewall errors are possible and those
54 * can be trapped as well. But the trapping is implemented as part
55 * secure software and hence need not be implemented here.
56 */
57static irqreturn_t l3_interrupt_handler(int irq, void *_l3)
58{
59
60 struct omap4_l3 *l3 = _l3;
61 int inttype, i, k;
62 int err_src = 0;
63 u32 std_err_main, err_reg, clear, masterid;
64 void __iomem *base, *l3_targ_base;
65 char *target_name, *master_name = "UN IDENTIFIED";
66
67 /* Get the Type of interrupt */
68 inttype = irq == l3->app_irq ? L3_APPLICATION_ERROR : L3_DEBUG_ERROR;
69
70 for (i = 0; i < L3_MODULES; i++) {
71 /*
72 * Read the regerr register of the clock domain
73 * to determine the source
74 */
75 base = l3->l3_base[i];
76 err_reg = __raw_readl(base + l3_flagmux[i] +
77 + L3_FLAGMUX_REGERR0 + (inttype << 3));
78
79 /* Get the corresponding error and analyse */
80 if (err_reg) {
81 /* Identify the source from control status register */
82 err_src = __ffs(err_reg);
83
84 /* Read the stderrlog_main_source from clk domain */
85 l3_targ_base = base + *(l3_targ[i] + err_src);
86 std_err_main = __raw_readl(l3_targ_base +
87 L3_TARG_STDERRLOG_MAIN);
88 masterid = __raw_readl(l3_targ_base +
89 L3_TARG_STDERRLOG_MSTADDR);
90
91 switch (std_err_main & CUSTOM_ERROR) {
92 case STANDARD_ERROR:
93 target_name =
94 l3_targ_inst_name[i][err_src];
95 WARN(true, "L3 standard error: TARGET:%s at address 0x%x\n",
96 target_name,
97 __raw_readl(l3_targ_base +
98 L3_TARG_STDERRLOG_SLVOFSLSB));
99 /* clear the std error log*/
100 clear = std_err_main | CLEAR_STDERR_LOG;
101 writel(clear, l3_targ_base +
102 L3_TARG_STDERRLOG_MAIN);
103 break;
104
105 case CUSTOM_ERROR:
106 target_name =
107 l3_targ_inst_name[i][err_src];
108 for (k = 0; k < NUM_OF_L3_MASTERS; k++) {
109 if (masterid == l3_masters[k].id)
110 master_name =
111 l3_masters[k].name;
112 }
113 WARN(true, "L3 custom error: MASTER:%s TARGET:%s\n",
114 master_name, target_name);
115 /* clear the std error log*/
116 clear = std_err_main | CLEAR_STDERR_LOG;
117 writel(clear, l3_targ_base +
118 L3_TARG_STDERRLOG_MAIN);
119 break;
120
121 default:
122 /* Nothing to be handled here as of now */
123 break;
124 }
125 /* Error found so break the for loop */
126 break;
127 }
128 }
129 return IRQ_HANDLED;
130}
131
132static int __devinit omap4_l3_probe(struct platform_device *pdev)
133{
134 static struct omap4_l3 *l3;
135 struct resource *res;
136 int ret;
137
138 l3 = kzalloc(sizeof(*l3), GFP_KERNEL);
139 if (!l3)
140 return -ENOMEM;
141
142 platform_set_drvdata(pdev, l3);
143 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
144 if (!res) {
145 dev_err(&pdev->dev, "couldn't find resource 0\n");
146 ret = -ENODEV;
147 goto err0;
148 }
149
150 l3->l3_base[0] = ioremap(res->start, resource_size(res));
151 if (!l3->l3_base[0]) {
152 dev_err(&pdev->dev, "ioremap failed\n");
153 ret = -ENOMEM;
154 goto err0;
155 }
156
157 res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
158 if (!res) {
159 dev_err(&pdev->dev, "couldn't find resource 1\n");
160 ret = -ENODEV;
161 goto err1;
162 }
163
164 l3->l3_base[1] = ioremap(res->start, resource_size(res));
165 if (!l3->l3_base[1]) {
166 dev_err(&pdev->dev, "ioremap failed\n");
167 ret = -ENOMEM;
168 goto err1;
169 }
170
171 res = platform_get_resource(pdev, IORESOURCE_MEM, 2);
172 if (!res) {
173 dev_err(&pdev->dev, "couldn't find resource 2\n");
174 ret = -ENODEV;
175 goto err2;
176 }
177
178 l3->l3_base[2] = ioremap(res->start, resource_size(res));
179 if (!l3->l3_base[2]) {
180 dev_err(&pdev->dev, "ioremap failed\n");
181 ret = -ENOMEM;
182 goto err2;
183 }
184
185 /*
186 * Setup interrupt Handlers
187 */
188 l3->debug_irq = platform_get_irq(pdev, 0);
189 ret = request_irq(l3->debug_irq,
190 l3_interrupt_handler,
191 IRQF_DISABLED, "l3-dbg-irq", l3);
192 if (ret) {
193 pr_crit("L3: request_irq failed to register for 0x%x\n",
194 9 + OMAP44XX_IRQ_GIC_START);
195 goto err3;
196 }
197
198 l3->app_irq = platform_get_irq(pdev, 1);
199 ret = request_irq(l3->app_irq,
200 l3_interrupt_handler,
201 IRQF_DISABLED, "l3-app-irq", l3);
202 if (ret) {
203 pr_crit("L3: request_irq failed to register for 0x%x\n",
204 10 + OMAP44XX_IRQ_GIC_START);
205 goto err4;
206 }
207
208 return 0;
209
210err4:
211 free_irq(l3->debug_irq, l3);
212err3:
213 iounmap(l3->l3_base[2]);
214err2:
215 iounmap(l3->l3_base[1]);
216err1:
217 iounmap(l3->l3_base[0]);
218err0:
219 kfree(l3);
220 return ret;
221}
222
223static int __devexit omap4_l3_remove(struct platform_device *pdev)
224{
225 struct omap4_l3 *l3 = platform_get_drvdata(pdev);
226
227 free_irq(l3->app_irq, l3);
228 free_irq(l3->debug_irq, l3);
229 iounmap(l3->l3_base[0]);
230 iounmap(l3->l3_base[1]);
231 iounmap(l3->l3_base[2]);
232 kfree(l3);
233
234 return 0;
235}
236
237#if defined(CONFIG_OF)
238static const struct of_device_id l3_noc_match[] = {
239 {.compatible = "ti,omap4-l3-noc", },
240 {},
241};
242MODULE_DEVICE_TABLE(of, l3_noc_match);
243#else
244#define l3_noc_match NULL
245#endif
246
247static struct platform_driver omap4_l3_driver = {
248 .probe = omap4_l3_probe,
249 .remove = __devexit_p(omap4_l3_remove),
250 .driver = {
251 .name = "omap_l3_noc",
252 .owner = THIS_MODULE,
253 .of_match_table = l3_noc_match,
254 },
255};
256
257static int __init omap4_l3_init(void)
258{
259 return platform_driver_register(&omap4_l3_driver);
260}
261postcore_initcall_sync(omap4_l3_init);
262
263static void __exit omap4_l3_exit(void)
264{
265 platform_driver_unregister(&omap4_l3_driver);
266}
267module_exit(omap4_l3_exit);
diff --git a/arch/arm/mach-omap2/omap_l3_noc.h b/arch/arm/mach-omap2/omap_l3_noc.h
deleted file mode 100644
index a6ce34dc4814..000000000000
--- a/arch/arm/mach-omap2/omap_l3_noc.h
+++ /dev/null
@@ -1,176 +0,0 @@
1/*
2 * OMAP4XXX L3 Interconnect error handling driver header
3 *
4 * Copyright (C) 2011 Texas Corporation
5 * Santosh Shilimkar <santosh.shilimkar@ti.com>
6 * sricharan <r.sricharan@ti.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
21 * USA
22 */
23#ifndef __ARCH_ARM_MACH_OMAP2_L3_INTERCONNECT_3XXX_H
24#define __ARCH_ARM_MACH_OMAP2_L3_INTERCONNECT_3XXX_H
25
26#define L3_MODULES 3
27#define CLEAR_STDERR_LOG (1 << 31)
28#define CUSTOM_ERROR 0x2
29#define STANDARD_ERROR 0x0
30#define INBAND_ERROR 0x0
31#define L3_APPLICATION_ERROR 0x0
32#define L3_DEBUG_ERROR 0x1
33
34/* L3 TARG register offsets */
35#define L3_TARG_STDERRLOG_MAIN 0x48
36#define L3_TARG_STDERRLOG_SLVOFSLSB 0x5c
37#define L3_TARG_STDERRLOG_MSTADDR 0x68
38#define L3_FLAGMUX_REGERR0 0xc
39
40#define NUM_OF_L3_MASTERS (sizeof(l3_masters)/sizeof(l3_masters[0]))
41
42static u32 l3_flagmux[L3_MODULES] = {
43 0x500,
44 0x1000,
45 0X0200
46};
47
48/* L3 Target standard Error register offsets */
49static u32 l3_targ_inst_clk1[] = {
50 0x100, /* DMM1 */
51 0x200, /* DMM2 */
52 0x300, /* ABE */
53 0x400, /* L4CFG */
54 0x600, /* CLK2 PWR DISC */
55 0x0, /* Host CLK1 */
56 0x900 /* L4 Wakeup */
57};
58
59static u32 l3_targ_inst_clk2[] = {
60 0x500, /* CORTEX M3 */
61 0x300, /* DSS */
62 0x100, /* GPMC */
63 0x400, /* ISS */
64 0x700, /* IVAHD */
65 0xD00, /* missing in TRM corresponds to AES1*/
66 0x900, /* L4 PER0*/
67 0x200, /* OCMRAM */
68 0x100, /* missing in TRM corresponds to GPMC sERROR*/
69 0x600, /* SGX */
70 0x800, /* SL2 */
71 0x1600, /* C2C */
72 0x1100, /* missing in TRM corresponds PWR DISC CLK1*/
73 0xF00, /* missing in TRM corrsponds to SHA1*/
74 0xE00, /* missing in TRM corresponds to AES2*/
75 0xC00, /* L4 PER3 */
76 0xA00, /* L4 PER1*/
77 0xB00, /* L4 PER2*/
78 0x0, /* HOST CLK2 */
79 0x1800, /* CAL */
80 0x1700 /* LLI */
81};
82
83static u32 l3_targ_inst_clk3[] = {
84 0x0100 /* EMUSS */,
85 0x0300, /* DEBUGSS_CT_TBR */
86 0x0 /* HOST CLK3 */
87};
88
89static struct l3_masters_data {
90 u32 id;
91 char name[10];
92} l3_masters[] = {
93 { 0x0 , "MPU"},
94 { 0x10, "CS_ADP"},
95 { 0x14, "xxx"},
96 { 0x20, "DSP"},
97 { 0x30, "IVAHD"},
98 { 0x40, "ISS"},
99 { 0x44, "DucatiM3"},
100 { 0x48, "FaceDetect"},
101 { 0x50, "SDMA_Rd"},
102 { 0x54, "SDMA_Wr"},
103 { 0x58, "xxx"},
104 { 0x5C, "xxx"},
105 { 0x60, "SGX"},
106 { 0x70, "DSS"},
107 { 0x80, "C2C"},
108 { 0x88, "xxx"},
109 { 0x8C, "xxx"},
110 { 0x90, "HSI"},
111 { 0xA0, "MMC1"},
112 { 0xA4, "MMC2"},
113 { 0xA8, "MMC6"},
114 { 0xB0, "UNIPRO1"},
115 { 0xC0, "USBHOSTHS"},
116 { 0xC4, "USBOTGHS"},
117 { 0xC8, "USBHOSTFS"}
118};
119
120static char *l3_targ_inst_name[L3_MODULES][21] = {
121 {
122 "DMM1",
123 "DMM2",
124 "ABE",
125 "L4CFG",
126 "CLK2 PWR DISC",
127 "HOST CLK1",
128 "L4 WAKEUP"
129 },
130 {
131 "CORTEX M3" ,
132 "DSS ",
133 "GPMC ",
134 "ISS ",
135 "IVAHD ",
136 "AES1",
137 "L4 PER0",
138 "OCMRAM ",
139 "GPMC sERROR",
140 "SGX ",
141 "SL2 ",
142 "C2C ",
143 "PWR DISC CLK1",
144 "SHA1",
145 "AES2",
146 "L4 PER3",
147 "L4 PER1",
148 "L4 PER2",
149 "HOST CLK2",
150 "CAL",
151 "LLI"
152 },
153 {
154 "EMUSS",
155 "DEBUG SOURCE",
156 "HOST CLK3"
157 },
158};
159
160static u32 *l3_targ[L3_MODULES] = {
161 l3_targ_inst_clk1,
162 l3_targ_inst_clk2,
163 l3_targ_inst_clk3,
164};
165
166struct omap4_l3 {
167 struct device *dev;
168 struct clk *ick;
169
170 /* memory base */
171 void __iomem *l3_base[L3_MODULES];
172
173 int debug_irq;
174 int app_irq;
175};
176#endif
diff --git a/arch/arm/mach-omap2/omap_l3_smx.c b/arch/arm/mach-omap2/omap_l3_smx.c
deleted file mode 100644
index acc216491b8a..000000000000
--- a/arch/arm/mach-omap2/omap_l3_smx.c
+++ /dev/null
@@ -1,297 +0,0 @@
1/*
2 * OMAP3XXX L3 Interconnect Driver
3 *
4 * Copyright (C) 2011 Texas Corporation
5 * Felipe Balbi <balbi@ti.com>
6 * Santosh Shilimkar <santosh.shilimkar@ti.com>
7 * Sricharan <r.sricharan@ti.com>
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 as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
22 * USA
23 */
24
25#include <linux/kernel.h>
26#include <linux/slab.h>
27#include <linux/platform_device.h>
28#include <linux/interrupt.h>
29#include <linux/io.h>
30#include "omap_l3_smx.h"
31
32static inline u64 omap3_l3_readll(void __iomem *base, u16 reg)
33{
34 return __raw_readll(base + reg);
35}
36
37static inline void omap3_l3_writell(void __iomem *base, u16 reg, u64 value)
38{
39 __raw_writell(value, base + reg);
40}
41
42static inline enum omap3_l3_code omap3_l3_decode_error_code(u64 error)
43{
44 return (error & 0x0f000000) >> L3_ERROR_LOG_CODE;
45}
46
47static inline u32 omap3_l3_decode_addr(u64 error_addr)
48{
49 return error_addr & 0xffffffff;
50}
51
52static inline unsigned omap3_l3_decode_cmd(u64 error)
53{
54 return (error & 0x07) >> L3_ERROR_LOG_CMD;
55}
56
57static inline enum omap3_l3_initiator_id omap3_l3_decode_initid(u64 error)
58{
59 return (error & 0xff00) >> L3_ERROR_LOG_INITID;
60}
61
62static inline unsigned omap3_l3_decode_req_info(u64 error)
63{
64 return (error >> 32) & 0xffff;
65}
66
67static char *omap3_l3_code_string(u8 code)
68{
69 switch (code) {
70 case OMAP_L3_CODE_NOERROR:
71 return "No Error";
72 case OMAP_L3_CODE_UNSUP_CMD:
73 return "Unsupported Command";
74 case OMAP_L3_CODE_ADDR_HOLE:
75 return "Address Hole";
76 case OMAP_L3_CODE_PROTECT_VIOLATION:
77 return "Protection Violation";
78 case OMAP_L3_CODE_IN_BAND_ERR:
79 return "In-band Error";
80 case OMAP_L3_CODE_REQ_TOUT_NOT_ACCEPT:
81 return "Request Timeout Not Accepted";
82 case OMAP_L3_CODE_REQ_TOUT_NO_RESP:
83 return "Request Timeout, no response";
84 default:
85 return "UNKNOWN error";
86 }
87}
88
89static char *omap3_l3_initiator_string(u8 initid)
90{
91 switch (initid) {
92 case OMAP_L3_LCD:
93 return "LCD";
94 case OMAP_L3_SAD2D:
95 return "SAD2D";
96 case OMAP_L3_IA_MPU_SS_1:
97 case OMAP_L3_IA_MPU_SS_2:
98 case OMAP_L3_IA_MPU_SS_3:
99 case OMAP_L3_IA_MPU_SS_4:
100 case OMAP_L3_IA_MPU_SS_5:
101 return "MPU";
102 case OMAP_L3_IA_IVA_SS_1:
103 case OMAP_L3_IA_IVA_SS_2:
104 case OMAP_L3_IA_IVA_SS_3:
105 return "IVA_SS";
106 case OMAP_L3_IA_IVA_SS_DMA_1:
107 case OMAP_L3_IA_IVA_SS_DMA_2:
108 case OMAP_L3_IA_IVA_SS_DMA_3:
109 case OMAP_L3_IA_IVA_SS_DMA_4:
110 case OMAP_L3_IA_IVA_SS_DMA_5:
111 case OMAP_L3_IA_IVA_SS_DMA_6:
112 return "IVA_SS_DMA";
113 case OMAP_L3_IA_SGX:
114 return "SGX";
115 case OMAP_L3_IA_CAM_1:
116 case OMAP_L3_IA_CAM_2:
117 case OMAP_L3_IA_CAM_3:
118 return "CAM";
119 case OMAP_L3_IA_DAP:
120 return "DAP";
121 case OMAP_L3_SDMA_WR_1:
122 case OMAP_L3_SDMA_WR_2:
123 return "SDMA_WR";
124 case OMAP_L3_SDMA_RD_1:
125 case OMAP_L3_SDMA_RD_2:
126 case OMAP_L3_SDMA_RD_3:
127 case OMAP_L3_SDMA_RD_4:
128 return "SDMA_RD";
129 case OMAP_L3_USBOTG:
130 return "USB_OTG";
131 case OMAP_L3_USBHOST:
132 return "USB_HOST";
133 default:
134 return "UNKNOWN Initiator";
135 }
136}
137
138/*
139 * omap3_l3_block_irq - handles a register block's irq
140 * @l3: struct omap3_l3 *
141 * @base: register block base address
142 * @error: L3_ERROR_LOG register of our block
143 *
144 * Called in hard-irq context. Caller should take care of locking
145 *
146 * OMAP36xx TRM gives, on page 2001, Figure 9-10, the Typical Error
147 * Analysis Sequence, we are following that sequence here, please
148 * refer to that Figure for more information on the subject.
149 */
150static irqreturn_t omap3_l3_block_irq(struct omap3_l3 *l3,
151 u64 error, int error_addr)
152{
153 u8 code = omap3_l3_decode_error_code(error);
154 u8 initid = omap3_l3_decode_initid(error);
155 u8 multi = error & L3_ERROR_LOG_MULTI;
156 u32 address = omap3_l3_decode_addr(error_addr);
157
158 pr_err("%s seen by %s %s at address %x\n",
159 omap3_l3_code_string(code),
160 omap3_l3_initiator_string(initid),
161 multi ? "Multiple Errors" : "", address);
162 WARN_ON(1);
163
164 return IRQ_HANDLED;
165}
166
167static irqreturn_t omap3_l3_app_irq(int irq, void *_l3)
168{
169 struct omap3_l3 *l3 = _l3;
170 u64 status, clear;
171 u64 error;
172 u64 error_addr;
173 u64 err_source = 0;
174 void __iomem *base;
175 int int_type;
176 irqreturn_t ret = IRQ_NONE;
177
178 int_type = irq == l3->app_irq ? L3_APPLICATION_ERROR : L3_DEBUG_ERROR;
179 if (!int_type) {
180 status = omap3_l3_readll(l3->rt, L3_SI_FLAG_STATUS_0);
181 /*
182 * if we have a timeout error, there's nothing we can
183 * do besides rebooting the board. So let's BUG on any
184 * of such errors and handle the others. timeout error
185 * is severe and not expected to occur.
186 */
187 BUG_ON(status & L3_STATUS_0_TIMEOUT_MASK);
188 } else {
189 status = omap3_l3_readll(l3->rt, L3_SI_FLAG_STATUS_1);
190 /* No timeout error for debug sources */
191 }
192
193 /* identify the error source */
194 err_source = __ffs(status);
195
196 base = l3->rt + omap3_l3_bases[int_type][err_source];
197 error = omap3_l3_readll(base, L3_ERROR_LOG);
198 if (error) {
199 error_addr = omap3_l3_readll(base, L3_ERROR_LOG_ADDR);
200 ret |= omap3_l3_block_irq(l3, error, error_addr);
201 }
202
203 /* Clear the status register */
204 clear = (L3_AGENT_STATUS_CLEAR_IA << int_type) |
205 L3_AGENT_STATUS_CLEAR_TA;
206 omap3_l3_writell(base, L3_AGENT_STATUS, clear);
207
208 /* clear the error log register */
209 omap3_l3_writell(base, L3_ERROR_LOG, error);
210
211 return ret;
212}
213
214static int __init omap3_l3_probe(struct platform_device *pdev)
215{
216 struct omap3_l3 *l3;
217 struct resource *res;
218 int ret;
219
220 l3 = kzalloc(sizeof(*l3), GFP_KERNEL);
221 if (!l3)
222 return -ENOMEM;
223
224 platform_set_drvdata(pdev, l3);
225
226 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
227 if (!res) {
228 dev_err(&pdev->dev, "couldn't find resource\n");
229 ret = -ENODEV;
230 goto err0;
231 }
232 l3->rt = ioremap(res->start, resource_size(res));
233 if (!l3->rt) {
234 dev_err(&pdev->dev, "ioremap failed\n");
235 ret = -ENOMEM;
236 goto err0;
237 }
238
239 l3->debug_irq = platform_get_irq(pdev, 0);
240 ret = request_irq(l3->debug_irq, omap3_l3_app_irq,
241 IRQF_DISABLED | IRQF_TRIGGER_RISING,
242 "l3-debug-irq", l3);
243 if (ret) {
244 dev_err(&pdev->dev, "couldn't request debug irq\n");
245 goto err1;
246 }
247
248 l3->app_irq = platform_get_irq(pdev, 1);
249 ret = request_irq(l3->app_irq, omap3_l3_app_irq,
250 IRQF_DISABLED | IRQF_TRIGGER_RISING,
251 "l3-app-irq", l3);
252 if (ret) {
253 dev_err(&pdev->dev, "couldn't request app irq\n");
254 goto err2;
255 }
256
257 return 0;
258
259err2:
260 free_irq(l3->debug_irq, l3);
261err1:
262 iounmap(l3->rt);
263err0:
264 kfree(l3);
265 return ret;
266}
267
268static int __exit omap3_l3_remove(struct platform_device *pdev)
269{
270 struct omap3_l3 *l3 = platform_get_drvdata(pdev);
271
272 free_irq(l3->app_irq, l3);
273 free_irq(l3->debug_irq, l3);
274 iounmap(l3->rt);
275 kfree(l3);
276
277 return 0;
278}
279
280static struct platform_driver omap3_l3_driver = {
281 .remove = __exit_p(omap3_l3_remove),
282 .driver = {
283 .name = "omap_l3_smx",
284 },
285};
286
287static int __init omap3_l3_init(void)
288{
289 return platform_driver_probe(&omap3_l3_driver, omap3_l3_probe);
290}
291postcore_initcall_sync(omap3_l3_init);
292
293static void __exit omap3_l3_exit(void)
294{
295 platform_driver_unregister(&omap3_l3_driver);
296}
297module_exit(omap3_l3_exit);
diff --git a/arch/arm/mach-omap2/omap_l3_smx.h b/arch/arm/mach-omap2/omap_l3_smx.h
deleted file mode 100644
index 4f3cebca4179..000000000000
--- a/arch/arm/mach-omap2/omap_l3_smx.h
+++ /dev/null
@@ -1,338 +0,0 @@
1/*
2 * OMAP3XXX L3 Interconnect Driver header
3 *
4 * Copyright (C) 2011 Texas Corporation
5 * Felipe Balbi <balbi@ti.com>
6 * Santosh Shilimkar <santosh.shilimkar@ti.com>
7 * sricharan <r.sricharan@ti.com>
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 as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
22 * USA
23 */
24#ifndef __ARCH_ARM_MACH_OMAP2_L3_INTERCONNECT_3XXX_H
25#define __ARCH_ARM_MACH_OMAP2_L3_INTERCONNECT_3XXX_H
26
27/* Register definitions. All 64-bit wide */
28#define L3_COMPONENT 0x000
29#define L3_CORE 0x018
30#define L3_AGENT_CONTROL 0x020
31#define L3_AGENT_STATUS 0x028
32#define L3_ERROR_LOG 0x058
33
34#define L3_ERROR_LOG_MULTI (1 << 31)
35#define L3_ERROR_LOG_SECONDARY (1 << 30)
36
37#define L3_ERROR_LOG_ADDR 0x060
38
39/* Register definitions for Sideband Interconnect */
40#define L3_SI_CONTROL 0x020
41#define L3_SI_FLAG_STATUS_0 0x510
42
43static const u64 shift = 1;
44
45#define L3_STATUS_0_MPUIA_BRST (shift << 0)
46#define L3_STATUS_0_MPUIA_RSP (shift << 1)
47#define L3_STATUS_0_MPUIA_INBAND (shift << 2)
48#define L3_STATUS_0_IVAIA_BRST (shift << 6)
49#define L3_STATUS_0_IVAIA_RSP (shift << 7)
50#define L3_STATUS_0_IVAIA_INBAND (shift << 8)
51#define L3_STATUS_0_SGXIA_BRST (shift << 9)
52#define L3_STATUS_0_SGXIA_RSP (shift << 10)
53#define L3_STATUS_0_SGXIA_MERROR (shift << 11)
54#define L3_STATUS_0_CAMIA_BRST (shift << 12)
55#define L3_STATUS_0_CAMIA_RSP (shift << 13)
56#define L3_STATUS_0_CAMIA_INBAND (shift << 14)
57#define L3_STATUS_0_DISPIA_BRST (shift << 15)
58#define L3_STATUS_0_DISPIA_RSP (shift << 16)
59#define L3_STATUS_0_DMARDIA_BRST (shift << 18)
60#define L3_STATUS_0_DMARDIA_RSP (shift << 19)
61#define L3_STATUS_0_DMAWRIA_BRST (shift << 21)
62#define L3_STATUS_0_DMAWRIA_RSP (shift << 22)
63#define L3_STATUS_0_USBOTGIA_BRST (shift << 24)
64#define L3_STATUS_0_USBOTGIA_RSP (shift << 25)
65#define L3_STATUS_0_USBOTGIA_INBAND (shift << 26)
66#define L3_STATUS_0_USBHOSTIA_BRST (shift << 27)
67#define L3_STATUS_0_USBHOSTIA_INBAND (shift << 28)
68#define L3_STATUS_0_SMSTA_REQ (shift << 48)
69#define L3_STATUS_0_GPMCTA_REQ (shift << 49)
70#define L3_STATUS_0_OCMRAMTA_REQ (shift << 50)
71#define L3_STATUS_0_OCMROMTA_REQ (shift << 51)
72#define L3_STATUS_0_IVATA_REQ (shift << 54)
73#define L3_STATUS_0_SGXTA_REQ (shift << 55)
74#define L3_STATUS_0_SGXTA_SERROR (shift << 56)
75#define L3_STATUS_0_GPMCTA_SERROR (shift << 57)
76#define L3_STATUS_0_L4CORETA_REQ (shift << 58)
77#define L3_STATUS_0_L4PERTA_REQ (shift << 59)
78#define L3_STATUS_0_L4EMUTA_REQ (shift << 60)
79#define L3_STATUS_0_MAD2DTA_REQ (shift << 61)
80
81#define L3_STATUS_0_TIMEOUT_MASK (L3_STATUS_0_MPUIA_BRST \
82 | L3_STATUS_0_MPUIA_RSP \
83 | L3_STATUS_0_IVAIA_BRST \
84 | L3_STATUS_0_IVAIA_RSP \
85 | L3_STATUS_0_SGXIA_BRST \
86 | L3_STATUS_0_SGXIA_RSP \
87 | L3_STATUS_0_CAMIA_BRST \
88 | L3_STATUS_0_CAMIA_RSP \
89 | L3_STATUS_0_DISPIA_BRST \
90 | L3_STATUS_0_DISPIA_RSP \
91 | L3_STATUS_0_DMARDIA_BRST \
92 | L3_STATUS_0_DMARDIA_RSP \
93 | L3_STATUS_0_DMAWRIA_BRST \
94 | L3_STATUS_0_DMAWRIA_RSP \
95 | L3_STATUS_0_USBOTGIA_BRST \
96 | L3_STATUS_0_USBOTGIA_RSP \
97 | L3_STATUS_0_USBHOSTIA_BRST \
98 | L3_STATUS_0_SMSTA_REQ \
99 | L3_STATUS_0_GPMCTA_REQ \
100 | L3_STATUS_0_OCMRAMTA_REQ \
101 | L3_STATUS_0_OCMROMTA_REQ \
102 | L3_STATUS_0_IVATA_REQ \
103 | L3_STATUS_0_SGXTA_REQ \
104 | L3_STATUS_0_L4CORETA_REQ \
105 | L3_STATUS_0_L4PERTA_REQ \
106 | L3_STATUS_0_L4EMUTA_REQ \
107 | L3_STATUS_0_MAD2DTA_REQ)
108
109#define L3_SI_FLAG_STATUS_1 0x530
110
111#define L3_STATUS_1_MPU_DATAIA (1 << 0)
112#define L3_STATUS_1_DAPIA0 (1 << 3)
113#define L3_STATUS_1_DAPIA1 (1 << 4)
114#define L3_STATUS_1_IVAIA (1 << 6)
115
116#define L3_PM_ERROR_LOG 0x020
117#define L3_PM_CONTROL 0x028
118#define L3_PM_ERROR_CLEAR_SINGLE 0x030
119#define L3_PM_ERROR_CLEAR_MULTI 0x038
120#define L3_PM_REQ_INFO_PERMISSION(n) (0x048 + (0x020 * n))
121#define L3_PM_READ_PERMISSION(n) (0x050 + (0x020 * n))
122#define L3_PM_WRITE_PERMISSION(n) (0x058 + (0x020 * n))
123#define L3_PM_ADDR_MATCH(n) (0x060 + (0x020 * n))
124
125/* L3 error log bit fields. Common for IA and TA */
126#define L3_ERROR_LOG_CODE 24
127#define L3_ERROR_LOG_INITID 8
128#define L3_ERROR_LOG_CMD 0
129
130/* L3 agent status bit fields. */
131#define L3_AGENT_STATUS_CLEAR_IA 0x10000000
132#define L3_AGENT_STATUS_CLEAR_TA 0x01000000
133
134#define OMAP34xx_IRQ_L3_APP 10
135#define L3_APPLICATION_ERROR 0x0
136#define L3_DEBUG_ERROR 0x1
137
138enum omap3_l3_initiator_id {
139 /* LCD has 1 ID */
140 OMAP_L3_LCD = 29,
141 /* SAD2D has 1 ID */
142 OMAP_L3_SAD2D = 28,
143 /* MPU has 5 IDs */
144 OMAP_L3_IA_MPU_SS_1 = 27,
145 OMAP_L3_IA_MPU_SS_2 = 26,
146 OMAP_L3_IA_MPU_SS_3 = 25,
147 OMAP_L3_IA_MPU_SS_4 = 24,
148 OMAP_L3_IA_MPU_SS_5 = 23,
149 /* IVA2.2 SS has 3 IDs*/
150 OMAP_L3_IA_IVA_SS_1 = 22,
151 OMAP_L3_IA_IVA_SS_2 = 21,
152 OMAP_L3_IA_IVA_SS_3 = 20,
153 /* IVA 2.2 SS DMA has 6 IDS */
154 OMAP_L3_IA_IVA_SS_DMA_1 = 19,
155 OMAP_L3_IA_IVA_SS_DMA_2 = 18,
156 OMAP_L3_IA_IVA_SS_DMA_3 = 17,
157 OMAP_L3_IA_IVA_SS_DMA_4 = 16,
158 OMAP_L3_IA_IVA_SS_DMA_5 = 15,
159 OMAP_L3_IA_IVA_SS_DMA_6 = 14,
160 /* SGX has 1 ID */
161 OMAP_L3_IA_SGX = 13,
162 /* CAM has 3 ID */
163 OMAP_L3_IA_CAM_1 = 12,
164 OMAP_L3_IA_CAM_2 = 11,
165 OMAP_L3_IA_CAM_3 = 10,
166 /* DAP has 1 ID */
167 OMAP_L3_IA_DAP = 9,
168 /* SDMA WR has 2 IDs */
169 OMAP_L3_SDMA_WR_1 = 8,
170 OMAP_L3_SDMA_WR_2 = 7,
171 /* SDMA RD has 4 IDs */
172 OMAP_L3_SDMA_RD_1 = 6,
173 OMAP_L3_SDMA_RD_2 = 5,
174 OMAP_L3_SDMA_RD_3 = 4,
175 OMAP_L3_SDMA_RD_4 = 3,
176 /* HSUSB OTG has 1 ID */
177 OMAP_L3_USBOTG = 2,
178 /* HSUSB HOST has 1 ID */
179 OMAP_L3_USBHOST = 1,
180};
181
182enum omap3_l3_code {
183 OMAP_L3_CODE_NOERROR = 0,
184 OMAP_L3_CODE_UNSUP_CMD = 1,
185 OMAP_L3_CODE_ADDR_HOLE = 2,
186 OMAP_L3_CODE_PROTECT_VIOLATION = 3,
187 OMAP_L3_CODE_IN_BAND_ERR = 4,
188 /* codes 5 and 6 are reserved */
189 OMAP_L3_CODE_REQ_TOUT_NOT_ACCEPT = 7,
190 OMAP_L3_CODE_REQ_TOUT_NO_RESP = 8,
191 /* codes 9 - 15 are also reserved */
192};
193
194struct omap3_l3 {
195 struct device *dev;
196 struct clk *ick;
197
198 /* memory base*/
199 void __iomem *rt;
200
201 int debug_irq;
202 int app_irq;
203
204 /* true when and inband functional error occurs */
205 unsigned inband:1;
206};
207
208/* offsets for l3 agents in order with the Flag status register */
209static unsigned int omap3_l3_app_bases[] = {
210 /* MPU IA */
211 0x1400,
212 0x1400,
213 0x1400,
214 /* RESERVED */
215 0,
216 0,
217 0,
218 /* IVA 2.2 IA */
219 0x1800,
220 0x1800,
221 0x1800,
222 /* SGX IA */
223 0x1c00,
224 0x1c00,
225 /* RESERVED */
226 0,
227 /* CAMERA IA */
228 0x5800,
229 0x5800,
230 0x5800,
231 /* DISPLAY IA */
232 0x5400,
233 0x5400,
234 /* RESERVED */
235 0,
236 /*SDMA RD IA */
237 0x4c00,
238 0x4c00,
239 /* RESERVED */
240 0,
241 /* SDMA WR IA */
242 0x5000,
243 0x5000,
244 /* RESERVED */
245 0,
246 /* USB OTG IA */
247 0x4400,
248 0x4400,
249 0x4400,
250 /* USB HOST IA */
251 0x4000,
252 0x4000,
253 /* RESERVED */
254 0,
255 0,
256 0,
257 0,
258 /* SAD2D IA */
259 0x3000,
260 0x3000,
261 0x3000,
262 /* RESERVED */
263 0,
264 0,
265 0,
266 0,
267 0,
268 0,
269 0,
270 0,
271 0,
272 0,
273 0,
274 0,
275 /* SMA TA */
276 0x2000,
277 /* GPMC TA */
278 0x2400,
279 /* OCM RAM TA */
280 0x2800,
281 /* OCM ROM TA */
282 0x2C00,
283 /* L4 CORE TA */
284 0x6800,
285 /* L4 PER TA */
286 0x6c00,
287 /* IVA 2.2 TA */
288 0x6000,
289 /* SGX TA */
290 0x6400,
291 /* L4 EMU TA */
292 0x7000,
293 /* GPMC TA */
294 0x2400,
295 /* L4 CORE TA */
296 0x6800,
297 /* L4 PER TA */
298 0x6c00,
299 /* L4 EMU TA */
300 0x7000,
301 /* MAD2D TA */
302 0x3400,
303 /* RESERVED */
304 0,
305 0,
306};
307
308static unsigned int omap3_l3_debug_bases[] = {
309 /* MPU DATA IA */
310 0x1400,
311 /* RESERVED */
312 0,
313 0,
314 /* DAP IA */
315 0x5c00,
316 0x5c00,
317 /* RESERVED */
318 0,
319 /* IVA 2.2 IA */
320 0x1800,
321 /* REST RESERVED */
322};
323
324static u32 *omap3_l3_bases[] = {
325 omap3_l3_app_bases,
326 omap3_l3_debug_bases,
327};
328
329/*
330 * REVISIT define __raw_readll/__raw_writell here, but move them to
331 * <asm/io.h> at some point
332 */
333#define __raw_writell(v, a) (__chk_io_ptr(a), \
334 *(volatile u64 __force *)(a) = (v))
335#define __raw_readll(a) (__chk_io_ptr(a), \
336 *(volatile u64 __force *)(a))
337
338#endif
diff --git a/arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c b/arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c
index 78a6a11d8216..9b1c95310291 100644
--- a/arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c
+++ b/arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c
@@ -18,7 +18,6 @@
18#include <linux/ethtool.h> 18#include <linux/ethtool.h>
19#include <net/dsa.h> 19#include <net/dsa.h>
20#include <asm/mach-types.h> 20#include <asm/mach-types.h>
21#include <asm/leds.h>
22#include <asm/mach/arch.h> 21#include <asm/mach/arch.h>
23#include <asm/mach/pci.h> 22#include <asm/mach/pci.h>
24#include <mach/orion5x.h> 23#include <mach/orion5x.h>
diff --git a/arch/arm/mach-orion5x/rd88f5181l-ge-setup.c b/arch/arm/mach-orion5x/rd88f5181l-ge-setup.c
index 2f5dc54cd4cd..51ba2b81a10b 100644
--- a/arch/arm/mach-orion5x/rd88f5181l-ge-setup.c
+++ b/arch/arm/mach-orion5x/rd88f5181l-ge-setup.c
@@ -19,7 +19,6 @@
19#include <linux/i2c.h> 19#include <linux/i2c.h>
20#include <net/dsa.h> 20#include <net/dsa.h>
21#include <asm/mach-types.h> 21#include <asm/mach-types.h>
22#include <asm/leds.h>
23#include <asm/mach/arch.h> 22#include <asm/mach/arch.h>
24#include <asm/mach/pci.h> 23#include <asm/mach/pci.h>
25#include <mach/orion5x.h> 24#include <mach/orion5x.h>
diff --git a/arch/arm/mach-orion5x/rd88f5182-setup.c b/arch/arm/mach-orion5x/rd88f5182-setup.c
index 399130fac0b6..0a56b9444f1b 100644
--- a/arch/arm/mach-orion5x/rd88f5182-setup.c
+++ b/arch/arm/mach-orion5x/rd88f5182-setup.c
@@ -19,8 +19,8 @@
19#include <linux/mv643xx_eth.h> 19#include <linux/mv643xx_eth.h>
20#include <linux/ata_platform.h> 20#include <linux/ata_platform.h>
21#include <linux/i2c.h> 21#include <linux/i2c.h>
22#include <linux/leds.h>
22#include <asm/mach-types.h> 23#include <asm/mach-types.h>
23#include <asm/leds.h>
24#include <asm/mach/arch.h> 24#include <asm/mach/arch.h>
25#include <asm/mach/pci.h> 25#include <asm/mach/pci.h>
26#include <mach/orion5x.h> 26#include <mach/orion5x.h>
@@ -53,12 +53,6 @@
53#define RD88F5182_PCI_SLOT0_IRQ_A_PIN 7 53#define RD88F5182_PCI_SLOT0_IRQ_A_PIN 7
54#define RD88F5182_PCI_SLOT0_IRQ_B_PIN 6 54#define RD88F5182_PCI_SLOT0_IRQ_B_PIN 6
55 55
56/*
57 * GPIO Debug LED
58 */
59
60#define RD88F5182_GPIO_DBG_LED 0
61
62/***************************************************************************** 56/*****************************************************************************
63 * 16M NOR Flash on Device bus CS1 57 * 16M NOR Flash on Device bus CS1
64 ****************************************************************************/ 58 ****************************************************************************/
@@ -83,55 +77,32 @@ static struct platform_device rd88f5182_nor_flash = {
83 .resource = &rd88f5182_nor_flash_resource, 77 .resource = &rd88f5182_nor_flash_resource,
84}; 78};
85 79
86#ifdef CONFIG_LEDS
87
88/***************************************************************************** 80/*****************************************************************************
89 * Use GPIO debug led as CPU active indication 81 * Use GPIO LED as CPU active indication
90 ****************************************************************************/ 82 ****************************************************************************/
91 83
92static void rd88f5182_dbgled_event(led_event_t evt) 84#define RD88F5182_GPIO_LED 0
93{
94 int val;
95
96 if (evt == led_idle_end)
97 val = 1;
98 else if (evt == led_idle_start)
99 val = 0;
100 else
101 return;
102
103 gpio_set_value(RD88F5182_GPIO_DBG_LED, val);
104}
105
106static int __init rd88f5182_dbgled_init(void)
107{
108 int pin;
109
110 if (machine_is_rd88f5182()) {
111 pin = RD88F5182_GPIO_DBG_LED;
112 85
113 if (gpio_request(pin, "DBGLED") == 0) { 86static struct gpio_led rd88f5182_gpio_led_pins[] = {
114 if (gpio_direction_output(pin, 0) != 0) { 87 {
115 printk(KERN_ERR "rd88f5182_dbgled_init failed " 88 .name = "rd88f5182:cpu",
116 "to set output pin %d\n", pin); 89 .default_trigger = "cpu0",
117 gpio_free(pin); 90 .gpio = RD88F5182_GPIO_LED,
118 return 0; 91 },
119 } 92};
120 } else {
121 printk(KERN_ERR "rd88f5182_dbgled_init failed "
122 "to request gpio %d\n", pin);
123 return 0;
124 }
125
126 leds_event = rd88f5182_dbgled_event;
127 }
128
129 return 0;
130}
131 93
132__initcall(rd88f5182_dbgled_init); 94static struct gpio_led_platform_data rd88f5182_gpio_led_data = {
95 .leds = rd88f5182_gpio_led_pins,
96 .num_leds = ARRAY_SIZE(rd88f5182_gpio_led_pins),
97};
133 98
134#endif 99static struct platform_device rd88f5182_gpio_leds = {
100 .name = "leds-gpio",
101 .id = -1,
102 .dev = {
103 .platform_data = &rd88f5182_gpio_led_data,
104 },
105};
135 106
136/***************************************************************************** 107/*****************************************************************************
137 * PCI 108 * PCI
@@ -298,6 +269,7 @@ static void __init rd88f5182_init(void)
298 269
299 orion5x_setup_dev1_win(RD88F5182_NOR_BASE, RD88F5182_NOR_SIZE); 270 orion5x_setup_dev1_win(RD88F5182_NOR_BASE, RD88F5182_NOR_SIZE);
300 platform_device_register(&rd88f5182_nor_flash); 271 platform_device_register(&rd88f5182_nor_flash);
272 platform_device_register(&rd88f5182_gpio_leds);
301 273
302 i2c_register_board_info(0, &rd88f5182_i2c_rtc, 1); 274 i2c_register_board_info(0, &rd88f5182_i2c_rtc, 1);
303} 275}
diff --git a/arch/arm/mach-orion5x/rd88f6183ap-ge-setup.c b/arch/arm/mach-orion5x/rd88f6183ap-ge-setup.c
index 92df49c1b62a..ed50910b08a4 100644
--- a/arch/arm/mach-orion5x/rd88f6183ap-ge-setup.c
+++ b/arch/arm/mach-orion5x/rd88f6183ap-ge-setup.c
@@ -20,7 +20,6 @@
20#include <linux/ethtool.h> 20#include <linux/ethtool.h>
21#include <net/dsa.h> 21#include <net/dsa.h>
22#include <asm/mach-types.h> 22#include <asm/mach-types.h>
23#include <asm/leds.h>
24#include <asm/mach/arch.h> 23#include <asm/mach/arch.h>
25#include <asm/mach/pci.h> 24#include <asm/mach/pci.h>
26#include <mach/orion5x.h> 25#include <mach/orion5x.h>
diff --git a/arch/arm/mach-pxa/Makefile b/arch/arm/mach-pxa/Makefile
index 2bedc9ed076c..ee88d6eae648 100644
--- a/arch/arm/mach-pxa/Makefile
+++ b/arch/arm/mach-pxa/Makefile
@@ -98,12 +98,4 @@ obj-$(CONFIG_MACH_RAUMFELD_CONNECTOR) += raumfeld.o
98obj-$(CONFIG_MACH_RAUMFELD_SPEAKER) += raumfeld.o 98obj-$(CONFIG_MACH_RAUMFELD_SPEAKER) += raumfeld.o
99obj-$(CONFIG_MACH_ZIPIT2) += z2.o 99obj-$(CONFIG_MACH_ZIPIT2) += z2.o
100 100
101# Support for blinky lights
102led-y := leds.o
103led-$(CONFIG_ARCH_LUBBOCK) += leds-lubbock.o
104led-$(CONFIG_MACH_MAINSTONE) += leds-mainstone.o
105led-$(CONFIG_ARCH_PXA_IDP) += leds-idp.o
106
107obj-$(CONFIG_LEDS) += $(led-y)
108
109obj-$(CONFIG_TOSA_BT) += tosa-bt.o 101obj-$(CONFIG_TOSA_BT) += tosa-bt.o
diff --git a/arch/arm/mach-pxa/idp.c b/arch/arm/mach-pxa/idp.c
index 6ff466bd43e8..ae1e9977603e 100644
--- a/arch/arm/mach-pxa/idp.c
+++ b/arch/arm/mach-pxa/idp.c
@@ -191,6 +191,87 @@ static void __init idp_map_io(void)
191 iotable_init(idp_io_desc, ARRAY_SIZE(idp_io_desc)); 191 iotable_init(idp_io_desc, ARRAY_SIZE(idp_io_desc));
192} 192}
193 193
194/* LEDs */
195#if defined(CONFIG_NEW_LEDS) && defined(CONFIG_LEDS_CLASS)
196struct idp_led {
197 struct led_classdev cdev;
198 u8 mask;
199};
200
201/*
202 * The triggers lines up below will only be used if the
203 * LED triggers are compiled in.
204 */
205static const struct {
206 const char *name;
207 const char *trigger;
208} idp_leds[] = {
209 { "idp:green", "heartbeat", },
210 { "idp:red", "cpu0", },
211};
212
213static void idp_led_set(struct led_classdev *cdev,
214 enum led_brightness b)
215{
216 struct idp_led *led = container_of(cdev,
217 struct idp_led, cdev);
218 u32 reg = IDP_CPLD_LED_CONTROL;
219
220 if (b != LED_OFF)
221 reg &= ~led->mask;
222 else
223 reg |= led->mask;
224
225 IDP_CPLD_LED_CONTROL = reg;
226}
227
228static enum led_brightness idp_led_get(struct led_classdev *cdev)
229{
230 struct idp_led *led = container_of(cdev,
231 struct idp_led, cdev);
232
233 return (IDP_CPLD_LED_CONTROL & led->mask) ? LED_OFF : LED_FULL;
234}
235
236static int __init idp_leds_init(void)
237{
238 int i;
239
240 if (!machine_is_pxa_idp())
241 return -ENODEV;
242
243 for (i = 0; i < ARRAY_SIZE(idp_leds); i++) {
244 struct idp_led *led;
245
246 led = kzalloc(sizeof(*led), GFP_KERNEL);
247 if (!led)
248 break;
249
250 led->cdev.name = idp_leds[i].name;
251 led->cdev.brightness_set = idp_led_set;
252 led->cdev.brightness_get = idp_led_get;
253 led->cdev.default_trigger = idp_leds[i].trigger;
254
255 if (i == 0)
256 led->mask = IDP_HB_LED;
257 else
258 led->mask = IDP_BUSY_LED;
259
260 if (led_classdev_register(NULL, &led->cdev) < 0) {
261 kfree(led);
262 break;
263 }
264 }
265
266 return 0;
267}
268
269/*
270 * Since we may have triggers on any subsystem, defer registration
271 * until after subsystem_init.
272 */
273fs_initcall(idp_leds_init);
274#endif
194 275
195MACHINE_START(PXA_IDP, "Vibren PXA255 IDP") 276MACHINE_START(PXA_IDP, "Vibren PXA255 IDP")
196 /* Maintainer: Vibren Technologies */ 277 /* Maintainer: Vibren Technologies */
diff --git a/arch/arm/mach-pxa/leds-idp.c b/arch/arm/mach-pxa/leds-idp.c
deleted file mode 100644
index 06b060025d11..000000000000
--- a/arch/arm/mach-pxa/leds-idp.c
+++ /dev/null
@@ -1,115 +0,0 @@
1/*
2 * linux/arch/arm/mach-pxa/leds-idp.c
3 *
4 * Copyright (C) 2000 John Dorsey <john+@cs.cmu.edu>
5 *
6 * Copyright (c) 2001 Jeff Sutherland <jeffs@accelent.com>
7 *
8 * Original (leds-footbridge.c) by Russell King
9 *
10 * Macros for actual LED manipulation should be in machine specific
11 * files in this 'mach' directory.
12 */
13
14
15#include <linux/init.h>
16
17#include <mach/hardware.h>
18#include <asm/leds.h>
19
20#include <mach/pxa25x.h>
21#include <mach/idp.h>
22
23#include "leds.h"
24
25#define LED_STATE_ENABLED 1
26#define LED_STATE_CLAIMED 2
27
28static unsigned int led_state;
29static unsigned int hw_led_state;
30
31void idp_leds_event(led_event_t evt)
32{
33 unsigned long flags;
34
35 local_irq_save(flags);
36
37 switch (evt) {
38 case led_start:
39 hw_led_state = IDP_HB_LED | IDP_BUSY_LED;
40 led_state = LED_STATE_ENABLED;
41 break;
42
43 case led_stop:
44 led_state &= ~LED_STATE_ENABLED;
45 break;
46
47 case led_claim:
48 led_state |= LED_STATE_CLAIMED;
49 hw_led_state = IDP_HB_LED | IDP_BUSY_LED;
50 break;
51
52 case led_release:
53 led_state &= ~LED_STATE_CLAIMED;
54 hw_led_state = IDP_HB_LED | IDP_BUSY_LED;
55 break;
56
57#ifdef CONFIG_LEDS_TIMER
58 case led_timer:
59 if (!(led_state & LED_STATE_CLAIMED))
60 hw_led_state ^= IDP_HB_LED;
61 break;
62#endif
63
64#ifdef CONFIG_LEDS_CPU
65 case led_idle_start:
66 if (!(led_state & LED_STATE_CLAIMED))
67 hw_led_state &= ~IDP_BUSY_LED;
68 break;
69
70 case led_idle_end:
71 if (!(led_state & LED_STATE_CLAIMED))
72 hw_led_state |= IDP_BUSY_LED;
73 break;
74#endif
75
76 case led_halted:
77 break;
78
79 case led_green_on:
80 if (led_state & LED_STATE_CLAIMED)
81 hw_led_state |= IDP_HB_LED;
82 break;
83
84 case led_green_off:
85 if (led_state & LED_STATE_CLAIMED)
86 hw_led_state &= ~IDP_HB_LED;
87 break;
88
89 case led_amber_on:
90 break;
91
92 case led_amber_off:
93 break;
94
95 case led_red_on:
96 if (led_state & LED_STATE_CLAIMED)
97 hw_led_state |= IDP_BUSY_LED;
98 break;
99
100 case led_red_off:
101 if (led_state & LED_STATE_CLAIMED)
102 hw_led_state &= ~IDP_BUSY_LED;
103 break;
104
105 default:
106 break;
107 }
108
109 if (led_state & LED_STATE_ENABLED)
110 IDP_CPLD_LED_CONTROL = ( (IDP_CPLD_LED_CONTROL | IDP_LEDS_MASK) & ~hw_led_state);
111 else
112 IDP_CPLD_LED_CONTROL |= IDP_LEDS_MASK;
113
114 local_irq_restore(flags);
115}
diff --git a/arch/arm/mach-pxa/leds-lubbock.c b/arch/arm/mach-pxa/leds-lubbock.c
deleted file mode 100644
index 0bd85c884a7c..000000000000
--- a/arch/arm/mach-pxa/leds-lubbock.c
+++ /dev/null
@@ -1,124 +0,0 @@
1/*
2 * linux/arch/arm/mach-pxa/leds-lubbock.c
3 *
4 * Copyright (C) 2000 John Dorsey <john+@cs.cmu.edu>
5 *
6 * Copyright (c) 2001 Jeff Sutherland <jeffs@accelent.com>
7 *
8 * Original (leds-footbridge.c) by Russell King
9 *
10 * Major surgery on April 2004 by Nicolas Pitre for less global
11 * namespace collision. Mostly adapted the Mainstone version.
12 */
13
14#include <linux/init.h>
15
16#include <mach/hardware.h>
17#include <asm/leds.h>
18#include <mach/pxa25x.h>
19#include <mach/lubbock.h>
20
21#include "leds.h"
22
23/*
24 * 8 discrete leds available for general use:
25 *
26 * Note: bits [15-8] are used to enable/blank the 8 7 segment hex displays
27 * so be sure to not monkey with them here.
28 */
29
30#define D28 (1 << 0)
31#define D27 (1 << 1)
32#define D26 (1 << 2)
33#define D25 (1 << 3)
34#define D24 (1 << 4)
35#define D23 (1 << 5)
36#define D22 (1 << 6)
37#define D21 (1 << 7)
38
39#define LED_STATE_ENABLED 1
40#define LED_STATE_CLAIMED 2
41
42static unsigned int led_state;
43static unsigned int hw_led_state;
44
45void lubbock_leds_event(led_event_t evt)
46{
47 unsigned long flags;
48
49 local_irq_save(flags);
50
51 switch (evt) {
52 case led_start:
53 hw_led_state = 0;
54 led_state = LED_STATE_ENABLED;
55 break;
56
57 case led_stop:
58 led_state &= ~LED_STATE_ENABLED;
59 break;
60
61 case led_claim:
62 led_state |= LED_STATE_CLAIMED;
63 hw_led_state = 0;
64 break;
65
66 case led_release:
67 led_state &= ~LED_STATE_CLAIMED;
68 hw_led_state = 0;
69 break;
70
71#ifdef CONFIG_LEDS_TIMER
72 case led_timer:
73 hw_led_state ^= D26;
74 break;
75#endif
76
77#ifdef CONFIG_LEDS_CPU
78 case led_idle_start:
79 hw_led_state &= ~D27;
80 break;
81
82 case led_idle_end:
83 hw_led_state |= D27;
84 break;
85#endif
86
87 case led_halted:
88 break;
89
90 case led_green_on:
91 hw_led_state |= D21;
92 break;
93
94 case led_green_off:
95 hw_led_state &= ~D21;
96 break;
97
98 case led_amber_on:
99 hw_led_state |= D22;
100 break;
101
102 case led_amber_off:
103 hw_led_state &= ~D22;
104 break;
105
106 case led_red_on:
107 hw_led_state |= D23;
108 break;
109
110 case led_red_off:
111 hw_led_state &= ~D23;
112 break;
113
114 default:
115 break;
116 }
117
118 if (led_state & LED_STATE_ENABLED)
119 LUB_DISC_BLNK_LED = (LUB_DISC_BLNK_LED | 0xff) & ~hw_led_state;
120 else
121 LUB_DISC_BLNK_LED |= 0xff;
122
123 local_irq_restore(flags);
124}
diff --git a/arch/arm/mach-pxa/leds-mainstone.c b/arch/arm/mach-pxa/leds-mainstone.c
deleted file mode 100644
index 4058ab340fe6..000000000000
--- a/arch/arm/mach-pxa/leds-mainstone.c
+++ /dev/null
@@ -1,119 +0,0 @@
1/*
2 * linux/arch/arm/mach-pxa/leds-mainstone.c
3 *
4 * Author: Nicolas Pitre
5 * Created: Nov 05, 2002
6 * Copyright: MontaVista Software Inc.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#include <linux/init.h>
14
15#include <mach/hardware.h>
16#include <asm/leds.h>
17
18#include <mach/pxa27x.h>
19#include <mach/mainstone.h>
20
21#include "leds.h"
22
23
24/* 8 discrete leds available for general use: */
25#define D28 (1 << 0)
26#define D27 (1 << 1)
27#define D26 (1 << 2)
28#define D25 (1 << 3)
29#define D24 (1 << 4)
30#define D23 (1 << 5)
31#define D22 (1 << 6)
32#define D21 (1 << 7)
33
34#define LED_STATE_ENABLED 1
35#define LED_STATE_CLAIMED 2
36
37static unsigned int led_state;
38static unsigned int hw_led_state;
39
40void mainstone_leds_event(led_event_t evt)
41{
42 unsigned long flags;
43
44 local_irq_save(flags);
45
46 switch (evt) {
47 case led_start:
48 hw_led_state = 0;
49 led_state = LED_STATE_ENABLED;
50 break;
51
52 case led_stop:
53 led_state &= ~LED_STATE_ENABLED;
54 break;
55
56 case led_claim:
57 led_state |= LED_STATE_CLAIMED;
58 hw_led_state = 0;
59 break;
60
61 case led_release:
62 led_state &= ~LED_STATE_CLAIMED;
63 hw_led_state = 0;
64 break;
65
66#ifdef CONFIG_LEDS_TIMER
67 case led_timer:
68 hw_led_state ^= D26;
69 break;
70#endif
71
72#ifdef CONFIG_LEDS_CPU
73 case led_idle_start:
74 hw_led_state &= ~D27;
75 break;
76
77 case led_idle_end:
78 hw_led_state |= D27;
79 break;
80#endif
81
82 case led_halted:
83 break;
84
85 case led_green_on:
86 hw_led_state |= D21;
87 break;
88
89 case led_green_off:
90 hw_led_state &= ~D21;
91 break;
92
93 case led_amber_on:
94 hw_led_state |= D22;
95 break;
96
97 case led_amber_off:
98 hw_led_state &= ~D22;
99 break;
100
101 case led_red_on:
102 hw_led_state |= D23;
103 break;
104
105 case led_red_off:
106 hw_led_state &= ~D23;
107 break;
108
109 default:
110 break;
111 }
112
113 if (led_state & LED_STATE_ENABLED)
114 MST_LEDCTRL = (MST_LEDCTRL | 0xff) & ~hw_led_state;
115 else
116 MST_LEDCTRL |= 0xff;
117
118 local_irq_restore(flags);
119}
diff --git a/arch/arm/mach-pxa/leds.c b/arch/arm/mach-pxa/leds.c
deleted file mode 100644
index bbe4d5f6afaa..000000000000
--- a/arch/arm/mach-pxa/leds.c
+++ /dev/null
@@ -1,32 +0,0 @@
1/*
2 * linux/arch/arm/mach-pxa/leds.c
3 *
4 * xscale LEDs dispatcher
5 *
6 * Copyright (C) 2001 Nicolas Pitre
7 *
8 * Copyright (c) 2001 Jeff Sutherland, Accelent Systems Inc.
9 */
10#include <linux/compiler.h>
11#include <linux/init.h>
12
13#include <asm/leds.h>
14#include <asm/mach-types.h>
15
16#include "leds.h"
17
18static int __init
19pxa_leds_init(void)
20{
21 if (machine_is_lubbock())
22 leds_event = lubbock_leds_event;
23 if (machine_is_mainstone())
24 leds_event = mainstone_leds_event;
25 if (machine_is_pxa_idp())
26 leds_event = idp_leds_event;
27
28 leds_event(led_start);
29 return 0;
30}
31
32core_initcall(pxa_leds_init);
diff --git a/arch/arm/mach-pxa/leds.h b/arch/arm/mach-pxa/leds.h
deleted file mode 100644
index 7f0dfe01345a..000000000000
--- a/arch/arm/mach-pxa/leds.h
+++ /dev/null
@@ -1,13 +0,0 @@
1/*
2 * arch/arm/mach-pxa/leds.h
3 *
4 * Copyright (c) 2001 Jeff Sutherland, Accelent Systems Inc.
5 *
6 * blinky lights for various PXA-based systems:
7 *
8 */
9
10extern void idp_leds_event(led_event_t evt);
11extern void lubbock_leds_event(led_event_t evt);
12extern void mainstone_leds_event(led_event_t evt);
13extern void trizeps4_leds_event(led_event_t evt);
diff --git a/arch/arm/mach-pxa/lubbock.c b/arch/arm/mach-pxa/lubbock.c
index 0ca0db787903..3c48035afd6b 100644
--- a/arch/arm/mach-pxa/lubbock.c
+++ b/arch/arm/mach-pxa/lubbock.c
@@ -15,6 +15,7 @@
15#include <linux/module.h> 15#include <linux/module.h>
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/io.h>
18#include <linux/platform_device.h> 19#include <linux/platform_device.h>
19#include <linux/syscore_ops.h> 20#include <linux/syscore_ops.h>
20#include <linux/major.h> 21#include <linux/major.h>
@@ -23,6 +24,8 @@
23#include <linux/mtd/mtd.h> 24#include <linux/mtd/mtd.h>
24#include <linux/mtd/partitions.h> 25#include <linux/mtd/partitions.h>
25#include <linux/smc91x.h> 26#include <linux/smc91x.h>
27#include <linux/slab.h>
28#include <linux/leds.h>
26 29
27#include <linux/spi/spi.h> 30#include <linux/spi/spi.h>
28#include <linux/spi/ads7846.h> 31#include <linux/spi/ads7846.h>
@@ -549,6 +552,98 @@ static void __init lubbock_map_io(void)
549 PCFR |= PCFR_OPDE; 552 PCFR |= PCFR_OPDE;
550} 553}
551 554
555/*
556 * Driver for the 8 discrete LEDs available for general use:
557 * Note: bits [15-8] are used to enable/blank the 8 7 segment hex displays
558 * so be sure to not monkey with them here.
559 */
560
561#if defined(CONFIG_NEW_LEDS) && defined(CONFIG_LEDS_CLASS)
562struct lubbock_led {
563 struct led_classdev cdev;
564 u8 mask;
565};
566
567/*
568 * The triggers lines up below will only be used if the
569 * LED triggers are compiled in.
570 */
571static const struct {
572 const char *name;
573 const char *trigger;
574} lubbock_leds[] = {
575 { "lubbock:D28", "default-on", },
576 { "lubbock:D27", "cpu0", },
577 { "lubbock:D26", "heartbeat" },
578 { "lubbock:D25", },
579 { "lubbock:D24", },
580 { "lubbock:D23", },
581 { "lubbock:D22", },
582 { "lubbock:D21", },
583};
584
585static void lubbock_led_set(struct led_classdev *cdev,
586 enum led_brightness b)
587{
588 struct lubbock_led *led = container_of(cdev,
589 struct lubbock_led, cdev);
590 u32 reg = LUB_DISC_BLNK_LED;
591
592 if (b != LED_OFF)
593 reg |= led->mask;
594 else
595 reg &= ~led->mask;
596
597 LUB_DISC_BLNK_LED = reg;
598}
599
600static enum led_brightness lubbock_led_get(struct led_classdev *cdev)
601{
602 struct lubbock_led *led = container_of(cdev,
603 struct lubbock_led, cdev);
604 u32 reg = LUB_DISC_BLNK_LED;
605
606 return (reg & led->mask) ? LED_FULL : LED_OFF;
607}
608
609static int __init lubbock_leds_init(void)
610{
611 int i;
612
613 if (!machine_is_lubbock())
614 return -ENODEV;
615
616 /* All ON */
617 LUB_DISC_BLNK_LED |= 0xff;
618 for (i = 0; i < ARRAY_SIZE(lubbock_leds); i++) {
619 struct lubbock_led *led;
620
621 led = kzalloc(sizeof(*led), GFP_KERNEL);
622 if (!led)
623 break;
624
625 led->cdev.name = lubbock_leds[i].name;
626 led->cdev.brightness_set = lubbock_led_set;
627 led->cdev.brightness_get = lubbock_led_get;
628 led->cdev.default_trigger = lubbock_leds[i].trigger;
629 led->mask = BIT(i);
630
631 if (led_classdev_register(NULL, &led->cdev) < 0) {
632 kfree(led);
633 break;
634 }
635 }
636
637 return 0;
638}
639
640/*
641 * Since we may have triggers on any subsystem, defer registration
642 * until after subsystem_init.
643 */
644fs_initcall(lubbock_leds_init);
645#endif
646
552MACHINE_START(LUBBOCK, "Intel DBPXA250 Development Platform (aka Lubbock)") 647MACHINE_START(LUBBOCK, "Intel DBPXA250 Development Platform (aka Lubbock)")
553 /* Maintainer: MontaVista Software Inc. */ 648 /* Maintainer: MontaVista Software Inc. */
554 .map_io = lubbock_map_io, 649 .map_io = lubbock_map_io,
diff --git a/arch/arm/mach-pxa/mainstone.c b/arch/arm/mach-pxa/mainstone.c
index 1aebaf719462..bdc6c335830a 100644
--- a/arch/arm/mach-pxa/mainstone.c
+++ b/arch/arm/mach-pxa/mainstone.c
@@ -28,6 +28,8 @@
28#include <linux/pwm_backlight.h> 28#include <linux/pwm_backlight.h>
29#include <linux/smc91x.h> 29#include <linux/smc91x.h>
30#include <linux/i2c/pxa-i2c.h> 30#include <linux/i2c/pxa-i2c.h>
31#include <linux/slab.h>
32#include <linux/leds.h>
31 33
32#include <asm/types.h> 34#include <asm/types.h>
33#include <asm/setup.h> 35#include <asm/setup.h>
@@ -613,6 +615,98 @@ static void __init mainstone_map_io(void)
613 PCFR = 0x66; 615 PCFR = 0x66;
614} 616}
615 617
618/*
619 * Driver for the 8 discrete LEDs available for general use:
620 * Note: bits [15-8] are used to enable/blank the 8 7 segment hex displays
621 * so be sure to not monkey with them here.
622 */
623
624#if defined(CONFIG_NEW_LEDS) && defined(CONFIG_LEDS_CLASS)
625struct mainstone_led {
626 struct led_classdev cdev;
627 u8 mask;
628};
629
630/*
631 * The triggers lines up below will only be used if the
632 * LED triggers are compiled in.
633 */
634static const struct {
635 const char *name;
636 const char *trigger;
637} mainstone_leds[] = {
638 { "mainstone:D28", "default-on", },
639 { "mainstone:D27", "cpu0", },
640 { "mainstone:D26", "heartbeat" },
641 { "mainstone:D25", },
642 { "mainstone:D24", },
643 { "mainstone:D23", },
644 { "mainstone:D22", },
645 { "mainstone:D21", },
646};
647
648static void mainstone_led_set(struct led_classdev *cdev,
649 enum led_brightness b)
650{
651 struct mainstone_led *led = container_of(cdev,
652 struct mainstone_led, cdev);
653 u32 reg = MST_LEDCTRL;
654
655 if (b != LED_OFF)
656 reg |= led->mask;
657 else
658 reg &= ~led->mask;
659
660 MST_LEDCTRL = reg;
661}
662
663static enum led_brightness mainstone_led_get(struct led_classdev *cdev)
664{
665 struct mainstone_led *led = container_of(cdev,
666 struct mainstone_led, cdev);
667 u32 reg = MST_LEDCTRL;
668
669 return (reg & led->mask) ? LED_FULL : LED_OFF;
670}
671
672static int __init mainstone_leds_init(void)
673{
674 int i;
675
676 if (!machine_is_mainstone())
677 return -ENODEV;
678
679 /* All ON */
680 MST_LEDCTRL |= 0xff;
681 for (i = 0; i < ARRAY_SIZE(mainstone_leds); i++) {
682 struct mainstone_led *led;
683
684 led = kzalloc(sizeof(*led), GFP_KERNEL);
685 if (!led)
686 break;
687
688 led->cdev.name = mainstone_leds[i].name;
689 led->cdev.brightness_set = mainstone_led_set;
690 led->cdev.brightness_get = mainstone_led_get;
691 led->cdev.default_trigger = mainstone_leds[i].trigger;
692 led->mask = BIT(i);
693
694 if (led_classdev_register(NULL, &led->cdev) < 0) {
695 kfree(led);
696 break;
697 }
698 }
699
700 return 0;
701}
702
703/*
704 * Since we may have triggers on any subsystem, defer registration
705 * until after subsystem_init.
706 */
707fs_initcall(mainstone_leds_init);
708#endif
709
616MACHINE_START(MAINSTONE, "Intel HCDDBBVA0 Development Platform (aka Mainstone)") 710MACHINE_START(MAINSTONE, "Intel HCDDBBVA0 Development Platform (aka Mainstone)")
617 /* Maintainer: MontaVista Software Inc. */ 711 /* Maintainer: MontaVista Software Inc. */
618 .atag_offset = 0x100, /* BLOB boot parameter setting */ 712 .atag_offset = 0x100, /* BLOB boot parameter setting */
diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c
index ff007d15e0ec..682467480588 100644
--- a/arch/arm/mach-realview/core.c
+++ b/arch/arm/mach-realview/core.c
@@ -34,7 +34,6 @@
34 34
35#include <mach/hardware.h> 35#include <mach/hardware.h>
36#include <asm/irq.h> 36#include <asm/irq.h>
37#include <asm/leds.h>
38#include <asm/mach-types.h> 37#include <asm/mach-types.h>
39#include <asm/hardware/arm_timer.h> 38#include <asm/hardware/arm_timer.h>
40#include <asm/hardware/icst.h> 39#include <asm/hardware/icst.h>
@@ -330,44 +329,6 @@ struct clcd_board clcd_plat_data = {
330 .remove = versatile_clcd_remove_dma, 329 .remove = versatile_clcd_remove_dma,
331}; 330};
332 331
333#ifdef CONFIG_LEDS
334#define VA_LEDS_BASE (__io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_LED_OFFSET)
335
336void realview_leds_event(led_event_t ledevt)
337{
338 unsigned long flags;
339 u32 val;
340 u32 led = 1 << smp_processor_id();
341
342 local_irq_save(flags);
343 val = readl(VA_LEDS_BASE);
344
345 switch (ledevt) {
346 case led_idle_start:
347 val = val & ~led;
348 break;
349
350 case led_idle_end:
351 val = val | led;
352 break;
353
354 case led_timer:
355 val = val ^ REALVIEW_SYS_LED7;
356 break;
357
358 case led_halted:
359 val = 0;
360 break;
361
362 default:
363 break;
364 }
365
366 writel(val, VA_LEDS_BASE);
367 local_irq_restore(flags);
368}
369#endif /* CONFIG_LEDS */
370
371/* 332/*
372 * Where is the timer (VA)? 333 * Where is the timer (VA)?
373 */ 334 */
diff --git a/arch/arm/mach-realview/core.h b/arch/arm/mach-realview/core.h
index f8f2c0ac4c01..f2141ae5a7de 100644
--- a/arch/arm/mach-realview/core.h
+++ b/arch/arm/mach-realview/core.h
@@ -26,7 +26,6 @@
26#include <linux/io.h> 26#include <linux/io.h>
27 27
28#include <asm/setup.h> 28#include <asm/setup.h>
29#include <asm/leds.h>
30 29
31#define APB_DEVICE(name, busid, base, plat) \ 30#define APB_DEVICE(name, busid, base, plat) \
32static AMBA_APB_DEVICE(name, busid, 0, REALVIEW_##base##_BASE, base##_IRQ, plat) 31static AMBA_APB_DEVICE(name, busid, 0, REALVIEW_##base##_BASE, base##_IRQ, plat)
@@ -47,7 +46,6 @@ extern void __iomem *timer1_va_base;
47extern void __iomem *timer2_va_base; 46extern void __iomem *timer2_va_base;
48extern void __iomem *timer3_va_base; 47extern void __iomem *timer3_va_base;
49 48
50extern void realview_leds_event(led_event_t ledevt);
51extern void realview_timer_init(unsigned int timer_irq); 49extern void realview_timer_init(unsigned int timer_irq);
52extern int realview_flash_register(struct resource *res, u32 num); 50extern int realview_flash_register(struct resource *res, u32 num);
53extern int realview_eth_register(const char *name, struct resource *res); 51extern int realview_eth_register(const char *name, struct resource *res);
diff --git a/arch/arm/mach-realview/realview_eb.c b/arch/arm/mach-realview/realview_eb.c
index ce7747692c8b..d3b3cd216d64 100644
--- a/arch/arm/mach-realview/realview_eb.c
+++ b/arch/arm/mach-realview/realview_eb.c
@@ -31,7 +31,6 @@
31 31
32#include <mach/hardware.h> 32#include <mach/hardware.h>
33#include <asm/irq.h> 33#include <asm/irq.h>
34#include <asm/leds.h>
35#include <asm/mach-types.h> 34#include <asm/mach-types.h>
36#include <asm/pgtable.h> 35#include <asm/pgtable.h>
37#include <asm/hardware/gic.h> 36#include <asm/hardware/gic.h>
@@ -463,10 +462,6 @@ static void __init realview_eb_init(void)
463 struct amba_device *d = amba_devs[i]; 462 struct amba_device *d = amba_devs[i];
464 amba_device_register(d, &iomem_resource); 463 amba_device_register(d, &iomem_resource);
465 } 464 }
466
467#ifdef CONFIG_LEDS
468 leds_event = realview_leds_event;
469#endif
470} 465}
471 466
472MACHINE_START(REALVIEW_EB, "ARM-RealView EB") 467MACHINE_START(REALVIEW_EB, "ARM-RealView EB")
diff --git a/arch/arm/mach-realview/realview_pb1176.c b/arch/arm/mach-realview/realview_pb1176.c
index e21711d72ee2..07d6672ddae7 100644
--- a/arch/arm/mach-realview/realview_pb1176.c
+++ b/arch/arm/mach-realview/realview_pb1176.c
@@ -33,7 +33,6 @@
33 33
34#include <mach/hardware.h> 34#include <mach/hardware.h>
35#include <asm/irq.h> 35#include <asm/irq.h>
36#include <asm/leds.h>
37#include <asm/mach-types.h> 36#include <asm/mach-types.h>
38#include <asm/pgtable.h> 37#include <asm/pgtable.h>
39#include <asm/hardware/gic.h> 38#include <asm/hardware/gic.h>
@@ -376,10 +375,6 @@ static void __init realview_pb1176_init(void)
376 struct amba_device *d = amba_devs[i]; 375 struct amba_device *d = amba_devs[i];
377 amba_device_register(d, &iomem_resource); 376 amba_device_register(d, &iomem_resource);
378 } 377 }
379
380#ifdef CONFIG_LEDS
381 leds_event = realview_leds_event;
382#endif
383} 378}
384 379
385MACHINE_START(REALVIEW_PB1176, "ARM-RealView PB1176") 380MACHINE_START(REALVIEW_PB1176, "ARM-RealView PB1176")
diff --git a/arch/arm/mach-realview/realview_pb11mp.c b/arch/arm/mach-realview/realview_pb11mp.c
index b442fb276d57..ec4fcd9a7e9c 100644
--- a/arch/arm/mach-realview/realview_pb11mp.c
+++ b/arch/arm/mach-realview/realview_pb11mp.c
@@ -31,7 +31,6 @@
31 31
32#include <mach/hardware.h> 32#include <mach/hardware.h>
33#include <asm/irq.h> 33#include <asm/irq.h>
34#include <asm/leds.h>
35#include <asm/mach-types.h> 34#include <asm/mach-types.h>
36#include <asm/pgtable.h> 35#include <asm/pgtable.h>
37#include <asm/hardware/gic.h> 36#include <asm/hardware/gic.h>
@@ -358,10 +357,6 @@ static void __init realview_pb11mp_init(void)
358 struct amba_device *d = amba_devs[i]; 357 struct amba_device *d = amba_devs[i];
359 amba_device_register(d, &iomem_resource); 358 amba_device_register(d, &iomem_resource);
360 } 359 }
361
362#ifdef CONFIG_LEDS
363 leds_event = realview_leds_event;
364#endif
365} 360}
366 361
367MACHINE_START(REALVIEW_PB11MP, "ARM-RealView PB11MPCore") 362MACHINE_START(REALVIEW_PB11MP, "ARM-RealView PB11MPCore")
diff --git a/arch/arm/mach-realview/realview_pba8.c b/arch/arm/mach-realview/realview_pba8.c
index 1435cd863965..9992431b8a15 100644
--- a/arch/arm/mach-realview/realview_pba8.c
+++ b/arch/arm/mach-realview/realview_pba8.c
@@ -30,7 +30,6 @@
30#include <linux/platform_data/clk-realview.h> 30#include <linux/platform_data/clk-realview.h>
31 31
32#include <asm/irq.h> 32#include <asm/irq.h>
33#include <asm/leds.h>
34#include <asm/mach-types.h> 33#include <asm/mach-types.h>
35#include <asm/pgtable.h> 34#include <asm/pgtable.h>
36#include <asm/hardware/gic.h> 35#include <asm/hardware/gic.h>
@@ -300,10 +299,6 @@ static void __init realview_pba8_init(void)
300 struct amba_device *d = amba_devs[i]; 299 struct amba_device *d = amba_devs[i];
301 amba_device_register(d, &iomem_resource); 300 amba_device_register(d, &iomem_resource);
302 } 301 }
303
304#ifdef CONFIG_LEDS
305 leds_event = realview_leds_event;
306#endif
307} 302}
308 303
309MACHINE_START(REALVIEW_PBA8, "ARM-RealView PB-A8") 304MACHINE_START(REALVIEW_PBA8, "ARM-RealView PB-A8")
diff --git a/arch/arm/mach-realview/realview_pbx.c b/arch/arm/mach-realview/realview_pbx.c
index 5d2c8bebb069..17954a327e1b 100644
--- a/arch/arm/mach-realview/realview_pbx.c
+++ b/arch/arm/mach-realview/realview_pbx.c
@@ -29,7 +29,6 @@
29#include <linux/platform_data/clk-realview.h> 29#include <linux/platform_data/clk-realview.h>
30 30
31#include <asm/irq.h> 31#include <asm/irq.h>
32#include <asm/leds.h>
33#include <asm/mach-types.h> 32#include <asm/mach-types.h>
34#include <asm/smp_twd.h> 33#include <asm/smp_twd.h>
35#include <asm/pgtable.h> 34#include <asm/pgtable.h>
@@ -395,10 +394,6 @@ static void __init realview_pbx_init(void)
395 struct amba_device *d = amba_devs[i]; 394 struct amba_device *d = amba_devs[i];
396 amba_device_register(d, &iomem_resource); 395 amba_device_register(d, &iomem_resource);
397 } 396 }
398
399#ifdef CONFIG_LEDS
400 leds_event = realview_leds_event;
401#endif
402} 397}
403 398
404MACHINE_START(REALVIEW_PBX, "ARM-RealView PBX") 399MACHINE_START(REALVIEW_PBX, "ARM-RealView PBX")
diff --git a/arch/arm/mach-sa1100/Makefile b/arch/arm/mach-sa1100/Makefile
index 60b97ec01676..1aed9e70465d 100644
--- a/arch/arm/mach-sa1100/Makefile
+++ b/arch/arm/mach-sa1100/Makefile
@@ -7,21 +7,17 @@ obj-y := clock.o generic.o irq.o time.o #nmi-oopser.o
7obj-m := 7obj-m :=
8obj-n := 8obj-n :=
9obj- := 9obj- :=
10led-y := leds.o
11 10
12obj-$(CONFIG_CPU_FREQ_SA1100) += cpu-sa1100.o 11obj-$(CONFIG_CPU_FREQ_SA1100) += cpu-sa1100.o
13obj-$(CONFIG_CPU_FREQ_SA1110) += cpu-sa1110.o 12obj-$(CONFIG_CPU_FREQ_SA1110) += cpu-sa1110.o
14 13
15# Specific board support 14# Specific board support
16obj-$(CONFIG_SA1100_ASSABET) += assabet.o 15obj-$(CONFIG_SA1100_ASSABET) += assabet.o
17led-$(CONFIG_SA1100_ASSABET) += leds-assabet.o
18obj-$(CONFIG_ASSABET_NEPONSET) += neponset.o 16obj-$(CONFIG_ASSABET_NEPONSET) += neponset.o
19 17
20obj-$(CONFIG_SA1100_BADGE4) += badge4.o 18obj-$(CONFIG_SA1100_BADGE4) += badge4.o
21led-$(CONFIG_SA1100_BADGE4) += leds-badge4.o
22 19
23obj-$(CONFIG_SA1100_CERF) += cerf.o 20obj-$(CONFIG_SA1100_CERF) += cerf.o
24led-$(CONFIG_SA1100_CERF) += leds-cerf.o
25 21
26obj-$(CONFIG_SA1100_COLLIE) += collie.o 22obj-$(CONFIG_SA1100_COLLIE) += collie.o
27 23
@@ -29,13 +25,11 @@ obj-$(CONFIG_SA1100_H3100) += h3100.o h3xxx.o
29obj-$(CONFIG_SA1100_H3600) += h3600.o h3xxx.o 25obj-$(CONFIG_SA1100_H3600) += h3600.o h3xxx.o
30 26
31obj-$(CONFIG_SA1100_HACKKIT) += hackkit.o 27obj-$(CONFIG_SA1100_HACKKIT) += hackkit.o
32led-$(CONFIG_SA1100_HACKKIT) += leds-hackkit.o
33 28
34obj-$(CONFIG_SA1100_JORNADA720) += jornada720.o 29obj-$(CONFIG_SA1100_JORNADA720) += jornada720.o
35obj-$(CONFIG_SA1100_JORNADA720_SSP) += jornada720_ssp.o 30obj-$(CONFIG_SA1100_JORNADA720_SSP) += jornada720_ssp.o
36 31
37obj-$(CONFIG_SA1100_LART) += lart.o 32obj-$(CONFIG_SA1100_LART) += lart.o
38led-$(CONFIG_SA1100_LART) += leds-lart.o
39 33
40obj-$(CONFIG_SA1100_NANOENGINE) += nanoengine.o 34obj-$(CONFIG_SA1100_NANOENGINE) += nanoengine.o
41obj-$(CONFIG_PCI_NANOENGINE) += pci-nanoengine.o 35obj-$(CONFIG_PCI_NANOENGINE) += pci-nanoengine.o
@@ -46,9 +40,6 @@ obj-$(CONFIG_SA1100_SHANNON) += shannon.o
46 40
47obj-$(CONFIG_SA1100_SIMPAD) += simpad.o 41obj-$(CONFIG_SA1100_SIMPAD) += simpad.o
48 42
49# LEDs support
50obj-$(CONFIG_LEDS) += $(led-y)
51
52# Miscellaneous functions 43# Miscellaneous functions
53obj-$(CONFIG_PM) += pm.o sleep.o 44obj-$(CONFIG_PM) += pm.o sleep.o
54obj-$(CONFIG_SA1100_SSP) += ssp.o 45obj-$(CONFIG_SA1100_SSP) += ssp.o
diff --git a/arch/arm/mach-sa1100/assabet.c b/arch/arm/mach-sa1100/assabet.c
index d673211f121c..1710ed1a0ac0 100644
--- a/arch/arm/mach-sa1100/assabet.c
+++ b/arch/arm/mach-sa1100/assabet.c
@@ -20,6 +20,8 @@
20#include <linux/mtd/partitions.h> 20#include <linux/mtd/partitions.h>
21#include <linux/delay.h> 21#include <linux/delay.h>
22#include <linux/mm.h> 22#include <linux/mm.h>
23#include <linux/leds.h>
24#include <linux/slab.h>
23 25
24#include <video/sa1100fb.h> 26#include <video/sa1100fb.h>
25 27
@@ -529,6 +531,89 @@ static void __init assabet_map_io(void)
529 sa1100_register_uart(2, 3); 531 sa1100_register_uart(2, 3);
530} 532}
531 533
534/* LEDs */
535#if defined(CONFIG_NEW_LEDS) && defined(CONFIG_LEDS_CLASS)
536struct assabet_led {
537 struct led_classdev cdev;
538 u32 mask;
539};
540
541/*
542 * The triggers lines up below will only be used if the
543 * LED triggers are compiled in.
544 */
545static const struct {
546 const char *name;
547 const char *trigger;
548} assabet_leds[] = {
549 { "assabet:red", "cpu0",},
550 { "assabet:green", "heartbeat", },
551};
552
553/*
554 * The LED control in Assabet is reversed:
555 * - setting bit means turn off LED
556 * - clearing bit means turn on LED
557 */
558static void assabet_led_set(struct led_classdev *cdev,
559 enum led_brightness b)
560{
561 struct assabet_led *led = container_of(cdev,
562 struct assabet_led, cdev);
563
564 if (b != LED_OFF)
565 ASSABET_BCR_clear(led->mask);
566 else
567 ASSABET_BCR_set(led->mask);
568}
569
570static enum led_brightness assabet_led_get(struct led_classdev *cdev)
571{
572 struct assabet_led *led = container_of(cdev,
573 struct assabet_led, cdev);
574
575 return (ASSABET_BCR & led->mask) ? LED_OFF : LED_FULL;
576}
577
578static int __init assabet_leds_init(void)
579{
580 int i;
581
582 if (!machine_is_assabet())
583 return -ENODEV;
584
585 for (i = 0; i < ARRAY_SIZE(assabet_leds); i++) {
586 struct assabet_led *led;
587
588 led = kzalloc(sizeof(*led), GFP_KERNEL);
589 if (!led)
590 break;
591
592 led->cdev.name = assabet_leds[i].name;
593 led->cdev.brightness_set = assabet_led_set;
594 led->cdev.brightness_get = assabet_led_get;
595 led->cdev.default_trigger = assabet_leds[i].trigger;
596
597 if (!i)
598 led->mask = ASSABET_BCR_LED_RED;
599 else
600 led->mask = ASSABET_BCR_LED_GREEN;
601
602 if (led_classdev_register(NULL, &led->cdev) < 0) {
603 kfree(led);
604 break;
605 }
606 }
607
608 return 0;
609}
610
611/*
612 * Since we may have triggers on any subsystem, defer registration
613 * until after subsystem_init.
614 */
615fs_initcall(assabet_leds_init);
616#endif
532 617
533MACHINE_START(ASSABET, "Intel-Assabet") 618MACHINE_START(ASSABET, "Intel-Assabet")
534 .atag_offset = 0x100, 619 .atag_offset = 0x100,
diff --git a/arch/arm/mach-sa1100/badge4.c b/arch/arm/mach-sa1100/badge4.c
index b30fb99b587c..038df4894b0f 100644
--- a/arch/arm/mach-sa1100/badge4.c
+++ b/arch/arm/mach-sa1100/badge4.c
@@ -22,6 +22,8 @@
22#include <linux/mtd/mtd.h> 22#include <linux/mtd/mtd.h>
23#include <linux/mtd/partitions.h> 23#include <linux/mtd/partitions.h>
24#include <linux/errno.h> 24#include <linux/errno.h>
25#include <linux/gpio.h>
26#include <linux/leds.h>
25 27
26#include <mach/hardware.h> 28#include <mach/hardware.h>
27#include <asm/mach-types.h> 29#include <asm/mach-types.h>
@@ -76,8 +78,36 @@ static struct platform_device sa1111_device = {
76 .resource = sa1111_resources, 78 .resource = sa1111_resources,
77}; 79};
78 80
81/* LEDs */
82struct gpio_led badge4_gpio_leds[] = {
83 {
84 .name = "badge4:red",
85 .default_trigger = "heartbeat",
86 .gpio = 7,
87 },
88 {
89 .name = "badge4:green",
90 .default_trigger = "cpu0",
91 .gpio = 9,
92 },
93};
94
95static struct gpio_led_platform_data badge4_gpio_led_info = {
96 .leds = badge4_gpio_leds,
97 .num_leds = ARRAY_SIZE(badge4_gpio_leds),
98};
99
100static struct platform_device badge4_leds = {
101 .name = "leds-gpio",
102 .id = -1,
103 .dev = {
104 .platform_data = &badge4_gpio_led_info,
105 }
106};
107
79static struct platform_device *devices[] __initdata = { 108static struct platform_device *devices[] __initdata = {
80 &sa1111_device, 109 &sa1111_device,
110 &badge4_leds,
81}; 111};
82 112
83static int __init badge4_sa1111_init(void) 113static int __init badge4_sa1111_init(void)
diff --git a/arch/arm/mach-sa1100/cerf.c b/arch/arm/mach-sa1100/cerf.c
index 09d7f4b4b354..5240f104a3cd 100644
--- a/arch/arm/mach-sa1100/cerf.c
+++ b/arch/arm/mach-sa1100/cerf.c
@@ -17,6 +17,8 @@
17#include <linux/irq.h> 17#include <linux/irq.h>
18#include <linux/mtd/mtd.h> 18#include <linux/mtd/mtd.h>
19#include <linux/mtd/partitions.h> 19#include <linux/mtd/partitions.h>
20#include <linux/gpio.h>
21#include <linux/leds.h>
20 22
21#include <mach/hardware.h> 23#include <mach/hardware.h>
22#include <asm/setup.h> 24#include <asm/setup.h>
@@ -43,8 +45,48 @@ static struct platform_device cerfuart2_device = {
43 .resource = cerfuart2_resources, 45 .resource = cerfuart2_resources,
44}; 46};
45 47
48/* LEDs */
49struct gpio_led cerf_gpio_leds[] = {
50 {
51 .name = "cerf:d0",
52 .default_trigger = "heartbeat",
53 .gpio = 0,
54 },
55 {
56 .name = "cerf:d1",
57 .default_trigger = "cpu0",
58 .gpio = 1,
59 },
60 {
61 .name = "cerf:d2",
62 .default_trigger = "default-on",
63 .gpio = 2,
64 },
65 {
66 .name = "cerf:d3",
67 .default_trigger = "default-on",
68 .gpio = 3,
69 },
70
71};
72
73static struct gpio_led_platform_data cerf_gpio_led_info = {
74 .leds = cerf_gpio_leds,
75 .num_leds = ARRAY_SIZE(cerf_gpio_leds),
76};
77
78static struct platform_device cerf_leds = {
79 .name = "leds-gpio",
80 .id = -1,
81 .dev = {
82 .platform_data = &cerf_gpio_led_info,
83 }
84};
85
86
46static struct platform_device *cerf_devices[] __initdata = { 87static struct platform_device *cerf_devices[] __initdata = {
47 &cerfuart2_device, 88 &cerfuart2_device,
89 &cerf_leds,
48}; 90};
49 91
50#ifdef CONFIG_SA1100_CERF_FLASH_32MB 92#ifdef CONFIG_SA1100_CERF_FLASH_32MB
diff --git a/arch/arm/mach-sa1100/hackkit.c b/arch/arm/mach-sa1100/hackkit.c
index 7f86bd911826..fc106aab7c7e 100644
--- a/arch/arm/mach-sa1100/hackkit.c
+++ b/arch/arm/mach-sa1100/hackkit.c
@@ -21,6 +21,10 @@
21#include <linux/serial_core.h> 21#include <linux/serial_core.h>
22#include <linux/mtd/mtd.h> 22#include <linux/mtd/mtd.h>
23#include <linux/mtd/partitions.h> 23#include <linux/mtd/partitions.h>
24#include <linux/tty.h>
25#include <linux/gpio.h>
26#include <linux/leds.h>
27#include <linux/platform_device.h>
24 28
25#include <asm/mach-types.h> 29#include <asm/mach-types.h>
26#include <asm/setup.h> 30#include <asm/setup.h>
@@ -183,9 +187,37 @@ static struct flash_platform_data hackkit_flash_data = {
183static struct resource hackkit_flash_resource = 187static struct resource hackkit_flash_resource =
184 DEFINE_RES_MEM(SA1100_CS0_PHYS, SZ_32M); 188 DEFINE_RES_MEM(SA1100_CS0_PHYS, SZ_32M);
185 189
190/* LEDs */
191struct gpio_led hackkit_gpio_leds[] = {
192 {
193 .name = "hackkit:red",
194 .default_trigger = "cpu0",
195 .gpio = 22,
196 },
197 {
198 .name = "hackkit:green",
199 .default_trigger = "heartbeat",
200 .gpio = 23,
201 },
202};
203
204static struct gpio_led_platform_data hackkit_gpio_led_info = {
205 .leds = hackkit_gpio_leds,
206 .num_leds = ARRAY_SIZE(hackkit_gpio_leds),
207};
208
209static struct platform_device hackkit_leds = {
210 .name = "leds-gpio",
211 .id = -1,
212 .dev = {
213 .platform_data = &hackkit_gpio_led_info,
214 }
215};
216
186static void __init hackkit_init(void) 217static void __init hackkit_init(void)
187{ 218{
188 sa11x0_register_mtd(&hackkit_flash_data, &hackkit_flash_resource, 1); 219 sa11x0_register_mtd(&hackkit_flash_data, &hackkit_flash_resource, 1);
220 platform_device_register(&hackkit_leds);
189} 221}
190 222
191/********************************************************************** 223/**********************************************************************
diff --git a/arch/arm/mach-sa1100/lart.c b/arch/arm/mach-sa1100/lart.c
index b775a0abec0a..b2ce04bf4c9b 100644
--- a/arch/arm/mach-sa1100/lart.c
+++ b/arch/arm/mach-sa1100/lart.c
@@ -5,6 +5,9 @@
5#include <linux/init.h> 5#include <linux/init.h>
6#include <linux/kernel.h> 6#include <linux/kernel.h>
7#include <linux/tty.h> 7#include <linux/tty.h>
8#include <linux/gpio.h>
9#include <linux/leds.h>
10#include <linux/platform_device.h>
8 11
9#include <video/sa1100fb.h> 12#include <video/sa1100fb.h>
10 13
@@ -126,6 +129,27 @@ static struct map_desc lart_io_desc[] __initdata = {
126 } 129 }
127}; 130};
128 131
132/* LEDs */
133struct gpio_led lart_gpio_leds[] = {
134 {
135 .name = "lart:red",
136 .default_trigger = "cpu0",
137 .gpio = 23,
138 },
139};
140
141static struct gpio_led_platform_data lart_gpio_led_info = {
142 .leds = lart_gpio_leds,
143 .num_leds = ARRAY_SIZE(lart_gpio_leds),
144};
145
146static struct platform_device lart_leds = {
147 .name = "leds-gpio",
148 .id = -1,
149 .dev = {
150 .platform_data = &lart_gpio_led_info,
151 }
152};
129static void __init lart_map_io(void) 153static void __init lart_map_io(void)
130{ 154{
131 sa1100_map_io(); 155 sa1100_map_io();
@@ -139,6 +163,8 @@ static void __init lart_map_io(void)
139 GPDR |= GPIO_UART_TXD; 163 GPDR |= GPIO_UART_TXD;
140 GPDR &= ~GPIO_UART_RXD; 164 GPDR &= ~GPIO_UART_RXD;
141 PPAR |= PPAR_UPR; 165 PPAR |= PPAR_UPR;
166
167 platform_device_register(&lart_leds);
142} 168}
143 169
144MACHINE_START(LART, "LART") 170MACHINE_START(LART, "LART")
diff --git a/arch/arm/mach-sa1100/leds-assabet.c b/arch/arm/mach-sa1100/leds-assabet.c
deleted file mode 100644
index 3699176bca94..000000000000
--- a/arch/arm/mach-sa1100/leds-assabet.c
+++ /dev/null
@@ -1,113 +0,0 @@
1/*
2 * linux/arch/arm/mach-sa1100/leds-assabet.c
3 *
4 * Copyright (C) 2000 John Dorsey <john+@cs.cmu.edu>
5 *
6 * Original (leds-footbridge.c) by Russell King
7 *
8 * Assabet uses the LEDs as follows:
9 * - Green - toggles state every 50 timer interrupts
10 * - Red - on if system is not idle
11 */
12#include <linux/init.h>
13
14#include <mach/hardware.h>
15#include <asm/leds.h>
16#include <mach/assabet.h>
17
18#include "leds.h"
19
20
21#define LED_STATE_ENABLED 1
22#define LED_STATE_CLAIMED 2
23
24static unsigned int led_state;
25static unsigned int hw_led_state;
26
27#define ASSABET_BCR_LED_MASK (ASSABET_BCR_LED_GREEN | ASSABET_BCR_LED_RED)
28
29void assabet_leds_event(led_event_t evt)
30{
31 unsigned long flags;
32
33 local_irq_save(flags);
34
35 switch (evt) {
36 case led_start:
37 hw_led_state = ASSABET_BCR_LED_RED | ASSABET_BCR_LED_GREEN;
38 led_state = LED_STATE_ENABLED;
39 break;
40
41 case led_stop:
42 led_state &= ~LED_STATE_ENABLED;
43 hw_led_state = ASSABET_BCR_LED_RED | ASSABET_BCR_LED_GREEN;
44 ASSABET_BCR_frob(ASSABET_BCR_LED_MASK, hw_led_state);
45 break;
46
47 case led_claim:
48 led_state |= LED_STATE_CLAIMED;
49 hw_led_state = ASSABET_BCR_LED_RED | ASSABET_BCR_LED_GREEN;
50 break;
51
52 case led_release:
53 led_state &= ~LED_STATE_CLAIMED;
54 hw_led_state = ASSABET_BCR_LED_RED | ASSABET_BCR_LED_GREEN;
55 break;
56
57#ifdef CONFIG_LEDS_TIMER
58 case led_timer:
59 if (!(led_state & LED_STATE_CLAIMED))
60 hw_led_state ^= ASSABET_BCR_LED_GREEN;
61 break;
62#endif
63
64#ifdef CONFIG_LEDS_CPU
65 case led_idle_start:
66 if (!(led_state & LED_STATE_CLAIMED))
67 hw_led_state |= ASSABET_BCR_LED_RED;
68 break;
69
70 case led_idle_end:
71 if (!(led_state & LED_STATE_CLAIMED))
72 hw_led_state &= ~ASSABET_BCR_LED_RED;
73 break;
74#endif
75
76 case led_halted:
77 break;
78
79 case led_green_on:
80 if (led_state & LED_STATE_CLAIMED)
81 hw_led_state &= ~ASSABET_BCR_LED_GREEN;
82 break;
83
84 case led_green_off:
85 if (led_state & LED_STATE_CLAIMED)
86 hw_led_state |= ASSABET_BCR_LED_GREEN;
87 break;
88
89 case led_amber_on:
90 break;
91
92 case led_amber_off:
93 break;
94
95 case led_red_on:
96 if (led_state & LED_STATE_CLAIMED)
97 hw_led_state &= ~ASSABET_BCR_LED_RED;
98 break;
99
100 case led_red_off:
101 if (led_state & LED_STATE_CLAIMED)
102 hw_led_state |= ASSABET_BCR_LED_RED;
103 break;
104
105 default:
106 break;
107 }
108
109 if (led_state & LED_STATE_ENABLED)
110 ASSABET_BCR_frob(ASSABET_BCR_LED_MASK, hw_led_state);
111
112 local_irq_restore(flags);
113}
diff --git a/arch/arm/mach-sa1100/leds-badge4.c b/arch/arm/mach-sa1100/leds-badge4.c
deleted file mode 100644
index f99fac3eedb6..000000000000
--- a/arch/arm/mach-sa1100/leds-badge4.c
+++ /dev/null
@@ -1,110 +0,0 @@
1/*
2 * linux/arch/arm/mach-sa1100/leds-badge4.c
3 *
4 * Author: Christopher Hoover <ch@hpl.hp.com>
5 * Copyright (C) 2002 Hewlett-Packard Company
6 *
7 * 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
9 * published by the Free Software Foundation.
10 *
11 */
12
13#include <linux/init.h>
14
15#include <mach/hardware.h>
16#include <asm/leds.h>
17
18#include "leds.h"
19
20#define LED_STATE_ENABLED 1
21#define LED_STATE_CLAIMED 2
22
23static unsigned int led_state;
24static unsigned int hw_led_state;
25
26#define LED_RED GPIO_GPIO(7)
27#define LED_GREEN GPIO_GPIO(9)
28#define LED_MASK (LED_RED|LED_GREEN)
29
30#define LED_IDLE LED_GREEN
31#define LED_TIMER LED_RED
32
33void badge4_leds_event(led_event_t evt)
34{
35 unsigned long flags;
36
37 local_irq_save(flags);
38
39 switch (evt) {
40 case led_start:
41 GPDR |= LED_MASK;
42 hw_led_state = LED_MASK;
43 led_state = LED_STATE_ENABLED;
44 break;
45
46 case led_stop:
47 led_state &= ~LED_STATE_ENABLED;
48 break;
49
50 case led_claim:
51 led_state |= LED_STATE_CLAIMED;
52 hw_led_state = LED_MASK;
53 break;
54
55 case led_release:
56 led_state &= ~LED_STATE_CLAIMED;
57 hw_led_state = LED_MASK;
58 break;
59
60#ifdef CONFIG_LEDS_TIMER
61 case led_timer:
62 if (!(led_state & LED_STATE_CLAIMED))
63 hw_led_state ^= LED_TIMER;
64 break;
65#endif
66
67#ifdef CONFIG_LEDS_CPU
68 case led_idle_start:
69 /* LED off when system is idle */
70 if (!(led_state & LED_STATE_CLAIMED))
71 hw_led_state &= ~LED_IDLE;
72 break;
73
74 case led_idle_end:
75 if (!(led_state & LED_STATE_CLAIMED))
76 hw_led_state |= LED_IDLE;
77 break;
78#endif
79
80 case led_red_on:
81 if (!(led_state & LED_STATE_CLAIMED))
82 hw_led_state &= ~LED_RED;
83 break;
84
85 case led_red_off:
86 if (!(led_state & LED_STATE_CLAIMED))
87 hw_led_state |= LED_RED;
88 break;
89
90 case led_green_on:
91 if (!(led_state & LED_STATE_CLAIMED))
92 hw_led_state &= ~LED_GREEN;
93 break;
94
95 case led_green_off:
96 if (!(led_state & LED_STATE_CLAIMED))
97 hw_led_state |= LED_GREEN;
98 break;
99
100 default:
101 break;
102 }
103
104 if (led_state & LED_STATE_ENABLED) {
105 GPSR = hw_led_state;
106 GPCR = hw_led_state ^ LED_MASK;
107 }
108
109 local_irq_restore(flags);
110}
diff --git a/arch/arm/mach-sa1100/leds-cerf.c b/arch/arm/mach-sa1100/leds-cerf.c
deleted file mode 100644
index 30fc3b2bf555..000000000000
--- a/arch/arm/mach-sa1100/leds-cerf.c
+++ /dev/null
@@ -1,110 +0,0 @@
1/*
2 * linux/arch/arm/mach-sa1100/leds-cerf.c
3 *
4 * Author: ???
5 */
6#include <linux/init.h>
7#include <linux/io.h>
8
9#include <mach/hardware.h>
10#include <asm/leds.h>
11
12#include "leds.h"
13
14
15#define LED_STATE_ENABLED 1
16#define LED_STATE_CLAIMED 2
17
18static unsigned int led_state;
19static unsigned int hw_led_state;
20
21#define LED_D0 GPIO_GPIO(0)
22#define LED_D1 GPIO_GPIO(1)
23#define LED_D2 GPIO_GPIO(2)
24#define LED_D3 GPIO_GPIO(3)
25#define LED_MASK (LED_D0|LED_D1|LED_D2|LED_D3)
26
27void cerf_leds_event(led_event_t evt)
28{
29 unsigned long flags;
30
31 local_irq_save(flags);
32
33 switch (evt) {
34 case led_start:
35 hw_led_state = LED_MASK;
36 led_state = LED_STATE_ENABLED;
37 break;
38
39 case led_stop:
40 led_state &= ~LED_STATE_ENABLED;
41 break;
42
43 case led_claim:
44 led_state |= LED_STATE_CLAIMED;
45 hw_led_state = LED_MASK;
46 break;
47 case led_release:
48 led_state &= ~LED_STATE_CLAIMED;
49 hw_led_state = LED_MASK;
50 break;
51
52#ifdef CONFIG_LEDS_TIMER
53 case led_timer:
54 if (!(led_state & LED_STATE_CLAIMED))
55 hw_led_state ^= LED_D0;
56 break;
57#endif
58
59#ifdef CONFIG_LEDS_CPU
60 case led_idle_start:
61 if (!(led_state & LED_STATE_CLAIMED))
62 hw_led_state &= ~LED_D1;
63 break;
64
65 case led_idle_end:
66 if (!(led_state & LED_STATE_CLAIMED))
67 hw_led_state |= LED_D1;
68 break;
69#endif
70 case led_green_on:
71 if (!(led_state & LED_STATE_CLAIMED))
72 hw_led_state &= ~LED_D2;
73 break;
74
75 case led_green_off:
76 if (!(led_state & LED_STATE_CLAIMED))
77 hw_led_state |= LED_D2;
78 break;
79
80 case led_amber_on:
81 if (!(led_state & LED_STATE_CLAIMED))
82 hw_led_state &= ~LED_D3;
83 break;
84
85 case led_amber_off:
86 if (!(led_state & LED_STATE_CLAIMED))
87 hw_led_state |= LED_D3;
88 break;
89
90 case led_red_on:
91 if (!(led_state & LED_STATE_CLAIMED))
92 hw_led_state &= ~LED_D1;
93 break;
94
95 case led_red_off:
96 if (!(led_state & LED_STATE_CLAIMED))
97 hw_led_state |= LED_D1;
98 break;
99
100 default:
101 break;
102 }
103
104 if (led_state & LED_STATE_ENABLED) {
105 GPSR = hw_led_state;
106 GPCR = hw_led_state ^ LED_MASK;
107 }
108
109 local_irq_restore(flags);
110}
diff --git a/arch/arm/mach-sa1100/leds-hackkit.c b/arch/arm/mach-sa1100/leds-hackkit.c
deleted file mode 100644
index f8e47235babe..000000000000
--- a/arch/arm/mach-sa1100/leds-hackkit.c
+++ /dev/null
@@ -1,112 +0,0 @@
1/*
2 * linux/arch/arm/mach-sa1100/leds-hackkit.c
3 *
4 * based on leds-lart.c
5 *
6 * (C) Erik Mouw (J.A.K.Mouw@its.tudelft.nl), April 21, 2000
7 * (C) Stefan Eletzhofer <stefan.eletzhofer@eletztrick.de>, 2002
8 *
9 * The HackKit has two leds (GPIO 22/23). The red led (gpio 22) is used
10 * as cpu led, the green one is used as timer led.
11 */
12#include <linux/init.h>
13#include <linux/io.h>
14
15#include <mach/hardware.h>
16#include <asm/leds.h>
17
18#include "leds.h"
19
20
21#define LED_STATE_ENABLED 1
22#define LED_STATE_CLAIMED 2
23
24static unsigned int led_state;
25static unsigned int hw_led_state;
26
27#define LED_GREEN GPIO_GPIO23
28#define LED_RED GPIO_GPIO22
29#define LED_MASK (LED_RED | LED_GREEN)
30
31void hackkit_leds_event(led_event_t evt)
32{
33 unsigned long flags;
34
35 local_irq_save(flags);
36
37 switch(evt) {
38 case led_start:
39 /* pin 22/23 are outputs */
40 GPDR |= LED_MASK;
41 hw_led_state = LED_MASK;
42 led_state = LED_STATE_ENABLED;
43 break;
44
45 case led_stop:
46 led_state &= ~LED_STATE_ENABLED;
47 break;
48
49 case led_claim:
50 led_state |= LED_STATE_CLAIMED;
51 hw_led_state = LED_MASK;
52 break;
53
54 case led_release:
55 led_state &= ~LED_STATE_CLAIMED;
56 hw_led_state = LED_MASK;
57 break;
58
59#ifdef CONFIG_LEDS_TIMER
60 case led_timer:
61 if (!(led_state & LED_STATE_CLAIMED))
62 hw_led_state ^= LED_GREEN;
63 break;
64#endif
65
66#ifdef CONFIG_LEDS_CPU
67 case led_idle_start:
68 /* The LART people like the LED to be off when the
69 system is idle... */
70 if (!(led_state & LED_STATE_CLAIMED))
71 hw_led_state &= ~LED_RED;
72 break;
73
74 case led_idle_end:
75 /* ... and on if the system is not idle */
76 if (!(led_state & LED_STATE_CLAIMED))
77 hw_led_state |= LED_RED;
78 break;
79#endif
80
81 case led_red_on:
82 if (led_state & LED_STATE_CLAIMED)
83 hw_led_state &= ~LED_RED;
84 break;
85
86 case led_red_off:
87 if (led_state & LED_STATE_CLAIMED)
88 hw_led_state |= LED_RED;
89 break;
90
91 case led_green_on:
92 if (led_state & LED_STATE_CLAIMED)
93 hw_led_state &= ~LED_GREEN;
94 break;
95
96 case led_green_off:
97 if (led_state & LED_STATE_CLAIMED)
98 hw_led_state |= LED_GREEN;
99 break;
100
101 default:
102 break;
103 }
104
105 /* Now set the GPIO state, or nothing will happen at all */
106 if (led_state & LED_STATE_ENABLED) {
107 GPSR = hw_led_state;
108 GPCR = hw_led_state ^ LED_MASK;
109 }
110
111 local_irq_restore(flags);
112}
diff --git a/arch/arm/mach-sa1100/leds-lart.c b/arch/arm/mach-sa1100/leds-lart.c
deleted file mode 100644
index 50a5b143b460..000000000000
--- a/arch/arm/mach-sa1100/leds-lart.c
+++ /dev/null
@@ -1,101 +0,0 @@
1/*
2 * linux/arch/arm/mach-sa1100/leds-lart.c
3 *
4 * (C) Erik Mouw (J.A.K.Mouw@its.tudelft.nl), April 21, 2000
5 *
6 * LART uses the LED as follows:
7 * - GPIO23 is the LED, on if system is not idle
8 * You can use both CONFIG_LEDS_CPU and CONFIG_LEDS_TIMER at the same
9 * time, but in that case the timer events will still dictate the
10 * pace of the LED.
11 */
12#include <linux/init.h>
13#include <linux/io.h>
14
15#include <mach/hardware.h>
16#include <asm/leds.h>
17
18#include "leds.h"
19
20
21#define LED_STATE_ENABLED 1
22#define LED_STATE_CLAIMED 2
23
24static unsigned int led_state;
25static unsigned int hw_led_state;
26
27#define LED_23 GPIO_GPIO23
28#define LED_MASK (LED_23)
29
30void lart_leds_event(led_event_t evt)
31{
32 unsigned long flags;
33
34 local_irq_save(flags);
35
36 switch(evt) {
37 case led_start:
38 /* pin 23 is output pin */
39 GPDR |= LED_23;
40 hw_led_state = LED_MASK;
41 led_state = LED_STATE_ENABLED;
42 break;
43
44 case led_stop:
45 led_state &= ~LED_STATE_ENABLED;
46 break;
47
48 case led_claim:
49 led_state |= LED_STATE_CLAIMED;
50 hw_led_state = LED_MASK;
51 break;
52
53 case led_release:
54 led_state &= ~LED_STATE_CLAIMED;
55 hw_led_state = LED_MASK;
56 break;
57
58#ifdef CONFIG_LEDS_TIMER
59 case led_timer:
60 if (!(led_state & LED_STATE_CLAIMED))
61 hw_led_state ^= LED_23;
62 break;
63#endif
64
65#ifdef CONFIG_LEDS_CPU
66 case led_idle_start:
67 /* The LART people like the LED to be off when the
68 system is idle... */
69 if (!(led_state & LED_STATE_CLAIMED))
70 hw_led_state &= ~LED_23;
71 break;
72
73 case led_idle_end:
74 /* ... and on if the system is not idle */
75 if (!(led_state & LED_STATE_CLAIMED))
76 hw_led_state |= LED_23;
77 break;
78#endif
79
80 case led_red_on:
81 if (led_state & LED_STATE_CLAIMED)
82 hw_led_state &= ~LED_23;
83 break;
84
85 case led_red_off:
86 if (led_state & LED_STATE_CLAIMED)
87 hw_led_state |= LED_23;
88 break;
89
90 default:
91 break;
92 }
93
94 /* Now set the GPIO state, or nothing will happen at all */
95 if (led_state & LED_STATE_ENABLED) {
96 GPSR = hw_led_state;
97 GPCR = hw_led_state ^ LED_MASK;
98 }
99
100 local_irq_restore(flags);
101}
diff --git a/arch/arm/mach-sa1100/leds.c b/arch/arm/mach-sa1100/leds.c
deleted file mode 100644
index 5fe71a0f1053..000000000000
--- a/arch/arm/mach-sa1100/leds.c
+++ /dev/null
@@ -1,50 +0,0 @@
1/*
2 * linux/arch/arm/mach-sa1100/leds.c
3 *
4 * SA1100 LEDs dispatcher
5 *
6 * Copyright (C) 2001 Nicolas Pitre
7 */
8#include <linux/compiler.h>
9#include <linux/init.h>
10
11#include <asm/leds.h>
12#include <asm/mach-types.h>
13
14#include "leds.h"
15
16static int __init
17sa1100_leds_init(void)
18{
19 if (machine_is_assabet())
20 leds_event = assabet_leds_event;
21 if (machine_is_consus())
22 leds_event = consus_leds_event;
23 if (machine_is_badge4())
24 leds_event = badge4_leds_event;
25 if (machine_is_brutus())
26 leds_event = brutus_leds_event;
27 if (machine_is_cerf())
28 leds_event = cerf_leds_event;
29 if (machine_is_flexanet())
30 leds_event = flexanet_leds_event;
31 if (machine_is_graphicsclient())
32 leds_event = graphicsclient_leds_event;
33 if (machine_is_hackkit())
34 leds_event = hackkit_leds_event;
35 if (machine_is_lart())
36 leds_event = lart_leds_event;
37 if (machine_is_pfs168())
38 leds_event = pfs168_leds_event;
39 if (machine_is_graphicsmaster())
40 leds_event = graphicsmaster_leds_event;
41 if (machine_is_adsbitsy())
42 leds_event = adsbitsy_leds_event;
43 if (machine_is_pt_system3())
44 leds_event = system3_leds_event;
45
46 leds_event(led_start);
47 return 0;
48}
49
50core_initcall(sa1100_leds_init);
diff --git a/arch/arm/mach-sa1100/leds.h b/arch/arm/mach-sa1100/leds.h
deleted file mode 100644
index 776b6020f550..000000000000
--- a/arch/arm/mach-sa1100/leds.h
+++ /dev/null
@@ -1,13 +0,0 @@
1extern void assabet_leds_event(led_event_t evt);
2extern void badge4_leds_event(led_event_t evt);
3extern void consus_leds_event(led_event_t evt);
4extern void brutus_leds_event(led_event_t evt);
5extern void cerf_leds_event(led_event_t evt);
6extern void flexanet_leds_event(led_event_t evt);
7extern void graphicsclient_leds_event(led_event_t evt);
8extern void hackkit_leds_event(led_event_t evt);
9extern void lart_leds_event(led_event_t evt);
10extern void pfs168_leds_event(led_event_t evt);
11extern void graphicsmaster_leds_event(led_event_t evt);
12extern void adsbitsy_leds_event(led_event_t evt);
13extern void system3_leds_event(led_event_t evt);
diff --git a/arch/arm/mach-shark/Makefile b/arch/arm/mach-shark/Makefile
index 45be9b04e7ba..29657183c452 100644
--- a/arch/arm/mach-shark/Makefile
+++ b/arch/arm/mach-shark/Makefile
@@ -4,9 +4,7 @@
4 4
5# Object file lists. 5# Object file lists.
6 6
7obj-y := core.o dma.o irq.o pci.o 7obj-y := core.o dma.o irq.o pci.o leds.o
8obj-m := 8obj-m :=
9obj-n := 9obj-n :=
10obj- := 10obj- :=
11
12obj-$(CONFIG_LEDS) += leds.o
diff --git a/arch/arm/mach-shark/core.c b/arch/arm/mach-shark/core.c
index d35b94ef73b7..9ad2e9737fb5 100644
--- a/arch/arm/mach-shark/core.c
+++ b/arch/arm/mach-shark/core.c
@@ -13,7 +13,6 @@
13 13
14#include <asm/setup.h> 14#include <asm/setup.h>
15#include <asm/mach-types.h> 15#include <asm/mach-types.h>
16#include <asm/leds.h>
17#include <asm/param.h> 16#include <asm/param.h>
18#include <asm/system_misc.h> 17#include <asm/system_misc.h>
19 18
diff --git a/arch/arm/mach-shark/leds.c b/arch/arm/mach-shark/leds.c
index 25609076921f..081c778a10ac 100644
--- a/arch/arm/mach-shark/leds.c
+++ b/arch/arm/mach-shark/leds.c
@@ -1,165 +1,117 @@
1/* 1/*
2 * arch/arm/mach-shark/leds.c
3 * by Alexander Schulz
4 *
5 * derived from:
6 * arch/arm/kernel/leds-footbridge.c
7 * Copyright (C) 1998-1999 Russell King
8 *
9 * DIGITAL Shark LED control routines. 2 * DIGITAL Shark LED control routines.
10 * 3 *
11 * The leds use is as follows: 4 * Driver for the 3 user LEDs found on the Shark
12 * - Green front - toggles state every 50 timer interrupts 5 * Based on Versatile and RealView machine LED code
13 * - Amber front - Unused, this is a dual color led (Amber/Green)
14 * - Amber back - On if system is not idle
15 * 6 *
16 * Changelog: 7 * License terms: GNU General Public License (GPL) version 2
8 * Author: Bryan Wu <bryan.wu@canonical.com>
17 */ 9 */
18#include <linux/kernel.h> 10#include <linux/kernel.h>
19#include <linux/module.h>
20#include <linux/init.h> 11#include <linux/init.h>
21#include <linux/spinlock.h>
22#include <linux/ioport.h>
23#include <linux/io.h> 12#include <linux/io.h>
13#include <linux/ioport.h>
14#include <linux/slab.h>
15#include <linux/leds.h>
24 16
25#include <asm/leds.h> 17#include <asm/mach-types.h>
26 18
27#define LED_STATE_ENABLED 1 19#if defined(CONFIG_NEW_LEDS) && defined(CONFIG_LEDS_CLASS)
28#define LED_STATE_CLAIMED 2 20struct shark_led {
21 struct led_classdev cdev;
22 u8 mask;
23};
29 24
30#define SEQUOIA_LED_GREEN (1<<6) 25/*
31#define SEQUOIA_LED_AMBER (1<<5) 26 * The triggers lines up below will only be used if the
32#define SEQUOIA_LED_BACK (1<<7) 27 * LED triggers are compiled in.
28 */
29static const struct {
30 const char *name;
31 const char *trigger;
32} shark_leds[] = {
33 { "shark:amber0", "default-on", }, /* Bit 5 */
34 { "shark:green", "heartbeat", }, /* Bit 6 */
35 { "shark:amber1", "cpu0" }, /* Bit 7 */
36};
37
38static u16 led_reg_read(void)
39{
40 outw(0x09, 0x24);
41 return inw(0x26);
42}
33 43
34static char led_state; 44static void led_reg_write(u16 value)
35static short hw_led_state; 45{
36static short saved_state; 46 outw(0x09, 0x24);
47 outw(value, 0x26);
48}
37 49
38static DEFINE_RAW_SPINLOCK(leds_lock); 50static void shark_led_set(struct led_classdev *cdev,
51 enum led_brightness b)
52{
53 struct shark_led *led = container_of(cdev,
54 struct shark_led, cdev);
55 u16 reg = led_reg_read();
39 56
40short sequoia_read(int addr) { 57 if (b != LED_OFF)
41 outw(addr,0x24); 58 reg |= led->mask;
42 return inw(0x26); 59 else
43} 60 reg &= ~led->mask;
44 61
45void sequoia_write(short value,short addr) { 62 led_reg_write(reg);
46 outw(addr,0x24);
47 outw(value,0x26);
48} 63}
49 64
50static void sequoia_leds_event(led_event_t evt) 65static enum led_brightness shark_led_get(struct led_classdev *cdev)
51{ 66{
52 unsigned long flags; 67 struct shark_led *led = container_of(cdev,
53 68 struct shark_led, cdev);
54 raw_spin_lock_irqsave(&leds_lock, flags); 69 u16 reg = led_reg_read();
55 70
56 hw_led_state = sequoia_read(0x09); 71 return (reg & led->mask) ? LED_FULL : LED_OFF;
72}
57 73
58 switch (evt) { 74static int __init shark_leds_init(void)
59 case led_start: 75{
60 hw_led_state |= SEQUOIA_LED_GREEN; 76 int i;
61 hw_led_state |= SEQUOIA_LED_AMBER; 77 u16 reg;
62#ifdef CONFIG_LEDS_CPU
63 hw_led_state |= SEQUOIA_LED_BACK;
64#else
65 hw_led_state &= ~SEQUOIA_LED_BACK;
66#endif
67 led_state |= LED_STATE_ENABLED;
68 break;
69
70 case led_stop:
71 hw_led_state &= ~SEQUOIA_LED_BACK;
72 hw_led_state |= SEQUOIA_LED_GREEN;
73 hw_led_state |= SEQUOIA_LED_AMBER;
74 led_state &= ~LED_STATE_ENABLED;
75 break;
76
77 case led_claim:
78 led_state |= LED_STATE_CLAIMED;
79 saved_state = hw_led_state;
80 hw_led_state &= ~SEQUOIA_LED_BACK;
81 hw_led_state |= SEQUOIA_LED_GREEN;
82 hw_led_state |= SEQUOIA_LED_AMBER;
83 break;
84
85 case led_release:
86 led_state &= ~LED_STATE_CLAIMED;
87 hw_led_state = saved_state;
88 break;
89
90#ifdef CONFIG_LEDS_TIMER
91 case led_timer:
92 if (!(led_state & LED_STATE_CLAIMED))
93 hw_led_state ^= SEQUOIA_LED_GREEN;
94 break;
95#endif
96 78
97#ifdef CONFIG_LEDS_CPU 79 if (!machine_is_shark())
98 case led_idle_start: 80 return -ENODEV;
99 if (!(led_state & LED_STATE_CLAIMED))
100 hw_led_state &= ~SEQUOIA_LED_BACK;
101 break;
102 81
103 case led_idle_end: 82 for (i = 0; i < ARRAY_SIZE(shark_leds); i++) {
104 if (!(led_state & LED_STATE_CLAIMED)) 83 struct shark_led *led;
105 hw_led_state |= SEQUOIA_LED_BACK;
106 break;
107#endif
108 84
109 case led_green_on: 85 led = kzalloc(sizeof(*led), GFP_KERNEL);
110 if (led_state & LED_STATE_CLAIMED) 86 if (!led)
111 hw_led_state &= ~SEQUOIA_LED_GREEN; 87 break;
112 break;
113
114 case led_green_off:
115 if (led_state & LED_STATE_CLAIMED)
116 hw_led_state |= SEQUOIA_LED_GREEN;
117 break;
118
119 case led_amber_on:
120 if (led_state & LED_STATE_CLAIMED)
121 hw_led_state &= ~SEQUOIA_LED_AMBER;
122 break;
123
124 case led_amber_off:
125 if (led_state & LED_STATE_CLAIMED)
126 hw_led_state |= SEQUOIA_LED_AMBER;
127 break;
128
129 case led_red_on:
130 if (led_state & LED_STATE_CLAIMED)
131 hw_led_state |= SEQUOIA_LED_BACK;
132 break;
133
134 case led_red_off:
135 if (led_state & LED_STATE_CLAIMED)
136 hw_led_state &= ~SEQUOIA_LED_BACK;
137 break;
138
139 default:
140 break;
141 }
142 88
143 if (led_state & LED_STATE_ENABLED) 89 led->cdev.name = shark_leds[i].name;
144 sequoia_write(hw_led_state,0x09); 90 led->cdev.brightness_set = shark_led_set;
91 led->cdev.brightness_get = shark_led_get;
92 led->cdev.default_trigger = shark_leds[i].trigger;
145 93
146 raw_spin_unlock_irqrestore(&leds_lock, flags); 94 /* Count in 5 bits offset */
147} 95 led->mask = BIT(i + 5);
148 96
149static int __init leds_init(void) 97 if (led_classdev_register(NULL, &led->cdev) < 0) {
150{ 98 kfree(led);
151 extern void (*leds_event)(led_event_t); 99 break;
152 short temp; 100 }
153 101 }
154 leds_event = sequoia_leds_event;
155 102
156 /* Make LEDs independent of power-state */ 103 /* Make LEDs independent of power-state */
157 request_region(0x24,4,"sequoia"); 104 request_region(0x24, 4, "led_reg");
158 temp = sequoia_read(0x09); 105 reg = led_reg_read();
159 temp |= 1<<10; 106 reg |= 1 << 10;
160 sequoia_write(temp,0x09); 107 led_reg_write(reg);
161 leds_event(led_start); 108
162 return 0; 109 return 0;
163} 110}
164 111
165__initcall(leds_init); 112/*
113 * Since we may have triggers on any subsystem, defer registration
114 * until after subsystem_init.
115 */
116fs_initcall(shark_leds_init);
117#endif
diff --git a/arch/arm/mach-tegra/tegra20_clocks_data.c b/arch/arm/mach-tegra/tegra20_clocks_data.c
index c8a7b951f759..cc9b5fd8c3d3 100644
--- a/arch/arm/mach-tegra/tegra20_clocks_data.c
+++ b/arch/arm/mach-tegra/tegra20_clocks_data.c
@@ -917,14 +917,10 @@ PERIPH_CLK(la, "la", NULL, 76, 0x1f8, 26000000, mux_pllp_pllc_pllm_clkm, MUX
917PERIPH_CLK(owr, "tegra_w1", NULL, 71, 0x1cc, 26000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71); 917PERIPH_CLK(owr, "tegra_w1", NULL, 71, 0x1cc, 26000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71);
918PERIPH_CLK(nor, "nor", NULL, 42, 0x1d0, 92000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71); /* requires min voltage */ 918PERIPH_CLK(nor, "nor", NULL, 42, 0x1d0, 92000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71); /* requires min voltage */
919PERIPH_CLK(mipi, "mipi", NULL, 50, 0x174, 60000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71); /* scales with voltage */ 919PERIPH_CLK(mipi, "mipi", NULL, 50, 0x174, 60000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71); /* scales with voltage */
920PERIPH_CLK(i2c1, "tegra-i2c.0", NULL, 12, 0x124, 26000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U16); 920PERIPH_CLK(i2c1, "tegra-i2c.0", "div-clk", 12, 0x124, 26000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U16);
921PERIPH_CLK(i2c2, "tegra-i2c.1", NULL, 54, 0x198, 26000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U16); 921PERIPH_CLK(i2c2, "tegra-i2c.1", "div-clk", 54, 0x198, 26000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U16);
922PERIPH_CLK(i2c3, "tegra-i2c.2", NULL, 67, 0x1b8, 26000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U16); 922PERIPH_CLK(i2c3, "tegra-i2c.2", "div-clk", 67, 0x1b8, 26000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U16);
923PERIPH_CLK(dvc, "tegra-i2c.3", NULL, 47, 0x128, 26000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U16); 923PERIPH_CLK(dvc, "tegra-i2c.3", "div-clk", 47, 0x128, 26000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U16);
924PERIPH_CLK(i2c1_i2c, "tegra-i2c.0", "i2c", 0, 0, 72000000, mux_pllp_out3, 0);
925PERIPH_CLK(i2c2_i2c, "tegra-i2c.1", "i2c", 0, 0, 72000000, mux_pllp_out3, 0);
926PERIPH_CLK(i2c3_i2c, "tegra-i2c.2", "i2c", 0, 0, 72000000, mux_pllp_out3, 0);
927PERIPH_CLK(dvc_i2c, "tegra-i2c.3", "i2c", 0, 0, 72000000, mux_pllp_out3, 0);
928PERIPH_CLK(uarta, "tegra-uart.0", NULL, 6, 0x178, 600000000, mux_pllp_pllc_pllm_clkm, MUX); 924PERIPH_CLK(uarta, "tegra-uart.0", NULL, 6, 0x178, 600000000, mux_pllp_pllc_pllm_clkm, MUX);
929PERIPH_CLK(uartb, "tegra-uart.1", NULL, 7, 0x17c, 600000000, mux_pllp_pllc_pllm_clkm, MUX); 925PERIPH_CLK(uartb, "tegra-uart.1", NULL, 7, 0x17c, 600000000, mux_pllp_pllc_pllm_clkm, MUX);
930PERIPH_CLK(uartc, "tegra-uart.2", NULL, 55, 0x1a0, 600000000, mux_pllp_pllc_pllm_clkm, MUX); 926PERIPH_CLK(uartc, "tegra-uart.2", NULL, 55, 0x1a0, 600000000, mux_pllp_pllc_pllm_clkm, MUX);
@@ -989,10 +985,6 @@ static struct clk *tegra_list_clks[] = {
989 &tegra_i2c2, 985 &tegra_i2c2,
990 &tegra_i2c3, 986 &tegra_i2c3,
991 &tegra_dvc, 987 &tegra_dvc,
992 &tegra_i2c1_i2c,
993 &tegra_i2c2_i2c,
994 &tegra_i2c3_i2c,
995 &tegra_dvc_i2c,
996 &tegra_uarta, 988 &tegra_uarta,
997 &tegra_uartb, 989 &tegra_uartb,
998 &tegra_uartc, 990 &tegra_uartc,
@@ -1056,6 +1048,10 @@ static struct clk_duplicate tegra_clk_duplicates[] = {
1056 CLK_DUPLICATE("vde", "tegra-aes", "vde"), 1048 CLK_DUPLICATE("vde", "tegra-aes", "vde"),
1057 CLK_DUPLICATE("cclk", NULL, "cpu"), 1049 CLK_DUPLICATE("cclk", NULL, "cpu"),
1058 CLK_DUPLICATE("twd", "smp_twd", NULL), 1050 CLK_DUPLICATE("twd", "smp_twd", NULL),
1051 CLK_DUPLICATE("pll_p_out3", "tegra-i2c.0", "fast-clk"),
1052 CLK_DUPLICATE("pll_p_out3", "tegra-i2c.1", "fast-clk"),
1053 CLK_DUPLICATE("pll_p_out3", "tegra-i2c.2", "fast-clk"),
1054 CLK_DUPLICATE("pll_p_out3", "tegra-i2c.3", "fast-clk"),
1059}; 1055};
1060 1056
1061#define CLK(dev, con, ck) \ 1057#define CLK(dev, con, ck) \
diff --git a/arch/arm/mach-tegra/tegra30_clocks_data.c b/arch/arm/mach-tegra/tegra30_clocks_data.c
index c10449603df0..d92cb556ae35 100644
--- a/arch/arm/mach-tegra/tegra30_clocks_data.c
+++ b/arch/arm/mach-tegra/tegra30_clocks_data.c
@@ -1071,11 +1071,11 @@ PERIPH_CLK(la, "la", NULL, 76, 0x1f8, 26000000, mux_pllp_pllc_pllm_clkm, MUX
1071PERIPH_CLK(owr, "tegra_w1", NULL, 71, 0x1cc, 26000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | PERIPH_ON_APB); 1071PERIPH_CLK(owr, "tegra_w1", NULL, 71, 0x1cc, 26000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | PERIPH_ON_APB);
1072PERIPH_CLK(nor, "nor", NULL, 42, 0x1d0, 127000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71); /* requires min voltage */ 1072PERIPH_CLK(nor, "nor", NULL, 42, 0x1d0, 127000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71); /* requires min voltage */
1073PERIPH_CLK(mipi, "mipi", NULL, 50, 0x174, 60000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | PERIPH_ON_APB); /* scales with voltage */ 1073PERIPH_CLK(mipi, "mipi", NULL, 50, 0x174, 60000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | PERIPH_ON_APB); /* scales with voltage */
1074PERIPH_CLK(i2c1, "tegra-i2c.0", NULL, 12, 0x124, 26000000, mux_pllp_clkm, MUX | DIV_U16 | PERIPH_ON_APB); 1074PERIPH_CLK(i2c1, "tegra-i2c.0", "div-clk", 12, 0x124, 26000000, mux_pllp_clkm, MUX | DIV_U16 | PERIPH_ON_APB);
1075PERIPH_CLK(i2c2, "tegra-i2c.1", NULL, 54, 0x198, 26000000, mux_pllp_clkm, MUX | DIV_U16 | PERIPH_ON_APB); 1075PERIPH_CLK(i2c2, "tegra-i2c.1", "div-clk", 54, 0x198, 26000000, mux_pllp_clkm, MUX | DIV_U16 | PERIPH_ON_APB);
1076PERIPH_CLK(i2c3, "tegra-i2c.2", NULL, 67, 0x1b8, 26000000, mux_pllp_clkm, MUX | DIV_U16 | PERIPH_ON_APB); 1076PERIPH_CLK(i2c3, "tegra-i2c.2", "div-clk", 67, 0x1b8, 26000000, mux_pllp_clkm, MUX | DIV_U16 | PERIPH_ON_APB);
1077PERIPH_CLK(i2c4, "tegra-i2c.3", NULL, 103, 0x3c4, 26000000, mux_pllp_clkm, MUX | DIV_U16 | PERIPH_ON_APB); 1077PERIPH_CLK(i2c4, "tegra-i2c.3", "div-clk", 103, 0x3c4, 26000000, mux_pllp_clkm, MUX | DIV_U16 | PERIPH_ON_APB);
1078PERIPH_CLK(i2c5, "tegra-i2c.4", NULL, 47, 0x128, 26000000, mux_pllp_clkm, MUX | DIV_U16 | PERIPH_ON_APB); 1078PERIPH_CLK(i2c5, "tegra-i2c.4", "div-clk", 47, 0x128, 26000000, mux_pllp_clkm, MUX | DIV_U16 | PERIPH_ON_APB);
1079PERIPH_CLK(uarta, "tegra-uart.0", NULL, 6, 0x178, 800000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | DIV_U71_UART | PERIPH_ON_APB); 1079PERIPH_CLK(uarta, "tegra-uart.0", NULL, 6, 0x178, 800000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | DIV_U71_UART | PERIPH_ON_APB);
1080PERIPH_CLK(uartb, "tegra-uart.1", NULL, 7, 0x17c, 800000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | DIV_U71_UART | PERIPH_ON_APB); 1080PERIPH_CLK(uartb, "tegra-uart.1", NULL, 7, 0x17c, 800000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | DIV_U71_UART | PERIPH_ON_APB);
1081PERIPH_CLK(uartc, "tegra-uart.2", NULL, 55, 0x1a0, 800000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | DIV_U71_UART | PERIPH_ON_APB); 1081PERIPH_CLK(uartc, "tegra-uart.2", NULL, 55, 0x1a0, 800000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | DIV_U71_UART | PERIPH_ON_APB);
@@ -1287,6 +1287,11 @@ struct clk_duplicate tegra_clk_duplicates[] = {
1287 CLK_DUPLICATE("dam1", NULL, "dam1"), 1287 CLK_DUPLICATE("dam1", NULL, "dam1"),
1288 CLK_DUPLICATE("dam2", NULL, "dam2"), 1288 CLK_DUPLICATE("dam2", NULL, "dam2"),
1289 CLK_DUPLICATE("spdif_in", NULL, "spdif_in"), 1289 CLK_DUPLICATE("spdif_in", NULL, "spdif_in"),
1290 CLK_DUPLICATE("pll_p_out3", "tegra-i2c.0", "fast-clk"),
1291 CLK_DUPLICATE("pll_p_out3", "tegra-i2c.1", "fast-clk"),
1292 CLK_DUPLICATE("pll_p_out3", "tegra-i2c.2", "fast-clk"),
1293 CLK_DUPLICATE("pll_p_out3", "tegra-i2c.3", "fast-clk"),
1294 CLK_DUPLICATE("pll_p_out3", "tegra-i2c.4", "fast-clk"),
1290}; 1295};
1291 1296
1292struct clk *tegra_ptr_clks[] = { 1297struct clk *tegra_ptr_clks[] = {
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c
index ca7902c6ed18..5b5c1eeb5b5c 100644
--- a/arch/arm/mach-versatile/core.c
+++ b/arch/arm/mach-versatile/core.c
@@ -37,7 +37,6 @@
37#include <linux/mtd/physmap.h> 37#include <linux/mtd/physmap.h>
38 38
39#include <asm/irq.h> 39#include <asm/irq.h>
40#include <asm/leds.h>
41#include <asm/hardware/arm_timer.h> 40#include <asm/hardware/arm_timer.h>
42#include <asm/hardware/icst.h> 41#include <asm/hardware/icst.h>
43#include <asm/hardware/vic.h> 42#include <asm/hardware/vic.h>
@@ -758,10 +757,6 @@ void __init versatile_init(void)
758 struct amba_device *d = amba_devs[i]; 757 struct amba_device *d = amba_devs[i];
759 amba_device_register(d, &iomem_resource); 758 amba_device_register(d, &iomem_resource);
760 } 759 }
761
762#ifdef CONFIG_LEDS
763 leds_event = versatile_leds_event;
764#endif
765} 760}
766 761
767/* 762/*
diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig
index d15a4a6d6146..ca83a7659aef 100644
--- a/arch/arm/plat-omap/Kconfig
+++ b/arch/arm/plat-omap/Kconfig
@@ -42,9 +42,8 @@ config OMAP_DEBUG_DEVICES
42 For debug cards on TI reference boards. 42 For debug cards on TI reference boards.
43 43
44config OMAP_DEBUG_LEDS 44config OMAP_DEBUG_LEDS
45 bool 45 def_bool y if NEW_LEDS
46 depends on OMAP_DEBUG_DEVICES 46 depends on OMAP_DEBUG_DEVICES
47 default y if LEDS_CLASS
48 47
49config POWER_AVS_OMAP 48config POWER_AVS_OMAP
50 bool "AVS(Adaptive Voltage Scaling) support for OMAP IP versions 1&2" 49 bool "AVS(Adaptive Voltage Scaling) support for OMAP IP versions 1&2"
diff --git a/arch/arm/plat-omap/debug-leds.c b/arch/arm/plat-omap/debug-leds.c
index 195aaae65872..ea29bbe8e5cf 100644
--- a/arch/arm/plat-omap/debug-leds.c
+++ b/arch/arm/plat-omap/debug-leds.c
@@ -1,280 +1,119 @@
1/* 1/*
2 * linux/arch/arm/plat-omap/debug-leds.c 2 * linux/arch/arm/plat-omap/debug-leds.c
3 * 3 *
4 * Copyright 2011 by Bryan Wu <bryan.wu@canonical.com>
4 * Copyright 2003 by Texas Instruments Incorporated 5 * Copyright 2003 by Texas Instruments Incorporated
5 * 6 *
6 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as 8 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation. 9 * published by the Free Software Foundation.
9 */ 10 */
10#include <linux/gpio.h> 11
12#include <linux/kernel.h>
11#include <linux/init.h> 13#include <linux/init.h>
12#include <linux/platform_device.h> 14#include <linux/platform_device.h>
13#include <linux/leds.h> 15#include <linux/leds.h>
14#include <linux/io.h> 16#include <linux/io.h>
15#include <linux/platform_data/gpio-omap.h> 17#include <linux/platform_data/gpio-omap.h>
18#include <linux/slab.h>
16 19
17#include <mach/hardware.h> 20#include <mach/hardware.h>
18#include <asm/leds.h>
19#include <asm/mach-types.h> 21#include <asm/mach-types.h>
20 22
21#include <plat/fpga.h> 23#include <plat/fpga.h>
22 24
23
24/* Many OMAP development platforms reuse the same "debug board"; these 25/* Many OMAP development platforms reuse the same "debug board"; these
25 * platforms include H2, H3, H4, and Perseus2. There are 16 LEDs on the 26 * platforms include H2, H3, H4, and Perseus2. There are 16 LEDs on the
26 * debug board (all green), accessed through FPGA registers. 27 * debug board (all green), accessed through FPGA registers.
27 *
28 * The "surfer" expansion board and H2 sample board also have two-color
29 * green+red LEDs (in parallel), used here for timer and idle indicators
30 * in preference to the ones on the debug board, for a "Disco LED" effect.
31 *
32 * This driver exports either the original ARM LED API, the new generic
33 * one, or both.
34 */
35
36static spinlock_t lock;
37static struct h2p2_dbg_fpga __iomem *fpga;
38static u16 led_state, hw_led_state;
39
40
41#ifdef CONFIG_OMAP_DEBUG_LEDS
42#define new_led_api() 1
43#else
44#define new_led_api() 0
45#endif
46
47
48/*-------------------------------------------------------------------------*/
49
50/* original ARM debug LED API:
51 * - timer and idle leds (some boards use non-FPGA leds here);
52 * - up to 4 generic leds, easily accessed in-kernel (any context)
53 */ 28 */
54 29
55#define GPIO_LED_RED 3 30static struct h2p2_dbg_fpga __iomem *fpga;
56#define GPIO_LED_GREEN OMAP_MPUIO(4)
57
58#define LED_STATE_ENABLED 0x01
59#define LED_STATE_CLAIMED 0x02
60#define LED_TIMER_ON 0x04
61
62#define GPIO_IDLE GPIO_LED_GREEN
63#define GPIO_TIMER GPIO_LED_RED
64
65static void h2p2_dbg_leds_event(led_event_t evt)
66{
67 unsigned long flags;
68
69 spin_lock_irqsave(&lock, flags);
70
71 if (!(led_state & LED_STATE_ENABLED) && evt != led_start)
72 goto done;
73
74 switch (evt) {
75 case led_start:
76 if (fpga)
77 led_state |= LED_STATE_ENABLED;
78 break;
79
80 case led_stop:
81 case led_halted:
82 /* all leds off during suspend or shutdown */
83
84 if (!(machine_is_omap_perseus2() || machine_is_omap_h4())) {
85 gpio_set_value(GPIO_TIMER, 0);
86 gpio_set_value(GPIO_IDLE, 0);
87 }
88
89 __raw_writew(~0, &fpga->leds);
90 led_state &= ~LED_STATE_ENABLED;
91 goto done;
92
93 case led_claim:
94 led_state |= LED_STATE_CLAIMED;
95 hw_led_state = 0;
96 break;
97
98 case led_release:
99 led_state &= ~LED_STATE_CLAIMED;
100 break;
101
102#ifdef CONFIG_LEDS_TIMER
103 case led_timer:
104 led_state ^= LED_TIMER_ON;
105
106 if (machine_is_omap_perseus2() || machine_is_omap_h4())
107 hw_led_state ^= H2P2_DBG_FPGA_P2_LED_TIMER;
108 else {
109 gpio_set_value(GPIO_TIMER,
110 led_state & LED_TIMER_ON);
111 goto done;
112 }
113
114 break;
115#endif
116
117#ifdef CONFIG_LEDS_CPU
118 /* LED lit iff busy */
119 case led_idle_start:
120 if (machine_is_omap_perseus2() || machine_is_omap_h4())
121 hw_led_state &= ~H2P2_DBG_FPGA_P2_LED_IDLE;
122 else {
123 gpio_set_value(GPIO_IDLE, 1);
124 goto done;
125 }
126
127 break;
128 31
129 case led_idle_end: 32static u16 fpga_led_state;
130 if (machine_is_omap_perseus2() || machine_is_omap_h4())
131 hw_led_state |= H2P2_DBG_FPGA_P2_LED_IDLE;
132 else {
133 gpio_set_value(GPIO_IDLE, 0);
134 goto done;
135 }
136
137 break;
138#endif
139
140 case led_green_on:
141 hw_led_state |= H2P2_DBG_FPGA_LED_GREEN;
142 break;
143 case led_green_off:
144 hw_led_state &= ~H2P2_DBG_FPGA_LED_GREEN;
145 break;
146
147 case led_amber_on:
148 hw_led_state |= H2P2_DBG_FPGA_LED_AMBER;
149 break;
150 case led_amber_off:
151 hw_led_state &= ~H2P2_DBG_FPGA_LED_AMBER;
152 break;
153
154 case led_red_on:
155 hw_led_state |= H2P2_DBG_FPGA_LED_RED;
156 break;
157 case led_red_off:
158 hw_led_state &= ~H2P2_DBG_FPGA_LED_RED;
159 break;
160
161 case led_blue_on:
162 hw_led_state |= H2P2_DBG_FPGA_LED_BLUE;
163 break;
164 case led_blue_off:
165 hw_led_state &= ~H2P2_DBG_FPGA_LED_BLUE;
166 break;
167
168 default:
169 break;
170 }
171
172
173 /*
174 * Actually burn the LEDs
175 */
176 if (led_state & LED_STATE_ENABLED)
177 __raw_writew(~hw_led_state, &fpga->leds);
178
179done:
180 spin_unlock_irqrestore(&lock, flags);
181}
182
183/*-------------------------------------------------------------------------*/
184
185/* "new" LED API
186 * - with syfs access and generic triggering
187 * - not readily accessible to in-kernel drivers
188 */
189 33
190struct dbg_led { 34struct dbg_led {
191 struct led_classdev cdev; 35 struct led_classdev cdev;
192 u16 mask; 36 u16 mask;
193}; 37};
194 38
195static struct dbg_led dbg_leds[] = { 39static const struct {
196 /* REVISIT at least H2 uses different timer & cpu leds... */ 40 const char *name;
197#ifndef CONFIG_LEDS_TIMER 41 const char *trigger;
198 { .mask = 1 << 0, .cdev.name = "d4:green", 42} dbg_leds[] = {
199 .cdev.default_trigger = "heartbeat", }, 43 { "dbg:d4", "heartbeat", },
200#endif 44 { "dbg:d5", "cpu0", },
201#ifndef CONFIG_LEDS_CPU 45 { "dbg:d6", "default-on", },
202 { .mask = 1 << 1, .cdev.name = "d5:green", }, /* !idle */ 46 { "dbg:d7", },
203#endif 47 { "dbg:d8", },
204 { .mask = 1 << 2, .cdev.name = "d6:green", }, 48 { "dbg:d9", },
205 { .mask = 1 << 3, .cdev.name = "d7:green", }, 49 { "dbg:d10", },
206 50 { "dbg:d11", },
207 { .mask = 1 << 4, .cdev.name = "d8:green", }, 51 { "dbg:d12", },
208 { .mask = 1 << 5, .cdev.name = "d9:green", }, 52 { "dbg:d13", },
209 { .mask = 1 << 6, .cdev.name = "d10:green", }, 53 { "dbg:d14", },
210 { .mask = 1 << 7, .cdev.name = "d11:green", }, 54 { "dbg:d15", },
211 55 { "dbg:d16", },
212 { .mask = 1 << 8, .cdev.name = "d12:green", }, 56 { "dbg:d17", },
213 { .mask = 1 << 9, .cdev.name = "d13:green", }, 57 { "dbg:d18", },
214 { .mask = 1 << 10, .cdev.name = "d14:green", }, 58 { "dbg:d19", },
215 { .mask = 1 << 11, .cdev.name = "d15:green", },
216
217#ifndef CONFIG_LEDS
218 { .mask = 1 << 12, .cdev.name = "d16:green", },
219 { .mask = 1 << 13, .cdev.name = "d17:green", },
220 { .mask = 1 << 14, .cdev.name = "d18:green", },
221 { .mask = 1 << 15, .cdev.name = "d19:green", },
222#endif
223}; 59};
224 60
225static void 61/*
226fpga_led_set(struct led_classdev *cdev, enum led_brightness value) 62 * The triggers lines up below will only be used if the
63 * LED triggers are compiled in.
64 */
65static void dbg_led_set(struct led_classdev *cdev,
66 enum led_brightness b)
227{ 67{
228 struct dbg_led *led = container_of(cdev, struct dbg_led, cdev); 68 struct dbg_led *led = container_of(cdev, struct dbg_led, cdev);
229 unsigned long flags; 69 u16 reg;
230 70
231 spin_lock_irqsave(&lock, flags); 71 reg = __raw_readw(&fpga->leds);
232 if (value == LED_OFF) 72 if (b != LED_OFF)
233 hw_led_state &= ~led->mask; 73 reg |= led->mask;
234 else 74 else
235 hw_led_state |= led->mask; 75 reg &= ~led->mask;
236 __raw_writew(~hw_led_state, &fpga->leds); 76 __raw_writew(reg, &fpga->leds);
237 spin_unlock_irqrestore(&lock, flags);
238} 77}
239 78
240static void __init newled_init(struct device *dev) 79static enum led_brightness dbg_led_get(struct led_classdev *cdev)
241{ 80{
242 unsigned i; 81 struct dbg_led *led = container_of(cdev, struct dbg_led, cdev);
243 struct dbg_led *led; 82 u16 reg;
244 int status;
245 83
246 for (i = 0, led = dbg_leds; i < ARRAY_SIZE(dbg_leds); i++, led++) { 84 reg = __raw_readw(&fpga->leds);
247 led->cdev.brightness_set = fpga_led_set; 85 return (reg & led->mask) ? LED_FULL : LED_OFF;
248 status = led_classdev_register(dev, &led->cdev);
249 if (status < 0)
250 break;
251 }
252 return;
253} 86}
254 87
255 88static int fpga_probe(struct platform_device *pdev)
256/*-------------------------------------------------------------------------*/
257
258static int /* __init */ fpga_probe(struct platform_device *pdev)
259{ 89{
260 struct resource *iomem; 90 struct resource *iomem;
261 91 int i;
262 spin_lock_init(&lock);
263 92
264 iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); 93 iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
265 if (!iomem) 94 if (!iomem)
266 return -ENODEV; 95 return -ENODEV;
267 96
268 fpga = ioremap(iomem->start, H2P2_DBG_FPGA_SIZE); 97 fpga = ioremap(iomem->start, H2P2_DBG_FPGA_SIZE);
269 __raw_writew(~0, &fpga->leds); 98 __raw_writew(0xff, &fpga->leds);
99
100 for (i = 0; i < ARRAY_SIZE(dbg_leds); i++) {
101 struct dbg_led *led;
102
103 led = kzalloc(sizeof(*led), GFP_KERNEL);
104 if (!led)
105 break;
270 106
271#ifdef CONFIG_LEDS 107 led->cdev.name = dbg_leds[i].name;
272 leds_event = h2p2_dbg_leds_event; 108 led->cdev.brightness_set = dbg_led_set;
273 leds_event(led_start); 109 led->cdev.brightness_get = dbg_led_get;
274#endif 110 led->cdev.default_trigger = dbg_leds[i].trigger;
111 led->mask = BIT(i);
275 112
276 if (new_led_api()) { 113 if (led_classdev_register(NULL, &led->cdev) < 0) {
277 newled_init(&pdev->dev); 114 kfree(led);
115 break;
116 }
278 } 117 }
279 118
280 return 0; 119 return 0;
@@ -282,13 +121,15 @@ static int /* __init */ fpga_probe(struct platform_device *pdev)
282 121
283static int fpga_suspend_noirq(struct device *dev) 122static int fpga_suspend_noirq(struct device *dev)
284{ 123{
285 __raw_writew(~0, &fpga->leds); 124 fpga_led_state = __raw_readw(&fpga->leds);
125 __raw_writew(0xff, &fpga->leds);
126
286 return 0; 127 return 0;
287} 128}
288 129
289static int fpga_resume_noirq(struct device *dev) 130static int fpga_resume_noirq(struct device *dev)
290{ 131{
291 __raw_writew(~hw_led_state, &fpga->leds); 132 __raw_writew(~fpga_led_state, &fpga->leds);
292 return 0; 133 return 0;
293} 134}
294 135
diff --git a/arch/arm/plat-samsung/time.c b/arch/arm/plat-samsung/time.c
index 4dcb11c3d894..60552e22f22e 100644
--- a/arch/arm/plat-samsung/time.c
+++ b/arch/arm/plat-samsung/time.c
@@ -28,7 +28,6 @@
28#include <linux/io.h> 28#include <linux/io.h>
29#include <linux/platform_device.h> 29#include <linux/platform_device.h>
30 30
31#include <asm/leds.h>
32#include <asm/mach-types.h> 31#include <asm/mach-types.h>
33 32
34#include <asm/irq.h> 33#include <asm/irq.h>
diff --git a/arch/arm/plat-versatile/Kconfig b/arch/arm/plat-versatile/Kconfig
index 8d5c10a5084d..2a4ae8a6a081 100644
--- a/arch/arm/plat-versatile/Kconfig
+++ b/arch/arm/plat-versatile/Kconfig
@@ -16,8 +16,10 @@ config PLAT_VERSATILE_FPGA_IRQ_NR
16 depends on PLAT_VERSATILE_FPGA_IRQ 16 depends on PLAT_VERSATILE_FPGA_IRQ
17 17
18config PLAT_VERSATILE_LEDS 18config PLAT_VERSATILE_LEDS
19 def_bool y if LEDS_CLASS 19 def_bool y if NEW_LEDS
20 depends on ARCH_REALVIEW || ARCH_VERSATILE 20 depends on ARCH_REALVIEW || ARCH_VERSATILE
21 select LEDS_CLASS
22 select LEDS_TRIGGER
21 23
22config PLAT_VERSATILE_SCHED_CLOCK 24config PLAT_VERSATILE_SCHED_CLOCK
23 def_bool y 25 def_bool y
diff --git a/arch/arm/plat-versatile/leds.c b/arch/arm/plat-versatile/leds.c
index 3169fa555ea6..d2490d00b46c 100644
--- a/arch/arm/plat-versatile/leds.c
+++ b/arch/arm/plat-versatile/leds.c
@@ -37,10 +37,10 @@ static const struct {
37} versatile_leds[] = { 37} versatile_leds[] = {
38 { "versatile:0", "heartbeat", }, 38 { "versatile:0", "heartbeat", },
39 { "versatile:1", "mmc0", }, 39 { "versatile:1", "mmc0", },
40 { "versatile:2", }, 40 { "versatile:2", "cpu0" },
41 { "versatile:3", }, 41 { "versatile:3", "cpu1" },
42 { "versatile:4", }, 42 { "versatile:4", "cpu2" },
43 { "versatile:5", }, 43 { "versatile:5", "cpu3" },
44 { "versatile:6", }, 44 { "versatile:6", },
45 { "versatile:7", }, 45 { "versatile:7", },
46}; 46};