Jean Delvare | 26 Jan 19:00 2015
Picon

[PATCH v2] i2c: Only include slave support if selected

Make the slave support depend on CONFIG_I2C_SLAVE. Otherwise it gets
included unconditionally, even when it is not needed.

Signed-off-by: Jean Delvare <jdelvare@...>
Cc: Wolfram Sang <wsa@...>
---
Changes since v1:
* Let I2C_RCAR select I2C_SLAVE

Wolfram, you mentioned i2c-sh_mobile but that driver doesn't seem to
implement slave support in v3.19-rc6 so I did not include it. Feel free
to add more selects to drivers/i2c/busses/Kconfig to match the current
state of your i2c tree.

 drivers/i2c/busses/Kconfig |    1 +
 drivers/i2c/i2c-core.c     |    2 ++
 include/linux/i2c.h        |    4 ++++
 3 files changed, 7 insertions(+)

--- linux-3.19-rc6.orig/drivers/i2c/i2c-core.c	2015-01-26 12:47:26.467671896 +0100
+++ linux-3.19-rc6/drivers/i2c/i2c-core.c	2015-01-26 12:50:23.541420438 +0100
 <at>  <at>  -2962,6 +2962,7  <at>  <at>  trace:
 }
 EXPORT_SYMBOL(i2c_smbus_xfer);

