[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>
This commit is contained in:
wanzongshun 2009-07-23 08:52:51 +01:00 committed by Russell King
parent c16d5d5657
commit 3f3f1d9d8d

View File

@ -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);