aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-orion5x/Makefile2
-rw-r--r--arch/arm/mach-orion5x/common.h2
-rw-r--r--arch/arm/mach-orion5x/db88f5281-setup.c47
-rw-r--r--arch/arm/mach-orion5x/dns323-setup.c54
-rw-r--r--arch/arm/mach-orion5x/gpio.c7
-rw-r--r--arch/arm/mach-orion5x/kurobox_pro-setup.c45
-rw-r--r--arch/arm/mach-orion5x/mpp.c163
-rw-r--r--arch/arm/mach-orion5x/mpp.h74
-rw-r--r--arch/arm/mach-orion5x/rd88f5182-setup.c48
-rw-r--r--arch/arm/mach-orion5x/ts209-setup.c48
10 files changed, 376 insertions, 114 deletions
diff --git a/arch/arm/mach-orion5x/Makefile b/arch/arm/mach-orion5x/Makefile
index 9301bf55910b..55da46eeab8d 100644
--- a/arch/arm/mach-orion5x/Makefile
+++ b/arch/arm/mach-orion5x/Makefile
@@ -1,4 +1,4 @@
1obj-y += common.o addr-map.o pci.o gpio.o irq.o 1obj-y += common.o addr-map.o pci.o gpio.o irq.o mpp.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
diff --git a/arch/arm/mach-orion5x/common.h b/arch/arm/mach-orion5x/common.h
index da37c204bc38..97db8d88f3db 100644
--- a/arch/arm/mach-orion5x/common.h
+++ b/arch/arm/mach-orion5x/common.h
@@ -48,7 +48,7 @@ int orion5x_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin);
48 * Valid GPIO pins according to MPP setup, used by machine-setup. 48 * Valid GPIO pins according to MPP setup, used by machine-setup.
49 * (/mach-orion/gpio.c). 49 * (/mach-orion/gpio.c).
50 */ 50 */
51void orion5x_gpio_set_valid_pins(u32 pins); 51void orion5x_gpio_set_valid(unsigned pin, int valid);
52void gpio_display(void); /* debug */ 52void gpio_display(void); /* debug */
53 53
54struct machine_desc; 54struct machine_desc;
diff --git a/arch/arm/mach-orion5x/db88f5281-setup.c b/arch/arm/mach-orion5x/db88f5281-setup.c
index eca76b3348bc..3fee400c81ab 100644
--- a/arch/arm/mach-orion5x/db88f5281-setup.c
+++ b/arch/arm/mach-orion5x/db88f5281-setup.c
@@ -27,6 +27,7 @@
27#include <asm/arch/orion5x.h> 27#include <asm/arch/orion5x.h>
28#include <asm/plat-orion/orion_nand.h> 28#include <asm/plat-orion/orion_nand.h>
29#include "common.h" 29#include "common.h"
30#include "mpp.h"
30 31
31/***************************************************************************** 32/*****************************************************************************
32 * DB-88F5281 on board devices 33 * DB-88F5281 on board devices
@@ -298,6 +299,30 @@ static struct i2c_board_info __initdata db88f5281_i2c_rtc = {
298/***************************************************************************** 299/*****************************************************************************
299 * General Setup 300 * General Setup
300 ****************************************************************************/ 301 ****************************************************************************/
302static struct orion5x_mpp_mode db88f5281_mpp_modes[] __initdata = {
303 { 0, MPP_GPIO }, /* USB Over Current */
304 { 1, MPP_GPIO }, /* USB Vbat input */
305 { 2, MPP_PCI_ARB }, /* PCI_REQn[2] */
306 { 3, MPP_PCI_ARB }, /* PCI_GNTn[2] */
307 { 4, MPP_PCI_ARB }, /* PCI_REQn[3] */
308 { 5, MPP_PCI_ARB }, /* PCI_GNTn[3] */
309 { 6, MPP_GPIO }, /* JP0, CON17.2 */
310 { 7, MPP_GPIO }, /* JP1, CON17.1 */
311 { 8, MPP_GPIO }, /* JP2, CON11.2 */
312 { 9, MPP_GPIO }, /* JP3, CON11.3 */
313 { 10, MPP_GPIO }, /* RTC int */
314 { 11, MPP_GPIO }, /* Baud Rate Generator */
315 { 12, MPP_GPIO }, /* PCI int 1 */
316 { 13, MPP_GPIO }, /* PCI int 2 */
317 { 14, MPP_NAND }, /* NAND_REn[2] */
318 { 15, MPP_NAND }, /* NAND_WEn[2] */
319 { 16, MPP_UART }, /* UART1_RX */
320 { 17, MPP_UART }, /* UART1_TX */
321 { 18, MPP_UART }, /* UART1_CTSn */
322 { 19, MPP_UART }, /* UART1_RTSn */
323 { -1 },
324};
325
301static void __init db88f5281_init(void) 326static void __init db88f5281_init(void)
302{ 327{
303 /* 328 /*
@@ -305,26 +330,8 @@ static void __init db88f5281_init(void)
305 */ 330 */
306 orion5x_init(); 331 orion5x_init();
307 332
308 /* 333 orion5x_mpp_conf(db88f5281_mpp_modes);
309 * Setup Multiplexing Pins: 334 orion5x_write(MPP_DEV_CTRL, 0); /* DEV_D[31:16] */
310 * MPP0: GPIO (USB Over Current) MPP1: GPIO (USB Vbat input)
311 * MPP2: PCI_REQn[2] MPP3: PCI_GNTn[2]
312 * MPP4: PCI_REQn[3] MPP5: PCI_GNTn[3]
313 * MPP6: GPIO (JP0, CON17.2) MPP7: GPIO (JP1, CON17.1)
314 * MPP8: GPIO (JP2, CON11.2) MPP9: GPIO (JP3, CON11.3)
315 * MPP10: GPIO (RTC int) MPP11: GPIO (Baud Rate Generator)
316 * MPP12: GPIO (PCI int 1) MPP13: GPIO (PCI int 2)
317 * MPP14: NAND_REn[2] MPP15: NAND_WEn[2]
318 * MPP16: UART1_RX MPP17: UART1_TX
319 * MPP18: UART1_CTS MPP19: UART1_RTS
320 * MPP-DEV: DEV_D[16:31]
321 */
322 orion5x_write(MPP_0_7_CTRL, 0x00222203);
323 orion5x_write(MPP_8_15_CTRL, 0x44000000);
324 orion5x_write(MPP_16_19_CTRL, 0);
325 orion5x_write(MPP_DEV_CTRL, 0);
326
327 orion5x_gpio_set_valid_pins(0x00003fc3);
328 335
329 /* 336 /*
330 * Configure peripherals. 337 * Configure peripherals.
diff --git a/arch/arm/mach-orion5x/dns323-setup.c b/arch/arm/mach-orion5x/dns323-setup.c
index 9ec53501b2a8..05ce66048741 100644
--- a/arch/arm/mach-orion5x/dns323-setup.c
+++ b/arch/arm/mach-orion5x/dns323-setup.c
@@ -27,6 +27,7 @@
27#include <asm/mach/pci.h> 27#include <asm/mach/pci.h>
28#include <asm/arch/orion5x.h> 28#include <asm/arch/orion5x.h>
29#include "common.h" 29#include "common.h"
30#include "mpp.h"
30 31
31#define DNS323_GPIO_LED_RIGHT_AMBER 1 32#define DNS323_GPIO_LED_RIGHT_AMBER 1
32#define DNS323_GPIO_LED_LEFT_AMBER 2 33#define DNS323_GPIO_LED_LEFT_AMBER 2
@@ -212,6 +213,29 @@ static struct platform_device dns323_button_device = {
212/**************************************************************************** 213/****************************************************************************
213 * General Setup 214 * General Setup
214 */ 215 */
216static struct orion5x_mpp_mode dns323_mpp_modes[] __initdata = {
217 { 0, MPP_PCIE_RST_OUTn },
218 { 1, MPP_GPIO }, /* right amber LED (sata ch0) */
219 { 2, MPP_GPIO }, /* left amber LED (sata ch1) */
220 { 3, MPP_UNUSED },
221 { 4, MPP_GPIO }, /* power button LED */
222 { 5, MPP_GPIO }, /* power button LED */
223 { 6, MPP_GPIO }, /* GMT G751-2f overtemp */
224 { 7, MPP_GPIO }, /* M41T80 nIRQ/OUT/SQW */
225 { 8, MPP_GPIO }, /* triggers power off */
226 { 9, MPP_GPIO }, /* power button switch */
227 { 10, MPP_GPIO }, /* reset button switch */
228 { 11, MPP_UNUSED },
229 { 12, MPP_UNUSED },
230 { 13, MPP_UNUSED },
231 { 14, MPP_UNUSED },
232 { 15, MPP_UNUSED },
233 { 16, MPP_UNUSED },
234 { 17, MPP_UNUSED },
235 { 18, MPP_UNUSED },
236 { 19, MPP_UNUSED },
237 { -1 },
238};
215 239
216/* 240/*
217 * On the DNS-323 the following devices are attached via I2C: 241 * On the DNS-323 the following devices are attached via I2C:
@@ -247,34 +271,8 @@ static void __init dns323_init(void)
247 /* Setup basic Orion functions. Need to be called early. */ 271 /* Setup basic Orion functions. Need to be called early. */
248 orion5x_init(); 272 orion5x_init();
249 273
250 /* set MPP to 0 as D-Link's 2.6.12.6 kernel did */ 274 orion5x_mpp_conf(dns323_mpp_modes);
251 orion5x_write(MPP_0_7_CTRL, 0); 275 orion5x_write(MPP_DEV_CTRL, 0); /* DEV_D[31:16] */
252 orion5x_write(MPP_8_15_CTRL, 0);
253 orion5x_write(MPP_16_19_CTRL, 0);
254 orion5x_write(MPP_DEV_CTRL, 0);
255
256 /* Define used GPIO pins
257
258 GPIO Map:
259
260 | 0 | | PEX_RST_OUT (not controlled by GPIO)
261 | 1 | Out | right amber LED (= sata ch0 LED) (low-active)
262 | 2 | Out | left amber LED (= sata ch1 LED) (low-active)
263 | 3 | Out | //unknown//
264 | 4 | Out | power button LED (low-active, together with pin #5)
265 | 5 | Out | power button LED (low-active, together with pin #4)
266 | 6 | In | GMT G751-2f overtemp. shutdown signal (low-active)
267 | 7 | In | M41T80 nIRQ/OUT/SQW signal
268 | 8 | Out | triggers power off (high-active)
269 | 9 | In | power button switch (low-active)
270 | 10 | In | reset button switch (low-active)
271 | 11 | Out | //unknown//
272 | 12 | Out | //unknown//
273 | 13 | Out | //unknown//
274 | 14 | Out | //unknown//
275 | 15 | Out | //unknown//
276 */
277 orion5x_gpio_set_valid_pins(0x07f6);
278 276
279 /* 277 /*
280 * Configure peripherals. 278 * Configure peripherals.
diff --git a/arch/arm/mach-orion5x/gpio.c b/arch/arm/mach-orion5x/gpio.c
index 8108c316c426..9fba6a16dc1b 100644
--- a/arch/arm/mach-orion5x/gpio.c
+++ b/arch/arm/mach-orion5x/gpio.c
@@ -24,9 +24,12 @@ static DEFINE_SPINLOCK(gpio_lock);
24static unsigned long gpio_valid[BITS_TO_LONGS(GPIO_MAX)]; 24static unsigned long gpio_valid[BITS_TO_LONGS(GPIO_MAX)];
25static const char *gpio_label[GPIO_MAX]; /* non null for allocated GPIOs */ 25static const char *gpio_label[GPIO_MAX]; /* non null for allocated GPIOs */
26 26
27void __init orion5x_gpio_set_valid_pins(u32 pins) 27void __init orion5x_gpio_set_valid(unsigned pin, int valid)
28{ 28{
29 gpio_valid[0] = pins; 29 if (valid)
30 __set_bit(pin, gpio_valid);
31 else
32 __clear_bit(pin, gpio_valid);
30} 33}
31 34
32/* 35/*
diff --git a/arch/arm/mach-orion5x/kurobox_pro-setup.c b/arch/arm/mach-orion5x/kurobox_pro-setup.c
index 61755fe175cd..f0997a7ba6d2 100644
--- a/arch/arm/mach-orion5x/kurobox_pro-setup.c
+++ b/arch/arm/mach-orion5x/kurobox_pro-setup.c
@@ -25,6 +25,7 @@
25#include <asm/arch/orion5x.h> 25#include <asm/arch/orion5x.h>
26#include <asm/plat-orion/orion_nand.h> 26#include <asm/plat-orion/orion_nand.h>
27#include "common.h" 27#include "common.h"
28#include "mpp.h"
28 29
29/***************************************************************************** 30/*****************************************************************************
30 * KUROBOX-PRO Info 31 * KUROBOX-PRO Info
@@ -179,6 +180,29 @@ static struct mv_sata_platform_data kurobox_pro_sata_data = {
179/***************************************************************************** 180/*****************************************************************************
180 * General Setup 181 * General Setup
181 ****************************************************************************/ 182 ****************************************************************************/
183static struct orion5x_mpp_mode kurobox_pro_mpp_modes[] __initdata = {
184 { 0, MPP_UNUSED },
185 { 1, MPP_UNUSED },
186 { 2, MPP_GPIO }, /* GPIO Micon */
187 { 3, MPP_GPIO }, /* GPIO Rtc */
188 { 4, MPP_UNUSED },
189 { 5, MPP_UNUSED },
190 { 6, MPP_NAND }, /* NAND Flash REn */
191 { 7, MPP_NAND }, /* NAND Flash WEn */
192 { 8, MPP_UNUSED },
193 { 9, MPP_UNUSED },
194 { 10, MPP_UNUSED },
195 { 11, MPP_UNUSED },
196 { 12, MPP_SATA_LED }, /* SATA 0 presence */
197 { 13, MPP_SATA_LED }, /* SATA 1 presence */
198 { 14, MPP_SATA_LED }, /* SATA 0 active */
199 { 15, MPP_SATA_LED }, /* SATA 1 active */
200 { 16, MPP_UNUSED },
201 { 17, MPP_UNUSED },
202 { 18, MPP_UNUSED },
203 { 19, MPP_UNUSED },
204 { -1 },
205};
182 206
183static void __init kurobox_pro_init(void) 207static void __init kurobox_pro_init(void)
184{ 208{
@@ -187,26 +211,7 @@ static void __init kurobox_pro_init(void)
187 */ 211 */
188 orion5x_init(); 212 orion5x_init();
189 213
190 /* 214 orion5x_mpp_conf(kurobox_pro_mpp_modes);
191 * Setup Multiplexing Pins --
192 * MPP[0-1] Not used
193 * MPP[2] GPIO Micon
194 * MPP[3] GPIO RTC
195 * MPP[4-5] Not used
196 * MPP[6] Nand Flash REn
197 * MPP[7] Nand Flash WEn
198 * MPP[8-11] Not used
199 * MPP[12] SATA 0 presence Indication
200 * MPP[13] SATA 1 presence Indication
201 * MPP[14] SATA 0 active Indication
202 * MPP[15] SATA 1 active indication
203 * MPP[16-19] Not used
204 */
205 orion5x_write(MPP_0_7_CTRL, 0x44220003);
206 orion5x_write(MPP_8_15_CTRL, 0x55550000);
207 orion5x_write(MPP_16_19_CTRL, 0x0);
208
209 orion5x_gpio_set_valid_pins(0x0000000c);
210 215
211 /* 216 /*
212 * Configure peripherals. 217 * Configure peripherals.
diff --git a/arch/arm/mach-orion5x/mpp.c b/arch/arm/mach-orion5x/mpp.c
new file mode 100644
index 000000000000..a48cadb01590
--- /dev/null
+++ b/arch/arm/mach-orion5x/mpp.c
@@ -0,0 +1,163 @@
1/*
2 * arch/arm/mach-orion5x/mpp.c
3 *
4 * MPP functions for Marvell Orion 5x SoCs
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/mbus.h>
14#include <asm/hardware.h>
15#include <asm/io.h>
16#include "common.h"
17#include "mpp.h"
18
19static int is_5181l(void)
20{
21 u32 dev;
22 u32 rev;
23
24 orion5x_pcie_id(&dev, &rev);
25
26 return !!(dev == MV88F5181_DEV_ID && rev >= MV88F5181L_REV_A0);
27}
28
29static int is_5182(void)
30{
31 u32 dev;
32 u32 rev;
33
34 orion5x_pcie_id(&dev, &rev);
35
36 return !!(dev == MV88F5182_DEV_ID);
37}
38
39static int is_5281(void)
40{
41 u32 dev;
42 u32 rev;
43
44 orion5x_pcie_id(&dev, &rev);
45
46 return !!(dev == MV88F5281_DEV_ID);
47}
48
49static int __init determine_type_encoding(int mpp, enum orion5x_mpp_type type)
50{
51 switch (type) {
52 case MPP_UNUSED:
53 case MPP_GPIO:
54 if (mpp == 0)
55 return 3;
56 if (mpp >= 1 && mpp <= 15)
57 return 0;
58 if (mpp >= 16 && mpp <= 19) {
59 if (is_5182())
60 return 5;
61 if (type == MPP_UNUSED)
62 return 0;
63 }
64 return -1;
65
66 case MPP_PCIE_RST_OUTn:
67 if (mpp == 0)
68 return 0;
69 return -1;
70
71 case MPP_PCI_ARB:
72 if (mpp >= 0 && mpp <= 7)
73 return 2;
74 return -1;
75
76 case MPP_PCI_PMEn:
77 if (mpp == 2)
78 return 3;
79 return -1;
80
81 case MPP_GIGE:
82 if (mpp >= 8 && mpp <= 19)
83 return 1;
84 return -1;
85
86 case MPP_NAND:
87 if (is_5182() || is_5281()) {
88 if (mpp >= 4 && mpp <= 7)
89 return 4;
90 if (mpp >= 12 && mpp <= 17)
91 return 4;
92 }
93 return -1;
94
95 case MPP_PCI_CLK:
96 if (is_5181l() && mpp >= 6 && mpp <= 7)
97 return 5;
98 return -1;
99
100 case MPP_SATA_LED:
101 if (is_5182()) {
102 if (mpp >= 4 && mpp <= 7)
103 return 5;
104 if (mpp >= 12 && mpp <= 15)
105 return 5;
106 }
107 return -1;
108
109 case MPP_UART:
110 if (mpp >= 16 && mpp <= 19)
111 return 0;
112 return -1;
113 }
114
115 printk(KERN_INFO "unknown MPP type %d\n", type);
116
117 return -1;
118}
119
120void __init orion5x_mpp_conf(struct orion5x_mpp_mode *mode)
121{
122 u32 mpp_0_7_ctrl = readl(MPP_0_7_CTRL);
123 u32 mpp_8_15_ctrl = readl(MPP_8_15_CTRL);
124 u32 mpp_16_19_ctrl = readl(MPP_16_19_CTRL);
125
126 while (mode->mpp >= 0) {
127 u32 *reg;
128 int num_type;
129 int shift;
130
131 if (mode->mpp >= 0 && mode->mpp <= 7)
132 reg = &mpp_0_7_ctrl;
133 else if (mode->mpp >= 8 && mode->mpp <= 15)
134 reg = &mpp_8_15_ctrl;
135 else if (mode->mpp >= 16 && mode->mpp <= 19)
136 reg = &mpp_16_19_ctrl;
137 else {
138 printk(KERN_ERR "orion5x_mpp_conf: invalid MPP "
139 "(%d)\n", mode->mpp);
140 continue;
141 }
142
143 num_type = determine_type_encoding(mode->mpp, mode->type);
144 if (num_type < 0) {
145 printk(KERN_ERR "orion5x_mpp_conf: invalid MPP "
146 "combination (%d, %d)\n", mode->mpp,
147 mode->type);
148 continue;
149 }
150
151 shift = (mode->mpp & 7) << 2;
152 *reg &= ~(0xf << shift);
153 *reg |= (num_type & 0xf) << shift;
154
155 orion5x_gpio_set_valid(mode->mpp, !!(mode->type == MPP_GPIO));
156
157 mode++;
158 }
159
160 writel(mpp_0_7_ctrl, MPP_0_7_CTRL);
161 writel(mpp_8_15_ctrl, MPP_8_15_CTRL);
162 writel(mpp_16_19_ctrl, MPP_16_19_CTRL);
163}
diff --git a/arch/arm/mach-orion5x/mpp.h b/arch/arm/mach-orion5x/mpp.h
new file mode 100644
index 000000000000..290e610dc012
--- /dev/null
+++ b/arch/arm/mach-orion5x/mpp.h
@@ -0,0 +1,74 @@
1#ifndef __ARCH_ORION5X_MPP_H
2#define __ARCH_ORION5X_MPP_H
3
4enum orion5x_mpp_type {
5 /*
6 * This MPP is unused.
7 */
8 MPP_UNUSED,
9
10 /*
11 * This MPP pin is used as a generic GPIO pin. Valid for
12 * MPPs 0-15 and device bus data pins 16-31. On 5182, also
13 * valid for MPPs 16-19.
14 */
15 MPP_GPIO,
16
17 /*
18 * This MPP is used as PCIe_RST_OUTn pin. Valid for
19 * MPP 0 only.
20 */
21 MPP_PCIE_RST_OUTn,
22
23 /*
24 * This MPP is used as PCI arbiter pin (REQn/GNTn).
25 * Valid for MPPs 0-7 only.
26 */
27 MPP_PCI_ARB,
28
29 /*
30 * This MPP is used as PCI_PMEn pin. Valid for MPP 2 only.
31 */
32 MPP_PCI_PMEn,
33
34 /*
35 * This MPP is used as GigE half-duplex (COL, CRS) or GMII
36 * (RXERR, CRS, TXERR, TXD[7:4], RXD[7:4]) pin. Valid for
37 * MPPs 8-19 only.
38 */
39 MPP_GIGE,
40
41 /*
42 * This MPP is used as NAND REn/WEn pin. Valid for MPPs
43 * 4-7 and 12-17 only, and only on the 5181l/5182/5281.
44 */
45 MPP_NAND,
46
47 /*
48 * This MPP is used as a PCI clock output pin. Valid for
49 * MPPs 6-7 only, and only on the 5181l.
50 */
51 MPP_PCI_CLK,
52
53 /*
54 * This MPP is used as a SATA presence/activity LED.
55 * Valid for MPPs 4-7 and 12-15 only, and only on the 5182.
56 */
57 MPP_SATA_LED,
58
59 /*
60 * This MPP is used as UART1 RXD/TXD/CTSn/RTSn pin.
61 * Valid for MPPs 16-19 only.
62 */
63 MPP_UART,
64};
65
66struct orion5x_mpp_mode {
67 int mpp;
68 enum orion5x_mpp_type type;
69};
70
71void orion5x_mpp_conf(struct orion5x_mpp_mode *mode);
72
73
74#endif
diff --git a/arch/arm/mach-orion5x/rd88f5182-setup.c b/arch/arm/mach-orion5x/rd88f5182-setup.c
index 403ba9a0c9bd..44ad5de87b79 100644
--- a/arch/arm/mach-orion5x/rd88f5182-setup.c
+++ b/arch/arm/mach-orion5x/rd88f5182-setup.c
@@ -26,6 +26,7 @@
26#include <asm/mach/pci.h> 26#include <asm/mach/pci.h>
27#include <asm/arch/orion5x.h> 27#include <asm/arch/orion5x.h>
28#include "common.h" 28#include "common.h"
29#include "mpp.h"
29 30
30/***************************************************************************** 31/*****************************************************************************
31 * RD-88F5182 Info 32 * RD-88F5182 Info
@@ -241,6 +242,30 @@ static struct mv_sata_platform_data rd88f5182_sata_data = {
241/***************************************************************************** 242/*****************************************************************************
242 * General Setup 243 * General Setup
243 ****************************************************************************/ 244 ****************************************************************************/
245static struct orion5x_mpp_mode rd88f5182_mpp_modes[] __initdata = {
246 { 0, MPP_GPIO }, /* Debug Led */
247 { 1, MPP_GPIO }, /* Reset Switch */
248 { 2, MPP_UNUSED },
249 { 3, MPP_GPIO }, /* RTC Int */
250 { 4, MPP_GPIO },
251 { 5, MPP_GPIO },
252 { 6, MPP_GPIO }, /* PCI_intA */
253 { 7, MPP_GPIO }, /* PCI_intB */
254 { 8, MPP_UNUSED },
255 { 9, MPP_UNUSED },
256 { 10, MPP_UNUSED },
257 { 11, MPP_UNUSED },
258 { 12, MPP_SATA_LED }, /* SATA 0 presence */
259 { 13, MPP_SATA_LED }, /* SATA 1 presence */
260 { 14, MPP_SATA_LED }, /* SATA 0 active */
261 { 15, MPP_SATA_LED }, /* SATA 1 active */
262 { 16, MPP_UNUSED },
263 { 17, MPP_UNUSED },
264 { 18, MPP_UNUSED },
265 { 19, MPP_UNUSED },
266 { -1 },
267};
268
244static void __init rd88f5182_init(void) 269static void __init rd88f5182_init(void)
245{ 270{
246 /* 271 /*
@@ -248,22 +273,9 @@ static void __init rd88f5182_init(void)
248 */ 273 */
249 orion5x_init(); 274 orion5x_init();
250 275
276 orion5x_mpp_conf(rd88f5182_mpp_modes);
277
251 /* 278 /*
252 * Setup Multiplexing Pins --
253 * MPP[0] Debug Led (GPIO - Out)
254 * MPP[1] Debug Led (GPIO - Out)
255 * MPP[2] N/A
256 * MPP[3] RTC_Int (GPIO - In)
257 * MPP[4] GPIO
258 * MPP[5] GPIO
259 * MPP[6] PCI_intA (GPIO - In)
260 * MPP[7] PCI_intB (GPIO - In)
261 * MPP[8-11] N/A
262 * MPP[12] SATA 0 presence Indication
263 * MPP[13] SATA 1 presence Indication
264 * MPP[14] SATA 0 active Indication
265 * MPP[15] SATA 1 active indication
266 * MPP[16-19] Not used
267 * MPP[20] PCI Clock to MV88F5182 279 * MPP[20] PCI Clock to MV88F5182
268 * MPP[21] PCI Clock to mini PCI CON11 280 * MPP[21] PCI Clock to mini PCI CON11
269 * MPP[22] USB 0 over current indication 281 * MPP[22] USB 0 over current indication
@@ -272,12 +284,6 @@ static void __init rd88f5182_init(void)
272 * MPP[25] USB 0 over current enable 284 * MPP[25] USB 0 over current enable
273 */ 285 */
274 286
275 orion5x_write(MPP_0_7_CTRL, 0x00000003);
276 orion5x_write(MPP_8_15_CTRL, 0x55550000);
277 orion5x_write(MPP_16_19_CTRL, 0x5555);
278
279 orion5x_gpio_set_valid_pins(0x000000fb);
280
281 /* 287 /*
282 * Configure peripherals. 288 * Configure peripherals.
283 */ 289 */
diff --git a/arch/arm/mach-orion5x/ts209-setup.c b/arch/arm/mach-orion5x/ts209-setup.c
index 0ec067fcb514..5ad7ad9b9461 100644
--- a/arch/arm/mach-orion5x/ts209-setup.c
+++ b/arch/arm/mach-orion5x/ts209-setup.c
@@ -28,6 +28,7 @@
28#include <asm/mach/pci.h> 28#include <asm/mach/pci.h>
29#include <asm/arch/orion5x.h> 29#include <asm/arch/orion5x.h>
30#include "common.h" 30#include "common.h"
31#include "mpp.h"
31 32
32#define QNAP_TS209_NOR_BOOT_BASE 0xf4000000 33#define QNAP_TS209_NOR_BOOT_BASE 0xf4000000
33#define QNAP_TS209_NOR_BOOT_SIZE SZ_8M 34#define QNAP_TS209_NOR_BOOT_SIZE SZ_8M
@@ -332,6 +333,30 @@ static struct mv_sata_platform_data qnap_ts209_sata_data = {
332 333
333 * General Setup 334 * General Setup
334 ****************************************************************************/ 335 ****************************************************************************/
336static struct orion5x_mpp_mode ts209_mpp_modes[] __initdata = {
337 { 0, MPP_UNUSED },
338 { 1, MPP_GPIO }, /* USB copy button */
339 { 2, MPP_GPIO }, /* Load defaults button */
340 { 3, MPP_GPIO }, /* GPIO RTC */
341 { 4, MPP_UNUSED },
342 { 5, MPP_UNUSED },
343 { 6, MPP_GPIO }, /* PCI Int A */
344 { 7, MPP_GPIO }, /* PCI Int B */
345 { 8, MPP_UNUSED },
346 { 9, MPP_UNUSED },
347 { 10, MPP_UNUSED },
348 { 11, MPP_UNUSED },
349 { 12, MPP_SATA_LED }, /* SATA 0 presence */
350 { 13, MPP_SATA_LED }, /* SATA 1 presence */
351 { 14, MPP_SATA_LED }, /* SATA 0 active */
352 { 15, MPP_SATA_LED }, /* SATA 1 active */
353 { 16, MPP_UART }, /* UART1 RXD */
354 { 17, MPP_UART }, /* UART1 TXD */
355 { 18, MPP_GPIO }, /* SW_RST */
356 { 19, MPP_UNUSED },
357 { -1 },
358};
359
335/* 360/*
336 * QNAP TS-[12]09 specific power off method via UART1-attached PIC 361 * QNAP TS-[12]09 specific power off method via UART1-attached PIC
337 */ 362 */
@@ -364,33 +389,14 @@ static void __init qnap_ts209_init(void)
364 */ 389 */
365 orion5x_init(); 390 orion5x_init();
366 391
392 orion5x_mpp_conf(ts209_mpp_modes);
393
367 /* 394 /*
368 * Setup Multiplexing Pins --
369 * MPP[0] Reserved
370 * MPP[1] USB copy button (0 active)
371 * MPP[2] Load defaults button (0 active)
372 * MPP[3] GPIO RTC
373 * MPP[4-5] Reserved
374 * MPP[6] PCI Int A
375 * MPP[7] PCI Int B
376 * MPP[8-11] Reserved
377 * MPP[12] SATA 0 presence
378 * MPP[13] SATA 1 presence
379 * MPP[14] SATA 0 active
380 * MPP[15] SATA 1 active
381 * MPP[16] UART1 RXD
382 * MPP[17] UART1 TXD
383 * MPP[18] SW_RST (0 active)
384 * MPP[19] Reserved
385 * MPP[20] PCI clock 0 395 * MPP[20] PCI clock 0
386 * MPP[21] PCI clock 1 396 * MPP[21] PCI clock 1
387 * MPP[22] USB 0 over current 397 * MPP[22] USB 0 over current
388 * MPP[23-25] Reserved 398 * MPP[23-25] Reserved
389 */ 399 */
390 orion5x_write(MPP_0_7_CTRL, 0x3);
391 orion5x_write(MPP_8_15_CTRL, 0x55550000);
392 orion5x_write(MPP_16_19_CTRL, 0x5500);
393 orion5x_gpio_set_valid_pins(0x3cc0fff);
394 400
395 /* 401 /*
396 * Configure peripherals. 402 * Configure peripherals.