Skip to contentSkip to conversation

i2c: designware: Post-slave mode support patches

PATCH Applied Jarkko Nikula 4 participants 7 messages Jun 28, 2017 – Jul 4, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover i2c: designware: Post-slave mode support patches

Hi Luis

I noticed couple minor things after review. Here are patches.

Jarkko Nikula (2):
i2c: designware: Make HW init functions static
i2c: designware: Let slave adapter support be optional

 drivers/i2c/busses/Kconfig                 | 1 -
 drivers/i2c/busses/i2c-designware-core.h   | 6 ++++--
 drivers/i2c/busses/i2c-designware-master.c | 7 +++----
 drivers/i2c/busses/i2c-designware-slave.c  | 3 +--
 4 files changed, 8 insertions(+), 9 deletions(-)
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/2 i2c: designware: Make HW init functions static

Recent i2c-designware slave support patches use master or slave HW init functions through the function pointer so we can declare them static.

While at it, rename i2c_dw_init() as i2c_dw_init_master().

---
 drivers/i2c/busses/i2c-designware-core.h   | 2 --
 drivers/i2c/busses/i2c-designware-master.c | 7 +++----
 drivers/i2c/busses/i2c-designware-slave.c  | 3 +--
 3 files changed, 4 insertions(+), 8 deletions(-)
drivers/i2c/busses/i2c-designware-core.h +0 -2
index 7bfbcc62f6c5..a403dcdfca4b 100644
@@ -306,8 +306,6 @@ int i2c_dw_handle_tx_abort(struct dw_i2c_dev *dev);
 u32 i2c_dw_func(struct i2c_adapter *adap);
 void i2c_dw_disable(struct dw_i2c_dev *dev);
 void i2c_dw_disable_int(struct dw_i2c_dev *dev);
-int i2c_dw_init(struct dw_i2c_dev *dev);
-int i2c_dw_init_slave(struct dw_i2c_dev *dev);
 
 extern u32 i2c_dw_read_comp_param(struct dw_i2c_dev *dev);
 extern int i2c_dw_probe(struct dw_i2c_dev *dev);
drivers/i2c/busses/i2c-designware-master.c +3 -4
index eefc4db1ee3e..418c233075d3 100644
@@ -51,7 +51,7 @@ static void i2c_dw_configure_fifo_master(struct dw_i2c_dev *dev)
  * This function is called during I2C init function, and in case of timeout at
  * run time.
  */
-int i2c_dw_init(struct dw_i2c_dev *dev)
+static int i2c_dw_init_master(struct dw_i2c_dev *dev)
 {
 	u32 hcnt, lcnt;
 	u32 reg, comp_param1;
@@ -171,7 +171,6 @@ int i2c_dw_init(struct dw_i2c_dev *dev)
 
 	return 0;
 }
