aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-w90x900/mfp-w90p910.c
diff options
context:
space:
mode:
authorwanzongshun <mcuos.com@gmail.com>2009-07-23 03:52:51 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2009-07-23 05:24:31 -0400
commit3f3f1d9d8de10a5dad0d22046cdd26dfb93d05c9 (patch)
treea783422faf5a356e0b3e047e97c825e44b88d046 /arch/arm/mach-w90x900/mfp-w90p910.c
parentc16d5d5657294e782d505efd00bbf2452d6aa0ca (diff)
[ARM] 5619/1: Add spi mfp api for w90p910 spi driver
Add spi mfp api for w90p910 spi driver. Signed-off-by: Wan ZongShun <mcuos.com@gmail.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-w90x900/mfp-w90p910.c')
-rw-r--r--arch/arm/mach-w90x900/mfp-w90p910.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/arch/arm/mach-w90x900/mfp-w90p910.c b/arch/arm/mach-w90x900/mfp-w90p910.c
index 8aec34b044ca..e11a32b6856d 100644
--- a/arch/arm/mach-w90x900/mfp-w90p910.c
+++ b/arch/arm/mach-w90x900/mfp-w90p910.c
@@ -34,6 +34,12 @@
34#define GPSELEI0 (0x01 << 26) 34#define GPSELEI0 (0x01 << 26)
35#define GPSELEI1 (0x01 << 27) 35#define GPSELEI1 (0x01 << 27)
36 36
37#define GPIOG0TO1 (0x03 << 14)
38#define GPIOG2TO3 (0x03 << 16)
39#define ENSPI (0x0a << 14)
40#define ENI2C0 (0x01 << 14)
41#define ENI2C1 (0x01 << 16)
42
37static DECLARE_MUTEX(mfp_sem); 43static DECLARE_MUTEX(mfp_sem);
38 44
39void mfp_set_groupf(struct device *dev) 45void mfp_set_groupf(struct device *dev)
@@ -118,3 +124,35 @@ void mfp_set_groupi(struct device *dev)
118} 124}
119EXPORT_SYMBOL(mfp_set_groupi); 125EXPORT_SYMBOL(mfp_set_groupi);
120 126
127void mfp_set_groupg(struct device *dev)
128{
129 unsigned long mfpen;
130 const char *dev_id;
131
132 BUG_ON(!dev);
133
134 down(&mfp_sem);
135
136 dev_id = dev_name(dev);
137
138 mfpen = __raw_readl(REG_MFSEL);
139
140 if (strcmp(dev_id, "w90p910-spi") == 0) {
141 mfpen &= ~(GPIOG0TO1 | GPIOG2TO3);
142 mfpen |= ENSPI;/*enable spi*/
143 } else if (strcmp(dev_id, "w90p910-i2c0") == 0) {
144 mfpen &= ~(GPIOG0TO1);
145 mfpen |= ENI2C0;/*enable i2c0*/
146 } else if (strcmp(dev_id, "w90p910-i2c1") == 0) {
147 mfpen &= ~(GPIOG2TO3);
148 mfpen |= ENI2C1;/*enable i2c1*/
149 } else {
150 mfpen &= ~(GPIOG0TO1 | GPIOG2TO3);/*GPIOG[3:0]*/
151 }
152
153 __raw_writel(mfpen, REG_MFSEL);
154
155 up(&mfp_sem);
156}
157EXPORT_SYMBOL(mfp_set_groupg);
158