Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[ARM] 3850/1: iop3xx: add thecus n2100 support

Add support for the Thecus n2100 (80219-based.)

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

authored by

Lennert Buytenhek and committed by
Russell King
e60d07b6 17b602b1

+408 -3
+117 -2
arch/arm/configs/iop32x_defconfig
··· 128 128 # 129 129 CONFIG_ARCH_IQ80321=y 130 130 CONFIG_ARCH_IQ31244=y 131 + CONFIG_MACH_N2100=y 131 132 CONFIG_PLAT_IOP=y 132 133 133 134 # ··· 602 601 # CONFIG_NS83820 is not set 603 602 # CONFIG_HAMACHI is not set 604 603 # CONFIG_YELLOWFIN is not set 605 - # CONFIG_R8169 is not set 604 + CONFIG_R8169=y 605 + # CONFIG_R8169_NAPI is not set 606 606 # CONFIG_SIS190 is not set 607 607 # CONFIG_SKGE is not set 608 608 # CONFIG_SKY2 is not set ··· 899 897 CONFIG_USB_ARCH_HAS_HCD=y 900 898 CONFIG_USB_ARCH_HAS_OHCI=y 901 899 CONFIG_USB_ARCH_HAS_EHCI=y 902 - # CONFIG_USB is not set 900 + CONFIG_USB=y 901 + # CONFIG_USB_DEBUG is not set 902 + 903 + # 904 + # Miscellaneous USB options 905 + # 906 + # CONFIG_USB_DEVICEFS is not set 907 + # CONFIG_USB_BANDWIDTH is not set 908 + # CONFIG_USB_DYNAMIC_MINORS is not set 909 + # CONFIG_USB_OTG is not set 910 + 911 + # 912 + # USB Host Controller Drivers 913 + # 914 + CONFIG_USB_EHCI_HCD=y 915 + CONFIG_USB_EHCI_SPLIT_ISO=y 916 + CONFIG_USB_EHCI_ROOT_HUB_TT=y 917 + CONFIG_USB_EHCI_TT_NEWSCHED=y 918 + # CONFIG_USB_ISP116X_HCD is not set 919 + # CONFIG_USB_OHCI_HCD is not set 920 + CONFIG_USB_UHCI_HCD=y 921 + # CONFIG_USB_SL811_HCD is not set 922 + 923 + # 924 + # USB Device Class drivers 925 + # 926 + # CONFIG_USB_ACM is not set 927 + # CONFIG_USB_PRINTER is not set 903 928 904 929 # 905 930 # NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 931 + # 932 + 933 + # 934 + # may also be needed; see USB_STORAGE Help for more information 935 + # 936 + CONFIG_USB_STORAGE=y 937 + # CONFIG_USB_STORAGE_DEBUG is not set 938 + # CONFIG_USB_STORAGE_DATAFAB is not set 939 + # CONFIG_USB_STORAGE_FREECOM is not set 940 + # CONFIG_USB_STORAGE_DPCM is not set 941 + # CONFIG_USB_STORAGE_USBAT is not set 942 + # CONFIG_USB_STORAGE_SDDR09 is not set 943 + # CONFIG_USB_STORAGE_SDDR55 is not set 944 + # CONFIG_USB_STORAGE_JUMPSHOT is not set 945 + # CONFIG_USB_STORAGE_ALAUDA is not set 946 + # CONFIG_USB_LIBUSUAL is not set 947 + 948 + # 949 + # USB Input Devices 950 + # 951 + # CONFIG_USB_HID is not set 952 + 953 + # 954 + # USB HID Boot Protocol drivers 955 + # 956 + # CONFIG_USB_KBD is not set 957 + # CONFIG_USB_MOUSE is not set 958 + # CONFIG_USB_AIPTEK is not set 959 + # CONFIG_USB_WACOM is not set 960 + # CONFIG_USB_ACECAD is not set 961 + # CONFIG_USB_KBTAB is not set 962 + # CONFIG_USB_POWERMATE is not set 963 + # CONFIG_USB_TOUCHSCREEN is not set 964 + # CONFIG_USB_YEALINK is not set 965 + # CONFIG_USB_XPAD is not set 966 + # CONFIG_USB_ATI_REMOTE is not set 967 + # CONFIG_USB_ATI_REMOTE2 is not set 968 + # CONFIG_USB_KEYSPAN_REMOTE is not set 969 + # CONFIG_USB_APPLETOUCH is not set 970 + 971 + # 972 + # USB Imaging devices 973 + # 974 + # CONFIG_USB_MDC800 is not set 975 + # CONFIG_USB_MICROTEK is not set 976 + 977 + # 978 + # USB Network Adapters 979 + # 980 + # CONFIG_USB_CATC is not set 981 + # CONFIG_USB_KAWETH is not set 982 + # CONFIG_USB_PEGASUS is not set 983 + # CONFIG_USB_RTL8150 is not set 984 + # CONFIG_USB_USBNET is not set 985 + CONFIG_USB_MON=y 986 + 987 + # 988 + # USB port drivers 989 + # 990 + 991 + # 992 + # USB Serial Converter support 993 + # 994 + # CONFIG_USB_SERIAL is not set 995 + 996 + # 997 + # USB Miscellaneous drivers 998 + # 999 + # CONFIG_USB_EMI62 is not set 1000 + # CONFIG_USB_EMI26 is not set 1001 + # CONFIG_USB_AUERSWALD is not set 1002 + # CONFIG_USB_RIO500 is not set 1003 + # CONFIG_USB_LEGOTOWER is not set 1004 + # CONFIG_USB_LCD is not set 1005 + # CONFIG_USB_LED is not set 1006 + # CONFIG_USB_CYPRESS_CY7C63 is not set 1007 + # CONFIG_USB_CYTHERM is not set 1008 + # CONFIG_USB_PHIDGETKIT is not set 1009 + # CONFIG_USB_PHIDGETSERVO is not set 1010 + # CONFIG_USB_IDMOUSE is not set 1011 + # CONFIG_USB_APPLEDISPLAY is not set 1012 + # CONFIG_USB_SISUSBVGA is not set 1013 + # CONFIG_USB_LD is not set 1014 + 1015 + # 1016 + # USB DSL modem support 906 1017 # 907 1018 908 1019 #
+6
arch/arm/mach-iop32x/Kconfig
··· 17 17 evaluation kit for the Intel 80219 processor (a IOP321 variant) 18 18 or the IQ31244 evaluation kit for the IOP321 processor. 19 19 20 + config MACH_N2100 21 + bool "Enable support for the Thecus n2100" 22 + help 23 + Say Y here if you want to run your kernel on the Thecus n2100 24 + NAS appliance. 25 + 20 26 endmenu 21 27 22 28 endif
+1
arch/arm/mach-iop32x/Makefile
··· 9 9 10 10 obj-$(CONFIG_ARCH_IQ80321) += iq80321.o 11 11 obj-$(CONFIG_ARCH_IQ31244) += iq31244.o 12 + obj-$(CONFIG_MACH_N2100) += n2100.o
+2 -1
arch/arm/mach-iop32x/irq.c
··· 63 63 intctl_write(0); 64 64 intstr_write(0); 65 65 if (machine_is_iq80321() || 66 - machine_is_iq31244()) 66 + machine_is_iq31244() || 67 + machine_is_n2100()) 67 68 *IOP3XX_PCIIRSR = 0x0f; 68 69 69 70 for (i = 0; i < NR_IRQS; i++) {
+251
arch/arm/mach-iop32x/n2100.c
··· 1 + /* 2 + * arch/arm/mach-iop32x/n2100.c 3 + * 4 + * Board support code for the Thecus N2100 platform. 5 + * 6 + * Author: Rory Bolt <rorybolt@pacbell.net> 7 + * Copyright (C) 2002 Rory Bolt 8 + * Copyright 2003 (c) MontaVista, Software, Inc. 9 + * Copyright (C) 2004 Intel Corp. 10 + * 11 + * This program is free software; you can redistribute it and/or modify it 12 + * under the terms of the GNU General Public License as published by the 13 + * Free Software Foundation; either version 2 of the License, or (at your 14 + * option) any later version. 15 + */ 16 + 17 + #include <linux/mm.h> 18 + #include <linux/init.h> 19 + #include <linux/delay.h> 20 + #include <linux/kernel.h> 21 + #include <linux/pci.h> 22 + #include <linux/pm.h> 23 + #include <linux/string.h> 24 + #include <linux/slab.h> 25 + #include <linux/serial_core.h> 26 + #include <linux/serial_8250.h> 27 + #include <linux/mtd/physmap.h> 28 + #include <linux/platform_device.h> 29 + #include <linux/reboot.h> 30 + #include <asm/hardware.h> 31 + #include <asm/io.h> 32 + #include <asm/irq.h> 33 + #include <asm/mach/arch.h> 34 + #include <asm/mach/map.h> 35 + #include <asm/mach/pci.h> 36 + #include <asm/mach/time.h> 37 + #include <asm/mach-types.h> 38 + #include <asm/page.h> 39 + #include <asm/pgtable.h> 40 + 41 + /* 42 + * N2100 timer tick configuration. 43 + */ 44 + static void __init n2100_timer_init(void) 45 + { 46 + /* 33.000 MHz crystal. */ 47 + iop3xx_init_time(198000000); 48 + } 49 + 50 + static struct sys_timer n2100_timer = { 51 + .init = n2100_timer_init, 52 + .offset = iop3xx_gettimeoffset, 53 + }; 54 + 55 + 56 + /* 57 + * N2100 I/O. 58 + */ 59 + static struct map_desc n2100_io_desc[] __initdata = { 60 + { /* on-board devices */ 61 + .virtual = N2100_UART, 62 + .pfn = __phys_to_pfn(N2100_UART), 63 + .length = 0x00100000, 64 + .type = MT_DEVICE 65 + }, 66 + }; 67 + 68 + void __init n2100_map_io(void) 69 + { 70 + iop3xx_map_io(); 71 + iotable_init(n2100_io_desc, ARRAY_SIZE(n2100_io_desc)); 72 + } 73 + 74 + 75 + /* 76 + * N2100 PCI. 77 + */ 78 + static inline int __init 79 + n2100_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 80 + { 81 + int irq; 82 + 83 + if (PCI_SLOT(dev->devfn) == 1) { 84 + /* RTL8110SB #1 */ 85 + irq = IRQ_IOP32X_XINT0; 86 + } else if (PCI_SLOT(dev->devfn) == 2) { 87 + /* RTL8110SB #2 */ 88 + irq = IRQ_IOP32X_XINT1; 89 + } else if (PCI_SLOT(dev->devfn) == 3) { 90 + /* Sil3512 */ 91 + irq = IRQ_IOP32X_XINT2; 92 + } else if (PCI_SLOT(dev->devfn) == 4 && pin == 1) { 93 + /* VT6212 INTA */ 94 + irq = IRQ_IOP32X_XINT1; 95 + } else if (PCI_SLOT(dev->devfn) == 4 && pin == 2) { 96 + /* VT6212 INTB */ 97 + irq = IRQ_IOP32X_XINT0; 98 + } else if (PCI_SLOT(dev->devfn) == 4 && pin == 3) { 99 + /* VT6212 INTC */ 100 + irq = IRQ_IOP32X_XINT2; 101 + } else if (PCI_SLOT(dev->devfn) == 5) { 102 + /* Mini-PCI slot */ 103 + irq = IRQ_IOP32X_XINT3; 104 + } else { 105 + printk(KERN_ERR "n2100_pci_map_irq() called for unknown " 106 + "device PCI:%d:%d:%d\n", dev->bus->number, 107 + PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn)); 108 + irq = -1; 109 + } 110 + 111 + return irq; 112 + } 113 + 114 + static struct hw_pci n2100_pci __initdata = { 115 + .swizzle = pci_std_swizzle, 116 + .nr_controllers = 1, 117 + .setup = iop3xx_pci_setup, 118 + .preinit = iop3xx_pci_preinit, 119 + .scan = iop3xx_pci_scan_bus, 120 + .map_irq = n2100_pci_map_irq, 121 + }; 122 + 123 + static int __init n2100_pci_init(void) 124 + { 125 + if (machine_is_n2100()) 126 + pci_common_init(&n2100_pci); 127 + 128 + return 0; 129 + } 130 + 131 + subsys_initcall(n2100_pci_init); 132 + 133 + 134 + /* 135 + * N2100 machine initialisation. 136 + */ 137 + static struct physmap_flash_data n2100_flash_data = { 138 + .width = 2, 139 + }; 140 + 141 + static struct resource n2100_flash_resource = { 142 + .start = 0xf0000000, 143 + .end = 0xf0ffffff, 144 + .flags = IORESOURCE_MEM, 145 + }; 146 + 147 + static struct platform_device n2100_flash_device = { 148 + .name = "physmap-flash", 149 + .id = 0, 150 + .dev = { 151 + .platform_data = &n2100_flash_data, 152 + }, 153 + .num_resources = 1, 154 + .resource = &n2100_flash_resource, 155 + }; 156 + 157 + 158 + static struct plat_serial8250_port n2100_serial_port[] = { 159 + { 160 + .mapbase = N2100_UART, 161 + .membase = (char *)N2100_UART, 162 + .irq = 0, 163 + .flags = UPF_SKIP_TEST, 164 + .iotype = UPIO_MEM, 165 + .regshift = 0, 166 + .uartclk = 1843200, 167 + }, 168 + { }, 169 + }; 170 + 171 + static struct resource n2100_uart_resource = { 172 + .start = N2100_UART, 173 + .end = N2100_UART + 7, 174 + .flags = IORESOURCE_MEM, 175 + }; 176 + 177 + static struct platform_device n2100_serial_device = { 178 + .name = "serial8250", 179 + .id = PLAT8250_DEV_PLATFORM, 180 + .dev = { 181 + .platform_data = n2100_serial_port, 182 + }, 183 + .num_resources = 1, 184 + .resource = &n2100_uart_resource, 185 + }; 186 + 187 + 188 + /* 189 + * Pull PCA9532 GPIO #8 low to power off the machine. 190 + */ 191 + static void n2100_power_off(void) 192 + { 193 + local_irq_disable(); 194 + 195 + /* Start condition, I2C address of PCA9532, write transaction. */ 196 + *IOP3XX_IDBR0 = 0xc0; 197 + *IOP3XX_ICR0 = 0xe9; 198 + mdelay(1); 199 + 200 + /* Write address 0x08. */ 201 + *IOP3XX_IDBR0 = 0x08; 202 + *IOP3XX_ICR0 = 0xe8; 203 + mdelay(1); 204 + 205 + /* Write data 0x01, stop condition. */ 206 + *IOP3XX_IDBR0 = 0x01; 207 + *IOP3XX_ICR0 = 0xea; 208 + 209 + while (1) 210 + ; 211 + } 212 + 213 + 214 + static struct timer_list power_button_poll_timer; 215 + 216 + static void power_button_poll(unsigned long dummy) 217 + { 218 + if (gpio_line_get(N2100_POWER_BUTTON) == 0) { 219 + ctrl_alt_del(); 220 + return; 221 + } 222 + 223 + power_button_poll_timer.expires = jiffies + (HZ / 10); 224 + add_timer(&power_button_poll_timer); 225 + } 226 + 227 + 228 + static void __init n2100_init_machine(void) 229 + { 230 + platform_device_register(&iop3xx_i2c0_device); 231 + platform_device_register(&n2100_flash_device); 232 + platform_device_register(&n2100_serial_device); 233 + 234 + pm_power_off = n2100_power_off; 235 + 236 + init_timer(&power_button_poll_timer); 237 + power_button_poll_timer.function = power_button_poll; 238 + power_button_poll_timer.expires = jiffies + (HZ / 10); 239 + add_timer(&power_button_poll_timer); 240 + } 241 + 242 + MACHINE_START(N2100, "Thecus N2100") 243 + /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */ 244 + .phys_io = N2100_UART, 245 + .io_pg_offst = ((N2100_UART) >> 18) & 0xfffc, 246 + .boot_params = 0xa0000100, 247 + .map_io = n2100_map_io, 248 + .init_irq = iop32x_init_irq, 249 + .timer = &n2100_timer, 250 + .init_machine = n2100_init_machine, 251 + MACHINE_END
+1
include/asm-arm/arch-iop32x/hardware.h
··· 37 37 */ 38 38 #include "iq80321.h" 39 39 #include "iq31244.h" 40 + #include "n2100.h" 40 41 41 42 42 43 #endif
+19
include/asm-arm/arch-iop32x/n2100.h
··· 1 + /* 2 + * include/asm/arch-iop32x/n2100.h 3 + * 4 + * Thecus N2100 board registers 5 + */ 6 + 7 + #ifndef __N2100_H 8 + #define __N2100_H 9 + 10 + #define N2100_UART 0xfe800000 /* UART */ 11 + 12 + #define N2100_COPY_BUTTON IOP3XX_GPIO_LINE(0) 13 + #define N2100_PCA9532_RESET IOP3XX_GPIO_LINE(2) 14 + #define N2100_RESET_BUTTON IOP3XX_GPIO_LINE(3) 15 + #define N2100_HARDWARE_RESET IOP3XX_GPIO_LINE(4) 16 + #define N2100_POWER_BUTTON IOP3XX_GPIO_LINE(5) 17 + 18 + 19 + #endif
+11
include/asm-arm/arch-iop32x/system.h
··· 8 8 * published by the Free Software Foundation. 9 9 */ 10 10 11 + #include <asm/mach-types.h> 12 + 11 13 static inline void arch_idle(void) 12 14 { 13 15 cpu_do_idle(); ··· 17 15 18 16 static inline void arch_reset(char mode) 19 17 { 18 + local_irq_disable(); 19 + 20 + if (machine_is_n2100()) { 21 + gpio_line_set(N2100_HARDWARE_RESET, GPIO_LOW); 22 + gpio_line_config(N2100_HARDWARE_RESET, GPIO_OUT); 23 + while (1) 24 + ; 25 + } 26 + 20 27 *IOP3XX_PCSR = 0x30; 21 28 22 29 /* Jump into ROM at address 0 */