From fdb603ed6ba85180366c03cb3aae33afc1f19bfa Mon Sep 17 00:00:00 2001 From: Florian Fainelli Date: Fri, 11 May 2007 16:43:25 +0000 Subject: Rewrite LED driver, enable PCMCIA modules SVN-Revision: 7185 --- target/linux/rdc-2.6/config/default | 16 ++- .../rdc-2.6/files/drivers/leds/leds-rdc3211.c | 109 +++++++++++++++++++++ .../linux/rdc-2.6/patches/004-rdc3211_leds.patch | 27 +++++ 3 files changed, 149 insertions(+), 3 deletions(-) create mode 100644 target/linux/rdc-2.6/files/drivers/leds/leds-rdc3211.c create mode 100644 target/linux/rdc-2.6/patches/004-rdc3211_leds.patch (limited to 'target/linux') diff --git a/target/linux/rdc-2.6/config/default b/target/linux/rdc-2.6/config/default index 0e6cb38..7758633 100644 --- a/target/linux/rdc-2.6/config/default +++ b/target/linux/rdc-2.6/config/default @@ -4,6 +4,7 @@ # CONFIG_ACQUIRE_WDT is not set # CONFIG_ADVANTECH_WDT is not set # CONFIG_AGP is not set +# CONFIG_AIRO_CS is not set # CONFIG_ALIM1535_WDT is not set # CONFIG_ALIM7101_WDT is not set CONFIG_ARCH_MAY_HAVE_PC_FDC=y @@ -55,6 +56,7 @@ CONFIG_GENERIC_ISA_DMA=y # CONFIG_HANGCHECK_TIMER is not set # CONFIG_HIGHMEM4G is not set # CONFIG_HIGHMEM64G is not set +# CONFIG_HOSTAP_CS is not set # CONFIG_HPET_TIMER is not set CONFIG_HUGETLBFS=y CONFIG_HUGETLB_PAGE=y @@ -98,7 +100,7 @@ CONFIG_JFFS2_FS_DEBUG=0 CONFIG_JFFS2_RUBIN=y # CONFIG_KEXEC is not set CONFIG_KTIME_SCALAR=y -# CONFIG_LEDS_RDC3211 is not set +CONFIG_LEDS_RDC3211=m CONFIG_LIBCRC32C=y # CONFIG_M386 is not set CONFIG_M486=y @@ -205,6 +207,10 @@ CONFIG_PCI_GOANY=y # CONFIG_PCI_GOBIOS is not set # CONFIG_PCI_GODIRECT is not set # CONFIG_PCI_GOMMCONFIG is not set +CONFIG_PCMCIA=m +# CONFIG_PCMCIA_ATMEL is not set +CONFIG_PCMCIA_IOCTL=y +CONFIG_PCMCIA_LOAD_CIS=y CONFIG_PHYSICAL_START=0x100000 # CONFIG_PM is not set CONFIG_R6040=y @@ -223,6 +229,7 @@ CONFIG_RWSEM_XCHGADD_ALGORITHM=y # CONFIG_SCx200 is not set # CONFIG_SECCOMP is not set CONFIG_SEMAPHORE_SLEEPERS=y +# CONFIG_SERIAL_8250_CS is not set # CONFIG_SERIAL_8250_EXTENDED is not set CONFIG_SERIAL_8250_NR_UARTS=4 # CONFIG_SMP is not set @@ -230,7 +237,6 @@ CONFIG_SERIAL_8250_NR_UARTS=4 CONFIG_SOFT_WATCHDOG=m # CONFIG_SOUND is not set # CONFIG_SPARSEMEM_STATIC is not set -CONFIG_SYN_COOKIES=y # CONFIG_SYSVIPC is not set # CONFIG_TELCLOCK is not set # CONFIG_TOSHIBA is not set @@ -291,4 +297,8 @@ CONFIG_X86_RDC=y # CONFIG_X86_VOYAGER is not set CONFIG_X86_WP_WORKS_OK=y CONFIG_X86_XADD=y -# CONFIG_YENTA is not set +CONFIG_YENTA_ENE_TUNE=y +CONFIG_YENTA_O2=y +CONFIG_YENTA_RICOH=y +CONFIG_YENTA_TI=y +CONFIG_YENTA_TOSHIBA=y 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 new file mode 100644 index 0000000..b98b43a --- /dev/null +++ b/target/linux/rdc-2.6/files/drivers/leds/leds-rdc3211.c @@ -0,0 +1,109 @@ +/* + * LED driver for RDC3211 boards + * + * Copyright 2007 Florian Fainelli + * + * 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 +#include +#include +#include +#include + +#include + +#define LED_VAL 0x8000384C // the data ofset of gpio 0~30 + +static struct platform_device *pdev; + +static void rdc3211_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); +} + +static struct led_classdev rdc3211_power_led = { + .name = "rdc3211:power", + .flags = 15, + .brightness_set = rdc3211_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) +{ + 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; +} + +static int rdc3211_leds_remove(struct platform_device *pdev) +{ + led_classdev_unregister(&rdc3211_power_led); + led_classdev_unregister(&rdc3211_dmz_led); + return 0; +} + +static struct platform_driver rdc3211_leds_driver = { + .probe = rdc3211_leds_probe, + .remove = rdc3211_leds_remove, + .driver = { + .name = "rdc3211-leds", + } +}; + +static int __init rdc3211_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; + } + +out: + return ret; +} + +static void __exit rdc3211_leds_exit(void) +{ + platform_driver_unregister(&rdc3211_leds_driver); +} + +module_init(rdc3211_leds_init); +module_exit(rdc3211_leds_exit); + +MODULE_AUTHOR("Florian Fainelli "); +MODULE_DESCRIPTION("RDC3211 LED driver"); +MODULE_LICENSE("GPL"); diff --git a/target/linux/rdc-2.6/patches/004-rdc3211_leds.patch b/target/linux/rdc-2.6/patches/004-rdc3211_leds.patch new file mode 100644 index 0000000..3de3c8d --- /dev/null +++ b/target/linux/rdc-2.6/patches/004-rdc3211_leds.patch @@ -0,0 +1,27 @@ +diff -urN linux-2.6.19.2/drivers/leds/Kconfig linux-2.6.19.2.new/drivers/leds/Kconfig +--- linux-2.6.19.2/drivers/leds/Kconfig 2007-01-10 20:10:37.000000000 +0100 ++++ linux-2.6.19.2.new/drivers/leds/Kconfig 2007-04-16 22:09:40.000000000 +0200 +@@ -76,6 +76,12 @@ + This option enables support for the Soekris net4801 and net4826 error + LED. + ++config LEDS_RDC3211 ++ tristate "LED Support for RDC3211 boards" ++ depends on LEDS_CLASS && X86_RDC ++ help ++ This option enables support for the RDC3211 various LEDs. ++ + comment "LED Triggers" + + config LEDS_TRIGGERS +diff -urN linux-2.6.19.2/drivers/leds/Makefile linux-2.6.19.2.new/drivers/leds/Makefile +--- linux-2.6.19.2/drivers/leds/Makefile 2007-01-10 20:10:37.000000000 +0100 ++++ linux-2.6.19.2.new/drivers/leds/Makefile 2007-04-16 22:09:55.000000000 +0200 +@@ -13,6 +13,7 @@ + obj-$(CONFIG_LEDS_S3C24XX) += leds-s3c24xx.o + obj-$(CONFIG_LEDS_AMS_DELTA) += leds-ams-delta.o + obj-$(CONFIG_LEDS_NET48XX) += leds-net48xx.o ++obj-$(CONFIG_LEDS_RDC3211) += leds-rdc3211.o + + # LED Triggers + obj-$(CONFIG_LEDS_TRIGGER_TIMER) += ledtrig-timer.o -- cgit v1.1