diff options
138 files changed, 1955 insertions, 3478 deletions
diff --git a/Documentation/devicetree/bindings/bus/omap-ocp2scp.txt b/Documentation/devicetree/bindings/bus/omap-ocp2scp.txt new file mode 100644 index 000000000000..d2fe064a828b --- /dev/null +++ b/Documentation/devicetree/bindings/bus/omap-ocp2scp.txt | |||
@@ -0,0 +1,10 @@ | |||
1 | * OMAP OCP2SCP - ocp interface to scp interface | ||
2 | |||
3 | properties: | ||
4 | - compatible : Should be "ti,omap-ocp2scp" | ||
5 | - #address-cells, #size-cells : Must be present if the device has sub-nodes | ||
6 | - ranges : the child address space are mapped 1:1 onto the parent address space | ||
7 | - ti,hwmods : must be "ocp2scp_usb_phy" | ||
8 | |||
9 | Sub-nodes: | ||
10 | All the devices connected to ocp2scp are described using sub-node to ocp2scp | ||
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index b23213d2764e..aad7400e0913 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
@@ -1782,59 +1782,6 @@ config FORCE_MAX_ZONEORDER | |||
1782 | This config option is actually maximum order plus one. For example, | 1782 | This config option is actually maximum order plus one. For example, |
1783 | a value of 11 means that the largest free memory block is 2^10 pages. | 1783 | a value of 11 means that the largest free memory block is 2^10 pages. |
1784 | 1784 | ||
1785 | config LEDS | ||
1786 | bool "Timer and CPU usage LEDs" | ||
1787 | depends on ARCH_CDB89712 || ARCH_EBSA110 || \ | ||
1788 | ARCH_EBSA285 || ARCH_INTEGRATOR || \ | ||
1789 | ARCH_LUBBOCK || MACH_MAINSTONE || ARCH_NETWINDER || \ | ||
1790 | ARCH_OMAP || ARCH_P720T || ARCH_PXA_IDP || \ | ||
1791 | ARCH_SA1100 || ARCH_SHARK || ARCH_VERSATILE || \ | ||
1792 | ARCH_AT91 || ARCH_DAVINCI || \ | ||
1793 | ARCH_KS8695 || MACH_RD88F5182 || ARCH_REALVIEW | ||
1794 | help | ||
1795 | If you say Y here, the LEDs on your machine will be used | ||
1796 | to provide useful information about your current system status. | ||
1797 | |||
1798 | If you are compiling a kernel for a NetWinder or EBSA-285, you will | ||
1799 | be able to select which LEDs are active using the options below. If | ||
1800 | you are compiling a kernel for the EBSA-110 or the LART however, the | ||
1801 | red LED will simply flash regularly to indicate that the system is | ||
1802 | still functional. It is safe to say Y here if you have a CATS | ||
1803 | system, but the driver will do nothing. | ||
1804 | |||
1805 | config LEDS_TIMER | ||
1806 | bool "Timer LED" if (!ARCH_CDB89712 && !ARCH_OMAP) || \ | ||
1807 | OMAP_OSK_MISTRAL || MACH_OMAP_H2 \ | ||
1808 | || MACH_OMAP_PERSEUS2 | ||
1809 | depends on LEDS | ||
1810 | depends on !GENERIC_CLOCKEVENTS | ||
1811 | default y if ARCH_EBSA110 | ||
1812 | help | ||
1813 | If you say Y here, one of the system LEDs (the green one on the | ||
1814 | NetWinder, the amber one on the EBSA285, or the red one on the LART) | ||
1815 | will flash regularly to indicate that the system is still | ||
1816 | operational. This is mainly useful to kernel hackers who are | ||
1817 | debugging unstable kernels. | ||
1818 | |||
1819 | The LART uses the same LED for both Timer LED and CPU usage LED | ||
1820 | functions. You may choose to use both, but the Timer LED function | ||
1821 | will overrule the CPU usage LED. | ||
1822 | |||
1823 | config LEDS_CPU | ||
1824 | bool "CPU usage LED" if (!ARCH_CDB89712 && !ARCH_EBSA110 && \ | ||
1825 | !ARCH_OMAP) \ | ||
1826 | || OMAP_OSK_MISTRAL || MACH_OMAP_H2 \ | ||
1827 | || MACH_OMAP_PERSEUS2 | ||
1828 | depends on LEDS | ||
1829 | help | ||
1830 | If you say Y here, the red LED will be used to give a good real | ||
1831 | time indication of CPU usage, by lighting whenever the idle task | ||
1832 | is not currently executing. | ||
1833 | |||
1834 | The LART uses the same LED for both Timer LED and CPU usage LED | ||
1835 | functions. You may choose to use both, but the Timer LED function | ||
1836 | will overrule the CPU usage LED. | ||
1837 | |||
1838 | config ALIGNMENT_TRAP | 1785 | config ALIGNMENT_TRAP |
1839 | bool | 1786 | bool |
1840 | depends on CPU_CP15_MMU | 1787 | depends on CPU_CP15_MMU |
diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi index 04cbbcb6ff91..8a780b2a5083 100644 --- a/arch/arm/boot/dts/omap4.dtsi +++ b/arch/arm/boot/dts/omap4.dtsi | |||
@@ -295,5 +295,13 @@ | |||
295 | interrupt-parent = <&gic>; | 295 | interrupt-parent = <&gic>; |
296 | ti,hwmods = "dmic"; | 296 | ti,hwmods = "dmic"; |
297 | }; | 297 | }; |
298 | |||
299 | ocp2scp { | ||
300 | compatible = "ti,omap-ocp2scp"; | ||
301 | #address-cells = <1>; | ||
302 | #size-cells = <1>; | ||
303 | ranges; | ||
304 | ti,hwmods = "ocp2scp_usb_phy"; | ||
305 | }; | ||
298 | }; | 306 | }; |
299 | }; | 307 | }; |
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 | |||
39 | CONFIG_MTD_DATAFLASH=y | 39 | CONFIG_MTD_DATAFLASH=y |
40 | CONFIG_MTD_NAND=y | 40 | CONFIG_MTD_NAND=y |
41 | CONFIG_MTD_NAND_ATMEL=y | 41 | CONFIG_MTD_NAND_ATMEL=y |
42 | CONFIG_MTD_NAND_ATMEL_ECC_SOFT=y | ||
43 | CONFIG_BLK_DEV_RAM=y | 42 | CONFIG_BLK_DEV_RAM=y |
44 | CONFIG_BLK_DEV_RAM_SIZE=8192 | 43 | CONFIG_BLK_DEV_RAM_SIZE=8192 |
45 | CONFIG_ATMEL_SSC=y | 44 | CONFIG_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 | |||
232 | CONFIG_USB_ETH=m | 232 | CONFIG_USB_ETH=m |
233 | CONFIG_USB_MASS_STORAGE=m | 233 | CONFIG_USB_MASS_STORAGE=m |
234 | CONFIG_MMC=y | 234 | CONFIG_MMC=y |
235 | CONFIG_MMC_AT91=y | 235 | CONFIG_MMC_ATMELMCI=y |
236 | CONFIG_NEW_LEDS=y | 236 | CONFIG_NEW_LEDS=y |
237 | CONFIG_LEDS_CLASS=y | 237 | CONFIG_LEDS_CLASS=y |
238 | CONFIG_LEDS_GPIO=y | 238 | CONFIG_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 | |||
128 | CONFIG_USB_FILE_STORAGE=m | 128 | CONFIG_USB_FILE_STORAGE=m |
129 | CONFIG_USB_G_SERIAL=m | 129 | CONFIG_USB_G_SERIAL=m |
130 | CONFIG_MMC=y | 130 | CONFIG_MMC=y |
131 | CONFIG_MMC_AT91=m | 131 | CONFIG_MMC_ATMELMCI=m |
132 | CONFIG_NEW_LEDS=y | 132 | CONFIG_NEW_LEDS=y |
133 | CONFIG_LEDS_CLASS=y | 133 | CONFIG_LEDS_CLASS=y |
134 | CONFIG_LEDS_GPIO=y | 134 | CONFIG_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 | |||
61 | CONFIG_MTD_BLOCK2MTD=y | 61 | CONFIG_MTD_BLOCK2MTD=y |
62 | CONFIG_MTD_NAND=y | 62 | CONFIG_MTD_NAND=y |
63 | CONFIG_MTD_NAND_ATMEL=y | 63 | CONFIG_MTD_NAND_ATMEL=y |
64 | CONFIG_MTD_NAND_ATMEL_ECC_SOFT=y | ||
65 | CONFIG_MTD_UBI=y | 64 | CONFIG_MTD_UBI=y |
66 | CONFIG_MTD_UBI_GLUEBI=y | 65 | CONFIG_MTD_UBI_GLUEBI=y |
67 | CONFIG_BLK_DEV_LOOP=y | 66 | CONFIG_BLK_DEV_LOOP=y |
@@ -138,7 +137,7 @@ CONFIG_USB_FILE_STORAGE=m | |||
138 | CONFIG_USB_G_SERIAL=m | 137 | CONFIG_USB_G_SERIAL=m |
139 | CONFIG_MMC=y | 138 | CONFIG_MMC=y |
140 | CONFIG_SDIO_UART=m | 139 | CONFIG_SDIO_UART=m |
141 | CONFIG_MMC_AT91=m | 140 | CONFIG_MMC_ATMELMCI=m |
142 | CONFIG_NEW_LEDS=y | 141 | CONFIG_NEW_LEDS=y |
143 | CONFIG_LEDS_CLASS=y | 142 | CONFIG_LEDS_CLASS=y |
144 | CONFIG_LEDS_ATMEL_PWM=y | 143 | CONFIG_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 | |||
99 | CONFIG_USB_FILE_STORAGE=m | 99 | CONFIG_USB_FILE_STORAGE=m |
100 | CONFIG_USB_G_SERIAL=m | 100 | CONFIG_USB_G_SERIAL=m |
101 | CONFIG_MMC=y | 101 | CONFIG_MMC=y |
102 | CONFIG_MMC_AT91=m | 102 | CONFIG_MMC_ATMELMCI=m |
103 | CONFIG_NEW_LEDS=y | 103 | CONFIG_NEW_LEDS=y |
104 | CONFIG_LEDS_CLASS=y | 104 | CONFIG_LEDS_CLASS=y |
105 | CONFIG_LEDS_GPIO=y | 105 | CONFIG_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 | |||
60 | CONFIG_FB=y | 60 | CONFIG_FB=y |
61 | CONFIG_FB_ATMEL=y | 61 | CONFIG_FB_ATMEL=y |
62 | CONFIG_MMC=y | 62 | CONFIG_MMC=y |
63 | CONFIG_MMC_AT91=m | 63 | CONFIG_MMC_ATMELMCI=m |
64 | CONFIG_RTC_CLASS=y | 64 | CONFIG_RTC_CLASS=y |
65 | CONFIG_RTC_DRV_AT91SAM9=y | 65 | CONFIG_RTC_DRV_AT91SAM9=y |
66 | CONFIG_EXT2_FS=y | 66 | CONFIG_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 | |||
82 | CONFIG_USB_GADGET=y | 82 | CONFIG_USB_GADGET=y |
83 | CONFIG_USB_ETH=m | 83 | CONFIG_USB_ETH=m |
84 | CONFIG_MMC=y | 84 | CONFIG_MMC=y |
85 | CONFIG_MMC_AT91=m | 85 | CONFIG_MMC_ATMELMCI=m |
86 | CONFIG_NEW_LEDS=y | 86 | CONFIG_NEW_LEDS=y |
87 | CONFIG_LEDS_CLASS=y | 87 | CONFIG_LEDS_CLASS=y |
88 | CONFIG_LEDS_GPIO=y | 88 | CONFIG_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 | |||
82 | CONFIG_USB_GADGET=y | 82 | CONFIG_USB_GADGET=y |
83 | CONFIG_USB_ETH=m | 83 | CONFIG_USB_ETH=m |
84 | CONFIG_MMC=y | 84 | CONFIG_MMC=y |
85 | CONFIG_MMC_AT91=m | 85 | CONFIG_MMC_ATMELMCI=m |
86 | CONFIG_NEW_LEDS=y | 86 | CONFIG_NEW_LEDS=y |
87 | CONFIG_LEDS_CLASS=y | 87 | CONFIG_LEDS_CLASS=y |
88 | CONFIG_LEDS_GPIO=y | 88 | CONFIG_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 | |||
50 | CONFIG_MTD_DATAFLASH=y | 50 | CONFIG_MTD_DATAFLASH=y |
51 | CONFIG_MTD_NAND=y | 51 | CONFIG_MTD_NAND=y |
52 | CONFIG_MTD_NAND_ATMEL=y | 52 | CONFIG_MTD_NAND_ATMEL=y |
53 | CONFIG_MTD_NAND_ATMEL_ECC_SOFT=y | ||
54 | CONFIG_BLK_DEV_LOOP=y | 53 | CONFIG_BLK_DEV_LOOP=y |
55 | # CONFIG_MISC_DEVICES is not set | 54 | # CONFIG_MISC_DEVICES is not set |
56 | CONFIG_SCSI=y | 55 | CONFIG_SCSI=y |
@@ -87,7 +86,7 @@ CONFIG_USB_STORAGE=y | |||
87 | CONFIG_USB_GADGET=y | 86 | CONFIG_USB_GADGET=y |
88 | CONFIG_USB_ETH=m | 87 | CONFIG_USB_ETH=m |
89 | CONFIG_MMC=y | 88 | CONFIG_MMC=y |
90 | CONFIG_MMC_AT91=m | 89 | CONFIG_MMC_ATMELMCI=m |
91 | CONFIG_NEW_LEDS=y | 90 | CONFIG_NEW_LEDS=y |
92 | CONFIG_LEDS_CLASS=y | 91 | CONFIG_LEDS_CLASS=y |
93 | CONFIG_LEDS_GPIO=y | 92 | CONFIG_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 | |||
100 | CONFIG_USB_FILE_STORAGE=m | 100 | CONFIG_USB_FILE_STORAGE=m |
101 | CONFIG_USB_G_SERIAL=m | 101 | CONFIG_USB_G_SERIAL=m |
102 | CONFIG_MMC=y | 102 | CONFIG_MMC=y |
103 | # CONFIG_MMC_AT91 is not set | ||
104 | CONFIG_MMC_ATMELMCI=y | 103 | CONFIG_MMC_ATMELMCI=y |
105 | CONFIG_NEW_LEDS=y | 104 | CONFIG_NEW_LEDS=y |
106 | CONFIG_LEDS_CLASS=y | 105 | CONFIG_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 | |||
49 | CONFIG_MTD_DATAFLASH=y | 49 | CONFIG_MTD_DATAFLASH=y |
50 | CONFIG_MTD_NAND=y | 50 | CONFIG_MTD_NAND=y |
51 | CONFIG_MTD_NAND_ATMEL=y | 51 | CONFIG_MTD_NAND_ATMEL=y |
52 | CONFIG_MTD_NAND_ATMEL_ECC_SOFT=y | ||
53 | CONFIG_BLK_DEV_LOOP=y | 52 | CONFIG_BLK_DEV_LOOP=y |
54 | # CONFIG_MISC_DEVICES is not set | 53 | # CONFIG_MISC_DEVICES is not set |
55 | CONFIG_SCSI=y | 54 | CONFIG_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 | |||
17 | typedef 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 | ||
45 | extern 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 7ad2d5cf7008..8951577c4ced 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 | ||
22 | obj-$(CONFIG_DEPRECATED_PARAM_STRUCT) += compat.o | 22 | obj-$(CONFIG_DEPRECATED_PARAM_STRUCT) += compat.o |
23 | 23 | ||
24 | obj-$(CONFIG_LEDS) += leds.o | ||
25 | obj-$(CONFIG_OC_ETM) += etm.o | 24 | obj-$(CONFIG_OC_ETM) += etm.o |
26 | obj-$(CONFIG_CPU_IDLE) += cpuidle.o | 25 | obj-$(CONFIG_CPU_IDLE) += cpuidle.o |
27 | obj-$(CONFIG_ISA_DMA_API) += dma.o | 26 | obj-$(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 | |||
18 | static void dummy_leds_event(led_event_t evt) | ||
19 | { | ||
20 | } | ||
21 | |||
22 | void (*leds_event)(led_event_t) = dummy_leds_event; | ||
23 | |||
24 | struct leds_evt_name { | ||
25 | const char name[8]; | ||
26 | int on; | ||
27 | int off; | ||
28 | }; | ||
29 | |||
30 | static 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 | |||
37 | static 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 | |||
72 | static DEVICE_ATTR(event, 0200, NULL, leds_store); | ||
73 | |||
74 | static struct bus_type leds_subsys = { | ||
75 | .name = "leds", | ||
76 | .dev_name = "leds", | ||
77 | }; | ||
78 | |||
79 | static struct device leds_device = { | ||
80 | .id = 0, | ||
81 | .bus = &leds_subsys, | ||
82 | }; | ||
83 | |||
84 | static int leds_suspend(void) | ||
85 | { | ||
86 | leds_event(led_stop); | ||
87 | return 0; | ||
88 | } | ||
89 | |||
90 | static void leds_resume(void) | ||
91 | { | ||
92 | leds_event(led_start); | ||
93 | } | ||
94 | |||
95 | static void leds_shutdown(void) | ||
96 | { | ||
97 | leds_event(led_halted); | ||
98 | } | ||
99 | |||
100 | static struct syscore_ops leds_syscore_ops = { | ||
101 | .shutdown = leds_shutdown, | ||
102 | .suspend = leds_suspend, | ||
103 | .resume = leds_resume, | ||
104 | }; | ||
105 | |||
106 | static 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 | |||
119 | device_initcall(leds_init); | ||
120 | |||
121 | EXPORT_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 | ||
84 | static 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) | |||
102 | void timer_tick(void) | 86 | void 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) |
298 | static u64 mmc_dmamask = DMA_BIT_MASK(32); | 298 | static u64 mmc_dmamask = DMA_BIT_MASK(32); |
299 | static struct at91_mmc_data mmc_data; | 299 | static struct mci_platform_data mmc_data; |
300 | 300 | ||
301 | static struct resource mmc_resources[] = { | 301 | static struct resource mmc_resources[] = { |
302 | [0] = { | 302 | [0] = { |
@@ -312,7 +312,7 @@ static struct resource mmc_resources[] = { | |||
312 | }; | 312 | }; |
313 | 313 | ||
314 | static struct platform_device at91rm9200_mmc_device = { | 314 | static 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 | ||
326 | void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) | 326 | void __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 |
372 | void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {} | 388 | void __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 7b9c2ba396ed..156e639257c9 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) | ||
216 | static u64 mmc_dmamask = DMA_BIT_MASK(32); | ||
217 | static struct at91_mmc_data mmc_data; | ||
218 | |||
219 | static 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 | |||
232 | static 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 | |||
244 | void __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 | ||
290 | void __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) |
298 | static u64 mmc_dmamask = DMA_BIT_MASK(32); | 216 | static u64 mmc_dmamask = DMA_BIT_MASK(32); |
299 | static struct mci_platform_data mmc_data; | 217 | static 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 8df5c1bdff92..06c0c6e025b9 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) |
141 | static u64 mmc_dmamask = DMA_BIT_MASK(32); | 141 | static u64 mmc_dmamask = DMA_BIT_MASK(32); |
142 | static struct at91_mmc_data mmc_data; | 142 | static struct mci_platform_data mmc_data; |
143 | 143 | ||
144 | static struct resource mmc_resources[] = { | 144 | static struct resource mmc_resources[] = { |
145 | [0] = { | 145 | [0] = { |
@@ -155,7 +155,7 @@ static struct resource mmc_resources[] = { | |||
155 | }; | 155 | }; |
156 | 156 | ||
157 | static struct platform_device at91sam9261_mmc_device = { | 157 | static 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 | ||
169 | void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) | 169 | void __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 |
202 | void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {} | 202 | void __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 eb6bbf86fb9f..1e176aaaaecb 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) |
222 | static u64 mmc_dmamask = DMA_BIT_MASK(32); | 222 | static u64 mmc_dmamask = DMA_BIT_MASK(32); |
223 | static struct at91_mmc_data mmc0_data, mmc1_data; | 223 | static struct mci_platform_data mmc0_data, mmc1_data; |
224 | 224 | ||
225 | static struct resource mmc0_resources[] = { | 225 | static struct resource mmc0_resources[] = { |
226 | [0] = { | 226 | [0] = { |
@@ -236,7 +236,7 @@ static struct resource mmc0_resources[] = { | |||
236 | }; | 236 | }; |
237 | 237 | ||
238 | static struct platform_device at91sam9263_mmc0_device = { | 238 | static 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 | ||
263 | static struct platform_device at91sam9263_mmc1_device = { | 263 | static 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 | ||
275 | void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) | 275 | void __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 |
353 | void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {} | 378 | void __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 f09fff932172..ea4479e7c3f4 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) |
165 | static u64 mmc_dmamask = DMA_BIT_MASK(32); | 165 | static u64 mmc_dmamask = DMA_BIT_MASK(32); |
166 | static struct at91_mmc_data mmc_data; | 166 | static struct mci_platform_data mmc_data; |
167 | 167 | ||
168 | static struct resource mmc_resources[] = { | 168 | static struct resource mmc_resources[] = { |
169 | [0] = { | 169 | [0] = { |
@@ -179,7 +179,7 @@ static struct resource mmc_resources[] = { | |||
179 | }; | 179 | }; |
180 | 180 | ||
181 | static struct platform_device at91sam9rl_mmc_device = { | 181 | static 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 | ||
193 | void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) | 193 | void __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 |
226 | void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {} | 226 | void __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 | */ |
136 | static struct at91_mmc_data __initdata afeb9260_mmc_data = { | 136 | static 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 | ||
74 | static struct at91_mmc_data __initdata carmeva_mmc_data = { | 74 | static 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 | ||
82 | static struct spi_board_info carmeva_spi_devices[] = { | 82 | static 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 | ||
255 | static struct i2c_board_info __initdata cpu9krea_i2c_devices[] = { | 255 | static 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 | */ |
315 | static struct at91_mmc_data __initdata cpu9krea_mmc_data = { | 314 | static 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 | ||
323 | static void __init cpu9krea_board_init(void) | 322 | static 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 | ||
81 | static struct at91_mmc_data __initdata cpuat91_mmc_data = { | 81 | static 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 | ||
88 | static struct physmap_flash_data cpuat91_flash_data = { | 89 | static 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 | ||
90 | static struct at91_mmc_data __initdata csb337_mmc_data = { | 90 | static 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 | ||
98 | static struct spi_board_info csb337_spi_devices[] = { | 98 | static struct spi_board_info csb337_spi_devices[] = { |
@@ -220,8 +220,6 @@ static struct gpio_led csb_leds[] = { | |||
220 | 220 | ||
221 | static void __init csb337_board_init(void) | 221 | static 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 | ||
73 | static struct at91_mmc_data __initdata eb9200_mmc_data = { | 73 | static 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 | ||
81 | static struct i2c_board_info __initdata eb9200_i2c_devices[] = { | 81 | static 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 | ||
119 | MACHINE_START(ATEB9200, "Embest ATEB9200") | 119 | MACHINE_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 | ||
67 | static struct at91_mmc_data __initdata ecb_at91mmc_data = { | 67 | static 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 | */ | ||
144 | static 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 | |||
141 | static void __init ecb_at91board_init(void) | 153 | static 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 | ||
170 | MACHINE_START(ECBAT91, "emQbit's ECB_AT91") | 182 | MACHINE_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 | ||
59 | static struct at91_mmc_data __initdata eco920_mmc_data = { | 59 | static 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 | ||
67 | static struct physmap_flash_data eco920_flash_data = { | 67 | static 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 | */ | ||
99 | static 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 | |||
96 | static void __init eco920_board_init(void) | 114 | static 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 | ||
132 | MACHINE_START(ECO920, "eco920") | 150 | MACHINE_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) */ |
78 | static struct at91_mmc_data __initdata flexibity_mmc_data = { | 78 | static 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 | */ |
88 | static struct spi_board_info foxg20_spi_devices[] = { | 88 | static 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 | */ |
112 | static struct at91_mmc_data __initdata foxg20_mmc_data = { | 112 | static 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 | */ | ||
72 | static 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 | |||
69 | static void __init kafa_board_init(void) | 81 | static 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 | ||
93 | MACHINE_START(KAFA, "Sperry-Sun KAFA") | 104 | MACHINE_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 | ||
72 | static struct at91_mmc_data __initdata kb9202_mmc_data = { | 72 | static 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 | ||
80 | static struct mtd_partition __initdata kb9202_nand_partition[] = { | 80 | static 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 | */ | ||
102 | static 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 | |||
99 | static void __init kb9202_board_init(void) | 117 | static 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 | ||
133 | MACHINE_START(KB9200, "KB920x") | 150 | MACHINE_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 | */ |
141 | static struct at91_mmc_data __initdata neocore926_mmc_data = { | 141 | static 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 | ||
65 | static struct at91_mmc_data __initdata picotux200_mmc_data = { | 65 | static 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 | */ |
159 | static struct at91_mmc_data __initdata ek_mmc_data = { | 159 | static 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 |
80 | static struct at91_mmc_data __initdata dk_mmc_data = { | 80 | static 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 | ||
178 | static void __init dk_board_init(void) | 178 | static 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 |
73 | static struct at91_mmc_data __initdata ek_mmc_data = { | 73 | static 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 | ||
149 | static void __init ek_board_init(void) | 149 | static 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 | */ |
61 | static struct at91_mmc_data rsi_ews_mmc_data __initdata = { | 61 | static 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 | */ |
186 | static void __init rsi_ews_board_init(void) | 187 | static 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 | */ |
75 | static struct spi_board_info ek_spi_devices[] = { | 75 | static 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 | */ |
161 | static struct at91_mmc_data __initdata ek_mmc_data = { | 161 | static 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 | */ | ||
172 | static 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 | ||
169 | static void __init ek_board_init(void) | 187 | static 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 | ||
202 | MACHINE_START(SAM9_L9260, "Olimex SAM9-L9260") | 219 | MACHINE_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 | */ |
110 | static struct spi_board_info ek_spi_devices[] = { | 110 | static 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 | */ |
214 | static struct at91_mmc_data __initdata ek_mmc_data = { | 214 | static 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 | */ |
343 | static struct at91_mmc_data __initdata ek_mmc_data = { | 343 | static 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 | ||
570 | static void __init ek_board_init(void) | 571 | static 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 | */ |
144 | static struct at91_mmc_data __initdata ek_mmc_data = { | 144 | static 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 | */ |
94 | static struct spi_board_info ek_spi_devices[] = { | 94 | static 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) | ||
203 | static struct mci_platform_data __initdata ek_mmc_data = { | 202 | static 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 | ||
212 | static 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 | ||
221 | static void __init ek_add_device_mmc(void) | 211 | static 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 | */ |
59 | static struct at91_mmc_data __initdata ek_mmc_data = { | 59 | static 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) | ||
87 | static struct mci_platform_data __initdata mmc_data = { | 86 | static 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 | ||
95 | static 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 | */ |
111 | static struct spi_board_info usb_a9263_spi_devices[] = { | 111 | static 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 | ||
122 | static struct spi_board_info usb_a9g20_spi_devices[] = { | 120 | static 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 | */ |
122 | static struct at91_mmc_data __initdata yl9200_mmc_data = { | 122 | static 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 | ||
542 | static void __init yl9200_board_init(void) | 543 | static 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 { | |||
187 | extern void __init at91_add_device_can(struct at91_can_data *data); | 187 | extern void __init at91_add_device_can(struct at91_can_data *data); |
188 | 188 | ||
189 | /* LEDs */ | 189 | /* LEDs */ |
190 | extern void __init at91_init_leds(u8 cpu_led, u8 timer_led); | ||
191 | extern void __init at91_gpio_leds(struct gpio_led *leds, int nr); | 190 | extern void __init at91_gpio_leds(struct gpio_led *leds, int nr); |
192 | extern void __init at91_pwm_leds(struct gpio_led *leds, int nr); | 191 | extern 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 |
91 | void __init at91_pwm_leds(struct gpio_led *leds, int nr){} | 91 | void __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 | |||
106 | static u8 at91_leds_cpu; | ||
107 | static u8 at91_leds_timer; | ||
108 | |||
109 | static inline void at91_led_on(unsigned int led) | ||
110 | { | ||
111 | at91_set_gpio_value(led, 0); | ||
112 | } | ||
113 | |||
114 | static inline void at91_led_off(unsigned int led) | ||
115 | { | ||
116 | at91_set_gpio_value(led, 1); | ||
117 | } | ||
118 | |||
119 | static 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 | */ | ||
132 | static 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 | |||
171 | static 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 | |||
185 | void __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 | ||
196 | void __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 f2f0256232e3..5872b49bfaed 100644 --- a/arch/arm/mach-clps711x/Makefile +++ b/arch/arm/mach-clps711x/Makefile | |||
@@ -16,5 +16,3 @@ obj-$(CONFIG_ARCH_CLEP7312) += clep7312.o | |||
16 | obj-$(CONFIG_ARCH_EDB7211) += edb7211-arch.o edb7211-mm.o | 16 | obj-$(CONFIG_ARCH_EDB7211) += edb7211-arch.o edb7211-mm.o |
17 | obj-$(CONFIG_ARCH_FORTUNET) += fortunet.o | 17 | obj-$(CONFIG_ARCH_FORTUNET) += fortunet.o |
18 | obj-$(CONFIG_ARCH_P720T) += p720t.o | 18 | obj-$(CONFIG_ARCH_P720T) += p720t.o |
19 | leds-$(CONFIG_ARCH_P720T) += p720t-leds.o | ||
20 | obj-$(CONFIG_LEDS) += $(leds-y) | ||
diff --git a/arch/arm/mach-clps711x/common.c b/arch/arm/mach-clps711x/common.c index f15293bd7974..3a4af00db9e3 100644 --- a/arch/arm/mach-clps711x/common.c +++ b/arch/arm/mach-clps711x/common.c | |||
@@ -30,7 +30,6 @@ | |||
30 | #include <asm/sizes.h> | 30 | #include <asm/sizes.h> |
31 | #include <mach/hardware.h> | 31 | #include <mach/hardware.h> |
32 | #include <asm/irq.h> | 32 | #include <asm/irq.h> |
33 | #include <asm/leds.h> | ||
34 | #include <asm/pgtable.h> | 33 | #include <asm/pgtable.h> |
35 | #include <asm/page.h> | 34 | #include <asm/page.h> |
36 | #include <asm/mach/map.h> | 35 | #include <asm/mach/map.h> |
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 | |||
30 | static 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 | |||
55 | static int __init leds_init(void) | ||
56 | { | ||
57 | if (machine_is_p720t()) | ||
58 | leds_event = p720t_leds_event; | ||
59 | |||
60 | return 0; | ||
61 | } | ||
62 | |||
63 | arch_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) | ||
118 | static 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 | |||
131 | static 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 | |||
138 | static 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 | */ | ||
169 | fs_initcall(p720t_leds_init); | ||
170 | #endif | ||
171 | |||
110 | MACHINE_START(P720T, "ARM-Prospector720T") | 172 | MACHINE_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 | ||
7 | obj-y := core.o io.o | 7 | obj-y := core.o io.o leds.o |
8 | obj-m := | 8 | obj-m := |
9 | obj-n := | 9 | obj-n := |
10 | obj- := | 10 | obj- := |
11 | |||
12 | obj-$(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 | ||
24 | static spinlock_t leds_lock; | 18 | #if defined(CONFIG_NEW_LEDS) && defined(CONFIG_LEDS_CLASS) |
25 | 19 | static void ebsa110_led_set(struct led_classdev *cdev, | |
26 | static 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: | 32 | static 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 | ||
44 | static int __init leds_init(void) | 39 | static 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 | */ | ||
70 | fs_initcall(ebsa110_leds_init); | ||
71 | #endif | ||
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 | |||
14 | pci-$(CONFIG_ARCH_NETWINDER) += netwinder-pci.o | 14 | pci-$(CONFIG_ARCH_NETWINDER) += netwinder-pci.o |
15 | pci-$(CONFIG_ARCH_PERSONAL_SERVER) += personal-pci.o | 15 | pci-$(CONFIG_ARCH_PERSONAL_SERVER) += personal-pci.o |
16 | 16 | ||
17 | leds-$(CONFIG_ARCH_EBSA285) += ebsa285-leds.o | ||
18 | leds-$(CONFIG_ARCH_NETWINDER) += netwinder-leds.o | ||
19 | |||
20 | obj-$(CONFIG_ARCH_CATS) += cats-hw.o isa-timer.o | 17 | obj-$(CONFIG_ARCH_CATS) += cats-hw.o isa-timer.o |
21 | obj-$(CONFIG_ARCH_EBSA285) += ebsa285.o dc21285-timer.o | 18 | obj-$(CONFIG_ARCH_EBSA285) += ebsa285.o dc21285-timer.o |
22 | obj-$(CONFIG_ARCH_NETWINDER) += netwinder-hw.o isa-timer.o | 19 | obj-$(CONFIG_ARCH_NETWINDER) += netwinder-hw.o isa-timer.o |
23 | obj-$(CONFIG_ARCH_PERSONAL_SERVER) += personal.o dc21285-timer.o | 20 | obj-$(CONFIG_ARCH_PERSONAL_SERVER) += personal.o dc21285-timer.o |
24 | 21 | ||
25 | obj-$(CONFIG_PCI) +=$(pci-y) | 22 | obj-$(CONFIG_PCI) +=$(pci-y) |
26 | obj-$(CONFIG_LEDS) +=$(leds-y) | ||
27 | 23 | ||
28 | obj-$(CONFIG_ISA) += isa.o isa-rtc.o | 24 | obj-$(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 | ||
30 | static char led_state; | ||
31 | static char hw_led_state; | ||
32 | |||
33 | static DEFINE_SPINLOCK(leds_lock); | ||
34 | |||
35 | static 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 | |||
128 | static 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) | ||
20 | struct 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 | */ | ||
29 | static 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 | |||
38 | static 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 | |||
50 | static 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 | |||
58 | static 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 | */ | ||
94 | fs_initcall(ebsa285_leds_init); | ||
95 | #endif | ||
96 | |||
16 | MACHINE_START(EBSA285, "EBSA285") | 97 | MACHINE_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) | |||
611 | static int __init nw_hw_init(void) | 605 | static 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) | ||
665 | struct 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 | */ | ||
674 | static 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 | */ | ||
687 | static 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 | |||
705 | static 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 | |||
719 | static 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 | */ | ||
756 | fs_initcall(netwinder_leds_init); | ||
757 | #endif | ||
758 | |||
675 | MACHINE_START(NETWINDER, "Rebel-NetWinder") | 759 | MACHINE_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 | ||
30 | static char led_state; | ||
31 | static char hw_led_state; | ||
32 | |||
33 | static DEFINE_RAW_SPINLOCK(leds_lock); | ||
34 | |||
35 | static 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 | |||
128 | static 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 | ||
7 | obj-y := core.o lm.o | 7 | obj-y := core.o lm.o leds.o |
8 | obj-$(CONFIG_ARCH_INTEGRATOR_AP) += integrator_ap.o | 8 | obj-$(CONFIG_ARCH_INTEGRATOR_AP) += integrator_ap.o |
9 | obj-$(CONFIG_ARCH_INTEGRATOR_CP) += integrator_cp.o | 9 | obj-$(CONFIG_ARCH_INTEGRATOR_CP) += integrator_cp.o |
10 | 10 | ||
11 | obj-$(CONFIG_LEDS) += leds.o | ||
12 | obj-$(CONFIG_PCI) += pci_v3.o pci.o | 11 | obj-$(CONFIG_PCI) += pci_v3.o pci.o |
13 | obj-$(CONFIG_CPU_FREQ_INTEGRATOR) += cpu.o | 12 | obj-$(CONFIG_CPU_FREQ_INTEGRATOR) += cpu.o |
14 | obj-$(CONFIG_INTEGRATOR_IMPD1) += impd1.o | 13 | obj-$(CONFIG_INTEGRATOR_IMPD1) += impd1.o |
diff --git a/arch/arm/mach-integrator/core.c b/arch/arm/mach-integrator/core.c index 3fa6c51390da..2af5034ea29e 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 | |||
133 | static DEFINE_RAW_SPINLOCK(cm_lock); | 130 | static 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 | */ |
4 | void cm_control(u32, u32); | 4 | void 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 | ||
35 | static 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 | ||
37 | static void integrator_leds_event(led_event_t ledevt) | 23 | struct 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 | */ | ||
32 | static 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 | |||
43 | static 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: | 61 | static 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: | 70 | static 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: | 79 | static 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 | ||
82 | static int __init leds_init(void) | 86 | static 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 | ||
90 | core_initcall(leds_init); | 120 | /* |
121 | * Since we may have triggers on any subsystem, defer registration | ||
122 | * until after subsystem_init. | ||
123 | */ | ||
124 | fs_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 |
12 | obj-$(CONFIG_PCI) += pci.o | 12 | obj-$(CONFIG_PCI) += pci.o |
13 | 13 | ||
14 | # LEDs | ||
15 | obj-$(CONFIG_LEDS) += leds.o | ||
16 | |||
17 | # Board-specific support | 14 | # Board-specific support |
18 | obj-$(CONFIG_MACH_KS8695) += board-micrel.o | 15 | obj-$(CONFIG_MACH_KS8695) += board-micrel.o |
19 | obj-$(CONFIG_MACH_DSM320) += board-dsm320.o | 16 | obj-$(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) | ||
190 | short ks8695_leds_cpu = -1; | ||
191 | short ks8695_leds_timer = -1; | ||
192 | |||
193 | void __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 | ||
203 | void __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); | |||
18 | extern void __init ks8695_add_device_lan(void); | 18 | extern void __init ks8695_add_device_lan(void); |
19 | extern void __init ks8695_add_device_hpna(void); | 19 | extern void __init ks8695_add_device_hpna(void); |
20 | 20 | ||
21 | /* LEDs */ | ||
22 | extern short ks8695_leds_cpu; | ||
23 | extern short ks8695_leds_timer; | ||
24 | extern 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 | |||
19 | static inline void ks8695_led_on(unsigned int led) | ||
20 | { | ||
21 | gpio_set_value(led, 0); | ||
22 | } | ||
23 | |||
24 | static inline void ks8695_led_off(unsigned int led) | ||
25 | { | ||
26 | gpio_set_value(led, 1); | ||
27 | } | ||
28 | |||
29 | static 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 | */ | ||
42 | static 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 | |||
81 | static 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 | |||
61 | obj-$(CONFIG_ARCH_OMAP15XX) += gpio15xx.o | 61 | obj-$(CONFIG_ARCH_OMAP15XX) += gpio15xx.o |
62 | obj-$(CONFIG_ARCH_OMAP16XX) += gpio16xx.o | 62 | obj-$(CONFIG_ARCH_OMAP16XX) += gpio16xx.o |
63 | 63 | ||
64 | # LEDs support | ||
65 | led-$(CONFIG_MACH_OMAP_H2) += leds-h2p2-debug.o | ||
66 | led-$(CONFIG_MACH_OMAP_H3) += leds-h2p2-debug.o | ||
67 | led-$(CONFIG_MACH_OMAP_INNOVATOR) += leds-innovator.o | ||
68 | led-$(CONFIG_MACH_OMAP_PERSEUS2) += leds-h2p2-debug.o | ||
69 | led-$(CONFIG_MACH_OMAP_OSK) += leds-osk.o | ||
70 | obj-$(CONFIG_LEDS) += $(led-y) | ||
71 | |||
72 | ifneq ($(CONFIG_FB_OMAP),) | 64 | ifneq ($(CONFIG_FB_OMAP),) |
73 | obj-y += lcd_dma.o | 65 | obj-y += lcd_dma.o |
74 | endif | 66 | endif |
diff --git a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c index 44a4ab195fbc..cd8836f43f01 100644 --- a/arch/arm/mach-omap1/board-h2.c +++ b/arch/arm/mach-omap1/board-h2.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/i2c/tps65010.h> | 31 | #include <linux/i2c/tps65010.h> |
32 | #include <linux/smc91x.h> | 32 | #include <linux/smc91x.h> |
33 | #include <linux/omapfb.h> | 33 | #include <linux/omapfb.h> |
34 | #include <linux/leds.h> | ||
34 | 35 | ||
35 | #include <asm/mach-types.h> | 36 | #include <asm/mach-types.h> |
36 | #include <asm/mach/arch.h> | 37 | #include <asm/mach/arch.h> |
@@ -306,12 +307,39 @@ static struct platform_device h2_irda_device = { | |||
306 | .resource = h2_irda_resources, | 307 | .resource = h2_irda_resources, |
307 | }; | 308 | }; |
308 | 309 | ||
310 | static struct gpio_led h2_gpio_led_pins[] = { | ||
311 | { | ||
312 | .name = "h2:red", | ||
313 | .default_trigger = "heartbeat", | ||
314 | .gpio = 3, | ||
315 | }, | ||
316 | { | ||
317 | .name = "h2:green", | ||
318 | .default_trigger = "cpu0", | ||
319 | .gpio = OMAP_MPUIO(4), | ||
320 | }, | ||
321 | }; | ||
322 | |||
323 | static struct gpio_led_platform_data h2_gpio_led_data = { | ||
324 | .leds = h2_gpio_led_pins, | ||
325 | .num_leds = ARRAY_SIZE(h2_gpio_led_pins), | ||
326 | }; | ||
327 | |||
328 | static struct platform_device h2_gpio_leds = { | ||
329 | .name = "leds-gpio", | ||
330 | .id = -1, | ||
331 | .dev = { | ||
332 | .platform_data = &h2_gpio_led_data, | ||
333 | }, | ||
334 | }; | ||
335 | |||
309 | static struct platform_device *h2_devices[] __initdata = { | 336 | static struct platform_device *h2_devices[] __initdata = { |
310 | &h2_nor_device, | 337 | &h2_nor_device, |
311 | &h2_nand_device, | 338 | &h2_nand_device, |
312 | &h2_smc91x_device, | 339 | &h2_smc91x_device, |
313 | &h2_irda_device, | 340 | &h2_irda_device, |
314 | &h2_kp_device, | 341 | &h2_kp_device, |
342 | &h2_gpio_leds, | ||
315 | }; | 343 | }; |
316 | 344 | ||
317 | static void __init h2_init_smc91x(void) | 345 | static void __init h2_init_smc91x(void) |
@@ -406,6 +434,10 @@ static void __init h2_init(void) | |||
406 | omap_cfg_reg(E19_1610_KBR4); | 434 | omap_cfg_reg(E19_1610_KBR4); |
407 | omap_cfg_reg(N19_1610_KBR5); | 435 | omap_cfg_reg(N19_1610_KBR5); |
408 | 436 | ||
437 | /* GPIO based LEDs */ | ||
438 | omap_cfg_reg(P18_1610_GPIO3); | ||
439 | omap_cfg_reg(MPUIO4); | ||
440 | |||
409 | h2_smc91x_resources[1].start = gpio_to_irq(0); | 441 | h2_smc91x_resources[1].start = gpio_to_irq(0); |
410 | h2_smc91x_resources[1].end = gpio_to_irq(0); | 442 | h2_smc91x_resources[1].end = gpio_to_irq(0); |
411 | platform_add_devices(h2_devices, ARRAY_SIZE(h2_devices)); | 443 | 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 86cb5a04a404..1fa9c45c1ae5 100644 --- a/arch/arm/mach-omap1/board-h3.c +++ b/arch/arm/mach-omap1/board-h3.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/i2c/tps65010.h> | 31 | #include <linux/i2c/tps65010.h> |
32 | #include <linux/smc91x.h> | 32 | #include <linux/smc91x.h> |
33 | #include <linux/omapfb.h> | 33 | #include <linux/omapfb.h> |
34 | #include <linux/leds.h> | ||
34 | 35 | ||
35 | #include <asm/setup.h> | 36 | #include <asm/setup.h> |
36 | #include <asm/page.h> | 37 | #include <asm/page.h> |
@@ -324,6 +325,32 @@ static struct spi_board_info h3_spi_board_info[] __initdata = { | |||
324 | }, | 325 | }, |
325 | }; | 326 | }; |
326 | 327 | ||
328 | static struct gpio_led h3_gpio_led_pins[] = { | ||
329 | { | ||
330 | .name = "h3:red", | ||
331 | .default_trigger = "heartbeat", | ||
332 | .gpio = 3, | ||
333 | }, | ||
334 | { | ||
335 | .name = "h3:green", | ||
336 | .default_trigger = "cpu0", | ||
337 | .gpio = OMAP_MPUIO(4), | ||
338 | }, | ||
339 | }; | ||
340 | |||
341 | static struct gpio_led_platform_data h3_gpio_led_data = { | ||
342 | .leds = h3_gpio_led_pins, | ||
343 | .num_leds = ARRAY_SIZE(h3_gpio_led_pins), | ||
344 | }; | ||
345 | |||
346 | static struct platform_device h3_gpio_leds = { | ||
347 | .name = "leds-gpio", | ||
348 | .id = -1, | ||
349 | .dev = { | ||
350 | .platform_data = &h3_gpio_led_data, | ||
351 | }, | ||
352 | }; | ||
353 | |||
327 | static struct platform_device *devices[] __initdata = { | 354 | static struct platform_device *devices[] __initdata = { |
328 | &nor_device, | 355 | &nor_device, |
329 | &nand_device, | 356 | &nand_device, |
@@ -331,6 +358,7 @@ static struct platform_device *devices[] __initdata = { | |||
331 | &intlat_device, | 358 | &intlat_device, |
332 | &h3_kp_device, | 359 | &h3_kp_device, |
333 | &h3_lcd_device, | 360 | &h3_lcd_device, |
361 | &h3_gpio_leds, | ||
334 | }; | 362 | }; |
335 | 363 | ||
336 | static struct omap_usb_config h3_usb_config __initdata = { | 364 | static struct omap_usb_config h3_usb_config __initdata = { |
@@ -398,6 +426,10 @@ static void __init h3_init(void) | |||
398 | omap_cfg_reg(E19_1610_KBR4); | 426 | omap_cfg_reg(E19_1610_KBR4); |
399 | omap_cfg_reg(N19_1610_KBR5); | 427 | omap_cfg_reg(N19_1610_KBR5); |
400 | 428 | ||
429 | /* GPIO based LEDs */ | ||
430 | omap_cfg_reg(P18_1610_GPIO3); | ||
431 | omap_cfg_reg(MPUIO4); | ||
432 | |||
401 | smc91x_resources[1].start = gpio_to_irq(40); | 433 | smc91x_resources[1].start = gpio_to_irq(40); |
402 | smc91x_resources[1].end = gpio_to_irq(40); | 434 | smc91x_resources[1].end = gpio_to_irq(40); |
403 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 435 | 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 8784705edb60..7ee1c1eac356 100644 --- a/arch/arm/mach-omap1/board-osk.c +++ b/arch/arm/mach-omap1/board-osk.c | |||
@@ -380,10 +380,37 @@ static struct platform_device osk5912_lcd_device = { | |||
380 | .id = -1, | 380 | .id = -1, |
381 | }; | 381 | }; |
382 | 382 | ||
383 | static struct gpio_led mistral_gpio_led_pins[] = { | ||
384 | { | ||
385 | .name = "mistral:red", | ||
386 | .default_trigger = "heartbeat", | ||
387 | .gpio = 3, | ||
388 | }, | ||
389 | { | ||
390 | .name = "mistral:green", | ||
391 | .default_trigger = "cpu0", | ||
392 | .gpio = OMAP_MPUIO(4), | ||
393 | }, | ||
394 | }; | ||
395 | |||
396 | static struct gpio_led_platform_data mistral_gpio_led_data = { | ||
397 | .leds = mistral_gpio_led_pins, | ||
398 | .num_leds = ARRAY_SIZE(mistral_gpio_led_pins), | ||
399 | }; | ||
400 | |||
401 | static struct platform_device mistral_gpio_leds = { | ||
402 | .name = "leds-gpio", | ||
403 | .id = -1, | ||
404 | .dev = { | ||
405 | .platform_data = &mistral_gpio_led_data, | ||
406 | }, | ||
407 | }; | ||
408 | |||
383 | static struct platform_device *mistral_devices[] __initdata = { | 409 | static struct platform_device *mistral_devices[] __initdata = { |
384 | &osk5912_kp_device, | 410 | &osk5912_kp_device, |
385 | &mistral_bl_device, | 411 | &mistral_bl_device, |
386 | &osk5912_lcd_device, | 412 | &osk5912_lcd_device, |
413 | &mistral_gpio_leds, | ||
387 | }; | 414 | }; |
388 | 415 | ||
389 | static int mistral_get_pendown_state(void) | 416 | static int mistral_get_pendown_state(void) |
@@ -508,6 +535,12 @@ static void __init osk_mistral_init(void) | |||
508 | if (gpio_request(2, "lcd_pwr") == 0) | 535 | if (gpio_request(2, "lcd_pwr") == 0) |
509 | gpio_direction_output(2, 1); | 536 | gpio_direction_output(2, 1); |
510 | 537 | ||
538 | /* | ||
539 | * GPIO based LEDs | ||
540 | */ | ||
541 | omap_cfg_reg(P18_1610_GPIO3); | ||
542 | omap_cfg_reg(MPUIO4); | ||
543 | |||
511 | i2c_register_board_info(1, mistral_i2c_board_info, | 544 | i2c_register_board_info(1, mistral_i2c_board_info, |
512 | ARRAY_SIZE(mistral_i2c_board_info)); | 545 | ARRAY_SIZE(mistral_i2c_board_info)); |
513 | 546 | ||
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 f6b14a14a957..000000000000 --- a/arch/arm/mach-omap1/leds-h2p2-debug.c +++ /dev/null | |||
@@ -1,166 +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 | |||
18 | #include <mach/hardware.h> | ||
19 | #include <asm/leds.h> | ||
20 | #include <asm/mach-types.h> | ||
21 | |||
22 | #include <plat/fpga.h> | ||
23 | |||
24 | #include "leds.h" | ||
25 | |||
26 | |||
27 | #define GPIO_LED_RED 3 | ||
28 | #define GPIO_LED_GREEN OMAP_MPUIO(4) | ||
29 | |||
30 | |||
31 | #define LED_STATE_ENABLED 0x01 | ||
32 | #define LED_STATE_CLAIMED 0x02 | ||
33 | #define LED_TIMER_ON 0x04 | ||
34 | |||
35 | #define GPIO_IDLE GPIO_LED_GREEN | ||
36 | #define GPIO_TIMER GPIO_LED_RED | ||
37 | |||
38 | |||
39 | void h2p2_dbg_leds_event(led_event_t evt) | ||
40 | { | ||
41 | unsigned long flags; | ||
42 | |||
43 | static struct h2p2_dbg_fpga __iomem *fpga; | ||
44 | static u16 led_state, hw_led_state; | ||
45 | |||
46 | local_irq_save(flags); | ||
47 | |||
48 | if (!(led_state & LED_STATE_ENABLED) && evt != led_start) | ||
49 | goto done; | ||
50 | |||
51 | switch (evt) { | ||
52 | case led_start: | ||
53 | if (!fpga) | ||
54 | fpga = ioremap(H2P2_DBG_FPGA_START, | ||
55 | H2P2_DBG_FPGA_SIZE); | ||
56 | if (fpga) { | ||
57 | led_state |= LED_STATE_ENABLED; | ||
58 | __raw_writew(~0, &fpga->leds); | ||
59 | } | ||
60 | break; | ||
61 | |||
62 | case led_stop: | ||
63 | case led_halted: | ||
64 | /* all leds off during suspend or shutdown */ | ||
65 | |||
66 | if (! machine_is_omap_perseus2()) { | ||
67 | gpio_set_value(GPIO_TIMER, 0); | ||
68 | gpio_set_value(GPIO_IDLE, 0); | ||
69 | } | ||
70 | |||
71 | __raw_writew(~0, &fpga->leds); | ||
72 | led_state &= ~LED_STATE_ENABLED; | ||
73 | if (evt == led_halted) { | ||
74 | iounmap(fpga); | ||
75 | fpga = NULL; | ||
76 | } | ||
77 | |||
78 | goto done; | ||
79 | |||
80 | case led_claim: | ||
81 | led_state |= LED_STATE_CLAIMED; | ||
82 | hw_led_state = 0; | ||
83 | break; | ||
84 | |||
85 | case led_release: | ||
86 | led_state &= ~LED_STATE_CLAIMED; | ||
87 | break; | ||
88 | |||
89 | #ifdef CONFIG_LEDS_TIMER | ||
90 | case led_timer: | ||
91 | led_state ^= LED_TIMER_ON; | ||
92 | |||
93 | if (machine_is_omap_perseus2()) | ||
94 | hw_led_state ^= H2P2_DBG_FPGA_P2_LED_TIMER; | ||
95 | else { | ||
96 | gpio_set_value(GPIO_TIMER, led_state & LED_TIMER_ON); | ||
97 | goto done; | ||
98 | } | ||
99 | |||
100 | break; | ||
101 | #endif | ||
102 | |||
103 | #ifdef CONFIG_LEDS_CPU | ||
104 | case led_idle_start: | ||
105 | if (machine_is_omap_perseus2()) | ||
106 | hw_led_state |= H2P2_DBG_FPGA_P2_LED_IDLE; | ||
107 | else { | ||
108 | gpio_set_value(GPIO_IDLE, 1); | ||
109 | goto done; | ||
110 | } | ||
111 | |||
112 | break; | ||
113 | |||
114 | case led_idle_end: | ||
115 | if (machine_is_omap_perseus2()) | ||
116 | hw_led_state &= ~H2P2_DBG_FPGA_P2_LED_IDLE; | ||
117 | else { | ||
118 | gpio_set_value(GPIO_IDLE, 0); | ||
119 | goto done; | ||
120 | } | ||
121 | |||
122 | break; | ||
123 | #endif | ||
124 | |||
125 | case led_green_on: | ||
126 | hw_led_state |= H2P2_DBG_FPGA_LED_GREEN; | ||
127 | break; | ||
128 | case led_green_off: | ||
129 | hw_led_state &= ~H2P2_DBG_FPGA_LED_GREEN; | ||
130 | break; | ||
131 | |||
132 | case led_amber_on: | ||
133 | hw_led_state |= H2P2_DBG_FPGA_LED_AMBER; | ||
134 | break; | ||
135 | case led_amber_off: | ||
136 | hw_led_state &= ~H2P2_DBG_FPGA_LED_AMBER; | ||
137 | break; | ||
138 | |||
139 | case led_red_on: | ||
140 | hw_led_state |= H2P2_DBG_FPGA_LED_RED; | ||
141 | break; | ||
142 | case led_red_off: | ||
143 | hw_led_state &= ~H2P2_DBG_FPGA_LED_RED; | ||
144 | break; | ||
145 | |||
146 | case led_blue_on: | ||
147 | hw_led_state |= H2P2_DBG_FPGA_LED_BLUE; | ||
148 | break; | ||
149 | case led_blue_off: | ||
150 | hw_led_state &= ~H2P2_DBG_FPGA_LED_BLUE; | ||
151 | break; | ||
152 | |||
153 | default: | ||
154 | break; | ||
155 | } | ||
156 | |||
157 | |||
158 | /* | ||
159 | * Actually burn the LEDs | ||
160 | */ | ||
161 | if (led_state & LED_STATE_ENABLED) | ||
162 | __raw_writew(~hw_led_state, &fpga->leds); | ||
163 | |||
164 | done: | ||
165 | local_irq_restore(flags); | ||
166 | } | ||
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 | |||
15 | static unsigned int led_state; | ||
16 | static unsigned int hw_led_state; | ||
17 | |||
18 | void 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) | ||
17 | static u8 led_state; | ||
18 | |||
19 | #define TIMER_LED (1 << 3) /* Mistral board */ | ||
20 | #define IDLE_LED (1 << 4) /* Mistral board */ | ||
21 | static 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 | |||
34 | static 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 | |||
51 | void 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 | |||
111 | done: | ||
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 ae6dd93b8ddc..000000000000 --- a/arch/arm/mach-omap1/leds.c +++ /dev/null | |||
@@ -1,69 +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 | |||
10 | #include <asm/leds.h> | ||
11 | #include <asm/mach-types.h> | ||
12 | |||
13 | #include <plat/mux.h> | ||
14 | |||
15 | #include "leds.h" | ||
16 | |||
17 | static int __init | ||
18 | omap_leds_init(void) | ||
19 | { | ||
20 | if (!cpu_class_is_omap1()) | ||
21 | return -ENODEV; | ||
22 | |||
23 | if (machine_is_omap_innovator()) | ||
24 | leds_event = innovator_leds_event; | ||
25 | |||
26 | else if (machine_is_omap_h2() | ||
27 | || machine_is_omap_h3() | ||
28 | || machine_is_omap_perseus2()) | ||
29 | leds_event = h2p2_dbg_leds_event; | ||
30 | |||
31 | else if (machine_is_omap_osk()) | ||
32 | leds_event = osk_leds_event; | ||
33 | |||
34 | else | ||
35 | return -1; | ||
36 | |||
37 | if (machine_is_omap_h2() | ||
38 | || machine_is_omap_h3() | ||
39 | #ifdef CONFIG_OMAP_OSK_MISTRAL | ||
40 | || machine_is_omap_osk() | ||
41 | #endif | ||
42 | ) { | ||
43 | |||
44 | /* LED1/LED2 pins can be used as GPIO (as done here), or by | ||
45 | * the LPG (works even in deep sleep!), to drive a bicolor | ||
46 | * LED on the H2 sample board, and another on the H2/P2 | ||
47 | * "surfer" expansion board. | ||
48 | * | ||
49 | * The same pins drive a LED on the OSK Mistral board, but | ||
50 | * that's a different kind of LED (just one color at a time). | ||
51 | */ | ||
52 | omap_cfg_reg(P18_1610_GPIO3); | ||
53 | if (gpio_request(3, "LED red") == 0) | ||
54 | gpio_direction_output(3, 1); | ||
55 | else | ||
56 | printk(KERN_WARNING "LED: can't get GPIO3/red?\n"); | ||
57 | |||
58 | omap_cfg_reg(MPUIO4); | ||
59 | if (gpio_request(OMAP_MPUIO(4), "LED green") == 0) | ||
60 | gpio_direction_output(OMAP_MPUIO(4), 1); | ||
61 | else | ||
62 | printk(KERN_WARNING "LED: can't get MPUIO4/green?\n"); | ||
63 | } | ||
64 | |||
65 | leds_event(led_start); | ||
66 | return 0; | ||
67 | } | ||
68 | |||
69 | __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 @@ | |||
1 | extern void innovator_leds_event(led_event_t evt); | ||
2 | extern void h2p2_dbg_leds_event(led_event_t evt); | ||
3 | extern 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-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 | ||
92 | static 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 | |||
106 | static 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) { | 86 | static 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); | 94 | static 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 | 99 | static 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-pnx4008/time.c b/arch/arm/mach-pnx4008/time.c index 0cfe8af3d3be..47a7ae96156a 100644 --- a/arch/arm/mach-pnx4008/time.c +++ b/arch/arm/mach-pnx4008/time.c | |||
@@ -25,7 +25,6 @@ | |||
25 | #include <linux/io.h> | 25 | #include <linux/io.h> |
26 | 26 | ||
27 | #include <mach/hardware.h> | 27 | #include <mach/hardware.h> |
28 | #include <asm/leds.h> | ||
29 | #include <asm/mach/time.h> | 28 | #include <asm/mach/time.h> |
30 | #include <asm/errno.h> | 29 | #include <asm/errno.h> |
31 | 30 | ||
diff --git a/arch/arm/mach-pxa/Makefile b/arch/arm/mach-pxa/Makefile index be0f7df8685c..d4337e300ada 100644 --- a/arch/arm/mach-pxa/Makefile +++ b/arch/arm/mach-pxa/Makefile | |||
@@ -95,12 +95,4 @@ obj-$(CONFIG_MACH_RAUMFELD_CONNECTOR) += raumfeld.o | |||
95 | obj-$(CONFIG_MACH_RAUMFELD_SPEAKER) += raumfeld.o | 95 | obj-$(CONFIG_MACH_RAUMFELD_SPEAKER) += raumfeld.o |
96 | obj-$(CONFIG_MACH_ZIPIT2) += z2.o | 96 | obj-$(CONFIG_MACH_ZIPIT2) += z2.o |
97 | 97 | ||
98 | # Support for blinky lights | ||
99 | led-y := leds.o | ||
100 | led-$(CONFIG_ARCH_LUBBOCK) += leds-lubbock.o | ||
101 | led-$(CONFIG_MACH_MAINSTONE) += leds-mainstone.o | ||
102 | led-$(CONFIG_ARCH_PXA_IDP) += leds-idp.o | ||
103 | |||
104 | obj-$(CONFIG_LEDS) += $(led-y) | ||
105 | |||
106 | obj-$(CONFIG_TOSA_BT) += tosa-bt.o | 98 | obj-$(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) | ||
196 | struct 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 | */ | ||
205 | static const struct { | ||
206 | const char *name; | ||
207 | const char *trigger; | ||
208 | } idp_leds[] = { | ||
209 | { "idp:green", "heartbeat", }, | ||
210 | { "idp:red", "cpu0", }, | ||
211 | }; | ||
212 | |||
213 | static 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 | |||
228 | static 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 | |||
236 | static 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 | */ | ||
273 | fs_initcall(idp_leds_init); | ||
274 | #endif | ||
194 | 275 | ||
195 | MACHINE_START(PXA_IDP, "Vibren PXA255 IDP") | 276 | MACHINE_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 | |||
28 | static unsigned int led_state; | ||
29 | static unsigned int hw_led_state; | ||
30 | |||
31 | void 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 | |||
42 | static unsigned int led_state; | ||
43 | static unsigned int hw_led_state; | ||
44 | |||
45 | void 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 | |||
37 | static unsigned int led_state; | ||
38 | static unsigned int hw_led_state; | ||
39 | |||
40 | void 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 | |||
18 | static int __init | ||
19 | pxa_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 | |||
32 | core_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 | |||
10 | extern void idp_leds_event(led_event_t evt); | ||
11 | extern void lubbock_leds_event(led_event_t evt); | ||
12 | extern void mainstone_leds_event(led_event_t evt); | ||
13 | extern 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) | ||
562 | struct 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 | */ | ||
571 | static 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 | |||
585 | static 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 | |||
600 | static 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 | |||
609 | static 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 | */ | ||
644 | fs_initcall(lubbock_leds_init); | ||
645 | #endif | ||
646 | |||
552 | MACHINE_START(LUBBOCK, "Intel DBPXA250 Development Platform (aka Lubbock)") | 647 | MACHINE_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) | ||
625 | struct 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 | */ | ||
634 | static 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 | |||
648 | static 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 | |||
663 | static 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 | |||
672 | static 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 | */ | ||
707 | fs_initcall(mainstone_leds_init); | ||
708 | #endif | ||
709 | |||
616 | MACHINE_START(MAINSTONE, "Intel HCDDBBVA0 Development Platform (aka Mainstone)") | 710 | MACHINE_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 45868bb43cbd..d22dee96484d 100644 --- a/arch/arm/mach-realview/core.c +++ b/arch/arm/mach-realview/core.c | |||
@@ -35,7 +35,6 @@ | |||
35 | 35 | ||
36 | #include <mach/hardware.h> | 36 | #include <mach/hardware.h> |
37 | #include <asm/irq.h> | 37 | #include <asm/irq.h> |
38 | #include <asm/leds.h> | ||
39 | #include <asm/mach-types.h> | 38 | #include <asm/mach-types.h> |
40 | #include <asm/hardware/arm_timer.h> | 39 | #include <asm/hardware/arm_timer.h> |
41 | #include <asm/hardware/icst.h> | 40 | #include <asm/hardware/icst.h> |
@@ -436,44 +435,6 @@ struct clcd_board clcd_plat_data = { | |||
436 | .remove = versatile_clcd_remove_dma, | 435 | .remove = versatile_clcd_remove_dma, |
437 | }; | 436 | }; |
438 | 437 | ||
439 | #ifdef CONFIG_LEDS | ||
440 | #define VA_LEDS_BASE (__io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_LED_OFFSET) | ||
441 | |||
442 | void realview_leds_event(led_event_t ledevt) | ||
443 | { | ||
444 | unsigned long flags; | ||
445 | u32 val; | ||
446 | u32 led = 1 << smp_processor_id(); | ||
447 | |||
448 | local_irq_save(flags); | ||
449 | val = readl(VA_LEDS_BASE); | ||
450 | |||
451 | switch (ledevt) { | ||
452 | case led_idle_start: | ||
453 | val = val & ~led; | ||
454 | break; | ||
455 | |||
456 | case led_idle_end: | ||
457 | val = val | led; | ||
458 | break; | ||
459 | |||
460 | case led_timer: | ||
461 | val = val ^ REALVIEW_SYS_LED7; | ||
462 | break; | ||
463 | |||
464 | case led_halted: | ||
465 | val = 0; | ||
466 | break; | ||
467 | |||
468 | default: | ||
469 | break; | ||
470 | } | ||
471 | |||
472 | writel(val, VA_LEDS_BASE); | ||
473 | local_irq_restore(flags); | ||
474 | } | ||
475 | #endif /* CONFIG_LEDS */ | ||
476 | |||
477 | /* | 438 | /* |
478 | * Where is the timer (VA)? | 439 | * Where is the timer (VA)? |
479 | */ | 440 | */ |
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) \ |
32 | static AMBA_APB_DEVICE(name, busid, 0, REALVIEW_##base##_BASE, base##_IRQ, plat) | 31 | static AMBA_APB_DEVICE(name, busid, 0, REALVIEW_##base##_BASE, base##_IRQ, plat) |
@@ -47,7 +46,6 @@ extern void __iomem *timer1_va_base; | |||
47 | extern void __iomem *timer2_va_base; | 46 | extern void __iomem *timer2_va_base; |
48 | extern void __iomem *timer3_va_base; | 47 | extern void __iomem *timer3_va_base; |
49 | 48 | ||
50 | extern void realview_leds_event(led_event_t ledevt); | ||
51 | extern void realview_timer_init(unsigned int timer_irq); | 49 | extern void realview_timer_init(unsigned int timer_irq); |
52 | extern int realview_flash_register(struct resource *res, u32 num); | 50 | extern int realview_flash_register(struct resource *res, u32 num); |
53 | extern int realview_eth_register(const char *name, struct resource *res); | 51 | extern 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 baf382c5e776..21661ade885f 100644 --- a/arch/arm/mach-realview/realview_eb.c +++ b/arch/arm/mach-realview/realview_eb.c | |||
@@ -30,7 +30,6 @@ | |||
30 | 30 | ||
31 | #include <mach/hardware.h> | 31 | #include <mach/hardware.h> |
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/pmu.h> | 34 | #include <asm/pmu.h> |
36 | #include <asm/pgtable.h> | 35 | #include <asm/pgtable.h> |
@@ -462,10 +461,6 @@ static void __init realview_eb_init(void) | |||
462 | struct amba_device *d = amba_devs[i]; | 461 | struct amba_device *d = amba_devs[i]; |
463 | amba_device_register(d, &iomem_resource); | 462 | amba_device_register(d, &iomem_resource); |
464 | } | 463 | } |
465 | |||
466 | #ifdef CONFIG_LEDS | ||
467 | leds_event = realview_leds_event; | ||
468 | #endif | ||
469 | } | 464 | } |
470 | 465 | ||
471 | MACHINE_START(REALVIEW_EB, "ARM-RealView EB") | 466 | MACHINE_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 b1d7cafa1a6d..c0ff882c5cb8 100644 --- a/arch/arm/mach-realview/realview_pb1176.c +++ b/arch/arm/mach-realview/realview_pb1176.c | |||
@@ -32,7 +32,6 @@ | |||
32 | 32 | ||
33 | #include <mach/hardware.h> | 33 | #include <mach/hardware.h> |
34 | #include <asm/irq.h> | 34 | #include <asm/irq.h> |
35 | #include <asm/leds.h> | ||
36 | #include <asm/mach-types.h> | 35 | #include <asm/mach-types.h> |
37 | #include <asm/pmu.h> | 36 | #include <asm/pmu.h> |
38 | #include <asm/pgtable.h> | 37 | #include <asm/pgtable.h> |
@@ -375,10 +374,6 @@ static void __init realview_pb1176_init(void) | |||
375 | struct amba_device *d = amba_devs[i]; | 374 | struct amba_device *d = amba_devs[i]; |
376 | amba_device_register(d, &iomem_resource); | 375 | amba_device_register(d, &iomem_resource); |
377 | } | 376 | } |
378 | |||
379 | #ifdef CONFIG_LEDS | ||
380 | leds_event = realview_leds_event; | ||
381 | #endif | ||
382 | } | 377 | } |
383 | 378 | ||
384 | MACHINE_START(REALVIEW_PB1176, "ARM-RealView PB1176") | 379 | MACHINE_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 a98c536e3327..30779ae40c04 100644 --- a/arch/arm/mach-realview/realview_pb11mp.c +++ b/arch/arm/mach-realview/realview_pb11mp.c | |||
@@ -30,7 +30,6 @@ | |||
30 | 30 | ||
31 | #include <mach/hardware.h> | 31 | #include <mach/hardware.h> |
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/pmu.h> | 34 | #include <asm/pmu.h> |
36 | #include <asm/pgtable.h> | 35 | #include <asm/pgtable.h> |
@@ -357,10 +356,6 @@ static void __init realview_pb11mp_init(void) | |||
357 | struct amba_device *d = amba_devs[i]; | 356 | struct amba_device *d = amba_devs[i]; |
358 | amba_device_register(d, &iomem_resource); | 357 | amba_device_register(d, &iomem_resource); |
359 | } | 358 | } |
360 | |||
361 | #ifdef CONFIG_LEDS | ||
362 | leds_event = realview_leds_event; | ||
363 | #endif | ||
364 | } | 359 | } |
365 | 360 | ||
366 | MACHINE_START(REALVIEW_PB11MP, "ARM-RealView PB11MPCore") | 361 | MACHINE_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 59650174e6ed..081cd72c090e 100644 --- a/arch/arm/mach-realview/realview_pba8.c +++ b/arch/arm/mach-realview/realview_pba8.c | |||
@@ -29,7 +29,6 @@ | |||
29 | #include <linux/io.h> | 29 | #include <linux/io.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/pmu.h> | 33 | #include <asm/pmu.h> |
35 | #include <asm/pgtable.h> | 34 | #include <asm/pgtable.h> |
@@ -299,10 +298,6 @@ static void __init realview_pba8_init(void) | |||
299 | struct amba_device *d = amba_devs[i]; | 298 | struct amba_device *d = amba_devs[i]; |
300 | amba_device_register(d, &iomem_resource); | 299 | amba_device_register(d, &iomem_resource); |
301 | } | 300 | } |
302 | |||
303 | #ifdef CONFIG_LEDS | ||
304 | leds_event = realview_leds_event; | ||
305 | #endif | ||
306 | } | 301 | } |
307 | 302 | ||
308 | MACHINE_START(REALVIEW_PBA8, "ARM-RealView PB-A8") | 303 | MACHINE_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 3f2f605624e9..1ce62b9f846c 100644 --- a/arch/arm/mach-realview/realview_pbx.c +++ b/arch/arm/mach-realview/realview_pbx.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #include <linux/io.h> | 28 | #include <linux/io.h> |
29 | 29 | ||
30 | #include <asm/irq.h> | 30 | #include <asm/irq.h> |
31 | #include <asm/leds.h> | ||
32 | #include <asm/mach-types.h> | 31 | #include <asm/mach-types.h> |
33 | #include <asm/pmu.h> | 32 | #include <asm/pmu.h> |
34 | #include <asm/smp_twd.h> | 33 | #include <asm/smp_twd.h> |
@@ -394,10 +393,6 @@ static void __init realview_pbx_init(void) | |||
394 | struct amba_device *d = amba_devs[i]; | 393 | struct amba_device *d = amba_devs[i]; |
395 | amba_device_register(d, &iomem_resource); | 394 | amba_device_register(d, &iomem_resource); |
396 | } | 395 | } |
397 | |||
398 | #ifdef CONFIG_LEDS | ||
399 | leds_event = realview_leds_event; | ||
400 | #endif | ||
401 | } | 396 | } |
402 | 397 | ||
403 | MACHINE_START(REALVIEW_PBX, "ARM-RealView PBX") | 398 | MACHINE_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 | |||
7 | obj-m := | 7 | obj-m := |
8 | obj-n := | 8 | obj-n := |
9 | obj- := | 9 | obj- := |
10 | led-y := leds.o | ||
11 | 10 | ||
12 | obj-$(CONFIG_CPU_FREQ_SA1100) += cpu-sa1100.o | 11 | obj-$(CONFIG_CPU_FREQ_SA1100) += cpu-sa1100.o |
13 | obj-$(CONFIG_CPU_FREQ_SA1110) += cpu-sa1110.o | 12 | obj-$(CONFIG_CPU_FREQ_SA1110) += cpu-sa1110.o |
14 | 13 | ||
15 | # Specific board support | 14 | # Specific board support |
16 | obj-$(CONFIG_SA1100_ASSABET) += assabet.o | 15 | obj-$(CONFIG_SA1100_ASSABET) += assabet.o |
17 | led-$(CONFIG_SA1100_ASSABET) += leds-assabet.o | ||
18 | obj-$(CONFIG_ASSABET_NEPONSET) += neponset.o | 16 | obj-$(CONFIG_ASSABET_NEPONSET) += neponset.o |
19 | 17 | ||
20 | obj-$(CONFIG_SA1100_BADGE4) += badge4.o | 18 | obj-$(CONFIG_SA1100_BADGE4) += badge4.o |
21 | led-$(CONFIG_SA1100_BADGE4) += leds-badge4.o | ||
22 | 19 | ||
23 | obj-$(CONFIG_SA1100_CERF) += cerf.o | 20 | obj-$(CONFIG_SA1100_CERF) += cerf.o |
24 | led-$(CONFIG_SA1100_CERF) += leds-cerf.o | ||
25 | 21 | ||
26 | obj-$(CONFIG_SA1100_COLLIE) += collie.o | 22 | obj-$(CONFIG_SA1100_COLLIE) += collie.o |
27 | 23 | ||
@@ -29,13 +25,11 @@ obj-$(CONFIG_SA1100_H3100) += h3100.o h3xxx.o | |||
29 | obj-$(CONFIG_SA1100_H3600) += h3600.o h3xxx.o | 25 | obj-$(CONFIG_SA1100_H3600) += h3600.o h3xxx.o |
30 | 26 | ||
31 | obj-$(CONFIG_SA1100_HACKKIT) += hackkit.o | 27 | obj-$(CONFIG_SA1100_HACKKIT) += hackkit.o |
32 | led-$(CONFIG_SA1100_HACKKIT) += leds-hackkit.o | ||
33 | 28 | ||
34 | obj-$(CONFIG_SA1100_JORNADA720) += jornada720.o | 29 | obj-$(CONFIG_SA1100_JORNADA720) += jornada720.o |
35 | obj-$(CONFIG_SA1100_JORNADA720_SSP) += jornada720_ssp.o | 30 | obj-$(CONFIG_SA1100_JORNADA720_SSP) += jornada720_ssp.o |
36 | 31 | ||
37 | obj-$(CONFIG_SA1100_LART) += lart.o | 32 | obj-$(CONFIG_SA1100_LART) += lart.o |
38 | led-$(CONFIG_SA1100_LART) += leds-lart.o | ||
39 | 33 | ||
40 | obj-$(CONFIG_SA1100_NANOENGINE) += nanoengine.o | 34 | obj-$(CONFIG_SA1100_NANOENGINE) += nanoengine.o |
41 | obj-$(CONFIG_PCI_NANOENGINE) += pci-nanoengine.o | 35 | obj-$(CONFIG_PCI_NANOENGINE) += pci-nanoengine.o |
@@ -46,9 +40,6 @@ obj-$(CONFIG_SA1100_SHANNON) += shannon.o | |||
46 | 40 | ||
47 | obj-$(CONFIG_SA1100_SIMPAD) += simpad.o | 41 | obj-$(CONFIG_SA1100_SIMPAD) += simpad.o |
48 | 42 | ||
49 | # LEDs support | ||
50 | obj-$(CONFIG_LEDS) += $(led-y) | ||
51 | |||
52 | # Miscellaneous functions | 43 | # Miscellaneous functions |
53 | obj-$(CONFIG_PM) += pm.o sleep.o | 44 | obj-$(CONFIG_PM) += pm.o sleep.o |
54 | obj-$(CONFIG_SA1100_SSP) += ssp.o | 45 | obj-$(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) | ||
536 | struct 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 | */ | ||
545 | static 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 | */ | ||
558 | static 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 | |||
570 | static 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 | |||
578 | static 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 | */ | ||
615 | fs_initcall(assabet_leds_init); | ||
616 | #endif | ||
532 | 617 | ||
533 | MACHINE_START(ASSABET, "Intel-Assabet") | 618 | MACHINE_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 */ | ||
82 | struct 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 | |||
95 | static struct gpio_led_platform_data badge4_gpio_led_info = { | ||
96 | .leds = badge4_gpio_leds, | ||
97 | .num_leds = ARRAY_SIZE(badge4_gpio_leds), | ||
98 | }; | ||
99 | |||
100 | static struct platform_device badge4_leds = { | ||
101 | .name = "leds-gpio", | ||
102 | .id = -1, | ||
103 | .dev = { | ||
104 | .platform_data = &badge4_gpio_led_info, | ||
105 | } | ||
106 | }; | ||
107 | |||
79 | static struct platform_device *devices[] __initdata = { | 108 | static struct platform_device *devices[] __initdata = { |
80 | &sa1111_device, | 109 | &sa1111_device, |
110 | &badge4_leds, | ||
81 | }; | 111 | }; |
82 | 112 | ||
83 | static int __init badge4_sa1111_init(void) | 113 | static 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 */ | ||
49 | struct 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 | |||
73 | static struct gpio_led_platform_data cerf_gpio_led_info = { | ||
74 | .leds = cerf_gpio_leds, | ||
75 | .num_leds = ARRAY_SIZE(cerf_gpio_leds), | ||
76 | }; | ||
77 | |||
78 | static 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 | |||
46 | static struct platform_device *cerf_devices[] __initdata = { | 87 | static 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 = { | |||
183 | static struct resource hackkit_flash_resource = | 187 | static 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 */ | ||
191 | struct 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 | |||
204 | static struct gpio_led_platform_data hackkit_gpio_led_info = { | ||
205 | .leds = hackkit_gpio_leds, | ||
206 | .num_leds = ARRAY_SIZE(hackkit_gpio_leds), | ||
207 | }; | ||
208 | |||
209 | static struct platform_device hackkit_leds = { | ||
210 | .name = "leds-gpio", | ||
211 | .id = -1, | ||
212 | .dev = { | ||
213 | .platform_data = &hackkit_gpio_led_info, | ||
214 | } | ||
215 | }; | ||
216 | |||
186 | static void __init hackkit_init(void) | 217 | static 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 */ | ||
133 | struct gpio_led lart_gpio_leds[] = { | ||
134 | { | ||
135 | .name = "lart:red", | ||
136 | .default_trigger = "cpu0", | ||
137 | .gpio = 23, | ||
138 | }, | ||
139 | }; | ||
140 | |||
141 | static struct gpio_led_platform_data lart_gpio_led_info = { | ||
142 | .leds = lart_gpio_leds, | ||
143 | .num_leds = ARRAY_SIZE(lart_gpio_leds), | ||
144 | }; | ||
145 | |||
146 | static struct platform_device lart_leds = { | ||
147 | .name = "leds-gpio", | ||
148 | .id = -1, | ||
149 | .dev = { | ||
150 | .platform_data = &lart_gpio_led_info, | ||
151 | } | ||
152 | }; | ||
129 | static void __init lart_map_io(void) | 153 | static 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 | ||
144 | MACHINE_START(LART, "LART") | 170 | MACHINE_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 | |||
24 | static unsigned int led_state; | ||
25 | static unsigned int hw_led_state; | ||
26 | |||
27 | #define ASSABET_BCR_LED_MASK (ASSABET_BCR_LED_GREEN | ASSABET_BCR_LED_RED) | ||
28 | |||
29 | void 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 | |||
23 | static unsigned int led_state; | ||
24 | static 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 | |||
33 | void 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 | |||
18 | static unsigned int led_state; | ||
19 | static 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 | |||
27 | void 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 | |||
24 | static unsigned int led_state; | ||
25 | static 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 | |||
31 | void 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 | |||
24 | static unsigned int led_state; | ||
25 | static unsigned int hw_led_state; | ||
26 | |||
27 | #define LED_23 GPIO_GPIO23 | ||
28 | #define LED_MASK (LED_23) | ||
29 | |||
30 | void 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 | |||
16 | static int __init | ||
17 | sa1100_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 | |||
50 | core_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 @@ | |||
1 | extern void assabet_leds_event(led_event_t evt); | ||
2 | extern void badge4_leds_event(led_event_t evt); | ||
3 | extern void consus_leds_event(led_event_t evt); | ||
4 | extern void brutus_leds_event(led_event_t evt); | ||
5 | extern void cerf_leds_event(led_event_t evt); | ||
6 | extern void flexanet_leds_event(led_event_t evt); | ||
7 | extern void graphicsclient_leds_event(led_event_t evt); | ||
8 | extern void hackkit_leds_event(led_event_t evt); | ||
9 | extern void lart_leds_event(led_event_t evt); | ||
10 | extern void pfs168_leds_event(led_event_t evt); | ||
11 | extern void graphicsmaster_leds_event(led_event_t evt); | ||
12 | extern void adsbitsy_leds_event(led_event_t evt); | ||
13 | extern 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 | ||
7 | obj-y := core.o dma.o irq.o pci.o | 7 | obj-y := core.o dma.o irq.o pci.o leds.o |
8 | obj-m := | 8 | obj-m := |
9 | obj-n := | 9 | obj-n := |
10 | obj- := | 10 | obj- := |
11 | |||
12 | obj-$(CONFIG_LEDS) += leds.o | ||
diff --git a/arch/arm/mach-shark/core.c b/arch/arm/mach-shark/core.c index 2704bcd869cd..c709979ee751 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 | 20 | struct 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 | */ | ||
29 | static 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 | |||
38 | static u16 led_reg_read(void) | ||
39 | { | ||
40 | outw(0x09, 0x24); | ||
41 | return inw(0x26); | ||
42 | } | ||
33 | 43 | ||
34 | static char led_state; | 44 | static void led_reg_write(u16 value) |
35 | static short hw_led_state; | 45 | { |
36 | static short saved_state; | 46 | outw(0x09, 0x24); |
47 | outw(value, 0x26); | ||
48 | } | ||
37 | 49 | ||
38 | static DEFINE_RAW_SPINLOCK(leds_lock); | 50 | static 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 | ||
40 | short 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 | ||
45 | void sequoia_write(short value,short addr) { | 62 | led_reg_write(reg); |
46 | outw(addr,0x24); | ||
47 | outw(value,0x26); | ||
48 | } | 63 | } |
49 | 64 | ||
50 | static void sequoia_leds_event(led_event_t evt) | 65 | static 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) { | 74 | static 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 | ||
149 | static 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 | */ | ||
116 | fs_initcall(shark_leds_init); | ||
117 | #endif | ||
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c index cd8ea3588f93..855ca02581e8 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> |
@@ -763,10 +762,6 @@ void __init versatile_init(void) | |||
763 | struct amba_device *d = amba_devs[i]; | 762 | struct amba_device *d = amba_devs[i]; |
764 | amba_device_register(d, &iomem_resource); | 763 | amba_device_register(d, &iomem_resource); |
765 | } | 764 | } |
766 | |||
767 | #ifdef CONFIG_LEDS | ||
768 | leds_event = versatile_leds_event; | ||
769 | #endif | ||
770 | } | 765 | } |
771 | 766 | ||
772 | /* | 767 | /* |
diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig index dd36eba9506c..13910baae228 100644 --- a/arch/arm/plat-omap/Kconfig +++ b/arch/arm/plat-omap/Kconfig | |||
@@ -41,9 +41,8 @@ config OMAP_DEBUG_DEVICES | |||
41 | For debug cards on TI reference boards. | 41 | For debug cards on TI reference boards. |
42 | 42 | ||
43 | config OMAP_DEBUG_LEDS | 43 | config OMAP_DEBUG_LEDS |
44 | bool | 44 | def_bool y if NEW_LEDS |
45 | depends on OMAP_DEBUG_DEVICES | 45 | depends on OMAP_DEBUG_DEVICES |
46 | default y if LEDS_CLASS | ||
47 | 46 | ||
48 | config POWER_AVS_OMAP | 47 | config POWER_AVS_OMAP |
49 | bool "AVS(Adaptive Voltage Scaling) support for OMAP IP versions 1&2" | 48 | 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 39407cbe34c6..24e23f3dd6a8 100644 --- a/arch/arm/plat-omap/debug-leds.c +++ b/arch/arm/plat-omap/debug-leds.c | |||
@@ -1,279 +1,118 @@ | |||
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> |
17 | #include <linux/slab.h> | ||
15 | 18 | ||
16 | #include <mach/hardware.h> | 19 | #include <mach/hardware.h> |
17 | #include <asm/leds.h> | ||
18 | #include <asm/mach-types.h> | 20 | #include <asm/mach-types.h> |
19 | 21 | ||
20 | #include <plat/fpga.h> | 22 | #include <plat/fpga.h> |
21 | 23 | ||
22 | |||
23 | /* Many OMAP development platforms reuse the same "debug board"; these | 24 | /* Many OMAP development platforms reuse the same "debug board"; these |
24 | * platforms include H2, H3, H4, and Perseus2. There are 16 LEDs on the | 25 | * platforms include H2, H3, H4, and Perseus2. There are 16 LEDs on the |
25 | * debug board (all green), accessed through FPGA registers. | 26 | * debug board (all green), accessed through FPGA registers. |
26 | * | ||
27 | * The "surfer" expansion board and H2 sample board also have two-color | ||
28 | * green+red LEDs (in parallel), used here for timer and idle indicators | ||
29 | * in preference to the ones on the debug board, for a "Disco LED" effect. | ||
30 | * | ||
31 | * This driver exports either the original ARM LED API, the new generic | ||
32 | * one, or both. | ||
33 | */ | ||
34 | |||
35 | static spinlock_t lock; | ||
36 | static struct h2p2_dbg_fpga __iomem *fpga; | ||
37 | static u16 led_state, hw_led_state; | ||
38 | |||
39 | |||
40 | #ifdef CONFIG_OMAP_DEBUG_LEDS | ||
41 | #define new_led_api() 1 | ||
42 | #else | ||
43 | #define new_led_api() 0 | ||
44 | #endif | ||
45 | |||
46 | |||
47 | /*-------------------------------------------------------------------------*/ | ||
48 | |||
49 | /* original ARM debug LED API: | ||
50 | * - timer and idle leds (some boards use non-FPGA leds here); | ||
51 | * - up to 4 generic leds, easily accessed in-kernel (any context) | ||
52 | */ | 27 | */ |
53 | 28 | ||
54 | #define GPIO_LED_RED 3 | 29 | static struct h2p2_dbg_fpga __iomem *fpga; |
55 | #define GPIO_LED_GREEN OMAP_MPUIO(4) | ||
56 | |||
57 | #define LED_STATE_ENABLED 0x01 | ||
58 | #define LED_STATE_CLAIMED 0x02 | ||
59 | #define LED_TIMER_ON 0x04 | ||
60 | |||
61 | #define GPIO_IDLE GPIO_LED_GREEN | ||
62 | #define GPIO_TIMER GPIO_LED_RED | ||
63 | |||
64 | static void h2p2_dbg_leds_event(led_event_t evt) | ||
65 | { | ||
66 | unsigned long flags; | ||
67 | |||
68 | spin_lock_irqsave(&lock, flags); | ||
69 | |||
70 | if (!(led_state & LED_STATE_ENABLED) && evt != led_start) | ||
71 | goto done; | ||
72 | |||
73 | switch (evt) { | ||
74 | case led_start: | ||
75 | if (fpga) | ||
76 | led_state |= LED_STATE_ENABLED; | ||
77 | break; | ||
78 | |||
79 | case led_stop: | ||
80 | case led_halted: | ||
81 | /* all leds off during suspend or shutdown */ | ||
82 | |||
83 | if (!(machine_is_omap_perseus2() || machine_is_omap_h4())) { | ||
84 | gpio_set_value(GPIO_TIMER, 0); | ||
85 | gpio_set_value(GPIO_IDLE, 0); | ||
86 | } | ||
87 | |||
88 | __raw_writew(~0, &fpga->leds); | ||
89 | led_state &= ~LED_STATE_ENABLED; | ||
90 | goto done; | ||
91 | |||
92 | case led_claim: | ||
93 | led_state |= LED_STATE_CLAIMED; | ||
94 | hw_led_state = 0; | ||
95 | break; | ||
96 | |||
97 | case led_release: | ||
98 | led_state &= ~LED_STATE_CLAIMED; | ||
99 | break; | ||
100 | |||
101 | #ifdef CONFIG_LEDS_TIMER | ||
102 | case led_timer: | ||
103 | led_state ^= LED_TIMER_ON; | ||
104 | |||
105 | if (machine_is_omap_perseus2() || machine_is_omap_h4()) | ||
106 | hw_led_state ^= H2P2_DBG_FPGA_P2_LED_TIMER; | ||
107 | else { | ||
108 | gpio_set_value(GPIO_TIMER, | ||
109 | led_state & LED_TIMER_ON); | ||
110 | goto done; | ||
111 | } | ||
112 | |||
113 | break; | ||
114 | #endif | ||
115 | |||
116 | #ifdef CONFIG_LEDS_CPU | ||
117 | /* LED lit iff busy */ | ||
118 | case led_idle_start: | ||
119 | if (machine_is_omap_perseus2() || machine_is_omap_h4()) | ||
120 | hw_led_state &= ~H2P2_DBG_FPGA_P2_LED_IDLE; | ||
121 | else { | ||
122 | gpio_set_value(GPIO_IDLE, 1); | ||
123 | goto done; | ||
124 | } | ||
125 | |||
126 | break; | ||
127 | 30 | ||
128 | case led_idle_end: | 31 | static u16 fpga_led_state; |
129 | if (machine_is_omap_perseus2() || machine_is_omap_h4()) | ||
130 | hw_led_state |= H2P2_DBG_FPGA_P2_LED_IDLE; | ||
131 | else { | ||
132 | gpio_set_value(GPIO_IDLE, 0); | ||
133 | goto done; | ||
134 | } | ||
135 | |||
136 | break; | ||
137 | #endif | ||
138 | |||
139 | case led_green_on: | ||
140 | hw_led_state |= H2P2_DBG_FPGA_LED_GREEN; | ||
141 | break; | ||
142 | case led_green_off: | ||
143 | hw_led_state &= ~H2P2_DBG_FPGA_LED_GREEN; | ||
144 | break; | ||
145 | |||
146 | case led_amber_on: | ||
147 | hw_led_state |= H2P2_DBG_FPGA_LED_AMBER; | ||
148 | break; | ||
149 | case led_amber_off: | ||
150 | hw_led_state &= ~H2P2_DBG_FPGA_LED_AMBER; | ||
151 | break; | ||
152 | |||
153 | case led_red_on: | ||
154 | hw_led_state |= H2P2_DBG_FPGA_LED_RED; | ||
155 | break; | ||
156 | case led_red_off: | ||
157 | hw_led_state &= ~H2P2_DBG_FPGA_LED_RED; | ||
158 | break; | ||
159 | |||
160 | case led_blue_on: | ||
161 | hw_led_state |= H2P2_DBG_FPGA_LED_BLUE; | ||
162 | break; | ||
163 | case led_blue_off: | ||
164 | hw_led_state &= ~H2P2_DBG_FPGA_LED_BLUE; | ||
165 | break; | ||
166 | |||
167 | default: | ||
168 | break; | ||
169 | } | ||
170 | |||
171 | |||
172 | /* | ||
173 | * Actually burn the LEDs | ||
174 | */ | ||
175 | if (led_state & LED_STATE_ENABLED) | ||
176 | __raw_writew(~hw_led_state, &fpga->leds); | ||
177 | |||
178 | done: | ||
179 | spin_unlock_irqrestore(&lock, flags); | ||
180 | } | ||
181 | |||
182 | /*-------------------------------------------------------------------------*/ | ||
183 | |||
184 | /* "new" LED API | ||
185 | * - with syfs access and generic triggering | ||
186 | * - not readily accessible to in-kernel drivers | ||
187 | */ | ||
188 | 32 | ||
189 | struct dbg_led { | 33 | struct dbg_led { |
190 | struct led_classdev cdev; | 34 | struct led_classdev cdev; |
191 | u16 mask; | 35 | u16 mask; |
192 | }; | 36 | }; |
193 | 37 | ||
194 | static struct dbg_led dbg_leds[] = { | 38 | static const struct { |
195 | /* REVISIT at least H2 uses different timer & cpu leds... */ | 39 | const char *name; |
196 | #ifndef CONFIG_LEDS_TIMER | 40 | const char *trigger; |
197 | { .mask = 1 << 0, .cdev.name = "d4:green", | 41 | } dbg_leds[] = { |
198 | .cdev.default_trigger = "heartbeat", }, | 42 | { "dbg:d4", "heartbeat", }, |
199 | #endif | 43 | { "dbg:d5", "cpu0", }, |
200 | #ifndef CONFIG_LEDS_CPU | 44 | { "dbg:d6", "default-on", }, |
201 | { .mask = 1 << 1, .cdev.name = "d5:green", }, /* !idle */ | 45 | { "dbg:d7", }, |
202 | #endif | 46 | { "dbg:d8", }, |
203 | { .mask = 1 << 2, .cdev.name = "d6:green", }, | 47 | { "dbg:d9", }, |
204 | { .mask = 1 << 3, .cdev.name = "d7:green", }, | 48 | { "dbg:d10", }, |
205 | 49 | { "dbg:d11", }, | |
206 | { .mask = 1 << 4, .cdev.name = "d8:green", }, | 50 | { "dbg:d12", }, |
207 | { .mask = 1 << 5, .cdev.name = "d9:green", }, | 51 | { "dbg:d13", }, |
208 | { .mask = 1 << 6, .cdev.name = "d10:green", }, | 52 | { "dbg:d14", }, |
209 | { .mask = 1 << 7, .cdev.name = "d11:green", }, | 53 | { "dbg:d15", }, |
210 | 54 | { "dbg:d16", }, | |
211 | { .mask = 1 << 8, .cdev.name = "d12:green", }, | 55 | { "dbg:d17", }, |
212 | { .mask = 1 << 9, .cdev.name = "d13:green", }, | 56 | { "dbg:d18", }, |
213 | { .mask = 1 << 10, .cdev.name = "d14:green", }, | 57 | { "dbg:d19", }, |
214 | { .mask = 1 << 11, .cdev.name = "d15:green", }, | ||
215 | |||
216 | #ifndef CONFIG_LEDS | ||
217 | { .mask = 1 << 12, .cdev.name = "d16:green", }, | ||
218 | { .mask = 1 << 13, .cdev.name = "d17:green", }, | ||
219 | { .mask = 1 << 14, .cdev.name = "d18:green", }, | ||
220 | { .mask = 1 << 15, .cdev.name = "d19:green", }, | ||
221 | #endif | ||
222 | }; | 58 | }; |
223 | 59 | ||
224 | static void | 60 | /* |
225 | fpga_led_set(struct led_classdev *cdev, enum led_brightness value) | 61 | * The triggers lines up below will only be used if the |
62 | * LED triggers are compiled in. | ||
63 | */ | ||
64 | static void dbg_led_set(struct led_classdev *cdev, | ||
65 | enum led_brightness b) | ||
226 | { | 66 | { |
227 | struct dbg_led *led = container_of(cdev, struct dbg_led, cdev); | 67 | struct dbg_led *led = container_of(cdev, struct dbg_led, cdev); |
228 | unsigned long flags; | 68 | u16 reg; |
229 | 69 | ||
230 | spin_lock_irqsave(&lock, flags); | 70 | reg = __raw_readw(&fpga->leds); |
231 | if (value == LED_OFF) | 71 | if (b != LED_OFF) |
232 | hw_led_state &= ~led->mask; | 72 | reg |= led->mask; |
233 | else | 73 | else |
234 | hw_led_state |= led->mask; | 74 | reg &= ~led->mask; |
235 | __raw_writew(~hw_led_state, &fpga->leds); | 75 | __raw_writew(reg, &fpga->leds); |
236 | spin_unlock_irqrestore(&lock, flags); | ||
237 | } | 76 | } |
238 | 77 | ||
239 | static void __init newled_init(struct device *dev) | 78 | static enum led_brightness dbg_led_get(struct led_classdev *cdev) |
240 | { | 79 | { |
241 | unsigned i; | 80 | struct dbg_led *led = container_of(cdev, struct dbg_led, cdev); |
242 | struct dbg_led *led; | 81 | u16 reg; |
243 | int status; | ||
244 | 82 | ||
245 | for (i = 0, led = dbg_leds; i < ARRAY_SIZE(dbg_leds); i++, led++) { | 83 | reg = __raw_readw(&fpga->leds); |
246 | led->cdev.brightness_set = fpga_led_set; | 84 | return (reg & led->mask) ? LED_FULL : LED_OFF; |
247 | status = led_classdev_register(dev, &led->cdev); | ||
248 | if (status < 0) | ||
249 | break; | ||
250 | } | ||
251 | return; | ||
252 | } | 85 | } |
253 | 86 | ||
254 | 87 | static int fpga_probe(struct platform_device *pdev) | |
255 | /*-------------------------------------------------------------------------*/ | ||
256 | |||
257 | static int /* __init */ fpga_probe(struct platform_device *pdev) | ||
258 | { | 88 | { |
259 | struct resource *iomem; | 89 | struct resource *iomem; |
260 | 90 | int i; | |
261 | spin_lock_init(&lock); | ||
262 | 91 | ||
263 | iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 92 | iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
264 | if (!iomem) | 93 | if (!iomem) |
265 | return -ENODEV; | 94 | return -ENODEV; |
266 | 95 | ||
267 | fpga = ioremap(iomem->start, H2P2_DBG_FPGA_SIZE); | 96 | fpga = ioremap(iomem->start, H2P2_DBG_FPGA_SIZE); |
268 | __raw_writew(~0, &fpga->leds); | 97 | __raw_writew(0xff, &fpga->leds); |
98 | |||
99 | for (i = 0; i < ARRAY_SIZE(dbg_leds); i++) { | ||
100 | struct dbg_led *led; | ||
101 | |||
102 | led = kzalloc(sizeof(*led), GFP_KERNEL); | ||
103 | if (!led) | ||
104 | break; | ||
269 | 105 | ||
270 | #ifdef CONFIG_LEDS | 106 | led->cdev.name = dbg_leds[i].name; |
271 | leds_event = h2p2_dbg_leds_event; | 107 | led->cdev.brightness_set = dbg_led_set; |
272 | leds_event(led_start); | 108 | led->cdev.brightness_get = dbg_led_get; |
273 | #endif | 109 | led->cdev.default_trigger = dbg_leds[i].trigger; |
110 | led->mask = BIT(i); | ||
274 | 111 | ||
275 | if (new_led_api()) { | 112 | if (led_classdev_register(NULL, &led->cdev) < 0) { |
276 | newled_init(&pdev->dev); | 113 | kfree(led); |
114 | break; | ||
115 | } | ||
277 | } | 116 | } |
278 | 117 | ||
279 | return 0; | 118 | return 0; |
@@ -281,13 +120,15 @@ static int /* __init */ fpga_probe(struct platform_device *pdev) | |||
281 | 120 | ||
282 | static int fpga_suspend_noirq(struct device *dev) | 121 | static int fpga_suspend_noirq(struct device *dev) |
283 | { | 122 | { |
284 | __raw_writew(~0, &fpga->leds); | 123 | fpga_led_state = __raw_readw(&fpga->leds); |
124 | __raw_writew(0xff, &fpga->leds); | ||
125 | |||
285 | return 0; | 126 | return 0; |
286 | } | 127 | } |
287 | 128 | ||
288 | static int fpga_resume_noirq(struct device *dev) | 129 | static int fpga_resume_noirq(struct device *dev) |
289 | { | 130 | { |
290 | __raw_writew(~hw_led_state, &fpga->leds); | 131 | __raw_writew(~fpga_led_state, &fpga->leds); |
291 | return 0; | 132 | return 0; |
292 | } | 133 | } |
293 | 134 | ||
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 | ||
18 | config PLAT_VERSATILE_LEDS | 18 | config 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 | ||
22 | config PLAT_VERSATILE_SCHED_CLOCK | 24 | config 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 | }; |
diff --git a/drivers/Kconfig b/drivers/Kconfig index ece958d3762e..324e958d5ac3 100644 --- a/drivers/Kconfig +++ b/drivers/Kconfig | |||
@@ -2,6 +2,8 @@ menu "Device Drivers" | |||
2 | 2 | ||
3 | source "drivers/base/Kconfig" | 3 | source "drivers/base/Kconfig" |
4 | 4 | ||
5 | source "drivers/bus/Kconfig" | ||
6 | |||
5 | source "drivers/connector/Kconfig" | 7 | source "drivers/connector/Kconfig" |
6 | 8 | ||
7 | source "drivers/mtd/Kconfig" | 9 | source "drivers/mtd/Kconfig" |
diff --git a/drivers/Makefile b/drivers/Makefile index 5b421840c48d..f8cdeeb5c484 100644 --- a/drivers/Makefile +++ b/drivers/Makefile | |||
@@ -5,6 +5,8 @@ | |||
5 | # Rewritten to use lists instead of if-statements. | 5 | # Rewritten to use lists instead of if-statements. |
6 | # | 6 | # |
7 | 7 | ||
8 | obj-y += bus/ | ||
9 | |||
8 | # GPIO must come after pinctrl as gpios may need to mux pins etc | 10 | # GPIO must come after pinctrl as gpios may need to mux pins etc |
9 | obj-y += pinctrl/ | 11 | obj-y += pinctrl/ |
10 | obj-y += gpio/ | 12 | obj-y += gpio/ |
diff --git a/drivers/bus/Kconfig b/drivers/bus/Kconfig new file mode 100644 index 000000000000..6270415107d0 --- /dev/null +++ b/drivers/bus/Kconfig | |||
@@ -0,0 +1,15 @@ | |||
1 | # | ||
2 | # Bus Devices | ||
3 | # | ||
4 | |||
5 | menu "Bus devices" | ||
6 | |||
7 | config OMAP_OCP2SCP | ||
8 | tristate "OMAP OCP2SCP DRIVER" | ||
9 | help | ||
10 | Driver to enable ocp2scp module which transforms ocp interface | ||
11 | protocol to scp protocol. In OMAP4, USB PHY is connected via | ||
12 | OCP2SCP and in OMAP5, both USB PHY and SATA PHY is connected via | ||
13 | OCP2SCP. | ||
14 | |||
15 | endmenu | ||
diff --git a/drivers/bus/Makefile b/drivers/bus/Makefile new file mode 100644 index 000000000000..0ec50bc43d7c --- /dev/null +++ b/drivers/bus/Makefile | |||
@@ -0,0 +1,5 @@ | |||
1 | # | ||
2 | # Makefile for the bus drivers. | ||
3 | # | ||
4 | |||
5 | obj-$(CONFIG_OMAP_OCP2SCP) += omap-ocp2scp.o | ||
diff --git a/drivers/bus/omap-ocp2scp.c b/drivers/bus/omap-ocp2scp.c new file mode 100644 index 000000000000..ff63560b8467 --- /dev/null +++ b/drivers/bus/omap-ocp2scp.c | |||
@@ -0,0 +1,88 @@ | |||
1 | /* | ||
2 | * omap-ocp2scp.c - transform ocp interface protocol to scp protocol | ||
3 | * | ||
4 | * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * Author: Kishon Vijay Abraham I <kishon@ti.com> | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | */ | ||
18 | |||
19 | #include <linux/module.h> | ||
20 | #include <linux/platform_device.h> | ||
21 | #include <linux/err.h> | ||
22 | #include <linux/pm_runtime.h> | ||
23 | #include <linux/of.h> | ||
24 | #include <linux/of_platform.h> | ||
25 | |||
26 | static int ocp2scp_remove_devices(struct device *dev, void *c) | ||
27 | { | ||
28 | struct platform_device *pdev = to_platform_device(dev); | ||
29 | |||
30 | platform_device_unregister(pdev); | ||
31 | |||
32 | return 0; | ||
33 | } | ||
34 | |||
35 | static int __devinit omap_ocp2scp_probe(struct platform_device *pdev) | ||
36 | { | ||
37 | int ret; | ||
38 | struct device_node *np = pdev->dev.of_node; | ||
39 | |||
40 | if (np) { | ||
41 | ret = of_platform_populate(np, NULL, NULL, &pdev->dev); | ||
42 | if (ret) { | ||
43 | dev_err(&pdev->dev, "failed to add resources for ocp2scp child\n"); | ||
44 | goto err0; | ||
45 | } | ||
46 | } | ||
47 | pm_runtime_enable(&pdev->dev); | ||
48 | |||
49 | return 0; | ||
50 | |||
51 | err0: | ||
52 | device_for_each_child(&pdev->dev, NULL, ocp2scp_remove_devices); | ||
53 | |||
54 | return ret; | ||
55 | } | ||
56 | |||
57 | static int __devexit omap_ocp2scp_remove(struct platform_device *pdev) | ||
58 | { | ||
59 | pm_runtime_disable(&pdev->dev); | ||
60 | device_for_each_child(&pdev->dev, NULL, ocp2scp_remove_devices); | ||
61 | |||
62 | return 0; | ||
63 | } | ||
64 | |||
65 | #ifdef CONFIG_OF | ||
66 | static const struct of_device_id omap_ocp2scp_id_table[] = { | ||
67 | { .compatible = "ti,omap-ocp2scp" }, | ||
68 | {} | ||
69 | }; | ||
70 | MODULE_DEVICE_TABLE(of, omap_ocp2scp_id_table); | ||
71 | #endif | ||
72 | |||
73 | static struct platform_driver omap_ocp2scp_driver = { | ||
74 | .probe = omap_ocp2scp_probe, | ||
75 | .remove = __devexit_p(omap_ocp2scp_remove), | ||
76 | .driver = { | ||
77 | .name = "omap-ocp2scp", | ||
78 | .owner = THIS_MODULE, | ||
79 | .of_match_table = of_match_ptr(omap_ocp2scp_id_table), | ||
80 | }, | ||
81 | }; | ||
82 | |||
83 | module_platform_driver(omap_ocp2scp_driver); | ||
84 | |||
85 | MODULE_ALIAS("platform: omap-ocp2scp"); | ||
86 | MODULE_AUTHOR("Texas Instruments Inc."); | ||
87 | MODULE_DESCRIPTION("OMAP OCP2SCP driver"); | ||
88 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/drivers/char/nwflash.c b/drivers/char/nwflash.c index d45c3345b4af..a0e2f7d70355 100644 --- a/drivers/char/nwflash.c +++ b/drivers/char/nwflash.c | |||
@@ -30,7 +30,6 @@ | |||
30 | 30 | ||
31 | #include <asm/hardware/dec21285.h> | 31 | #include <asm/hardware/dec21285.h> |
32 | #include <asm/io.h> | 32 | #include <asm/io.h> |
33 | #include <asm/leds.h> | ||
34 | #include <asm/mach-types.h> | 33 | #include <asm/mach-types.h> |
35 | #include <asm/uaccess.h> | 34 | #include <asm/uaccess.h> |
36 | 35 | ||
@@ -179,9 +178,6 @@ static ssize_t flash_write(struct file *file, const char __user *buf, | |||
179 | 178 | ||
180 | written = 0; | 179 | written = 0; |
181 | 180 | ||
182 | leds_event(led_claim); | ||
183 | leds_event(led_green_on); | ||
184 | |||
185 | nBlock = (int) p >> 16; //block # of 64K bytes | 181 | nBlock = (int) p >> 16; //block # of 64K bytes |
186 | 182 | ||
187 | /* | 183 | /* |
@@ -258,11 +254,6 @@ static ssize_t flash_write(struct file *file, const char __user *buf, | |||
258 | printk(KERN_DEBUG "flash_write: written 0x%X bytes OK.\n", written); | 254 | printk(KERN_DEBUG "flash_write: written 0x%X bytes OK.\n", written); |
259 | } | 255 | } |
260 | 256 | ||
261 | /* | ||
262 | * restore reg on exit | ||
263 | */ | ||
264 | leds_event(led_release); | ||
265 | |||
266 | mutex_unlock(&nwflash_mutex); | 257 | mutex_unlock(&nwflash_mutex); |
267 | 258 | ||
268 | return written; | 259 | return written; |
@@ -334,11 +325,6 @@ static int erase_block(int nBlock) | |||
334 | int temp, temp1; | 325 | int temp, temp1; |
335 | 326 | ||
336 | /* | 327 | /* |
337 | * orange LED == erase | ||
338 | */ | ||
339 | leds_event(led_amber_on); | ||
340 | |||
341 | /* | ||
342 | * reset footbridge to the correct offset 0 (...0..3) | 328 | * reset footbridge to the correct offset 0 (...0..3) |
343 | */ | 329 | */ |
344 | *CSR_ROMWRITEREG = 0; | 330 | *CSR_ROMWRITEREG = 0; |
@@ -446,12 +432,6 @@ static int write_block(unsigned long p, const char __user *buf, int count) | |||
446 | unsigned long timeout; | 432 | unsigned long timeout; |
447 | unsigned long timeout1; | 433 | unsigned long timeout1; |
448 | 434 | ||
449 | /* | ||
450 | * red LED == write | ||
451 | */ | ||
452 | leds_event(led_amber_off); | ||
453 | leds_event(led_red_on); | ||
454 | |||
455 | pWritePtr = (unsigned char *) ((unsigned int) (FLASH_BASE + p)); | 435 | pWritePtr = (unsigned char *) ((unsigned int) (FLASH_BASE + p)); |
456 | 436 | ||
457 | /* | 437 | /* |
@@ -558,17 +538,9 @@ static int write_block(unsigned long p, const char __user *buf, int count) | |||
558 | pWritePtr - FLASH_BASE); | 538 | pWritePtr - FLASH_BASE); |
559 | 539 | ||
560 | /* | 540 | /* |
561 | * no LED == waiting | ||
562 | */ | ||
563 | leds_event(led_amber_off); | ||
564 | /* | ||
565 | * wait couple ms | 541 | * wait couple ms |
566 | */ | 542 | */ |
567 | msleep(10); | 543 | msleep(10); |
568 | /* | ||
569 | * red LED == write | ||
570 | */ | ||
571 | leds_event(led_red_on); | ||
572 | 544 | ||
573 | goto WriteRetry; | 545 | goto WriteRetry; |
574 | } else { | 546 | } else { |
@@ -583,12 +555,6 @@ static int write_block(unsigned long p, const char __user *buf, int count) | |||
583 | } | 555 | } |
584 | } | 556 | } |
585 | 557 | ||
586 | /* | ||
587 | * green LED == read/verify | ||
588 | */ | ||
589 | leds_event(led_amber_off); | ||
590 | leds_event(led_green_on); | ||
591 | |||
592 | msleep(10); | 558 | msleep(10); |
593 | 559 | ||
594 | pWritePtr = (unsigned char *) ((unsigned int) (FLASH_BASE + p)); | 560 | pWritePtr = (unsigned char *) ((unsigned int) (FLASH_BASE + p)); |
diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index c96bbaadeebd..16578d3b52bb 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig | |||
@@ -506,6 +506,16 @@ config LEDS_TRIGGER_BACKLIGHT | |||
506 | 506 | ||
507 | If unsure, say N. | 507 | If unsure, say N. |
508 | 508 | ||
509 | config LEDS_TRIGGER_CPU | ||
510 | bool "LED CPU Trigger" | ||
511 | depends on LEDS_TRIGGERS | ||
512 | help | ||
513 | This allows LEDs to be controlled by active CPUs. This shows | ||
514 | the active CPUs across an array of LEDs so you can see which | ||
515 | CPUs are active on the system at any given moment. | ||
516 | |||
517 | If unsure, say N. | ||
518 | |||
509 | config LEDS_TRIGGER_GPIO | 519 | config LEDS_TRIGGER_GPIO |
510 | tristate "LED GPIO Trigger" | 520 | tristate "LED GPIO Trigger" |
511 | depends on LEDS_TRIGGERS | 521 | depends on LEDS_TRIGGERS |
diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile index a4429a9217bc..a9b627c4f8ba 100644 --- a/drivers/leds/Makefile +++ b/drivers/leds/Makefile | |||
@@ -61,5 +61,6 @@ obj-$(CONFIG_LEDS_TRIGGER_IDE_DISK) += ledtrig-ide-disk.o | |||
61 | obj-$(CONFIG_LEDS_TRIGGER_HEARTBEAT) += ledtrig-heartbeat.o | 61 | obj-$(CONFIG_LEDS_TRIGGER_HEARTBEAT) += ledtrig-heartbeat.o |
62 | obj-$(CONFIG_LEDS_TRIGGER_BACKLIGHT) += ledtrig-backlight.o | 62 | obj-$(CONFIG_LEDS_TRIGGER_BACKLIGHT) += ledtrig-backlight.o |
63 | obj-$(CONFIG_LEDS_TRIGGER_GPIO) += ledtrig-gpio.o | 63 | obj-$(CONFIG_LEDS_TRIGGER_GPIO) += ledtrig-gpio.o |
64 | obj-$(CONFIG_LEDS_TRIGGER_CPU) += ledtrig-cpu.o | ||
64 | obj-$(CONFIG_LEDS_TRIGGER_DEFAULT_ON) += ledtrig-default-on.o | 65 | obj-$(CONFIG_LEDS_TRIGGER_DEFAULT_ON) += ledtrig-default-on.o |
65 | obj-$(CONFIG_LEDS_TRIGGER_TRANSIENT) += ledtrig-transient.o | 66 | obj-$(CONFIG_LEDS_TRIGGER_TRANSIENT) += ledtrig-transient.o |
diff --git a/drivers/leds/ledtrig-cpu.c b/drivers/leds/ledtrig-cpu.c new file mode 100644 index 000000000000..b312056da14d --- /dev/null +++ b/drivers/leds/ledtrig-cpu.c | |||
@@ -0,0 +1,163 @@ | |||
1 | /* | ||
2 | * ledtrig-cpu.c - LED trigger based on CPU activity | ||
3 | * | ||
4 | * This LED trigger will be registered for each possible CPU and named as | ||
5 | * cpu0, cpu1, cpu2, cpu3, etc. | ||
6 | * | ||
7 | * It can be bound to any LED just like other triggers using either a | ||
8 | * board file or via sysfs interface. | ||
9 | * | ||
10 | * An API named ledtrig_cpu is exported for any user, who want to add CPU | ||
11 | * activity indication in their code | ||
12 | * | ||
13 | * Copyright 2011 Linus Walleij <linus.walleij@linaro.org> | ||
14 | * Copyright 2011 - 2012 Bryan Wu <bryan.wu@canonical.com> | ||
15 | * | ||
16 | * This program is free software; you can redistribute it and/or modify | ||
17 | * it under the terms of the GNU General Public License version 2 as | ||
18 | * published by the Free Software Foundation. | ||
19 | * | ||
20 | */ | ||
21 | |||
22 | #include <linux/module.h> | ||
23 | #include <linux/kernel.h> | ||
24 | #include <linux/init.h> | ||
25 | #include <linux/slab.h> | ||
26 | #include <linux/percpu.h> | ||
27 | #include <linux/syscore_ops.h> | ||
28 | #include <linux/rwsem.h> | ||
29 | #include "leds.h" | ||
30 | |||
31 | #define MAX_NAME_LEN 8 | ||
32 | |||
33 | struct led_trigger_cpu { | ||
34 | char name[MAX_NAME_LEN]; | ||
35 | struct led_trigger *_trig; | ||
36 | struct mutex lock; | ||
37 | int lock_is_inited; | ||
38 | }; | ||
39 | |||
40 | static DEFINE_PER_CPU(struct led_trigger_cpu, cpu_trig); | ||
41 | |||
42 | /** | ||
43 | * ledtrig_cpu - emit a CPU event as a trigger | ||
44 | * @evt: CPU event to be emitted | ||
45 | * | ||
46 | * Emit a CPU event on a CPU core, which will trigger a | ||
47 | * binded LED to turn on or turn off. | ||
48 | */ | ||
49 | void ledtrig_cpu(enum cpu_led_event ledevt) | ||
50 | { | ||
51 | struct led_trigger_cpu *trig = &__get_cpu_var(cpu_trig); | ||
52 | |||
53 | /* mutex lock should be initialized before calling mutex_call() */ | ||
54 | if (!trig->lock_is_inited) | ||
55 | return; | ||
56 | |||
57 | mutex_lock(&trig->lock); | ||
58 | |||
59 | /* Locate the correct CPU LED */ | ||
60 | switch (ledevt) { | ||
61 | case CPU_LED_IDLE_END: | ||
62 | case CPU_LED_START: | ||
63 | /* Will turn the LED on, max brightness */ | ||
64 | led_trigger_event(trig->_trig, LED_FULL); | ||
65 | break; | ||
66 | |||
67 | case CPU_LED_IDLE_START: | ||
68 | case CPU_LED_STOP: | ||
69 | case CPU_LED_HALTED: | ||
70 | /* Will turn the LED off */ | ||
71 | led_trigger_event(trig->_trig, LED_OFF); | ||
72 | break; | ||
73 | |||
74 | default: | ||
75 | /* Will leave the LED as it is */ | ||
76 | break; | ||
77 | } | ||
78 | |||
79 | mutex_unlock(&trig->lock); | ||
80 | } | ||
81 | EXPORT_SYMBOL(ledtrig_cpu); | ||
82 | |||
83 | static int ledtrig_cpu_syscore_suspend(void) | ||
84 | { | ||
85 | ledtrig_cpu(CPU_LED_STOP); | ||
86 | return 0; | ||
87 | } | ||
88 | |||
89 | static void ledtrig_cpu_syscore_resume(void) | ||
90 | { | ||
91 | ledtrig_cpu(CPU_LED_START); | ||
92 | } | ||
93 | |||
94 | static void ledtrig_cpu_syscore_shutdown(void) | ||
95 | { | ||
96 | ledtrig_cpu(CPU_LED_HALTED); | ||
97 | } | ||
98 | |||
99 | static struct syscore_ops ledtrig_cpu_syscore_ops = { | ||
100 | .shutdown = ledtrig_cpu_syscore_shutdown, | ||
101 | .suspend = ledtrig_cpu_syscore_suspend, | ||
102 | .resume = ledtrig_cpu_syscore_resume, | ||
103 | }; | ||
104 | |||
105 | static int __init ledtrig_cpu_init(void) | ||
106 | { | ||
107 | int cpu; | ||
108 | |||
109 | /* Supports up to 9999 cpu cores */ | ||
110 | BUILD_BUG_ON(CONFIG_NR_CPUS > 9999); | ||
111 | |||
112 | /* | ||
113 | * Registering CPU led trigger for each CPU core here | ||
114 | * ignores CPU hotplug, but after this CPU hotplug works | ||
115 | * fine with this trigger. | ||
116 | */ | ||
117 | for_each_possible_cpu(cpu) { | ||
118 | struct led_trigger_cpu *trig = &per_cpu(cpu_trig, cpu); | ||
119 | |||
120 | mutex_init(&trig->lock); | ||
121 | |||
122 | snprintf(trig->name, MAX_NAME_LEN, "cpu%d", cpu); | ||
123 | |||
124 | mutex_lock(&trig->lock); | ||
125 | led_trigger_register_simple(trig->name, &trig->_trig); | ||
126 | trig->lock_is_inited = 1; | ||
127 | mutex_unlock(&trig->lock); | ||
128 | } | ||
129 | |||
130 | register_syscore_ops(&ledtrig_cpu_syscore_ops); | ||
131 | |||
132 | pr_info("ledtrig-cpu: registered to indicate activity on CPUs\n"); | ||
133 | |||
134 | return 0; | ||
135 | } | ||
136 | module_init(ledtrig_cpu_init); | ||
137 | |||
138 | static void __exit ledtrig_cpu_exit(void) | ||
139 | { | ||
140 | int cpu; | ||
141 | |||
142 | for_each_possible_cpu(cpu) { | ||
143 | struct led_trigger_cpu *trig = &per_cpu(cpu_trig, cpu); | ||
144 | |||
145 | mutex_lock(&trig->lock); | ||
146 | |||
147 | led_trigger_unregister_simple(trig->_trig); | ||
148 | trig->_trig = NULL; | ||
149 | memset(trig->name, 0, MAX_NAME_LEN); | ||
150 | trig->lock_is_inited = 0; | ||
151 | |||
152 | mutex_unlock(&trig->lock); | ||
153 | mutex_destroy(&trig->lock); | ||
154 | } | ||
155 | |||
156 | unregister_syscore_ops(&ledtrig_cpu_syscore_ops); | ||
157 | } | ||
158 | module_exit(ledtrig_cpu_exit); | ||
159 | |||
160 | MODULE_AUTHOR("Linus Walleij <linus.walleij@linaro.org>"); | ||
161 | MODULE_AUTHOR("Bryan Wu <bryan.wu@canonical.com>"); | ||
162 | MODULE_DESCRIPTION("CPU LED trigger"); | ||
163 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig index 8ca417614c57..598cd0a3adee 100644 --- a/drivers/mtd/nand/Kconfig +++ b/drivers/mtd/nand/Kconfig | |||
@@ -406,46 +406,6 @@ config MTD_NAND_ATMEL | |||
406 | help | 406 | help |
407 | Enables support for NAND Flash / Smart Media Card interface | 407 | Enables support for NAND Flash / Smart Media Card interface |
408 | on Atmel AT91 and AVR32 processors. | 408 | on Atmel AT91 and AVR32 processors. |
409 | choice | ||
410 | prompt "ECC management for NAND Flash / SmartMedia on AT91 / AVR32" | ||
411 | depends on MTD_NAND_ATMEL | ||
412 | |||
413 | config MTD_NAND_ATMEL_ECC_HW | ||
414 | bool "Hardware ECC" | ||
415 | depends on ARCH_AT91SAM9263 || ARCH_AT91SAM9260 || AVR32 | ||
416 | help | ||
417 | Use hardware ECC instead of software ECC when the chip | ||
418 | supports it. | ||
419 | |||
420 | The hardware ECC controller is capable of single bit error | ||
421 | correction and 2-bit random detection per page. | ||
422 | |||
423 | NB : hardware and software ECC schemes are incompatible. | ||
424 | If you switch from one to another, you'll have to erase your | ||
425 | mtd partition. | ||
426 | |||
427 | If unsure, say Y | ||
428 | |||
429 | config MTD_NAND_ATMEL_ECC_SOFT | ||
430 | bool "Software ECC" | ||
431 | help | ||
432 | Use software ECC. | ||
433 | |||
434 | NB : hardware and software ECC schemes are incompatible. | ||
435 | If you switch from one to another, you'll have to erase your | ||
436 | mtd partition. | ||
437 | |||
438 | config MTD_NAND_ATMEL_ECC_NONE | ||
439 | bool "No ECC (testing only, DANGEROUS)" | ||
440 | depends on DEBUG_KERNEL | ||
441 | help | ||
442 | No ECC will be used. | ||
443 | It's not a good idea and it should be reserved for testing | ||
444 | purpose only. | ||
445 | |||
446 | If unsure, say N | ||
447 | |||
448 | endchoice | ||
449 | 409 | ||
450 | config MTD_NAND_PXA3xx | 410 | config MTD_NAND_PXA3xx |
451 | tristate "Support for NAND flash devices on PXA3xx" | 411 | tristate "Support for NAND flash devices on PXA3xx" |
diff --git a/include/linux/leds.h b/include/linux/leds.h index 3aade1d8f410..c6f8dad2ceb0 100644 --- a/include/linux/leds.h +++ b/include/linux/leds.h | |||
@@ -237,4 +237,20 @@ struct gpio_led_platform_data { | |||
237 | struct platform_device *gpio_led_register_device( | 237 | struct platform_device *gpio_led_register_device( |
238 | int id, const struct gpio_led_platform_data *pdata); | 238 | int id, const struct gpio_led_platform_data *pdata); |
239 | 239 | ||
240 | enum cpu_led_event { | ||
241 | CPU_LED_IDLE_START, /* CPU enters idle */ | ||
242 | CPU_LED_IDLE_END, /* CPU idle ends */ | ||
243 | CPU_LED_START, /* Machine starts, especially resume */ | ||
244 | CPU_LED_STOP, /* Machine stops, especially suspend */ | ||
245 | CPU_LED_HALTED, /* Machine shutdown */ | ||
246 | }; | ||
247 | #ifdef CONFIG_LEDS_TRIGGER_CPU | ||
248 | extern void ledtrig_cpu(enum cpu_led_event evt); | ||
249 | #else | ||
250 | static inline void ledtrig_cpu(enum cpu_led_event evt) | ||
251 | { | ||
252 | return; | ||
253 | } | ||
254 | #endif | ||
255 | |||
240 | #endif /* __LINUX_LEDS_H_INCLUDED */ | 256 | #endif /* __LINUX_LEDS_H_INCLUDED */ |