+#if IS_ENABLED(CONFIG_I2C_SLAVE)
 int i2c_slave_register(struct i2c_client *client, i2c_slave_cb_t slave_cb)
 {
 	int ret;
 <at>  <at>  -3009,6 +3010,7  <at>  <at>  int i2c_slave_unregister(struct i2c_clie
(Continue reading)

Wolfram Sang | 26 Jan 17:49 2015
Picon

[PATCH] i2c: designware-baytrail: use proper Kconfig dependencies

IOSF_MBI depends on PCI, so we should not select it but depend on it.
This ensures also we compile on X86 only, other archs will break because
of an arch specific include. Also depend on ACPI since this driver uses
it.

Signed-off-by: Wolfram Sang <wsa@...>
---
 drivers/i2c/busses/Kconfig | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
index 83062b2c0e6b..442408d2e7b7 100644
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
 <at>  <at>  -467,8 +467,7  <at>  <at>  config I2C_DESIGNWARE_PCI

 config I2C_DESIGNWARE_BAYTRAIL
 	bool "Intel Baytrail I2C semaphore support"
-	depends on I2C_DESIGNWARE_PLATFORM
-	select IOSF_MBI
+	depends on I2C_DESIGNWARE_PLATFORM && IOSF_MBI && ACPI
 	help
 	  This driver enables managed host access to the PMIC I2C bus on select
 	  Intel BayTrail platforms using the X-Powers AXP288 PMIC. It allows
--

-- 
2.1.3

Jean Delvare | 24 Jan 21:08 2015
Picon

I2C slave support

Hi Wolfram,

I find it confusing that I2C slave support is included even when
CONFIG_I2C_SLAVE is not set. I don't know if this was discussed before?
Most systems don't need this code so including it unconditionally seems
suboptimal.

I am considering adding ifdefs around the code to only include it when
CONFIG_I2C_SLAVE is set. Alternatively the code could be moved to a
separate module altogether. What do you think?

Thanks,
--

-- 
Jean Delvare
SUSE L3 Support
Pantelis Antoniou | 24 Jan 08:16 2015

[PATCH] i2c: Mark instantiated device nodes with OF_POPULATE

Mark (and unmark) device nodes with the POPULATE flag as appropriate.
This is required to avoid multi probing when using I2C and device
overlays containing a mux.
This patch is also more careful with the release of the adapter device
which caused a deadlock with muxes, and does not break the build
on !OF since the node flag accessors are not defined then.

Signed-off-by: Pantelis Antoniou <pantelis.antoniou@...>
---
 drivers/i2c/i2c-core.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 39d25a8..8c32ee3 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
 <at>  <at>  -1122,6 +1122,8  <at>  <at>  EXPORT_SYMBOL_GPL(i2c_new_device);
  */
 void i2c_unregister_device(struct i2c_client *client)
 {
+	if (client->dev.of_node)
+		of_node_clear_flag(client->dev.of_node, OF_POPULATED);
 	device_unregister(&client->dev);
 }
 EXPORT_SYMBOL_GPL(i2c_unregister_device);
 <at>  <at>  -1441,8 +1443,11  <at>  <at>  static void of_i2c_register_devices(struct i2c_adapter *adap)

 	dev_dbg(&adap->dev, "of_i2c: walking child nodes\n");

-	for_each_available_child_of_node(adap->dev.of_node, node)
(Continue reading)

Andy Shevchenko | 23 Jan 12:54 2015
Picon

[PATCH v2 1/4] i2c: designware-pci: remove Moorestown support

The Moorestown support bits were removed few years ago. This is a follow up to
that changes.

Suggested-by: David Cohen <david.a.cohen@...>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@...>
---
 drivers/i2c/busses/i2c-designware-pcidrv.c | 29 -----------------------------
 1 file changed, 29 deletions(-)

diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c b/drivers/i2c/busses/i2c-designware-pcidrv.c
index acb40f9..5c6fca7 100644
--- a/drivers/i2c/busses/i2c-designware-pcidrv.c
+++ b/drivers/i2c/busses/i2c-designware-pcidrv.c
 <at>  <at>  -40,10 +40,6  <at>  <at> 
 #define DRIVER_NAME "i2c-designware-pci"

 enum dw_pci_ctl_id_t {
-	moorestown_0,
-	moorestown_1,
-	moorestown_2,
-
 	medfield_0,
 	medfield_1,
 	medfield_2,
 <at>  <at>  -102,27 +98,6  <at>  <at>  static struct dw_scl_sda_cfg hsw_config = {
 };

 static struct  dw_pci_controller  dw_pci_controllers[] = {
-	[moorestown_0] = {
-		.bus_num     = 0,
(Continue reading)

Jarkko Nikula | 23 Jan 10:35 2015
Picon

[PATCH] i2c: designware: Do not calculate SCL timing parameters needlessly

Do SCL timing parameter calculation conditionally depending are custom
parameters provided since calculated values will get instantly overwritten
by provided parameters.

Signed-off-by: Jarkko Nikula <jarkko.nikula@...>
---
 drivers/i2c/busses/i2c-designware-core.c | 45 ++++++++++++++++----------------
 1 file changed, 22 insertions(+), 23 deletions(-)

diff --git a/drivers/i2c/busses/i2c-designware-core.c b/drivers/i2c/busses/i2c-designware-core.c
index 23628b7bfb8d..2c7749774a5f 100644
--- a/drivers/i2c/busses/i2c-designware-core.c
+++ b/drivers/i2c/busses/i2c-designware-core.c
 <at>  <at>  -309,40 +309,39  <at>  <at>  int i2c_dw_init(struct dw_i2c_dev *dev)
 	sda_falling_time = dev->sda_falling_time ?: 300; /* ns */
 	scl_falling_time = dev->scl_falling_time ?: 300; /* ns */

-	/* Standard-mode */
-	hcnt = i2c_dw_scl_hcnt(input_clock_khz,
-				4000,	/* tHD;STA = tHIGH = 4.0 us */
-				sda_falling_time,
-				0,	/* 0: DW default, 1: Ideal */
-				0);	/* No offset */
-	lcnt = i2c_dw_scl_lcnt(input_clock_khz,
-				4700,	/* tLOW = 4.7 us */
-				scl_falling_time,
-				0);	/* No offset */
-
-	/* Allow platforms to specify the ideal HCNT and LCNT values */
+	/* Set SCL timing parameters for standard-mode */
(Continue reading)

Philipp Zabel | 22 Jan 16:17 2015
Picon

[PATCH v2] i2c: imx: whitespace and checkpatch cleanup

This patch fixes up some whitespace issues and addresses a few
checkpatch warnings.

Signed-off-by: Philipp Zabel <p.zabel@...>
Acked-by: Fugang Duan <B38611@...>
---
Changes since v1:
 - Dropped the 80 char limit line breaks
---
 drivers/i2c/busses/i2c-imx.c | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
index 9b02d1d..60ecb3f 100644
--- a/drivers/i2c/busses/i2c-imx.c
+++ b/drivers/i2c/busses/i2c-imx.c
 <at>  <at>  -201,7 +201,7  <at>  <at>  struct imx_i2c_struct {
 	void __iomem		*base;
 	wait_queue_head_t	queue;
 	unsigned long		i2csr;
-	unsigned int 		disable_delay;
+	unsigned int		disable_delay;
 	int			stopped;
 	unsigned int		ifdr; /* IMX_I2C_IFDR */
 	unsigned int		cur_clk;
 <at>  <at>  -479,8 +479,8  <at>  <at>  static void i2c_imx_set_clk(struct imx_i2c_struct *i2c_imx)
 	i2c_clk_rate = clk_get_rate(i2c_imx->clk);
 	if (i2c_imx->cur_clk == i2c_clk_rate)
 		return;
-	else
(Continue reading)

Andy Shevchenko | 22 Jan 15:44 2015
Picon

[PATCH v1 1/3] i2c: designware-pci: shrink dw_pci_controllers array

There is no need to duplicate same data for each controller. If we need
specific stuff for a certain controller in the future we may add it later. The
patch leaves one controller per platform.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@...>
---
 drivers/i2c/busses/i2c-designware-pcidrv.c | 96 ++++++------------------------
 1 file changed, 19 insertions(+), 77 deletions(-)

diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c b/drivers/i2c/busses/i2c-designware-pcidrv.c
index acb40f9..9237abb 100644
--- a/drivers/i2c/busses/i2c-designware-pcidrv.c
+++ b/drivers/i2c/busses/i2c-designware-pcidrv.c
 <at>  <at>  -40,17 +40,8  <at>  <at> 
 #define DRIVER_NAME "i2c-designware-pci"

 enum dw_pci_ctl_id_t {
-	moorestown_0,
-	moorestown_1,
-	moorestown_2,
-
-	medfield_0,
-	medfield_1,
-	medfield_2,
-	medfield_3,
-	medfield_4,
-	medfield_5,
-
+	moorestown,
+	medfield,
(Continue reading)

Ray Jui | 19 Jan 22:51 2015

[PATCH v7 0/3] Add I2C support to Broadcom iProc

This patchset contains the initial I2C support for Broadcom iProc family of
SoCs.

The iProc I2C controller has separate internal TX and RX FIFOs, each has a
size of 64 bytes. The iProc I2C controller supports two bus speeds including
standard mode (100 kHz) and fast mode (400 kHz)

Changes from v6:
 - Get rid of unnecessary atomic variable usage in the driver
 - Improve the "waiting for transaction to complete" logic further by making
   sure there's no pending/ongoing interrupt by the time when flag
   'xfer_is_done' is checked
 - After disabling interrupt with 'writel', add 'readl' to the same register
   to flush the bus to ensure the write has gone through

Changes from v5:
 - Improve the "waiting for transaction to be complete" logic to take care of
   the corner case when an interrupt fires after wait_for_completion_timeout
   times out
 - Improve the logic to disable I2C interrupt in the remove function. Make it
   more generic so it works for both dedicated and shared interrupt

Changes from v4:
 - Remove redundant header file includes
 - Change the logic that waits for the host controller to be idle to
   simply return -EBUSY
 - Use proper print level and error codes in the driver
 - Allow zero length message in the driver to support I2C_SMBUS_QUICK
 - Change back to use devm_request_irq. Disable interrupt in the remove
   function so there's no outstanding I2C interrupt when the driver is
(Continue reading)

Wolfram Sang | 19 Jan 20:12 2015
Picon

[PATCH] i2c: simplify boilerplate code for attribute groups

Declaring attribute groups can be done with macros these days, let's use
them for consistency and readability reasons. Also, put the ATTR macros
directly below the referenced functions while we are here.

Signed-off-by: Wolfram Sang <wsa@...>
---
 drivers/i2c/i2c-core.c | 30 ++++++------------------------
 1 file changed, 6 insertions(+), 24 deletions(-)

diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 15cc5902cf89..15be1e95e1d2 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
 <at>  <at>  -803,6 +803,7  <at>  <at>  show_name(struct device *dev, struct device_attribute *attr, char *buf)
 	return sprintf(buf, "%s\n", dev->type == &i2c_client_type ?
 		       to_i2c_client(dev)->name : to_i2c_adapter(dev)->name);
 }
+static DEVICE_ATTR(name, S_IRUGO, show_name, NULL);

 static ssize_t
 show_modalias(struct device *dev, struct device_attribute *attr, char *buf)
 <at>  <at>  -816,8 +817,6  <at>  <at>  show_modalias(struct device *dev, struct device_attribute *attr, char *buf)

 	return sprintf(buf, "%s%s\n", I2C_MODULE_PREFIX, client->name);
 }
-
-static DEVICE_ATTR(name, S_IRUGO, show_name, NULL);
 static DEVICE_ATTR(modalias, S_IRUGO, show_modalias, NULL);

 static struct attribute *i2c_dev_attrs[] = {
(Continue reading)

Paul Osmialowski | 19 Jan 17:03 2015

[PATCH] i2c: s3c2410: fix ABBA deadlock by keeping clock prepared

This patch solves deadlock between clock prepare mutex and regmap mutex reported
by Tomasz Figa in [1] by implementing solution from [2]: "always leave the clock
of the i2c controller in a prepared state".

[1] https://lkml.org/lkml/2014/7/2/171
[2] https://lkml.org/lkml/2014/7/2/207

On each i2c transfer handled by s3c24xx_i2c_xfer(), clk_prepare_enable() was
called, which calls clk_prepare() then clk_enable(). clk_prepare() takes
prepare_lock mutex before proceeding. Note that i2c transfer functions are
invoked from many places in kernel, typically with some other additional lock
held.

It may happen that function on CPU1 (e.g. regmap_update_bits()) has taken a
mutex (i.e. regmap lock mutex) then it attempts i2c communication in order to
proceed (so it needs to obtain clock related prepare_lock mutex during transfer
preparation stage due to clk_prepare() call). At the same time other task on
CPU0 wants to operate on clock (e.g. to (un)prepare clock for some other reason)
so it has taken prepare_lock mutex.

CPU0:                        CPU1:
clk_disable_unused()         regulator_disable()
  clk_prepare_lock()           map->lock(map->lock_arg)
  regmap_read()                s3c24xx_i2c_xfer()
    map->lock(map->lock_arg)     clk_prepare_lock()

Implemented solution from [2] leaves i2c clock prepared. Preparation is done in
s3c24xx_i2c_probe() function. Without this patch, it is immediately unprepared
by clk_disable_unprepare() call. I've replaced this call with clk_disable() and
I've added clk_unprepare() call in s3c24xx_i2c_remove().
(Continue reading)


Gmane