diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2013-11-30 08:41:26 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2013-12-29 07:36:44 -0500 |
commit | 43024ed6fa831094b1e0eca7f18de372842ac9a1 (patch) | |
tree | 62bc317ccd1d065c0e4da8a0cd55e34b22d238af /arch/arm/mach-footbridge/ebsa285.c | |
parent | 8c65da6dc89ccb605d73773b1dd617e72982d971 (diff) |
ARM: footbridge: cleanup LEDs code
Cleanup the LEDs code to use ioremap()/writeb() to access the register.
This allows us to move the definitions out of a header file directly
into the ebsa285 support code.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-footbridge/ebsa285.c')
-rw-r--r-- | arch/arm/mach-footbridge/ebsa285.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/arch/arm/mach-footbridge/ebsa285.c b/arch/arm/mach-footbridge/ebsa285.c index 3ff7a0c30a0f..aee8300f3490 100644 --- a/arch/arm/mach-footbridge/ebsa285.c +++ b/arch/arm/mach-footbridge/ebsa285.c | |||
@@ -4,6 +4,7 @@ | |||
4 | * EBSA285 machine fixup | 4 | * EBSA285 machine fixup |
5 | */ | 5 | */ |
6 | #include <linux/init.h> | 6 | #include <linux/init.h> |
7 | #include <linux/io.h> | ||
7 | #include <linux/spinlock.h> | 8 | #include <linux/spinlock.h> |
8 | #include <linux/slab.h> | 9 | #include <linux/slab.h> |
9 | #include <linux/leds.h> | 10 | #include <linux/leds.h> |
@@ -17,6 +18,11 @@ | |||
17 | 18 | ||
18 | /* LEDs */ | 19 | /* LEDs */ |
19 | #if defined(CONFIG_NEW_LEDS) && defined(CONFIG_LEDS_CLASS) | 20 | #if defined(CONFIG_NEW_LEDS) && defined(CONFIG_LEDS_CLASS) |
21 | #define XBUS_AMBER_L BIT(0) | ||
22 | #define XBUS_GREEN_L BIT(1) | ||
23 | #define XBUS_RED_L BIT(2) | ||
24 | #define XBUS_TOGGLE BIT(7) | ||
25 | |||
20 | struct ebsa285_led { | 26 | struct ebsa285_led { |
21 | struct led_classdev cdev; | 27 | struct led_classdev cdev; |
22 | u8 mask; | 28 | u8 mask; |
@@ -36,6 +42,7 @@ static const struct { | |||
36 | }; | 42 | }; |
37 | 43 | ||
38 | static unsigned char hw_led_state; | 44 | static unsigned char hw_led_state; |
45 | static void __iomem *xbus; | ||
39 | 46 | ||
40 | static void ebsa285_led_set(struct led_classdev *cdev, | 47 | static void ebsa285_led_set(struct led_classdev *cdev, |
41 | enum led_brightness b) | 48 | enum led_brightness b) |
@@ -47,7 +54,7 @@ static void ebsa285_led_set(struct led_classdev *cdev, | |||
47 | hw_led_state |= led->mask; | 54 | hw_led_state |= led->mask; |
48 | else | 55 | else |
49 | hw_led_state &= ~led->mask; | 56 | hw_led_state &= ~led->mask; |
50 | *XBUS_LEDS = hw_led_state; | 57 | writeb(hw_led_state, xbus); |
51 | } | 58 | } |
52 | 59 | ||
53 | static enum led_brightness ebsa285_led_get(struct led_classdev *cdev) | 60 | static enum led_brightness ebsa285_led_get(struct led_classdev *cdev) |
@@ -65,9 +72,13 @@ static int __init ebsa285_leds_init(void) | |||
65 | if (!machine_is_ebsa285()) | 72 | if (!machine_is_ebsa285()) |
66 | return -ENODEV; | 73 | return -ENODEV; |
67 | 74 | ||
75 | xbus = ioremap(XBUS_CS2, SZ_4K); | ||
76 | if (!xbus) | ||
77 | return -ENOMEM; | ||
78 | |||
68 | /* 3 LEDS all off */ | 79 | /* 3 LEDS all off */ |
69 | hw_led_state = XBUS_LED_AMBER | XBUS_LED_GREEN | XBUS_LED_RED; | 80 | hw_led_state = XBUS_AMBER_L | XBUS_GREEN_L | XBUS_RED_L; |
70 | *XBUS_LEDS = hw_led_state; | 81 | writeb(hw_led_state, xbus); |
71 | 82 | ||
72 | for (i = 0; i < ARRAY_SIZE(ebsa285_leds); i++) { | 83 | for (i = 0; i < ARRAY_SIZE(ebsa285_leds); i++) { |
73 | struct ebsa285_led *led; | 84 | struct ebsa285_led *led; |