MIPS: RBTX4927: Add GPIO-LED support

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
This commit is contained in:
Atsushi Nemoto 2008-09-02 22:44:38 +09:00 committed by Ralf Baechle
parent 9cc4581528
commit 864cbf804d

View File

@ -49,6 +49,7 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/leds.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/reboot.h> #include <asm/reboot.h>
#include <asm/txx9/generic.h> #include <asm/txx9/generic.h>
@ -210,10 +211,6 @@ static void __init rbtx4927_mem_setup(void)
/* TX4927-SIO DTR on (PIO[15]) */ /* TX4927-SIO DTR on (PIO[15]) */
gpio_request(15, "sio-dtr"); gpio_request(15, "sio-dtr");
gpio_direction_output(15, 1); gpio_direction_output(15, 1);
gpio_request(0, "led");
gpio_direction_output(0, 1);
gpio_request(1, "led");
gpio_direction_output(1, 1);
tx4927_sio_init(0, 0); tx4927_sio_init(0, 0);
#ifdef CONFIG_SERIAL_TXX9_CONSOLE #ifdef CONFIG_SERIAL_TXX9_CONSOLE
@ -315,6 +312,25 @@ static void __init rbtx4927_mtd_init(void)
tx4927_mtd_init(i); tx4927_mtd_init(i);
} }
static void __init rbtx4927_gpioled_init(void)
{
static struct gpio_led leds[] = {
{ .name = "gpioled:green:0", .gpio = 0, .active_low = 1, },
{ .name = "gpioled:green:1", .gpio = 1, .active_low = 1, },
};
static struct gpio_led_platform_data pdata = {
.num_leds = ARRAY_SIZE(leds),
.leds = leds,
};
struct platform_device *pdev = platform_device_alloc("leds-gpio", 0);
if (!pdev)
return;
pdev->dev.platform_data = &pdata;
if (platform_device_add(pdev))
platform_device_put(pdev);
}
static void __init rbtx4927_device_init(void) static void __init rbtx4927_device_init(void)
{ {
toshiba_rbtx4927_rtc_init(); toshiba_rbtx4927_rtc_init();
@ -322,6 +338,7 @@ static void __init rbtx4927_device_init(void)
tx4927_wdt_init(); tx4927_wdt_init();
rbtx4927_mtd_init(); rbtx4927_mtd_init();
txx9_iocled_init(RBTX4927_LED_ADDR - IO_BASE, -1, 3, 1, "green", NULL); txx9_iocled_init(RBTX4927_LED_ADDR - IO_BASE, -1, 3, 1, "green", NULL);
rbtx4927_gpioled_init();
} }
struct txx9_board_vec rbtx4927_vec __initdata = { struct txx9_board_vec rbtx4927_vec __initdata = {