From 35124e21efc22c570a19876a2e1a83a230104bf9 Mon Sep 17 00:00:00 2001 From: Heesub Shin Date: Sun, 9 Apr 2017 18:32:58 +0900 Subject: [PATCH] s5j/i2c: remove s5j_i2c_reset() s5j_i2c_reset() is not in use. It is compiled only when we have enabled CONFIG_I2C_RESET which depends on ARCH_HAVE_I2CRESET, but it is never set in S5J platform. Both Kconfig knobs have never been enabled, so there is no point in having s5j_i2c_reset(). This commit removes it. This commit does not make any functional differences. Change-Id: Ia14f169fee75d0b4bde60595b020f5a8bf93895f Signed-off-by: Heesub Shin --- os/arch/arm/src/s5j/s5j_i2c.c | 109 ------------------------------------------ os/arch/arm/src/s5j/s5j_i2c.h | 5 +- 2 files changed, 1 insertion(+), 113 deletions(-) diff --git a/os/arch/arm/src/s5j/s5j_i2c.c b/os/arch/arm/src/s5j/s5j_i2c.c index bc456e0..cdbef5e 100644 --- a/os/arch/arm/src/s5j/s5j_i2c.c +++ b/os/arch/arm/src/s5j/s5j_i2c.c @@ -1263,115 +1263,6 @@ int s5j_i2c_write(FAR struct i2c_dev_s *dev, FAR const uint8_t *buffer, int bufl /** * - * @brief I2C bus reset - * @param struct i2c_master_s *dev : structure visible to the I2C client - * @return int : ==0 :OK - * @note - */ -#ifdef CONFIG_I2C_RESET -int s5j_i2c_reset(FAR struct i2c_dev_s *dev) -{ - struct s5j_i2c_priv_s *priv = (struct s5j_i2c_priv_s *)dev; - unsigned int clock_count; - unsigned int stretch_count; - unsigned int scl_gpio; - unsigned int sda_gpio; - int ret = ERROR; - - DEBUGASSERT(priv && priv->config); - - /* Our caller must own a ref */ - - ASSERT(priv->refs > 0); - - /* Lock out other clients */ - - s5j_i2c_sem_wait(priv); - - /* Un-initialize the port */ - - s5j_i2c_uninitialize(priv); - - /* Use GPIO configuration to un-wedge the bus */ - - scl_gpio = priv->config->scl_pin; - sda_gpio = priv->config->sda_pin; - - gpio_cfg_pin(scl_gpio, GPIO_FUNC(1)); - gpio_cfg_pin(sda_gpio, GPIO_FUNC(1)); - - /* Let SDA go high */ - - gpio_set_value(sda_gpio, 1); - /* Clock the bus until any slaves currently driving it let it go. */ - - clock_count = 0; - while (!gpio_get_value(sda_gpio)) { - /* Give up if we have tried too hard */ - - if (clock_count++ > 10) { - goto out; - } - - /* Sniff to make sure that clock stretching has finished. - * - * If the bus never relaxes, the reset has failed. - */ - - stretch_count = 0; - while (!gpio_get_value(scl_gpio)) { - /* Give up if we have tried too hard */ - - if (stretch_count++ > 10) { - goto out; - } - - up_udelay(10); - } - - /* Drive SCL low */ - - gpio_set_value(scl_gpio, 0); - up_udelay(10); - - /* Drive SCL high again */ - - gpio_set_value(scl_gpio, 1); - up_udelay(10); - } - - /* Generate a start followed by a stop to reset slave - * state machines. - */ - - gpio_set_value(sda_gpio, 0); - up_udelay(10); - gpio_set_value(scl_gpio, 0); - up_udelay(10); - gpio_set_value(scl_gpio, 1); - up_udelay(10); - gpio_set_value(sda_gpio, 1); - up_udelay(10); - - /* Revert the GPIO configuration. */ - - gpio_cfg_pin(scl_gpio, GPIO_FUNC(0)); - gpio_cfg_pin(sda_gpio, GPIO_FUNC(0)); - /* Re-init the port */ - - s5j_i2c_initialize(priv, priv->xfer_speed); - ret = OK; - -out: - - /* Release the port for re-use by other clients */ - s5j_i2c_sem_post(priv); - return ret; -} -#endif /* CONFIG_I2C_RESET */ - -/** - * * @brief Initialize one I2C bus * @param int port : * @return struct i2c_master_s : device structure diff --git a/os/arch/arm/src/s5j/s5j_i2c.h b/os/arch/arm/src/s5j/s5j_i2c.h index 942dab4..ec7e839 100644 --- a/os/arch/arm/src/s5j/s5j_i2c.h +++ b/os/arch/arm/src/s5j/s5j_i2c.h @@ -271,10 +271,7 @@ int s5j_i2c_setownaddress(FAR struct i2c_dev_s *dev, int addr, int nbits); int s5j_i2c_transfer(struct i2c_dev_s *dev, struct i2c_msg_s *msgv, int msgc); int s5j_i2c_read(FAR struct i2c_dev_s *dev, FAR uint8_t *buffer, int buflen); int s5j_i2c_write(FAR struct i2c_dev_s *dev, FAR const uint8_t *buffer, int buflen); -#ifdef CONFIG_I2C_RESET -int s5j_i2c_reset(FAR struct i2c_dev_s *dev); -#endif struct i2c_dev_s *up_i2cinitialize(int port); int s5j_i2cbus_uninitialize(FAR struct i2c_dev_s *dev); void s5j_i2c_register(int bus); -#endif /* __ARCH_ARM_SRC_S5J_I2C_H */ +#endif /* __ARCH_ARM_SRC_S5J_I2C_H */ -- 2.7.4