mcp251xfd.h (24436be590c6fbb05f6161b0dfba7d9da60214aa) | mcp251xfd.h (b8e0ddd36ce9536ad7478dd27df06c9ae92370ba) |
---|---|
1/* SPDX-License-Identifier: GPL-2.0 2 * 3 * mcp251xfd - Microchip MCP251xFD Family CAN controller driver 4 * 5 * Copyright (c) 2019, 2020, 2021, 2023 Pengutronix, 6 * Marc Kleine-Budde <kernel@pengutronix.de> 7 * Copyright (c) 2019 Martin Sperl <kernel@martin.sperl.org> 8 */ --- 510 unchanged lines hidden (view full) --- 519}; 520 521struct mcp251xfd_tef_ring { 522 unsigned int head; 523 unsigned int tail; 524 525 /* u8 obj_num equals tx_ring->obj_num */ 526 /* u8 obj_size equals sizeof(struct mcp251xfd_hw_tef_obj) */ | 1/* SPDX-License-Identifier: GPL-2.0 2 * 3 * mcp251xfd - Microchip MCP251xFD Family CAN controller driver 4 * 5 * Copyright (c) 2019, 2020, 2021, 2023 Pengutronix, 6 * Marc Kleine-Budde <kernel@pengutronix.de> 7 * Copyright (c) 2019 Martin Sperl <kernel@martin.sperl.org> 8 */ --- 510 unchanged lines hidden (view full) --- 519}; 520 521struct mcp251xfd_tef_ring { 522 unsigned int head; 523 unsigned int tail; 524 525 /* u8 obj_num equals tx_ring->obj_num */ 526 /* u8 obj_size equals sizeof(struct mcp251xfd_hw_tef_obj) */ |
527 /* u8 obj_num_shift_to_u8 equals tx_ring->obj_num_shift_to_u8 */ |
|
527 528 union mcp251xfd_write_reg_buf irq_enable_buf; 529 struct spi_transfer irq_enable_xfer; 530 struct spi_message irq_enable_msg; 531 532 union mcp251xfd_write_reg_buf uinc_buf; 533 union mcp251xfd_write_reg_buf uinc_irq_disable_buf; 534 struct spi_transfer uinc_xfer[MCP251XFD_TX_OBJ_NUM_MAX]; 535}; 536 537struct mcp251xfd_tx_ring { 538 unsigned int head; 539 unsigned int tail; 540 541 u16 base; 542 u8 nr; 543 u8 fifo_nr; 544 u8 obj_num; | 528 529 union mcp251xfd_write_reg_buf irq_enable_buf; 530 struct spi_transfer irq_enable_xfer; 531 struct spi_message irq_enable_msg; 532 533 union mcp251xfd_write_reg_buf uinc_buf; 534 union mcp251xfd_write_reg_buf uinc_irq_disable_buf; 535 struct spi_transfer uinc_xfer[MCP251XFD_TX_OBJ_NUM_MAX]; 536}; 537 538struct mcp251xfd_tx_ring { 539 unsigned int head; 540 unsigned int tail; 541 542 u16 base; 543 u8 nr; 544 u8 fifo_nr; 545 u8 obj_num; |
546 u8 obj_num_shift_to_u8; |
|
545 u8 obj_size; 546 547 struct mcp251xfd_tx_obj obj[MCP251XFD_TX_OBJ_NUM_MAX]; 548 union mcp251xfd_write_reg_buf rts_buf; 549}; 550 551struct mcp251xfd_rx_ring { 552 unsigned int head; --- 324 unchanged lines hidden (view full) --- 877 return priv->tef->head & (priv->tx->obj_num - 1); 878} 879 880static inline u8 mcp251xfd_get_tef_tail(const struct mcp251xfd_priv *priv) 881{ 882 return priv->tef->tail & (priv->tx->obj_num - 1); 883} 884 | 547 u8 obj_size; 548 549 struct mcp251xfd_tx_obj obj[MCP251XFD_TX_OBJ_NUM_MAX]; 550 union mcp251xfd_write_reg_buf rts_buf; 551}; 552 553struct mcp251xfd_rx_ring { 554 unsigned int head; --- 324 unchanged lines hidden (view full) --- 879 return priv->tef->head & (priv->tx->obj_num - 1); 880} 881 882static inline u8 mcp251xfd_get_tef_tail(const struct mcp251xfd_priv *priv) 883{ 884 return priv->tef->tail & (priv->tx->obj_num - 1); 885} 886 |
885static inline u8 mcp251xfd_get_tef_len(const struct mcp251xfd_priv *priv) | 887static inline u8 mcp251xfd_get_tef_linear_len(const struct mcp251xfd_priv *priv, u8 len) |
886{ | 888{ |
887 return priv->tef->head - priv->tef->tail; 888} 889 890static inline u8 mcp251xfd_get_tef_linear_len(const struct mcp251xfd_priv *priv) 891{ 892 u8 len; 893 894 len = mcp251xfd_get_tef_len(priv); 895 | |
896 return min_t(u8, len, priv->tx->obj_num - mcp251xfd_get_tef_tail(priv)); 897} 898 899static inline u8 mcp251xfd_get_tx_head(const struct mcp251xfd_tx_ring *ring) 900{ 901 return ring->head & (ring->obj_num - 1); 902} 903 --- 79 unchanged lines hidden --- | 889 return min_t(u8, len, priv->tx->obj_num - mcp251xfd_get_tef_tail(priv)); 890} 891 892static inline u8 mcp251xfd_get_tx_head(const struct mcp251xfd_tx_ring *ring) 893{ 894 return ring->head & (ring->obj_num - 1); 895} 896 --- 79 unchanged lines hidden --- |