Skip to content

Commit 43024ed

Browse files
author
Russell King
committed
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 <[email protected]>
1 parent 8c65da6 commit 43024ed

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

arch/arm/mach-footbridge/common.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,6 @@ static struct map_desc fb_common_io_desc[] __initdata = {
143143
.pfn = __phys_to_pfn(DC21285_ARMCSR_BASE),
144144
.length = ARMCSR_SIZE,
145145
.type = MT_DEVICE,
146-
}, {
147-
.virtual = XBUS_BASE,
148-
.pfn = __phys_to_pfn(0x40000000),
149-
.length = XBUS_SIZE,
150-
.type = MT_DEVICE,
151146
}
152147
};
153148

arch/arm/mach-footbridge/ebsa285.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* EBSA285 machine fixup
55
*/
66
#include <linux/init.h>
7+
#include <linux/io.h>
78
#include <linux/spinlock.h>
89
#include <linux/slab.h>
910
#include <linux/leds.h>
@@ -17,6 +18,11 @@
1718

1819
/* LEDs */
1920
#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+
2026
struct ebsa285_led {
2127
struct led_classdev cdev;
2228
u8 mask;
@@ -36,6 +42,7 @@ static const struct {
3642
};
3743

3844
static unsigned char hw_led_state;
45+
static void __iomem *xbus;
3946

4047
static void ebsa285_led_set(struct led_classdev *cdev,
4148
enum led_brightness b)
@@ -47,7 +54,7 @@ static void ebsa285_led_set(struct led_classdev *cdev,
4754
hw_led_state |= led->mask;
4855
else
4956
hw_led_state &= ~led->mask;
50-
*XBUS_LEDS = hw_led_state;
57+
writeb(hw_led_state, xbus);
5158
}
5259

5360
static enum led_brightness ebsa285_led_get(struct led_classdev *cdev)
@@ -65,9 +72,13 @@ static int __init ebsa285_leds_init(void)
6572
if (!machine_is_ebsa285())
6673
return -ENODEV;
6774

75+
xbus = ioremap(XBUS_CS2, SZ_4K);
76+
if (!xbus)
77+
return -ENOMEM;
78+
6879
/* 3 LEDS all off */
69-
hw_led_state = XBUS_LED_AMBER | XBUS_LED_GREEN | XBUS_LED_RED;
70-
*XBUS_LEDS = hw_led_state;
80+
hw_led_state = XBUS_AMBER_L | XBUS_GREEN_L | XBUS_RED_L;
81+
writeb(hw_led_state, xbus);
7182

7283
for (i = 0; i < ARRAY_SIZE(ebsa285_leds); i++) {
7384
struct ebsa285_led *led;

arch/arm/mach-footbridge/include/mach/hardware.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,7 @@
5151
#define PCIMEM_SIZE 0x01000000
5252
#define PCIMEM_BASE MMU_IO(0xf0000000, 0x80000000)
5353

54-
#define XBUS_LEDS ((volatile unsigned char *)(XBUS_BASE + 0x12000))
55-
#define XBUS_LED_AMBER (1 << 0)
56-
#define XBUS_LED_GREEN (1 << 1)
57-
#define XBUS_LED_RED (1 << 2)
58-
#define XBUS_LED_TOGGLE (1 << 8)
54+
#define XBUS_CS2 0x40012000
5955

6056
#define XBUS_SWITCH ((volatile unsigned char *)(XBUS_BASE + 0x12000))
6157
#define XBUS_SWITCH_SWITCH ((*XBUS_SWITCH) & 15)

0 commit comments

Comments
 (0)