summaryrefslogtreecommitdiffstats
path: root/target/linux/au1000/files
diff options
context:
space:
mode:
authorFlorian Fainelli <florian@openwrt.org>2007-10-10 14:03:16 +0000
committerFlorian Fainelli <florian@openwrt.org>2007-10-10 14:03:16 +0000
commit137e963057c93bcd8ffa2500b410c1109bf5c916 (patch)
tree5d1f5d641d378b961fa37792e2932cf3f6a48705 /target/linux/au1000/files
parentc07d9904902144c95d359be77226eed3190028ae (diff)
downloadmaster-31e0f0ae-137e963057c93bcd8ffa2500b410c1109bf5c916.tar.gz
master-31e0f0ae-137e963057c93bcd8ffa2500b410c1109bf5c916.tar.bz2
master-31e0f0ae-137e963057c93bcd8ffa2500b410c1109bf5c916.zip
Upgrade au1000 to 2.6.23
SVN-Revision: 9243
Diffstat (limited to 'target/linux/au1000/files')
-rw-r--r--target/linux/au1000/files/arch/mips/au1000/mtx-1/platform.c44
-rw-r--r--target/linux/au1000/files/drivers/leds/leds-mtx1.c101
2 files changed, 30 insertions, 115 deletions
diff --git a/target/linux/au1000/files/arch/mips/au1000/mtx-1/platform.c b/target/linux/au1000/files/arch/mips/au1000/mtx-1/platform.c
index e5116f08e5..529595fcd4 100644
--- a/target/linux/au1000/files/arch/mips/au1000/mtx-1/platform.c
+++ b/target/linux/au1000/files/arch/mips/au1000/mtx-1/platform.c
@@ -26,13 +26,31 @@
#include <asm/gpio.h>
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23)
+static struct resource mtx1_wdt_res[] = {
+ [0] = {
+ .start = 15,
+ .end = 15,
+ .name = "mtx1-wdt-gpio",
+ .flags = IORESOURCE_IRQ,
+ }
+};
+
+static struct platform_device mtx1_wdt = {
+ .name = "mtx1-wdt",
+ .id = 0,
+ .num_resources = ARRAY_SIZE(mtx1_wdt_res),
+ .resource = mtx1_wdt_res,
+};
+
static struct gpio_led default_leds[] = {
- { .name = "mtx1:green", .gpio = 211, .active_low = 1, },
- { .name = "mtx1:red", gpio = 212, .active_low = 1, },
-}
+ { .name = "mtx1:green", .gpio = 211, },
+ { .name = "mtx1:red", .gpio = 212, },
+};
-static struct gpio_led_platform_data mtx1_led_data;
+static struct gpio_led_platform_data mtx1_led_data = {
+ .num_leds = ARRAY_SIZE(default_leds),
+ .leds = default_leds,
+};
static struct platform_device mtx1_gpio_leds = {
.name = "leds-gpio",
@@ -41,18 +59,16 @@ static struct platform_device mtx1_gpio_leds = {
.platform_data = &mtx1_led_data,
}
};
-#endif
+
+static struct platform_device *mtx1_devs[] = {
+ &mtx1_gpio_leds,
+ &mtx1_wdt
+};
static int __init mtx1_register_devices(void)
{
- int res;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23)
- mtx1_led_data.num_leds = ARRAY_SIZE(default_leds);
- mtx1_led_data.leds = default_leds;
- res = platform_device_register(&mtx1_gpio_leds);
-#endif
- return res;
+ return platform_add_devices(mtx1_devs, ARRAY_SIZE(mtx1_devs));
}
-arch_initall(mtx1_register_devices);
+arch_initcall(mtx1_register_devices);
diff --git a/target/linux/au1000/files/drivers/leds/leds-mtx1.c b/target/linux/au1000/files/drivers/leds/leds-mtx1.c
deleted file mode 100644
index 4c2ab55fc3..0000000000
--- a/target/linux/au1000/files/drivers/leds/leds-mtx1.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * LED driver for MTX-1 boards
- *
- * Copyright 2007 Florian Fainelli <florian@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- */
-
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/platform_device.h>
-#include <linux/leds.h>
-#include <linux/err.h>
-#include <asm/gpio.h>
-
-static struct platform_device *pdev;
-
-static void mtx1_led_set(struct led_classdev *led_cdev, enum led_brightness brightness)
-{
- if (!strcmp("mtx1:green", led_cdev->name))
- gpio_set_value(211, brightness ? 1 : 0);
- else
- gpio_set_value(212, brightness ? 1 : 0);
-}
-
-static struct led_classdev mtx1_green_led = {
- .name = "mtx1:green",
- .brightness_set = mtx1_led_set,
-};
-
-static struct led_classdev mtx1_red_led = {
- .name = "mtx1:red",
- .brightness_set = mtx1_led_set,
-};
-
-static int mtx1_leds_probe(struct platform_device *pdev)
-{
- int ret;
-
- ret = led_classdev_register(&pdev->dev, &mtx1_green_led);
- if (ret < 0)
- goto out;
-
- ret = led_classdev_register(&pdev->dev, &mtx1_red_led);
- if (ret < 0)
- led_classdev_unregister(&mtx1_green_led);
-
-out:
- return ret;
-}
-
-static int mtx1_leds_remove(struct platform_device *pdev)
-{
- led_classdev_unregister(&mtx1_green_led);
- led_classdev_unregister(&mtx1_red_led);
- return 0;
-}
-
-static struct platform_driver mtx1_leds_driver = {
- .probe = mtx1_leds_probe,
- .remove = mtx1_leds_remove,
- .driver = {
- .name = "mtx1-leds",
- }
-};
-
-static int __init mtx1_leds_init(void)
-{
- int ret;
-
- ret = platform_driver_register(&mtx1_leds_driver);
- if (ret < 0)
- goto out;
-
- pdev = platform_device_register_simple("mtx1-leds", -1, NULL, 0);
- if (IS_ERR(pdev)) {
- ret = PTR_ERR(pdev);
- platform_driver_unregister(&mtx1_leds_driver);
- goto out;
- }
-
-out:
- return ret;
-
-}
-
-static void __exit mtx1_leds_exit(void)
-{
- platform_device_unregister(pdev);
- platform_driver_unregister(&mtx1_leds_driver);
-}
-
-module_init(mtx1_leds_init);
-module_exit(mtx1_leds_exit);
-
-MODULE_AUTHOR("Florian Fainelli <florian@openwrt.org>");
-MODULE_DESCRIPTION("MTX-1 LED driver");
-MODULE_LICENSE("GPL");