|
@@ -4,6 +4,7 @@
|
|
|
* EBSA285 machine fixup
|
|
|
*/
|
|
|
#include <linux/init.h>
|
|
|
+#include <linux/io.h>
|
|
|
#include <linux/spinlock.h>
|
|
|
#include <linux/slab.h>
|
|
|
#include <linux/leds.h>
|
|
@@ -17,6 +18,11 @@
|
|
|
|
|
|
/* LEDs */
|
|
|
#if defined(CONFIG_NEW_LEDS) && defined(CONFIG_LEDS_CLASS)
|
|
|
+#define XBUS_AMBER_L BIT(0)
|
|
|
+#define XBUS_GREEN_L BIT(1)
|
|
|
+#define XBUS_RED_L BIT(2)
|
|
|
+#define XBUS_TOGGLE BIT(7)
|
|
|
+
|
|
|
struct ebsa285_led {
|
|
|
struct led_classdev cdev;
|
|
|
u8 mask;
|
|
@@ -36,6 +42,7 @@ static const struct {
|
|
|
};
|
|
|
|
|
|
static unsigned char hw_led_state;
|
|
|
+static void __iomem *xbus;
|
|
|
|
|
|
static void ebsa285_led_set(struct led_classdev *cdev,
|
|
|
enum led_brightness b)
|
|
@@ -47,7 +54,7 @@ static void ebsa285_led_set(struct led_classdev *cdev,
|
|
|
hw_led_state |= led->mask;
|
|
|
else
|
|
|
hw_led_state &= ~led->mask;
|
|
|
- *XBUS_LEDS = hw_led_state;
|
|
|
+ writeb(hw_led_state, xbus);
|
|
|
}
|
|
|
|
|
|
static enum led_brightness ebsa285_led_get(struct led_classdev *cdev)
|
|
@@ -65,9 +72,13 @@ static int __init ebsa285_leds_init(void)
|
|
|
if (!machine_is_ebsa285())
|
|
|
return -ENODEV;
|
|
|
|
|
|
+ xbus = ioremap(XBUS_CS2, SZ_4K);
|
|
|
+ if (!xbus)
|
|
|
+ return -ENOMEM;
|
|
|
+
|
|
|
/* 3 LEDS all off */
|
|
|
- hw_led_state = XBUS_LED_AMBER | XBUS_LED_GREEN | XBUS_LED_RED;
|
|
|
- *XBUS_LEDS = hw_led_state;
|
|
|
+ hw_led_state = XBUS_AMBER_L | XBUS_GREEN_L | XBUS_RED_L;
|
|
|
+ writeb(hw_led_state, xbus);
|
|
|
|
|
|
for (i = 0; i < ARRAY_SIZE(ebsa285_leds); i++) {
|
|
|
struct ebsa285_led *led;
|