drivers: ethernet: w5500: keep thread blocking in command read-back
add changes for command read-back and change from k_sleep to k_busy_wait which will allow other threads to wakeup Signed-off-by: Hari Haran Babu <hariharan@linumiz.com> Signed-off-by: Marcel Graber <marcel@clever.design>
This commit is contained in:
parent
e3b8fad9fa
commit
d8e3affe7b
2 changed files with 9 additions and 8 deletions
|
@ -160,18 +160,17 @@ static int w5500_command(const struct device *dev, uint8_t cmd)
|
|||
uint64_t end = sys_clock_timeout_end_calc(K_MSEC(100));
|
||||
|
||||
w5500_spi_write(dev, W5500_S0_CR, &cmd, 1);
|
||||
do {
|
||||
while (1) {
|
||||
w5500_spi_read(dev, W5500_S0_CR, ®, 1);
|
||||
if (!reg) {
|
||||
break;
|
||||
}
|
||||
int64_t remaining = end - sys_clock_tick_get();
|
||||
|
||||
if (remaining <= 0) {
|
||||
return -EIO;
|
||||
}
|
||||
k_busy_wait(W5500_PHY_ACCESS_DELAY);
|
||||
}
|
||||
|
||||
w5500_spi_read(dev, W5500_S0_CR, ®, 1);
|
||||
|
||||
k_msleep(1);
|
||||
} while (reg != 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -76,6 +76,8 @@
|
|||
#define W5500_Sn_RX_MEM_START 0x30000
|
||||
#define W5500_RX_MEM_SIZE 0x04000
|
||||
|
||||
/* Delay for PHY write/read operations (25.6 us) */
|
||||
#define W5500_PHY_ACCESS_DELAY 26U
|
||||
struct w5500_config {
|
||||
struct spi_dt_spec spi;
|
||||
struct gpio_dt_spec interrupt;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue