From ec7c6a80fc0e28187aa08a17e32e41e1336ce644 Mon Sep 17 00:00:00 2001 From: Andre Guedes Date: Wed, 17 Feb 2016 12:55:35 -0200 Subject: [PATCH] i2c: Enable QMSI driver for Quark D2000 This patch fixes the QMSI I2C shim driver so we are able to use it in Quark D2000 based platforms. The only change required to enable this driver is an #if guard in i2c_qmsi_init() because the macro QM_I2C_1 is not defined in QMSI headers from Quark D2000. Since this drivers is now properly tested with Quark D2000, this patch sets the QMSI driver default options in arch/x86/soc/quark_d2000/Kconfig. It also adds the wiring information required to test the i2c_lsm9ds0 sample app in the Quark D2000 CRB. Change-Id: I4be03c09304da5a66ac663e48b1d72225eb5651d Signed-off-by: Andre Guedes --- arch/x86/soc/quark_d2000/Kconfig | 8 ++++++++ drivers/i2c/i2c_qmsi.c | 4 ++++ samples/drivers/i2c_lsm9ds0/README | 22 +++++++++++----------- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/arch/x86/soc/quark_d2000/Kconfig b/arch/x86/soc/quark_d2000/Kconfig index 9d7f2a87323..03c18b253a6 100644 --- a/arch/x86/soc/quark_d2000/Kconfig +++ b/arch/x86/soc/quark_d2000/Kconfig @@ -207,6 +207,14 @@ config I2C_CLOCK_SPEED endif +if I2C_QMSI +config I2C_QMSI_0 + def_bool y +config I2C_QMSI_0_IRQ + default 4 +config I2C_QMSI_0_INT_PRIORITY + default 0 +endif # I2C_QMSI endif # I2C endif # SOC_QUARK_D2000 diff --git a/drivers/i2c/i2c_qmsi.c b/drivers/i2c/i2c_qmsi.c index 7c2206ea9b6..5a1825c3c49 100644 --- a/drivers/i2c/i2c_qmsi.c +++ b/drivers/i2c/i2c_qmsi.c @@ -218,6 +218,8 @@ static int i2c_qmsi_init(struct device *dev) clk_periph_enable(CLK_PERIPH_I2C_M0_REGISTER); break; + +#ifdef CONFIG_I2C_QMSI_1 case QM_I2C_1: IRQ_CONNECT(CONFIG_I2C_QMSI_1_IRQ, CONFIG_I2C_QMSI_1_INT_PRIORITY, qm_i2c_1_isr, NULL, @@ -227,6 +229,8 @@ static int i2c_qmsi_init(struct device *dev) clk_periph_enable(CLK_PERIPH_I2C_M1_REGISTER); break; +#endif /* CONFIG_I2C_QMSI_1 */ + default: return DEV_FAIL; } diff --git a/samples/drivers/i2c_lsm9ds0/README b/samples/drivers/i2c_lsm9ds0/README index fef9e81b268..e8d562c6bcb 100644 --- a/samples/drivers/i2c_lsm9ds0/README +++ b/samples/drivers/i2c_lsm9ds0/README @@ -13,14 +13,14 @@ the datasheet. Below follows the wiring information for each board this samples has been tested. ---------------+-------------------- -| LSM9DS0 pin | Quark SE Devboard | -| | pin | -|-------------+-------------------| -| VIN | P4 pin 1 | -| GND | P4 pin 43 | -| SCL | P4 pin 31 | -| SDA | P4 pin 33 | -| CSG | P4 pin 29 | -| SDOG | P4 pin 17 | ---------------+-------------------- +--------------+-------------------+------------------ +| LSM9DS0 pin | Quark SE Devboard | Quark D2000 CRB | +| | pin | pin | +|-------------+-------------------+-----------------| +| VIN | P4 pin 1 | J25 pin 1 | +| GND | P4 pin 43 | J25 pin 2 | +| SCL | P4 pin 31 | J21 pin 6 | +| SDA | P4 pin 33 | J21 pin 5 | +| CSG | P4 pin 29 | J25 pin 1 | +| SDOG | P4 pin 17 | J25 pin 2 | +--------------+-------------------+------------------