aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-clps711x
diff options
context:
space:
mode:
authorBryan Wu <bryan.wu@canonical.com>2012-03-13 13:55:26 -0400
committerBryan Wu <bryan.wu@canonical.com>2012-07-31 23:22:08 -0400
commit8ee8ef2996df477aa1623bd213b1548ab1b9c07c (patch)
tree2cdafd3f18279be0ac234d83365801693f15b2aa /arch/arm/mach-clps711x
parent95f4965cf8a7cb7cdd987359cf48162f37bdd2d3 (diff)
ARM: mach-clps711x: retire custom LED code of P720T machine
Add tigger based LED driver into board file of P720T. Remove old LED driver file. Signed-off-by: Bryan Wu <bryan.wu@canonical.com>
Diffstat (limited to 'arch/arm/mach-clps711x')
-rw-r--r--arch/arm/mach-clps711x/Makefile2
-rw-r--r--arch/arm/mach-clps711x/common.c1
-rw-r--r--arch/arm/mach-clps711x/p720t-leds.c63
-rw-r--r--arch/arm/mach-clps711x/p720t.c61
4 files changed, 61 insertions, 66 deletions
diff --git a/arch/arm/mach-clps711x/Makefile b/arch/arm/mach-clps711x/Makefile
index f2f0256232e..5872b49bfae 100644
--- a/arch/arm/mach-clps711x/Makefile
+++ b/arch/arm/mach-clps711x/Makefile
@@ -16,5 +16,3 @@ obj-$(CONFIG_ARCH_CLEP7312) += clep7312.o
16obj-$(CONFIG_ARCH_EDB7211) += edb7211-arch.o edb7211-mm.o 16obj-$(CONFIG_ARCH_EDB7211) += edb7211-arch.o edb7211-mm.o
17obj-$(CONFIG_ARCH_FORTUNET) += fortunet.o 17obj-$(CONFIG_ARCH_FORTUNET) += fortunet.o
18obj-$(CONFIG_ARCH_P720T) += p720t.o 18obj-$(CONFIG_ARCH_P720T) += p720t.o
19leds-$(CONFIG_ARCH_P720T) += p720t-leds.o
20obj-$(CONFIG_LEDS) += $(leds-y)
diff --git a/arch/arm/mach-clps711x/common.c b/arch/arm/mach-clps711x/common.c
index c965fd8eb31..1e1ae48726f 100644
--- a/arch/arm/mach-clps711x/common.c
+++ b/arch/arm/mach-clps711x/common.c
@@ -31,7 +31,6 @@
31#include <asm/sizes.h> 31#include <asm/sizes.h>
32#include <mach/hardware.h> 32#include <mach/hardware.h>
33#include <asm/irq.h> 33#include <asm/irq.h>
34#include <asm/leds.h>
35#include <asm/pgtable.h> 34#include <asm/pgtable.h>
36#include <asm/page.h> 35#include <asm/page.h>
37#include <asm/mach/map.h> 36#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 bbc449fbe14..00000000000
--- a/arch/arm/mach-clps711x/p720t-leds.c
+++ /dev/null
@@ -1,63 +0,0 @@
1/*
2 * linux/arch/arm/mach-clps711x/leds.c
3 *
4 * Integrator LED control routines
5 *
6 * Copyright (C) 2000 Deep Blue Solutions Ltd
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22#include <linux/kernel.h>
23#include <linux/init.h>
24#include <linux/io.h>
25
26#include <mach/hardware.h>
27#include <asm/leds.h>
28#include <asm/mach-types.h>
29
30static void p720t_leds_event(led_event_t ledevt)
31{
32 unsigned long flags;
33 u32 pddr;
34
35 local_irq_save(flags);
36 switch(ledevt) {
37 case led_idle_start:
38 break;
39
40 case led_idle_end:
41 break;
42
43 case led_timer:
44 pddr = clps_readb(PDDR);
45 clps_writeb(pddr ^ 1, PDDR);
46 break;
47
48 default:
49 break;
50 }
51
52 local_irq_restore(flags);
53}
54
55static int __init leds_init(void)
56{
57 if (machine_is_p720t())
58 leds_event = p720t_leds_event;
59
60 return 0;
61}
62
63arch_initcall(leds_init);
diff --git a/arch/arm/mach-clps711x/p720t.c b/arch/arm/mach-clps711x/p720t.c
index 42ee8f33eaf..09113a94114 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/*
@@ -121,3 +125,60 @@ static int p720t_hw_init(void)
121 125
122__initcall(p720t_hw_init); 126__initcall(p720t_hw_init);
123 127
128/*
129 * LED controled by CPLD
130 */
131#if defined(CONFIG_NEW_LEDS) && defined(CONFIG_LEDS_CLASS)
132static void p720t_led_set(struct led_classdev *cdev,
133 enum led_brightness b)
134{
135 u8 reg = clps_readb(PDDR);
136
137 if (b != LED_OFF)
138 reg |= 0x1;
139 else
140 reg &= ~0x1;
141
142 clps_writeb(reg, PDDR);
143}
144
145static enum led_brightness p720t_led_get(struct led_classdev *cdev)
146{
147 u8 reg = clps_readb(PDDR);
148
149 return (reg & 0x1) ? LED_FULL : LED_OFF;
150}
151
152static int __init p720t_leds_init(void)
153{
154
155 struct led_classdev *cdev;
156 int ret;
157
158 if (!machine_is_p720t())
159 return -ENODEV;
160
161 cdev = kzalloc(sizeof(*cdev), GFP_KERNEL);
162 if (!cdev)
163 return -ENOMEM;
164
165 cdev->name = "p720t:0";
166 cdev->brightness_set = p720t_led_set;
167 cdev->brightness_get = p720t_led_get;
168 cdev->default_trigger = "heartbeat";
169
170 ret = led_classdev_register(NULL, cdev);
171 if (ret < 0) {
172 kfree(cdev);
173 return ret;
174 }
175
176 return 0;
177}
178
179/*
180 * Since we may have triggers on any subsystem, defer registration
181 * until after subsystem_init.
182 */
183fs_initcall(p720t_leds_init);
184#endif