Fix chip/s32k3xx_lpi2c.c:624:3: error: unused function 's32k3xx_lpi2c_sem_waitstop'
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
987d2561c0
commit
670c3e0e35
@ -238,9 +238,7 @@ static uint32_t s32k3xx_lpi2c_toticks(int msgc, struct i2c_msg_s *msgs);
|
||||
#endif /* CONFIG_S32K3XX_I2C_DYNTIMEO */
|
||||
|
||||
static inline int
|
||||
s32k3xx_lpi2c_sem_waitdone(struct s32k3xx_lpi2c_priv_s *priv);
|
||||
static inline void
|
||||
s32k3xx_lpi2c_sem_waitstop(struct s32k3xx_lpi2c_priv_s *priv);
|
||||
s32k3xx_lpi2c_sem_waitdone(struct s32k3xx_lpi2c_priv_s *priv);
|
||||
|
||||
#ifdef CONFIG_I2C_TRACE
|
||||
static void s32k3xx_lpi2c_tracereset(struct s32k3xx_lpi2c_priv_s *priv);
|
||||
@ -470,7 +468,7 @@ static uint32_t s32k3xx_lpi2c_toticks(int msgc, struct i2c_msg_s *msgs)
|
||||
|
||||
#ifndef CONFIG_I2C_POLLED
|
||||
static inline int
|
||||
s32k3xx_lpi2c_sem_waitdone(struct s32k3xx_lpi2c_priv_s *priv)
|
||||
s32k3xx_lpi2c_sem_waitdone(struct s32k3xx_lpi2c_priv_s *priv)
|
||||
{
|
||||
irqstate_t flags;
|
||||
uint32_t regval;
|
||||
@ -561,7 +559,7 @@ static inline int
|
||||
}
|
||||
#else
|
||||
static inline int
|
||||
s32k3xx_lpi2c_sem_waitdone(struct s32k3xx_lpi2c_priv_s *priv)
|
||||
s32k3xx_lpi2c_sem_waitdone(struct s32k3xx_lpi2c_priv_s *priv)
|
||||
{
|
||||
clock_t timeout;
|
||||
clock_t start;
|
||||
@ -612,95 +610,6 @@ static inline int
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: s32k3xx_lpi2c_sem_waitstop
|
||||
*
|
||||
* Description:
|
||||
* Wait for a STOP to complete
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static inline void
|
||||
s32k3xx_lpi2c_sem_waitstop(struct s32k3xx_lpi2c_priv_s *priv)
|
||||
{
|
||||
clock_t start;
|
||||
clock_t elapsed;
|
||||
clock_t timeout;
|
||||
uint32_t regval;
|
||||
|
||||
/* Select a timeout */
|
||||
|
||||
#ifdef CONFIG_S32K3XX_I2C_DYNTIMEO
|
||||
timeout = USEC2TICK(CONFIG_S32K3XX_I2C_DYNTIMEO_STARTSTOP);
|
||||
#else
|
||||
timeout = CONFIG_S32K3XX_I2CTIMEOTICKS;
|
||||
#endif
|
||||
|
||||
/* Wait as stop might still be in progress; but stop might also
|
||||
* be set because of a timeout error: "The [STOP] bit is set and
|
||||
* cleared by software, cleared by hardware when a Stop condition is
|
||||
* detected, set by hardware when a timeout error is detected."
|
||||
*/
|
||||
|
||||
start = clock_systime_ticks();
|
||||
do
|
||||
{
|
||||
/* Calculate the elapsed time */
|
||||
|
||||
elapsed = clock_systime_ticks() - start;
|
||||
|
||||
/* Check for STOP condition */
|
||||
|
||||
if (priv->config->mode == LPI2C_MASTER)
|
||||
{
|
||||
regval = s32k3xx_lpi2c_getreg(priv, S32K3XX_LPI2C_MSR_OFFSET);
|
||||
if ((regval & LPI2C_MSR_SDF) == LPI2C_MSR_SDF)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* Enable Interrupts when slave mode */
|
||||
|
||||
else
|
||||
{
|
||||
regval = s32k3xx_lpi2c_getreg(priv, S32K3XX_LPI2C_SSR_OFFSET);
|
||||
if ((regval & LPI2C_SSR_SDF) == LPI2C_SSR_SDF)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* Check for NACK error */
|
||||
|
||||
if (priv->config->mode == LPI2C_MASTER)
|
||||
{
|
||||
regval = s32k3xx_lpi2c_getreg(priv, S32K3XX_LPI2C_MSR_OFFSET);
|
||||
if ((regval & LPI2C_MSR_NDF) == LPI2C_MSR_NDF)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* Enable Interrupts when slave mode */
|
||||
|
||||
else
|
||||
{
|
||||
#warning Missing logic for I2C Slave
|
||||
}
|
||||
}
|
||||
|
||||
/* Loop until the stop is complete or a timeout occurs. */
|
||||
|
||||
while (elapsed < timeout);
|
||||
|
||||
/* If we get here then a timeout occurred with the STOP condition
|
||||
* still pending.
|
||||
*/
|
||||
|
||||
i2cinfo("Timeout with Status Register: %" PRIx32 "\n", regval);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: s32k3xx_lpi2c_trace*
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user