Renumbered the fsg patch into nslu2-linux managed numbering area

SVN-Revision: 10167
v19.07.3_mercusys_ac12_duma
Rod Whitby 17 years ago
parent 45af6f04d1
commit 5b99e7f1c4

@ -302,7 +302,7 @@ Index: linux-2.6.23.12-armeb/arch/arm/mach-ixp4xx/fsg-setup.c
Index: linux-2.6.23.12-armeb/arch/arm/mach-ixp4xx/Kconfig
===================================================================
--- linux-2.6.23.12-armeb.orig/arch/arm/mach-ixp4xx/Kconfig 2008-01-09 12:49:04.000000000 +1030
+++ linux-2.6.23.12-armeb/arch/arm/mach-ixp4xx/Kconfig 2008-01-09 12:49:07.000000000 +1030
+++ linux-2.6.23.12-armeb/arch/arm/mach-ixp4xx/Kconfig 2008-01-11 13:24:01.000000000 +1030
@@ -125,6 +125,15 @@
depends on ARCH_IXDP425 || MACH_IXDP465 || MACH_KIXRP435
default y
@ -313,7 +313,7 @@ Index: linux-2.6.23.12-armeb/arch/arm/mach-ixp4xx/Kconfig
+ select PCI
+ help
+ Say 'Y' here if you want your kernel to support Freecom's
+ FSG-3 device. For more information on this platform
+ FSG-3 device. For more information on this platform,
+ see http://www.nslu2-linux.org/wiki/FSG3/HomePage
+
#
@ -342,8 +342,8 @@ Index: linux-2.6.23.12-armeb/arch/arm/mach-ixp4xx/Makefile
Index: linux-2.6.23.12-armeb/include/asm-arm/arch-ixp4xx/fsg.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6.23.12-armeb/include/asm-arm/arch-ixp4xx/fsg.h 2008-01-09 12:49:07.000000000 +1030
@@ -0,0 +1,74 @@
+++ linux-2.6.23.12-armeb/include/asm-arm/arch-ixp4xx/fsg.h 2008-01-11 13:29:42.000000000 +1030
@@ -0,0 +1,58 @@
+/*
+ * include/asm-arm/arch-ixp4xx/fsg.h
+ *
@ -396,28 +396,12 @@ Index: linux-2.6.23.12-armeb/include/asm-arm/arch-ixp4xx/fsg.h
+
+/* LEDs */
+
+#define FSG_LED_RING_GPIO 0
+#define FSG_LED_SYNC_GPIO 1
+#define FSG_LED_USB_GPIO 2
+#define FSG_LED_SATA_GPIO 3
+#define FSG_LED_WAN_GPIO 4
+#define FSG_LED_WLAN_GPIO 5
+
+/* %%% REMOVE %%%
+#define FSG_PCI_SLOT0_PIN 6
+#define FSG_PCI_SLOT1_PIN 7
+
+#define FSG_PCI_SLOT0_DEVID 14
+#define FSG_PCI_SLOT1_DEVID 15
+
+#define FSG_IDE_BASE_PHYS IXP4XX_EXP_BUS_BASE(3)
+#define FSG_IDE_BASE_VIRT 0xFFFE1000
+#define FSG_IDE_REGION_SIZE 0x1000
+
+#define FSG_IDE_DATA_PORT 0xFFFE10E0
+#define FSG_IDE_CTRL_PORT 0xFFFE10FC
+#define FSG_IDE_ERROR_PORT 0xFFFE10E2
+*/
+#define FSG_LED_WLAN_BIT 0
+#define FSG_LED_WAN_BIT 1
+#define FSG_LED_SATA_BIT 2
+#define FSG_LED_USB_BIT 4
+#define FSG_LED_RING_BIT 5
+#define FSG_LED_SYNC_BIT 7
Index: linux-2.6.23.12-armeb/include/asm-arm/arch-ixp4xx/hardware.h
===================================================================
--- linux-2.6.23.12-armeb.orig/include/asm-arm/arch-ixp4xx/hardware.h 2008-01-09 12:49:04.000000000 +1030
@ -432,8 +416,8 @@ Index: linux-2.6.23.12-armeb/include/asm-arm/arch-ixp4xx/hardware.h
Index: linux-2.6.23.12-armeb/include/asm-arm/arch-ixp4xx/irqs.h
===================================================================
--- linux-2.6.23.12-armeb.orig/include/asm-arm/arch-ixp4xx/irqs.h 2008-01-09 12:49:04.000000000 +1030
+++ linux-2.6.23.12-armeb/include/asm-arm/arch-ixp4xx/irqs.h 2008-01-09 12:49:07.000000000 +1030
@@ -128,4 +128,17 @@
+++ linux-2.6.23.12-armeb/include/asm-arm/arch-ixp4xx/irqs.h 2008-01-11 13:30:09.000000000 +1030
@@ -128,4 +128,11 @@
#define IRQ_DSMG600_PCI_INTE IRQ_IXP4XX_GPIO7
#define IRQ_DSMG600_PCI_INTF IRQ_IXP4XX_GPIO6
@ -443,19 +427,13 @@ Index: linux-2.6.23.12-armeb/include/asm-arm/arch-ixp4xx/irqs.h
+#define IRQ_FSG_PCI_INTA IRQ_IXP4XX_GPIO6
+#define IRQ_FSG_PCI_INTB IRQ_IXP4XX_GPIO7
+#define IRQ_FSG_PCI_INTC IRQ_IXP4XX_GPIO5
+
+/* %%% REMOVE %%%
+#define IRQ_FSG_PCI_SLOT0 IRQ_IXP4XX_GPIO6
+#define IRQ_FSG_PCI_SLOT1 IRQ_IXP4XX_GPIO7
+#define IRQ_FSG_IDE IRQ_IXP4XX_GPIO5
+*/
+
#endif
Index: linux-2.6.23.12-armeb/arch/arm/mach-ixp4xx/fsg-power.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6.23.12-armeb/arch/arm/mach-ixp4xx/fsg-power.c 2008-01-09 12:49:07.000000000 +1030
@@ -0,0 +1,87 @@
+++ linux-2.6.23.12-armeb/arch/arm/mach-ixp4xx/fsg-power.c 2008-01-11 12:47:50.000000000 +1030
@@ -0,0 +1,88 @@
+/*
+ * arch/arm/mach-ixp4xx/fsg-power.c
+ *
@ -474,9 +452,10 @@ Index: linux-2.6.23.12-armeb/arch/arm/mach-ixp4xx/fsg-power.c
+
+#include <linux/module.h>
+#include <linux/reboot.h>
+#include <linux/irq.h>
+#include <linux/interrupt.h>
+#include <linux/kernel.h>
+#include <linux/irq.h>
+#include <linux/jiffies.h>
+#include <linux/timer.h>
+
+#include <asm/mach-types.h>
+
@ -543,3 +522,280 @@ Index: linux-2.6.23.12-armeb/arch/arm/mach-ixp4xx/fsg-power.c
+MODULE_AUTHOR("Rod Whitby <rod@whitby.id.au>");
+MODULE_DESCRIPTION("FSG Power/Reset driver");
+MODULE_LICENSE("GPL");
Index: linux-2.6.23.12-armeb/drivers/leds/Kconfig
===================================================================
--- linux-2.6.23.12-armeb.orig/drivers/leds/Kconfig 2008-01-11 13:30:47.000000000 +1030
+++ linux-2.6.23.12-armeb/drivers/leds/Kconfig 2008-01-11 13:34:34.000000000 +1030
@@ -48,6 +48,12 @@
particular board must have LEDs and they must be connected
to the GPIO lines. If unsure, say Y.
+config LEDS_FSG
+ tristate "LED Support for the Freecom FSG-3"
+ depends on LEDS_CLASS && MACH_FSG
+ help
+ This option enables support for the LEDs on the Freecom FSG-3.
+
config LEDS_TOSA
tristate "LED Support for the Sharp SL-6000 series"
depends on LEDS_CLASS && PXA_SHARPSL
Index: linux-2.6.23.12-armeb/drivers/leds/Makefile
===================================================================
--- linux-2.6.23.12-armeb.orig/drivers/leds/Makefile 2008-01-11 13:30:50.000000000 +1030
+++ linux-2.6.23.12-armeb/drivers/leds/Makefile 2008-01-11 13:34:34.000000000 +1030
@@ -9,6 +9,7 @@
obj-$(CONFIG_LEDS_LOCOMO) += leds-locomo.o
obj-$(CONFIG_LEDS_SPITZ) += leds-spitz.o
obj-$(CONFIG_LEDS_IXP4XX) += leds-ixp4xx-gpio.o
+obj-$(CONFIG_LEDS_FSG) += leds-fsg.o
obj-$(CONFIG_LEDS_TOSA) += leds-tosa.o
obj-$(CONFIG_LEDS_S3C24XX) += leds-s3c24xx.o
obj-$(CONFIG_LEDS_AMS_DELTA) += leds-ams-delta.o
Index: linux-2.6.23.12-armeb/drivers/leds/leds-fsg.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6.23.12-armeb/drivers/leds/leds-fsg.c 2008-01-11 13:34:34.000000000 +1030
@@ -0,0 +1,243 @@
+/*
+ * LED Driver for the Freecom FSG-3
+ *
+ * Copyright (c) 2008 Rod Whitby <rod@whitby.id.au>
+ *
+ * Author: Rod Whitby <rod@whitby.id.au>
+ *
+ * Based on leds-spitz.c
+ * Copyright 2005-2006 Openedhand Ltd.
+ * Author: Richard Purdie <rpurdie@openedhand.com>
+ *
+ * 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 <asm/arch/hardware.h>
+#include <asm/io.h>
+
+static short __iomem *latch_address;
+static unsigned short latch_value;
+
+
+static void fsg_led_wlan_set(struct led_classdev *led_cdev, enum led_brightness value)
+{
+ if (value) {
+ latch_value &= ~(1 << FSG_LED_WLAN_BIT);
+ *latch_address = latch_value;
+ }
+ else {
+ latch_value |= (1 << FSG_LED_WLAN_BIT);
+ *latch_address = latch_value;
+ }
+}
+
+static void fsg_led_wan_set(struct led_classdev *led_cdev, enum led_brightness value)
+{
+ if (value) {
+ latch_value &= ~(1 << FSG_LED_WAN_BIT);
+ *latch_address = latch_value;
+ }
+ else {
+ latch_value |= (1 << FSG_LED_WAN_BIT);
+ *latch_address = latch_value;
+ }
+}
+
+static void fsg_led_sata_set(struct led_classdev *led_cdev, enum led_brightness value)
+{
+ if (value) {
+ latch_value &= ~(1 << FSG_LED_SATA_BIT);
+ *latch_address = latch_value;
+ }
+ else {
+ latch_value |= (1 << FSG_LED_SATA_BIT);
+ *latch_address = latch_value;
+ }
+}
+
+static void fsg_led_usb_set(struct led_classdev *led_cdev, enum led_brightness value)
+{
+ if (value) {
+ latch_value &= ~(1 << FSG_LED_USB_BIT);
+ *latch_address = latch_value;
+ }
+ else {
+ latch_value |= (1 << FSG_LED_USB_BIT);
+ *latch_address = latch_value;
+ }
+}
+
+static void fsg_led_sync_set(struct led_classdev *led_cdev, enum led_brightness value)
+{
+ if (value) {
+ latch_value &= ~(1 << FSG_LED_SYNC_BIT);
+ *latch_address = latch_value;
+ }
+ else {
+ latch_value |= (1 << FSG_LED_SYNC_BIT);
+ *latch_address = latch_value;
+ }
+}
+
+static void fsg_led_ring_set(struct led_classdev *led_cdev, enum led_brightness value)
+{
+ if (value) {
+ latch_value &= ~(1 << FSG_LED_RING_BIT);
+ *latch_address = latch_value;
+ }
+ else {
+ latch_value |= (1 << FSG_LED_RING_BIT);
+ *latch_address = latch_value;
+ }
+}
+
+
+
+static struct led_classdev fsg_wlan_led = {
+ .name = "fsg:wlan",
+ .brightness_set = fsg_led_wlan_set,
+};
+
+static struct led_classdev fsg_wan_led = {
+ .name = "fsg:wan",
+ .brightness_set = fsg_led_wan_set,
+};
+
+static struct led_classdev fsg_sata_led = {
+ .name = "fsg:sata",
+ .brightness_set = fsg_led_sata_set,
+};
+
+static struct led_classdev fsg_usb_led = {
+ .name = "fsg:usb",
+ .brightness_set = fsg_led_usb_set,
+};
+
+static struct led_classdev fsg_sync_led = {
+ .name = "fsg:sync",
+ .brightness_set = fsg_led_sync_set,
+};
+
+static struct led_classdev fsg_ring_led = {
+ .name = "fsg:ring",
+ .brightness_set = fsg_led_ring_set,
+};
+
+
+
+#ifdef CONFIG_PM
+static int fsg_led_suspend(struct platform_device *dev, pm_message_t state)
+{
+ led_classdev_suspend(&fsg_wlan_led);
+ led_classdev_suspend(&fsg_wan_led);
+ led_classdev_suspend(&fsg_sata_led);
+ led_classdev_suspend(&fsg_usb_led);
+ led_classdev_suspend(&fsg_sync_led);
+ led_classdev_suspend(&fsg_ring_led);
+ return 0;
+}
+
+static int fsg_led_resume(struct platform_device *dev)
+{
+ led_classdev_resume(&fsg_wlan_led);
+ led_classdev_resume(&fsg_wan_led);
+ led_classdev_resume(&fsg_sata_led);
+ led_classdev_resume(&fsg_usb_led);
+ led_classdev_resume(&fsg_sync_led);
+ led_classdev_resume(&fsg_ring_led);
+ return 0;
+}
+#endif
+
+
+static int fsg_led_probe(struct platform_device *pdev)
+{
+ int ret;
+
+ /* FIXME: Need to work out how to handle failure below */
+
+ ret = led_classdev_register(&pdev->dev, &fsg_wlan_led);
+ if (ret < 0)
+ return ret;
+
+ ret = led_classdev_register(&pdev->dev, &fsg_wan_led);
+ if (ret < 0)
+ return ret;
+
+ ret = led_classdev_register(&pdev->dev, &fsg_sata_led);
+ if (ret < 0)
+ return ret;
+
+ ret = led_classdev_register(&pdev->dev, &fsg_usb_led);
+ if (ret < 0)
+ return ret;
+
+ ret = led_classdev_register(&pdev->dev, &fsg_sync_led);
+ if (ret < 0)
+ return ret;
+
+ ret = led_classdev_register(&pdev->dev, &fsg_ring_led);
+ if (ret < 0)
+ return ret;
+
+ return ret;
+}
+
+static int fsg_led_remove(struct platform_device *pdev)
+{
+ led_classdev_unregister(&fsg_wlan_led);
+ led_classdev_unregister(&fsg_wan_led);
+ led_classdev_unregister(&fsg_sata_led);
+ led_classdev_unregister(&fsg_usb_led);
+ led_classdev_unregister(&fsg_sync_led);
+ led_classdev_unregister(&fsg_ring_led);
+
+ return 0;
+}
+
+
+static struct platform_driver fsg_led_driver = {
+ .probe = fsg_led_probe,
+ .remove = fsg_led_remove,
+#ifdef CONFIG_PM
+ .suspend = fsg_led_suspend,
+ .resume = fsg_led_resume,
+#endif
+ .driver = {
+ .name = "fsg-led",
+ },
+};
+
+
+static int __init fsg_led_init(void)
+{
+ /* Map the LED chip select address space */
+ latch_address = (unsigned short *) ioremap(IXP4XX_EXP_BUS_BASE(2), 512);
+ if (!latch_address)
+ return -ENOMEM;
+ latch_value = 0xffff;
+ *latch_address = latch_value;
+ /* FIXME: We leak memory if the next line fails */
+ return platform_driver_register(&fsg_led_driver);
+}
+
+static void __exit fsg_led_exit(void)
+{
+ platform_driver_unregister(&fsg_led_driver);
+ iounmap(latch_address);
+}
+
+
+module_init(fsg_led_init);
+module_exit(fsg_led_exit);
+
+MODULE_AUTHOR("Rod Whitby <rod@whitby.id.au>");
+MODULE_DESCRIPTION("Freecom FSG-3 LED driver");
+MODULE_LICENSE("GPL");
Loading…
Cancel
Save