You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by da...@apache.org on 2022/08/01 11:34:09 UTC
[incubator-nuttx] branch master updated: NXP S32K1XX: fix LPI2C reset
This is an automated email from the ASF dual-hosted git repository.
davids5 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new a554b9ce89 NXP S32K1XX: fix LPI2C reset
a554b9ce89 is described below
commit a554b9ce899dd9ffaf5a090285c9979130b35301
Author: Jari van Ewijk <ja...@nxp.com>
AuthorDate: Mon Aug 1 11:32:03 2022 +0200
NXP S32K1XX: fix LPI2C reset
---
arch/arm/Kconfig | 1 +
arch/arm/src/s32k1xx/s32k1xx_lpi2c.c | 22 +++++++++++-----------
2 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 59d00ae5e7..870655b2f3 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -245,6 +245,7 @@ config ARCH_CHIP_S32K1XX
select ARCH_HAVE_MPU
select ARM_HAVE_MPU_UNIFIED
select ARCH_HAVE_RAMFUNCS
+ select ARCH_HAVE_I2CRESET
---help---
NPX S32K1XX architectures (ARM Cortex-M0+ and Cortex-M4F).
diff --git a/arch/arm/src/s32k1xx/s32k1xx_lpi2c.c b/arch/arm/src/s32k1xx/s32k1xx_lpi2c.c
index 517d35656c..1a900fc724 100644
--- a/arch/arm/src/s32k1xx/s32k1xx_lpi2c.c
+++ b/arch/arm/src/s32k1xx/s32k1xx_lpi2c.c
@@ -47,6 +47,7 @@
#include "hardware/s32k1xx_pinmux.h"
#include "s32k1xx_lpi2c.h"
#include "s32k1xx_periphclocks.h"
+#include "s32k1xx_pin.h"
#include <arch/board/board.h>
@@ -1615,8 +1616,7 @@ static int s32k1xx_lpi2c_transfer(struct i2c_master_s *dev,
#ifdef CONFIG_I2C_RESET
static int s32k1xx_lpi2c_reset(struct i2c_master_s *dev)
{
- struct s32k1xx_lpi2c_priv_s *priv =
- (struct s32k1xx_lpi2c_priv_s *)dev;
+ struct s32k1xx_lpi2c_priv_s *priv = (struct s32k1xx_lpi2c_priv_s *)dev;
unsigned int clock_count;
unsigned int stretch_count;
uint32_t scl_gpio;
@@ -1658,12 +1658,12 @@ static int s32k1xx_lpi2c_reset(struct i2c_master_s *dev)
/* Let SDA go high */
- s32k1xx_gpio_write(sda_gpio, 1);
+ s32k1xx_gpiowrite(sda_gpio, 1);
/* Clock the bus until any slaves currently driving it let it go. */
clock_count = 0;
- while (!s32k1xx_gpio_read(sda_gpio))
+ while (!s32k1xx_gpioread(sda_gpio))
{
/* Give up if we have tried too hard */
@@ -1678,7 +1678,7 @@ static int s32k1xx_lpi2c_reset(struct i2c_master_s *dev)
*/
stretch_count = 0;
- while (!s32k1xx_gpio_read(scl_gpio))
+ while (!s32k1xx_gpioread(scl_gpio))
{
/* Give up if we have tried too hard */
@@ -1692,12 +1692,12 @@ static int s32k1xx_lpi2c_reset(struct i2c_master_s *dev)
/* Drive SCL low */
- s32k1xx_gpio_write(scl_gpio, 0);
+ s32k1xx_gpiowrite(scl_gpio, 0);
up_udelay(10);
/* Drive SCL high again */
- s32k1xx_gpio_write(scl_gpio, 1);
+ s32k1xx_gpiowrite(scl_gpio, 1);
up_udelay(10);
}
@@ -1705,13 +1705,13 @@ static int s32k1xx_lpi2c_reset(struct i2c_master_s *dev)
* state machines.
*/
- s32k1xx_gpio_write(sda_gpio, 0);
+ s32k1xx_gpiowrite(sda_gpio, 0);
up_udelay(10);
- s32k1xx_gpio_write(scl_gpio, 0);
+ s32k1xx_gpiowrite(scl_gpio, 0);
up_udelay(10);
- s32k1xx_gpio_write(scl_gpio, 1);
+ s32k1xx_gpiowrite(scl_gpio, 1);
up_udelay(10);
- s32k1xx_gpio_write(sda_gpio, 1);
+ s32k1xx_gpiowrite(sda_gpio, 1);
up_udelay(10);
/* Revert the GPIO configuration. */