summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorAvinash A <Avinash.a@stericsson.com>2011-09-09 18:56:20 +0530
committerUlf Hansson <ulf.hansson@stericsson.com>2011-09-19 16:07:27 +0200
commit3644f77507d80862edcbe108a4ad553c84a10f40 (patch)
treee61bc36559d641fcf73fe50c656a794e0413ef80 /arch
parent531d3313d7b2d9d67c3294ef0412ff99003e4075 (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')
-rwxr-xr-xarch/arm/mach-ux500/board-mop500-cyttsp.c4
-rw-r--r--arch/arm/mach-ux500/board-mop500-pins.c9
-rw-r--r--arch/arm/mach-ux500/board-mop500-uib.c41
-rw-r--r--arch/arm/mach-ux500/board-mop500.c5
-rw-r--r--arch/arm/mach-ux500/board-mop500.h6
-rw-r--r--arch/arm/mach-ux500/include/mach/hardware.h13
6 files changed, 59 insertions, 19 deletions
diff --git a/arch/arm/mach-ux500/board-mop500-cyttsp.c b/arch/arm/mach-ux500/board-mop500-cyttsp.c
index 8904f27a895..9723ee21f16 100755
--- a/arch/arm/mach-ux500/board-mop500-cyttsp.c
+++ b/arch/arm/mach-ux500/board-mop500-cyttsp.c
@@ -11,8 +11,10 @@
#include <linux/delay.h>
#include <linux/amba/pl022.h>
#include <plat/pincfg.h>
+#include <mach/hardware.h>
+#include <mach/irqs.h>
+#include <mach/irqs-db8500.h>
#include "include/mach/prcmu-db8500.h"
-
#include "pins-db8500.h"
#include "board-mop500.h"
#include "devices-db8500.h"
diff --git a/arch/arm/mach-ux500/board-mop500-pins.c b/arch/arm/mach-ux500/board-mop500-pins.c
index 4fa8adf9e4b..823129cf6f5 100644
--- a/arch/arm/mach-ux500/board-mop500-pins.c
+++ b/arch/arm/mach-ux500/board-mop500-pins.c
@@ -403,6 +403,14 @@ static UX500_PINS(mop500_pins_usb,
GPIO267_USB_DAT0,
);
+/* SPI2 */
+static UX500_PINS(mop500_pins_spi2,
+ GPIO216_GPIO | PIN_OUTPUT_HIGH,
+ GPIO218_SPI2_RXD | PIN_INPUT_PULLDOWN,
+ GPIO215_SPI2_TXD | PIN_OUTPUT_LOW,
+ GPIO217_SPI2_CLK | PIN_OUTPUT_LOW,
+);
+
static struct ux500_pin_lookup mop500_pins[] = {
PIN_LOOKUP("mcde-dpi", &mop500_pins_mcde_dpi),
PIN_LOOKUP("mcde-tvout", &mop500_pins_mcde_tvout),
@@ -417,6 +425,7 @@ static struct ux500_pin_lookup mop500_pins[] = {
PIN_LOOKUP("sdi2", &mop500_pins_sdi2),
PIN_LOOKUP("sdi4", &mop500_pins_sdi4),
PIN_LOOKUP("ab8500-usb.0", &mop500_pins_usb),
+ PIN_LOOKUP("spi2", &mop500_pins_spi2),
};
/*
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;
diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c
index 2fa4f598a63..2bf6b4fd389 100644
--- a/arch/arm/mach-ux500/board-mop500.c
+++ b/arch/arm/mach-ux500/board-mop500.c
@@ -36,7 +36,6 @@
#include <linux/pwm_backlight.h>
#include <linux/gpio/nomadik.h>
#include <linux/leds.h>
-#include <linux/cyttsp.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
@@ -1000,10 +999,6 @@ static struct pl022_ssp_controller ssp0_platform_data = {
*/
.num_chipselect = NUM_SSP_CLIENTS,
};
-static struct pl022_ssp_controller mop500_spi2_data = {
- .bus_id = SPI023_2_CONTROLLER,
- .num_chipselect = NUM_SSP_CLIENTS,
-};
static void __init mop500_spi_init(void)
{
diff --git a/arch/arm/mach-ux500/board-mop500.h b/arch/arm/mach-ux500/board-mop500.h
index a166b264e75..9b069a9f085 100644
--- a/arch/arm/mach-ux500/board-mop500.h
+++ b/arch/arm/mach-ux500/board-mop500.h
@@ -36,7 +36,9 @@
#define HREFV60_XSHUTDOWN_SECONDARY_SENSOR 140
#define XSHUTDOWN_PRIMARY_SENSOR 141
#define XSHUTDOWN_SECONDARY_SENSOR 142
-
+#define CYPRESS_TOUCH_INT_PIN 84
+#define CYPRESS_TOUCH_RST_GPIO 143
+#define CYPRESS_SLAVE_SELECT_GPIO 216
/* MOP500 generic GPIOs */
#define MOP500_HDMI_RST_GPIO 196
@@ -83,6 +85,8 @@ void __init mop500_stuib_init(void);
void __init mop500_msp_init(void);
void __init mop500_pins_init(void);
void __init mop500_vibra_init(void);
+void mop500_cyttsp_init(void);
+void __init mop500_u8500uib_r3_init(void);
void mop500_uib_i2c_add(int busnum, struct i2c_board_info const *info,
unsigned n);
diff --git a/arch/arm/mach-ux500/include/mach/hardware.h b/arch/arm/mach-ux500/include/mach/hardware.h
index 642657ed3b2..5983d53c3c9 100644
--- a/arch/arm/mach-ux500/include/mach/hardware.h
+++ b/arch/arm/mach-ux500/include/mach/hardware.h
@@ -47,6 +47,19 @@
#define MSP_TX_CLOCK_EDGE MSP_FALLING_EDGE
#define MSP_RX_CLOCK_EDGE MSP_FALLING_EDGE
+#define MSP_0_CONTROLLER 1
+#define MSP_1_CONTROLLER 2
+#define MSP_2_CONTROLLER 3
+#define MSP_3_CONTROLLER 4
+
+#define SSP_0_CONTROLLER 4
+#define SSP_1_CONTROLLER 5
+
+#define SPI023_0_CONTROLLER 6
+#define SPI023_1_CONTROLLER 7
+#define SPI023_2_CONTROLLER 8
+#define SPI023_3_CONTROLLER 9
+
#ifndef __ASSEMBLY__
#include <mach/id.h>