diff -urN a/arch/arm/mach-iop3xx/Kconfig b/arch/arm/mach-iop3xx/Kconfig --- a/arch/arm/mach-iop3xx/Kconfig 2006-08-11 16:23:02.024248000 +0000 +++ b/arch/arm/mach-iop3xx/Kconfig 2006-08-11 16:30:53.873736750 +0000 @@ -17,6 +17,13 @@ Say Y here if you want to run your kernel on the Thecus n2100 NAS appliance. +config MACH_GLANTANK + bool "Enable support for the GLAN Tank" + help + Say Y here if you want to run your kernel on the GLAN Tank + NAS appliance or machines from IO-Data's HDL-Gxxx, HDL-GWxxx + and HDL-GZxxx series. + config ARCH_IQ31244 bool "Enable support for IQ31244" select ARCH_IOP321 diff -urN a/arch/arm/mach-iop3xx/Makefile b/arch/arm/mach-iop3xx/Makefile --- a/arch/arm/mach-iop3xx/Makefile 2006-08-11 16:23:02.024248000 +0000 +++ b/arch/arm/mach-iop3xx/Makefile 2006-08-11 16:31:02.574280500 +0000 @@ -24,3 +24,5 @@ obj-$(CONFIG_MACH_N2100) += n2100.o +obj-$(CONFIG_MACH_GLANTANK) += glantank.o + diff -urN a/arch/arm/mach-iop3xx/glantank.c b/arch/arm/mach-iop3xx/glantank.c --- a/arch/arm/mach-iop3xx/glantank.c 1970-01-01 00:00:00.000000000 +0000 +++ b/arch/arm/mach-iop3xx/glantank.c 2006-08-11 17:06:45.236188500 +0000 @@ -0,0 +1,203 @@ +/* + * arch/arm/mach-iop32x/glantank.c + * + * Board support code for the GLAN Tank. + * + * Copyright (C) 2006 Martin Michlmayr + * Copyright (C) 2006 Lennert Buytenhek + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define INTA IRQ_IQ80321_INTA +#define INTB IRQ_IQ80321_INTB +#define INTC IRQ_IQ80321_INTC +#define INTD IRQ_IQ80321_INTD + +/* + * GLAN Tank timer tick configuration. + */ +static void __init glantank_timer_init(void) +{ + /* 33.333 MHz crystal. */ + iop3xx_init_time(200000000); +} + +static struct sys_timer glantank_timer = { + .init = glantank_timer_init, + .offset = iop3xx_gettimeoffset, +}; + +/* + * GLAN Tank I/O. + */ +static struct map_desc glantank_io_desc[] __initdata = { + { /* on-board devices */ + .virtual = GLANTANK_UART, + .pfn = __phys_to_pfn(GLANTANK_UART), + .length = 0x00100000, + .type = MT_DEVICE + }, +}; + +void __init glantank_map_io(void) +{ + iop321_map_io(); + iotable_init(glantank_io_desc, ARRAY_SIZE(glantank_io_desc)); +} + + +/* + * GLAN Tank PCI. + */ +static inline int __init +glantank_map_irq(struct pci_dev *dev, u8 idsel, u8 pin) +{ + static int pci_irq_table[][4] = { + /* + * PCI IDSEL/INTPIN->INTLINE + * A B C D + */ + {INTD, INTD, INTD, INTD}, /* UART (8250) */ + {INTA, INTA, INTA, INTA}, /* Ethernet (E1000) */ + {INTB, INTB, INTB, INTB}, /* IDE (AEC6280R) */ + {INTC, INTC, INTC, INTC}, /* USB (NEC) */ + }; + + BUG_ON(pin < 1 || pin > 4); + + return pci_irq_table[idsel%4][pin-1]; +} + +static int glantank_setup(int nr, struct pci_sys_data *sys) +{ + struct resource *res; + + if(nr != 0) + return 0; + + res = kzalloc(sizeof(struct resource) * 2, GFP_KERNEL); + if (!res) + panic("PCI: unable to alloc resources"); + + res[0].start = IOP321_PCI_LOWER_IO_VA; + res[0].end = IOP321_PCI_UPPER_IO_VA; + res[0].name = "GLAN Tank PCI I/O Space"; + res[0].flags = IORESOURCE_IO; + request_resource(&ioport_resource, &res[0]); + + res[1].start = IOP321_PCI_LOWER_MEM_PA; + res[1].end = IOP321_PCI_UPPER_MEM_PA; + res[1].name = "GLAN Tank PCI Memory Space"; + res[1].flags = IORESOURCE_MEM; + request_resource(&iomem_resource, &res[1]); + + sys->mem_offset = IOP321_PCI_MEM_OFFSET; + sys->io_offset = IOP321_PCI_IO_OFFSET; + + sys->resource[0] = &res[0]; + sys->resource[1] = &res[1]; + sys->resource[2] = NULL; + + return 1; +} + +static void glantank_preinit(void) +{ + iop321_init(); +} + +static struct hw_pci glantank_pci __initdata = { + .swizzle = pci_std_swizzle, + .nr_controllers = 1, + .setup = glantank_setup, + .scan = iop321_scan_bus, + .preinit = glantank_preinit, + .map_irq = glantank_map_irq +}; + +static int __init glantank_pci_init(void) +{ + if (machine_is_glantank()) + pci_common_init(&glantank_pci); + + return 0; +} + +subsys_initcall(glantank_pci_init); + + +/* + * GLAN Tank machine initialization. + */ +static struct plat_serial8250_port glantank_serial_port[] = { + { + .mapbase = GLANTANK_UART, + .membase = (char *)GLANTANK_UART, + .irq = IRQ_GLANTANK_UART, + .flags = UPF_SKIP_TEST, + .iotype = UPIO_MEM, + .regshift = 0, + .uartclk = 1843200, + }, + { }, +}; + +static struct resource glantank_uart_resource = { + .start = GLANTANK_UART, + .end = GLANTANK_UART + 7, + .flags = IORESOURCE_MEM, +}; + +static struct platform_device glantank_serial_device = { + .name = "serial8250", + .id = PLAT8250_DEV_PLATFORM, + .dev = { + .platform_data = glantank_serial_port, + }, + .num_resources = 1, + .resource = &glantank_uart_resource, +}; + +static void __init glantank_init_machine(void) +{ + iop32x_init(); + platform_device_register(&glantank_serial_device); +} + +MACHINE_START(GLANTANK, "GLAN Tank") + /* Maintainer: Martin Michlmayr */ + .phys_io = GLANTANK_UART, + .io_pg_offst = ((GLANTANK_UART) >> 18) & 0xfffc, + .boot_params = 0xa0000100, + .map_io = glantank_map_io, + .init_irq = iop321_init_irq, + .timer = &glantank_timer, + .init_machine = glantank_init_machine, +MACHINE_END + diff -urN a/arch/arm/mach-iop3xx/iop321-irq.c b/arch/arm/mach-iop3xx/iop321-irq.c --- a/arch/arm/mach-iop3xx/iop321-irq.c 2006-08-11 16:23:02.024248000 +0000 +++ b/arch/arm/mach-iop3xx/iop321-irq.c 2006-08-11 16:30:21.151691750 +0000 @@ -83,6 +83,7 @@ intstr_write(0); // treat all as IRQ if(machine_is_iq80321() || machine_is_iq31244() || + machine_is_glantank() || machine_is_n2100()) // all interrupts are inputs to chip *IOP321_PCIIRSR = 0x0f; diff -urN a/arch/arm/mach-iop3xx/iop321-setup.c b/arch/arm/mach-iop3xx/iop321-setup.c --- a/arch/arm/mach-iop3xx/iop321-setup.c 2006-08-11 16:23:02.024248000 +0000 +++ b/arch/arm/mach-iop3xx/iop321-setup.c 2006-08-11 17:08:00.472890500 +0000 @@ -132,7 +132,8 @@ void __init iop321_map_io(void) { iotable_init(iop321_std_desc, ARRAY_SIZE(iop321_std_desc)); - early_serial_setup(&iop321_serial_ports[0]); + if (!machine_is_glantank()) + early_serial_setup(&iop321_serial_ports[0]); } #ifdef CONFIG_ARCH_IQ80321 --- a/arch/arm/tools/mach-types 2006-09-05 15:54:52.475751076 +0000 +++ b/arch/arm/tools/mach-types 2006-09-05 15:55:09.098279119 +0000 @@ -1093,4 +1093,5 @@ eti_b1 MACH_ETI_B1 ETI_B1 1080 za9l_series MACH_ZILOG_ZA9L ZILOG_ZA9L 1081 bit2440 MACH_BIT2440 BIT2440 1082 +glantank MACH_GLANTANK GLANTANK 1100 n2100 MACH_N2100 N2100 1101 diff -urN a/include/asm-arm/arch-iop3xx/glantank.h b/include/asm-arm/arch-iop3xx/glantank.h --- a/include/asm-arm/arch-iop3xx/glantank.h 1970-01-01 00:00:00.000000000 +0000 +++ b/include/asm-arm/arch-iop3xx/glantank.h 2006-08-11 16:28:08.259386500 +0000 @@ -0,0 +1,19 @@ +/* + * include/asm/arch-iop32x/glantank.h + * + * GLAN Tank board registers + * + */ + +#ifndef _GLANTANK_H_ +#define _GLANTANK_H_ + +#define GLANTANK_FLASHBASE 0xf0000000 +#define GLANTANK_FLASHSIZE 0x00080000 +#define GLANTANK_FLASHWIDTH 2 + +#define GLANTANK_UART 0xfe800000 /* UART #1 */ +#define IRQ_GLANTANK_UART IRQ_IOP321_XINT3 + +#endif + diff -urN a/include/asm-arm/arch-iop3xx/hardware.h b/include/asm-arm/arch-iop3xx/hardware.h --- a/include/asm-arm/arch-iop3xx/hardware.h 2006-08-11 16:23:07.888614500 +0000 +++ b/include/asm-arm/arch-iop3xx/hardware.h 2006-08-11 16:28:53.390207000 +0000 @@ -54,5 +54,6 @@ #include "iq80331.h" #include "iq80332.h" #include "n2100.h" +#include "glantank.h" #endif /* _ASM_ARCH_HARDWARE_H */