-EXPORT_SYMBOL_GPL(i2c_dw_init);
 
 static void i2c_dw_xfer_init(struct dw_i2c_dev *dev)
 {
@@ -444,7 +443,7 @@ i2c_dw_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
 	if (!wait_for_completion_timeout(&dev->cmd_complete, adap->timeout)) {
 		dev_err(dev->dev, "controller timed out\n");
 		/* i2c_dw_init implicitly disables the adapter */
-		i2c_dw_init(dev);
+		i2c_dw_init_master(dev);
 		ret = -ETIMEDOUT;
 		goto done;
 	}
@@ -622,7 +621,7 @@ int i2c_dw_probe(struct dw_i2c_dev *dev)
 
 	init_completion(&dev->cmd_complete);
 
-	dev->init = i2c_dw_init;
+	dev->init = i2c_dw_init_master;
 	dev->disable = i2c_dw_disable;
 	dev->disable_int = i2c_dw_disable_int;
 
drivers/i2c/busses/i2c-designware-slave.c +1 -2
index 4012c74e9785..1b82a8611eb5 100644
@@ -49,7 +49,7 @@ static void i2c_dw_configure_fifo_slave(struct dw_i2c_dev *dev)
  * This function is called during I2C init function, and in case of timeout at
  * run time.
  */
-int i2c_dw_init_slave(struct dw_i2c_dev *dev)
+static int i2c_dw_init_slave(struct dw_i2c_dev *dev)
 {
 	u32 sda_falling_time, scl_falling_time;
 	u32 reg, comp_param1;
@@ -168,7 +168,6 @@ int i2c_dw_init_slave(struct dw_i2c_dev *dev)
 
 	return 0;
 }
-EXPORT_SYMBOL_GPL(i2c_dw_init_slave);
 
 static int i2c_dw_reg_slave(struct i2c_client *slave)
 {
Signature · 1 line
2.11.0
#3 lore raw

PATCH 2/2 i2c: designware: Let slave adapter support be optional

In reply to Jarkko Nikula

Only certain system configurations may use the I2C slave mode so let the support be optional. This allow reducing module size if needed:

   text    data     bss     dec     hex filename
  10328    1336      16   11680    2da0 drivers/i2c/busses/i2c-designware-core.ko
   7222    1136       8    8366    20ae drivers/i2c/busses/i2c-designware-core.ko
---
 drivers/i2c/busses/Kconfig               | 1 -
 drivers/i2c/busses/i2c-designware-core.h | 4 ++++
 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/i2c/busses/Kconfig +0 -1
index c98c8e51c448..1006b230b236 100644
@@ -483,7 +483,6 @@ config I2C_DESIGNWARE_CORE
 config I2C_DESIGNWARE_PLATFORM
 	tristate "Synopsys DesignWare Platform"
 	select I2C_DESIGNWARE_CORE
-	select I2C_DESIGNWARE_SLAVE
 	depends on (ACPI && COMMON_CLK) || !ACPI
 	help
 	  If you say yes to this option, support will be included for the
drivers/i2c/busses/i2c-designware-core.h +4 -0
index a403dcdfca4b..9fee4c054d3d 100644
@@ -309,7 +309,11 @@ void i2c_dw_disable_int(struct dw_i2c_dev *dev);
 
 extern u32 i2c_dw_read_comp_param(struct dw_i2c_dev *dev);
 extern int i2c_dw_probe(struct dw_i2c_dev *dev);
+#if IS_ENABLED(CONFIG_I2C_DESIGNWARE_SLAVE)
 extern int i2c_dw_probe_slave(struct dw_i2c_dev *dev);
+#else
+static inline int i2c_dw_probe_slave(struct dw_i2c_dev *dev) { return -EINVAL; }
+#endif
 
 #if IS_ENABLED(CONFIG_I2C_DESIGNWARE_BAYTRAIL)
 extern int i2c_dw_probe_lock_support(struct dw_i2c_dev *dev);
Signature · 1 line
2.11.0
#5 lore raw
In reply to Jarkko Nikula
Quoted 4 lines · Jarkko Nikula

Hi Luis

I noticed couple minor things after review. Here are patches.

I like the series, esp. patch 1.

m>

Quoted 10 lines

Jarkko Nikula (2):
  i2c: designware: Make HW init functions static
  i2c: designware: Let slave adapter support be optional

 drivers/i2c/busses/Kconfig                 | 1 - drivers/i2c/busses/i2c-designware-core.h   | 6 ++++-- drivers/i2c/busses/i2c-designware-master.c | 7 +++---- drivers/i2c/busses/i2c-designware-slave.c  | 3 +--

 4 files changed, 8 insertions(+), 9 deletions(-)
Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy
Tested-by on the v1 series
#6 lore raw
In reply to Jarkko Nikula
Quoted 4 lines · Jarkko Nikula

Hi Luis

I noticed couple minor things after review. Here are patches.

Hi Jarkko, thank you. Just tested them and everything works as expected.

Quoted 10 lines

Jarkko Nikula (2):
i2c: designware: Make HW init functions static
i2c: designware: Let slave adapter support be optional

 drivers/i2c/busses/Kconfig                 | 1 -
 drivers/i2c/busses/i2c-designware-core.h   | 6 ++++--
 drivers/i2c/busses/i2c-designware-master.c | 7 +++----
 drivers/i2c/busses/i2c-designware-slave.c  | 3 +--
 4 files changed, 8 insertions(+), 9 deletions(-)
Applied
#2 lore raw

Re: [PATCH 1/2] i2c: designware: Make HW init functions static

In reply to Jarkko Nikula
Quoted 8 lines · Jarkko Nikula

Recent i2c-designware slave support patches use master or slave HW init functions through the function pointer so we can declare them static.

While at it, rename i2c_dw_init() as i2c_dw_init_master().

---
 drivers/i2c/busses/i2c-designware-core.h   | 2 --

Applied to for-next (for this merge window), so we have slave support immediately as proper as possible, thanks!

Applied
#4 lore raw

Re: [PATCH 2/2] i2c: designware: Let slave adapter support be optional

In reply to Jarkko Nikula
Quoted 8 lines · Jarkko Nikula

Only certain system configurations may use the I2C slave mode so let the support be optional. This allow reducing module size if needed:

   text    data     bss     dec     hex filename
  10328    1336      16   11680    2da0 drivers/i2c/busses/i2c-designware-core.ko
   7222    1136       8    8366    20ae drivers/i2c/busses/i2c-designware-core.ko

Applied to for-next (for this merge window), so we have slave support immediately as proper as possible, thanks!