summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorJimmy Rubin <jimmy.rubin@stericsson.com>2011-09-29 10:06:16 +0200
committerRobert Marklund <robert.marklund@stericsson.com>2011-10-27 15:49:45 +0200
commit675b486ecfdfcbfe1256c42b4909f0d5156ba9fd (patch)
tree1d0633c3b969ed93ba098fdc071f1bb03b386361 /arch
parent3ec60661a3e1951122668d9ee8c09a8c0c757a70 (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> Signed-off-by: Robert Marklund <robert.marklund@stericsson.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-ux500/board-mop500-uib.c29
-rw-r--r--arch/arm/mach-ux500/board-mop500.h4
2 files changed, 32 insertions, 1 deletions
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