1 Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/fsg-pci.c
2 ===================================================================
4 +++ linux-2.6.21.7/arch/arm/mach-ixp4xx/fsg-pci.c
7 + * arch/arch/mach-ixp4xx/fsg-pci.c
9 + * FSG board-level PCI initialization
11 + * Author: Rod Whitby <rod@whitby.id.au>
12 + * Maintainer: http://www.nslu2-linux.org/
14 + * based on ixdp425-pci.c:
15 + * Copyright (C) 2002 Intel Corporation.
16 + * Copyright (C) 2003-2004 MontaVista Software, Inc.
18 + * This program is free software; you can redistribute it and/or modify
19 + * it under the terms of the GNU General Public License version 2 as
20 + * published by the Free Software Foundation.
24 +#include <linux/pci.h>
25 +#include <linux/init.h>
26 +#include <linux/irq.h>
28 +#include <asm/mach/pci.h>
29 +#include <asm/mach-types.h>
31 +void __init fsg_pci_preinit(void)
33 + set_irq_type(IRQ_FSG_PCI_INTA, IRQT_LOW);
34 + set_irq_type(IRQ_FSG_PCI_INTB, IRQT_LOW);
35 + set_irq_type(IRQ_FSG_PCI_INTC, IRQT_LOW);
37 + ixp4xx_pci_preinit();
40 +static int __init fsg_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
42 + static int pci_irq_table[FSG_PCI_IRQ_LINES] = {
51 + if (slot >= 1 && slot <= FSG_PCI_MAX_DEV &&
52 + pin >= 1 && pin <= FSG_PCI_IRQ_LINES) {
53 + irq = pci_irq_table[(slot - 1)];
55 + printk("%s: Mapped slot %d pin %d to IRQ %d\n", __FUNCTION__,slot, pin, irq);
60 +struct hw_pci fsg_pci __initdata = {
61 + .nr_controllers = 1,
62 + .preinit = fsg_pci_preinit,
63 + .swizzle = pci_std_swizzle,
64 + .setup = ixp4xx_setup,
65 + .scan = ixp4xx_scan_bus,
66 + .map_irq = fsg_map_irq,
69 +int __init fsg_pci_init(void)
71 + if (machine_is_fsg())
72 + pci_common_init(&fsg_pci);
76 +subsys_initcall(fsg_pci_init);
77 Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/fsg-setup.c
78 ===================================================================
80 +++ linux-2.6.21.7/arch/arm/mach-ixp4xx/fsg-setup.c
83 + * arch/arm/mach-ixp4xx/fsg-setup.c
87 + * based ixdp425-setup.c:
88 + * Copyright (C) 2003-2004 MontaVista Software, Inc.
90 + * Author: Rod Whitby <rod@whitby.id.au>
91 + * Maintainers: http://www.nslu2-linux.org/
95 +#include <linux/kernel.h>
96 +#include <linux/serial.h>
97 +#include <linux/serial_8250.h>
98 +#include <linux/leds.h>
99 +#include <linux/mtd/mtd.h>
101 +#include <asm/mach-types.h>
102 +#include <asm/mach/arch.h>
103 +#include <asm/mach/flash.h>
105 +static struct flash_platform_data fsg_flash_data = {
106 + .map_name = "cfi_probe",
110 +static struct resource fsg_flash_resource = {
111 + .flags = IORESOURCE_MEM,
114 +static struct platform_device fsg_flash = {
115 + .name = "IXP4XX-Flash",
117 + .dev.platform_data = &fsg_flash_data,
118 + .num_resources = 1,
119 + .resource = &fsg_flash_resource,
122 +static struct ixp4xx_i2c_pins fsg_i2c_gpio_pins = {
123 + .sda_pin = FSG_SDA_PIN,
124 + .scl_pin = FSG_SCL_PIN,
127 +static struct platform_device fsg_i2c_controller = {
128 + .name = "IXP4XX-I2C",
130 + .dev.platform_data = &fsg_i2c_gpio_pins,
131 + .num_resources = 0,
134 +static struct resource fsg_uart_resources[] = {
136 + .start = IXP4XX_UART1_BASE_PHYS,
137 + .end = IXP4XX_UART1_BASE_PHYS + 0x0fff,
138 + .flags = IORESOURCE_MEM,
141 + .start = IXP4XX_UART2_BASE_PHYS,
142 + .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
143 + .flags = IORESOURCE_MEM,
147 +static struct plat_serial8250_port fsg_uart_data[] = {
149 + .mapbase = IXP4XX_UART1_BASE_PHYS,
150 + .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
151 + .irq = IRQ_IXP4XX_UART1,
152 + .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
153 + .iotype = UPIO_MEM,
155 + .uartclk = IXP4XX_UART_XTAL,
158 + .mapbase = IXP4XX_UART2_BASE_PHYS,
159 + .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
160 + .irq = IRQ_IXP4XX_UART2,
161 + .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
162 + .iotype = UPIO_MEM,
164 + .uartclk = IXP4XX_UART_XTAL,
169 +static struct platform_device fsg_uart = {
170 + .name = "serial8250",
171 + .id = PLAT8250_DEV_PLATFORM,
172 + .dev.platform_data = fsg_uart_data,
173 + .num_resources = ARRAY_SIZE(fsg_uart_resources),
174 + .resource = fsg_uart_resources,
177 +/* Built-in 10/100 Ethernet MAC interfaces */
178 +static struct resource res_mac0 = {
179 + .start = IXP4XX_EthB_BASE_PHYS,
180 + .end = IXP4XX_EthB_BASE_PHYS + 0x1ff,
181 + .flags = IORESOURCE_MEM,
184 +static struct resource res_mac1 = {
185 + .start = IXP4XX_EthC_BASE_PHYS,
186 + .end = IXP4XX_EthC_BASE_PHYS + 0x1ff,
187 + .flags = IORESOURCE_MEM,
190 +static struct mac_plat_info plat_mac0 = {
199 +static struct mac_plat_info plat_mac1 = {
208 +static struct platform_device mac0 = {
209 + .name = "ixp4xx_mac",
211 + .dev.platform_data = &plat_mac0,
212 + .num_resources = 1,
213 + .resource = &res_mac0,
216 +static struct platform_device mac1 = {
217 + .name = "ixp4xx_mac",
219 + .dev.platform_data = &plat_mac1,
220 + .num_resources = 1,
221 + .resource = &res_mac1,
224 +struct npe_ucode_platform_data fsg_npe_ucode_data = {
225 + .mtd_partition = "microcode",
228 +static struct platform_device fsg_npe_ucode = {
229 + .name = "ixp4xx_npe_ucode",
231 + .dev.platform_data = &fsg_npe_ucode_data,
234 +static struct platform_device *fsg_devices[] __initdata = {
235 + &fsg_i2c_controller,
242 +static void fsg_flash_add(struct mtd_info *mtd)
244 + if (strcmp(mtd->name, "RedBoot config") == 0) {
248 + if (mtd->read(mtd, 0x0422, 6, &retlen, mac) == 0 && retlen == 6) {
249 + printk(KERN_INFO "eth0 mac: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n",
250 + mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
251 + memcpy(plat_mac0.hwaddr, mac, 6);
253 + printk(KERN_INFO "eth1 mac: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n",
254 + mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
255 + memcpy(plat_mac1.hwaddr, mac, 6);
257 + printk(KERN_ERR "fsg mac: read failed\n");
262 +static void fsg_flash_remove(struct mtd_info *mtd) {
265 +static struct mtd_notifier fsg_flash_notifier = {
266 + .add = fsg_flash_add,
267 + .remove = fsg_flash_remove,
270 +static void __init fsg_init(void)
274 + fsg_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
275 + fsg_flash_resource.end =
276 + IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1;
278 + *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE;
279 + *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0;
281 + /* Configure CS2 for operation, 8bit and writable */
282 + *IXP4XX_EXP_CS2 = 0xbfff0002;
284 + /* This is only useful on a modified machine, but it is valuable
285 + * to have it first in order to see debug messages, and so that
286 + * it does *not* get removed if platform_add_devices fails!
288 + (void)platform_device_register(&fsg_uart);
290 + platform_add_devices(fsg_devices, ARRAY_SIZE(fsg_devices));
292 + register_mtd_user(&fsg_flash_notifier);
295 +MACHINE_START(FSG, "Freecom FSG-3")
296 + .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
297 + .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
298 + .map_io = ixp4xx_map_io,
299 + .init_irq = ixp4xx_init_irq,
300 + .timer = &ixp4xx_timer,
301 + .boot_params = 0x0100,
302 + .init_machine = fsg_init,
305 Index: linux-2.6.21.7/include/asm-arm/arch-ixp4xx/fsg.h
306 ===================================================================
308 +++ linux-2.6.21.7/include/asm-arm/arch-ixp4xx/fsg.h
311 + * include/asm-arm/arch-ixp4xx/fsg.h
313 + * Freecom FSG-3 platform specific definitions
315 + * Author: Rod Whitby <rod@whitby.id.au>
316 + * Author: Tomasz Chmielewski <mangoo@wpkg.org>
317 + * Maintainers: http://www.nslu2-linux.org
319 + * Based on coyote.h by
320 + * Copyright 2004 (c) MontaVista, Software, Inc.
322 + * This file is licensed under the terms of the GNU General Public
323 + * License version 2. This program is licensed "as is" without any
324 + * warranty of any kind, whether express or implied.
327 +#ifndef __ASM_ARCH_HARDWARE_H__
328 +#error "Do not include this directly, instead #include <asm/hardware.h>"
331 +#define FSG_SDA_PIN 12
332 +#define FSG_SCL_PIN 13
337 +#define FSG_PCI_MAX_DEV 3
338 +#define FSG_PCI_IRQ_LINES 3
341 +/* PCI controller GPIO to IRQ pin mappings */
342 +#define FSG_PCI_INTA_PIN 6
343 +#define FSG_PCI_INTB_PIN 7
344 +#define FSG_PCI_INTC_PIN 5
348 +#define FSG_SB_GPIO 4
349 +#define FSG_RB_GPIO 9
350 +#define FSG_UB_GPIO 10
352 +#define FSG_SB_IRQ IRQ_IXP4XX_GPIO4
353 +#define FSG_RB_IRQ IRQ_IXP4XX_GPIO9
354 +#define FSG_UB_IRQ IRQ_IXP4XX_GPIO10
356 +#define FSG_SB_BM (1L << FSG_SB_GPIO)
357 +#define FSG_RB_BM (1L << FSG_RB_GPIO)
358 +#define FSG_UB_BM (1L << FSG_UB_GPIO)
362 +#define FSG_LED_RING_BIT 0
363 +#define FSG_LED_SYNC_BIT 1
364 +#define FSG_LED_USB_BIT 2
365 +#define FSG_LED_SATA_BIT 3
366 +#define FSG_LED_WAN_BIT 4
367 +#define FSG_LED_WLAN_BIT 5
368 Index: linux-2.6.21.7/include/asm-arm/arch-ixp4xx/hardware.h
369 ===================================================================
370 --- linux-2.6.21.7.orig/include/asm-arm/arch-ixp4xx/hardware.h
371 +++ linux-2.6.21.7/include/asm-arm/arch-ixp4xx/hardware.h
372 @@ -48,5 +48,6 @@ extern unsigned int processor_id;
378 #endif /* _ASM_ARCH_HARDWARE_H */
379 Index: linux-2.6.21.7/include/asm-arm/arch-ixp4xx/irqs.h
380 ===================================================================
381 --- linux-2.6.21.7.orig/include/asm-arm/arch-ixp4xx/irqs.h
382 +++ linux-2.6.21.7/include/asm-arm/arch-ixp4xx/irqs.h
384 #define IRQ_DSMG600_PCI_INTE IRQ_IXP4XX_GPIO7
385 #define IRQ_DSMG600_PCI_INTF IRQ_IXP4XX_GPIO6
388 + * Freecom FSG-3 board IRQs
390 +#define IRQ_FSG_PCI_INTA IRQ_IXP4XX_GPIO6
391 +#define IRQ_FSG_PCI_INTB IRQ_IXP4XX_GPIO7
392 +#define IRQ_FSG_PCI_INTC IRQ_IXP4XX_GPIO5
395 Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/Makefile
396 ===================================================================
397 --- linux-2.6.21.7.orig/arch/arm/mach-ixp4xx/Makefile
398 +++ linux-2.6.21.7/arch/arm/mach-ixp4xx/Makefile
399 @@ -13,6 +13,7 @@ obj-pci-$(CONFIG_MACH_GTWX5715) += gtwx
400 obj-pci-$(CONFIG_MACH_NSLU2) += nslu2-pci.o
401 obj-pci-$(CONFIG_MACH_NAS100D) += nas100d-pci.o
402 obj-pci-$(CONFIG_MACH_DSMG600) += dsmg600-pci.o
403 +obj-pci-$(CONFIG_MACH_FSG) += fsg-pci.o
404 obj-pci-$(CONFIG_MACH_GATEWAY7001) += gateway7001-pci.o
405 obj-pci-$(CONFIG_MACH_WG302V2) += wg302v2-pci.o
406 obj-pci-$(CONFIG_MACH_PRONGHORNMETRO) += pronghornmetro-pci.o
407 @@ -29,6 +30,7 @@ obj-$(CONFIG_MACH_GTWX5715) += gtwx5715-
408 obj-$(CONFIG_MACH_NSLU2) += nslu2-setup.o nslu2-power.o
409 obj-$(CONFIG_MACH_NAS100D) += nas100d-setup.o nas100d-power.o
410 obj-$(CONFIG_MACH_DSMG600) += dsmg600-setup.o dsmg600-power.o
411 +obj-$(CONFIG_MACH_FSG) += fsg-setup.o
412 obj-$(CONFIG_MACH_GATEWAY7001) += gateway7001-setup.o
413 obj-$(CONFIG_MACH_WG302V2) += wg302v2-setup.o
414 obj-$(CONFIG_MACH_PRONGHORNMETRO) += pronghornmetro-setup.o
415 Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/Kconfig
416 ===================================================================
417 --- linux-2.6.21.7.orig/arch/arm/mach-ixp4xx/Kconfig
418 +++ linux-2.6.21.7/arch/arm/mach-ixp4xx/Kconfig
419 @@ -138,6 +138,14 @@ config MACH_DSMG600
420 DSM-G600 RevA device. For more information on this platform,
421 see http://www.nslu2-linux.org/wiki/DSMG600/HomePage
425 + prompt "Freecom FSG-3"
427 + Say 'Y' here if you want your kernel to support Freecom's
428 + FSG-3 device. For more information on this
429 + platform see http://www.openfsg.com/
432 # Avila and IXDP share the same source for now. Will change in future