diff options
author | Sean MacLennan <smaclennan@pikatech.com> | 2008-01-21 12:55:29 -0500 |
---|---|---|
committer | Josh Boyer <jwboyer@linux.vnet.ibm.com> | 2008-01-25 08:09:42 -0500 |
commit | f9bdedb2c5f2952f33e4f88038e5c48e27144cda (patch) | |
tree | c4386c4962449aa364281e38e0bfc03cb2b20eaa /arch | |
parent | 3f8fc3e0c7445dab78a81d68d995e9150f895d7e (diff) |
[POWERPC] 4xx: PIKA Warp base platform
Add the base platform support for the PIKA Warp boards.
Signed-off-by: Sean MacLennan <smaclennan@pikatech.com>
Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/Kconfig | 2 | ||||
-rw-r--r-- | arch/powerpc/platforms/44x/Kconfig | 14 | ||||
-rw-r--r-- | arch/powerpc/platforms/44x/Makefile | 2 | ||||
-rw-r--r-- | arch/powerpc/platforms/44x/warp-nand.c | 105 | ||||
-rw-r--r-- | arch/powerpc/platforms/44x/warp.c | 153 |
5 files changed, 275 insertions, 1 deletions
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 9ae800d81f89..5e1083829d82 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig | |||
@@ -480,7 +480,7 @@ config MCA | |||
480 | config PCI | 480 | config PCI |
481 | bool "PCI support" if 40x || CPM2 || PPC_83xx || PPC_85xx || PPC_86xx \ | 481 | bool "PCI support" if 40x || CPM2 || PPC_83xx || PPC_85xx || PPC_86xx \ |
482 | || PPC_MPC52xx || (EMBEDDED && (PPC_PSERIES || PPC_ISERIES)) \ | 482 | || PPC_MPC52xx || (EMBEDDED && (PPC_PSERIES || PPC_ISERIES)) \ |
483 | || PPC_PS3 | 483 | || PPC_PS3 || 44x |
484 | default y if !40x && !CPM2 && !8xx && !PPC_83xx \ | 484 | default y if !40x && !CPM2 && !8xx && !PPC_83xx \ |
485 | && !PPC_85xx && !PPC_86xx | 485 | && !PPC_85xx && !PPC_86xx |
486 | default PCI_PERMEDIA if !4xx && !CPM2 && !8xx | 486 | default PCI_PERMEDIA if !4xx && !CPM2 && !8xx |
diff --git a/arch/powerpc/platforms/44x/Kconfig b/arch/powerpc/platforms/44x/Kconfig index c3e4e8c3c467..c062c4cbbed5 100644 --- a/arch/powerpc/platforms/44x/Kconfig +++ b/arch/powerpc/platforms/44x/Kconfig | |||
@@ -54,6 +54,19 @@ config RAINIER | |||
54 | help | 54 | help |
55 | This option enables support for the AMCC PPC440GRX evaluation board. | 55 | This option enables support for the AMCC PPC440GRX evaluation board. |
56 | 56 | ||
57 | config WARP | ||
58 | bool "PIKA Warp" | ||
59 | depends on 44x | ||
60 | default n | ||
61 | select 440EP | ||
62 | help | ||
63 | This option enables support for the PIKA Warp(tm) Appliance. The Warp | ||
64 | is a small computer replacement with up to 9 ports of FXO/FXS plus VOIP | ||
65 | stations and trunks. | ||
66 | |||
67 | See http://www.pikatechnologies.com/ and follow the "PIKA for Computer | ||
68 | Telephony Developers" link for more information. | ||
69 | |||
57 | #config LUAN | 70 | #config LUAN |
58 | # bool "Luan" | 71 | # bool "Luan" |
59 | # depends on 44x | 72 | # depends on 44x |
@@ -76,6 +89,7 @@ config 440EP | |||
76 | select PPC_FPU | 89 | select PPC_FPU |
77 | select IBM440EP_ERR42 | 90 | select IBM440EP_ERR42 |
78 | select IBM_NEW_EMAC_ZMII | 91 | select IBM_NEW_EMAC_ZMII |
92 | select USB_ARCH_HAS_OHCI | ||
79 | 93 | ||
80 | config 440EPX | 94 | config 440EPX |
81 | bool | 95 | bool |
diff --git a/arch/powerpc/platforms/44x/Makefile b/arch/powerpc/platforms/44x/Makefile index a2a0dc13e9e9..0864d4f1cbc2 100644 --- a/arch/powerpc/platforms/44x/Makefile +++ b/arch/powerpc/platforms/44x/Makefile | |||
@@ -5,3 +5,5 @@ obj-$(CONFIG_BAMBOO) += bamboo.o | |||
5 | obj-$(CONFIG_SEQUOIA) += sequoia.o | 5 | obj-$(CONFIG_SEQUOIA) += sequoia.o |
6 | obj-$(CONFIG_KATMAI) += katmai.o | 6 | obj-$(CONFIG_KATMAI) += katmai.o |
7 | obj-$(CONFIG_RAINIER) += rainier.o | 7 | obj-$(CONFIG_RAINIER) += rainier.o |
8 | obj-$(CONFIG_WARP) += warp.o | ||
9 | obj-$(CONFIG_WARP) += warp-nand.o | ||
diff --git a/arch/powerpc/platforms/44x/warp-nand.c b/arch/powerpc/platforms/44x/warp-nand.c new file mode 100644 index 000000000000..84ab78ff8c03 --- /dev/null +++ b/arch/powerpc/platforms/44x/warp-nand.c | |||
@@ -0,0 +1,105 @@ | |||
1 | /* | ||
2 | * PIKA Warp(tm) NAND flash specific routines | ||
3 | * | ||
4 | * Copyright (c) 2008 PIKA Technologies | ||
5 | * Sean MacLennan <smaclennan@pikatech.com> | ||
6 | */ | ||
7 | |||
8 | #include <linux/platform_device.h> | ||
9 | #include <linux/mtd/mtd.h> | ||
10 | #include <linux/mtd/map.h> | ||
11 | #include <linux/mtd/partitions.h> | ||
12 | #include <linux/mtd/nand.h> | ||
13 | #include <linux/mtd/ndfc.h> | ||
14 | |||
15 | #ifdef CONFIG_MTD_NAND_NDFC | ||
16 | |||
17 | #define CS_NAND_0 1 /* use chip select 1 for NAND device 0 */ | ||
18 | |||
19 | #define WARP_NAND_FLASH_REG_ADDR 0xD0000000UL | ||
20 | #define WARP_NAND_FLASH_REG_SIZE 0x2000 | ||
21 | |||
22 | static struct resource warp_ndfc = { | ||
23 | .start = WARP_NAND_FLASH_REG_ADDR, | ||
24 | .end = WARP_NAND_FLASH_REG_ADDR + WARP_NAND_FLASH_REG_SIZE, | ||
25 | .flags = IORESOURCE_MEM, | ||
26 | }; | ||
27 | |||
28 | static struct mtd_partition nand_parts[] = { | ||
29 | { | ||
30 | .name = "kernel", | ||
31 | .offset = 0, | ||
32 | .size = 0x0200000 | ||
33 | }, | ||
34 | { | ||
35 | .name = "root", | ||
36 | .offset = 0x0200000, | ||
37 | .size = 0x3400000 | ||
38 | }, | ||
39 | { | ||
40 | .name = "user", | ||
41 | .offset = 0x3600000, | ||
42 | .size = 0x0A00000 | ||
43 | }, | ||
44 | }; | ||
45 | |||
46 | struct ndfc_controller_settings warp_ndfc_settings = { | ||
47 | .ccr_settings = (NDFC_CCR_BS(CS_NAND_0) | NDFC_CCR_ARAC1), | ||
48 | .ndfc_erpn = 0, | ||
49 | }; | ||
50 | |||
51 | static struct ndfc_chip_settings warp_chip0_settings = { | ||
52 | .bank_settings = 0x80002222, | ||
53 | }; | ||
54 | |||
55 | struct platform_nand_ctrl warp_nand_ctrl = { | ||
56 | .priv = &warp_ndfc_settings, | ||
57 | }; | ||
58 | |||
59 | static struct platform_device warp_ndfc_device = { | ||
60 | .name = "ndfc-nand", | ||
61 | .id = 0, | ||
62 | .dev = { | ||
63 | .platform_data = &warp_nand_ctrl, | ||
64 | }, | ||
65 | .num_resources = 1, | ||
66 | .resource = &warp_ndfc, | ||
67 | }; | ||
68 | |||
69 | static struct nand_ecclayout nand_oob_16 = { | ||
70 | .eccbytes = 3, | ||
71 | .eccpos = { 0, 1, 2, 3, 6, 7 }, | ||
72 | .oobfree = { {.offset = 8, .length = 16} } | ||
73 | }; | ||
74 | |||
75 | static struct platform_nand_chip warp_nand_chip0 = { | ||
76 | .nr_chips = 1, | ||
77 | .chip_offset = CS_NAND_0, | ||
78 | .nr_partitions = ARRAY_SIZE(nand_parts), | ||
79 | .partitions = nand_parts, | ||
80 | .chip_delay = 50, | ||
81 | .ecclayout = &nand_oob_16, | ||
82 | .priv = &warp_chip0_settings, | ||
83 | }; | ||
84 | |||
85 | static struct platform_device warp_nand_device = { | ||
86 | .name = "ndfc-chip", | ||
87 | .id = 0, | ||
88 | .num_resources = 1, | ||
89 | .resource = &warp_ndfc, | ||
90 | .dev = { | ||
91 | .platform_data = &warp_nand_chip0, | ||
92 | .parent = &warp_ndfc_device.dev, | ||
93 | } | ||
94 | }; | ||
95 | |||
96 | static int warp_setup_nand_flash(void) | ||
97 | { | ||
98 | platform_device_register(&warp_ndfc_device); | ||
99 | platform_device_register(&warp_nand_device); | ||
100 | |||
101 | return 0; | ||
102 | } | ||
103 | device_initcall(warp_setup_nand_flash); | ||
104 | |||
105 | #endif | ||
diff --git a/arch/powerpc/platforms/44x/warp.c b/arch/powerpc/platforms/44x/warp.c new file mode 100644 index 000000000000..8f01563dbd2a --- /dev/null +++ b/arch/powerpc/platforms/44x/warp.c | |||
@@ -0,0 +1,153 @@ | |||
1 | /* | ||
2 | * PIKA Warp(tm) board specific routines | ||
3 | * | ||
4 | * Copyright (c) 2008 PIKA Technologies | ||
5 | * Sean MacLennan <smaclennan@pikatech.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms of the GNU General Public License as published by the | ||
9 | * Free Software Foundation; either version 2 of the License, or (at your | ||
10 | * option) any later version. | ||
11 | */ | ||
12 | #include <linux/init.h> | ||
13 | #include <linux/of_platform.h> | ||
14 | #include <linux/kthread.h> | ||
15 | |||
16 | #include <asm/machdep.h> | ||
17 | #include <asm/prom.h> | ||
18 | #include <asm/udbg.h> | ||
19 | #include <asm/time.h> | ||
20 | #include <asm/uic.h> | ||
21 | |||
22 | #include "44x.h" | ||
23 | |||
24 | |||
25 | static __initdata struct of_device_id warp_of_bus[] = { | ||
26 | { .compatible = "ibm,plb4", }, | ||
27 | { .compatible = "ibm,opb", }, | ||
28 | { .compatible = "ibm,ebc", }, | ||
29 | {}, | ||
30 | }; | ||
31 | |||
32 | static int __init warp_device_probe(void) | ||
33 | { | ||
34 | of_platform_bus_probe(NULL, warp_of_bus, NULL); | ||
35 | return 0; | ||
36 | } | ||
37 | machine_device_initcall(warp, warp_device_probe); | ||
38 | |||
39 | static int __init warp_probe(void) | ||
40 | { | ||
41 | unsigned long root = of_get_flat_dt_root(); | ||
42 | |||
43 | return of_flat_dt_is_compatible(root, "pika,warp"); | ||
44 | } | ||
45 | |||
46 | define_machine(warp) { | ||
47 | .name = "Warp", | ||
48 | .probe = warp_probe, | ||
49 | .progress = udbg_progress, | ||
50 | .init_IRQ = uic_init_tree, | ||
51 | .get_irq = uic_get_irq, | ||
52 | .restart = ppc44x_reset_system, | ||
53 | .calibrate_decr = generic_calibrate_decr, | ||
54 | }; | ||
55 | |||
56 | |||
57 | #define LED_GREEN (0x80000000 >> 0) | ||
58 | #define LED_RED (0x80000000 >> 1) | ||
59 | |||
60 | |||
61 | /* This is for the power LEDs 1 = on, 0 = off, -1 = leave alone */ | ||
62 | void warp_set_power_leds(int green, int red) | ||
63 | { | ||
64 | static void __iomem *gpio_base = NULL; | ||
65 | unsigned leds; | ||
66 | |||
67 | if (gpio_base == NULL) { | ||
68 | struct device_node *np; | ||
69 | |||
70 | /* Power LEDS are on the second GPIO controller */ | ||
71 | np = of_find_compatible_node(NULL, NULL, "ibm,gpio-440EP"); | ||
72 | if (np) | ||
73 | np = of_find_compatible_node(np, NULL, "ibm,gpio-440EP"); | ||
74 | if (np == NULL) { | ||
75 | printk(KERN_ERR __FILE__ ": Unable to find gpio\n"); | ||
76 | return; | ||
77 | } | ||
78 | |||
79 | gpio_base = of_iomap(np, 0); | ||
80 | of_node_put(np); | ||
81 | if (gpio_base == NULL) { | ||
82 | printk(KERN_ERR __FILE__ ": Unable to map gpio"); | ||
83 | return; | ||
84 | } | ||
85 | } | ||
86 | |||
87 | leds = in_be32(gpio_base); | ||
88 | |||
89 | switch (green) { | ||
90 | case 0: leds &= ~LED_GREEN; break; | ||
91 | case 1: leds |= LED_GREEN; break; | ||
92 | } | ||
93 | switch (red) { | ||
94 | case 0: leds &= ~LED_RED; break; | ||
95 | case 1: leds |= LED_RED; break; | ||
96 | } | ||
97 | |||
98 | out_be32(gpio_base, leds); | ||
99 | } | ||
100 | EXPORT_SYMBOL(warp_set_power_leds); | ||
101 | |||
102 | |||
103 | #ifdef CONFIG_SENSORS_AD7414 | ||
104 | static int pika_dtm_thread(void __iomem *fpga) | ||
105 | { | ||
106 | extern int ad7414_get_temp(int index); | ||
107 | |||
108 | while (!kthread_should_stop()) { | ||
109 | int temp = ad7414_get_temp(0); | ||
110 | |||
111 | out_be32(fpga, temp); | ||
112 | |||
113 | set_current_state(TASK_INTERRUPTIBLE); | ||
114 | schedule_timeout(HZ); | ||
115 | } | ||
116 | |||
117 | return 0; | ||
118 | } | ||
119 | |||
120 | static int __init pika_dtm_start(void) | ||
121 | { | ||
122 | struct task_struct *dtm_thread; | ||
123 | struct device_node *np; | ||
124 | struct resource res; | ||
125 | void __iomem *fpga; | ||
126 | |||
127 | np = of_find_compatible_node(NULL, NULL, "pika,fpga"); | ||
128 | if (np == NULL) | ||
129 | return -ENOENT; | ||
130 | |||
131 | /* We do not call of_iomap here since it would map in the entire | ||
132 | * fpga space, which is over 8k. | ||
133 | */ | ||
134 | if (of_address_to_resource(np, 0, &res)) { | ||
135 | of_node_put(np); | ||
136 | return -ENOENT; | ||
137 | } | ||
138 | of_node_put(np); | ||
139 | |||
140 | fpga = ioremap(res.start + 0x20, 4); | ||
141 | if (fpga == NULL) | ||
142 | return -ENOENT; | ||
143 | |||
144 | dtm_thread = kthread_run(pika_dtm_thread, fpga + 0x20, "pika-dtm"); | ||
145 | if (IS_ERR(dtm_thread)) { | ||
146 | iounmap(fpga); | ||
147 | return PTR_ERR(dtm_thread); | ||
148 | } | ||
149 | |||
150 | return 0; | ||
151 | } | ||
152 | device_initcall(pika_dtm_start); | ||
153 | #endif | ||