ixp4xx: Updated patches to include all upstream-merged ixp4xx patches

SVN-Revision: 10636
This commit is contained in:
Rod Whitby 2008-03-21 13:57:03 +00:00
parent e1ea7361df
commit 5c58e93209
15 changed files with 5269 additions and 418 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,23 +1,26 @@
Upgrade the power and reset button handling for the DSMG600:
From 67e494e3e03ef807255f084800d8658b89ff5fec Mon Sep 17 00:00:00 2001
From: Rod Whitby <rod@whitby.id.au>
Date: Tue, 29 Jan 2008 10:00:25 +1030
Subject: ixp4xx: Button updates for the dsmg600 board (Patch #4769)
* Remove the superfluous declaration of ctrl_alt_del().
* Convert GPIO and IRQ handling to use the <asm/gpio.h> api.
* Perform the reset on the release of the power button, so that
NAS devices which have been set to auto-power-on (by bridging
the power button) do not continuously power cycle.
NAS devices which have been set to auto-power-on (by solder
bridging the power button) do not continuously power cycle.
* Remove all superflous constants from dsmg600.h
Signed-off-by: Rod Whitby <rod@whitby.id.au>
Acked-by: Lennert Buytenhek <buytenh@wantstofly.org>
---
arch/arm/mach-ixp4xx/dsmg600-power.c | 24 ++++++++++++++----------
include/asm-arm/arch-ixp4xx/dsmg600.h | 7 +------
2 files changed, 15 insertions(+), 16 deletions(-)
PATCH FOLLOWS
KernelVersion: 2.6.24-git5
Index: linux-2.6.23.12-armeb/arch/arm/mach-ixp4xx/dsmg600-power.c
===================================================================
--- linux-2.6.23.12-armeb.orig/arch/arm/mach-ixp4xx/dsmg600-power.c 2008-01-11 16:20:26.000000000 +1030
+++ linux-2.6.23.12-armeb/arch/arm/mach-ixp4xx/dsmg600-power.c 2008-01-11 16:20:30.000000000 +1030
@@ -26,10 +26,9 @@
diff --git a/arch/arm/mach-ixp4xx/dsmg600-power.c b/arch/arm/mach-ixp4xx/dsmg600-power.c
index 3471787..db63987 100644
--- a/arch/arm/mach-ixp4xx/dsmg600-power.c
+++ b/arch/arm/mach-ixp4xx/dsmg600-power.c
@@ -26,14 +26,13 @@
#include <linux/jiffies.h>
#include <linux/timer.h>
@ -29,7 +32,12 @@ Index: linux-2.6.23.12-armeb/arch/arm/mach-ixp4xx/dsmg600-power.c
/* This is used to make sure the power-button pusher is serious. The button
* must be held until the value of this counter reaches zero.
*/
@@ -47,9 +46,16 @@
-static volatile int power_button_countdown;
+static int power_button_countdown;
/* Must hold the button down for at least this many counts to be processed */
#define PBUTTON_HOLDDOWN_COUNT 4 /* 2 secs */
@@ -47,22 +46,27 @@ static void dsmg600_power_handler(unsigned long data)
* state of the power button.
*/
@ -37,17 +45,20 @@ Index: linux-2.6.23.12-armeb/arch/arm/mach-ixp4xx/dsmg600-power.c
+ if (gpio_get_value(DSMG600_PB_GPIO)) {
/* IO Pin is 1 (button pushed) */
+ if (power_button_countdown > 0) {
+ if (power_button_countdown > 0)
+ power_button_countdown--;
+ }
+
+ } else {
+
+ /* Done on button release, to allow for auto-power-on mods. */
if (power_button_countdown == 0) {
/* Signal init to do the ctrlaltdel action, this will bypass
* init if it hasn't started and do a kernel_restart.
@@ -58,11 +64,9 @@
- /* Signal init to do the ctrlaltdel action, this will bypass
- * init if it hasn't started and do a kernel_restart.
+ /* Signal init to do the ctrlaltdel action,
+ * this will bypass init if it hasn't started
+ * and do a kernel_restart.
*/
ctrl_alt_del();
/* Change the state of the power LED to "blink" */
gpio_line_set(DSMG600_LED_PWR_GPIO, IXP4XX_GPIO_LOW);
@ -61,7 +72,7 @@ Index: linux-2.6.23.12-armeb/arch/arm/mach-ixp4xx/dsmg600-power.c
}
mod_timer(&dsmg600_power_timer, jiffies + msecs_to_jiffies(500));
@@ -81,12 +85,12 @@
@@ -81,12 +85,12 @@ static int __init dsmg600_power_init(void)
if (!(machine_is_dsmg600()))
return 0;
@ -76,7 +87,7 @@ Index: linux-2.6.23.12-armeb/arch/arm/mach-ixp4xx/dsmg600-power.c
return -EIO;
}
@@ -114,7 +118,7 @@
@@ -114,7 +118,7 @@ static void __exit dsmg600_power_exit(void)
del_timer_sync(&dsmg600_power_timer);
@ -85,10 +96,10 @@ Index: linux-2.6.23.12-armeb/arch/arm/mach-ixp4xx/dsmg600-power.c
}
module_init(dsmg600_power_init);
Index: linux-2.6.23.12-armeb/include/asm-arm/arch-ixp4xx/dsmg600.h
===================================================================
--- linux-2.6.23.12-armeb.orig/include/asm-arm/arch-ixp4xx/dsmg600.h 2008-01-11 16:20:26.000000000 +1030
+++ linux-2.6.23.12-armeb/include/asm-arm/arch-ixp4xx/dsmg600.h 2008-01-11 16:20:30.000000000 +1030
diff --git a/include/asm-arm/arch-ixp4xx/dsmg600.h b/include/asm-arm/arch-ixp4xx/dsmg600.h
index a19605a..b7673e1 100644
--- a/include/asm-arm/arch-ixp4xx/dsmg600.h
+++ b/include/asm-arm/arch-ixp4xx/dsmg600.h
@@ -40,18 +40,13 @@
/* Buttons */
@ -109,3 +120,6 @@ Index: linux-2.6.23.12-armeb/include/asm-arm/arch-ixp4xx/dsmg600.h
-
#define DSMG600_LED_WLAN_GPIO 14
-#define DSMG600_LED_WLAN_BM (1L << DSMG600_LED_WLAN_GPIO)
--
1.5.2.5

View File

