aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwanzongshun2009-07-23 08:52:51 +0100
committerRussell King2009-07-23 10:24:31 +0100
commit3f3f1d9d8de10a5dad0d22046cdd26dfb93d05c9 (patch)
treea783422faf5a356e0b3e047e97c825e44b88d046
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>
-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 @@
#define GPSELEI0 (0x01 << 26)
#define GPSELEI1 (0x01 << 27)
+#define GPIOG0TO1 (0x03 << 14)
+#define GPIOG2TO3 (0x03 << 16)
+#define ENSPI (0x0a << 14)
+#define ENI2C0 (0x01 << 14)
+#define ENI2C1 (0x01 << 16)
+
static DECLARE_MUTEX(mfp_sem);
void mfp_set_groupf(struct device *dev)
@@ -118,3 +124,35 @@ void mfp_set_groupi(struct device *dev)
}
EXPORT_SYMBOL(mfp_set_groupi);
+void mfp_set_groupg(struct device *dev)
+{
+ unsigned long mfpen;
+ const char *dev_id;
+
+ BUG_ON(!dev);
+
+ down(&mfp_sem);
+
+ dev_id = dev_name(dev);
+
+ mfpen = __raw_readl(REG_MFSEL);
+
+ if (strcmp(dev_id, "w90p910-spi") == 0) {
+ mfpen &= ~(GPIOG0TO1 | GPIOG2TO3);
+ mfpen |= ENSPI;/*enable spi*/
+ } else if (strcmp(dev_id, "w90p910-i2c0") == 0) {
+ mfpen &= ~(GPIOG0TO1);
+ mfpen |= ENI2C0;/*enable i2c0*/
+ } else if (strcmp(dev_id, "w90p910-i2c1") == 0) {
+ mfpen &= ~(GPIOG2TO3);
+ mfpen |= ENI2C1;/*enable i2c1*/
+ } else {
+ mfpen &= ~(GPIOG0TO1 | GPIOG2TO3);/*GPIOG[3:0]*/
+ }
+
+ __raw_writel(mfpen, REG_MFSEL);
+
+ up(&mfp_sem);
+}
+EXPORT_SYMBOL(mfp_set_groupg);
+