From 675b486ecfdfcbfe1256c42b4909f0d5156ba9fd Mon Sep 17 00:00:00 2001 From: Jimmy Rubin Date: Thu, 29 Sep 2011 10:06:16 +0200 Subject: 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 Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/32593 Reviewed-by: Marcus LORENTZON Signed-off-by: Robert Marklund --- arch/arm/mach-ux500/board-mop500-uib.c | 29 ++++++++++++++++++++++++++++- arch/arm/mach-ux500/board-mop500.h | 4 ++++ 2 files changed, 32 insertions(+), 1 deletion(-) (limited to 'arch') diff --git a/arch/arm/mach-ux500/board-mop500-uib.c b/arch/arm/mach-ux500/board-mop500-uib.c index d8360d7ef74..c3ab87d13e2 100644 --- a/arch/arm/mach-ux500/board-mop500-uib.c +++ b/arch/arm/mach-ux500/board-mop500-uib.c @@ -20,6 +20,7 @@ enum mop500_uib { STUIB, U8500UIB, U8500UIB_R3, + NO_UIB, }; struct uib { @@ -28,6 +29,8 @@ struct uib { void (*init)(void); }; +static u8 type_of_uib = NO_UIB; + static struct uib __initdata mop500_uibs[] = { [STUIB] = { .name = "ST-UIB", @@ -98,9 +101,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. */ @@ -132,9 +158,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 981fc2b802b..9e14f6b5b66 100644 --- a/arch/arm/mach-ux500/board-mop500.h +++ b/arch/arm/mach-ux500/board-mop500.h @@ -85,4 +85,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 -- cgit v1.2.3