diff options
author | John Bowler <jbowler@nslu2-linux.org> | 2005-06-17 01:02:14 +0000 |
---|---|---|
committer | John Bowler <jbowler@nslu2-linux.org> | 2005-06-17 01:02:14 +0000 |
commit | 17eda4148261ba29cc23c949c0e2da2a70030336 (patch) | |
tree | a7907b13a3a4d06a404c405a90c9046736d0ed49 | |
parent | d8815b187088d9e54e656811e5efdc560a0823b2 (diff) |
Fix for shutdown -h. Change shutdown -r to use soft reboot (which does
not currently work, but there seems to be no way to make the hardware
reboot work reliably). Also change the soft reboot to set the watchdog
timer so that if it *doesn't* work the hardware reboot gets used (it does
sometimes work...)
BKrev: 42b22116rJbKTRTvvr2KxZ0fK909pA
4 files changed, 174 insertions, 29 deletions
diff --git a/packages/linux/openslug-kernel-2.6.11.2/nslu2-io.c b/packages/linux/openslug-kernel-2.6.11.2/nslu2-io.c index a15a305439..8e3ca894c4 100644 --- a/packages/linux/openslug-kernel-2.6.11.2/nslu2-io.c +++ b/packages/linux/openslug-kernel-2.6.11.2/nslu2-io.c @@ -47,6 +47,7 @@ #include <linux/interrupt.h> #include <linux/moduleparam.h> #include <linux/timer.h> +#include <linux/reboot.h> #include <asm/system.h> #include <asm/uaccess.h> @@ -298,10 +299,10 @@ static void n2lm_ledon(unsigned long led) *IXP4XX_GPIO_GPOUTR |= RS_GRN_ON; //2 return; case LED_DISK1: - *IXP4XX_GPIO_GPOUTR &= DISK1_ON; //0xfffffffb + *IXP4XX_GPIO_GPOUTR &= DISK1_ON; //0xfffffff7 return; case LED_DISK2: - *IXP4XX_GPIO_GPOUTR &= DISK2_ON; //0xfffffff7 + *IXP4XX_GPIO_GPOUTR &= DISK2_ON; //0xfffffffb return; case LED_ALL: //all green *IXP4XX_GPIO_GPOUTR |= RS_GRN_ON; @@ -323,10 +324,10 @@ static void n2lm_ledoff(unsigned long led) *IXP4XX_GPIO_GPOUTR &= RS_GRN_OFF; //0xfffffffd return; case LED_DISK1: - *IXP4XX_GPIO_GPOUTR |= DISK1_OFF; //0x00000004 + *IXP4XX_GPIO_GPOUTR |= DISK1_OFF; //0x00000008 return; case LED_DISK2: - *IXP4XX_GPIO_GPOUTR |= DISK2_OFF; //0x00000008 + *IXP4XX_GPIO_GPOUTR |= DISK2_OFF; //0x00000004 return; case LED_ALL: *IXP4XX_GPIO_GPOUTR &= (RS_GRN_OFF & RS_RED_OFF); @@ -512,8 +513,7 @@ static irqreturn_t n2pb_handler (int irq, void *dev_id, struct pt_regs *regs) // message, do an orderly shutdown and use an ioctl or something in // /proc/powerdowm to actually have us pull the plug. - *IXP4XX_GPIO_GPOER &= ~GPIO_PO_BM; // enable the pwr cntl gpio - *IXP4XX_GPIO_GPOUTR |= GPIO_PO_BM; // do the deed + machine_power_off(); return IRQ_HANDLED; } @@ -543,27 +543,27 @@ static irqreturn_t n2rb_handler (int irq, void *dev_id, struct pt_regs *regs) { static struct testr test[] = { - N2LM_ALL_OFF,0, - N2LM_ON,0, - N2LM_OFF,0, - N2LM_ON,1, - N2LM_ALL_OFF,1, - N2LM_ON,2, - N2LM_OFF,2, - N2LM_ON,3, - N2LM_OFF,3, - N2LM_BLINK,0, - N2LM_OFF,0, - N2LM_BLINK,1, - N2LM_OFF,1, - N2LM_BLINK,2, - N2LM_OFF,2, - N2LM_BLINK,3, - N2LM_OFF,3, - N2LM_ALL_OFF,0, - N2LM_ALT,1, - N2LM_OFF,1, - N2LM_ALL_ON,0 + { N2LM_ALL_OFF,0 }, + { N2LM_ON,0 }, + { N2LM_OFF,0 }, + { N2LM_ON,1 }, + { N2LM_ALL_OFF,1 }, + { N2LM_ON,2 }, + { N2LM_OFF,2 }, + { N2LM_ON,3 }, + { N2LM_OFF,3 }, + { N2LM_BLINK,0 }, + { N2LM_OFF,0 }, + { N2LM_BLINK,1 }, + { N2LM_OFF,1 }, + { N2LM_BLINK,2 }, + { N2LM_OFF,2 }, + { N2LM_BLINK,3 }, + { N2LM_OFF,3 }, + { N2LM_ALL_OFF,0 }, + { N2LM_ALT,1 }, + { N2LM_OFF,1 }, + { N2LM_ALL_ON,0 } }; nslu2_io_debug(("Reset Entry IRQ =%d Presses = %d Jiffies = %08lx\tIO = %x\tIOW = %x\n", irq, rb_presses, jiffies, (int)_IO('M',rb_presses), (int)_IOW('M',rb_presses,long))); diff --git a/packages/linux/openslug-kernel-2.6.11.2/nslu2-setup.c b/packages/linux/openslug-kernel-2.6.11.2/nslu2-setup.c index e69de29bb2..358c58f22e 100644 --- a/packages/linux/openslug-kernel-2.6.11.2/nslu2-setup.c +++ b/packages/linux/openslug-kernel-2.6.11.2/nslu2-setup.c @@ -0,0 +1,144 @@ +/* + * arch/arm/mach-ixp4xx/nslu2-setup.c + * + * NSLU2 board-setup + * + * based ixdp425-setup.c: + * Copyright (C) 2003-2004 MontaVista Software, Inc. + * + * Author: Mark Rakes <mrakes at mac.com> + * 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/kernel.h> +#include <linux/init.h> +#include <linux/device.h> +#include <linux/serial.h> +#include <linux/tty.h> +#include <linux/serial_core.h> + +#include <asm/types.h> +#include <asm/setup.h> +#include <asm/memory.h> +#include <asm/hardware.h> +#include <asm/mach-types.h> +#include <asm/irq.h> +#include <asm/mach/arch.h> +#include <asm/mach/flash.h> + +#ifdef __ARMEB__ +#define REG_OFFSET 3 +#else +#define REG_OFFSET 0 +#endif + +/* + * NSLU2 uses only one serial port + */ +static struct uart_port nslu2_serial_ports[] = { + { + .membase = (char*)(IXP4XX_UART1_BASE_VIRT + REG_OFFSET), + .mapbase = (IXP4XX_UART1_BASE_PHYS), + .irq = IRQ_IXP4XX_UART1, + .flags = UPF_SKIP_TEST, + .iotype = UPIO_MEM, + .regshift = 2, + .uartclk = IXP4XX_UART_XTAL, + .line = 0, + .type = PORT_XSCALE, + .fifosize = 32 + } +#if 0 + , { + .membase = (char*)(IXP4XX_UART2_BASE_VIRT + REG_OFFSET), + .mapbase = (IXP4XX_UART2_BASE_PHYS), + .irq = IRQ_IXP4XX_UART2, + .flags = UPF_SKIP_TEST, + .iotype = UPIO_MEM, + .regshift = 2, + .uartclk = IXP4XX_UART_XTAL, + .line = 1, + .type = PORT_XSCALE, + .fifosize = 32 + } +#endif +}; + +void __init nslu2_map_io(void) +{ + early_serial_setup(&nslu2_serial_ports[0]); +#if 0 + early_serial_setup(&nslu2_serial_ports[1]); +#endif + ixp4xx_map_io(); +} + +static struct flash_platform_data nslu2_flash_data = { + .map_name = "cfi_probe", + .width = 2, +}; + +static struct resource nslu2_flash_resource = { + .start = NSLU2_FLASH_BASE, + .end = NSLU2_FLASH_BASE + NSLU2_FLASH_SIZE, + .flags = IORESOURCE_MEM, +}; + +static struct platform_device nslu2_flash = { + .name = "IXP4XX-Flash", + .id = 0, + .dev = { + .platform_data = &nslu2_flash_data, + }, + .num_resources = 1, + .resource = &nslu2_flash_resource, +}; + +static struct ixp4xx_i2c_pins nslu2_i2c_gpio_pins = { + .sda_pin = NSLU2_SDA_PIN, + .scl_pin = NSLU2_SCL_PIN, +}; + +static struct platform_device nslu2_i2c_controller = { + .name = "IXP4XX-I2C", + .id = 0, + .dev = { + .platform_data = &nslu2_i2c_gpio_pins, + }, + .num_resources = 0 +}; + +static struct platform_device *nslu2_devices[] __initdata = { + &nslu2_i2c_controller, + &nslu2_flash +}; + +static void n2_power_off(void) +{ + /* This causes the box to drop the power and go dead. */ +#define GPIO_PO_BM 0x0100 //b0000 0001 0000 0000 + *IXP4XX_GPIO_GPOER &= ~GPIO_PO_BM; // enable the pwr cntl gpio + *IXP4XX_GPIO_GPOUTR |= GPIO_PO_BM; // do the deed +} + +static void __init nslu2_init(void) +{ + /* Need power off to work. */ + pm_power_off = n2_power_off; + platform_add_devices(nslu2_devices, ARRAY_SIZE(nslu2_devices)); +} + +MACHINE_START(NSLU2, "Linksys NSLU2") + MAINTAINER("www.nslu2-linux.org") + BOOT_MEM(PHYS_OFFSET, IXP4XX_PERIPHERAL_BASE_PHYS, + IXP4XX_PERIPHERAL_BASE_VIRT) + MAPIO(nslu2_map_io) + INITIRQ(ixp4xx_init_irq) //FIXME: all irq are off here + .timer = &ixp4xx_timer, + // INITTIME(ixp4xx_init_time) //this was missing in 2.6.7 code ...soft reboot needed? + BOOT_PARAMS(0x0100) + INIT_MACHINE(nslu2_init) +MACHINE_END diff --git a/packages/linux/openslug-kernel-2.6.11.2/xscale-reset.patch b/packages/linux/openslug-kernel-2.6.11.2/xscale-reset.patch new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/packages/linux/openslug-kernel-2.6.11.2/xscale-reset.patch diff --git a/packages/linux/openslug-kernel_2.6.11.2.bb b/packages/linux/openslug-kernel_2.6.11.2.bb index b604e27ad8..476bea31b8 100644 --- a/packages/linux/openslug-kernel_2.6.11.2.bb +++ b/packages/linux/openslug-kernel_2.6.11.2.bb @@ -2,7 +2,7 @@ SECTION = "kernel" DESCRIPTION = "Linux kernel for the Linksys NSLU2 device" LICENSE = "GPL" MAINTAINER = "Chris Larson <kergoth@handhelds.org>" -PR = "r11" +PR = "r12" KERNEL_SUFFIX = "openslug" @@ -11,6 +11,7 @@ SRC_URI = "ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.11.2.tar.bz2 \ file://usbnet.patch;patch=1 \ file://ixp4xx_copy_from.patch;patch=1 \ file://anonymiser.patch;patch=1 \ + file://xscale-reset.patch;patch=1 \ file://defconfig \ file://x1205-rtc.c \ file://nslu2-io.c \ @@ -27,7 +28,7 @@ inherit kernel ARCH = "arm" KERNEL_IMAGETYPE = "zImage" CMDLINE_CONSOLE ?= "ttyS0,115200n8" -CMDLINE_ROOT ?= "root=/dev/mtdblock4 rw rootfstype=jffs2 mem=32M@0x00000000 init=/linuxrc" +CMDLINE_ROOT ?= "root=/dev/mtdblock4 rw rootfstype=jffs2 mem=32M@0x00000000 init=/linuxrc reboot=s" #CMDLINE_ROOT ?= "root=/dev/ram0 rw rootfstype=ext2,jffs2 initrd=0x01000000,10M init=/linuxrc mem=32M@0x00000000" CMDLINE = "${CMDLINE_ROOT} ${CMDLINE_CONSOLE}" |