diff options
author | Jimmy Rubin <jimmy.rubin@stericsson.com> | 2011-09-29 10:06:16 +0200 |
---|---|---|
committer | Jonas ABERG <jonas.aberg@stericsson.com> | 2011-10-06 13:38:02 +0200 |
commit | faf0623e6b499a5540046cc381bac64b550d21ca (patch) | |
tree | 7e256cbe06fa9f0b373452c7cd230c28ad70da20 /arch | |
parent | 28af34781abf6416f6edf38e8dceb2a0f4b35e6f (diff) |
ux500: uib: Add functions to get type of uib
ST-Ericsson ID: 321190
ST-Ericsson Linux Next: NA
ST-Ericsson FOSS-OUT ID: Trivial
Change-Id: Ibfe3da0b59978533d3acb8de6bc015c48b605dce
Signed-off-by: Jimmy Rubin <jimmy.rubin@stericsson.com>
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/32593
Reviewed-by: Marcus LORENTZON <marcus.xm.lorentzon@stericsson.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-ux500/board-mop500-uib.c | 28 | ||||
-rw-r--r-- | arch/arm/mach-ux500/board-mop500.h | 4 |
2 files changed, 31 insertions, 1 deletions
diff --git a/arch/arm/mach-ux500/board-mop500-uib.c b/arch/arm/mach-ux500/board-mop500-uib.c index 2a5d50aa286..3e60f49a66c 100644 --- a/arch/arm/mach-ux500/board-mop500-uib.c +++ b/arch/arm/mach-ux500/board-mop500-uib.c @@ -26,6 +26,8 @@ struct uib { void (*init)(void); }; +static u8 type_of_uib; + static struct uib __initdata mop500_uibs[] = { [STUIB] = { .name = "ST-UIB", @@ -96,9 +98,32 @@ void mop500_uib_i2c_add(int busnum, struct i2c_board_info const *info, static void __init __mop500_uib_init(struct uib *uib, const char *why) { pr_info("%s (%s)\n", uib->name, why); + + if (strcmp("stuib", uib->option) == 0) + type_of_uib = STUIB; + else if (strcmp("u8500uib", uib->option) == 0) + type_of_uib = U8500UIB; + else if (strcmp("u8500uibr3", uib->option) == 0) + type_of_uib = U8500UIB_R3; + uib->init(); } +int uib_is_stuib(void) +{ + return (type_of_uib == STUIB); +} + +int uib_is_u8500uib(void) +{ + return (type_of_uib == U8500UIB); +} + +int uib_is_u8500uibr3(void) +{ + return (type_of_uib == U8500UIB_R3); +} + /* * Detect the UIB attached based on the presence or absence of i2c devices. */ @@ -129,9 +154,10 @@ static int __init mop500_uib_init(void) __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); + i2c_put_adapter(i2c3); if (ret == 0) uib = &mop500_uibs[U8500UIB]; else diff --git a/arch/arm/mach-ux500/board-mop500.h b/arch/arm/mach-ux500/board-mop500.h index 569cd9d7fca..273aa24b57e 100644 --- a/arch/arm/mach-ux500/board-mop500.h +++ b/arch/arm/mach-ux500/board-mop500.h @@ -84,4 +84,8 @@ void mop500_uib_i2c_add(int busnum, struct i2c_board_info const *info, int msp13_i2s_init(void); int msp13_i2s_exit(void); +int uib_is_stuib(void); +int uib_is_u8500uib(void); +int uib_is_u8500uibr3(void); + #endif |