drivers: net: tc6: Handle lost of device synchronization (SYNC == 0)

Handle the situation when OA TC6 compliant device signals to the host
that its configuration is lost - i.e. the SYNC bit in the footer is
cleared.

In this (unlikely happen) situation the device is reset and reconfigured.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
This commit is contained in:
Lukasz Majewski 2023-11-28 12:16:40 +01:00 committed by Fabio Baltieri
parent 384ba59c5b
commit 32e64cb8c5
2 changed files with 10 additions and 1 deletions

View file

@ -425,6 +425,7 @@ static void lan865x_int_thread(const struct device *dev)
struct lan865x_data *ctx = dev->data;
struct oa_tc6 *tc6 = ctx->tc6;
uint32_t sts, val, ftr;
int ret;
while (true) {
k_sem_take(&ctx->int_sem, K_FOREVER);
@ -459,7 +460,10 @@ static void lan865x_int_thread(const struct device *dev)
lan865x_read_chunks(dev);
} while (tc6->rca > 0);
oa_tc6_check_status(tc6);
ret = oa_tc6_check_status(tc6);
if (ret == -EIO) {
lan865x_gpio_reset(dev);
}
}
}

View file

@ -227,6 +227,11 @@ int oa_tc6_check_status(struct oa_tc6 *tc6)
{
uint32_t sts;
if (!tc6->sync) {
LOG_ERR("SYNC: Configuration lost, reset IC!");
return -EIO;
}
if (tc6->exst) {
/*
* Just clear any pending interrupts.