From 840957918e8bc5ba84904b876daefde836a53c69 Mon Sep 17 00:00:00 2001 From: Rod Whitby Date: Thu, 10 Nov 2005 09:43:10 +0000 Subject: nas100d-kernel: Added machine-specific files and patches. --- .../nas100d-kernel/2.6.14/50-nas100d-arch.patch | 55 +++++++++ packages/linux/nas100d-kernel/2.6.14/defconfig | 5 +- packages/linux/nas100d-kernel/2.6.14/nas100d-pci.c | 77 ++++++++++++ .../linux/nas100d-kernel/2.6.14/nas100d-power.c | 92 ++++++++++++++ .../linux/nas100d-kernel/2.6.14/nas100d-setup.c | 134 +++++++++++++++++++++ packages/linux/nas100d-kernel/2.6.14/nas100d.h | 94 +++++++++++++++ packages/linux/nas100d-kernel_2.6.14.bb | 10 +- 7 files changed, 460 insertions(+), 7 deletions(-) create mode 100644 packages/linux/nas100d-kernel/2.6.14/50-nas100d-arch.patch create mode 100644 packages/linux/nas100d-kernel/2.6.14/nas100d-pci.c create mode 100644 packages/linux/nas100d-kernel/2.6.14/nas100d-power.c create mode 100644 packages/linux/nas100d-kernel/2.6.14/nas100d-setup.c create mode 100644 packages/linux/nas100d-kernel/2.6.14/nas100d.h diff --git a/packages/linux/nas100d-kernel/2.6.14/50-nas100d-arch.patch b/packages/linux/nas100d-kernel/2.6.14/50-nas100d-arch.patch new file mode 100644 index 0000000000..d6a69e3583 --- /dev/null +++ b/packages/linux/nas100d-kernel/2.6.14/50-nas100d-arch.patch @@ -0,0 +1,55 @@ +--- linux-2.6.14-git.orig/arch/arm/mach-ixp4xx/Kconfig 2005-11-09 23:23:28.000000000 +0100 ++++ linux-2.6.14-git/arch/arm/mach-ixp4xx/Kconfig 2005-11-09 23:24:48.000000000 +0100 +@@ -61,6 +61,14 @@ + PrPCM1100 Processor Mezanine Module. For more information on + this platform, see . + ++config MACH_NAS100D ++ bool ++ prompt "NAS100D" ++ help ++ Say 'Y' here if you want your kernel to support Iomega's ++ NAS 100d device. For more information on this platform, ++ see http://www.nslu2-linux.org/wiki/NAS100d/HomePage ++ + # + # Avila and IXDP share the same source for now. Will change in future + # +--- linux-2.6.14-git.orig/arch/arm/mach-ixp4xx/Makefile 2005-11-09 23:23:28.000000000 +0100 ++++ linux-2.6.14-git/arch/arm/mach-ixp4xx/Makefile 2005-11-09 23:24:48.000000000 +0100 +@@ -8,4 +8,5 @@ + obj-$(CONFIG_MACH_IXDPG425) += ixdpg425-pci.o coyote-setup.o + obj-$(CONFIG_ARCH_ADI_COYOTE) += coyote-pci.o coyote-setup.o + obj-$(CONFIG_MACH_GTWX5715) += gtwx5715-pci.o gtwx5715-setup.o ++obj-$(CONFIG_MACH_NAS100D) += nas100d-pci.o nas100d-setup.o nas100d-power.o + +--- linux-2.6.14-git.orig/include/asm-arm/arch-ixp4xx/hardware.h 2005-11-09 23:23:28.000000000 +0100 ++++ linux-2.6.14-git/include/asm-arm/arch-ixp4xx/hardware.h 2005-11-09 23:24:48.000000000 +0100 +@@ -44,5 +44,6 @@ + #include "ixdp425.h" + #include "coyote.h" + #include "prpmc1100.h" ++#include "nas100d.h" + + #endif /* _ASM_ARCH_HARDWARE_H */ +--- linux-2.6.14-git.orig/include/asm-arm/arch-ixp4xx/irqs.h 2005-11-09 23:23:28.000000000 +0100 ++++ linux-2.6.14-git/include/asm-arm/arch-ixp4xx/irqs.h 2005-11-09 23:24:48.000000000 +0100 +@@ -93,4 +93,11 @@ + #define IRQ_COYOTE_PCI_SLOT1 IRQ_IXP4XX_GPIO11 + #define IRQ_COYOTE_IDE IRQ_IXP4XX_GPIO5 + ++/* ++ * NAS100D board IRQs ++ */ ++#define IRQ_NAS100D_PCI_INTA IRQ_IXP4XX_GPIO11 ++#define IRQ_NAS100D_PCI_INTB IRQ_IXP4XX_GPIO10 ++#define IRQ_NAS100D_PCI_INTC IRQ_IXP4XX_GPIO9 ++ + #endif +--- linux-2.6.14/arch/arm/tools/mach-types~ 2005-10-28 09:32:08.000000000 +0930 ++++ linux-2.6.14/arch/arm/tools/mach-types 2005-11-10 19:58:03.534106856 +1030 +@@ -869,3 +869,4 @@ + htcuniversal MACH_HTCUNIVERSAL HTCUNIVERSAL 855 + tpad MACH_TPAD TPAD 856 + roverp3 MACH_ROVERP3 ROVERP3 857 ++nas100d MACH_NAS100D NAS100D 865 diff --git a/packages/linux/nas100d-kernel/2.6.14/defconfig b/packages/linux/nas100d-kernel/2.6.14/defconfig index 564bffa17e..c6c9e51e8d 100644 --- a/packages/linux/nas100d-kernel/2.6.14/defconfig +++ b/packages/linux/nas100d-kernel/2.6.14/defconfig @@ -95,10 +95,11 @@ CONFIG_ARCH_SUPPORTS_BIG_ENDIAN=y # # CONFIG_ARCH_AVILA is not set # CONFIG_ARCH_ADI_COYOTE is not set -CONFIG_ARCH_IXDP425=y +# CONFIG_ARCH_IXDP425 is not set # CONFIG_MACH_IXDPG425 is not set # CONFIG_MACH_IXDP465 is not set -# CONFIG_MACH_NAS100D is not set +# CONFIG_MACH_NSLU2 is not set +CONFIG_MACH_NAS100D=y # CONFIG_ARCH_PRPMC1100 is not set # CONFIG_MACH_GTWX5715 is not set diff --git a/packages/linux/nas100d-kernel/2.6.14/nas100d-pci.c b/packages/linux/nas100d-kernel/2.6.14/nas100d-pci.c new file mode 100644 index 0000000000..7a319179c3 --- /dev/null +++ b/packages/linux/nas100d-kernel/2.6.14/nas100d-pci.c @@ -0,0 +1,77 @@ +/* + * arch/arm/mach-ixp4xx/nas100d-pci.c + * + * NAS 100d 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 +#include +#include + +#include +#include + +void __init nas100d_pci_preinit(void) +{ + set_irq_type(IRQ_NAS100D_PCI_INTA, IRQT_LOW); + set_irq_type(IRQ_NAS100D_PCI_INTB, IRQT_LOW); + set_irq_type(IRQ_NAS100D_PCI_INTC, IRQT_LOW); + + gpio_line_isr_clear(NAS100D_PCI_INTA_PIN); + gpio_line_isr_clear(NAS100D_PCI_INTB_PIN); + gpio_line_isr_clear(NAS100D_PCI_INTC_PIN); + + /* INTD is not configured as GPIO is used + * for the power input button. + */ + + ixp4xx_pci_preinit(); +} + +static int __init nas100d_map_irq(struct pci_dev *dev, u8 slot, u8 pin) +{ + static int pci_irq_table[NAS100D_PCI_IRQ_LINES] = { + IRQ_NAS100D_PCI_INTA, + IRQ_NAS100D_PCI_INTB, + IRQ_NAS100D_PCI_INTC, + }; + + int irq = -1; + + if (slot >= 1 && slot <= NAS100D_PCI_MAX_DEV && + pin >= 1 && pin <= NAS100D_PCI_IRQ_LINES) { + irq = pci_irq_table[(slot + pin - 2) % NAS100D_PCI_IRQ_LINES]; + } + + return irq; +} + +struct hw_pci __initdata nas100d_pci = { + .nr_controllers = 1, + .preinit = nas100d_pci_preinit, + .swizzle = pci_std_swizzle, + .setup = ixp4xx_setup, + .scan = ixp4xx_scan_bus, + .map_irq = nas100d_map_irq, +}; + +int __init nas100d_pci_init(void) /* monkey see, monkey do */ +{ + if (machine_is_nas100d()) + pci_common_init(&nas100d_pci); + + return 0; +} + +subsys_initcall(nas100d_pci_init); diff --git a/packages/linux/nas100d-kernel/2.6.14/nas100d-power.c b/packages/linux/nas100d-kernel/2.6.14/nas100d-power.c new file mode 100644 index 0000000000..008e6d5490 --- /dev/null +++ b/packages/linux/nas100d-kernel/2.6.14/nas100d-power.c @@ -0,0 +1,92 @@ +/* + * 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 + * Maintainers: http://www.nslu2-linux.org/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + */ + +#include +#include +#include + +#include + +extern void ctrl_alt_del(void); + +static irqreturn_t nas100d_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 nas100d_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 nas100d_power_init(void) +{ + if (!(machine_is_nas100d())) + return 0; + + *IXP4XX_GPIO_GPISR = 0x20400000; /* read the 2 irqs to clr */ + + set_irq_type(NAS100D_RB_IRQ, IRQT_LOW); + set_irq_type(NAS100D_PB_IRQ, IRQT_HIGH); + + gpio_line_isr_clear(NAS100D_RB_GPIO); + gpio_line_isr_clear(NAS100D_PB_GPIO); + + if (request_irq(NAS100D_RB_IRQ, &nas100d_reset_handler, + SA_INTERRUPT, "NAS100D reset button", NULL) < 0) { + + printk(KERN_DEBUG "Reset Button IRQ %d not available\n", + NAS100D_RB_IRQ); + + return -EIO; + } + + if (request_irq(NAS100D_PB_IRQ, &nas100d_power_handler, + SA_INTERRUPT, "NAS100D power button", NULL) < 0) { + + printk(KERN_DEBUG "Power Button IRQ %d not available\n", + NAS100D_PB_IRQ); + + return -EIO; + } + + return 0; +} + +static void __exit nas100d_power_exit(void) +{ + free_irq(NAS100D_RB_IRQ, NULL); + free_irq(NAS100D_PB_IRQ, NULL); +} + +module_init(nas100d_power_init); +module_exit(nas100d_power_exit); + +MODULE_AUTHOR("Alessandro Zummo "); +MODULE_DESCRIPTION("NAS100D Power/Reset driver"); +MODULE_LICENSE("GPL"); diff --git a/packages/linux/nas100d-kernel/2.6.14/nas100d-setup.c b/packages/linux/nas100d-kernel/2.6.14/nas100d-setup.c new file mode 100644 index 0000000000..572c8ce639 --- /dev/null +++ b/packages/linux/nas100d-kernel/2.6.14/nas100d-setup.c @@ -0,0 +1,134 @@ +/* + * arch/arm/mach-ixp4xx/nas100d-setup.c + * + * NAS 100d board-setup + * + * based ixdp425-setup.c: + * Copyright (C) 2003-2004 MontaVista Software, Inc. + * + * Author: Mark Rakes + * 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 +#include +#include + +#include +#include +#include + +static struct flash_platform_data nas100d_flash_data = { + .map_name = "cfi_probe", + .width = 2, +}; + +static struct resource nas100d_flash_resource = { + .start = NAS100D_FLASH_BASE, + .end = NAS100D_FLASH_BASE + NAS100D_FLASH_SIZE, + .flags = IORESOURCE_MEM, +}; + +static struct platform_device nas100d_flash = { + .name = "IXP4XX-Flash", + .id = 0, + .dev.platform_data = &nas100d_flash_data, + .num_resources = 1, + .resource = &nas100d_flash_resource, +}; + +static struct ixp4xx_i2c_pins nas100d_i2c_gpio_pins = { + .sda_pin = NAS100D_SDA_PIN, + .scl_pin = NAS100D_SCL_PIN, +}; + +static struct platform_device nas100d_i2c_controller = { + .name = "IXP4XX-I2C", + .id = 0, + .dev.platform_data = &nas100d_i2c_gpio_pins, + .num_resources = 0, +}; + +static struct resource nas100d_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 nas100d_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 nas100d_uart = { + .name = "serial8250", + .id = PLAT8250_DEV_PLATFORM, + .dev.platform_data = nas100d_uart_data, + .num_resources = 2, + .resource = nas100d_uart_resources, +}; + +static struct platform_device *nas100d_devices[] __initdata = { + &nas100d_i2c_controller, + &nas100d_flash, + &nas100d_uart, +}; + +static void nas100d_power_off(void) +{ + /* This causes the box to drop the power and go dead. */ + + /* enable the pwr cntl gpio */ + gpio_line_config(NAS100D_PO_GPIO, IXP4XX_GPIO_OUT); + + /* do the deed */ + gpio_line_set(NAS100D_PO_GPIO, IXP4XX_GPIO_HIGH); +} + +static void __init nas100d_init(void) +{ + ixp4xx_sys_init(); + + pm_power_off = nas100d_power_off; + + platform_add_devices(nas100d_devices, ARRAY_SIZE(nas100d_devices)); +} + +MACHINE_START(NAS100D, "Iomega NAS 100d") + /* 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 = nas100d_init, +MACHINE_END diff --git a/packages/linux/nas100d-kernel/2.6.14/nas100d.h b/packages/linux/nas100d-kernel/2.6.14/nas100d.h new file mode 100644 index 0000000000..22f827d4bb --- /dev/null +++ b/packages/linux/nas100d-kernel/2.6.14/nas100d.h @@ -0,0 +1,94 @@ +/* + * include/asm-arm/arch-ixp4xx/nas100d.h + * + * NAS 100d platform specific definitions + * + * Author: Mark Rakes + * Maintainers: http://www.nslu2-linux.org + * + * based on ixdp425.h: + * Copyright 2004 (c) MontaVista, Software, Inc. + * + * This file is licensed under the terms of the GNU General Public + * License version 2. This program is licensed "as is" without any + * warranty of any kind, whether express or implied. + */ + +#ifndef __ASM_ARCH_HARDWARE_H__ +#error "Do not include this directly, instead #include " +#endif + +#define NAS100D_FLASH_BASE IXP4XX_EXP_BUS_CS0_BASE_PHYS +#define NAS100D_FLASH_SIZE IXP4XX_EXP_BUS_CSX_REGION_SIZE + +#define NAS100D_SDA_PIN 7 +#define NAS100D_SCL_PIN 6 + +/* + * NAS100D PCI IRQs + */ +#define NAS100D_PCI_MAX_DEV 3 +#define NAS100D_PCI_IRQ_LINES 3 + + +/* PCI controller GPIO to IRQ pin mappings */ +#define NAS100D_PCI_INTA_PIN 11 +#define NAS100D_PCI_INTB_PIN 10 +#define NAS100D_PCI_INTC_PIN 9 +#define NAS100D_PCI_INTD_PIN 8 + + +/* NAS100D Timer */ +#define NAS100D_FREQ 66000000 +#define NAS100D_CLOCK_TICK_RATE (((NAS100D_FREQ / HZ & ~IXP4XX_OST_RELOAD_MASK) + 1) * HZ) +#define NAS100D_CLOCK_TICKS_PER_USEC ((NAS100D_CLOCK_TICK_RATE + USEC_PER_SEC/2) / USEC_PER_SEC) + +/* GPIO */ + +#define NAS100D_GPIO0 0 +#define NAS100D_GPIO1 1 +#define NAS100D_GPIO2 2 +#define NAS100D_GPIO3 3 +#define NAS100D_GPIO4 4 +#define NAS100D_GPIO5 5 +#define NAS100D_GPIO6 6 +#define NAS100D_GPIO7 7 +#define NAS100D_GPIO8 8 +#define NAS100D_GPIO9 9 +#define NAS100D_GPIO10 10 +#define NAS100D_GPIO11 11 +#define NAS100D_GPIO12 12 +#define NAS100D_GPIO13 13 +#define NAS100D_GPIO14 14 +#define NAS100D_GPIO15 15 + +/* Buttons */ + +#define NAS100D_PB_GPIO NAS100D_GPIO5 +#define NAS100D_PO_GPIO NAS100D_GPIO8 /* power off */ +#define NAS100D_RB_GPIO NAS100D_GPIO12 + +#define NAS100D_PB_IRQ IRQ_IXP4XX_GPIO5 +#define NAS100D_RB_IRQ IRQ_IXP4XX_GPIO12 + +#define NAS100D_PB_BM (1L << NAS100D_PB_GPIO) +#define NAS100D_PO_BM (1L << NAS100D_PO_GPIO) +#define NAS100D_RB_BM (1L << NAS100D_RB_GPIO) + +/* Buzzer */ + +#define NAS100D_GPIO_BUZZ 4 +#define NAS100D_BZ_BM (1L << NAS100D_GPIO_BUZZ) +/* LEDs */ + +#define NAS100D_LED_RED NAS100D_GPIO0 +#define NAS100D_LED_GRN NAS100D_GPIO1 + +#define NAS100D_LED_RED_BM (1L << NAS100D_LED_RED) +#define NAS100D_LED_GRN_BM (1L << NAS100D_LED_GRN) + +#define NAS100D_LED_DISK1 NAS100D_GPIO2 +#define NAS100D_LED_DISK2 NAS100D_GPIO3 + +#define NAS100D_LED_DISK1_BM (1L << NAS100D_GPIO2) +#define NAS100D_LED_DISK2_BM (1L << NAS100D_GPIO3) diff --git a/packages/linux/nas100d-kernel_2.6.14.bb b/packages/linux/nas100d-kernel_2.6.14.bb index 6526cfbc27..98f2bc15ed 100644 --- a/packages/linux/nas100d-kernel_2.6.14.bb +++ b/packages/linux/nas100d-kernel_2.6.14.bb @@ -11,12 +11,11 @@ PR_CONFIG = "0" PR = "r0.${PR_CONFIG}" N1K_FILES = "\ + arch/arm/mach-ixp4xx/nas100d-pci.c \ + arch/arm/mach-ixp4xx/nas100d-power.c \ + arch/arm/mach-ixp4xx/nas100d-setup.c \ + include/asm-arm/arch-ixp4xx/nas100d.h \ " -# arch/arm/mach-ixp4xx/nas100d-io.c \ -# arch/arm/mach-ixp4xx/nas100d-setup.c \ -# arch/arm/mach-ixp4xx/nas100d-pci.c \ -# arch/arm/mach-ixp4xx/nas100d-part.c \ -# include/asm-arm/arch-ixp4xx/nas100d.h N1K_PATCHES = "\ file://10-ixp4xx-copy-from.patch;patch=1 \ @@ -26,6 +25,7 @@ N1K_PATCHES = "\ file://18-ixp4xx-io-h-addr.patch;patch=1 \ file://28-spinlock-up.patch;patch=1 \ file://29-ipv4-route-c-spinlock.patch;patch=1 \ + file://50-nas100d-arch.patch;patch=1 \ file://90-ixp4xx-pci-le.patch;patch=1 \ " -- cgit v1.2.3