diff options
Diffstat (limited to 'arch/arm/mach-kirkwood')
-rw-r--r-- | arch/arm/mach-kirkwood/mpp.c | 58 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/mpp.h | 6 |
2 files changed, 3 insertions, 61 deletions
diff --git a/arch/arm/mach-kirkwood/mpp.c b/arch/arm/mach-kirkwood/mpp.c index 7ce201848067..b0a7d979a8ed 100644 --- a/arch/arm/mach-kirkwood/mpp.c +++ b/arch/arm/mach-kirkwood/mpp.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/io.h> | 14 | #include <linux/io.h> |
15 | #include <asm/gpio.h> | 15 | #include <asm/gpio.h> |
16 | #include <mach/hardware.h> | 16 | #include <mach/hardware.h> |
17 | #include <plat/mpp.h> | ||
17 | #include "common.h" | 18 | #include "common.h" |
18 | #include "mpp.h" | 19 | #include "mpp.h" |
19 | 20 | ||
@@ -36,61 +37,8 @@ static unsigned int __init kirkwood_variant(void) | |||
36 | return 0; | 37 | return 0; |
37 | } | 38 | } |
38 | 39 | ||
39 | #define MPP_CTRL(i) (DEV_BUS_VIRT_BASE + (i) * 4) | ||
40 | #define MPP_NR_REGS (1 + MPP_MAX/8) | ||
41 | |||
42 | void __init kirkwood_mpp_conf(unsigned int *mpp_list) | 40 | void __init kirkwood_mpp_conf(unsigned int *mpp_list) |
43 | { | 41 | { |
44 | u32 mpp_ctrl[MPP_NR_REGS]; | 42 | orion_mpp_conf(mpp_list, kirkwood_variant(), |
45 | unsigned int variant_mask; | 43 | MPP_MAX, DEV_BUS_VIRT_BASE); |
46 | int i; | ||
47 | |||
48 | variant_mask = kirkwood_variant(); | ||
49 | if (!variant_mask) | ||
50 | return; | ||
51 | |||
52 | printk(KERN_DEBUG "initial MPP regs:"); | ||
53 | for (i = 0; i < MPP_NR_REGS; i++) { | ||
54 | mpp_ctrl[i] = readl(MPP_CTRL(i)); | ||
55 | printk(" %08x", mpp_ctrl[i]); | ||
56 | } | ||
57 | printk("\n"); | ||
58 | |||
59 | for ( ; *mpp_list; mpp_list++) { | ||
60 | unsigned int num = MPP_NUM(*mpp_list); | ||
61 | unsigned int sel = MPP_SEL(*mpp_list); | ||
62 | int shift, gpio_mode; | ||
63 | |||
64 | if (num > MPP_MAX) { | ||
65 | printk(KERN_ERR "kirkwood_mpp_conf: invalid MPP " | ||
66 | "number (%u)\n", num); | ||
67 | continue; | ||
68 | } | ||
69 | if (!(*mpp_list & variant_mask)) { | ||
70 | printk(KERN_WARNING | ||
71 | "kirkwood_mpp_conf: requested MPP%u config " | ||
72 | "unavailable on this hardware\n", num); | ||
73 | continue; | ||
74 | } | ||
75 | |||
76 | shift = (num & 7) << 2; | ||
77 | mpp_ctrl[num / 8] &= ~(0xf << shift); | ||
78 | mpp_ctrl[num / 8] |= sel << shift; | ||
79 | |||
80 | gpio_mode = 0; | ||
81 | if (*mpp_list & MPP_INPUT_MASK) | ||
82 | gpio_mode |= GPIO_INPUT_OK; | ||
83 | if (*mpp_list & MPP_OUTPUT_MASK) | ||
84 | gpio_mode |= GPIO_OUTPUT_OK; | ||
85 | if (sel != 0) | ||
86 | gpio_mode = 0; | ||
87 | orion_gpio_set_valid(num, gpio_mode); | ||
88 | } | ||
89 | |||
90 | printk(KERN_DEBUG " final MPP regs:"); | ||
91 | for (i = 0; i < MPP_NR_REGS; i++) { | ||
92 | writel(mpp_ctrl[i], MPP_CTRL(i)); | ||
93 | printk(" %08x", mpp_ctrl[i]); | ||
94 | } | ||
95 | printk("\n"); | ||
96 | } | 44 | } |
diff --git a/arch/arm/mach-kirkwood/mpp.h b/arch/arm/mach-kirkwood/mpp.h index 9b0a94d85c3e..ac787957e2d9 100644 --- a/arch/arm/mach-kirkwood/mpp.h +++ b/arch/arm/mach-kirkwood/mpp.h | |||
@@ -22,14 +22,8 @@ | |||
22 | /* available on F6281 */ ((!!(_F6281)) << 17) | \ | 22 | /* available on F6281 */ ((!!(_F6281)) << 17) | \ |
23 | /* available on F6282 */ ((!!(_F6282)) << 18)) | 23 | /* available on F6282 */ ((!!(_F6282)) << 18)) |
24 | 24 | ||
25 | #define MPP_NUM(x) ((x) & 0xff) | ||
26 | #define MPP_SEL(x) (((x) >> 8) & 0xf) | ||
27 | |||
28 | /* num sel i o 6180 6190 6192 6281 6282 */ | 25 | /* num sel i o 6180 6190 6192 6281 6282 */ |
29 | 26 | ||
30 | #define MPP_INPUT_MASK MPP( 0, 0x0, 1, 0, 0, 0, 0, 0, 0 ) | ||
31 | #define MPP_OUTPUT_MASK MPP( 0, 0x0, 0, 1, 0, 0, 0, 0, 0 ) | ||
32 | |||
33 | #define MPP_F6180_MASK MPP( 0, 0x0, 0, 0, 1, 0, 0, 0, 0 ) | 27 | #define MPP_F6180_MASK MPP( 0, 0x0, 0, 0, 1, 0, 0, 0, 0 ) |
34 | #define MPP_F6190_MASK MPP( 0, 0x0, 0, 0, 0, 1, 0, 0, 0 ) | 28 | #define MPP_F6190_MASK MPP( 0, 0x0, 0, 0, 0, 1, 0, 0, 0 ) |
35 | #define MPP_F6192_MASK MPP( 0, 0x0, 0, 0, 0, 0, 1, 0, 0 ) | 29 | #define MPP_F6192_MASK MPP( 0, 0x0, 0, 0, 0, 0, 1, 0, 0 ) |