summaryrefslogtreecommitdiff
path: root/target/linux/rdc-2.6/files/drivers
diff options
context:
space:
mode:
authorflorian <florian@3c298f89-4303-0410-b956-a3cf2f4a3e73>2007-08-06 14:15:57 +0000
committerflorian <florian@3c298f89-4303-0410-b956-a3cf2f4a3e73>2007-08-06 14:15:57 +0000
commit47ef8de2605ee325507e867ebb99bb3aade23f22 (patch)
tree6cacae14aefd2165449806a588da78bbea54ee72 /target/linux/rdc-2.6/files/drivers
parent94040edc4564cd2419a4d0898fdece22d0d205ea (diff)
Add generic gpio support to rdc, convert the led driver to be a platform driver, need to convert the flash driver as well
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@8348 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/rdc-2.6/files/drivers')
-rw-r--r--target/linux/rdc-2.6/files/drivers/leds/leds-rdc3211.c87
1 files changed, 27 insertions, 60 deletions
diff --git a/target/linux/rdc-2.6/files/drivers/leds/leds-rdc3211.c b/target/linux/rdc-2.6/files/drivers/leds/leds-rdc3211.c
index b98b43a5b5..b45a10e0a6 100644
--- a/target/linux/rdc-2.6/files/drivers/leds/leds-rdc3211.c
+++ b/target/linux/rdc-2.6/files/drivers/leds/leds-rdc3211.c
@@ -10,100 +10,67 @@
*/
#include <linux/kernel.h>
+#include <linux/module.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/leds.h>
#include <linux/err.h>
+#include <linux/delay.h>
#include <asm/io.h>
+#include <asm/gpio.h>
-#define LED_VAL 0x8000384C // the data ofset of gpio 0~30
+int gpio;
+module_param(gpio, int, 0444);
+MODULE_PARM_DESC(gpio, " GPIO line");
-static struct platform_device *pdev;
-
-static void rdc3211_led_set(struct led_classdev *led_cdev, enum led_brightness brightness)
+static void rdc321x_led_set(struct led_classdev *led_cdev, enum led_brightness brightness)
{
- unsigned long ul_ledstat = 0xffffffff;
- unsigned long led_bit = 1 << (led_cdev->flags);
-
- if (brightness)
- ul_ledstat &= ~led_bit;
- else
- ul_ledstat|= led_bit;
-
- outl(LED_VAL, 0xcf8);
- outl(ul_ledstat, 0xcfc);
+ gpio_set_value(gpio, brightness ? 1 : 0);
}
-static struct led_classdev rdc3211_power_led = {
- .name = "rdc3211:power",
- .flags = 15,
- .brightness_set = rdc3211_led_set,
+static struct led_classdev rdc321x_dmz_led = {
+ .name = "rdc321x:dmz",
+ .brightness_set = rdc321x_led_set,
};
-static struct led_classdev rdc3211_dmz_led = {
- .name = "rdc3211:dmz",
- .flags = 16,
- .brightness_set = rdc3211_led_set,
-};
-
-static int rdc3211_leds_probe(struct platform_device *pdev)
+static int rdc321x_leds_probe(struct platform_device *pdev)
{
- int ret;
-
- ret = led_classdev_register(&pdev->dev, &rdc3211_power_led);
- if (ret < 0)
- return ret;
-
- ret = led_classdev_register(&pdev->dev, &rdc3211_dmz_led);
- if (ret < 0)
- led_classdev_unregister(&rdc3211_power_led);
-
- return ret;
+ return led_classdev_register(&pdev->dev, &rdc321x_dmz_led);
}
-static int rdc3211_leds_remove(struct platform_device *pdev)
+static int rdc321x_leds_remove(struct platform_device *pdev)
{
- led_classdev_unregister(&rdc3211_power_led);
- led_classdev_unregister(&rdc3211_dmz_led);
+ led_classdev_unregister(&rdc321x_dmz_led);
return 0;
}
-static struct platform_driver rdc3211_leds_driver = {
- .probe = rdc3211_leds_probe,
- .remove = rdc3211_leds_remove,
+static struct platform_driver rdc321x_leds_driver = {
+ .probe = rdc321x_leds_probe,
+ .remove = rdc321x_leds_remove,
.driver = {
- .name = "rdc3211-leds",
+ .name = "rdc321x-leds",
+ .owner = THIS_MODULE,
}
};
-static int __init rdc3211_leds_init(void)
+static int __init rdc321x_leds_init(void)
{
int ret;
- ret = platform_driver_register(&rdc3211_leds_driver);
- if (ret < 0)
- goto out;
-
- pdev = platform_device_register_simple("rdc3211-leds", -1, NULL, 0);
- if (IS_ERR(pdev)) {
- ret = PTR_ERR(pdev);
- platform_driver_unregister(&rdc3211_leds_driver);
- goto out;
- }
+ ret = platform_driver_register(&rdc321x_leds_driver);
-out:
return ret;
}
-static void __exit rdc3211_leds_exit(void)
+static void __exit rdc321x_leds_exit(void)
{
- platform_driver_unregister(&rdc3211_leds_driver);
+ platform_driver_unregister(&rdc321x_leds_driver);
}
-module_init(rdc3211_leds_init);
-module_exit(rdc3211_leds_exit);
+module_init(rdc321x_leds_init);
+module_exit(rdc321x_leds_exit);
MODULE_AUTHOR("Florian Fainelli <florian@openwrt.org>");
-MODULE_DESCRIPTION("RDC3211 LED driver");
+MODULE_DESCRIPTION("RDC321x LED driver");
MODULE_LICENSE("GPL");