Index: linux-2.6/arch/arm/mach-iop32x/Kconfig =================================================================== --- linux-2.6.orig/arch/arm/mach-iop32x/Kconfig 2009-07-23 11:07:43.000000000 +0200 +++ linux-2.6/arch/arm/mach-iop32x/Kconfig 2009-07-23 11:10:16.000000000 +0200 @@ -41,6 +41,13 @@ config MACH_EM7210 board. Say also Y here if you have a SS4000e Baxter Creek NAS appliance." +config MACH_SANMINA + bool "Enable support for the ApplianceWare Sanmina" + help + Say Y here if you want to run your kernel on the AppianceWare Sanmina + board. This board can be found in Newisys NA-1400 and Nec NS-50 + appliances." + endmenu endif Index: linux-2.6/arch/arm/mach-iop32x/Makefile =================================================================== --- linux-2.6.orig/arch/arm/mach-iop32x/Makefile 2009-07-23 11:07:43.000000000 +0200 +++ linux-2.6/arch/arm/mach-iop32x/Makefile 2009-07-23 11:10:16.000000000 +0200 @@ -12,3 +12,4 @@ obj-$(CONFIG_ARCH_IQ80321) += iq80321.o obj-$(CONFIG_ARCH_IQ31244) += iq31244.o obj-$(CONFIG_MACH_N2100) += n2100.o obj-$(CONFIG_MACH_EM7210) += em7210.o +obj-$(CONFIG_MACH_SANMINA) += sanmina.o Index: linux-2.6/arch/arm/mach-iop32x/include/mach/uncompress.h =================================================================== --- linux-2.6.orig/arch/arm/mach-iop32x/include/mach/uncompress.h 2009-07-23 11:07:43.000000000 +0200 +++ linux-2.6/arch/arm/mach-iop32x/include/mach/uncompress.h 2009-07-24 10:20:09.000000000 +0200 @@ -26,7 +26,8 @@ static __inline__ void __arch_decomp_set { if (machine_is_iq80321()) uart_base = (volatile u8 *)IQ80321_UART; - else if (machine_is_iq31244() || machine_is_em7210()) + else if (machine_is_iq31244() \ + || machine_is_em7210() || machine_is_sanmina()) uart_base = (volatile u8 *)IQ31244_UART; else uart_base = (volatile u8 *)0xfe800000; Index: linux-2.6/arch/arm/mach-iop32x/irq.c =================================================================== --- linux-2.6.orig/arch/arm/mach-iop32x/irq.c 2009-07-23 11:07:43.000000000 +0200 +++ linux-2.6/arch/arm/mach-iop32x/irq.c 2009-07-23 11:10:16.000000000 +0200 @@ -64,6 +64,7 @@ void __init iop32x_init_irq(void) machine_is_iq80321() || machine_is_iq31244() || machine_is_n2100() || + machine_is_sanmina() || machine_is_em7210()) *IOP3XX_PCIIRSR = 0x0f; Index: linux-2.6/arch/arm/mach-iop32x/sanmina.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ linux-2.6/arch/arm/mach-iop32x/sanmina.c 2009-07-27 13:31:58.000000000 +0200 @@ -0,0 +1,232 @@ +/* + * arch/arm/mach-iop32x/sanmina.c + * + * Board support code for the ApplianceWare Sanmina platforms. + * + * Based on arch/arm/mach-iop32x/em7210.c file. + * + * Copyright (C) 2009 Arnaud Patard + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void __init sanmina_timer_init(void) +{ + /* 33.333 MHz crystal. */ + /* RedBoot tells me trr0 equal to 0x1E8480 on cold boot */ + iop_init_time(200000000); +} + +static struct sys_timer sanmina_timer = { + .init = sanmina_timer_init, + .offset = iop_gettimeoffset, +}; + +static struct i2c_board_info __initdata sanmina_i2c_devices[] = { + { + I2C_BOARD_INFO("m41st85", 0x68), + }, +}; + +static struct map_desc sanmina_io_desc[] __initdata = { + { /* on-board devices */ + .virtual = IQ31244_UART, + .pfn = __phys_to_pfn(IQ31244_UART), + .length = 0x00100000, + .type = MT_DEVICE, + }, +}; + +void __init sanmina_map_io(void) +{ + iop3xx_map_io(); + iotable_init(sanmina_io_desc, ARRAY_SIZE(sanmina_io_desc)); +} + + +static int __init +sanmina_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) +{ + int irq; + + if (slot == 1) { + /* e1000 */ + irq = IRQ_IOP32X_XINT1; + } else if (slot == 3) { + /* SATA */ + irq = IRQ_IOP32X_XINT0; + } else if (slot == 4) { + /* e1000 */ + irq = IRQ_IOP32X_XINT2; + } else if (slot == 5) { + /* USB */ + irq = IRQ_IOP32X_XINT3; + } else { + printk(KERN_ERR "%s() called for unknown " + "device PCI:%d:%d:%d\n", __func__, dev->bus->number, + PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn)); + irq = -1; + } + + return irq; +} + +static struct hw_pci sanmina_pci __initdata = { + .swizzle = pci_std_swizzle, + .nr_controllers = 1, + .setup = iop3xx_pci_setup, + .preinit = iop3xx_pci_preinit, + .scan = iop3xx_pci_scan_bus, + .map_irq = sanmina_pci_map_irq, +}; +static int __init sanmina_pci_init(void) +{ + if (machine_is_sanmina()) + pci_common_init(&sanmina_pci); + + return 0; +} + +subsys_initcall(sanmina_pci_init); + +static struct physmap_flash_data sanmina_flash_data = { + .width = 2, +}; + +static struct resource sanmina_flash_resource = { + .start = 0xf0000000, + .end = 0xf0ffffff, + .flags = IORESOURCE_MEM, +}; + +static struct platform_device sanmina_flash_device = { + .name = "physmap-flash", + .id = 0, + .dev = { + .platform_data = &sanmina_flash_data, + }, + .num_resources = 1, + .resource = &sanmina_flash_resource, +}; + +static struct plat_serial8250_port sanmina_serial_port[] = { + { + .mapbase = IQ31244_UART, + .membase = (char *)IQ31244_UART, + .irq = IRQ_IOP32X_XINT3, + .flags = UPF_SKIP_TEST | UPF_SHARE_IRQ, + .iotype = UPIO_MEM, + .regshift = 0, + .uartclk = 14745600, + }, + { }, +}; + +static struct resource sanmina_uart_resource = { + .start = IQ31244_UART, + .end = IQ31244_UART + 0x3f, + .flags = IORESOURCE_MEM, +}; + +static struct platform_device sanmina_serial_device = { + .name = "serial8250", + .id = PLAT8250_DEV_PLATFORM, + .dev = { + .platform_data = sanmina_serial_port, + }, + .num_resources = 1, + .resource = &sanmina_uart_resource, +}; + +/* + * verbatim copy of the iq31244.c:ep80219_power_off() code. + * the box is using a different pic from microchip but the + * protocol is at least compatible for the shutdown command. + */ +void sanmina_power_off(void) +{ + /* + * Send the Address byte w/ the start condition + */ + *IOP3XX_IDBR1 = 0x60; + *IOP3XX_ICR1 = 0xE9; + mdelay(1); + + /* + * Send the START_MSG byte w/ no start or stop condition + */ + *IOP3XX_IDBR1 = 0x0F; + *IOP3XX_ICR1 = 0xE8; + mdelay(1); + + /* + * Send the SHUTDOWN_COMPLETE Message ID byte w/ no start or + * stop condition + */ + *IOP3XX_IDBR1 = 0x03; + *IOP3XX_ICR1 = 0xE8; + mdelay(1); + + /* + * Send an ignored byte w/ stop condition + */ + *IOP3XX_IDBR1 = 0x00; + *IOP3XX_ICR1 = 0xEA; + + while (1) + ; +} + +static void __init sanmina_init_machine(void) +{ + platform_device_register(&iop3xx_i2c0_device); + platform_device_register(&iop3xx_i2c1_device); + platform_device_register(&sanmina_flash_device); + platform_device_register(&sanmina_serial_device); + platform_device_register(&iop3xx_dma_0_channel); + platform_device_register(&iop3xx_dma_1_channel); + + i2c_register_board_info(0, sanmina_i2c_devices, + ARRAY_SIZE(sanmina_i2c_devices)); + + pm_power_off = sanmina_power_off; +} +MACHINE_START(SANMINA, "ApplianceWare Sanmina") + .phys_io = IQ31244_UART, + .io_pg_offst = ((IQ31244_UART) >> 18) & 0xfffc, + .boot_params = 0xa0000100, + .map_io = sanmina_map_io, + .init_irq = iop32x_init_irq, + .timer = &sanmina_timer, + .init_machine = sanmina_init_machine, +MACHINE_END +