Skip to content

Commit c20ff3e

Browse files
stm-at-esdmarckleinebudde
authored andcommitted
can: esd_402_pci: Add support for one-shot mode
This patch adds support for one-shot mode. In this mode there happens no automatic retransmission in the case of an arbitration lost error or on any bus error. Signed-off-by: Stefan Mätje <[email protected]> Link: https://lore.kernel.org/all/[email protected] Signed-off-by: Marc Kleine-Budde <[email protected]>
1 parent 3e6cb3f commit c20ff3e

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

drivers/net/can/esd/esd_402_pci-core.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,12 +369,13 @@ static int pci402_init_cores(struct pci_dev *pdev)
369369
SET_NETDEV_DEV(netdev, &pdev->dev);
370370

371371
priv = netdev_priv(netdev);
372+
priv->can.clock.freq = card->ov.core_frequency;
372373
priv->can.ctrlmode_supported = CAN_CTRLMODE_LOOPBACK |
373374
CAN_CTRLMODE_LISTENONLY |
374375
CAN_CTRLMODE_BERR_REPORTING |
375376
CAN_CTRLMODE_CC_LEN8_DLC;
376-
377-
priv->can.clock.freq = card->ov.core_frequency;
377+
if (card->ov.features & ACC_OV_REG_FEAT_MASK_DAR)
378+
priv->can.ctrlmode_supported |= CAN_CTRLMODE_ONE_SHOT;
378379
if (card->ov.features & ACC_OV_REG_FEAT_MASK_CANFD)
379380
priv->can.bittiming_const = &pci402_bittiming_const_canfd;
380381
else

drivers/net/can/esd/esdacc.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
/* esdACC DLC register layout */
1818
#define ACC_DLC_DLC_MASK GENMASK(3, 0)
1919
#define ACC_DLC_RTR_FLAG BIT(4)
20+
#define ACC_DLC_SSTX_FLAG BIT(24) /* Single Shot TX */
21+
22+
/* esdACC DLC in struct acc_bmmsg_rxtxdone::acc_dlc.len only! */
2023
#define ACC_DLC_TXD_FLAG BIT(5)
2124

2225
/* ecc value of esdACC equals SJA1000's ECC register */
@@ -59,7 +62,7 @@ static void acc_resetmode_leave(struct acc_core *core)
5962
acc_resetmode_entered(core);
6063
}
6164

62-
static void acc_txq_put(struct acc_core *core, u32 acc_id, u8 acc_dlc,
65+
static void acc_txq_put(struct acc_core *core, u32 acc_id, u32 acc_dlc,
6366
const void *data)
6467
{
6568
acc_write32_noswap(core, ACC_CORE_OF_TXFIFO_DATA_1,
@@ -249,7 +252,7 @@ netdev_tx_t acc_start_xmit(struct sk_buff *skb, struct net_device *netdev)
249252
u8 tx_fifo_head = core->tx_fifo_head;
250253
int fifo_usage;
251254
u32 acc_id;
252-
u8 acc_dlc;
255+
u32 acc_dlc;
253256

254257
if (can_dropped_invalid_skb(netdev, skb))
255258
return NETDEV_TX_OK;
@@ -274,6 +277,8 @@ netdev_tx_t acc_start_xmit(struct sk_buff *skb, struct net_device *netdev)
274277
acc_dlc = can_get_cc_dlc(cf, priv->can.ctrlmode);
275278
if (cf->can_id & CAN_RTR_FLAG)
276279
acc_dlc |= ACC_DLC_RTR_FLAG;
280+
if (priv->can.ctrlmode & CAN_CTRLMODE_ONE_SHOT)
281+
acc_dlc |= ACC_DLC_SSTX_FLAG;
277282

278283
if (cf->can_id & CAN_EFF_FLAG) {
279284
acc_id = cf->can_id & CAN_EFF_MASK;

drivers/net/can/esd/esdacc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
*/
3636
#define ACC_OV_REG_FEAT_MASK_CANFD BIT(27 - 16)
3737
#define ACC_OV_REG_FEAT_MASK_NEW_PSC BIT(28 - 16)
38+
#define ACC_OV_REG_FEAT_MASK_DAR BIT(30 - 16)
3839

3940
#define ACC_OV_REG_MODE_MASK_ENDIAN_LITTLE BIT(0)
4041
#define ACC_OV_REG_MODE_MASK_BM_ENABLE BIT(1)

0 commit comments

Comments
 (0)