diff options
author | Avinash A <Avinash.a@stericsson.com> | 2011-09-09 18:56:20 +0530 |
---|---|---|
committer | Philippe Langlais <philippe.langlais@stericsson.com> | 2012-05-22 11:02:11 +0200 |
commit | b40dd46a861738be1086b8037544e2648a9ed488 (patch) | |
tree | 39d0916e1657cb7c42b00e166e1a755f5f2098e5 /arch/arm/mach-ux500/board-mop500-uib.c | |
parent | 1c5dacbf630cd762e1f0c8862112d234beabed97 (diff) |
mach-ux500: dynamic detection of uibs
Detect the uibs dynamically and resolve the
conflict between the pins used for SPI
with the cypress touchscreen and the keypad pins
on other boards
ref commit-id: I3bb7672cebe4e9696c7df6846d6031841f87ea58
Signed-off-by: Avinash A <Avinash.a@stericsson.com>
Change-Id: I661a0939e1b10dc4e1e8f21ff07f3070a7dc6963
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/30589
Reviewed-by: Avinash A <avinash.a@stericsson.com>
Tested-by: Avinash A <avinash.a@stericsson.com>
Diffstat (limited to 'arch/arm/mach-ux500/board-mop500-uib.c')
-rw-r--r-- | arch/arm/mach-ux500/board-mop500-uib.c | 41 |
1 files changed, 29 insertions, 12 deletions
diff --git a/arch/arm/mach-ux500/board-mop500-uib.c b/arch/arm/mach-ux500/board-mop500-uib.c index f4dfd52541c..2a5d50aa286 100644 --- a/arch/arm/mach-ux500/board-mop500-uib.c +++ b/arch/arm/mach-ux500/board-mop500-uib.c @@ -17,6 +17,7 @@ enum mop500_uib { STUIB, U8500UIB, + U8500UIB_R3, }; struct uib { @@ -36,6 +37,11 @@ static struct uib __initdata mop500_uibs[] = { .option = "u8500uib", .init = mop500_u8500uib_init, }, + [U8500UIB_R3] = { + .name = "U8500-UIBR3", + .option = "u8500uibr3", + .init = mop500_u8500uib_r3_init, + }, }; static struct uib __initdata *mop500_uib; @@ -98,18 +104,14 @@ static void __init __mop500_uib_init(struct uib *uib, const char *why) */ static int __init mop500_uib_init(void) { - struct uib *uib = mop500_uib; + struct uib *uib = mop500_uibs; struct i2c_adapter *i2c0; + struct i2c_adapter *i2c3; int ret; if (!cpu_is_u8500()) return -ENODEV; - if (uib) { - __mop500_uib_init(uib, "from uib= boot argument"); - return 0; - } - i2c0 = i2c_get_adapter(0); if (!i2c0) { __mop500_uib_init(&mop500_uibs[STUIB], @@ -121,12 +123,27 @@ static int __init mop500_uib_init(void) ret = i2c_smbus_xfer(i2c0, 0x44, 0, I2C_SMBUS_WRITE, 0, I2C_SMBUS_QUICK, NULL); i2c_put_adapter(i2c0); - - if (ret == 0) - uib = &mop500_uibs[U8500UIB]; - else - uib = &mop500_uibs[STUIB]; - + i2c3 = i2c_get_adapter(3); + if (ret == 0) { + if (!i2c3) { + __mop500_uib_init(&mop500_uibs[STUIB], + "fallback, could not get i2c3"); + return -ENODEV; + } + ret = i2c_smbus_xfer(i2c3, 0x4B, 0, I2C_SMBUS_WRITE, 0, + I2C_SMBUS_QUICK, NULL); + if (ret == 0) + uib = &mop500_uibs[U8500UIB]; + else + uib = &mop500_uibs[U8500UIB_R3]; + } + else { + ret = i2c_smbus_xfer(i2c3, 0x5C, 0, I2C_SMBUS_WRITE, 0, + I2C_SMBUS_QUICK, NULL); + i2c_put_adapter(i2c3); + if (ret == 0) + uib = &mop500_uibs[STUIB]; + } __mop500_uib_init(uib, "detected"); return 0; |