1 Index: linux-2.6.19/arch/arm/mach-ixp4xx/Kconfig
2 ===================================================================
3 --- linux-2.6.19.orig/arch/arm/mach-ixp4xx/Kconfig
4 +++ linux-2.6.19/arch/arm/mach-ixp4xx/Kconfig
5 @@ -89,6 +89,15 @@ config MACH_NAS100D
6 NAS 100d device. For more information on this platform,
7 see http://www.nslu2-linux.org/wiki/NAS100d/HomePage
11 + prompt "D-Link DSM-G600 RevA"
14 + Say 'Y' here if you want your kernel to support D-Link's
15 + DSM-G600 RevA device. For more information on this platform,
16 + see http://www.nslu2-linux.org/wiki/DSMG600/HomePage
19 # Avila and IXDP share the same source for now. Will change in future
21 Index: linux-2.6.19/arch/arm/mach-ixp4xx/Makefile
22 ===================================================================
23 --- linux-2.6.19.orig/arch/arm/mach-ixp4xx/Makefile
24 +++ linux-2.6.19/arch/arm/mach-ixp4xx/Makefile
25 @@ -12,6 +12,7 @@ obj-pci-$(CONFIG_ARCH_ADI_COYOTE) += coy
26 obj-pci-$(CONFIG_MACH_GTWX5715) += gtwx5715-pci.o
27 obj-pci-$(CONFIG_MACH_NSLU2) += nslu2-pci.o
28 obj-pci-$(CONFIG_MACH_NAS100D) += nas100d-pci.o
29 +obj-pci-$(CONFIG_MACH_DSMG600) += dsmg600-pci.o
33 @@ -22,5 +23,6 @@ obj-$(CONFIG_ARCH_ADI_COYOTE) += coyote-
34 obj-$(CONFIG_MACH_GTWX5715) += gtwx5715-setup.o
35 obj-$(CONFIG_MACH_NSLU2) += nslu2-setup.o nslu2-power.o
36 obj-$(CONFIG_MACH_NAS100D) += nas100d-setup.o nas100d-power.o
37 +obj-$(CONFIG_MACH_DSMG600) += dsmg600-setup.o dsmg600-power.o
39 obj-$(CONFIG_PCI) += $(obj-pci-$(CONFIG_PCI)) common-pci.o
40 Index: linux-2.6.19/arch/arm/mach-ixp4xx/dsmg600-pci.c
41 ===================================================================
43 +++ linux-2.6.19/arch/arm/mach-ixp4xx/dsmg600-pci.c
46 + * DSM-G600 board-level PCI initialization
48 + * Copyright (c) 2006 Tower Technologies
49 + * Author: Alessandro Zummo <a.zummo@towertech.it>
51 + * based on ixdp425-pci.c:
52 + * Copyright (C) 2002 Intel Corporation.
53 + * Copyright (C) 2003-2004 MontaVista Software, Inc.
55 + * Maintainer: http://www.nslu2-linux.org/
57 + * This program is free software; you can redistribute it and/or modify
58 + * it under the terms of the GNU General Public License version 2 as
59 + * published by the Free Software Foundation.
63 +#include <linux/pci.h>
64 +#include <linux/init.h>
65 +#include <linux/irq.h>
67 +#include <asm/mach/pci.h>
68 +#include <asm/mach-types.h>
70 +void __init dsmg600_pci_preinit(void)
72 + set_irq_type(IRQ_DSMG600_PCI_INTA, IRQT_LOW);
73 + set_irq_type(IRQ_DSMG600_PCI_INTB, IRQT_LOW);
74 + set_irq_type(IRQ_DSMG600_PCI_INTC, IRQT_LOW);
75 + set_irq_type(IRQ_DSMG600_PCI_INTD, IRQT_LOW);
76 + set_irq_type(IRQ_DSMG600_PCI_INTE, IRQT_LOW);
77 + set_irq_type(IRQ_DSMG600_PCI_INTF, IRQT_LOW);
79 + ixp4xx_pci_preinit();
82 +static int __init dsmg600_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
84 + static int pci_irq_table[DSMG600_PCI_MAX_DEV][DSMG600_PCI_IRQ_LINES] =
86 + { IRQ_DSMG600_PCI_INTE, -1, -1 },
87 + { IRQ_DSMG600_PCI_INTA, -1, -1 },
88 + { IRQ_DSMG600_PCI_INTB, IRQ_DSMG600_PCI_INTC, IRQ_DSMG600_PCI_INTD },
89 + { IRQ_DSMG600_PCI_INTF, -1, -1 },
94 + if (slot >= 1 && slot <= DSMG600_PCI_MAX_DEV &&
95 + pin >= 1 && pin <= DSMG600_PCI_IRQ_LINES)
96 + irq = pci_irq_table[slot-1][pin-1];
101 +struct hw_pci __initdata dsmg600_pci = {
102 + .nr_controllers = 1,
103 + .preinit = dsmg600_pci_preinit,
104 + .swizzle = pci_std_swizzle,
105 + .setup = ixp4xx_setup,
106 + .scan = ixp4xx_scan_bus,
107 + .map_irq = dsmg600_map_irq,
110 +int __init dsmg600_pci_init(void)
112 + if (machine_is_dsmg600())
113 + pci_common_init(&dsmg600_pci);
118 +subsys_initcall(dsmg600_pci_init);
119 Index: linux-2.6.19/arch/arm/mach-ixp4xx/dsmg600-power.c
120 ===================================================================
122 +++ linux-2.6.19/arch/arm/mach-ixp4xx/dsmg600-power.c
125 + * arch/arm/mach-ixp4xx/dsmg600-power.c
127 + * DSM-G600 Power/Reset driver
128 + * Author: Michael Westerhof <mwester@dls.net>
130 + * Based on nslu2-power.c
131 + * Copyright (C) 2005 Tower Technologies
132 + * Author: Alessandro Zummo <a.zummo@towertech.it>
134 + * which was based on nslu2-io.c
135 + * Copyright (C) 2004 Karen Spearel
137 + * Maintainers: http://www.nslu2-linux.org/
139 + * This program is free software; you can redistribute it and/or modify
140 + * it under the terms of the GNU General Public License version 2 as
141 + * published by the Free Software Foundation.
145 +#include <linux/module.h>
146 +#include <linux/reboot.h>
147 +#include <linux/interrupt.h>
148 +#include <linux/irq.h>
150 +#include <asm/mach-types.h>
152 +static irqreturn_t dsmg600_reset_handler(int irq, void *dev_id)
154 + /* This is the paper-clip reset, it shuts the machine down directly. */
156 + machine_power_off();
158 + return IRQ_HANDLED;
161 +static int __init dsmg600_power_init(void)
163 + if (!(machine_is_dsmg600()))
166 + set_irq_type(DSMG600_RB_IRQ, IRQT_LOW);
168 + if (request_irq(DSMG600_RB_IRQ, &dsmg600_reset_handler,
169 + IRQF_DISABLED, "DSM-G600 reset button", NULL) < 0) {
171 + printk(KERN_DEBUG "Reset Button IRQ %d not available\n",
180 +static void __exit dsmg600_power_exit(void)
182 + if (!(machine_is_dsmg600()))
185 + free_irq(DSMG600_RB_IRQ, NULL);
188 +module_init(dsmg600_power_init);
189 +module_exit(dsmg600_power_exit);
191 +MODULE_AUTHOR("Michael Westerhof <mwester@dls.net>");
192 +MODULE_DESCRIPTION("DSM-G600 Power/Reset driver");
193 +MODULE_LICENSE("GPL");
194 Index: linux-2.6.19/arch/arm/mach-ixp4xx/dsmg600-setup.c
195 ===================================================================
197 +++ linux-2.6.19/arch/arm/mach-ixp4xx/dsmg600-setup.c
200 + * DSM-G600 board-setup
202 + * Copyright (c) 2006 Tower Technologies
203 + * Author: Alessandro Zummo <a.zummo@towertech.it>
205 + * based ixdp425-setup.c:
206 + * Copyright (C) 2003-2004 MontaVista Software, Inc.
208 + * Author: Alessandro Zummo <a.zummo@towertech.it>
209 + * Maintainers: http://www.nslu2-linux.org/
212 +#include <linux/kernel.h>
213 +#include <linux/serial.h>
214 +#include <linux/serial_8250.h>
216 +#include <asm/mach-types.h>
217 +#include <asm/mach/arch.h>
218 +#include <asm/mach/flash.h>
220 +static struct flash_platform_data dsmg600_flash_data = {
221 + .map_name = "cfi_probe",
225 +static struct resource dsmg600_flash_resource = {
226 + .flags = IORESOURCE_MEM,
229 +static struct platform_device dsmg600_flash = {
230 + .name = "IXP4XX-Flash",
232 + .dev.platform_data = &dsmg600_flash_data,
233 + .num_resources = 1,
234 + .resource = &dsmg600_flash_resource,
237 +static struct ixp4xx_i2c_pins dsmg600_i2c_gpio_pins = {
238 + .sda_pin = DSMG600_SDA_PIN,
239 + .scl_pin = DSMG600_SCL_PIN,
242 +static struct platform_device dsmg600_i2c_controller = {
243 + .name = "IXP4XX-I2C",
245 + .dev.platform_data = &dsmg600_i2c_gpio_pins,
246 + .num_resources = 0,
249 +#ifdef CONFIG_LEDS_CLASS
250 +static struct resource dsmg600_led_resources[] = {
253 + .start = DSMG600_LED_PWR,
254 + .end = DSMG600_LED_PWR,
255 + .flags = IXP4XX_GPIO_HIGH,
259 + .start = DSMG600_LED_WLAN,
260 + .end = DSMG600_LED_WLAN,
261 + .flags = IXP4XX_GPIO_LOW,
265 +static struct platform_device dsmg600_leds = {
266 + .name = "IXP4XX-GPIO-LED",
268 + .num_resources = ARRAY_SIZE(dsmg600_led_resources),
269 + .resource = dsmg600_led_resources,
273 +static struct resource dsmg600_uart_resources[] = {
275 + .start = IXP4XX_UART1_BASE_PHYS,
276 + .end = IXP4XX_UART1_BASE_PHYS + 0x0fff,
277 + .flags = IORESOURCE_MEM,
280 + .start = IXP4XX_UART2_BASE_PHYS,
281 + .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
282 + .flags = IORESOURCE_MEM,
286 +static struct plat_serial8250_port dsmg600_uart_data[] = {
288 + .mapbase = IXP4XX_UART1_BASE_PHYS,
289 + .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
290 + .irq = IRQ_IXP4XX_UART1,
291 + .flags = UPF_BOOT_AUTOCONF,
292 + .iotype = UPIO_MEM,
294 + .uartclk = IXP4XX_UART_XTAL,
297 + .mapbase = IXP4XX_UART2_BASE_PHYS,
298 + .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
299 + .irq = IRQ_IXP4XX_UART2,
300 + .flags = UPF_BOOT_AUTOCONF,
301 + .iotype = UPIO_MEM,
303 + .uartclk = IXP4XX_UART_XTAL,
308 +static struct platform_device dsmg600_uart = {
309 + .name = "serial8250",
310 + .id = PLAT8250_DEV_PLATFORM,
311 + .dev.platform_data = dsmg600_uart_data,
312 + .num_resources = 2,
313 + .resource = dsmg600_uart_resources,
316 +static struct platform_device *dsmg600_devices[] __initdata = {
317 + &dsmg600_i2c_controller,
321 +static void dsmg600_power_off(void)
323 + /* enable the pwr cntl gpio */
324 + gpio_line_config(DSMG600_PO_GPIO, IXP4XX_GPIO_OUT);
327 + gpio_line_set(DSMG600_PO_GPIO, IXP4XX_GPIO_HIGH);
330 +static void __init dsmg600_init(void)
332 + ixp4xx_timer_freq = DSMG600_FREQ;
335 + /* Make sure that GPIO14 and GPIO15 are not used as clocks */
336 + *IXP4XX_GPIO_GPCLKR = 0;
338 + dsmg600_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
339 + dsmg600_flash_resource.end =
340 + IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1;
342 + pm_power_off = dsmg600_power_off;
344 + /* The UART is required on the DSM-G600 (Redboot cannot use the
345 + * NIC) -- do it here so that it does *not* get removed if
346 + * platform_add_devices fails!
348 + (void)platform_device_register(&dsmg600_uart);
350 + platform_add_devices(dsmg600_devices, ARRAY_SIZE(dsmg600_devices));
352 +#ifdef CONFIG_LEDS_CLASS
353 + /* We don't care whether or not this works. */
354 + (void)platform_device_register(&dsmg600_leds);
358 +MACHINE_START(DSMG600, "D-Link DSM-G600 RevA")
359 + /* Maintainer: www.nslu2-linux.org */
360 + .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
361 + .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xFFFC,
362 + .boot_params = 0x00000100,
363 + .map_io = ixp4xx_map_io,
364 + .init_irq = ixp4xx_init_irq,
365 + .timer = &ixp4xx_timer,
366 + .init_machine = dsmg600_init,
368 Index: linux-2.6.19/include/asm-arm/arch-ixp4xx/dsmg600.h
369 ===================================================================
371 +++ linux-2.6.19/include/asm-arm/arch-ixp4xx/dsmg600.h
374 + * DSM-G600 platform specific definitions
376 + * Copyright (c) 2006 Tower Technologies
377 + * Author: Alessandro Zummo <a.zummo@towertech.it>
379 + * based on ixdp425.h:
380 + * Copyright 2004 (c) MontaVista, Software, Inc.
382 + * This file is licensed under the terms of the GNU General Public
383 + * License version 2. This program is licensed "as is" without any
384 + * warranty of any kind, whether express or implied.
387 +#ifndef __ASM_ARCH_HARDWARE_H__
388 +#error "Do not include this directly, instead #include <asm/hardware.h>"
391 +#define DSMG600_SDA_PIN 5
392 +#define DSMG600_SCL_PIN 4
397 +#define DSMG600_PCI_MAX_DEV 4
398 +#define DSMG600_PCI_IRQ_LINES 3
401 +/* PCI controller GPIO to IRQ pin mappings */
402 +#define DSMG600_PCI_INTA_PIN 11
403 +#define DSMG600_PCI_INTB_PIN 10
404 +#define DSMG600_PCI_INTC_PIN 9
405 +#define DSMG600_PCI_INTD_PIN 8
406 +#define DSMG600_PCI_INTE_PIN 7
407 +#define DSMG600_PCI_INTF_PIN 6
409 +/* DSM-G600 Timer Setting */
410 +#define DSMG600_FREQ 66000000
414 +#define DSMG600_GPIO0 0
415 +#define DSMG600_GPIO1 1
416 +#define DSMG600_GPIO2 2
417 +#define DSMG600_GPIO3 3
418 +#define DSMG600_GPIO4 4
419 +#define DSMG600_GPIO5 5
420 +#define DSMG600_GPIO6 6
421 +#define DSMG600_GPIO7 7
422 +#define DSMG600_GPIO8 8
423 +#define DSMG600_GPIO9 9
424 +#define DSMG600_GPIO10 10
425 +#define DSMG600_GPIO11 11
426 +#define DSMG600_GPIO12 12
427 +#define DSMG600_GPIO13 13
428 +#define DSMG600_GPIO14 14
429 +#define DSMG600_GPIO15 15
433 +#define DSMG600_PB_GPIO DSMG600_GPIO15 /* power button */
434 +#define DSMG600_PB_BM (1L << DSMG600_PB_GPIO)
436 +#define DSMG600_RB_GPIO DSMG600_GPIO3 /* reset button */
438 +#define DSMG600_RB_IRQ IRQ_IXP4XX_GPIO3
440 +#define DSMG600_PO_GPIO DSMG600_GPIO2 /* power off */
444 +#define DSMG600_LED_PWR DSMG600_GPIO0
445 +#define DSMG600_LED_PWR_BM (1L << DSMG600_LED_PWR)
447 +#define DSMG600_LED_WLAN DSMG600_GPIO14
448 +#define DSMG600_LED_WLAN_BM (1L << DSMG600_LED_WLAN)
449 Index: linux-2.6.19/include/asm-arm/arch-ixp4xx/hardware.h
450 ===================================================================
451 --- linux-2.6.19.orig/include/asm-arm/arch-ixp4xx/hardware.h
452 +++ linux-2.6.19/include/asm-arm/arch-ixp4xx/hardware.h
453 @@ -47,5 +47,6 @@ extern unsigned int processor_id;
454 #include "prpmc1100.h"
457 +#include "dsmg600.h"
459 #endif /* _ASM_ARCH_HARDWARE_H */
460 Index: linux-2.6.19/include/asm-arm/arch-ixp4xx/irqs.h
461 ===================================================================
462 --- linux-2.6.19.orig/include/asm-arm/arch-ixp4xx/irqs.h
463 +++ linux-2.6.19/include/asm-arm/arch-ixp4xx/irqs.h
465 #define IRQ_NAS100D_PCI_INTD IRQ_IXP4XX_GPIO8
466 #define IRQ_NAS100D_PCI_INTE IRQ_IXP4XX_GPIO7
469 + * D-Link DSM-G600 RevA board IRQs
471 +#define IRQ_DSMG600_PCI_INTA IRQ_IXP4XX_GPIO11
472 +#define IRQ_DSMG600_PCI_INTB IRQ_IXP4XX_GPIO10
473 +#define IRQ_DSMG600_PCI_INTC IRQ_IXP4XX_GPIO9
474 +#define IRQ_DSMG600_PCI_INTD IRQ_IXP4XX_GPIO8
475 +#define IRQ_DSMG600_PCI_INTE IRQ_IXP4XX_GPIO7
476 +#define IRQ_DSMG600_PCI_INTF IRQ_IXP4XX_GPIO6