summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-ux500/board-mop500-uib.c28
-rw-r--r--arch/arm/mach-ux500/board-mop500.h4
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