@ -1,20 +1,28 @@
Upgrade the power and reset button handling for the NAS100D:
From 6261e59795d861f21f63878944900a3da713348c Mon Sep 17 00:00:00 2001
From: Rod Whitby <rod@whitby.id.au>
Date: Tue, 29 Jan 2008 09:53:46 +1030
Subject: ixp4xx: Button and LED updates for the nas100d board (Patch #4768)
* Convert GPIO and IRQ handling to use the <asm/gpio.h> api.
* Perform the reset only after the power button has been held down
for at least two seconds. Do the reset on the release of the power
button, so that NAS devices which have been set to auto-power-on (by
bridging the power button) do not continuously power cycle.
solder bridging the power button) do not continuously power cycle.
* Remove all superflous constants from nas100d.h
* Add LED constants to nas100d.h while we're there.
Also, update the board LED setup code to use constants.
* Update the board LED setup code to use those constants.
Signed-off-by: Rod Whitby <rod@whitby.id.au>
Acked-by: Lennert Buytenhek <buytenh@wantstofly.org>
Index: linux-2.6.23.12-armeb/arch/arm/mach-ixp4xx/nas100d-power.c
===================================================================
--- linux-2.6.23.12-armeb.orig/arch/arm/mach-ixp4xx/nas100d-power.c 2008-01-11 16:59:20.000000000 +1030
+++ linux-2.6.23.12-armeb/arch/arm/mach-ixp4xx/nas100d-power.c 2008-01-11 17:03:23.000000000 +1030
@@ -21,15 +21,61 @@
PATCH FOLLOWS
KernelVersion: 2.6.24-git5
diff --git a/arch/arm/mach-ixp4xx/nas100d-power.c b/arch/arm/mach-ixp4xx/nas100d-power.c
index 29aa98d..4c1c01b 100644
--- a/arch/arm/mach-ixp4xx/nas100d-power.c
+++ b/arch/arm/mach-ixp4xx/nas100d-power.c
@@ -21,15 +21,59 @@
#include <linux/irq.h>
#include <linux/module.h>
#include <linux/reboot.h>
@ -25,12 +33,10 @@ Index: linux-2.6.23.12-armeb/arch/arm/mach-ixp4xx/nas100d-power.c
#include <asm/mach-types.h>
-static irqreturn_t nas100d_reset_handler(int irq, void *dev_id)
+extern void ctrl_alt_del(void);
+
+/* This is used to make sure the power-button pusher is serious. The button
+ * must be held until the value of this counter reaches zero.
+ */
+static volatile int power_button_countdown;
+static int power_button_countdown;
+
+/* Must hold the button down for at least this many counts to be processed */
+#define PBUTTON_HOLDDOWN_COUNT 4 /* 2 secs */
@ -50,16 +56,16 @@ Index: linux-2.6.23.12-armeb/arch/arm/mach-ixp4xx/nas100d-power.c
+ if (gpio_get_value(NAS100D_PB_GPIO)) {
+
+ /* IO Pin is 1 (button pushed) */
+ if (power_button_countdown > 0) {
+ if (power_button_countdown > 0)
+ power_button_countdown--;
+ }
+
+ } else {
+
+ /* Done on button release, to allow for auto-power-on mods. */
+ if (power_button_countdown == 0) {
+ /* Signal init to do the ctrlaltdel action, this will bypass
+ * init if it hasn't started and do a kernel_restart.
+ /* Signal init to do the ctrlaltdel action,
+ * this will bypass init if it hasn't started
+ * and do a kernel_restart.
+ */
+ ctrl_alt_del();
+
@ -80,7 +86,7 @@ Index: linux-2.6.23.12-armeb/arch/arm/mach-ixp4xx/nas100d-power.c
return IRQ_HANDLED;
}
@@ -39,17 +85,30 @@
@@ -39,17 +83,30 @@ static int __init nas100d_power_init(void)
if (!(machine_is_nas100d()))
return 0;
@ -114,7 +120,7 @@ Index: linux-2.6.23.12-armeb/arch/arm/mach-ixp4xx/nas100d-power.c
return 0;
}
@@ -58,7 +117,9 @@
@@ -58,7 +115,9 @@ static void __exit nas100d_power_exit(void)
if (!(machine_is_nas100d()))
return;
@ -125,10 +131,42 @@ Index: linux-2.6.23.12-armeb/arch/arm/mach-ixp4xx/nas100d-power.c
}
module_init(nas100d_power_init);
Index: linux-2.6.23.12-armeb/include/asm-arm/arch-ixp4xx/nas100d.h
===================================================================
--- linux-2.6.23.12-armeb.orig/include/asm-arm/arch-ixp4xx/nas100d.h 2008-01-11 16:59:20.000000000 +1030
+++ linux-2.6.23.12-armeb/include/asm-arm/arch-ixp4xx/nas100d.h 2008-01-11 17:03:23.000000000 +1030
diff --git a/arch/arm/mach-ixp4xx/nas100d-setup.c b/arch/arm/mach-ixp4xx/nas100d-setup.c
index 54d884f..213a4ce 100644
--- a/arch/arm/mach-ixp4xx/nas100d-setup.c
+++ b/arch/arm/mach-ixp4xx/nas100d-setup.c
@@ -43,20 +43,20 @@ static struct platform_device nas100d_flash = {
static struct resource nas100d_led_resources[] = {
{
.name = "wlan", /* green led */
- .start = 0,
- .end = 0,
+ .start = NAS100D_LED_WLAN_GPIO,
+ .end = NAS100D_LED_WLAN_GPIO,
.flags = IXP4XX_GPIO_LOW,
},
{
- .name = "ready", /* blue power led (off is flashing!) */
- .start = 15,
- .end = 15,
+ .name = "power", /* blue power led (off=flashing) */
+ .start = NAS100D_LED_PWR_GPIO,
+ .end = NAS100D_LED_PWR_GPIO,
.flags = IXP4XX_GPIO_LOW,
},
{
.name = "disk", /* yellow led */
- .start = 3,
- .end = 3,
+ .start = NAS100D_LED_DISK_GPIO,
+ .end = NAS100D_LED_DISK_GPIO,
.flags = IXP4XX_GPIO_LOW,
},
};
diff --git a/include/asm-arm/arch-ixp4xx/nas100d.h b/include/asm-arm/arch-ixp4xx/nas100d.h
index 131e0a1..98d9378 100644
--- a/include/asm-arm/arch-ixp4xx/nas100d.h
+++ b/include/asm-arm/arch-ixp4xx/nas100d.h
@@ -38,15 +38,15 @@
/* Buttons */
@ -154,35 +192,6 @@ Index: linux-2.6.23.12-armeb/include/asm-arm/arch-ixp4xx/nas100d.h
+#define NAS100D_LED_WLAN_GPIO 0
+#define NAS100D_LED_DISK_GPIO 3
+#define NAS100D_LED_PWR_GPIO 15
Index: linux-2.6.23.12-armeb/arch/arm/mach-ixp4xx/nas100d-setup.c
===================================================================
--- linux-2.6.23.12-armeb.orig/arch/arm/mach-ixp4xx/nas100d-setup.c 2008-01-11 17:03:23.000000000 +1030
+++ linux-2.6.23.12-armeb/arch/arm/mach-ixp4xx/nas100d-setup.c 2008-01-11 17:06:15.000000000 +1030
@@ -44,20 +44,20 @@
static struct resource nas100d_led_resources[] = {
{
.name = "wlan", /* green led */
- .start = 0,
- .end = 0,
+ .start = NAS100D_LED_WLAN_GPIO,
+ .end = NAS100D_LED_WLAN_GPIO,
.flags = IXP4XX_GPIO_LOW,
},
{
- .name = "ready", /* blue power led (off is flashing!) */
- .start = 15,
- .end = 15,
+ .name = "power", /* blue power led (off is flashing!) */
+ .start = NAS100D_LED_PWR_GPIO,
+ .end = NAS100D_LED_PWR_GPIO,
.flags = IXP4XX_GPIO_LOW,
},
{
.name = "disk", /* yellow led */
- .start = 3,
- .end = 3,
+ .start = NAS100D_LED_DISK_GPIO,
+ .end = NAS100D_LED_DISK_GPIO,
.flags = IXP4XX_GPIO_LOW,
},
};
--
1.5.2.5

View File

@ -0,0 +1,156 @@
From 88721db37ead2212a54c1392e2e65bae78d2604b Mon Sep 17 00:00:00 2001
From: Rod Whitby <rod@whitby.id.au>
Date: Tue, 29 Jan 2008 10:05:48 +1030
Subject: ixp4xx: Register nslu2 rtc i2c_board_info (Patch #4772)
Register the i2c board info related to the RTC chip on the nslu2 board
to allow it to be found automatically on boot.
Signed-off-by: Rod Whitby <rod@whitby.id.au>
Signed-off-by: Alessandro Zummo <a.zummo@towertech.it>
PATCH FOLLOWS
KernelVersion: 2.6.24-git5
diff --git a/arch/arm/mach-ixp4xx/nslu2-setup.c b/arch/arm/mach-ixp4xx/nslu2-setup.c
index 332a066..ebeb566 100644
--- a/arch/arm/mach-ixp4xx/nslu2-setup.c
+++ b/arch/arm/mach-ixp4xx/nslu2-setup.c
@@ -19,6 +19,7 @@
#include <linux/serial.h>
#include <linux/serial_8250.h>
#include <linux/leds.h>
+#include <linux/i2c.h>
#include <linux/i2c-gpio.h>
#include <asm/mach-types.h>
@@ -49,6 +50,12 @@ static struct i2c_gpio_platform_data nslu2_i2c_gpio_data = {
.scl_pin = NSLU2_SCL_PIN,
};
+static struct i2c_board_info __initdata nslu2_i2c_board_info [] = {
+ {
+ I2C_BOARD_INFO("rtc-x1205", 0x6f),
+ },
+};
+
#ifdef CONFIG_LEDS_IXP4XX
static struct resource nslu2_led_resources[] = {
{
@@ -207,6 +214,9 @@ static void __init nslu2_init(void)
pm_power_off = nslu2_power_off;
+ i2c_register_board_info(0, nslu2_i2c_board_info,
+ ARRAY_SIZE(nslu2_i2c_board_info));
+
/*
* This is only useful on a modified machine, but it is valuable
* to have it first in order to see debug messages, and so that
--
1.5.2.5
From d4ef1ee0daf96e42bf93421960eaded71e189712 Mon Sep 17 00:00:00 2001
From: Rod Whitby <rod@whitby.id.au>
Date: Tue, 29 Jan 2008 10:07:29 +1030
Subject: ixp4xx: Register nas100d rtc i2c_board_info (Patch #4773)
Register the i2c board info related to the RTC chip on the nas100d
board to allow it to be found automatically on boot.
Signed-off-by: Rod Whitby <rod@whitby.id.au>
Signed-off-by: Alessandro Zummo <a.zummo@towertech.it>
PATCH FOLLOWS
KernelVersion: 2.6.24-git5
diff --git a/arch/arm/mach-ixp4xx/nas100d-setup.c b/arch/arm/mach-ixp4xx/nas100d-setup.c
index b0884c2..09f75b9 100644
--- a/arch/arm/mach-ixp4xx/nas100d-setup.c
+++ b/arch/arm/mach-ixp4xx/nas100d-setup.c
@@ -17,6 +17,7 @@
#include <linux/serial.h>
#include <linux/serial_8250.h>
#include <linux/leds.h>
+#include <linux/i2c.h>
#include <linux/i2c-gpio.h>
#include <asm/mach-types.h>
@@ -41,6 +42,12 @@ static struct platform_device nas100d_flash = {
.resource = &nas100d_flash_resource,
};
+static struct i2c_board_info __initdata nas100d_i2c_board_info [] = {
+ {
+ I2C_BOARD_INFO("rtc-pcf8563", 0x51),
+ },
+};
+
#ifdef CONFIG_LEDS_IXP4XX
static struct resource nas100d_led_resources[] = {
{
@@ -181,6 +188,9 @@ static void __init nas100d_init(void)
pm_power_off = nas100d_power_off;
+ i2c_register_board_info(0, nas100d_i2c_board_info,
+ ARRAY_SIZE(nas100d_i2c_board_info));
+
/*
* This is only useful on a modified machine, but it is valuable
* to have it first in order to see debug messages, and so that
--
1.5.2.5
From aa9d35dae397402f57f1baa8d53fed75d76aed8d Mon Sep 17 00:00:00 2001
From: Rod Whitby <rod@whitby.id.au>
Date: Tue, 29 Jan 2008 10:09:41 +1030
Subject: ixp4xx: Register dsmg600 rtc i2c_board_info (Patch #4774)
Register the i2c board info related to the RTC chip on the dsmg600
board to allow it to be found automatically on boot.
Signed-off-by: Rod Whitby <rod@whitby.id.au>
Signed-off-by: Alessandro Zummo <a.zummo@towertech.it>
PATCH FOLLOWS
KernelVersion: 2.6.24-git5
diff --git a/arch/arm/mach-ixp4xx/dsmg600-setup.c b/arch/arm/mach-ixp4xx/dsmg600-setup.c
index c473d40..a1c44ef 100644
--- a/arch/arm/mach-ixp4xx/dsmg600-setup.c
+++ b/arch/arm/mach-ixp4xx/dsmg600-setup.c
@@ -14,6 +14,7 @@
#include <linux/kernel.h>
#include <linux/serial.h>
#include <linux/serial_8250.h>
+#include <linux/i2c.h>
#include <linux/i2c-gpio.h>
#include <asm/mach-types.h>
@@ -51,6 +52,12 @@ static struct platform_device dsmg600_i2c_gpio = {
},
};
+static struct i2c_board_info __initdata dsmg600_i2c_board_info [] = {
+ {
+ I2C_BOARD_INFO("rtc-pcf8563", 0x51),
+ },
+};
+
#ifdef CONFIG_LEDS_CLASS
static struct resource dsmg600_led_resources[] = {
{
@@ -158,6 +165,9 @@ static void __init dsmg600_init(void)
pm_power_off = dsmg600_power_off;
+ i2c_register_board_info(0, dsmg600_i2c_board_info,
+ ARRAY_SIZE(dsmg600_i2c_board_info));
+
/* The UART is required on the DSM-G600 (Redboot cannot use the
* NIC) -- do it here so that it does *not* get removed if
* platform_add_devices fails!
--
1.5.2.5

View File

@ -0,0 +1,242 @@
From 383256474f2ba043bdb57a657f9d786df88780f1 Mon Sep 17 00:00:00 2001
From: Rod Whitby <rod@whitby.id.au>
Date: Tue, 29 Jan 2008 17:17:29 +1030
Subject: ixp4xx: Use leds-gpio driver instead of IXP4XX-GPIO-LED driver
These are the only three boards to use the IXP4XX-GPIO-LED driver, and
they can all use the new leds-gpio driver instead with no change in
functionality.
Signed-off-by: Rod Whitby <rod@whitby.id.au>
--
PATCH FOLLOWS
KernelVersion: v2.6.24-1915-gc9b12e6
diff --git a/arch/arm/configs/ixp4xx_defconfig b/arch/arm/configs/ixp4xx_defconfig
index 2d5ae33..77fe3b0 100644
--- a/arch/arm/configs/ixp4xx_defconfig
+++ b/arch/arm/configs/ixp4xx_defconfig
@@ -1330,8 +1330,8 @@ CONFIG_LEDS_CLASS=y
#
# LED drivers
#
-CONFIG_LEDS_IXP4XX=y
-# CONFIG_LEDS_GPIO is not set
+# CONFIG_LEDS_IXP4XX is not set
+CONFIG_LEDS_GPIO=y
#
# LED Triggers
diff --git a/arch/arm/mach-ixp4xx/dsmg600-setup.c b/arch/arm/mach-ixp4xx/dsmg600-setup.c
index a1c44ef..d0e1295 100644
--- a/arch/arm/mach-ixp4xx/dsmg600-setup.c
+++ b/arch/arm/mach-ixp4xx/dsmg600-setup.c
@@ -14,6 +14,7 @@
#include <linux/kernel.h>
#include <linux/serial.h>
#include <linux/serial_8250.h>
+#include <linux/leds.h>
#include <linux/i2c.h>
#include <linux/i2c-gpio.h>
@@ -58,29 +59,28 @@ static struct i2c_board_info __initdata dsmg600_i2c_board_info [] = {
},
};
-#ifdef CONFIG_LEDS_CLASS
-static struct resource dsmg600_led_resources[] = {
+static struct gpio_led dsmg600_led_pins[] = {
{
- .name = "power",
- .start = DSMG600_LED_PWR_GPIO,
- .end = DSMG600_LED_PWR_GPIO,
- .flags = IXP4XX_GPIO_HIGH,
+ .name = "power",
+ .gpio = DSMG600_LED_PWR_GPIO,
},
{
- .name = "wlan",
- .start = DSMG600_LED_WLAN_GPIO,
- .end = DSMG600_LED_WLAN_GPIO,
- .flags = IXP4XX_GPIO_LOW,
+ .name = "wlan",
+ .gpio = DSMG600_LED_WLAN_GPIO,
+ .active_low = true,
},
};
+static struct gpio_led_platform_data dsmg600_led_data = {
+ .num_leds = ARRAY_SIZE(dsmg600_led_pins),
+ .leds = dsmg600_led_pins,
+};
+
static struct platform_device dsmg600_leds = {
- .name = "IXP4XX-GPIO-LED",
- .id = -1,
- .num_resources = ARRAY_SIZE(dsmg600_led_resources),
- .resource = dsmg600_led_resources,
+ .name = "leds-gpio",
+ .id = -1,
+ .dev.platform_data = &dsmg600_led_data,
};
-#endif
static struct resource dsmg600_uart_resources[] = {
{
@@ -128,6 +128,7 @@ static struct platform_device dsmg600_uart = {
static struct platform_device *dsmg600_devices[] __initdata = {
&dsmg600_i2c_gpio,
&dsmg600_flash,
+ &dsmg600_leds,
};
static void dsmg600_power_off(void)
@@ -175,11 +176,6 @@ static void __init dsmg600_init(void)
(void)platform_device_register(&dsmg600_uart);
platform_add_devices(dsmg600_devices, ARRAY_SIZE(dsmg600_devices));
-
-#ifdef CONFIG_LEDS_CLASS
- /* We don't care whether or not this works. */
- (void)platform_device_register(&dsmg600_leds);
-#endif
}
MACHINE_START(DSMG600, "D-Link DSM-G600 RevA")
diff --git a/arch/arm/mach-ixp4xx/nas100d-setup.c b/arch/arm/mach-ixp4xx/nas100d-setup.c
index dc782d0..5801579 100644
--- a/arch/arm/mach-ixp4xx/nas100d-setup.c
+++ b/arch/arm/mach-ixp4xx/nas100d-setup.c
@@ -46,35 +46,34 @@ static struct i2c_board_info __initdata nas100d_i2c_board_info [] = {
},
};
-#ifdef CONFIG_LEDS_IXP4XX
-static struct resource nas100d_led_resources[] = {
+static struct gpio_led nas100d_led_pins[] = {
{
.name = "wlan", /* green led */
- .start = NAS100D_LED_WLAN_GPIO,
- .end = NAS100D_LED_WLAN_GPIO,
- .flags = IXP4XX_GPIO_LOW,
+ .gpio = NAS100D_LED_WLAN_GPIO,
+ .active_low = true,
},
{
.name = "power", /* blue power led (off=flashing) */
- .start = NAS100D_LED_PWR_GPIO,
- .end = NAS100D_LED_PWR_GPIO,
- .flags = IXP4XX_GPIO_LOW,
+ .gpio = NAS100D_LED_PWR_GPIO,
+ .active_low = true,
},
{
.name = "disk", /* yellow led */
- .start = NAS100D_LED_DISK_GPIO,
- .end = NAS100D_LED_DISK_GPIO,
- .flags = IXP4XX_GPIO_LOW,
+ .gpio = NAS100D_LED_DISK_GPIO,
+ .active_low = true,
},
};
+static struct gpio_led_platform_data nas100d_led_data = {
+ .num_leds = ARRAY_SIZE(nas100d_led_pins),
+ .leds = nas100d_led_pins,
+};
+
static struct platform_device nas100d_leds = {
- .name = "IXP4XX-GPIO-LED",
+ .name = "leds-gpio",
.id = -1,
- .num_resources = ARRAY_SIZE(nas100d_led_resources),
- .resource = nas100d_led_resources,
+ .dev.platform_data = &nas100d_led_data,
};
-#endif
static struct i2c_gpio_platform_data nas100d_i2c_gpio_data = {
.sda_pin = NAS100D_SDA_PIN,
@@ -135,9 +134,7 @@ static struct platform_device nas100d_uart = {
static struct platform_device *nas100d_devices[] __initdata = {
&nas100d_i2c_gpio,
&nas100d_flash,
-#ifdef CONFIG_LEDS_IXP4XX
&nas100d_leds,
-#endif
};
static void nas100d_power_off(void)
diff --git a/arch/arm/mach-ixp4xx/nslu2-setup.c b/arch/arm/mach-ixp4xx/nslu2-setup.c
index 16d091c..41d55c8 100644
--- a/arch/arm/mach-ixp4xx/nslu2-setup.c
+++ b/arch/arm/mach-ixp4xx/nslu2-setup.c
@@ -54,41 +54,37 @@ static struct i2c_board_info __initdata nslu2_i2c_board_info [] = {
},
};
-#ifdef CONFIG_LEDS_IXP4XX
-static struct resource nslu2_led_resources[] = {
+static struct gpio_led nslu2_led_pins[] = {
{
.name = "ready", /* green led */
- .start = NSLU2_LED_GRN_GPIO,
- .end = NSLU2_LED_GRN_GPIO,
- .flags = IXP4XX_GPIO_HIGH,
+ .gpio = NSLU2_LED_GRN_GPIO,
},
{
.name = "status", /* red led */
- .start = NSLU2_LED_RED_GPIO,
- .end = NSLU2_LED_RED_GPIO,
- .flags = IXP4XX_GPIO_HIGH,
+ .gpio = NSLU2_LED_RED_GPIO,
},
{
.name = "disk-1",
- .start = NSLU2_LED_DISK1_GPIO,
- .end = NSLU2_LED_DISK1_GPIO,
- .flags = IXP4XX_GPIO_LOW,
+ .gpio = NSLU2_LED_DISK1_GPIO,
+ .active_low = true,
},
{
.name = "disk-2",
- .start = NSLU2_LED_DISK2_GPIO,
- .end = NSLU2_LED_DISK2_GPIO,
- .flags = IXP4XX_GPIO_LOW,
+ .gpio = NSLU2_LED_DISK2_GPIO,
+ .active_low = true,
},
};
+static struct gpio_led_platform_data nslu2_led_data = {
+ .num_leds = ARRAY_SIZE(nslu2_led_pins),
+ .leds = nslu2_led_pins,
+};
+
static struct platform_device nslu2_leds = {
- .name = "IXP4XX-GPIO-LED",
+ .name = "leds-gpio",
.id = -1,
- .num_resources = ARRAY_SIZE(nslu2_led_resources),
- .resource = nslu2_led_resources,
+ .dev.platform_data = &nslu2_led_data,
};
-#endif
static struct platform_device nslu2_i2c_gpio = {
.name = "i2c-gpio",
@@ -151,9 +147,7 @@ static struct platform_device *nslu2_devices[] __initdata = {
&nslu2_i2c_gpio,
&nslu2_flash,
&nslu2_beeper,
-#ifdef CONFIG_LEDS_IXP4XX
&nslu2_leds,
-#endif
};
static void nslu2_power_off(void)
--
1.5.2.5

View File

@ -1,88 +0,0 @@
Index: linux-2.6.23.12-armeb/arch/arm/mach-ixp4xx/nslu2-setup.c
===================================================================
--- linux-2.6.23.12-armeb.orig/arch/arm/mach-ixp4xx/nslu2-setup.c 2008-01-08 15:28:13.000000000 +1030
+++ linux-2.6.23.12-armeb/arch/arm/mach-ixp4xx/nslu2-setup.c 2008-01-08 15:28:32.000000000 +1030
@@ -24,6 +24,7 @@
#include <asm/mach/arch.h>
#include <asm/mach/flash.h>
#include <asm/mach/time.h>
+#include <asm/io.h>
static struct flash_platform_data nslu2_flash_data = {
.map_name = "cfi_probe",
@@ -140,6 +141,23 @@
.resource = nslu2_uart_resources,
};
+/* Built-in 10/100 Ethernet MAC interfaces */
+static struct eth_plat_info nslu2_plat_eth[] = {
+ {
+ .phy = 1,
+ .rxq = 3,
+ .txreadyq = 20,
+ }
+};
+
+static struct platform_device nslu2_eth[] = {
+ {
+ .name = "ixp4xx_eth",
+ .id = IXP4XX_ETH_NPEB,
+ .dev.platform_data = nslu2_plat_eth,
+ }
+};
+
static struct platform_device *nslu2_devices[] __initdata = {
&nslu2_i2c_gpio,
&nslu2_flash,
@@ -147,6 +165,7 @@
#ifdef CONFIG_LEDS_IXP4XX
&nslu2_leds,
#endif
+ &nslu2_eth[0],
};
static void nslu2_power_off(void)
@@ -175,6 +194,9 @@
static void __init nslu2_init(void)
{
+ uint8_t __iomem *f;
+ int i;
+
ixp4xx_sys_init();
nslu2_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
@@ -191,6 +213,33 @@
(void)platform_device_register(&nslu2_uart);
platform_add_devices(nslu2_devices, ARRAY_SIZE(nslu2_devices));
+
+
+ /*
+ * Map in a portion of the flash and read the MAC address.
+ * Since it is stored in BE in the flash itself, we need to
+ * byteswap it if we're in LE mode.
+ */
+ if ((f = ioremap(IXP4XX_EXP_BUS_BASE(0), 0x40000))) {
+#ifdef __ARMEB__
+ for (i = 0; i < 6; i++) {
+ nslu2_plat_eth[0].hwaddr[i] = readb(f + 0x3FFB0 + i);
+ }
+#else
+ nslu2_plat_eth[0].hwaddr[0] = readb(f + 0x3FFB0 + 3);
+ nslu2_plat_eth[0].hwaddr[1] = readb(f + 0x3FFB0 + 2);
+ nslu2_plat_eth[0].hwaddr[2] = readb(f + 0x3FFB0 + 1);
+ nslu2_plat_eth[0].hwaddr[3] = readb(f + 0x3FFB0 + 0);
+ nslu2_plat_eth[0].hwaddr[4] = readb(f + 0x3FFB0 + 7);
+ nslu2_plat_eth[0].hwaddr[5] = readb(f + 0x3FFB0 + 6);
+#endif
+ iounmap(f);
+ }
+ printk(KERN_INFO "NSLU2: Using MAC address %.2x:%.2x:%.2x:%.2x:%.2x:%.2x for port 0\n",
+ nslu2_plat_eth[0].hwaddr[0], nslu2_plat_eth[0].hwaddr[1],
+ nslu2_plat_eth[0].hwaddr[2], nslu2_plat_eth[0].hwaddr[3],
+ nslu2_plat_eth[0].hwaddr[4], nslu2_plat_eth[0].hwaddr[5]);
+
}
MACHINE_START(NSLU2, "Linksys NSLU2")

View File

@ -0,0 +1,235 @@
From af66bd3b3324d51f0c43b7672b7a0563db425377 Mon Sep 17 00:00:00 2001
From: Rod Whitby <rod@whitby.id.au>
Date: Tue, 29 Jan 2008 10:03:19 +1030
Subject: ixp4xx: Ethernet support for the nslu2 and nas100d boards
Enables the new ixp4xx qmgr and npe drivers in ixp4xx_defconfig.
Sets up the corresponding platform data for the nslu2 and nas100d
boards, and reads the ethernet MAC address from the internal flash.
Tested on both little-endian and big-endian kernels.
Signed-off-by: Rod Whitby <rod@whitby.id.au>
Signed-off-by: Michael Westerhof <mwester@dls.net>
Tested-by: Tom King <tom@websb.net>
PATCH FOLLOWS
KernelVersion: v2.6.24-1916-g3832564
diff --git a/arch/arm/configs/ixp4xx_defconfig b/arch/arm/configs/ixp4xx_defconfig
index 77fe3b0..efa0485 100644
--- a/arch/arm/configs/ixp4xx_defconfig
+++ b/arch/arm/configs/ixp4xx_defconfig
@@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
-# Linux kernel version: 2.6.24-rc8
-# Wed Jan 23 17:26:16 2008
+# Linux kernel version: 2.6.24
+# Sun Jan 27 07:33:38 2008
#
CONFIG_ARM=y
CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@@ -174,6 +174,8 @@ CONFIG_MACH_GTWX5715=y
#
CONFIG_DMABOUNCE=y
# CONFIG_IXP4XX_INDIRECT_PCI is not set
+CONFIG_IXP4XX_QMGR=y
+CONFIG_IXP4XX_NPE=y
#
# Boot options
@@ -832,6 +834,7 @@ CONFIG_DUMMY=y
# CONFIG_PHYLIB is not set
CONFIG_NET_ETHERNET=y
CONFIG_MII=y
+CONFIG_IXP4XX_ETH=y
# CONFIG_AX88796 is not set
# CONFIG_HAPPYMEAL is not set
# CONFIG_SUNGEM is not set
@@ -925,6 +928,7 @@ CONFIG_HDLC_X25=m
# CONFIG_PC300TOO is not set
# CONFIG_FARSYNC is not set
# CONFIG_DSCC4 is not set
+# CONFIG_IXP4XX_HSS is not set
CONFIG_DLCI=m
CONFIG_DLCI_MAX=8
CONFIG_WAN_ROUTER_DRIVERS=m
diff --git a/arch/arm/mach-ixp4xx/nas100d-setup.c b/arch/arm/mach-ixp4xx/nas100d-setup.c
index 5801579..a432226 100644
--- a/arch/arm/mach-ixp4xx/nas100d-setup.c
+++ b/arch/arm/mach-ixp4xx/nas100d-setup.c
@@ -12,6 +12,7 @@
*
*/
+#include <linux/if_ether.h>
#include <linux/kernel.h>
#include <linux/serial.h>
#include <linux/serial_8250.h>
@@ -22,6 +23,7 @@
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
#include <asm/mach/flash.h>
+#include <asm/io.h>
static struct flash_platform_data nas100d_flash_data = {
.map_name = "cfi_probe",
@@ -131,10 +133,28 @@ static struct platform_device nas100d_uart = {
.resource = nas100d_uart_resources,
};
+/* Built-in 10/100 Ethernet MAC interfaces */
+static struct eth_plat_info nas100d_plat_eth[] = {
+ {
+ .phy = 0,
+ .rxq = 3,
+ .txreadyq = 20,
+ }
+};
+
+static struct platform_device nas100d_eth[] = {
+ {
+ .name = "ixp4xx_eth",
+ .id = IXP4XX_ETH_NPEB,
+ .dev.platform_data = nas100d_plat_eth,
+ }
+};
+
static struct platform_device *nas100d_devices[] __initdata = {
&nas100d_i2c_gpio,
&nas100d_flash,
&nas100d_leds,
+ &nas100d_eth[0],
};
static void nas100d_power_off(void)
@@ -150,6 +170,10 @@ static void nas100d_power_off(void)
static void __init nas100d_init(void)
{
+ DECLARE_MAC_BUF(mac_buf);
+ uint8_t __iomem *f;
+ int i;
+
ixp4xx_sys_init();
/* gpio 14 and 15 are _not_ clocks */
@@ -172,6 +196,25 @@ static void __init nas100d_init(void)
(void)platform_device_register(&nas100d_uart);
platform_add_devices(nas100d_devices, ARRAY_SIZE(nas100d_devices));
+
+ /*
+ * Map in a portion of the flash and read the MAC address.
+ * Since it is stored in BE in the flash itself, we need to
+ * byteswap it if we're in LE mode.
+ */
+ f = ioremap(IXP4XX_EXP_BUS_BASE(0), 0x1000000);
+ if (f) {
+ for (i = 0; i < 6; i++)
+#ifdef __ARMEB__
+ nas100d_plat_eth[0].hwaddr[i] = readb(f + 0xFC0FD8 + i);
+#else
+ nas100d_plat_eth[0].hwaddr[i] = readb(f + 0xFC0FD8 + (i^3));
+#endif
+ iounmap(f);
+ }
+ printk(KERN_INFO "NAS100D: Using MAC address %s for port 0\n",
+ print_mac(mac_buf, nas100d_plat_eth[0].hwaddr));
+
}
MACHINE_START(NAS100D, "Iomega NAS 100d")
diff --git a/arch/arm/mach-ixp4xx/nslu2-setup.c b/arch/arm/mach-ixp4xx/nslu2-setup.c
index 41d55c8..fd9ec17 100644
--- a/arch/arm/mach-ixp4xx/nslu2-setup.c
+++ b/arch/arm/mach-ixp4xx/nslu2-setup.c
@@ -14,6 +14,7 @@
* Changed to conform to new style __init ixdp425 kas11 10/22/04
*/
+#include <linux/if_ether.h>
#include <linux/kernel.h>
#include <linux/serial.h>
#include <linux/serial_8250.h>
@@ -25,6 +26,7 @@
#include <asm/mach/arch.h>
#include <asm/mach/flash.h>
#include <asm/mach/time.h>
+#include <asm/io.h>
static struct flash_platform_data nslu2_flash_data = {
.map_name = "cfi_probe",
@@ -143,11 +145,29 @@ static struct platform_device nslu2_uart = {
.resource = nslu2_uart_resources,
};
+/* Built-in 10/100 Ethernet MAC interfaces */
+static struct eth_plat_info nslu2_plat_eth[] = {
+ {
+ .phy = 1,
+ .rxq = 3,
+ .txreadyq = 20,
+ }
+};
+
+static struct platform_device nslu2_eth[] = {
+ {
+ .name = "ixp4xx_eth",
+ .id = IXP4XX_ETH_NPEB,
+ .dev.platform_data = nslu2_plat_eth,
+ }
+};
+
static struct platform_device *nslu2_devices[] __initdata = {
&nslu2_i2c_gpio,
&nslu2_flash,
&nslu2_beeper,
&nslu2_leds,
+ &nslu2_eth[0],
};
static void nslu2_power_off(void)
@@ -176,6 +196,10 @@ static struct sys_timer nslu2_timer = {
static void __init nslu2_init(void)
{
+ DECLARE_MAC_BUF(mac_buf);
+ uint8_t __iomem *f;
+ int i;
+
ixp4xx_sys_init();
nslu2_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
@@ -195,6 +219,26 @@ static void __init nslu2_init(void)
(void)platform_device_register(&nslu2_uart);
platform_add_devices(nslu2_devices, ARRAY_SIZE(nslu2_devices));
+
+
+ /*
+ * Map in a portion of the flash and read the MAC address.
+ * Since it is stored in BE in the flash itself, we need to
+ * byteswap it if we're in LE mode.
+ */
+ f = ioremap(IXP4XX_EXP_BUS_BASE(0), 0x40000);
+ if (f) {
+ for (i = 0; i < 6; i++)
+#ifdef __ARMEB__
+ nslu2_plat_eth[0].hwaddr[i] = readb(f + 0x3FFB0 + i);
+#else
+ nslu2_plat_eth[0].hwaddr[i] = readb(f + 0x3FFB0 + (i^3));
+#endif
+ iounmap(f);
+ }
+ printk(KERN_INFO "NSLU2: Using MAC address %s for port 0\n",
+ print_mac(mac_buf, nslu2_plat_eth[0].hwaddr));
+
}
MACHINE_START(NSLU2, "Linksys NSLU2")
--
1.5.2.5

View File

@ -1,87 +0,0 @@
Index: linux-2.6.23.12-armeb/arch/arm/mach-ixp4xx/nas100d-setup.c
===================================================================
--- linux-2.6.23.12-armeb.orig/arch/arm/mach-ixp4xx/nas100d-setup.c 2008-01-08 15:22:07.000000000 +1030
+++ linux-2.6.23.12-armeb/arch/arm/mach-ixp4xx/nas100d-setup.c 2008-01-08 15:32:32.000000000 +1030
@@ -21,6 +21,7 @@
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
#include <asm/mach/flash.h>
+#include <asm/io.h>
static struct flash_platform_data nas100d_flash_data = {
.map_name = "cfi_probe",
@@ -125,12 +126,30 @@
.resource = nas100d_uart_resources,
};
+/* Built-in 10/100 Ethernet MAC interfaces */
+static struct eth_plat_info nas100d_plat_eth[] = {
+ {
+ .phy = 0,
+ .rxq = 3,
+ .txreadyq = 20,
+ }
+};
+
+static struct platform_device nas100d_eth[] = {
+ {
+ .name = "ixp4xx_eth",
+ .id = IXP4XX_ETH_NPEB,
+ .dev.platform_data = nas100d_plat_eth,
+ }
+};
+
static struct platform_device *nas100d_devices[] __initdata = {
&nas100d_i2c_gpio,
&nas100d_flash,
#ifdef CONFIG_LEDS_IXP4XX
&nas100d_leds,
#endif
+ &nas100d_eth[0],
};
static void nas100d_power_off(void)
@@ -146,6 +165,9 @@
static void __init nas100d_init(void)
{
+ uint8_t __iomem *f;
+ int i;
+
ixp4xx_sys_init();
/* gpio 14 and 15 are _not_ clocks */
@@ -165,6 +187,33 @@
(void)platform_device_register(&nas100d_uart);
platform_add_devices(nas100d_devices, ARRAY_SIZE(nas100d_devices));
+
+
+ /*
+ * Map in a portion of the flash and read the MAC address.
+ * Since it is stored in BE in the flash itself, we need to
+ * byteswap it if we're in LE mode.
+ */
+ if ((f = ioremap(IXP4XX_EXP_BUS_BASE(0), 0x1000000))) {
+#ifdef __ARMEB__
+ for (i = 0; i < 6; i++) {
+ nas100d_plat_eth[0].hwaddr[i] = readb(f + 0xFC0FD8 + i);
+ }
+#else
+ nas100d_plat_eth[0].hwaddr[0] = readb(f + 0xFC0FD8 + 3);
+ nas100d_plat_eth[0].hwaddr[1] = readb(f + 0xFC0FD8 + 2);
+ nas100d_plat_eth[0].hwaddr[2] = readb(f + 0xFC0FD8 + 1);
+ nas100d_plat_eth[0].hwaddr[3] = readb(f + 0xFC0FD8 + 0);
+ nas100d_plat_eth[0].hwaddr[4] = readb(f + 0xFC0FD8 + 7);
+ nas100d_plat_eth[0].hwaddr[5] = readb(f + 0xFC0FD8 + 6);
+#endif
+ iounmap(f);
+ }
+ printk(KERN_INFO "NAS100D: Using MAC address %.2x:%.2x:%.2x:%.2x:%.2x:%.2x for port 0\n",
+ nas100d_plat_eth[0].hwaddr[0], nas100d_plat_eth[0].hwaddr[1],
+ nas100d_plat_eth[0].hwaddr[2], nas100d_plat_eth[0].hwaddr[3],
+ nas100d_plat_eth[0].hwaddr[4], nas100d_plat_eth[0].hwaddr[5]);
+
}
MACHINE_START(NAS100D, "Iomega NAS 100d")

View File

@ -0,0 +1,873 @@
From: Rod Whitby <rod@whitby.id.au>
Subject: ixp4xx: Merge nslu2-power.c into nslu2-setup.c (Patch #4807)
There is no reason to have power control in a separate file from the
board setup code. Merge it back into the board setup file, removing
superfluous header includes and removing superfluous constants from
the machine header file.
Signed-off-by: Rod Whitby <rod@whitby.id.au>
--
PATCH FOLLOWS
KernelVersion: v2.6.24-1917-gaf66bd3
Index: linux-2.6.24-armeb/arch/arm/mach-ixp4xx/Makefile
===================================================================
--- linux-2.6.24-armeb.orig/arch/arm/mach-ixp4xx/Makefile 2008-02-03 22:45:22.000000000 +1030
+++ linux-2.6.24-armeb/arch/arm/mach-ixp4xx/Makefile 2008-02-03 22:45:44.000000000 +1030
@@ -23,7 +23,7 @@
obj-$(CONFIG_MACH_IXDPG425) += coyote-setup.o
obj-$(CONFIG_ARCH_ADI_COYOTE) += coyote-setup.o
obj-$(CONFIG_MACH_GTWX5715) += gtwx5715-setup.o
-obj-$(CONFIG_MACH_NSLU2) += nslu2-setup.o nslu2-power.o
+obj-$(CONFIG_MACH_NSLU2) += nslu2-setup.o
obj-$(CONFIG_MACH_NAS100D) += nas100d-setup.o nas100d-power.o
obj-$(CONFIG_MACH_DSMG600) += dsmg600-setup.o dsmg600-power.o
obj-$(CONFIG_MACH_GATEWAY7001) += gateway7001-setup.o
Index: linux-2.6.24-armeb/arch/arm/mach-ixp4xx/nslu2-power.c
===================================================================
--- linux-2.6.24-armeb.orig/arch/arm/mach-ixp4xx/nslu2-power.c 2008-02-03 22:45:10.000000000 +1030
+++ /dev/null 1970-01-01 00:00:00.000000000 +0000
@@ -1,92 +0,0 @@
-/*
- * arch/arm/mach-ixp4xx/nslu2-power.c
- *
- * NSLU2 Power/Reset driver
- *
- * Copyright (C) 2005 Tower Technologies
- *
- * based on nslu2-io.c
- * Copyright (C) 2004 Karen Spearel
- *
- * Author: Alessandro Zummo <a.zummo@towertech.it>
- * 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 <linux/module.h>
-#include <linux/reboot.h>
-#include <linux/irq.h>
-#include <linux/interrupt.h>
-#include <linux/reboot.h>
-
-#include <asm/mach-types.h>
-
-static irqreturn_t nslu2_power_handler(int irq, void *dev_id)
-{
- /* Signal init to do the ctrlaltdel action, this will bypass init if
- * it hasn't started and do a kernel_restart.
- */
- ctrl_alt_del();
-
- return IRQ_HANDLED;
-}
-
-static irqreturn_t nslu2_reset_handler(int irq, void *dev_id)
-{
- /* This is the paper-clip reset, it shuts the machine down directly.
- */
- machine_power_off();
-
- return IRQ_HANDLED;
-}
-
-static int __init nslu2_power_init(void)
-{
- if (!(machine_is_nslu2()))
- return 0;
-
- *IXP4XX_GPIO_GPISR = 0x20400000; /* read the 2 irqs to clr */
-
- set_irq_type(NSLU2_RB_IRQ, IRQT_LOW);
- set_irq_type(NSLU2_PB_IRQ, IRQT_HIGH);
-
- if (request_irq(NSLU2_RB_IRQ, &nslu2_reset_handler,
- IRQF_DISABLED, "NSLU2 reset button", NULL) < 0) {
-
- printk(KERN_DEBUG "Reset Button IRQ %d not available\n",
- NSLU2_RB_IRQ);
-
- return -EIO;
- }
-
- if (request_irq(NSLU2_PB_IRQ, &nslu2_power_handler,
- IRQF_DISABLED, "NSLU2 power button", NULL) < 0) {
-
- printk(KERN_DEBUG "Power Button IRQ %d not available\n",
- NSLU2_PB_IRQ);
-
- return -EIO;
- }
-
- return 0;
-}
-
-static void __exit nslu2_power_exit(void)
-{
- if (!(machine_is_nslu2()))
- return;
-
- free_irq(NSLU2_RB_IRQ, NULL);
- free_irq(NSLU2_PB_IRQ, NULL);
-}
-
-module_init(nslu2_power_init);
-module_exit(nslu2_power_exit);
-
-MODULE_AUTHOR("Alessandro Zummo <a.zummo@towertech.it>");
-MODULE_DESCRIPTION("NSLU2 Power/Reset driver");
-MODULE_LICENSE("GPL");
Index: linux-2.6.24-armeb/arch/arm/mach-ixp4xx/nslu2-setup.c
===================================================================
--- linux-2.6.24-armeb.orig/arch/arm/mach-ixp4xx/nslu2-setup.c 2008-02-03 22:45:22.000000000 +1030
+++ linux-2.6.24-armeb/arch/arm/mach-ixp4xx/nslu2-setup.c 2008-02-03 22:45:44.000000000 +1030
@@ -3,22 +3,26 @@
*
* NSLU2 board-setup
*
- * based ixdp425-setup.c:
+ * Copyright (C) 2008 Rod Whitby <rod@whitby.id.au>
+ *
+ * based on ixdp425-setup.c:
* Copyright (C) 2003-2004 MontaVista Software, Inc.
+ * based on nslu2-power.c:
+ * Copyright (C) 2005 Tower Technologies
*
* Author: Mark Rakes <mrakes at mac.com>
* Author: Rod Whitby <rod@whitby.id.au>
+ * Author: Alessandro Zummo <a.zummo@towertech.it>
* Maintainers: http://www.nslu2-linux.org/
*
- * Fixed missing init_time in MACHINE_START kas11 10/22/04
- * Changed to conform to new style __init ixdp425 kas11 10/22/04
*/
#include <linux/if_ether.h>
-#include <linux/kernel.h>
+#include <linux/irq.h>
#include <linux/serial.h>
#include <linux/serial_8250.h>
#include <linux/leds.h>
+#include <linux/reboot.h>
#include <linux/i2c.h>
#include <linux/i2c-gpio.h>
@@ -27,6 +31,7 @@
#include <asm/mach/flash.h>
#include <asm/mach/time.h>
#include <asm/io.h>
+#include <asm/gpio.h>
static struct flash_platform_data nslu2_flash_data = {
.map_name = "cfi_probe",
@@ -181,6 +186,25 @@
gpio_line_set(NSLU2_PO_GPIO, IXP4XX_GPIO_HIGH);
}
+static irqreturn_t nslu2_power_handler(int irq, void *dev_id)
+{
+ /* Signal init to do the ctrlaltdel action, this will bypass init if
+ * it hasn't started and do a kernel_restart.
+ */
+ ctrl_alt_del();
+
+ return IRQ_HANDLED;
+}
+
+static irqreturn_t nslu2_reset_handler(int irq, void *dev_id)
+{
+ /* This is the paper-clip reset, it shuts the machine down directly.
+ */
+ machine_power_off();
+
+ return IRQ_HANDLED;
+}
+
static void __init nslu2_timer_init(void)
{
/* The xtal on this machine is non-standard. */
@@ -206,8 +230,6 @@
nslu2_flash_resource.end =
IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1;
- pm_power_off = nslu2_power_off;
-
i2c_register_board_info(0, nslu2_i2c_board_info,
ARRAY_SIZE(nslu2_i2c_board_info));
@@ -220,6 +242,23 @@
platform_add_devices(nslu2_devices, ARRAY_SIZE(nslu2_devices));
+ pm_power_off = nslu2_power_off;
+
+ if (request_irq(gpio_to_irq(NSLU2_RB_GPIO), &nslu2_reset_handler,
+ IRQF_DISABLED | IRQF_TRIGGER_LOW,
+ "NSLU2 reset button", NULL) < 0) {
+
+ printk(KERN_DEBUG "Reset Button IRQ %d not available\n",
+ gpio_to_irq(NSLU2_RB_GPIO));
+ }
+
+ if (request_irq(gpio_to_irq(NSLU2_PB_GPIO), &nslu2_power_handler,
+ IRQF_DISABLED | IRQF_TRIGGER_HIGH,
+ "NSLU2 power button", NULL) < 0) {
+
+ printk(KERN_DEBUG "Power Button IRQ %d not available\n",
+ gpio_to_irq(NSLU2_PB_GPIO));
+ }
/*
* Map in a portion of the flash and read the MAC address.
Index: linux-2.6.24-armeb/include/asm-arm/arch-ixp4xx/nslu2.h
===================================================================
--- linux-2.6.24-armeb.orig/include/asm-arm/arch-ixp4xx/nslu2.h 2008-02-03 22:45:11.000000000 +1030
+++ linux-2.6.24-armeb/include/asm-arm/arch-ixp4xx/nslu2.h 2008-02-03 22:45:44.000000000 +1030
@@ -39,34 +39,17 @@
/* Buttons */
-#define NSLU2_PB_GPIO 5
+#define NSLU2_PB_GPIO 5 /* power button */
#define NSLU2_PO_GPIO 8 /* power off */
-#define NSLU2_RB_GPIO 12
-
-#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)
+#define NSLU2_RB_GPIO 12 /* reset button */
/* Buzzer */
#define NSLU2_GPIO_BUZZ 4
-#define NSLU2_BZ_BM (1L << NSLU2_GPIO_BUZZ)
/* LEDs */
#define NSLU2_LED_RED_GPIO 0
#define NSLU2_LED_GRN_GPIO 1
-
-#define NSLU2_LED_RED_BM (1L << NSLU2_LED_RED_GPIO)
-#define NSLU2_LED_GRN_BM (1L << NSLU2_LED_GRN_GPIO)
-
#define NSLU2_LED_DISK1_GPIO 3
#define NSLU2_LED_DISK2_GPIO 2
-
-#define NSLU2_LED_DISK1_BM (1L << NSLU2_LED_DISK1_GPIO)
-#define NSLU2_LED_DISK2_BM (1L << NSLU2_LED_DISK2_GPIO)
-
-
From: Rod Whitby <rod@whitby.id.au>
Subject: ixp4xx: Merge nas100d-power.c into nas100d-setup.c (Patch #4808)
There is no reason to have power control in a separate file from the
board setup code. Merge it back into the board setup file and remove
superfluous header includes.
Signed-off-by: Rod Whitby <rod@whitby.id.au>
--
PATCH FOLLOWS
KernelVersion: 2.6.24-git9
diff --git a/arch/arm/mach-ixp4xx/Makefile b/arch/arm/mach-ixp4xx/Makefile
index 4fc7316..a7880ab 100644
--- a/arch/arm/mach-ixp4xx/Makefile
+++ b/arch/arm/mach-ixp4xx/Makefile
@@ -24,7 +24,7 @@ obj-$(CONFIG_MACH_IXDPG425) += coyote-setup.o
obj-$(CONFIG_ARCH_ADI_COYOTE) += coyote-setup.o
obj-$(CONFIG_MACH_GTWX5715) += gtwx5715-setup.o
obj-$(CONFIG_MACH_NSLU2) += nslu2-setup.o
-obj-$(CONFIG_MACH_NAS100D) += nas100d-setup.o nas100d-power.o
+obj-$(CONFIG_MACH_NAS100D) += nas100d-setup.o
obj-$(CONFIG_MACH_DSMG600) += dsmg600-setup.o dsmg600-power.o
obj-$(CONFIG_MACH_GATEWAY7001) += gateway7001-setup.o
obj-$(CONFIG_MACH_WG302V2) += wg302v2-setup.o
diff --git a/arch/arm/mach-ixp4xx/nas100d-power.c b/arch/arm/mach-ixp4xx/nas100d-power.c
deleted file mode 100644
index 4c1c01b..0000000
--- a/arch/arm/mach-ixp4xx/nas100d-power.c
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * arch/arm/mach-ixp4xx/nas100d-power.c
- *
- * NAS 100d Power/Reset driver
- *
- * Copyright (C) 2005 Tower Technologies
- *
- * based on nas100d-io.c
- * Copyright (C) 2004 Karen Spearel
- *
- * Author: Alessandro Zummo <a.zummo@towertech.it>
- * 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 <linux/interrupt.h>
-#include <linux/irq.h>
-#include <linux/module.h>
-#include <linux/reboot.h>
-#include <linux/jiffies.h>
-#include <linux/timer.h>
-
-#include <asm/gpio.h>
-#include <asm/mach-types.h>
-
-/* This is used to make sure the power-button pusher is serious. The button
- * must be held until the value of this counter reaches zero.
- */
-static int power_button_countdown;
-
-/* Must hold the button down for at least this many counts to be processed */
-#define PBUTTON_HOLDDOWN_COUNT 4 /* 2 secs */
-
-static void nas100d_power_handler(unsigned long data);
-static DEFINE_TIMER(nas100d_power_timer, nas100d_power_handler, 0, 0);
-
-static void nas100d_power_handler(unsigned long data)
-{
- /* This routine is called twice per second to check the
- * state of the power button.
- */
-
- if (gpio_get_value(NAS100D_PB_GPIO)) {
-
- /* IO Pin is 1 (button pushed) */
- if (power_button_countdown > 0)
- power_button_countdown--;
-
- } else {
-
- /* Done on button release, to allow for auto-power-on mods. */
- if (power_button_countdown == 0) {
- /* Signal init to do the ctrlaltdel action,
- * this will bypass init if it hasn't started
- * and do a kernel_restart.
- */
- ctrl_alt_del();
-
- /* Change the state of the power LED to "blink" */
- gpio_line_set(NAS100D_LED_PWR_GPIO, IXP4XX_GPIO_LOW);
- } else {
- power_button_countdown = PBUTTON_HOLDDOWN_COUNT;
- }
- }
-
- mod_timer(&nas100d_power_timer, jiffies + msecs_to_jiffies(500));
-}
-
-static irqreturn_t nas100d_reset_handler(int irq, void *dev_id)
-{
- /* This is the paper-clip reset, it shuts the machine down directly. */
- machine_power_off();
-
- return IRQ_HANDLED;
-}
-
-static int __init nas100d_power_init(void)
-{
- if (!(machine_is_nas100d()))
- return 0;
-
- set_irq_type(gpio_to_irq(NAS100D_RB_GPIO), IRQT_LOW);
-
- if (request_irq(gpio_to_irq(NAS100D_RB_GPIO), &nas100d_reset_handler,
- IRQF_DISABLED, "NAS100D reset button", NULL) < 0) {
-
- printk(KERN_DEBUG "Reset Button IRQ %d not available\n",
- gpio_to_irq(NAS100D_RB_GPIO));
-
- return -EIO;
- }
-
- /* The power button on the Iomega NAS100d is on GPIO 14, but
- * it cannot handle interrupts on that GPIO line. So we'll
- * have to poll it with a kernel timer.
- */
-
- /* Make sure that the power button GPIO is set up as an input */
- gpio_line_config(NAS100D_PB_GPIO, IXP4XX_GPIO_IN);
-
- /* Set the initial value for the power button IRQ handler */
- power_button_countdown = PBUTTON_HOLDDOWN_COUNT;
-
- mod_timer(&nas100d_power_timer, jiffies + msecs_to_jiffies(500));
-
- return 0;
-}
-
-static void __exit nas100d_power_exit(void)
-{
- if (!(machine_is_nas100d()))
- return;
-
- del_timer_sync(&nas100d_power_timer);
-
- free_irq(gpio_to_irq(NAS100D_RB_GPIO), NULL);
-}
-
-module_init(nas100d_power_init);
-module_exit(nas100d_power_exit);
-
-MODULE_AUTHOR("Alessandro Zummo <a.zummo@towertech.it>");
-MODULE_DESCRIPTION("NAS100D Power/Reset driver");
-MODULE_LICENSE("GPL");
diff --git a/arch/arm/mach-ixp4xx/nas100d-setup.c b/arch/arm/mach-ixp4xx/nas100d-setup.c
index a432226..4cecae8 100644
--- a/arch/arm/mach-ixp4xx/nas100d-setup.c
+++ b/arch/arm/mach-ixp4xx/nas100d-setup.c
@@ -3,8 +3,14 @@
*
* NAS 100d board-setup
*
- * based ixdp425-setup.c:
+ * Copyright (C) 2008 Rod Whitby <rod@whitby.id.au>
+ *
+ * based on ixdp425-setup.c:
* Copyright (C) 2003-2004 MontaVista Software, Inc.
+ * based on nas100d-power.c:
+ * Copyright (C) 2005 Tower Technologies
+ * based on nas100d-io.c
+ * Copyright (C) 2004 Karen Spearel
*
* Author: Alessandro Zummo <a.zummo@towertech.it>
* Author: Rod Whitby <rod@whitby.id.au>
@@ -13,10 +19,13 @@
*/
#include <linux/if_ether.h>
-#include <linux/kernel.h>
+#include <linux/irq.h>
+#include <linux/jiffies.h>
+#include <linux/timer.h>
#include <linux/serial.h>
#include <linux/serial_8250.h>
#include <linux/leds.h>
+#include <linux/reboot.h>
#include <linux/i2c.h>
#include <linux/i2c-gpio.h>
@@ -24,6 +33,7 @@
#include <asm/mach/arch.h>
#include <asm/mach/flash.h>
#include <asm/io.h>
+#include <asm/gpio.h>
static struct flash_platform_data nas100d_flash_data = {
.map_name = "cfi_probe",
@@ -168,6 +178,57 @@ static void nas100d_power_off(void)
gpio_line_set(NAS100D_PO_GPIO, IXP4XX_GPIO_HIGH);
}
+/* This is used to make sure the power-button pusher is serious. The button
+ * must be held until the value of this counter reaches zero.
+ */
+static int power_button_countdown;
+
+/* Must hold the button down for at least this many counts to be processed */
+#define PBUTTON_HOLDDOWN_COUNT 4 /* 2 secs */
+
+static void nas100d_power_handler(unsigned long data);
+static DEFINE_TIMER(nas100d_power_timer, nas100d_power_handler, 0, 0);
+
+static void nas100d_power_handler(unsigned long data)
+{
+ /* This routine is called twice per second to check the
+ * state of the power button.
+ */
+
+ if (gpio_get_value(NAS100D_PB_GPIO)) {
+
+ /* IO Pin is 1 (button pushed) */
+ if (power_button_countdown > 0)
+ power_button_countdown--;
+
+ } else {
+
+ /* Done on button release, to allow for auto-power-on mods. */
+ if (power_button_countdown == 0) {
+ /* Signal init to do the ctrlaltdel action,
+ * this will bypass init if it hasn't started
+ * and do a kernel_restart.
+ */
+ ctrl_alt_del();
+
+ /* Change the state of the power LED to "blink" */
+ gpio_line_set(NAS100D_LED_PWR_GPIO, IXP4XX_GPIO_LOW);
+ } else {
+ power_button_countdown = PBUTTON_HOLDDOWN_COUNT;
+ }
+ }
+
+ mod_timer(&nas100d_power_timer, jiffies + msecs_to_jiffies(500));
+}
+
+static irqreturn_t nas100d_reset_handler(int irq, void *dev_id)
+{
+ /* This is the paper-clip reset, it shuts the machine down directly. */
+ machine_power_off();
+
+ return IRQ_HANDLED;
+}
+
static void __init nas100d_init(void)
{
DECLARE_MAC_BUF(mac_buf);
@@ -183,8 +244,6 @@ static void __init nas100d_init(void)
nas100d_flash_resource.end =
IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1;
- pm_power_off = nas100d_power_off;
-
i2c_register_board_info(0, nas100d_i2c_board_info,
ARRAY_SIZE(nas100d_i2c_board_info));
@@ -197,6 +256,29 @@ static void __init nas100d_init(void)
platform_add_devices(nas100d_devices, ARRAY_SIZE(nas100d_devices));
+ pm_power_off = nas100d_power_off;
+
+ if (request_irq(gpio_to_irq(NAS100D_RB_GPIO), &nas100d_reset_handler,
+ IRQF_DISABLED | IRQF_TRIGGER_LOW,
+ "NAS100D reset button", NULL) < 0) {
+
+ printk(KERN_DEBUG "Reset Button IRQ %d not available\n",
+ gpio_to_irq(NAS100D_RB_GPIO));
+ }
+
+ /* The power button on the Iomega NAS100d is on GPIO 14, but
+ * it cannot handle interrupts on that GPIO line. So we'll
+ * have to poll it with a kernel timer.
+ */
+
+ /* Make sure that the power button GPIO is set up as an input */
+ gpio_line_config(NAS100D_PB_GPIO, IXP4XX_GPIO_IN);
+
+ /* Set the initial value for the power button IRQ handler */
+ power_button_countdown = PBUTTON_HOLDDOWN_COUNT;
+
+ mod_timer(&nas100d_power_timer, jiffies + msecs_to_jiffies(500));
+
/*
* Map in a portion of the flash and read the MAC address.
* Since it is stored in BE in the flash itself, we need to
--
1.5.2.5
From: Rod Whitby <rod@whitby.id.au>
Subject: ixp4xx: Merge dsmg600-power.c into dsmg600-setup.c (Patch #4809)
There is no reason to have power control in a separate file from the
board setup code. Merge it back into the board setup file and remove
superfluous header includes.
Signed-off-by: Rod Whitby <rod@whitby.id.au>
--
PATCH FOLLOWS
KernelVersion: 2.6.24-git9
diff --git a/arch/arm/mach-ixp4xx/Makefile b/arch/arm/mach-ixp4xx/Makefile
index a7880ab..c195688 100644
--- a/arch/arm/mach-ixp4xx/Makefile
+++ b/arch/arm/mach-ixp4xx/Makefile
@@ -25,7 +25,7 @@ obj-$(CONFIG_ARCH_ADI_COYOTE) += coyote-setup.o
obj-$(CONFIG_MACH_GTWX5715) += gtwx5715-setup.o
obj-$(CONFIG_MACH_NSLU2) += nslu2-setup.o
obj-$(CONFIG_MACH_NAS100D) += nas100d-setup.o
-obj-$(CONFIG_MACH_DSMG600) += dsmg600-setup.o dsmg600-power.o
+obj-$(CONFIG_MACH_DSMG600) += dsmg600-setup.o
obj-$(CONFIG_MACH_GATEWAY7001) += gateway7001-setup.o
obj-$(CONFIG_MACH_WG302V2) += wg302v2-setup.o
diff --git a/arch/arm/mach-ixp4xx/dsmg600-power.c b/arch/arm/mach-ixp4xx/dsmg600-power.c
deleted file mode 100644
index db63987..0000000
--- a/arch/arm/mach-ixp4xx/dsmg600-power.c
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * arch/arm/mach-ixp4xx/dsmg600-power.c
- *
- * DSM-G600 Power/Reset driver
- * Author: Michael Westerhof <mwester@dls.net>
- *
- * Based on nslu2-power.c
- * Copyright (C) 2005 Tower Technologies
- * Author: Alessandro Zummo <a.zummo@towertech.it>
- *
- * which was based on nslu2-io.c
- * Copyright (C) 2004 Karen Spearel
- *
- * 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 <linux/module.h>
-#include <linux/reboot.h>
-#include <linux/interrupt.h>
-#include <linux/irq.h>
-#include <linux/jiffies.h>
-#include <linux/timer.h>
-
-#include <asm/gpio.h>
-#include <asm/mach-types.h>
-
-/* This is used to make sure the power-button pusher is serious. The button
- * must be held until the value of this counter reaches zero.
- */
-static int power_button_countdown;
-
-/* Must hold the button down for at least this many counts to be processed */
-#define PBUTTON_HOLDDOWN_COUNT 4 /* 2 secs */
-
-static void dsmg600_power_handler(unsigned long data);
-static DEFINE_TIMER(dsmg600_power_timer, dsmg600_power_handler, 0, 0);
-
-static void dsmg600_power_handler(unsigned long data)
-{
- /* This routine is called twice per second to check the
- * state of the power button.
- */
-
- if (gpio_get_value(DSMG600_PB_GPIO)) {
-
- /* IO Pin is 1 (button pushed) */
- if (power_button_countdown > 0)
- power_button_countdown--;
-
- } else {
-
- /* Done on button release, to allow for auto-power-on mods. */
- if (power_button_countdown == 0) {
- /* Signal init to do the ctrlaltdel action,
- * this will bypass init if it hasn't started
- * and do a kernel_restart.
- */
- ctrl_alt_del();
-
- /* Change the state of the power LED to "blink" */
- gpio_line_set(DSMG600_LED_PWR_GPIO, IXP4XX_GPIO_LOW);
- } else {
- power_button_countdown = PBUTTON_HOLDDOWN_COUNT;
- }
- }
-
- mod_timer(&dsmg600_power_timer, jiffies + msecs_to_jiffies(500));
-}
-
-static irqreturn_t dsmg600_reset_handler(int irq, void *dev_id)
-{
- /* This is the paper-clip reset, it shuts the machine down directly. */
- machine_power_off();
-
- return IRQ_HANDLED;
-}
-
-static int __init dsmg600_power_init(void)
-{
- if (!(machine_is_dsmg600()))
- return 0;
-
- if (request_irq(gpio_to_irq(DSMG600_RB_GPIO), &dsmg600_reset_handler,
- IRQF_DISABLED | IRQF_TRIGGER_LOW, "DSM-G600 reset button",
- NULL) < 0) {
-
- printk(KERN_DEBUG "Reset Button IRQ %d not available\n",
- gpio_to_irq(DSMG600_RB_GPIO));
-
- return -EIO;
- }
-
- /* The power button on the D-Link DSM-G600 is on GPIO 15, but
- * it cannot handle interrupts on that GPIO line. So we'll
- * have to poll it with a kernel timer.
- */
-
- /* Make sure that the power button GPIO is set up as an input */
- gpio_line_config(DSMG600_PB_GPIO, IXP4XX_GPIO_IN);
-
- /* Set the initial value for the power button IRQ handler */
- power_button_countdown = PBUTTON_HOLDDOWN_COUNT;
-
- mod_timer(&dsmg600_power_timer, jiffies + msecs_to_jiffies(500));
-
- return 0;
-}
-
-static void __exit dsmg600_power_exit(void)
-{
- if (!(machine_is_dsmg600()))
- return;
-
- del_timer_sync(&dsmg600_power_timer);
-
- free_irq(gpio_to_irq(DSMG600_RB_GPIO), NULL);
-}
-
-module_init(dsmg600_power_init);
-module_exit(dsmg600_power_exit);
-
-MODULE_AUTHOR("Michael Westerhof <mwester@dls.net>");
-MODULE_DESCRIPTION("DSM-G600 Power/Reset driver");
-MODULE_LICENSE("GPL");
diff --git a/arch/arm/mach-ixp4xx/dsmg600-setup.c b/arch/arm/mach-ixp4xx/dsmg600-setup.c
index d0e1295..6886596 100644
--- a/arch/arm/mach-ixp4xx/dsmg600-setup.c
+++ b/arch/arm/mach-ixp4xx/dsmg600-setup.c
@@ -1,20 +1,29 @@
/*
* DSM-G600 board-setup
*
+ * Copyright (C) 2008 Rod Whitby <rod@whitby.id.au>
* Copyright (C) 2006 Tower Technologies
- * Author: Alessandro Zummo <a.zummo@towertech.it>
*
- * based ixdp425-setup.c:
+ * based on ixdp425-setup.c:
* Copyright (C) 2003-2004 MontaVista Software, Inc.
+ * based on nslu2-power.c:
+ * Copyright (C) 2005 Tower Technologies
+ * based on nslu2-io.c:
+ * Copyright (C) 2004 Karen Spearel
*
* Author: Alessandro Zummo <a.zummo@towertech.it>
+ * Author: Michael Westerhof <mwester@dls.net>
+ * Author: Rod Whitby <rod@whitby.id.au>
* Maintainers: http://www.nslu2-linux.org/
*/
-#include <linux/kernel.h>
+#include <linux/irq.h>
+#include <linux/jiffies.h>
+#include <linux/timer.h>
#include <linux/serial.h>
#include <linux/serial_8250.h>
#include <linux/leds.h>
+#include <linux/reboot.h>
#include <linux/i2c.h>
#include <linux/i2c-gpio.h>
@@ -22,6 +31,7 @@
#include <asm/mach/arch.h>
#include <asm/mach/flash.h>
#include <asm/mach/time.h>
+#include <asm/gpio.h>
static struct flash_platform_data dsmg600_flash_data = {
.map_name = "cfi_probe",
@@ -140,6 +150,57 @@ static void dsmg600_power_off(void)
gpio_line_set(DSMG600_PO_GPIO, IXP4XX_GPIO_HIGH);
}
+/* This is used to make sure the power-button pusher is serious. The button
+ * must be held until the value of this counter reaches zero.
+ */
+static int power_button_countdown;
+
+/* Must hold the button down for at least this many counts to be processed */
+#define PBUTTON_HOLDDOWN_COUNT 4 /* 2 secs */
+
+static void dsmg600_power_handler(unsigned long data);
+static DEFINE_TIMER(dsmg600_power_timer, dsmg600_power_handler, 0, 0);
+
+static void dsmg600_power_handler(unsigned long data)
+{
+ /* This routine is called twice per second to check the
+ * state of the power button.
+ */
+
+ if (gpio_get_value(DSMG600_PB_GPIO)) {
+
+ /* IO Pin is 1 (button pushed) */
+ if (power_button_countdown > 0)
+ power_button_countdown--;
+
+ } else {
+
+ /* Done on button release, to allow for auto-power-on mods. */
+ if (power_button_countdown == 0) {
+ /* Signal init to do the ctrlaltdel action,
+ * this will bypass init if it hasn't started
+ * and do a kernel_restart.
+ */
+ ctrl_alt_del();
+
+ /* Change the state of the power LED to "blink" */
+ gpio_line_set(DSMG600_LED_PWR_GPIO, IXP4XX_GPIO_LOW);
+ } else {
+ power_button_countdown = PBUTTON_HOLDDOWN_COUNT;
+ }
+ }
+
+ mod_timer(&dsmg600_power_timer, jiffies + msecs_to_jiffies(500));
+}
+
+static irqreturn_t dsmg600_reset_handler(int irq, void *dev_id)
+{
+ /* This is the paper-clip reset, it shuts the machine down directly. */
+ machine_power_off();
+
+ return IRQ_HANDLED;
+}
+
static void __init dsmg600_timer_init(void)
{
/* The xtal on this machine is non-standard. */
@@ -164,8 +225,6 @@ static void __init dsmg600_init(void)
dsmg600_flash_resource.end =
IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1;
- pm_power_off = dsmg600_power_off;
-
i2c_register_board_info(0, dsmg600_i2c_board_info,
ARRAY_SIZE(dsmg600_i2c_board_info));
@@ -176,6 +235,29 @@ static void __init dsmg600_init(void)
(void)platform_device_register(&dsmg600_uart);
platform_add_devices(dsmg600_devices, ARRAY_SIZE(dsmg600_devices));
+
+ pm_power_off = dsmg600_power_off;
+
+ if (request_irq(gpio_to_irq(DSMG600_RB_GPIO), &dsmg600_reset_handler,
+ IRQF_DISABLED | IRQF_TRIGGER_LOW,
+ "DSM-G600 reset button", NULL) < 0) {
+
+ printk(KERN_DEBUG "Reset Button IRQ %d not available\n",
+ gpio_to_irq(DSMG600_RB_GPIO));
+ }
+
+ /* The power button on the D-Link DSM-G600 is on GPIO 15, but
+ * it cannot handle interrupts on that GPIO line. So we'll
+ * have to poll it with a kernel timer.
+ */
+
+ /* Make sure that the power button GPIO is set up as an input */
+ gpio_line_config(DSMG600_PB_GPIO, IXP4XX_GPIO_IN);
+
+ /* Set the initial value for the power button IRQ handler */
+ power_button_countdown = PBUTTON_HOLDDOWN_COUNT;
+
+ mod_timer(&dsmg600_power_timer, jiffies + msecs_to_jiffies(500));
}
MACHINE_START(DSMG600, "D-Link DSM-G600 RevA")
--
1.5.2.5

View File

@ -0,0 +1,897 @@
diff -Naur linux-2.6.24.orig/drivers/net/via-velocity.c linux-2.6.24/drivers/net/via-velocity.c
--- linux-2.6.24.orig/drivers/net/via-velocity.c 2008-01-31 23:11:26.000000000 -0600
+++ linux-2.6.24/drivers/net/via-velocity.c 2008-02-01 01:12:15.000000000 -0600
@@ -254,11 +254,31 @@
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("VIA Networking Velocity Family Gigabit Ethernet Adapter Driver");
+/* Valid values for vdebug (additive, this is a bitmask):
+ * 0x00 => off
+ * 0x01 => always on
+ * 0x02 => additional detail on tx (rx, too, if anyone implements same)
+ * 0x04 => detail the initialization process
+ * 0x08 => spot debug detail; to be used as developers see fit
+ */
+static int vdebug = 0;
+
+/* HAIL - these macros are for the normal 0x01-type tracing... */
+#define HAIL(S) \
+ if (vdebug&1) printk(KERN_NOTICE "%s\n", (S));
+#define HAILS(S,T) \
+ if (vdebug&1) printk(KERN_NOTICE "%s -> status=0x%x\n", (S), (T));
+
#define VELOCITY_PARAM(N,D) \
static int N[MAX_UNITS]=OPTION_DEFAULT;\
module_param_array(N, int, NULL, 0); \
MODULE_PARM_DESC(N, D);
+#define VELO_DEBUG_MIN 0
+#define VELO_DEBUG_MAX 255
+#define VELO_DEBUG_DEF 0
+VELOCITY_PARAM(velo_debug, "Debug level");
+
#define RX_DESC_MIN 64
#define RX_DESC_MAX 255
#define RX_DESC_DEF 64
@@ -557,12 +577,12 @@
if (val == -1)
*opt |= (def ? flag : 0);
else if (val < 0 || val > 1) {
- printk(KERN_NOTICE "%s: the value of parameter %s is invalid, the valid range is (0-1)\n",
- devname, name);
+ printk(KERN_NOTICE "via-velocity: the value of parameter %s is invalid, the valid range is (0-1)\n",
+ name);
*opt |= (def ? flag : 0);
} else {
- printk(KERN_INFO "%s: set parameter %s to %s\n",
- devname, name, val ? "TRUE" : "FALSE");
+ printk(KERN_INFO "via-velocity: set parameter %s to %s\n",
+ name, val ? "TRUE" : "FALSE");
*opt |= (val ? flag : 0);
}
}
@@ -580,6 +600,7 @@
static void __devinit velocity_get_options(struct velocity_opt *opts, int index, char *devname)
{
+ velocity_set_int_opt(&opts->velo_debug, velo_debug[index], VELO_DEBUG_MIN, VELO_DEBUG_MAX, VELO_DEBUG_DEF, "velo_debug", devname);
velocity_set_int_opt(&opts->rx_thresh, rx_thresh[index], RX_THRESH_MIN, RX_THRESH_MAX, RX_THRESH_DEF, "rx_thresh", devname);
velocity_set_int_opt(&opts->DMA_length, DMA_length[index], DMA_LENGTH_MIN, DMA_LENGTH_MAX, DMA_LENGTH_DEF, "DMA_length", devname);
velocity_set_int_opt(&opts->numrx, RxDescriptors[index], RX_DESC_MIN, RX_DESC_MAX, RX_DESC_DEF, "RxDescriptors", devname);
@@ -593,6 +614,7 @@
velocity_set_int_opt((int *) &opts->wol_opts, wol_opts[index], WOL_OPT_MIN, WOL_OPT_MAX, WOL_OPT_DEF, "Wake On Lan options", devname);
velocity_set_int_opt((int *) &opts->int_works, int_works[index], INT_WORKS_MIN, INT_WORKS_MAX, INT_WORKS_DEF, "Interrupt service works", devname);
opts->numrx = (opts->numrx & ~3);
+ vdebug = opts->velo_debug;
}
/**
@@ -608,6 +630,8 @@
struct mac_regs __iomem * regs = vptr->mac_regs;
unsigned short vid;
+ HAIL("velocity_init_cam_filter");
+
/* Turn on MCFG_PQEN, turn off MCFG_RTGOPT */
WORD_REG_BITS_SET(MCFG_PQEN, MCFG_RTGOPT, &regs->MCFG);
WORD_REG_BITS_ON(MCFG_VIDFR, &regs->MCFG);
@@ -636,8 +660,10 @@
} else {
u16 temp = 0;
mac_set_vlan_cam(regs, 0, (u8 *) &temp);
- temp = 1;
- mac_set_vlan_cam_mask(regs, (u8 *) &temp);
+ /* temp = 1; BE */
+ /* mac_set_vlan_cam_mask(regs, (u8 *) &temp); BE */
+ vptr->vCAMmask[0] |= 1; /* BE */
+ mac_set_vlan_cam_mask(regs, vptr->vCAMmask); /* BE */
}
}
@@ -675,13 +701,15 @@
struct mac_regs __iomem * regs = vptr->mac_regs;
int i;
+ HAIL("velocity_rx_reset");
vptr->rd_dirty = vptr->rd_filled = vptr->rd_curr = 0;
/*
* Init state, all RD entries belong to the NIC
*/
for (i = 0; i < vptr->options.numrx; ++i)
- vptr->rd_ring[i].rdesc0.owner = OWNED_BY_NIC;
+ /* vptr->rd_ring[i].rdesc0.owner = OWNED_BY_NIC; BE */
+ vptr->rd_ring[i].rdesc0 |= cpu_to_le32(BE_OWNED_BY_NIC); /* BE */
writew(vptr->options.numrx, &regs->RBRDU);
writel(vptr->rd_pool_dma, &regs->RDBaseLo);
@@ -704,12 +732,15 @@
struct mac_regs __iomem * regs = vptr->mac_regs;
int i, mii_status;
+ if (vdebug&5) printk(KERN_NOTICE "velocity_init_registers: entering\n");
+
mac_wol_reset(regs);
switch (type) {
case VELOCITY_INIT_RESET:
case VELOCITY_INIT_WOL:
+ if (vdebug&4) printk(KERN_NOTICE "velocity_init_registers: RESET or WOL\n");
netif_stop_queue(vptr->dev);
/*
@@ -737,12 +768,13 @@
case VELOCITY_INIT_COLD:
default:
+ if (vdebug&4) printk(KERN_NOTICE "velocity_init_registers: COLD or default\n");
/*
* Do reset
*/
velocity_soft_reset(vptr);
+ if (vdebug&4) printk(KERN_NOTICE "velocity_init_registers: soft reset complete.\n");
mdelay(5);
-
mac_eeprom_reload(regs);
for (i = 0; i < 6; i++) {
writeb(vptr->dev->dev_addr[i], &(regs->PAR[i]));
@@ -760,11 +792,16 @@
*/
BYTE_REG_BITS_SET(CFGB_OFSET, (CFGB_CRANDOM | CFGB_CAP | CFGB_MBA | CFGB_BAKOPT), &regs->CFGB);
+ if (vdebug&4) printk(KERN_NOTICE "velocity_init_registers: Initializing CAM filter\n");
/*
* Init CAM filter
*/
+ if (vdebug&8) printk(KERN_NOTICE "velocity: spot debug: about to init CAM filters\n");
+ mdelay(5); /* MJW - ARM processors, kernel 2.6.19 - this fixes oopses and hangs */
velocity_init_cam_filter(vptr);
+ if (vdebug&8) printk(KERN_NOTICE "velocity: spot debug: init CAM filters complete\n");
+ if (vdebug&4) printk(KERN_NOTICE "velocity_init_registers: Setting packet filter\n");
/*
* Set packet filter: Receive directed and broadcast address
*/
@@ -774,10 +811,12 @@
* Enable MII auto-polling
*/
enable_mii_autopoll(regs);
+ if (vdebug&4) printk(KERN_NOTICE "velocity_init_registers: enable_mii_autopoll complete.\n");
vptr->int_mask = INT_MASK_DEF;
- writel(cpu_to_le32(vptr->rd_pool_dma), &regs->RDBaseLo);
+ /* writel(cpu_to_le32(vptr->rd_pool_dma), &regs->RDBaseLo); BE */
+ writel((vptr->rd_pool_dma), &regs->RDBaseLo); /* BE */
writew(vptr->options.numrx - 1, &regs->RDCSize);
mac_rx_queue_run(regs);
mac_rx_queue_wake(regs);
@@ -785,10 +824,13 @@
writew(vptr->options.numtx - 1, &regs->TDCSize);
for (i = 0; i < vptr->num_txq; i++) {
- writel(cpu_to_le32(vptr->td_pool_dma[i]), &(regs->TDBaseLo[i]));
+ /* writel(cpu_to_le32(vptr->td_pool_dma[i]), &(regs->TDBaseLo[i])); BE */
+ writel((vptr->td_pool_dma[i]), &(regs->TDBaseLo[i])); /* BE */
mac_tx_queue_run(regs, i);
}
+ if (vdebug&4) printk(KERN_NOTICE "velocity_init_registers: DMA settings complete.\n");
+
init_flow_control_register(vptr);
writel(CR0_STOP, &regs->CR0Clr);
@@ -807,8 +849,10 @@
enable_flow_control_ability(vptr);
mac_hw_mibs_init(regs);
+ if (vdebug&4) printk(KERN_NOTICE "velocity_init_registers: Set interrupt mask\n");
mac_write_int_mask(vptr->int_mask, regs);
mac_clear_isr(regs);
+ if (vdebug&4) printk(KERN_NOTICE "velocity_init_registers: complete.\n");
}
}
@@ -826,6 +870,7 @@
struct mac_regs __iomem * regs = vptr->mac_regs;
int i = 0;
+ HAIL("velocity_soft_reset");
writel(CR0_SFRST, &regs->CR0Set);
for (i = 0; i < W_MAX_TIMEOUT; i++) {
@@ -888,6 +933,7 @@
VELOCITY_FULL_DRV_NAM, VELOCITY_VERSION);
printk(KERN_INFO "Copyright (c) 2002, 2003 VIA Networking Technologies, Inc.\n");
printk(KERN_INFO "Copyright (c) 2004 Red Hat Inc.\n");
+ printk(KERN_INFO "BE support, misc. fixes MJW 01Jan2007 - may be unstable\n");
first = 0;
}
@@ -1104,6 +1150,7 @@
dma_addr_t pool_dma;
u8 *pool;
+ HAIL("velocity_init_rings");
/*
* Allocate all RD/TD rings a single pool
*/
@@ -1166,6 +1213,7 @@
static void velocity_free_rings(struct velocity_info *vptr)
{
int size;
+ HAIL("velocity_free_rings");
size = vptr->options.numrx * sizeof(struct rx_desc) +
vptr->options.numtx * sizeof(struct tx_desc) * vptr->num_txq;
@@ -1182,6 +1230,7 @@
struct mac_regs __iomem *regs = vptr->mac_regs;
int avail, dirty, unusable;
+ HAIL("velocity_give_many_rx_descs");
/*
* RD number must be equal to 4X per hardware spec
* (programming guide rev 1.20, p.13)
@@ -1195,7 +1244,8 @@
dirty = vptr->rd_dirty - unusable;
for (avail = vptr->rd_filled & 0xfffc; avail; avail--) {
dirty = (dirty > 0) ? dirty - 1 : vptr->options.numrx - 1;
- vptr->rd_ring[dirty].rdesc0.owner = OWNED_BY_NIC;
+ /* vptr->rd_ring[dirty].rdesc0.owner = OWNED_BY_NIC; BE */
+ vptr->rd_ring[dirty].rdesc0 |= cpu_to_le32(BE_OWNED_BY_NIC); /* BE */
}
writew(vptr->rd_filled & 0xfffc, &regs->RBRDU);
@@ -1205,12 +1255,14 @@
static int velocity_rx_refill(struct velocity_info *vptr)
{
int dirty = vptr->rd_dirty, done = 0, ret = 0;
+ HAIL("velocity_rx_refill");
do {
struct rx_desc *rd = vptr->rd_ring + dirty;
/* Fine for an all zero Rx desc at init time as well */
- if (rd->rdesc0.owner == OWNED_BY_NIC)
+ /* if (rd->rdesc0.owner == OWNED_BY_NIC) BE */
+ if (rd->rdesc0 & cpu_to_le32(BE_OWNED_BY_NIC)) /* BE */
break;
if (!vptr->rd_info[dirty].skb) {
@@ -1244,6 +1296,7 @@
int ret;
int mtu = vptr->dev->mtu;
+ HAIL("velocity_init_rd_ring");
vptr->rx_buf_sz = (mtu <= ETH_DATA_LEN) ? PKT_BUF_SZ : mtu + 32;
vptr->rd_info = kcalloc(vptr->options.numrx,
@@ -1275,6 +1328,7 @@
{
int i;
+ HAIL("velocity_free_rd_ring");
if (vptr->rd_info == NULL)
return;
@@ -1314,6 +1368,7 @@
struct tx_desc *td;
struct velocity_td_info *td_info;
+ HAIL("velocity_init_td_ring");
/* Init the TD ring entries */
for (j = 0; j < vptr->num_txq; j++) {
curr = vptr->td_pool_dma[j];
@@ -1350,6 +1405,7 @@
struct velocity_td_info * td_info = &(vptr->td_infos[q][n]);
int i;
+ HAIL("velocity_free_td_ring_entry");
if (td_info == NULL)
return;
@@ -1379,6 +1435,7 @@
{
int i, j;
+ HAIL("velocity_free_td_ring");
for (j = 0; j < vptr->num_txq; j++) {
if (vptr->td_infos[j] == NULL)
continue;
@@ -1406,34 +1463,42 @@
struct net_device_stats *stats = &vptr->stats;
int rd_curr = vptr->rd_curr;
int works = 0;
+ u16 wRSR; /* BE */
+ HAILS("velocity_rx_srv", status);
do {
struct rx_desc *rd = vptr->rd_ring + rd_curr;
if (!vptr->rd_info[rd_curr].skb)
break;
- if (rd->rdesc0.owner == OWNED_BY_NIC)
+ /* if (rd->rdesc0.owner == OWNED_BY_NIC) BE */
+ if (rd->rdesc0 & cpu_to_le32(BE_OWNED_BY_NIC)) /* BE */
break;
rmb();
+ wRSR = (u16)(cpu_to_le32(rd->rdesc0)); /* BE */
/*
* Don't drop CE or RL error frame although RXOK is off
*/
- if ((rd->rdesc0.RSR & RSR_RXOK) || (!(rd->rdesc0.RSR & RSR_RXOK) && (rd->rdesc0.RSR & (RSR_CE | RSR_RL)))) {
+ /* if ((rd->rdesc0.RSR & RSR_RXOK) || (!(rd->rdesc0.RSR & RSR_RXOK) && (rd->rdesc0.RSR & (RSR_CE | RSR_RL)))) { BE */
+ if ((wRSR & RSR_RXOK) || (!(wRSR & RSR_RXOK) && (wRSR & (RSR_CE | RSR_RL)))) { /* BE */
if (velocity_receive_frame(vptr, rd_curr) < 0)
stats->rx_dropped++;
} else {
- if (rd->rdesc0.RSR & RSR_CRC)
+ /* if (rd->rdesc0.RSR & RSR_CRC) BE */
+ if (wRSR & RSR_CRC) /* BE */
stats->rx_crc_errors++;
- if (rd->rdesc0.RSR & RSR_FAE)
+ /* if (rd->rdesc0.RSR & RSR_FAE) BE */
+ if (wRSR & RSR_FAE) /* BE */
stats->rx_frame_errors++;
stats->rx_dropped++;
}
- rd->inten = 1;
+ /* rd->inten = 1; BE */
+ rd->ltwo |= cpu_to_le32(BE_INT_ENABLE); /* BE */
vptr->dev->last_rx = jiffies;
@@ -1464,13 +1529,21 @@
static inline void velocity_rx_csum(struct rx_desc *rd, struct sk_buff *skb)
{
+ u8 bCSM;
+ HAIL("velocity_rx_csum");
skb->ip_summed = CHECKSUM_NONE;
- if (rd->rdesc1.CSM & CSM_IPKT) {
- if (rd->rdesc1.CSM & CSM_IPOK) {
- if ((rd->rdesc1.CSM & CSM_TCPKT) ||
- (rd->rdesc1.CSM & CSM_UDPKT)) {
- if (!(rd->rdesc1.CSM & CSM_TUPOK)) {
+// if (rd->rdesc1.CSM & CSM_IPKT) {
+// if (rd->rdesc1.CSM & CSM_IPOK) {
+// if ((rd->rdesc1.CSM & CSM_TCPKT) ||
+// (rd->rdesc1.CSM & CSM_UDPKT)) {
+// if (!(rd->rdesc1.CSM & CSM_TUPOK)) {
+ bCSM = (u8)(cpu_to_le32(rd->rdesc1) >> 16); /* BE */
+ if (bCSM & CSM_IPKT) {
+ if (bCSM & CSM_IPOK) {
+ if ((bCSM & CSM_TCPKT) ||
+ (bCSM & CSM_UDPKT)) {
+ if (!(bCSM & CSM_TUPOK)) { /* BE */
return;
}
}
@@ -1496,9 +1569,11 @@
{
int ret = -1;
+ HAIL("velocity_rx_copy");
if (pkt_size < rx_copybreak) {
struct sk_buff *new_skb;
+ HAIL("velocity_rx_copy (working...)");
new_skb = dev_alloc_skb(pkt_size + 2);
if (new_skb) {
new_skb->dev = vptr->dev;
@@ -1529,10 +1604,12 @@
static inline void velocity_iph_realign(struct velocity_info *vptr,
struct sk_buff *skb, int pkt_size)
{
+ HAIL("velocity_iph_realign");
/* FIXME - memmove ? */
if (vptr->flags & VELOCITY_FLAGS_IP_ALIGN) {
int i;
+ HAIL("velocity_iph_realign (working...)");
for (i = pkt_size; i >= 0; i--)
*(skb->data + i + 2) = *(skb->data + i);
skb_reserve(skb, 2);
@@ -1551,19 +1628,27 @@
static int velocity_receive_frame(struct velocity_info *vptr, int idx)
{
void (*pci_action)(struct pci_dev *, dma_addr_t, size_t, int);
+ u16 pkt_len; /* BE */
+ u16 wRSR; /* BE */
+ struct sk_buff *skb;
struct net_device_stats *stats = &vptr->stats;
struct velocity_rd_info *rd_info = &(vptr->rd_info[idx]);
struct rx_desc *rd = &(vptr->rd_ring[idx]);
- int pkt_len = rd->rdesc0.len;
- struct sk_buff *skb;
+ /* int pkt_len = rd->rdesc0.len BE */;
+
+ pkt_len = ((cpu_to_le32(rd->rdesc0) >> 16) & 0x00003FFFUL); /* BE */
+ wRSR = (u16)(cpu_to_le32(rd->rdesc0)); /* BE */
- if (rd->rdesc0.RSR & (RSR_STP | RSR_EDP)) {
+ HAIL("velocity_receive_frame");
+ /* if (rd->rdesc0.RSR & (RSR_STP | RSR_EDP)) { BE */
+ if (wRSR & (RSR_STP | RSR_EDP)) { /* BE */
VELOCITY_PRT(MSG_LEVEL_VERBOSE, KERN_ERR " %s : the received frame span multple RDs.\n", vptr->dev->name);
stats->rx_length_errors++;
return -EINVAL;
}
- if (rd->rdesc0.RSR & RSR_MAR)
+ /* if (rd->rdesc0.RSR & RSR_MAR) BE */
+ if (wRSR & RSR_MAR) /* BE */
vptr->stats.multicast++;
skb = rd_info->skb;
@@ -1576,7 +1661,8 @@
*/
if (vptr->flags & VELOCITY_FLAGS_VAL_PKT_LEN) {
- if (rd->rdesc0.RSR & RSR_RL) {
+ /* if (rd->rdesc0.RSR & RSR_RL) { BE */
+ if (wRSR & RSR_RL) { /* BE */
stats->rx_length_errors++;
return -EINVAL;
}
@@ -1620,6 +1706,7 @@
struct rx_desc *rd = &(vptr->rd_ring[idx]);
struct velocity_rd_info *rd_info = &(vptr->rd_info[idx]);
+ HAIL("velocity_alloc_rx_buf");
rd_info->skb = dev_alloc_skb(vptr->rx_buf_sz + 64);
if (rd_info->skb == NULL)
return -ENOMEM;
@@ -1637,10 +1724,14 @@
*/
*((u32 *) & (rd->rdesc0)) = 0;
- rd->len = cpu_to_le32(vptr->rx_buf_sz);
- rd->inten = 1;
+ /* rd->len = cpu_to_le32(vptr->rx_buf_sz); BE */
+ /* rd->inten = 1; BE */
rd->pa_low = cpu_to_le32(rd_info->skb_dma);
- rd->pa_high = 0;
+ /* rd->pa_high = 0; BE */
+ rd->ltwo &= cpu_to_le32(0xC000FFFFUL); /* BE */
+ rd->ltwo |= cpu_to_le32((vptr->rx_buf_sz << 16)); /* BE */
+ rd->ltwo |= cpu_to_le32(BE_INT_ENABLE); /* BE */
+ rd->ltwo &= cpu_to_le32(0xFFFF0000UL); /* BE */
return 0;
}
@@ -1661,9 +1752,11 @@
int full = 0;
int idx;
int works = 0;
+ u16 wTSR; /* BE */
struct velocity_td_info *tdinfo;
struct net_device_stats *stats = &vptr->stats;
+ HAILS("velocity_tx_srv", status);
for (qnum = 0; qnum < vptr->num_txq; qnum++) {
for (idx = vptr->td_tail[qnum]; vptr->td_used[qnum] > 0;
idx = (idx + 1) % vptr->options.numtx) {
@@ -1674,22 +1767,29 @@
td = &(vptr->td_rings[qnum][idx]);
tdinfo = &(vptr->td_infos[qnum][idx]);
- if (td->tdesc0.owner == OWNED_BY_NIC)
+ /* if (td->tdesc0.owner == OWNED_BY_NIC) BE */
+ if (td->tdesc0 & cpu_to_le32(BE_OWNED_BY_NIC)) /* BE */
break;
if ((works++ > 15))
break;
- if (td->tdesc0.TSR & TSR0_TERR) {
+ wTSR = (u16)cpu_to_le32(td->tdesc0);
+ /* if (td->tdesc0.TSR & TSR0_TERR) { BE */
+ if (wTSR & TSR0_TERR) { /* BE */
stats->tx_errors++;
stats->tx_dropped++;
- if (td->tdesc0.TSR & TSR0_CDH)
+ /* if (td->tdesc0.TSR & TSR0_CDH) BE */
+ if (wTSR & TSR0_CDH) /* BE */
stats->tx_heartbeat_errors++;
- if (td->tdesc0.TSR & TSR0_CRS)
+ /* if (td->tdesc0.TSR & TSR0_CRS) BE */
+ if (wTSR & TSR0_CRS) /* BE */
stats->tx_carrier_errors++;
- if (td->tdesc0.TSR & TSR0_ABT)
+ /* if (td->tdesc0.TSR & TSR0_ABT) BE */
+ if (wTSR & TSR0_ABT) /* BE */
stats->tx_aborted_errors++;
- if (td->tdesc0.TSR & TSR0_OWC)
+ /* if (td->tdesc0.TSR & TSR0_OWC) BE */
+ if (wTSR & TSR0_OWC) /* BE */
stats->tx_window_errors++;
} else {
stats->tx_packets++;
@@ -1778,6 +1878,7 @@
static void velocity_error(struct velocity_info *vptr, int status)
{
+ HAILS("velocity_error", status);
if (status & ISR_TXSTLI) {
struct mac_regs __iomem * regs = vptr->mac_regs;
@@ -1867,6 +1968,7 @@
struct sk_buff *skb = tdinfo->skb;
int i;
+ HAIL("velocity_free_tx_buf");
/*
* Don't unmap the pre-allocated tx_bufs
*/
@@ -2067,6 +2169,7 @@
struct velocity_td_info *tdinfo;
unsigned long flags;
int index;
+ u32 lbufsz; /* BE */
int pktlen = skb->len;
@@ -2083,9 +2186,18 @@
td_ptr = &(vptr->td_rings[qnum][index]);
tdinfo = &(vptr->td_infos[qnum][index]);
- td_ptr->tdesc1.TCPLS = TCPLS_NORMAL;
- td_ptr->tdesc1.TCR = TCR0_TIC;
- td_ptr->td_buf[0].queue = 0;
+ td_ptr->tdesc0 = 0x00000000UL; /* BE */
+ td_ptr->tdesc1 = 0x00000000UL; /* BE */
+
+ /* td_ptr->tdesc1.TCPLS = TCPLS_NORMAL; BE */
+ td_ptr->tdesc1 &= cpu_to_le32(0xfcffffffUL); /* BE */
+ td_ptr->tdesc1 |= cpu_to_le32(((u32)TCPLS_NORMAL) << 24); /* BE */
+
+ /* td_ptr->tdesc1.TCR = TCR0_TIC; BE */
+ td_ptr->tdesc1 |= cpu_to_le32(BE_TCR_TIC); /* BE */
+
+ /* td_ptr->td_buf[0].queue = 0; BE */
+ td_ptr->td_buf[0].ltwo &= cpu_to_le32(~BE_QUEUE_ENABLE); /* BE */
/*
* Pad short frames.
@@ -2097,20 +2209,36 @@
memset(tdinfo->buf + skb->len, 0, ETH_ZLEN - skb->len);
tdinfo->skb = skb;
tdinfo->skb_dma[0] = tdinfo->buf_dma;
- td_ptr->tdesc0.pktsize = pktlen;
+ /* td_ptr->tdesc0.pktsize = pktlen; */
+ td_ptr->tdesc0 &= cpu_to_le32(0xc000ffffUL); /* BE */
+ lbufsz = pktlen; /* Assign, and make sure it's unsigned 32 bits - BE */
+ lbufsz = lbufsz << 16; /* BE - shift over */
+ td_ptr->tdesc0 |= cpu_to_le32(lbufsz); /* BE */
+
td_ptr->td_buf[0].pa_low = cpu_to_le32(tdinfo->skb_dma[0]);
- td_ptr->td_buf[0].pa_high = 0;
- td_ptr->td_buf[0].bufsize = td_ptr->tdesc0.pktsize;
+ /* td_ptr->td_buf[0].pa_high = 0; */
+ /* td_ptr->td_buf[0].bufsize = td_ptr->tdesc0.pktsize; */
+ td_ptr->td_buf[0].ltwo = cpu_to_le32(lbufsz); /* BE */
tdinfo->nskb_dma = 1;
- td_ptr->tdesc1.CMDZ = 2;
+ /* td_ptr->tdesc1.CMDZ = 2; */
+ td_ptr->tdesc1 &= cpu_to_le32(0x0fffffffUL); /* BE */
+ td_ptr->tdesc1 |= cpu_to_le32(((u32)0x2) << 28); /* BE */
} else
#ifdef VELOCITY_ZERO_COPY_SUPPORT
+ /*
+ * BE - NOTE on the VELOCITY_ZERO_COPY_SUPPORT:
+ * This block of code has NOT been patched up for BE support, as
+ * it is certainly broken -- if it compiles at all. Since the BE
+ * fixes depend on the broken code, attempts to convert to BE support
+ * would almost certainly confuse more than help.
+ */
if (skb_shinfo(skb)->nr_frags > 0) {
int nfrags = skb_shinfo(skb)->nr_frags;
tdinfo->skb = skb;
if (nfrags > 6) {
skb_copy_from_linear_data(skb, tdinfo->buf, skb->len);
tdinfo->skb_dma[0] = tdinfo->buf_dma;
+ /* BE: Er, exactly what value are we assigning in this next line? */
td_ptr->tdesc0.pktsize =
td_ptr->td_buf[0].pa_low = cpu_to_le32(tdinfo->skb_dma[0]);
td_ptr->td_buf[0].pa_high = 0;
@@ -2127,6 +2255,7 @@
/* FIXME: support 48bit DMA later */
td_ptr->td_buf[i].pa_low = cpu_to_le32(tdinfo->skb_dma);
td_ptr->td_buf[i].pa_high = 0;
+ /* BE: This next line can't be right: */
td_ptr->td_buf[i].bufsize = skb->len->skb->data_len;
for (i = 0; i < nfrags; i++) {
@@ -2144,7 +2273,7 @@
}
} else
-#endif
+#endif /* (broken) VELOCITY_ZERO_COPY_SUPPORT */
{
/*
* Map the linear network buffer into PCI space and
@@ -2152,19 +2281,29 @@
*/
tdinfo->skb = skb;
tdinfo->skb_dma[0] = pci_map_single(vptr->pdev, skb->data, pktlen, PCI_DMA_TODEVICE);
- td_ptr->tdesc0.pktsize = pktlen;
+ /* td_ptr->tdesc0.pktsize = pktlen; BE */
+ td_ptr->tdesc0 &= cpu_to_le32(0xc000ffffUL); /* BE */
+ lbufsz = pktlen; /* Assign, and make sure it's unsigned 32 bits - BE */
+ lbufsz = lbufsz << 16; /* BE */
+ td_ptr->tdesc0 |= cpu_to_le32(lbufsz); /* BE */
td_ptr->td_buf[0].pa_low = cpu_to_le32(tdinfo->skb_dma[0]);
- td_ptr->td_buf[0].pa_high = 0;
- td_ptr->td_buf[0].bufsize = td_ptr->tdesc0.pktsize;
+ /* td_ptr->td_buf[0].pa_high = 0; BE */
+ /* td_ptr->td_buf[0].bufsize = td_ptr->tdesc0.pktsize; BE */
+ td_ptr->td_buf[0].ltwo = cpu_to_le32(lbufsz); /* BE */
tdinfo->nskb_dma = 1;
- td_ptr->tdesc1.CMDZ = 2;
+ /* td_ptr->tdesc1.CMDZ = 2; BE */
+ td_ptr->tdesc1 &= cpu_to_le32(0x0fffffffUL); /* BE */
+ td_ptr->tdesc1 |= cpu_to_le32(((u32)0x2) << 28); /* BE */
}
if (vptr->vlgrp && vlan_tx_tag_present(skb)) {
- td_ptr->tdesc1.pqinf.VID = vlan_tx_tag_get(skb);
- td_ptr->tdesc1.pqinf.priority = 0;
- td_ptr->tdesc1.pqinf.CFI = 0;
- td_ptr->tdesc1.TCR |= TCR0_VETAG;
+ /* td_ptr->tdesc1.pqinf.VID = vlan_tx_tag_get(skb); BE */
+ /* td_ptr->tdesc1.pqinf.priority = 0; BE */
+ /* td_ptr->tdesc1.pqinf.CFI = 0; BE */
+ /* td_ptr->tdesc1.TCR |= TCR0_VETAG; BE */
+ td_ptr->tdesc1 &= cpu_to_le32(0xFFFF0000UL); /* BE */
+ td_ptr->tdesc1 |= cpu_to_le32(vlan_tx_tag_get(skb)); /* BE */
+ td_ptr->tdesc1 |= cpu_to_le32(BE_TCR_VETAG); /* BE */
}
/*
@@ -2174,26 +2313,34 @@
&& (skb->ip_summed == CHECKSUM_PARTIAL)) {
const struct iphdr *ip = ip_hdr(skb);
if (ip->protocol == IPPROTO_TCP)
- td_ptr->tdesc1.TCR |= TCR0_TCPCK;
+ /* td_ptr->tdesc1.TCR |= TCR0_TCPCK; BE */
+ td_ptr->tdesc1 |= cpu_to_le32(BE_TCR_TCPCK); /* BE */
else if (ip->protocol == IPPROTO_UDP)
- td_ptr->tdesc1.TCR |= (TCR0_UDPCK);
- td_ptr->tdesc1.TCR |= TCR0_IPCK;
- }
+ /* td_ptr->tdesc1.TCR |= (TCR0_UDPCK); BE */
+ td_ptr->tdesc1 |= cpu_to_le32(BE_TCR_UDPCK); /* BE */
+ /* td_ptr->tdesc1.TCR |= TCR0_IPCK; BE */
+ td_ptr->tdesc1 |= cpu_to_le32(BE_TCR_IPCK); /* BE */
+ }
{
int prev = index - 1;
if (prev < 0)
prev = vptr->options.numtx - 1;
- td_ptr->tdesc0.owner = OWNED_BY_NIC;
+ /* td_ptr->tdesc0.owner = OWNED_BY_NIC; BE */
+ td_ptr->tdesc0 |= cpu_to_le32(BE_OWNED_BY_NIC); /* BE */
vptr->td_used[qnum]++;
vptr->td_curr[qnum] = (index + 1) % vptr->options.numtx;
if (AVAIL_TD(vptr, qnum) < 1)
netif_stop_queue(dev);
- td_ptr = &(vptr->td_rings[qnum][prev]);
- td_ptr->td_buf[0].queue = 1;
+ td_ptr = &(vptr->td_rings[qnum][prev]);
+ /* td_ptr->td_buf[0].queue = 1; BE */
+ td_ptr->td_buf[0].ltwo |= cpu_to_le32(BE_QUEUE_ENABLE); /* BE */
+ if (vdebug&2) printk(KERN_NOTICE "velocity_xmit: (%s) len=%d idx=%d tdesc0=0x%x tdesc1=0x%x ltwo=0x%x\n",
+ (pktlen<ETH_ZLEN) ? "short" : "normal", pktlen, index,
+ td_ptr->tdesc0, td_ptr->tdesc1, td_ptr->td_buf[0].ltwo);
mac_tx_queue_wake(vptr->mac_regs, qnum);
}
dev->trans_start = jiffies;
@@ -2219,7 +2366,7 @@
u32 isr_status;
int max_count = 0;
-
+ HAIL("velocity_intr");
spin_lock(&vptr->lock);
isr_status = mac_read_isr(vptr->mac_regs);
@@ -2238,7 +2385,10 @@
while (isr_status != 0) {
mac_write_isr(vptr->mac_regs, isr_status);
- if (isr_status & (~(ISR_PRXI | ISR_PPRXI | ISR_PTXI | ISR_PPTXI)))
+ HAILS("velocity_intr",isr_status);
+ /* MJW - velocity_error is ALWAYS called; need to mask off some other flags */
+ /* if (isr_status & (~(ISR_PRXI | ISR_PPRXI | ISR_PTXI | ISR_PPTXI))) */
+ if (isr_status & (~(ISR_PRXI | ISR_PPRXI | ISR_PTXI | ISR_PPTXI | ISR_PTX0I | ISR_ISR0)))
velocity_error(vptr, isr_status);
if (isr_status & (ISR_PRXI | ISR_PPRXI))
max_count += velocity_rx_srv(vptr, isr_status);
@@ -2276,6 +2426,7 @@
int i;
struct dev_mc_list *mclist;
+ HAIL("velocity_set_multi");
if (dev->flags & IFF_PROMISC) { /* Set promiscuous. */
writel(0xffffffff, &regs->MARCAM[0]);
writel(0xffffffff, &regs->MARCAM[4]);
@@ -2319,6 +2470,7 @@
{
struct velocity_info *vptr = netdev_priv(dev);
+ HAIL("net_device_stats");
/* If the hardware is down, don't touch MII */
if(!netif_running(dev))
return &vptr->stats;
@@ -2363,6 +2515,7 @@
struct velocity_info *vptr = netdev_priv(dev);
int ret;
+ HAIL("velocity_ioctl");
/* If we are asked for information and the device is power
saving then we need to bring the device back up to talk to it */
@@ -2581,6 +2734,8 @@
{
u16 ww;
+ HAIL("velocity_mii_read");
+ HAIL("velocity_mii_write");
/*
* Disable MIICR_MAUTO, so that mii addr can be set normally
*/
diff -Naur linux-2.6.24.orig/drivers/net/via-velocity.h linux-2.6.24/drivers/net/via-velocity.h
--- linux-2.6.24.orig/drivers/net/via-velocity.h 2008-01-31 23:11:26.000000000 -0600
+++ linux-2.6.24/drivers/net/via-velocity.h 2008-02-01 01:12:15.000000000 -0600
@@ -196,64 +196,70 @@
* Receive descriptor
*/
-struct rdesc0 {
- u16 RSR; /* Receive status */
- u16 len:14; /* Received packet length */
- u16 reserved:1;
- u16 owner:1; /* Who owns this buffer ? */
-};
-
-struct rdesc1 {
- u16 PQTAG;
- u8 CSM;
- u8 IPKT;
-};
+//struct rdesc0 {
+// u16 RSR; /* Receive status */
+// u16 len:14; /* Received packet length */
+// u16 reserved:1;
+// u16 owner:1; /* Who owns this buffer ? */
+//};
+
+//struct rdesc1 {
+// u16 PQTAG;
+// u8 CSM;
+// u8 IPKT;
+//};
struct rx_desc {
- struct rdesc0 rdesc0;
- struct rdesc1 rdesc1;
+// struct rdesc0 rdesc0;
+// struct rdesc1 rdesc1;
+ u32 rdesc0;
+ u32 rdesc1;
u32 pa_low; /* Low 32 bit PCI address */
- u16 pa_high; /* Next 16 bit PCI address (48 total) */
- u16 len:15; /* Frame size */
- u16 inten:1; /* Enable interrupt */
+// u16 pa_high; /* Next 16 bit PCI address (48 total) */
+// u16 len:15; /* Frame size */
+// u16 inten:1; /* Enable interrupt */
+ u32 ltwo;
} __attribute__ ((__packed__));
/*
* Transmit descriptor
*/
-struct tdesc0 {
- u16 TSR; /* Transmit status register */
- u16 pktsize:14; /* Size of frame */
- u16 reserved:1;
- u16 owner:1; /* Who owns the buffer */
-};
-
-struct pqinf { /* Priority queue info */
- u16 VID:12;
- u16 CFI:1;
- u16 priority:3;
-} __attribute__ ((__packed__));
-
-struct tdesc1 {
- struct pqinf pqinf;
- u8 TCR;
- u8 TCPLS:2;
- u8 reserved:2;
- u8 CMDZ:4;
-} __attribute__ ((__packed__));
+//struct tdesc0 {
+// u16 TSR; /* Transmit status register */
+// u16 pktsize:14; /* Size of frame */
+// u16 reserved:1;
+// u16 owner:1; /* Who owns the buffer */
+//};
+
+//struct pqinf { /* Priority queue info */
+// u16 VID:12;
+// u16 CFI:1;
+// u16 priority:3;
+//} __attribute__ ((__packed__));
+
+//struct tdesc1 {
+// struct pqinf pqinf;
+// u8 TCR;
+// u8 TCPLS:2;
+// u8 reserved:2;
+// u8 CMDZ:4;
+//} __attribute__ ((__packed__));
struct td_buf {
u32 pa_low;
- u16 pa_high;
- u16 bufsize:14;
- u16 reserved:1;
- u16 queue:1;
+// u16 pa_high;
+// u16 bufsize:14;
+// u16 reserved:1;
+// u16 queue:1;
+ u32 ltwo;
} __attribute__ ((__packed__));
struct tx_desc {
- struct tdesc0 tdesc0;
- struct tdesc1 tdesc1;
+// struct tdesc0 tdesc0;
+// struct tdesc1 tdesc1;
+ u32 tdesc0;
+ u32 tdesc1;
struct td_buf td_buf[7];
};
@@ -279,6 +285,16 @@
OWNED_BY_NIC = 1
};
+/* Constants added for the BE fixes */
+#define BE_OWNED_BY_NIC 0x80000000UL
+#define BE_INT_ENABLE 0x80000000UL
+#define BE_QUEUE_ENABLE 0x80000000UL
+#define BE_TCR_TIC 0x00800000UL
+#define BE_TCR_VETAG 0x00200000UL
+#define BE_TCR_TCPCK 0x00040000UL
+#define BE_TCR_UDPCK 0x00080000UL
+#define BE_TCR_IPCK 0x00100000UL
+
/*
* MAC registers and macros.
@@ -1512,6 +1528,7 @@
};
struct velocity_opt {
+ int velo_debug; /* debug flag */
int numrx; /* Number of RX descriptors */
int numtx; /* Number of TX descriptors */
enum speed_opt spd_dpx; /* Media link mode */

View File

@ -1,55 +0,0 @@
diff -uprN linux-2.6.23.orig/arch/arm/mach-ixp4xx/nslu2-setup.c linux-2.6.23/arch/arm/mach-ixp4xx/nslu2-setup.c
--- linux-2.6.23.orig/arch/arm/mach-ixp4xx/nslu2-setup.c 2007-10-09 15:31:38.000000000 -0500
+++ linux-2.6.23/arch/arm/mach-ixp4xx/nslu2-setup.c 2007-10-11 01:04:46.000000000 -0500
@@ -19,6 +19,7 @@
#include <linux/serial_8250.h>
#include <linux/leds.h>
+#include <asm/setup.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
#include <asm/mach/flash.h>
@@ -171,6 +172,35 @@ static struct sys_timer nslu2_timer = {
.init = nslu2_timer_init,
};
+static char nslu2_rtc_probe[] __initdata = "rtc-isl1208.ignore=0,0x6f rtc-x1205.probe=0,0x6f ";
+
+static void __init nslu2_fixup(struct machine_desc *desc,
+ struct tag *tags, char **cmdline, struct meminfo *mi)
+{
+ struct tag *t = tags;
+ char *p = *cmdline;
+
+ /* Find the end of the tags table, taking note of any cmdline tag. */
+ for (; t->hdr.size; t = tag_next(t)) {
+ if (t->hdr.tag == ATAG_CMDLINE) {
+ p = t->u.cmdline.cmdline;
+ }
+ }
+
+ /* Overwrite the end of the table with a new cmdline tag. */
+ t->hdr.tag = ATAG_CMDLINE;
+ t->hdr.size = (sizeof (struct tag_header) +
+ strlen(nslu2_rtc_probe) + strlen(p) + 1 + 4) >> 2;
+ strlcpy(t->u.cmdline.cmdline, nslu2_rtc_probe, COMMAND_LINE_SIZE);
+ strlcpy(t->u.cmdline.cmdline + strlen(nslu2_rtc_probe), p,
+ COMMAND_LINE_SIZE - strlen(nslu2_rtc_probe));
+
+ /* Terminate the table. */
+ t = tag_next(t);
+ t->hdr.tag = ATAG_NONE;
+ t->hdr.size = 0;
+}
+
static void __init nslu2_init(void)
{
ixp4xx_sys_init();
@@ -196,6 +226,7 @@ MACHINE_START(NSLU2, "Linksys NSLU2")
.phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
.io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xFFFC,
.boot_params = 0x00000100,
+ .fixup = nslu2_fixup,
.map_io = ixp4xx_map_io,
.init_irq = ixp4xx_init_irq,
.timer = &nslu2_timer,

View File

@ -1,55 +0,0 @@
diff -uprN linux-2.6.23.orig/arch/arm/mach-ixp4xx/nas100d-setup.c linux-2.6.23/arch/arm/mach-ixp4xx/nas100d-setup.c
--- linux-2.6.23.orig/arch/arm/mach-ixp4xx/nas100d-setup.c 2007-10-09 15:31:38.000000000 -0500
+++ linux-2.6.23/arch/arm/mach-ixp4xx/nas100d-setup.c 2007-10-11 01:06:33.000000000 -0500
@@ -17,6 +17,7 @@
#include <linux/serial_8250.h>
#include <linux/leds.h>
+#include <asm/setup.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
#include <asm/mach/flash.h>
@@ -142,6 +143,35 @@ static void nas100d_power_off(void)
gpio_line_set(NAS100D_PO_GPIO, IXP4XX_GPIO_HIGH);
}
+static char nas100d_rtc_probe[] __initdata = "rtc-pcf8563.probe=0,0x51 ";
+
+static void __init nas100d_fixup(struct machine_desc *desc,
+ struct tag *tags, char **cmdline, struct meminfo *mi)
+{
+ struct tag *t = tags;
+ char *p = *cmdline;
+
+ /* Find the end of the tags table, taking note of any cmdline tag. */
+ for (; t->hdr.size; t = tag_next(t)) {
+ if (t->hdr.tag == ATAG_CMDLINE) {
+ p = t->u.cmdline.cmdline;
+ }
+ }
+
+ /* Overwrite the end of the table with a new cmdline tag. */
+ t->hdr.tag = ATAG_CMDLINE;
+ t->hdr.size = (sizeof (struct tag_header) +
+ strlen(nas100d_rtc_probe) + strlen(p) + 1 + 4) >> 2;
+ strlcpy(t->u.cmdline.cmdline, nas100d_rtc_probe, COMMAND_LINE_SIZE);
+ strlcpy(t->u.cmdline.cmdline + strlen(nas100d_rtc_probe), p,
+ COMMAND_LINE_SIZE - strlen(nas100d_rtc_probe));
+
+ /* Terminate the table. */
+ t = tag_next(t);
+ t->hdr.tag = ATAG_NONE;
+ t->hdr.size = 0;
+}
+
static void __init nas100d_init(void)
{
ixp4xx_sys_init();
@@ -170,6 +200,7 @@ MACHINE_START(NAS100D, "Iomega NAS 100d"
.phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
.io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xFFFC,
.boot_params = 0x00000100,
+ .fixup = nas100d_fixup,
.map_io = ixp4xx_map_io,
.init_irq = ixp4xx_init_irq,
.timer = &ixp4xx_timer,

View File

@ -1,56 +0,0 @@
Index: linux-2.6.22-rc4-armeb/arch/arm/mach-ixp4xx/dsmg600-setup.c
===================================================================
--- linux-2.6.22-rc4-armeb.orig/arch/arm/mach-ixp4xx/dsmg600-setup.c
+++ linux-2.6.22-rc4-armeb/arch/arm/mach-ixp4xx/dsmg600-setup.c
@@ -16,6 +16,7 @@
#include <linux/serial_8250.h>
#include <linux/i2c-gpio.h>
+#include <asm/setup.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
#include <asm/mach/flash.h>
@@ -145,6 +146,35 @@ static struct sys_timer dsmg600_timer =
.init = dsmg600_timer_init,
};
+static char dsmg600_rtc_probe[] __initdata = "rtc-pcf8563.probe=0,0x51 ";
+
+static void __init dsmg600_fixup(struct machine_desc *desc,
+ struct tag *tags, char **cmdline, struct meminfo *mi)
+{
+ struct tag *t = tags;
+ char *p = *cmdline;
+
+ /* Find the end of the tags table, taking note of any cmdline tag. */
+ for (; t->hdr.size; t = tag_next(t)) {
+ if (t->hdr.tag == ATAG_CMDLINE) {
+ p = t->u.cmdline.cmdline;
+ }
+ }
+
+ /* Overwrite the end of the table with a new cmdline tag. */
+ t->hdr.tag = ATAG_CMDLINE;
+ t->hdr.size = (sizeof (struct tag_header) +
+ strlen(dsmg600_rtc_probe) + strlen(p) + 1 + 4) >> 2;
+ strlcpy(t->u.cmdline.cmdline, dsmg600_rtc_probe, COMMAND_LINE_SIZE);
+ strlcpy(t->u.cmdline.cmdline + strlen(dsmg600_rtc_probe), p,
+ COMMAND_LINE_SIZE - strlen(dsmg600_rtc_probe));
+
+ /* Terminate the table. */
+ t = tag_next(t);
+ t->hdr.tag = ATAG_NONE;
+ t->hdr.size = 0;
+}
+
static void __init dsmg600_init(void)
{
ixp4xx_sys_init();
@@ -177,6 +207,7 @@ MACHINE_START(DSMG600, "D-Link DSM-G600
.phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
.io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xFFFC,
.boot_params = 0x00000100,
+ .fixup = dsmg600_fixup,
.map_io = ixp4xx_map_io,
.init_irq = ixp4xx_init_irq,
.timer = &dsmg600_timer,