aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-mv78xx0/mpp.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-mv78xx0/mpp.c')
-rw-r--r--arch/arm/mach-mv78xx0/mpp.c58
1 files changed, 3 insertions, 55 deletions
diff --git a/arch/arm/mach-mv78xx0/mpp.c b/arch/arm/mach-mv78xx0/mpp.c
index 65b72c454cb0..59b7686b9209 100644
--- a/arch/arm/mach-mv78xx0/mpp.c
+++ b/arch/arm/mach-mv78xx0/mpp.c
@@ -12,6 +12,7 @@
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/mbus.h> 13#include <linux/mbus.h>
14#include <linux/io.h> 14#include <linux/io.h>
15#include <plat/mpp.h>
15#include <asm/gpio.h> 16#include <asm/gpio.h>
16#include <mach/hardware.h> 17#include <mach/hardware.h>
17#include "common.h" 18#include "common.h"
@@ -31,61 +32,8 @@ static unsigned int __init mv78xx0_variant(void)
31 return 0; 32 return 0;
32} 33}
33 34
34#define MPP_CTRL(i) (DEV_BUS_VIRT_BASE + (i) * 4)
35#define MPP_NR_REGS (1 + MPP_MAX/8)
36
37void __init mv78xx0_mpp_conf(unsigned int *mpp_list) 35void __init mv78xx0_mpp_conf(unsigned int *mpp_list)
38{ 36{
39 u32 mpp_ctrl[MPP_NR_REGS]; 37 orion_mpp_conf(mpp_list, mv78xx0_variant(),
40 unsigned int variant_mask; 38 MPP_MAX, DEV_BUS_VIRT_BASE);
41 int i;
42
43 variant_mask = mv78xx0_variant();
44 if (!variant_mask)
45 return;
46
47 printk(KERN_DEBUG "initial MPP regs:");
48 for (i = 0; i < MPP_NR_REGS; i++) {
49 mpp_ctrl[i] = readl(MPP_CTRL(i));
50 printk(" %08x", mpp_ctrl[i]);
51 }
52 printk("\n");
53
54 for ( ; *mpp_list; mpp_list++) {
55 unsigned int num = MPP_NUM(*mpp_list);
56 unsigned int sel = MPP_SEL(*mpp_list);
57 int shift, gpio_mode;
58
59 if (num > MPP_MAX) {
60 printk(KERN_ERR "mv78xx0_mpp_conf: invalid MPP "
61 "number (%u)\n", num);
62 continue;
63 }
64 if (!(*mpp_list & variant_mask)) {
65 printk(KERN_WARNING
66 "mv78xx0_mpp_conf: requested MPP%u config "
67 "unavailable on this hardware\n", num);
68 continue;
69 }
70
71 shift = (num & 7) << 2;
72 mpp_ctrl[num / 8] &= ~(0xf << shift);
73 mpp_ctrl[num / 8] |= sel << shift;
74
75 gpio_mode = 0;
76 if (*mpp_list & MPP_INPUT_MASK)
77 gpio_mode |= GPIO_INPUT_OK;
78 if (*mpp_list & MPP_OUTPUT_MASK)
79 gpio_mode |= GPIO_OUTPUT_OK;
80 if (sel != 0)
81 gpio_mode = 0;
82 orion_gpio_set_valid(num, gpio_mode);
83 }
84
85 printk(KERN_DEBUG " final MPP regs:");
86 for (i = 0; i < MPP_NR_REGS; i++) {
87 writel(mpp_ctrl[i], MPP_CTRL(i));
88 printk(" %08x", mpp_ctrl[i]);
89 }
90 printk("\n");
91} 39}