From 5c27094d8bb4573126643589cdfa2bc582e56766 Mon Sep 17 00:00:00 2001 From: John Bowler Date: Fri, 7 Oct 2005 05:51:40 +0000 Subject: nslu2-kernel: integrate 2.6.14-rc3 patchset 4 --- .../linux/nslu2-kernel/2.6.14/30-i2c-x1205.patch | 148 +++++-- .../nslu2-kernel/2.6.14/50-nslu2-beeper.patch | 144 ------- .../nslu2-kernel/2.6.14/50-nslu2-general.patch | 439 +++++++++++++++++---- .../nslu2-kernel/2.6.14/60-nslu2-beeper.patch | 178 +++++++++ 4 files changed, 671 insertions(+), 238 deletions(-) delete mode 100644 packages/linux/nslu2-kernel/2.6.14/50-nslu2-beeper.patch create mode 100644 packages/linux/nslu2-kernel/2.6.14/60-nslu2-beeper.patch (limited to 'packages/linux/nslu2-kernel') diff --git a/packages/linux/nslu2-kernel/2.6.14/30-i2c-x1205.patch b/packages/linux/nslu2-kernel/2.6.14/30-i2c-x1205.patch index c212238941..1e775ba8b8 100644 --- a/packages/linux/nslu2-kernel/2.6.14/30-i2c-x1205.patch +++ b/packages/linux/nslu2-kernel/2.6.14/30-i2c-x1205.patch @@ -1,13 +1,13 @@ ---- linux-2.6.14-rc2/drivers/i2c/chips/Kconfig 2005-09-24 13:17:13.000000000 +0200 -+++ test3/drivers/i2c/chips/Kconfig 2005-09-24 16:09:51.000000000 +0200 -@@ -126,4 +126,14 @@ +diff -urN linux-2.6.14-rc3/drivers/i2c/chips/Kconfig test9/drivers/i2c/chips/Kconfig +--- linux-2.6.14-rc3/drivers/i2c/chips/Kconfig 2005-10-01 13:46:50.000000000 +0200 ++++ test9/drivers/i2c/chips/Kconfig 2005-10-03 16:10:22.000000000 +0200 +@@ -126,4 +126,13 @@ This driver can also be built as a module. If so, the module will be called max6875. +config SENSORS_X1205 + tristate "Xicor X1205 RTC chip" + depends on I2C -+ select I2C_SENSOR + help + If you say yes here you get support for the Xicor X1205 RTC chip. + @@ -15,8 +15,9 @@ + will be called x1205 + endmenu ---- linux-2.6.14-rc2/drivers/i2c/chips/Makefile 2005-09-17 12:42:33.000000000 +0200 -+++ test3/drivers/i2c/chips/Makefile 2005-09-24 16:49:34.000000000 +0200 +diff -urN linux-2.6.14-rc3/drivers/i2c/chips/Makefile test9/drivers/i2c/chips/Makefile +--- linux-2.6.14-rc3/drivers/i2c/chips/Makefile 2005-09-17 12:42:33.000000000 +0200 ++++ test9/drivers/i2c/chips/Makefile 2005-10-01 15:30:06.000000000 +0200 @@ -13,6 +13,7 @@ obj-$(CONFIG_SENSORS_RTC8564) += rtc8564.o obj-$(CONFIG_ISP1301_OMAP) += isp1301_omap.o @@ -25,10 +26,10 @@ ifeq ($(CONFIG_I2C_DEBUG_CHIP),y) EXTRA_CFLAGS += -DDEBUG -diff -urN linux-2.6.14-rc2/drivers/i2c/chips/x1205.c test3/drivers/i2c/chips/x1205.c ---- linux-2.6.14-rc2/drivers/i2c/chips/x1205.c 1970-01-01 01:00:00.000000000 +0100 -+++ test3/drivers/i2c/chips/x1205.c 2005-09-24 16:11:16.000000000 +0200 -@@ -0,0 +1,522 @@ +diff -urN linux-2.6.14-rc3/drivers/i2c/chips/x1205.c test9/drivers/i2c/chips/x1205.c +--- linux-2.6.14-rc3/drivers/i2c/chips/x1205.c 1970-01-01 01:00:00.000000000 +0100 ++++ test9/drivers/i2c/chips/x1205.c 2005-10-03 16:02:57.000000000 +0200 +@@ -0,0 +1,612 @@ +/* + * linux/drivers/i2c/chips/x1205.c + * @@ -62,7 +63,7 @@ diff -urN linux-2.6.14-rc2/drivers/i2c/chips/x1205.c test3/drivers/i2c/chips/x12 +#define EPOCH_1900 1900 +#define EPOCH_1970 1970 + -+#define DRIVER_VERSION "0.9.5" ++#define DRIVER_VERSION "0.9.6" +#define DRIVER_NAME (x1205_driver.name) + + @@ -140,20 +141,36 @@ diff -urN linux-2.6.14-rc2/drivers/i2c/chips/x1205.c test3/drivers/i2c/chips/x12 +static int x1205_get_datetime(struct i2c_client *client, struct rtc_time *tm, + u8 reg_base) +{ -+ static unsigned char addr[2] = { 0, }; -+ unsigned char buf[8]; ++ static unsigned char dt_addr[] = { 0, }; ++ static unsigned char sr_addr[] = { 0, }; + -+ struct i2c_msg msgs[2] = { -+ { client->addr, 0, 2, addr }, /* random read */ ++ unsigned char buf[8], sr; ++ ++ struct i2c_msg msgs[] = { ++ { client->addr, 0, 2, sr_addr }, /* random read */ ++ { client->addr, I2C_M_RD, 1, &sr }, ++ { client->addr, 0, 2, dt_addr }, /* random read */ + { client->addr, I2C_M_RD, 8, buf }, + }; + + struct x1205_data *xdata = i2c_get_clientdata(client); + -+ addr[1] = reg_base; ++ dt_addr[1] = reg_base; ++ sr_addr[1] = X1205_REG_SR; ++ ++ if ((i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs))) == ++ ARRAY_SIZE(msgs)) { ++ /* did we read the correct number of messages? */ + -+ if ((i2c_transfer(client->adapter, msgs, 2)) == 2) { -+ /* did we read 2 messages? */ ++ /* check for battery failure */ ++ if (sr & X1205_SR_RTCF) ++ { ++ dev_info(&client->adapter->dev, ++ "%s: Clock had a power failure, you must set the date.\n", ++ DRIVER_NAME); ++ ++ return -EINVAL; ++ } + + dev_dbg(&client->dev, + "%s: raw read data - sec-%02x min-%02x hr-%02x" @@ -318,6 +335,14 @@ diff -urN linux-2.6.14-rc2/drivers/i2c/chips/x1205.c test3/drivers/i2c/chips/x12 + return 0; +} + ++struct x1205_limit ++{ ++ unsigned char reg; ++ unsigned char mask; ++ unsigned char min; ++ unsigned char max; ++}; ++ +static int x1205_validate_client(struct i2c_client *client) +{ + int i, xfer; @@ -326,7 +351,7 @@ diff -urN linux-2.6.14-rc2/drivers/i2c/chips/x1205.c test3/drivers/i2c/chips/x12 + * address and check if the given bits are zero. + */ + -+ const unsigned char probe_pattern[] = { ++ const unsigned char probe_zero_pattern[] = { + + X1205_REG_SR, 0x18, + X1205_REG_Y2K, 0xC6, @@ -337,7 +362,7 @@ diff -urN linux-2.6.14-rc2/drivers/i2c/chips/x1205.c test3/drivers/i2c/chips/x12 + X1205_REG_MN, 0x80, + X1205_REG_SC, 0x80, + X1205_REG_DTR, 0xF8, -+ X1205_REG_ATR, 0x18, ++ X1205_REG_ATR, 0xC0, + X1205_REG_INT, 0x18, + X1205_REG_0, 0xFF, + X1205_REG_Y2K1, 0xC6, @@ -352,7 +377,35 @@ diff -urN linux-2.6.14-rc2/drivers/i2c/chips/x1205.c test3/drivers/i2c/chips/x12 + X1205_REG_HRA0, 0x40, + }; + -+ for (i = 0; i < sizeof(probe_pattern); i += 2) ++ const struct x1205_limit probe_limits_pattern[] = { ++ /* register, mask, min, max */ ++ { X1205_REG_Y2K, 0xFF, 19, 20 }, ++ { X1205_REG_DW, 0xFF, 0, 6 }, ++ { X1205_REG_YR, 0xFF, 0, 99 }, ++ { X1205_REG_MO, 0xFF, 0, 12 }, ++ { X1205_REG_DT, 0xFF, 0, 31 }, ++ { X1205_REG_HR, 0x7F, 0, 23 }, ++ { X1205_REG_MN, 0xFF, 0, 59 }, ++ { X1205_REG_SC, 0xFF, 0, 59 }, ++ { X1205_REG_Y2K1, 0xFF, 19, 20 }, ++ { X1205_REG_DWA1, 0x7F, 0, 6 }, ++ { X1205_REG_MOA1, 0x7F, 0, 12 }, ++ { X1205_REG_DTA1, 0x7F, 0, 31 }, ++ { X1205_REG_HRA1, 0x7F, 0, 23 }, ++ { X1205_REG_MNA1, 0x7F, 0, 59 }, ++ { X1205_REG_SCA1, 0x7F, 0, 59 }, ++ { X1205_REG_Y2K0, 0xFF, 19, 20 }, ++ { X1205_REG_DWA0, 0x7F, 0, 6 }, ++ { X1205_REG_MOA0, 0x7F, 0, 12 }, ++ { X1205_REG_DTA0, 0x7F, 0, 31 }, ++ { X1205_REG_HRA0, 0x7F, 0, 23 }, ++ { X1205_REG_MNA0, 0x7F, 0, 59 }, ++ { X1205_REG_SCA0, 0x7F, 0, 59 }, ++ }; ++ ++ /* check that registers have bits a 0 where expected */ ++ ++ for (i = 0; i < ARRAY_SIZE(probe_zero_pattern); i += 2) + { + unsigned char buf; + @@ -364,7 +417,7 @@ diff -urN linux-2.6.14-rc2/drivers/i2c/chips/x1205.c test3/drivers/i2c/chips/x12 + }; + + addr[0] = 0x00; -+ addr[1] = probe_pattern[i]; ++ addr[1] = probe_zero_pattern[i]; + + xfer = i2c_transfer(client->adapter, msgs, 2); + @@ -376,15 +429,53 @@ diff -urN linux-2.6.14-rc2/drivers/i2c/chips/x1205.c test3/drivers/i2c/chips/x12 + return -EIO; + } + -+ if ((buf & probe_pattern[i+1]) != 0) { ++ if ((buf & probe_zero_pattern[i+1]) != 0) { + dev_dbg(&client->adapter->dev, -+ "%s: register %x, pattern %d: %x\n", ++ "%s: register %x, zero pattern %d: %x\n", + __FUNCTION__, addr[1], i, buf); + + return -ENODEV; + } + } + ++ /* check limits */ ++ ++ for (i = 0; i < ARRAY_SIZE(probe_limits_pattern); i++) ++ { ++ unsigned char buf, val; ++ ++ static unsigned char addr[2]; ++ ++ struct i2c_msg msgs[2] = { ++ { client->addr, 0, 2, addr }, /* random read */ ++ { client->addr, I2C_M_RD, 1, &buf }, ++ }; ++ ++ addr[0] = 0x00; ++ addr[1] = probe_limits_pattern[i].reg; ++ ++ xfer = i2c_transfer(client->adapter, msgs, 2); ++ ++ if (xfer != 2) { ++ dev_dbg(&client->adapter->dev, ++ "%s: could not read register %x\n", ++ __FUNCTION__, addr[1]); ++ ++ return -EIO; ++ } ++ ++ val = BCD2BIN(buf & probe_limits_pattern[i].mask); ++ ++ if (val > probe_limits_pattern[i].max || ++ val < probe_limits_pattern[i].min) { ++ dev_dbg(&client->adapter->dev, ++ "%s: register %x, lim pattern %d: %d\n", ++ __FUNCTION__, addr[1], i, val); ++ ++ return -ENODEV; ++ } ++ } ++ + return 0; +} + @@ -444,7 +535,7 @@ diff -urN linux-2.6.14-rc2/drivers/i2c/chips/x1205.c test3/drivers/i2c/chips/x12 + + list_add(&xdata->list, &x1205_clients); + -+ dev_info(&adapter->dev, "%s: chip found, driver " DRIVER_VERSION "\n", ++ dev_info(&adapter->dev, "%s: Chip found, driver " DRIVER_VERSION "\n", + DRIVER_NAME); + + /* If requested, se the system time */ @@ -551,9 +642,9 @@ diff -urN linux-2.6.14-rc2/drivers/i2c/chips/x1205.c test3/drivers/i2c/chips/x12 + +module_init(x1205_init); +module_exit(x1205_exit); ---- linux-2.6.14-rc2/include/linux/x1205.h 1970-01-01 01:00:00.000000000 +0100 -+++ test3/include/linux/x1205.h 2005-09-24 16:59:28.000000000 +0200 -@@ -0,0 +1,66 @@ +--- linux-2.6.14-rc3/include/linux/x1205.h 1970-01-01 01:00:00.000000000 +0100 ++++ test9/include/linux/x1205.h 2005-10-03 15:38:21.000000000 +0200 +@@ -0,0 +1,67 @@ + +/* commands */ + @@ -613,6 +704,7 @@ diff -urN linux-2.6.14-rc2/drivers/i2c/chips/x1205.c test3/drivers/i2c/chips/x12 +#define X1205_CCR_BASE 0x30 /* Base address of CCR */ +#define X1205_ALM0_BASE 0x00 /* Base address of ALARM0 */ + ++#define X1205_SR_RTCF 0x01 +#define X1205_SR_WEL 0x02 /* Write Enable Latch bit */ +#define X1205_SR_RWEL 0x04 /* Register Write Enable Bit */ + diff --git a/packages/linux/nslu2-kernel/2.6.14/50-nslu2-beeper.patch b/packages/linux/nslu2-kernel/2.6.14/50-nslu2-beeper.patch deleted file mode 100644 index cf2de14c68..0000000000 --- a/packages/linux/nslu2-kernel/2.6.14/50-nslu2-beeper.patch +++ /dev/null @@ -1,144 +0,0 @@ -diff -urN linux-2.6.14-rc2/drivers/input/misc/Kconfig test6/drivers/input/misc/Kconfig ---- linux-2.6.14-rc2/drivers/input/misc/Kconfig 2005-09-17 12:42:09.000000000 +0200 -+++ test6/drivers/input/misc/Kconfig 2005-09-28 19:24:52.000000000 +0200 -@@ -40,6 +40,18 @@ - tristate "M68k Beeper support" - depends on M68K - -+config INPUT_NSLU2_BEEPER -+ tristate "NSLU2 Beeper support" -+ depends on MACH_NSLU2 -+ help -+ Say Y here if you want the embedded beeper on the LinkSys NSLU2 -+ to be used for bells and whistles. -+ -+ If unsure, say Y. -+ -+ To compile this driver as a module, choose M here: the -+ module will be called nslu2spkr. -+ - config INPUT_UINPUT - tristate "User level driver support" - help -diff -urN linux-2.6.14-rc2/drivers/input/misc/Makefile test6/drivers/input/misc/Makefile ---- linux-2.6.14-rc2/drivers/input/misc/Makefile 2005-09-17 12:42:09.000000000 +0200 -+++ test6/drivers/input/misc/Makefile 2005-09-28 17:01:19.000000000 +0200 -@@ -10,3 +10,4 @@ - obj-$(CONFIG_INPUT_98SPKR) += 98spkr.o - obj-$(CONFIG_INPUT_UINPUT) += uinput.o - obj-$(CONFIG_HP_SDC_RTC) += hp_sdc_rtc.o -+obj-$(CONFIG_INPUT_NSLU2_BEEPER) += nslu2spkr.o -diff -urN linux-2.6.14-rc2/drivers/input/misc/nslu2spkr.c test6/drivers/input/misc/nslu2spkr.c ---- linux-2.6.14-rc2/drivers/input/misc/nslu2spkr.c 1970-01-01 01:00:00.000000000 +0100 -+++ test6/drivers/input/misc/nslu2spkr.c 2005-09-28 19:23:34.000000000 +0200 -@@ -0,0 +1,110 @@ -+/* -+ * drivers/input/misc/nslu2spkr.c -+ * -+ * NSLU2 Beeper driver -+ * -+ * Copyright (C) 2005 Tower Technologies -+ * -+ * based on nslu2-io.c -+ * Copyright (C) 2004 Karen Spearel -+ * -+ * Author: Alessandro Zummo -+ * Maintainers: http://www.nslu2-linux.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 -+#include -+#include -+#include -+#include -+ -+#include -+#include -+ -+DEFINE_SPINLOCK(beep_lock); -+ -+static int nslu2_spkr_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) -+{ -+ unsigned int count = 0; -+ unsigned long flags; -+ -+ if (type != EV_SND) -+ return -1; -+ -+ switch (code) { -+ case SND_BELL: -+ if (value) value = 5000; -+ case SND_TONE: -+ break; -+ default: -+ return -1; -+ } -+ -+ if (value > 20 && value < 32767) -+ count = 1193182 / value; -+ -+ spin_lock_irqsave(&beep_lock, flags); -+ -+ *IXP4XX_GPIO_GPOER &= ~NSLU2_BZ_BM; -+ -+ while (count) { -+ *IXP4XX_GPIO_GPOUTR &= ~NSLU2_BZ_BM; -+ udelay(500); -+ -+ *IXP4XX_GPIO_GPOUTR |= NSLU2_BZ_BM; -+ udelay(500); -+ -+ count--; -+ } -+ -+ *IXP4XX_GPIO_GPOER |= NSLU2_BZ_BM; -+ -+ spin_unlock_irqrestore(&beep_lock, flags); -+ -+ return 0; -+} -+ -+static struct input_dev nslu2_spkr_dev = { -+ .phys = "nslu2/gpio4", -+ .name = "NSLU2 Beeper", -+ .evbit[0] = BIT(EV_SND), -+ .sndbit[0] = BIT(SND_BELL), -+ .event = nslu2_spkr_event, -+ .id = { -+ .bustype = BUS_HOST, -+ .vendor = 0x001f, -+ .product = 0x0001, -+ .version = 0x0100 -+ } -+}; -+ -+ -+static int __init nslu2_spkr_init(void) -+{ -+ input_register_device(&nslu2_spkr_dev); -+ -+ nslu2_spkr_event(NULL, EV_SND, SND_BELL, 1); -+ -+ printk(KERN_INFO "input: %s\n", nslu2_spkr_dev.name); -+ return 0; -+} -+ -+static void __exit nslu2_spkr_exit(void) -+{ -+ input_unregister_device(&nslu2_spkr_dev); -+ -+ /* turn it off */ -+ nslu2_spkr_event(NULL, EV_SND, SND_BELL, 0); -+} -+ -+module_init(nslu2_spkr_init); -+module_exit(nslu2_spkr_exit); -+ -+MODULE_AUTHOR("Alessandro Zummo "); -+MODULE_DESCRIPTION("NSLU2 Beeper driver"); -+MODULE_LICENSE("GPL"); diff --git a/packages/linux/nslu2-kernel/2.6.14/50-nslu2-general.patch b/packages/linux/nslu2-kernel/2.6.14/50-nslu2-general.patch index c5b513c5e1..c0c8d51731 100644 --- a/packages/linux/nslu2-kernel/2.6.14/50-nslu2-general.patch +++ b/packages/linux/nslu2-kernel/2.6.14/50-nslu2-general.patch @@ -1,15 +1,18 @@ ---- linux-2.6.14-rc2/arch/arm/mach-ixp4xx/Makefile 2005-09-17 12:42:02.000000000 +0200 -+++ test6/arch/arm/mach-ixp4xx/Makefile 2005-09-28 21:58:36.000000000 +0200 -@@ -8,4 +8,6 @@ +--- linux-2.6.14-rc3/arch/arm/mach-ixp4xx/Makefile 2005-09-17 12:42:02.000000000 +0200 ++++ test14/arch/arm/mach-ixp4xx/Makefile 2005-10-06 21:29:53.000000000 +0200 +@@ -8,4 +8,9 @@ obj-$(CONFIG_MACH_IXDPG425) += ixdpg425-pci.o coyote-setup.o obj-$(CONFIG_ARCH_ADI_COYOTE) += coyote-pci.o coyote-setup.o obj-$(CONFIG_MACH_GTWX5715) += gtwx5715-pci.o gtwx5715-setup.o +obj-$(CONFIG_MACH_NSLU2) += nslu2-pci.o nslu2-setup.o nslu2-power.o nslu2-rtc.o nslu2-io.o + ++leds-$(CONFIG_MACH_NSLU2) += nslu2-leds.o ++obj-$(CONFIG_LEDS) += $(leds-y) ++ ---- linux-2.6.14-rc2/arch/arm/mach-ixp4xx/nslu2-rtc.c 1970-01-01 01:00:00.000000000 +0100 -+++ test6/arch/arm/mach-ixp4xx/nslu2-rtc.c 2005-09-28 03:02:42.000000000 +0200 -@@ -0,0 +1,108 @@ +--- linux-2.6.14-rc3/arch/arm/mach-ixp4xx/nslu2-rtc.c 1970-01-01 01:00:00.000000000 +0100 ++++ test14/arch/arm/mach-ixp4xx/nslu2-rtc.c 2005-10-06 21:29:53.000000000 +0200 +@@ -0,0 +1,113 @@ +/* + * arch/arm/mach-ixp4xx/nslu2-rtc.c + * @@ -37,7 +40,7 @@ +#include + +#include -+ ++#include + +extern int (*set_rtc)(void); + @@ -99,9 +102,14 @@ + +static int __init nslu2_rtc_init(void) +{ -+ int ret = register_rtc(&rtc_ops); ++ int ret; + -+ if (ret) ++ if (!(machine_is_nslu2())) ++ return 0; ++ ++ printk(KERN_INFO "NSLU2: rtc\n"); ++ ++ if ((ret = register_rtc(&rtc_ops)) != 0) + return ret; + + set_rtc = nslu2_set_rtc; @@ -118,9 +126,9 @@ + +module_init(nslu2_rtc_init); +module_exit(nslu2_rtc_exit); ---- linux-2.6.14-rc2/arch/arm/mach-ixp4xx/nslu2-io.c 1970-01-01 01:00:00.000000000 +0100 -+++ test6/arch/arm/mach-ixp4xx/nslu2-io.c 2005-09-28 22:02:12.000000000 +0200 -@@ -0,0 +1,540 @@ +--- linux-2.6.14-rc3/arch/arm/mach-ixp4xx/nslu2-io.c 1970-01-01 01:00:00.000000000 +0100 ++++ test14/arch/arm/mach-ixp4xx/nslu2-io.c 2005-10-06 21:29:53.000000000 +0200 +@@ -0,0 +1,548 @@ +//============================================================================= +// +// n2-io.c version 0.1.7 @@ -172,6 +180,7 @@ +#define NSLU2BZ_MAJOR 62 //buzzer +#define NSLU2LM_MAJOR 126 + ++ +#define NSLU2_BEEP_DUR_LONG 2000 +#define NSLU2_BEEP_DUR_MED 400 +#define NSLU2_BEEP_DUR_SHORT 100 @@ -180,7 +189,7 @@ +#define NSLU2_BEEP_PITCH_LOW 1000 +#define NSLU2_LONG_DELAY 30000 + -+ ++#define NSLU2_BZ_BM (1L << NSLU2_GPIO_BUZZ) + +// ioctls -- 'M" is used for sound cards...we don't got one so it seems safe + @@ -241,7 +250,6 @@ +#define LED_DISK2 3 +#define LED_ALL 4 + -+static unsigned long init_jiffy = 0; /* jiffies at init time */ +static unsigned long ontime = 50; +static unsigned long offtime = 450; +static unsigned long bz_repeatcnt = 10; @@ -264,6 +272,7 @@ +// +//================================================================================================== +// this blinks rs green or green/yellow if rs red is on ++#ifndef CONFIG_LEDS +static void n2lm_rsg_handler(unsigned long data) +{ + *IXP4XX_GPIO_GPOUTR ^= RS_GRN_TGL; //flip the led @@ -475,6 +484,7 @@ + .owner = THIS_MODULE, + .ioctl = n2lm_ioctl, +}; ++#endif +//================================================================================================== +// We can't do anything fancy here since the system tick rate is far below that required to +// generate a desirable tone. Therefore we haven't much choice but to use a busy loop until @@ -577,29 +587,34 @@ + +static void n2iom_initarch(void) +{ -+ printk(KERN_DEBUG "setup_interrupts - jiffies=%ld init_jiffy=%ld\n", jiffies, init_jiffy); -+ ++#ifndef CONFIG_LEDS + init_timer(&n2lm_rsg_timer); + init_timer(&n2lm_rsr_timer); + init_timer(&n2lm_d1_timer); + init_timer(&n2lm_d2_timer); -+ init_timer(&n2bz_timer); + + n2lm_rsr_timer.function = n2lm_rsr_handler; + n2lm_rsg_timer.function = n2lm_rsg_handler; + n2lm_d2_timer.function = n2lm_d2_handler; + n2lm_d1_timer.function = n2lm_d1_handler; ++#endif ++ ++ init_timer(&n2bz_timer); + n2bz_timer.function = n2bz_handler; ++ + n2lm_rsr_timer.data = n2lm_rsg_timer.data = n2lm_d1_timer.data = n2lm_d2_timer.data = n2bz_timer.data = 0; + ++#ifndef CONFIG_LEDS + *IXP4XX_GPIO_GPOER &= 0xfffffff0; //enable gpio 0-3 + *IXP4XX_GPIO_GPOUTR |= 0x00000003; //turn off the leds + *IXP4XX_GPIO_GPOUTR &= 0xfffffffc; + n2lm_ledon(LED_ALL); + n2_buzz(NSLU2_BEEP_PITCH_MED, NSLU2_BEEP_DUR_SHORT); + n2lm_ledoff(LED_ALL); -+// Default the Ready/Status to Red during kernel boot, Turn Green at the end of sysvinit ++ ++ // Default the Ready/Status to Red during kernel boot, Turn Green at the end of sysvinit + n2lm_ledon(LED_RS_RED); ++#endif + + return; +} @@ -608,14 +623,13 @@ + +static int __init n2iom_init(void) +{ -+ printk(KERN_INFO "NSLU2 I/O driver %s\n", VERSION); ++ printk(KERN_INFO "NSLU2: i/o, %s\n", VERSION); + -+ init_jiffy = jiffies; -+ printk(KERN_DEBUG "init_jiffy=%ld\n",init_jiffy); + n2iom_initarch(); + + n2lm_class = class_create(THIS_MODULE, "nslu2"); + ++#ifndef CONFIG_LEDS + if (register_chrdev(NSLU2LM_MAJOR, "n2_ledm", &n2lm_fops) < 0) { + printk(KERN_DEBUG "Led Manager Major %d not available\n", NSLU2LM_MAJOR); + return -EBUSY; @@ -623,6 +637,8 @@ + else { + class_device_create(n2lm_class, MKDEV(NSLU2LM_MAJOR, 0), NULL, "leds"); + } ++#endif ++ + if (register_chrdev(NSLU2BZ_MAJOR, "n2_bzm", &n2bz_fops) < 0) { + printk(KERN_DEBUG "Buzzer Major %d not available\n", NSLU2BZ_MAJOR); + return -EBUSY; @@ -638,6 +654,8 @@ + +static void __exit n2iom_exit(void) +{ ++ ++#ifndef CONFIG_LEDS + del_timer(&n2lm_rsg_timer); + del_timer(&n2lm_rsr_timer); + del_timer(&n2lm_d1_timer); @@ -645,6 +663,7 @@ + + unregister_chrdev(NSLU2LM_MAJOR, "n2lm" ); + class_device_destroy(n2lm_class, MKDEV(NSLU2LM_MAJOR, 0)); ++#endif + + unregister_chrdev(NSLU2BZ_MAJOR, "n2bz"); + class_device_destroy(n2lm_class, MKDEV(NSLU2BZ_MAJOR, 0)); @@ -652,18 +671,15 @@ + class_destroy(n2lm_class); +} + -+module_init (n2iom_init); -+module_exit (n2iom_exit); ++module_init(n2iom_init); ++module_exit(n2iom_exit); + +MODULE_AUTHOR("Karen Spearel "); +MODULE_DESCRIPTION("NSLU2 I/O driver"); +MODULE_LICENSE("GPL"); -+static int debug = 7; -+module_param(debug, int, 0644); -+MODULE_PARM_DESC(debug, "Debugging enabled = 8"); ---- linux-2.6.14-rc2/arch/arm/mach-ixp4xx/nslu2-setup.c 1970-01-01 01:00:00.000000000 +0100 -+++ test6/arch/arm/mach-ixp4xx/nslu2-setup.c 2005-09-27 20:19:14.000000000 +0200 -@@ -0,0 +1,131 @@ +--- linux-2.6.14-rc3/arch/arm/mach-ixp4xx/nslu2-setup.c 1970-01-01 01:00:00.000000000 +0100 ++++ test14/arch/arm/mach-ixp4xx/nslu2-setup.c 2005-10-06 21:29:53.000000000 +0200 +@@ -0,0 +1,134 @@ +/* + * arch/arm/mach-ixp4xx/nslu2-setup.c + * @@ -771,8 +787,11 @@ +{ + /* This causes the box to drop the power and go dead. */ + -+ *IXP4XX_GPIO_GPOER &= ~NSLU2_PO_BM; /* enable the pwr cntl gpio */ -+ *IXP4XX_GPIO_GPOUTR |= NSLU2_PO_BM; /* do the deed */ ++ /* enable the pwr cntl gpio */ ++ gpio_line_config(NSLU2_PO_GPIO, IXP4XX_GPIO_OUT); ++ ++ /* do the deed */ ++ gpio_line_set(NSLU2_PO_GPIO, IXP4XX_GPIO_HIGH); +} + +static void __init nslu2_init(void) @@ -795,8 +814,8 @@ + .timer = &ixp4xx_timer, + .init_machine = nslu2_init, +MACHINE_END ---- linux-2.6.14-rc2/arch/arm/mach-ixp4xx/nslu2-pci.c 1970-01-01 01:00:00.000000000 +0100 -+++ test6/arch/arm/mach-ixp4xx/nslu2-pci.c 2005-09-27 20:19:14.000000000 +0200 +--- linux-2.6.14-rc3/arch/arm/mach-ixp4xx/nslu2-pci.c 1970-01-01 01:00:00.000000000 +0100 ++++ test14/arch/arm/mach-ixp4xx/nslu2-pci.c 2005-10-06 21:29:53.000000000 +0200 @@ -0,0 +1,78 @@ +/* + * arch/arm/mach-ixp4xx/nslu2-pci.c @@ -876,9 +895,9 @@ +} + +subsys_initcall(nslu2_pci_init); ---- linux-2.6.14-rc2/arch/arm/mach-ixp4xx/nslu2-power.c 1970-01-01 01:00:00.000000000 +0100 -+++ test6/arch/arm/mach-ixp4xx/nslu2-power.c 2005-09-28 03:03:11.000000000 +0200 -@@ -0,0 +1,98 @@ +--- linux-2.6.14-rc3/arch/arm/mach-ixp4xx/nslu2-power.c 1970-01-01 01:00:00.000000000 +0100 ++++ test14/arch/arm/mach-ixp4xx/nslu2-power.c 2005-10-06 21:39:43.000000000 +0200 +@@ -0,0 +1,92 @@ +/* + * arch/arm/mach-ixp4xx/nslu2-power.c + * @@ -902,17 +921,12 @@ +#include +#include + -+static int nslu2_shutdown_in_progress = 0; ++#include + +static irqreturn_t nslu2_power_handler(int irq, void *dev_id, struct pt_regs *regs) +{ -+ /* FIXME init will start a shutdown but the machine -+ * will actually reboot at the end -+ */ -+ -+ if (!nslu2_shutdown_in_progress++) { -+ kill_proc(1, SIGINT, 1); /* Signal init to shut down */ -+ } ++ /* Signal init to do the ctrlaltdel action */ ++ kill_proc(1, SIGINT, 1); + + return IRQ_HANDLED; +} @@ -930,7 +944,10 @@ + +static int __init nslu2_power_init(void) +{ -+ printk(KERN_INFO "NSLU2 Power/Reset\n"); ++ if (!(machine_is_nslu2())) ++ return 0; ++ ++ printk(KERN_INFO "NSLU2: power/reset\n"); + + *IXP4XX_GPIO_GPISR = 0x20400000; /* read the 2 irqs to clr */ + @@ -940,9 +957,8 @@ + gpio_line_isr_clear(NSLU2_RB_GPIO); + gpio_line_isr_clear(NSLU2_PB_GPIO); + -+ + if (request_irq(NSLU2_RB_IRQ, &nslu2_reset_handler, -+ SA_INTERRUPT, "NSLU2 reset button", NULL) < 0) { ++ SA_INTERRUPT, "NSLU2 reset button", NULL) < 0) { + + printk(KERN_DEBUG "Reset Button IRQ %d not available\n", + NSLU2_RB_IRQ); @@ -951,16 +967,13 @@ + } + + if (request_irq(NSLU2_PB_IRQ, &nslu2_power_handler, -+ SA_INTERRUPT, "NSLU2 power button", NULL) < 0) { ++ SA_INTERRUPT, "NSLU2 power button", NULL) < 0) { + + printk(KERN_DEBUG "Power Button IRQ %d not available\n", + NSLU2_PB_IRQ); + + return -EIO; + } -+ -+ enable_irq(NSLU2_PB_IRQ); -+ enable_irq(NSLU2_RB_IRQ); + + return 0; +} @@ -971,15 +984,15 @@ + free_irq(NSLU2_PB_IRQ, NULL); +} + -+module_init (nslu2_power_init); -+module_exit (nslu2_power_exit); ++module_init(nslu2_power_init); ++module_exit(nslu2_power_exit); + +MODULE_AUTHOR("Alessandro Zummo "); +MODULE_DESCRIPTION("NSLU2 Power/Reset driver"); +MODULE_LICENSE("GPL"); ---- linux-2.6.14-rc2/include/asm-arm/arch-ixp4xx/nslu2.h 1970-01-01 01:00:00.000000000 +0100 -+++ test6/include/asm-arm/arch-ixp4xx/nslu2.h 2005-09-27 20:39:35.000000000 +0200 -@@ -0,0 +1,59 @@ +--- linux-2.6.14-rc3/include/asm-arm/arch-ixp4xx/nslu2.h 1970-01-01 01:00:00.000000000 +0100 ++++ test14/include/asm-arm/arch-ixp4xx/nslu2.h 2005-10-06 21:29:53.000000000 +0200 +@@ -0,0 +1,96 @@ +/* + * include/asm-arm/arch-ixp4xx/nslu2.h + * @@ -1027,15 +1040,309 @@ + +/* GPIO */ + -+#define NSLU2_BZ_GPIO 4 -+#define NSLU2_PB_GPIO 5 -+#define NSLU2_PO_GPIO 8 /* power off */ -+#define NSLU2_RB_GPIO 12 ++#define NSLU2_GPIO0 0 ++#define NSLU2_GPIO1 1 ++#define NSLU2_GPIO2 2 ++#define NSLU2_GPIO3 3 ++#define NSLU2_GPIO4 4 ++#define NSLU2_GPIO5 5 ++#define NSLU2_GPIO6 6 ++#define NSLU2_GPIO7 7 ++#define NSLU2_GPIO8 8 ++#define NSLU2_GPIO9 9 ++#define NSLU2_GPIO10 10 ++#define NSLU2_GPIO11 11 ++#define NSLU2_GPIO12 12 ++#define NSLU2_GPIO13 13 ++#define NSLU2_GPIO14 14 ++#define NSLU2_GPIO15 15 ++ ++/* Buttons */ ++ ++#define NSLU2_PB_GPIO NSLU2_GPIO5 ++#define NSLU2_PO_GPIO NSLU2_GPIO8 /* power off */ ++#define NSLU2_RB_GPIO NSLU2_GPIO12 ++ ++#define NSLU2_PB_IRQ IRQ_IXP4XX_GPIO5 ++#define NSLU2_RB_IRQ IRQ_IXP4XX_GPIO12 ++ ++#define NSLU2_PB_BM (1L << NSLU2_PB_GPIO) ++#define NSLU2_PO_BM (1L << NSLU2_PO_GPIO) ++#define NSLU2_RB_BM (1L << NSLU2_RB_GPIO) ++ ++/* Buzzer */ ++ ++#define NSLU2_GPIO_BUZZ 4 ++#define NSLU2_BZ_BM (1L << NSLU2_GPIO_BUZZ) ++/* LEDs */ ++ ++#define NSLU2_LED_RED NSLU2_GPIO0 ++#define NSLU2_LED_GRN NSLU2_GPIO1 ++ ++#define NSLU2_LED_RED_BM (1L << NSLU2_LED_RED) ++#define NSLU2_LED_GRN_BM (1L << NSLU2_LED_GRN) ++ ++#define NSLU2_LED_DISK1 NSLU2_GPIO2 ++#define NSLU2_LED_DISK2 NSLU2_GPIO3 ++ ++#define NSLU2_LED_DISK1_BM (1L << NSLU2_GPIO2) ++#define NSLU2_LED_DISK2_BM (1L << NSLU2_GPIO3) ++ ++ +--- linux-2.6.14-rc3/arch/arm/Kconfig 2005-10-01 13:46:47.000000000 +0200 ++++ test14/arch/arm/Kconfig 2005-10-06 21:29:53.000000000 +0200 +@@ -389,7 +389,8 @@ + ARCH_EBSA285 || ARCH_IMX || ARCH_INTEGRATOR || \ + ARCH_LUBBOCK || MACH_MAINSTONE || ARCH_NETWINDER || \ + ARCH_OMAP || ARCH_P720T || ARCH_PXA_IDP || \ +- ARCH_SA1100 || ARCH_SHARK || ARCH_VERSATILE ++ ARCH_SA1100 || ARCH_SHARK || ARCH_VERSATILE || \ ++ MACH_NSLU2 + help + If you say Y here, the LEDs on your machine will be used + to provide useful information about your current system status. +@@ -403,7 +404,7 @@ + + config LEDS_TIMER + bool "Timer LED" if (!ARCH_CDB89712 && !ARCH_OMAP) || \ +- MACH_OMAP_H2 || MACH_OMAP_PERSEUS2 ++ MACH_OMAP_H2 || MACH_OMAP_PERSEUS2 || MACH_NSLU2 + depends on LEDS + default y if ARCH_EBSA110 + help +@@ -419,7 +420,8 @@ + + config LEDS_CPU + bool "CPU usage LED" if (!ARCH_CDB89712 && !ARCH_EBSA110 && \ +- !ARCH_OMAP) || MACH_OMAP_H2 || MACH_OMAP_PERSEUS2 ++ !ARCH_OMAP) || MACH_OMAP_H2 || MACH_OMAP_PERSEUS2 \ ++ || MACH_NSLU2 + depends on LEDS + help + If you say Y here, the red LED will be used to give a good real +--- linux-2.6.14-rc3/arch/arm/mach-ixp4xx/nslu2-leds.c 1970-01-01 01:00:00.000000000 +0100 ++++ test14/arch/arm/mach-ixp4xx/nslu2-leds.c 2005-10-06 21:29:53.000000000 +0200 +@@ -0,0 +1,223 @@ ++/* ++ * arch/arm/mach-ixp4xx/nslu2-leds.c ++ * ++ * NSLU2 LEDs driver ++ * ++ * Copyright (C) 2005 Tower Technologies ++ * ++ * based on nslu2-io.c ++ * Copyright (C) 2004 Karen Spearel ++ * and arch/arm/mach-footbridge/netwinder-leds.c ++ * Copyright (C) 1998-1999 Russell King ++ * ++ * Author: Alessandro Zummo ++ * Maintainers: http://www.nslu2-linux.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 ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++ ++#define LED_STATE_ENABLED 0x01 ++#define LED_STATE_CLAIMED 0x02 ++#define LED_STATE_IDLE 0x04 ++ ++static unsigned char led_state; ++static unsigned int hw_led_state; ++ ++static const unsigned long idle_seq[4] = { ++ ++ NSLU2_LED_GRN_BM, 0, ++ NSLU2_LED_GRN_BM, 0, ++}; ++ ++static const unsigned long busy_seq[4] = { ++ ++ NSLU2_LED_GRN_BM, 0, ++ NSLU2_LED_GRN_BM | NSLU2_LED_RED_BM, 0, ++}; ++ ++static unsigned char led_count = 0; ++ ++static DEFINE_SPINLOCK(leds_lock); ++extern spinlock_t gpio_lock; ++ ++static void nslu2_leds_event(led_event_t evt) ++{ ++ unsigned long flags; ++ ++ spin_lock_irqsave(&leds_lock, flags); ++ ++ switch (evt) { ++ case led_start: ++ /* Let's rock! Red led on, all others off. Remember ++ * that disk1/disk2 works inverted. On the NSLU2, the ++ * interface starts in a claimed state. XXX ++ */ ++ led_state = LED_STATE_ENABLED | LED_STATE_CLAIMED; ++ hw_led_state = NSLU2_LED_DISK1_BM | NSLU2_LED_DISK2_BM ++ | NSLU2_LED_RED_BM; ++ break; ++ ++ case led_stop: ++ led_state &= ~LED_STATE_ENABLED; ++ break; ++ ++ case led_claim: ++ /* The user claimed the interface, red and green off */ ++ led_state |= LED_STATE_CLAIMED; ++ hw_led_state &= ~(NSLU2_LED_RED_BM | NSLU2_LED_GRN_BM); ++ break; ++ ++ case led_release: ++ /* The user released the interface, preserve the last ++ * status of the leds, except red/green. ++ */ ++ led_state &= ~LED_STATE_CLAIMED; ++ hw_led_state = *IXP4XX_GPIO_GPOUTR & 0x0000000C; ++ break; ++ ++#ifdef CONFIG_LEDS_TIMER ++ case led_timer: ++ /* Pulse green led */ ++ if (!(led_state & LED_STATE_CLAIMED)) ++ { ++ /* clear red and green bits */ ++ hw_led_state &= ~(NSLU2_LED_RED_BM | NSLU2_LED_GRN_BM); ++ ++ /* copy the right sequence in */ ++ if (led_state & LED_STATE_IDLE) ++ hw_led_state |= idle_seq[led_count % 4]; ++ else ++ hw_led_state |= busy_seq[led_count % 4]; ++ ++ led_count++; ++ } ++ break; ++#endif ++ ++#ifdef CONFIG_LEDS_CPU ++ ++ case led_idle_start: ++ led_state |= LED_STATE_IDLE; ++#ifndef CONFIG_LEDS_TIMER ++ /* green on, red off */ ++ hw_led_state |= NSLU2_LED_GRN_BM; ++ hw_led_state &= ~NSLU2_LED_RED_BM; ++#endif ++ break; ++ ++ case led_idle_end: ++ led_state &= ~LED_STATE_IDLE; ++#ifndef CONFIG_LEDS_TIMER ++ /* green on, red on -> amber on */ ++ hw_led_state |= NSLU2_LED_GRN_BM | NSLU2_LED_RED_BM; ++#endif ++ break; ++#endif ++ ++ case led_halted: ++ if (!(led_state & LED_STATE_CLAIMED)) ++ hw_led_state |= NSLU2_LED_RED_BM; ++ break; ++ ++ /* leds */ ++ ++ case led_green_on: ++ if (led_state & LED_STATE_CLAIMED) ++ hw_led_state |= NSLU2_LED_GRN_BM; ++ break; ++ ++ case led_green_off: ++ if (led_state & LED_STATE_CLAIMED) ++ hw_led_state &= ~NSLU2_LED_GRN_BM; ++ break; ++ ++ case led_amber_on: ++ if (led_state & LED_STATE_CLAIMED) ++ hw_led_state |= (NSLU2_LED_RED_BM | NSLU2_LED_GRN_BM); ++ break; ++ ++ case led_amber_off: ++ if (led_state & LED_STATE_CLAIMED) ++ hw_led_state &= ~(NSLU2_LED_RED_BM | NSLU2_LED_GRN_BM); ++ break; ++ ++ case led_red_on: ++ if (led_state & LED_STATE_CLAIMED) ++ hw_led_state |= NSLU2_LED_RED_BM; ++ break; ++ ++ case led_red_off: ++ if (led_state & LED_STATE_CLAIMED) ++ hw_led_state &= ~NSLU2_LED_RED_BM; ++ break; ++ ++ default: ++ break; ++ } ++ ++ spin_unlock_irqrestore(&leds_lock, flags); ++ ++ if (led_state & LED_STATE_ENABLED) { ++ spin_lock_irqsave(&gpio_lock, flags); ++ *IXP4XX_GPIO_GPOUTR = (*IXP4XX_GPIO_GPOUTR & 0xFFFFFFF0) | hw_led_state; ++ spin_unlock_irqrestore(&gpio_lock, flags); ++ } ++} ++ ++static int nslu2_leds_panic_event(struct notifier_block *this, unsigned long event, ++ void *ptr) ++{ ++ leds_event(led_green_off); ++ leds_event(led_red_on); ++ ++ return NOTIFY_DONE; ++} ++ ++static struct notifier_block nslu2_leds_panic_block = { ++ .notifier_call = nslu2_leds_panic_event, ++}; ++ ++static int __init nslu2_leds_init(void) ++{ ++ if (!(machine_is_nslu2())) ++ return 0; ++ ++ printk(KERN_INFO "NSLU2: leds\n"); ++ ++ /* register panic notifier */ ++ notifier_chain_register(&panic_notifier_list, &nslu2_leds_panic_block); ++ ++ /* enable gpio 0-3 */ ++ gpio_line_config(NSLU2_LED_GRN, IXP4XX_GPIO_OUT); ++ gpio_line_config(NSLU2_LED_RED, IXP4XX_GPIO_OUT); ++ gpio_line_config(NSLU2_LED_DISK1, IXP4XX_GPIO_OUT); ++ gpio_line_config(NSLU2_LED_DISK2, IXP4XX_GPIO_OUT); ++ ++ leds_event = nslu2_leds_event; ++ ++ /* this will also initialize the leds to the ++ * default state. ++ */ ++ ++ leds_event(led_start); ++ ++ return 0; ++} + -+#define NSLU2_PB_IRQ 22 /* gpio5 */ -+#define NSLU2_RB_IRQ 29 /* gpio12 */ ++module_init(nslu2_leds_init); + -+#define NSLU2_BZ_BM 0x0010 /* b0000 0000 0001 0000 */ -+#define NSLU2_PB_BM 0x0020 /* b0000 0000 0010 0000 */ -+#define NSLU2_PO_BM 0x0100 /* b0000 0001 0000 0000 */ -+#define NSLU2_RB_BM 0x1000 /* b0001 0000 0000 0000 */ diff --git a/packages/linux/nslu2-kernel/2.6.14/60-nslu2-beeper.patch b/packages/linux/nslu2-kernel/2.6.14/60-nslu2-beeper.patch new file mode 100644 index 0000000000..1ef9b6bb37 --- /dev/null +++ b/packages/linux/nslu2-kernel/2.6.14/60-nslu2-beeper.patch @@ -0,0 +1,178 @@ +diff -urN -X linux-2.6.14-rc3/Documentation/dontdiff linux-2.6.14-rc3/drivers/input/misc/Kconfig test12/drivers/input/misc/Kconfig +--- linux-2.6.14-rc3/drivers/input/misc/Kconfig 2005-09-17 12:42:09.000000000 +0200 ++++ test12/drivers/input/misc/Kconfig 2005-10-03 23:26:15.000000000 +0200 +@@ -40,6 +40,18 @@ + tristate "M68k Beeper support" + depends on M68K + ++config INPUT_NSLU2_BEEPER ++ tristate "NSLU2 Beeper support" ++ depends on MACH_NSLU2 ++ help ++ Say Y here if you want the embedded beeper on the LinkSys NSLU2 ++ to be used for bells and whistles. ++ ++ If unsure, say Y. ++ ++ To compile this driver as a module, choose M here: the ++ module will be called nslu2spkr. ++ + config INPUT_UINPUT + tristate "User level driver support" + help +diff -urN -X linux-2.6.14-rc3/Documentation/dontdiff linux-2.6.14-rc3/drivers/input/misc/Makefile test12/drivers/input/misc/Makefile +--- linux-2.6.14-rc3/drivers/input/misc/Makefile 2005-09-17 12:42:09.000000000 +0200 ++++ test12/drivers/input/misc/Makefile 2005-10-03 23:26:15.000000000 +0200 +@@ -10,3 +10,4 @@ + obj-$(CONFIG_INPUT_98SPKR) += 98spkr.o + obj-$(CONFIG_INPUT_UINPUT) += uinput.o + obj-$(CONFIG_HP_SDC_RTC) += hp_sdc_rtc.o ++obj-$(CONFIG_INPUT_NSLU2_BEEPER) += nslu2spkr.o +diff -urN -X linux-2.6.14-rc3/Documentation/dontdiff linux-2.6.14-rc3/drivers/input/misc/nslu2spkr.c test12/drivers/input/misc/nslu2spkr.c +--- linux-2.6.14-rc3/drivers/input/misc/nslu2spkr.c 1970-01-01 01:00:00.000000000 +0100 ++++ test12/drivers/input/misc/nslu2spkr.c 2005-10-05 03:06:20.000000000 +0200 +@@ -0,0 +1,144 @@ ++/* ++ * drivers/input/misc/nslu2spkr.c ++ * ++ * NSLU2 Beeper driver ++ * ++ * Copyright (C) 2005 Tower Technologies ++ * ++ * based on nslu2-io.c ++ * Copyright (C) 2004 Karen Spearel ++ * ++ * Author: Alessandro Zummo ++ * Maintainers: http://www.nslu2-linux.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 ++#include ++#include ++#include ++#include ++ ++#include ++#include ++ ++static unsigned int beep_on_startup = 1; ++module_param(beep_on_startup, bool, 0); ++MODULE_PARM_DESC(beep_on_startup, "Play a beep on module startup"); ++ ++DEFINE_SPINLOCK(beep_lock); ++ ++static int nslu2_spkr_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) ++{ ++ unsigned int count = 0; ++ unsigned long flags; ++ ++ if (type != EV_SND) ++ return -1; ++ ++ switch (code) { ++ case SND_BELL: ++ if (value) value = 1000; ++ case SND_TONE: ++ break; ++ default: ++ return -1; ++ } ++ ++ if (value > 20 && value < 32767) ++ count = (NSLU2_FREQ / (value*4)) - 1; ++ ++ spin_lock_irqsave(&beep_lock, flags); ++ ++ if (count) { ++ ++ gpio_line_config(NSLU2_GPIO_BUZZ, IXP4XX_GPIO_OUT); ++ gpio_line_set(NSLU2_GPIO_BUZZ, IXP4XX_GPIO_LOW); ++ ++ *IXP4XX_OSRT2 = (count & ~IXP4XX_OST_RELOAD_MASK) | IXP4XX_OST_ENABLE; ++ ++ } else { ++ ++ gpio_line_config(NSLU2_GPIO_BUZZ, IXP4XX_GPIO_IN); ++ gpio_line_set(NSLU2_GPIO_BUZZ, IXP4XX_GPIO_HIGH); ++ ++ *IXP4XX_OSRT2 = 0; ++ } ++ ++ spin_unlock_irqrestore(&beep_lock, flags); ++ ++ return 0; ++} ++ ++static struct input_dev nslu2_spkr_dev = { ++ .phys = "ixp420/gpio4", ++ .name = "NSLU2 Beeper", ++ .evbit[0] = BIT(EV_SND), ++ .sndbit[0] = BIT(SND_BELL) | BIT(SND_TONE), ++ .event = nslu2_spkr_event, ++ .id = { ++ .bustype = BUS_HOST, ++ .vendor = 0x001f, ++ .product = 0x0001, ++ .version = 0x0100 ++ } ++}; ++ ++static irqreturn_t nslu2_spkr_handler(int irq, void *dev_id, struct pt_regs *regs) ++{ ++ /* clear interrupt */ ++ *IXP4XX_OSST = IXP4XX_OSST_TIMER_2_PEND; ++ ++ /* flip the beeper output */ ++ *IXP4XX_GPIO_GPOUTR ^= NSLU2_BZ_BM; ++ ++ return IRQ_HANDLED; ++} ++ ++static int __init nslu2_spkr_init(void) ++{ ++ if (request_irq(IRQ_IXP4XX_TIMER2, &nslu2_spkr_handler, ++ SA_INTERRUPT | SA_TIMER, "NSLU2 beeper", NULL < 0)) { ++ ++ printk(KERN_INFO "NSLU2 beeper: IRQ %d not available\n", ++ IRQ_IXP4XX_TIMER2); ++ ++ return -EIO; ++ } ++ ++ input_register_device(&nslu2_spkr_dev); ++ ++ /* do a little beep to tell the world we are alive */ ++ if (beep_on_startup) ++ { ++ nslu2_spkr_event(NULL, EV_SND, SND_TONE, 440); ++ msleep(120); ++ nslu2_spkr_event(NULL, EV_SND, SND_TONE, 0); ++ } ++ ++ printk(KERN_INFO "NSLU2: beeper\n"); ++ return 0; ++} ++ ++static void __exit nslu2_spkr_exit(void) ++{ ++ input_unregister_device(&nslu2_spkr_dev); ++ ++ disable_irq(IRQ_IXP4XX_TIMER2); ++ ++ /* turn it off */ ++ nslu2_spkr_event(NULL, EV_SND, SND_BELL, 0); ++ ++ free_irq(IRQ_IXP4XX_TIMER2, NULL); ++} ++ ++module_init(nslu2_spkr_init); ++module_exit(nslu2_spkr_exit); ++ ++MODULE_AUTHOR("Alessandro Zummo "); ++MODULE_DESCRIPTION("NSLU2 Beeper driver"); ++MODULE_LICENSE("GPL"); -- cgit v1.2.3