Skip to content

Commit c78c1b0

Browse files
mhennerichStefan Schmidt
authored andcommitted
net: ieee802154: adf7242: Avoid redundant RC_READY polling
READ/WRITE register and packet buffer can be done anytime as long as SPI_READY. Only CMD transactions require RC_READY && SPI_READY. Signed-off-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Stefan Schmidt <stefan@osg.samsung.com>
1 parent 78f012b commit c78c1b0

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

drivers/net/ieee802154/adf7242.c

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -344,12 +344,18 @@ static int adf7242_wait_status(struct adf7242_local *lp, unsigned int status,
344344
return ret;
345345
}
346346

347-
static int adf7242_wait_ready(struct adf7242_local *lp, int line)
347+
static int adf7242_wait_rc_ready(struct adf7242_local *lp, int line)
348348
{
349349
return adf7242_wait_status(lp, STAT_RC_READY | STAT_SPI_READY,
350350
STAT_RC_READY | STAT_SPI_READY, line);
351351
}
352352

353+
static int adf7242_wait_spi_ready(struct adf7242_local *lp, int line)
354+
{
355+
return adf7242_wait_status(lp, STAT_SPI_READY,
356+
STAT_SPI_READY, line);
357+
}
358+
353359
static int adf7242_write_fbuf(struct adf7242_local *lp, u8 *data, u8 len)
354360
{
355361
u8 *buf = lp->buf;
@@ -369,7 +375,7 @@ static int adf7242_write_fbuf(struct adf7242_local *lp, u8 *data, u8 len)
369375
spi_message_add_tail(&xfer_head, &msg);
370376
spi_message_add_tail(&xfer_buf, &msg);
371377

372-
adf7242_wait_ready(lp, __LINE__);
378+
adf7242_wait_spi_ready(lp, __LINE__);
373379

374380
mutex_lock(&lp->bmux);
375381
buf[0] = CMD_SPI_PKT_WR;
@@ -401,7 +407,7 @@ static int adf7242_read_fbuf(struct adf7242_local *lp,
401407
spi_message_add_tail(&xfer_head, &msg);
402408
spi_message_add_tail(&xfer_buf, &msg);
403409

404-
adf7242_wait_ready(lp, __LINE__);
410+
adf7242_wait_spi_ready(lp, __LINE__);
405411

406412
mutex_lock(&lp->bmux);
407413
if (packet_read) {
@@ -432,7 +438,7 @@ static int adf7242_read_reg(struct adf7242_local *lp, u16 addr, u8 *data)
432438
.rx_buf = lp->buf_read_rx,
433439
};
434440

435-
adf7242_wait_ready(lp, __LINE__);
441+
adf7242_wait_spi_ready(lp, __LINE__);
436442

437443
mutex_lock(&lp->bmux);
438444
lp->buf_read_tx[0] = CMD_SPI_MEM_RD(addr);
@@ -462,7 +468,7 @@ static int adf7242_write_reg(struct adf7242_local *lp, u16 addr, u8 data)
462468
{
463469
int status;
464470

465-
adf7242_wait_ready(lp, __LINE__);
471+
adf7242_wait_spi_ready(lp, __LINE__);
466472

467473
mutex_lock(&lp->bmux);
468474
lp->buf_reg_tx[0] = CMD_SPI_MEM_WR(addr);
@@ -484,7 +490,7 @@ static int adf7242_cmd(struct adf7242_local *lp, unsigned int cmd)
484490
dev_vdbg(&lp->spi->dev, "%s : CMD=0x%X\n", __func__, cmd);
485491

486492
if (cmd != CMD_RC_PC_RESET_NO_WAIT)
487-
adf7242_wait_ready(lp, __LINE__);
493+
adf7242_wait_rc_ready(lp, __LINE__);
488494

489495
mutex_lock(&lp->bmux);
490496
lp->buf_cmd = cmd;

0 commit comments

Comments
 (0)