Skip to content

Commit 86c03a0

Browse files
ParthibanI17164kuba-moo
authored andcommitted
net: ethernet: oa_tc6: implement error interrupts unmasking
This will unmask the following error interrupts from the MAC-PHY. tx protocol error rx buffer overflow error loss of framing error header error The MAC-PHY will signal an error by setting the EXST bit in the receive data footer which will then allow the host to read the STATUS0 register to find the source of the error. Reviewed-by: Andrew Lunn <[email protected]> Signed-off-by: Parthiban Veerasooran <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 1f9c4ee commit 86c03a0

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

drivers/net/ethernet/oa_tc6.c

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@
1818
#define OA_TC6_REG_STATUS0 0x0008
1919
#define STATUS0_RESETC BIT(6) /* Reset Complete */
2020

21+
/* Interrupt Mask Register #0 */
22+
#define OA_TC6_REG_INT_MASK0 0x000C
23+
#define INT_MASK0_HEADER_ERR_MASK BIT(5)
24+
#define INT_MASK0_LOSS_OF_FRAME_ERR_MASK BIT(4)
25+
#define INT_MASK0_RX_BUFFER_OVERFLOW_ERR_MASK BIT(3)
26+
#define INT_MASK0_TX_PROTOCOL_ERR_MASK BIT(0)
27+
2128
/* Control command header */
2229
#define OA_TC6_CTRL_HEADER_DATA_NOT_CTRL BIT(31)
2330
#define OA_TC6_CTRL_HEADER_WRITE_NOT_READ BIT(29)
@@ -327,6 +334,23 @@ static int oa_tc6_sw_reset_macphy(struct oa_tc6 *tc6)
327334
return oa_tc6_write_register(tc6, OA_TC6_REG_STATUS0, regval);
328335
}
329336

337+
static int oa_tc6_unmask_macphy_error_interrupts(struct oa_tc6 *tc6)
338+
{
339+
u32 regval;
340+
int ret;
341+
342+
ret = oa_tc6_read_register(tc6, OA_TC6_REG_INT_MASK0, &regval);
343+
if (ret)
344+
return ret;
345+
346+
regval &= ~(INT_MASK0_TX_PROTOCOL_ERR_MASK |
347+
INT_MASK0_RX_BUFFER_OVERFLOW_ERR_MASK |
348+
INT_MASK0_LOSS_OF_FRAME_ERR_MASK |
349+
INT_MASK0_HEADER_ERR_MASK);
350+
351+
return oa_tc6_write_register(tc6, OA_TC6_REG_INT_MASK0, regval);
352+
}
353+
330354
/**
331355
* oa_tc6_init - allocates and initializes oa_tc6 structure.
332356
* @spi: device with which data will be exchanged.
@@ -369,6 +393,13 @@ struct oa_tc6 *oa_tc6_init(struct spi_device *spi)
369393
return NULL;
370394
}
371395

396+
ret = oa_tc6_unmask_macphy_error_interrupts(tc6);
397+
if (ret) {
398+
dev_err(&tc6->spi->dev,
399+
"MAC-PHY error interrupts unmask failed: %d\n", ret);
400+
return NULL;
401+
}
402+
372403
return tc6;
373404
}
374405
EXPORT_SYMBOL_GPL(oa_tc6_init);

0 commit comments

Comments
 (0)