aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-orion
diff options
context:
space:
mode:
authorHerbert Valerio Riedel <hvr@gnu.org>2007-11-12 03:05:55 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-01-26 10:03:56 -0500
commit555a36561be191eb01658a5229aa11b4e4a8a7f0 (patch)
tree60c8d18fbfa1ac87cc5bbd7ec559529513f66f15 /arch/arm/mach-orion
parentc9e3de941a1694aeab60a10bd39eb710c975010d (diff)
[ARM] Orion: add support for Orion/MV88F5181 based D-Link DNS-323
With this patch USB, SATA (via sata_mv), Ethernet, RTC, LEDs and NOR Flash work. Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org> Acked-by: Tzachi Perelstein <tzachi@marvell.com> Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-orion')
-rw-r--r--arch/arm/mach-orion/Kconfig7
-rw-r--r--arch/arm/mach-orion/Makefile1
-rw-r--r--arch/arm/mach-orion/dns323-setup.c322
3 files changed, 330 insertions, 0 deletions
diff --git a/arch/arm/mach-orion/Kconfig b/arch/arm/mach-orion/Kconfig
index dc929511837f..bdaed867e450 100644
--- a/arch/arm/mach-orion/Kconfig
+++ b/arch/arm/mach-orion/Kconfig
@@ -23,6 +23,13 @@ config MACH_KUROBOX_PRO
23 Say 'Y' here if you want your kernel to support the 23 Say 'Y' here if you want your kernel to support the
24 KuroBox Pro platform. 24 KuroBox Pro platform.
25 25
26config MACH_DNS323
27 bool "D-Link DNS-323"
28 select I2C_BOARDINFO
29 help
30 Say 'Y' here if you want your kernel to support the
31 D-Link DNS-323 platform.
32
26endmenu 33endmenu
27 34
28endif 35endif
diff --git a/arch/arm/mach-orion/Makefile b/arch/arm/mach-orion/Makefile
index caf20ff921d8..237ce98ad0ef 100644
--- a/arch/arm/mach-orion/Makefile
+++ b/arch/arm/mach-orion/Makefile
@@ -2,3 +2,4 @@ obj-y += common.o addr-map.o pci.o gpio.o irq.o time.o
2obj-$(CONFIG_MACH_DB88F5281) += db88f5281-setup.o 2obj-$(CONFIG_MACH_DB88F5281) += db88f5281-setup.o
3obj-$(CONFIG_MACH_RD88F5182) += rd88f5182-setup.o 3obj-$(CONFIG_MACH_RD88F5182) += rd88f5182-setup.o
4obj-$(CONFIG_MACH_KUROBOX_PRO) += kurobox_pro-setup.o 4obj-$(CONFIG_MACH_KUROBOX_PRO) += kurobox_pro-setup.o
5obj-$(CONFIG_MACH_DNS323) += dns323-setup.o
diff --git a/arch/arm/mach-orion/dns323-setup.c b/arch/arm/mach-orion/dns323-setup.c
new file mode 100644
index 000000000000..c8a806f249c6
--- /dev/null
+++ b/arch/arm/mach-orion/dns323-setup.c
@@ -0,0 +1,322 @@
1/*
2 * arch/arm/mach-orion/dns323-setup.c
3 *
4 * Copyright (C) 2007 Herbert Valerio Riedel <hvr@gnu.org>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as
8 * published by the Free Software Foundation; either version 2 of the
9 * License, or (at your option) any later version.
10 *
11 */
12
13#include <linux/kernel.h>
14#include <linux/init.h>
15#include <linux/platform_device.h>
16#include <linux/pci.h>
17#include <linux/irq.h>
18#include <linux/mtd/physmap.h>
19#include <linux/mv643xx_eth.h>
20#include <linux/leds.h>
21#include <linux/gpio_keys.h>
22#include <linux/input.h>
23#include <linux/i2c.h>
24#include <asm/mach-types.h>
25#include <asm/gpio.h>
26#include <asm/mach/arch.h>
27#include <asm/mach/pci.h>
28#include <asm/arch/orion.h>
29#include <asm/arch/platform.h>
30#include "common.h"
31
32#define DNS323_GPIO_LED_RIGHT_AMBER 1
33#define DNS323_GPIO_LED_LEFT_AMBER 2
34#define DNS323_GPIO_LED_POWER 5
35#define DNS323_GPIO_OVERTEMP 6
36#define DNS323_GPIO_RTC 7
37#define DNS323_GPIO_POWER_OFF 8
38#define DNS323_GPIO_KEY_POWER 9
39#define DNS323_GPIO_KEY_RESET 10
40
41/****************************************************************************
42 * PCI setup
43 */
44
45static int __init dns323_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
46{
47 /* PCI-E */
48 if (dev->bus->number == orion_pcie_local_bus_nr())
49 return IRQ_ORION_PCIE0_INT;
50
51 pr_err("%s: requested mapping for unknown bus\n", __func__);
52
53 return -1;
54}
55
56static struct hw_pci dns323_pci __initdata = {
57 .nr_controllers = 1,
58 .swizzle = pci_std_swizzle,
59 .setup = orion_pci_sys_setup,
60 .scan = orion_pci_sys_scan_bus,
61 .map_irq = dns323_pci_map_irq,
62};
63
64static int __init dns323_pci_init(void)
65{
66 if (machine_is_dns323())
67 pci_common_init(&dns323_pci);
68
69 return 0;
70}
71
72subsys_initcall(dns323_pci_init);
73
74/****************************************************************************
75 * Ethernet
76 */
77
78static struct mv643xx_eth_platform_data dns323_eth_data = {
79 .phy_addr = 8,
80 .force_phy_addr = 1,
81};
82
83/****************************************************************************
84 * 8MiB NOR flash (Spansion S29GL064M90TFIR4)
85 *
86 * Layout as used by D-Link:
87 * 0x00000000-0x00010000 : "MTD1"
88 * 0x00010000-0x00020000 : "MTD2"
89 * 0x00020000-0x001a0000 : "Linux Kernel"
90 * 0x001a0000-0x007d0000 : "File System"
91 * 0x007d0000-0x00800000 : "u-boot"
92 */
93
94#define DNS323_NOR_BOOT_BASE 0xf4000000
95#define DNS323_NOR_BOOT_SIZE SZ_8M
96
97static struct mtd_partition dns323_partitions[] = {
98 {
99 .name = "MTD1",
100 .size = 0x00010000,
101 .offset = 0,
102 }, {
103 .name = "MTD2",
104 .size = 0x00010000,
105 .offset = 0x00010000,
106 }, {
107 .name = "Linux Kernel",
108 .size = 0x00180000,
109 .offset = 0x00020000,
110 }, {
111 .name = "File System",
112 .size = 0x00630000,
113 .offset = 0x001A0000,
114 }, {
115 .name = "u-boot",
116 .size = 0x00030000,
117 .offset = 0x007d0000,
118 }
119};
120
121static struct physmap_flash_data dns323_nor_flash_data = {
122 .width = 1,
123 .parts = dns323_partitions,
124 .nr_parts = ARRAY_SIZE(dns323_partitions)
125};
126
127static struct resource dns323_nor_flash_resource = {
128 .flags = IORESOURCE_MEM,
129 .start = DNS323_NOR_BOOT_BASE,
130 .end = DNS323_NOR_BOOT_BASE + DNS323_NOR_BOOT_SIZE - 1,
131};
132
133static struct platform_device dns323_nor_flash = {
134 .name = "physmap-flash",
135 .id = 0,
136 .dev = { .platform_data = &dns323_nor_flash_data, },
137 .resource = &dns323_nor_flash_resource,
138 .num_resources = 1,
139};
140
141/****************************************************************************
142 * GPIO LEDs (simple - doesn't use hardware blinking support)
143 */
144
145static struct gpio_led dns323_leds[] = {
146 {
147 .name = "power:blue",
148 .gpio = DNS323_GPIO_LED_POWER,
149 .active_low = 1,
150 }, {
151 .name = "right:amber",
152 .gpio = DNS323_GPIO_LED_RIGHT_AMBER,
153 .active_low = 1,
154 }, {
155 .name = "left:amber",
156 .gpio = DNS323_GPIO_LED_LEFT_AMBER,
157 .active_low = 1,
158 },
159};
160
161static struct gpio_led_platform_data dns323_led_data = {
162 .num_leds = ARRAY_SIZE(dns323_leds),
163 .leds = dns323_leds,
164};
165
166static struct platform_device dns323_gpio_leds = {
167 .name = "leds-gpio",
168 .id = -1,
169 .dev = { .platform_data = &dns323_led_data, },
170};
171
172/****************************************************************************
173 * GPIO Attached Keys
174 */
175
176static struct gpio_keys_button dns323_buttons[] = {
177 {
178 .code = KEY_RESTART,
179 .gpio = DNS323_GPIO_KEY_RESET,
180 .desc = "Reset Button",
181 .active_low = 1,
182 },
183 {
184 .code = KEY_POWER,
185 .gpio = DNS323_GPIO_KEY_POWER,
186 .desc = "Power Button",
187 .active_low = 1,
188 }
189};
190
191static struct gpio_keys_platform_data dns323_button_data = {
192 .buttons = dns323_buttons,
193 .nbuttons = ARRAY_SIZE(dns323_buttons),
194};
195
196static struct platform_device dns323_button_device = {
197 .name = "gpio-keys",
198 .id = -1,
199 .num_resources = 0,
200 .dev = { .platform_data = &dns323_button_data, },
201};
202
203/****************************************************************************
204 * General Setup
205 */
206
207static struct platform_device *dns323_plat_devices[] __initdata = {
208 &dns323_nor_flash,
209 &dns323_gpio_leds,
210 &dns323_button_device,
211};
212
213/*
214 * On the DNS-323 the following devices are attached via I2C:
215 *
216 * i2c addr | chip | description
217 * 0x3e | GMT G760Af | fan speed PWM controller
218 * 0x48 | GMT G751-2f | temp. sensor and therm. watchdog (LM75 compatible)
219 * 0x68 | ST M41T80 | RTC w/ alarm
220 */
221static struct i2c_board_info __initdata dns323_i2c_devices[] = {
222 {
223 I2C_BOARD_INFO("g760a", 0x3e),
224 .type = "g760a",
225 },
226#if 0
227 /* this entry requires the new-style driver model lm75 driver,
228 * for the meantime "insmod lm75.ko force_lm75=0,0x48" is needed */
229 {
230 I2C_BOARD_INFO("lm75", 0x48),
231 .type = "g751",
232 },
233#endif
234 {
235 I2C_BOARD_INFO("rtc-m41t80", 0x68),
236 .type = "m41t80",
237 }
238};
239
240/* DNS-323 specific power off method */
241static void dns323_power_off(void)
242{
243 pr_info("%s: triggering power-off...\n", __func__);
244 gpio_set_value(DNS323_GPIO_POWER_OFF, 1);
245}
246
247static void __init dns323_init(void)
248{
249 /* Setup basic Orion functions. Need to be called early. */
250 orion_init();
251
252 /* setup flash mapping
253 * CS3 holds a 8 MB Spansion S29GL064M90TFIR4
254 */
255 orion_setup_cpu_win(ORION_DEV_BOOT, DNS323_NOR_BOOT_BASE,
256 DNS323_NOR_BOOT_SIZE, -1);
257
258 /* DNS-323 has a Marvell 88X7042 SATA controller attached via PCIE
259 *
260 * Open a special address decode windows for the PCIE WA.
261 */
262 orion_write(ORION_REGS_BASE | 0x20074, ORION_PCIE_WA_BASE);
263 orion_write(ORION_REGS_BASE | 0x20070,
264 (0x7941 | (((ORION_PCIE_WA_SIZE >> 16) - 1)) << 16));
265
266 /* set MPP to 0 as D-Link's 2.6.12.6 kernel did */
267 orion_write(MPP_0_7_CTRL, 0);
268 orion_write(MPP_8_15_CTRL, 0);
269 orion_write(MPP_16_19_CTRL, 0);
270 orion_write(MPP_DEV_CTRL, 0);
271
272 /* Define used GPIO pins
273
274 GPIO Map:
275
276 | 0 | | PEX_RST_OUT (not controlled by GPIO)
277 | 1 | Out | right amber LED (= sata ch0 LED) (low-active)
278 | 2 | Out | left amber LED (= sata ch1 LED) (low-active)
279 | 3 | Out | //unknown//
280 | 4 | Out | power button LED (low-active, together with pin #5)
281 | 5 | Out | power button LED (low-active, together with pin #4)
282 | 6 | In | GMT G751-2f overtemp. shutdown signal (low-active)
283 | 7 | In | M41T80 nIRQ/OUT/SQW signal
284 | 8 | Out | triggers power off (high-active)
285 | 9 | In | power button switch (low-active)
286 | 10 | In | reset button switch (low-active)
287 | 11 | Out | //unknown//
288 | 12 | Out | //unknown//
289 | 13 | Out | //unknown//
290 | 14 | Out | //unknown//
291 | 15 | Out | //unknown//
292 */
293 orion_gpio_set_valid_pins(0x07f6);
294
295 /* register dns323 specific power-off method */
296 if ((gpio_request(DNS323_GPIO_POWER_OFF, "POWEROFF") != 0)
297 || (gpio_direction_output(DNS323_GPIO_POWER_OFF, 0) != 0))
298 pr_err("DNS323: failed to setup power-off GPIO\n");
299
300 pm_power_off = dns323_power_off;
301
302 /* register flash and other platform devices */
303 platform_add_devices(dns323_plat_devices,
304 ARRAY_SIZE(dns323_plat_devices));
305
306 i2c_register_board_info(0, dns323_i2c_devices,
307 ARRAY_SIZE(dns323_i2c_devices));
308
309 orion_eth_init(&dns323_eth_data);
310}
311
312/* Warning: D-Link uses a wrong mach-type (=526) in their bootloader */
313MACHINE_START(DNS323, "D-Link DNS-323")
314 /* Maintainer: Herbert Valerio Riedel <hvr@gnu.org> */
315 .phys_io = ORION_REGS_BASE,
316 .io_pg_offst = ((ORION_REGS_BASE) >> 18) & 0xFFFC,
317 .boot_params = 0x00000100,
318 .init_machine = dns323_init,
319 .map_io = orion_map_io,
320 .init_irq = orion_init_irq,
321 .timer = &orion_timer,
322MACHINE_END