-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Patch from Alessandro Zummo This patch adds support for the LinkSys NSLU2 running with both big and little-endian kernels. The LinkSys NSLU2 is a cost engineered ARM, XScale 420 based system similar to the the Intel IXDP425 evaluation board. It uses the IXP4XX ARCH. While this patch applies independently of other patches the resultant kernel requires further patches to successfully use onboard devices, including the onboard flash. Since these patches are independent of this one they will be submitted separately. A defconfig is not included here because not all of the required drivers are actually in the kernel. We intend to provide one as soon as the patches will be incorporated in mainstream. This patch is the combined work of nslu2-linux.org Signed-off-by: John Bowler <jbowler@acm.org> Signed-off-by: Alessandro Zummo <a.zummo@towertech.it> Signed-off-by: Deepak Saxena <dsaxena@plexity.net> Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
- Loading branch information
Alessandro Zummo
authored and
Russell King
committed
Nov 10, 2005
1 parent
af36bef
commit a7918f3
Showing
8 changed files
with
418 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/* | ||
* arch/arm/mach-ixp4xx/nslu2-pci.c | ||
* | ||
* NSLU2 board-level PCI initialization | ||
* | ||
* based on ixdp425-pci.c: | ||
* Copyright (C) 2002 Intel Corporation. | ||
* Copyright (C) 2003-2004 MontaVista Software, Inc. | ||
* | ||
* Maintainer: 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/config.h> | ||
#include <linux/pci.h> | ||
#include <linux/init.h> | ||
|
||
#include <asm/mach/pci.h> | ||
#include <asm/mach-types.h> | ||
|
||
void __init nslu2_pci_preinit(void) | ||
{ | ||
set_irq_type(IRQ_NSLU2_PCI_INTA, IRQT_LOW); | ||
set_irq_type(IRQ_NSLU2_PCI_INTB, IRQT_LOW); | ||
set_irq_type(IRQ_NSLU2_PCI_INTC, IRQT_LOW); | ||
|
||
gpio_line_isr_clear(NSLU2_PCI_INTA_PIN); | ||
gpio_line_isr_clear(NSLU2_PCI_INTB_PIN); | ||
gpio_line_isr_clear(NSLU2_PCI_INTC_PIN); | ||
|
||
/* INTD is not configured as GPIO is used | ||
* for the power input button. | ||
*/ | ||
|
||
ixp4xx_pci_preinit(); | ||
} | ||
|
||
static int __init nslu2_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | ||
{ | ||
static int pci_irq_table[NSLU2_PCI_IRQ_LINES] = { | ||
IRQ_NSLU2_PCI_INTA, | ||
IRQ_NSLU2_PCI_INTB, | ||
IRQ_NSLU2_PCI_INTC, | ||
}; | ||
|
||
int irq = -1; | ||
|
||
if (slot >= 1 && slot <= NSLU2_PCI_MAX_DEV && | ||
pin >= 1 && pin <= NSLU2_PCI_IRQ_LINES) { | ||
irq = pci_irq_table[(slot + pin - 2) % NSLU2_PCI_IRQ_LINES]; | ||
} | ||
|
||
return irq; | ||
} | ||
|
||
struct hw_pci __initdata nslu2_pci = { | ||
.nr_controllers = 1, | ||
.preinit = nslu2_pci_preinit, | ||
.swizzle = pci_std_swizzle, | ||
.setup = ixp4xx_setup, | ||
.scan = ixp4xx_scan_bus, | ||
.map_irq = nslu2_map_irq, | ||
}; | ||
|
||
int __init nslu2_pci_init(void) /* monkey see, monkey do */ | ||
{ | ||
if (machine_is_nslu2()) | ||
pci_common_init(&nslu2_pci); | ||
|
||
return 0; | ||
} | ||
|
||
subsys_initcall(nslu2_pci_init); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
/* | ||
* 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/interrupt.h> | ||
|
||
#include <asm/mach-types.h> | ||
|
||
extern void ctrl_alt_del(void); | ||
|
||
static irqreturn_t nslu2_power_handler(int irq, void *dev_id, struct pt_regs *regs) | ||
{ | ||
/* 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, struct pt_regs *regs) | ||
{ | ||
/* 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); | ||
|
||
gpio_line_isr_clear(NSLU2_RB_GPIO); | ||
gpio_line_isr_clear(NSLU2_PB_GPIO); | ||
|
||
if (request_irq(NSLU2_RB_IRQ, &nslu2_reset_handler, | ||
SA_INTERRUPT, "NSLU2 reset button", NULL) < 0) { | ||
|
||
printk(KERN_DEBUG "Reset Button IRQ %d not available\n", | ||
NSLU2_RB_IRQ); | ||
|
||
return -EIO; | ||
} | ||
|
||
if (request_irq(NSLU2_PB_IRQ, &nslu2_power_handler, | ||
SA_INTERRUPT, "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) | ||
{ | ||
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"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
/* | ||
* 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/serial.h> | ||
#include <linux/serial_8250.h> | ||
|
||
#include <asm/mach-types.h> | ||
#include <asm/mach/arch.h> | ||
#include <asm/mach/flash.h> | ||
|
||
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 resource nslu2_uart_resources[] = { | ||
{ | ||
.start = IXP4XX_UART1_BASE_PHYS, | ||
.end = IXP4XX_UART1_BASE_PHYS + 0x0fff, | ||
.flags = IORESOURCE_MEM, | ||
}, | ||
{ | ||
.start = IXP4XX_UART2_BASE_PHYS, | ||
.end = IXP4XX_UART2_BASE_PHYS + 0x0fff, | ||
.flags = IORESOURCE_MEM, | ||
} | ||
}; | ||
|
||
static struct plat_serial8250_port nslu2_uart_data[] = { | ||
{ | ||
.mapbase = IXP4XX_UART1_BASE_PHYS, | ||
.membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET, | ||
.irq = IRQ_IXP4XX_UART1, | ||
.flags = UPF_BOOT_AUTOCONF, | ||
.iotype = UPIO_MEM, | ||
.regshift = 2, | ||
.uartclk = IXP4XX_UART_XTAL, | ||
}, | ||
{ | ||
.mapbase = IXP4XX_UART2_BASE_PHYS, | ||
.membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET, | ||
.irq = IRQ_IXP4XX_UART2, | ||
.flags = UPF_BOOT_AUTOCONF, | ||
.iotype = UPIO_MEM, | ||
.regshift = 2, | ||
.uartclk = IXP4XX_UART_XTAL, | ||
}, | ||
{ } | ||
}; | ||
|
||
static struct platform_device nslu2_uart = { | ||
.name = "serial8250", | ||
.id = PLAT8250_DEV_PLATFORM, | ||
.dev.platform_data = nslu2_uart_data, | ||
.num_resources = 2, | ||
.resource = nslu2_uart_resources, | ||
}; | ||
|
||
static struct platform_device *nslu2_devices[] __initdata = { | ||
&nslu2_i2c_controller, | ||
&nslu2_flash, | ||
&nslu2_uart, | ||
}; | ||
|
||
static void nslu2_power_off(void) | ||
{ | ||
/* This causes the box to drop the power and go dead. */ | ||
|
||
/* enable the pwr cntl gpio */ | ||
gpio_line_config(NSLU2_PO_GPIO, IXP4XX_GPIO_OUT); | ||
|
||
/* do the deed */ | ||
gpio_line_set(NSLU2_PO_GPIO, IXP4XX_GPIO_HIGH); | ||
} | ||
|
||
static void __init nslu2_init(void) | ||
{ | ||
ixp4xx_sys_init(); | ||
|
||
pm_power_off = nslu2_power_off; | ||
|
||
platform_add_devices(nslu2_devices, ARRAY_SIZE(nslu2_devices)); | ||
} | ||
|
||
MACHINE_START(NSLU2, "Linksys NSLU2") | ||
/* Maintainer: www.nslu2-linux.org */ | ||
.phys_ram = PHYS_OFFSET, | ||
.phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, | ||
.io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xFFFC, | ||
.boot_params = 0x00000100, | ||
.map_io = ixp4xx_map_io, | ||
.init_irq = ixp4xx_init_irq, | ||
.timer = &ixp4xx_timer, | ||
.init_machine = nslu2_init, | ||
MACHINE_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.