diff options
author | Rod Whitby <rod@whitby.id.au> | 2006-01-04 12:17:11 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2006-01-04 12:17:11 -0500 |
commit | 3145d8a6cc83ee15adf18f598873e53a54cd1841 (patch) | |
tree | 9b314c3ad06350f4839fc17a2119fb18428123fe /arch/arm/mach-ixp4xx | |
parent | f7e8bbb8207c17afbd716e7e5fc785b78fa08571 (diff) |
[ARM] 3215/1: Iomega NAS 100d (MACH_NAS100D) machine support
Patch from Rod Whitby
This patch adds support for a new arm/ixp4xx machine - the Iomega NAS 100d network attached storage product. The NAS100D is a consumer device containing a 266MHz Intel IXP420 processor, 16MB of flash, 64MB of RAM, a 160Gb internal IDE hard disk, and 802.11b/g wireless on an Atheros mini-PCI card.
Work on porting the latest 2.6.x kernel to this device is being done by
the NSLU2-Linux project (the same team who maintains the port to the
Linksys NSLU2 device). In particular, the majority of this patch was
authored by Alessandro Zummo, based on the work done for MACH_NSLU2
support by the NSLU2-Linux core team of developers.
MACH_NAS100D (as implemented by this patch) can be enabled in jumbo
ixp4xx kernels without any affect on the other machines supported by
that kernel.
This patch applies cleanly against 2.6.15-rc7 and should be trivial to
apply to later kernel versions. It does not depend upon any other
patches.
Modified files (and number of lines inserted):
arch/arm/mach-ixp4xx/Kconfig | 8
arch/arm/mach-ixp4xx/Makefile | 1
include/asm-arm/arch-ixp4xx/hardware.h | 1
include/asm-arm/arch-ixp4xx/irqs.h | 9
include/asm-arm/arch-ixp4xx/nas100d.h | 75
arch/arm/mach-ixp4xx/nas100d-pci.c | 77
arch/arm/mach-ixp4xx/nas100d-power.c | 69
arch/arm/mach-ixp4xx/nas100d-setup.c | 133
-- Rod Whitby (NSLU2-Linux project lead)
Signed-off-by: Rod Whitby <rod@whitby.id.au>
Signed-off-by: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-ixp4xx')
-rw-r--r-- | arch/arm/mach-ixp4xx/Kconfig | 8 | ||||
-rw-r--r-- | arch/arm/mach-ixp4xx/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/mach-ixp4xx/nas100d-pci.c | 77 | ||||
-rw-r--r-- | arch/arm/mach-ixp4xx/nas100d-power.c | 69 | ||||
-rw-r--r-- | arch/arm/mach-ixp4xx/nas100d-setup.c | 133 |
5 files changed, 288 insertions, 0 deletions
diff --git a/arch/arm/mach-ixp4xx/Kconfig b/arch/arm/mach-ixp4xx/Kconfig index 385285851cb5..daadc78e271b 100644 --- a/arch/arm/mach-ixp4xx/Kconfig +++ b/arch/arm/mach-ixp4xx/Kconfig | |||
@@ -71,6 +71,14 @@ config ARCH_PRPMC1100 | |||
71 | PrPCM1100 Processor Mezanine Module. For more information on | 71 | PrPCM1100 Processor Mezanine Module. For more information on |
72 | this platform, see <file:Documentation/arm/IXP4xx>. | 72 | this platform, see <file:Documentation/arm/IXP4xx>. |
73 | 73 | ||
74 | config MACH_NAS100D | ||
75 | bool | ||
76 | prompt "NAS100D" | ||
77 | help | ||
78 | Say 'Y' here if you want your kernel to support Iomega's | ||
79 | NAS 100d device. For more information on this platform, | ||
80 | see http://www.nslu2-linux.org/wiki/NAS100d/HomePage | ||
81 | |||
74 | # | 82 | # |
75 | # Avila and IXDP share the same source for now. Will change in future | 83 | # Avila and IXDP share the same source for now. Will change in future |
76 | # | 84 | # |
diff --git a/arch/arm/mach-ixp4xx/Makefile b/arch/arm/mach-ixp4xx/Makefile index 7a15629c18d0..0471044fa179 100644 --- a/arch/arm/mach-ixp4xx/Makefile +++ b/arch/arm/mach-ixp4xx/Makefile | |||
@@ -9,4 +9,5 @@ obj-$(CONFIG_MACH_IXDPG425) += ixdpg425-pci.o coyote-setup.o | |||
9 | obj-$(CONFIG_ARCH_ADI_COYOTE) += coyote-pci.o coyote-setup.o | 9 | obj-$(CONFIG_ARCH_ADI_COYOTE) += coyote-pci.o coyote-setup.o |
10 | obj-$(CONFIG_MACH_GTWX5715) += gtwx5715-pci.o gtwx5715-setup.o | 10 | obj-$(CONFIG_MACH_GTWX5715) += gtwx5715-pci.o gtwx5715-setup.o |
11 | obj-$(CONFIG_MACH_NSLU2) += nslu2-pci.o nslu2-setup.o nslu2-power.o | 11 | obj-$(CONFIG_MACH_NSLU2) += nslu2-pci.o nslu2-setup.o nslu2-power.o |
12 | obj-$(CONFIG_MACH_NAS100D) += nas100d-pci.o nas100d-setup.o nas100d-power.o | ||
12 | 13 | ||
diff --git a/arch/arm/mach-ixp4xx/nas100d-pci.c b/arch/arm/mach-ixp4xx/nas100d-pci.c new file mode 100644 index 000000000000..9bd029462359 --- /dev/null +++ b/arch/arm/mach-ixp4xx/nas100d-pci.c | |||
@@ -0,0 +1,77 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-ixp4xx/nas100d-pci.c | ||
3 | * | ||
4 | * NAS 100d board-level PCI initialization | ||
5 | * | ||
6 | * based on ixdp425-pci.c: | ||
7 | * Copyright (C) 2002 Intel Corporation. | ||
8 | * Copyright (C) 2003-2004 MontaVista Software, Inc. | ||
9 | * | ||
10 | * Maintainer: http://www.nslu2-linux.org/ | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify | ||
13 | * it under the terms of the GNU General Public License version 2 as | ||
14 | * published by the Free Software Foundation. | ||
15 | * | ||
16 | */ | ||
17 | |||
18 | #include <linux/config.h> | ||
19 | #include <linux/pci.h> | ||
20 | #include <linux/init.h> | ||
21 | |||
22 | #include <asm/mach/pci.h> | ||
23 | #include <asm/mach-types.h> | ||
24 | |||
25 | void __init nas100d_pci_preinit(void) | ||
26 | { | ||
27 | set_irq_type(IRQ_NAS100D_PCI_INTA, IRQT_LOW); | ||
28 | set_irq_type(IRQ_NAS100D_PCI_INTB, IRQT_LOW); | ||
29 | set_irq_type(IRQ_NAS100D_PCI_INTC, IRQT_LOW); | ||
30 | set_irq_type(IRQ_NAS100D_PCI_INTD, IRQT_LOW); | ||
31 | set_irq_type(IRQ_NAS100D_PCI_INTE, IRQT_LOW); | ||
32 | |||
33 | gpio_line_isr_clear(NAS100D_PCI_INTA_PIN); | ||
34 | gpio_line_isr_clear(NAS100D_PCI_INTB_PIN); | ||
35 | gpio_line_isr_clear(NAS100D_PCI_INTC_PIN); | ||
36 | gpio_line_isr_clear(NAS100D_PCI_INTD_PIN); | ||
37 | gpio_line_isr_clear(NAS100D_PCI_INTE_PIN); | ||
38 | |||
39 | ixp4xx_pci_preinit(); | ||
40 | } | ||
41 | |||
42 | static int __init nas100d_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | ||
43 | { | ||
44 | static int pci_irq_table[NAS100D_PCI_MAX_DEV][NAS100D_PCI_IRQ_LINES] = | ||
45 | { | ||
46 | { IRQ_NAS100D_PCI_INTA, -1, -1 }, | ||
47 | { IRQ_NAS100D_PCI_INTB, -1, -1 }, | ||
48 | { IRQ_NAS100D_PCI_INTC, IRQ_NAS100D_PCI_INTD, IRQ_NAS100D_PCI_INTE }, | ||
49 | }; | ||
50 | |||
51 | int irq = -1; | ||
52 | |||
53 | if (slot >= 1 && slot <= NAS100D_PCI_MAX_DEV && | ||
54 | pin >= 1 && pin <= NAS100D_PCI_IRQ_LINES) | ||
55 | irq = pci_irq_table[slot-1][pin-1]; | ||
56 | |||
57 | return irq; | ||
58 | } | ||
59 | |||
60 | struct hw_pci __initdata nas100d_pci = { | ||
61 | .nr_controllers = 1, | ||
62 | .preinit = nas100d_pci_preinit, | ||
63 | .swizzle = pci_std_swizzle, | ||
64 | .setup = ixp4xx_setup, | ||
65 | .scan = ixp4xx_scan_bus, | ||
66 | .map_irq = nas100d_map_irq, | ||
67 | }; | ||
68 | |||
69 | int __init nas100d_pci_init(void) | ||
70 | { | ||
71 | if (machine_is_nas100d()) | ||
72 | pci_common_init(&nas100d_pci); | ||
73 | |||
74 | return 0; | ||
75 | } | ||
76 | |||
77 | subsys_initcall(nas100d_pci_init); | ||
diff --git a/arch/arm/mach-ixp4xx/nas100d-power.c b/arch/arm/mach-ixp4xx/nas100d-power.c new file mode 100644 index 000000000000..c74a19004390 --- /dev/null +++ b/arch/arm/mach-ixp4xx/nas100d-power.c | |||
@@ -0,0 +1,69 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-ixp4xx/nas100d-power.c | ||
3 | * | ||
4 | * NAS 100d Power/Reset driver | ||
5 | * | ||
6 | * Copyright (C) 2005 Tower Technologies | ||
7 | * | ||
8 | * based on nas100d-io.c | ||
9 | * Copyright (C) 2004 Karen Spearel | ||
10 | * | ||
11 | * Author: Alessandro Zummo <a.zummo@towertech.it> | ||
12 | * Maintainers: http://www.nslu2-linux.org/ | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or modify | ||
15 | * it under the terms of the GNU General Public License version 2 as | ||
16 | * published by the Free Software Foundation. | ||
17 | * | ||
18 | */ | ||
19 | |||
20 | #include <linux/module.h> | ||
21 | #include <linux/reboot.h> | ||
22 | #include <linux/interrupt.h> | ||
23 | |||
24 | #include <asm/mach-types.h> | ||
25 | |||
26 | extern void ctrl_alt_del(void); | ||
27 | |||
28 | static irqreturn_t nas100d_reset_handler(int irq, void *dev_id, struct pt_regs *regs) | ||
29 | { | ||
30 | /* Signal init to do the ctrlaltdel action, this will bypass init if | ||
31 | * it hasn't started and do a kernel_restart. | ||
32 | */ | ||
33 | ctrl_alt_del(); | ||
34 | |||
35 | return IRQ_HANDLED; | ||
36 | } | ||
37 | |||
38 | static int __init nas100d_power_init(void) | ||
39 | { | ||
40 | if (!(machine_is_nas100d())) | ||
41 | return 0; | ||
42 | |||
43 | set_irq_type(NAS100D_RB_IRQ, IRQT_LOW); | ||
44 | |||
45 | gpio_line_isr_clear(NAS100D_RB_GPIO); | ||
46 | |||
47 | if (request_irq(NAS100D_RB_IRQ, &nas100d_reset_handler, | ||
48 | SA_INTERRUPT, "NAS100D reset button", NULL) < 0) { | ||
49 | |||
50 | printk(KERN_DEBUG "Reset Button IRQ %d not available\n", | ||
51 | NAS100D_RB_IRQ); | ||
52 | |||
53 | return -EIO; | ||
54 | } | ||
55 | |||
56 | return 0; | ||
57 | } | ||
58 | |||
59 | static void __exit nas100d_power_exit(void) | ||
60 | { | ||
61 | free_irq(NAS100D_RB_IRQ, NULL); | ||
62 | } | ||
63 | |||
64 | module_init(nas100d_power_init); | ||
65 | module_exit(nas100d_power_exit); | ||
66 | |||
67 | MODULE_AUTHOR("Alessandro Zummo <a.zummo@towertech.it>"); | ||
68 | MODULE_DESCRIPTION("NAS100D Power/Reset driver"); | ||
69 | MODULE_LICENSE("GPL"); | ||
diff --git a/arch/arm/mach-ixp4xx/nas100d-setup.c b/arch/arm/mach-ixp4xx/nas100d-setup.c new file mode 100644 index 000000000000..bde9648e7afc --- /dev/null +++ b/arch/arm/mach-ixp4xx/nas100d-setup.c | |||
@@ -0,0 +1,133 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-ixp4xx/nas100d-setup.c | ||
3 | * | ||
4 | * NAS 100d board-setup | ||
5 | * | ||
6 | * based ixdp425-setup.c: | ||
7 | * Copyright (C) 2003-2004 MontaVista Software, Inc. | ||
8 | * | ||
9 | * Author: Alessandro Zummo <a.zummo@towertech.it> | ||
10 | * Author: Rod Whitby <rod@whitby.id.au> | ||
11 | * Maintainers: http://www.nslu2-linux.org/ | ||
12 | * | ||
13 | */ | ||
14 | |||
15 | #include <linux/kernel.h> | ||
16 | #include <linux/serial.h> | ||
17 | #include <linux/serial_8250.h> | ||
18 | |||
19 | #include <asm/mach-types.h> | ||
20 | #include <asm/mach/arch.h> | ||
21 | #include <asm/mach/flash.h> | ||
22 | |||
23 | static struct flash_platform_data nas100d_flash_data = { | ||
24 | .map_name = "cfi_probe", | ||
25 | .width = 2, | ||
26 | }; | ||
27 | |||
28 | static struct resource nas100d_flash_resource = { | ||
29 | .start = NAS100D_FLASH_BASE, | ||
30 | .end = NAS100D_FLASH_BASE + NAS100D_FLASH_SIZE, | ||
31 | .flags = IORESOURCE_MEM, | ||
32 | }; | ||
33 | |||
34 | static struct platform_device nas100d_flash = { | ||
35 | .name = "IXP4XX-Flash", | ||
36 | .id = 0, | ||
37 | .dev.platform_data = &nas100d_flash_data, | ||
38 | .num_resources = 1, | ||
39 | .resource = &nas100d_flash_resource, | ||
40 | }; | ||
41 | |||
42 | static struct ixp4xx_i2c_pins nas100d_i2c_gpio_pins = { | ||
43 | .sda_pin = NAS100D_SDA_PIN, | ||
44 | .scl_pin = NAS100D_SCL_PIN, | ||
45 | }; | ||
46 | |||
47 | static struct platform_device nas100d_i2c_controller = { | ||
48 | .name = "IXP4XX-I2C", | ||
49 | .id = 0, | ||
50 | .dev.platform_data = &nas100d_i2c_gpio_pins, | ||
51 | .num_resources = 0, | ||
52 | }; | ||
53 | |||
54 | static struct resource nas100d_uart_resources[] = { | ||
55 | { | ||
56 | .start = IXP4XX_UART1_BASE_PHYS, | ||
57 | .end = IXP4XX_UART1_BASE_PHYS + 0x0fff, | ||
58 | .flags = IORESOURCE_MEM, | ||
59 | }, | ||
60 | { | ||
61 | .start = IXP4XX_UART2_BASE_PHYS, | ||
62 | .end = IXP4XX_UART2_BASE_PHYS + 0x0fff, | ||
63 | .flags = IORESOURCE_MEM, | ||
64 | } | ||
65 | }; | ||
66 | |||
67 | static struct plat_serial8250_port nas100d_uart_data[] = { | ||
68 | { | ||
69 | .mapbase = IXP4XX_UART1_BASE_PHYS, | ||
70 | .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET, | ||
71 | .irq = IRQ_IXP4XX_UART1, | ||
72 | .flags = UPF_BOOT_AUTOCONF, | ||
73 | .iotype = UPIO_MEM, | ||
74 | .regshift = 2, | ||
75 | .uartclk = IXP4XX_UART_XTAL, | ||
76 | }, | ||
77 | { | ||
78 | .mapbase = IXP4XX_UART2_BASE_PHYS, | ||
79 | .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET, | ||
80 | .irq = IRQ_IXP4XX_UART2, | ||
81 | .flags = UPF_BOOT_AUTOCONF, | ||
82 | .iotype = UPIO_MEM, | ||
83 | .regshift = 2, | ||
84 | .uartclk = IXP4XX_UART_XTAL, | ||
85 | }, | ||
86 | { } | ||
87 | }; | ||
88 | |||
89 | static struct platform_device nas100d_uart = { | ||
90 | .name = "serial8250", | ||
91 | .id = PLAT8250_DEV_PLATFORM, | ||
92 | .dev.platform_data = nas100d_uart_data, | ||
93 | .num_resources = 2, | ||
94 | .resource = nas100d_uart_resources, | ||
95 | }; | ||
96 | |||
97 | static struct platform_device *nas100d_devices[] __initdata = { | ||
98 | &nas100d_i2c_controller, | ||
99 | &nas100d_flash, | ||
100 | &nas100d_uart, | ||
101 | }; | ||
102 | |||
103 | static void nas100d_power_off(void) | ||
104 | { | ||
105 | /* This causes the box to drop the power and go dead. */ | ||
106 | |||
107 | /* enable the pwr cntl gpio */ | ||
108 | gpio_line_config(NAS100D_PO_GPIO, IXP4XX_GPIO_OUT); | ||
109 | |||
110 | /* do the deed */ | ||
111 | gpio_line_set(NAS100D_PO_GPIO, IXP4XX_GPIO_HIGH); | ||
112 | } | ||
113 | |||
114 | static void __init nas100d_init(void) | ||
115 | { | ||
116 | ixp4xx_sys_init(); | ||
117 | |||
118 | pm_power_off = nas100d_power_off; | ||
119 | |||
120 | platform_add_devices(nas100d_devices, ARRAY_SIZE(nas100d_devices)); | ||
121 | } | ||
122 | |||
123 | MACHINE_START(NAS100D, "Iomega NAS 100d") | ||
124 | /* Maintainer: www.nslu2-linux.org */ | ||
125 | .phys_ram = PHYS_OFFSET, | ||
126 | .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, | ||
127 | .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xFFFC, | ||
128 | .boot_params = 0x00000100, | ||
129 | .map_io = ixp4xx_map_io, | ||
130 | .init_irq = ixp4xx_init_irq, | ||
131 | .timer = &ixp4xx_timer, | ||
132 | .init_machine = nas100d_init, | ||
133 | MACHINE_END | ||