diff options
author | Timos Ampelikiotis <t.ampelikiotis@virtualopensystems.com> | 2024-10-03 10:54:49 +0300 |
---|---|---|
committer | Timos Ampelikiotis <t.ampelikiotis@virtualopensystems.com> | 2024-11-06 15:58:16 +0200 |
commit | 70c6b997f65a4ea87003b7dcb3c282c590c6cec2 (patch) | |
tree | 4c156d45fcba8bd254c72fa2a2cb4ebefe6007d5 /meta-egvirt/recipes-kernel/kernel-module-virtio-can/files/virtio_can.h | |
parent | d0d69fddf69e544f6b594621754074169480b410 (diff) |
Update virtio-can driver
Updates [v2]:
- Rename virtio-can recipe to solve SDPX error
Updates [v1]:
- Update virtio-can driver implementation and make it
compatible with all kernel versions between v5.10 and
v6.6. The implementation was tested on AGL refHW and
raspberry pi 4 boards.
Bug-AGL: SPEC-4966
Change-Id: I1b41d3e220b99f839e20b5b498aab8e1dc77c0ab
Signed-off-by: Timos Ampelikiotis <t.ampelikiotis@virtualopensystems.com>
Diffstat (limited to 'meta-egvirt/recipes-kernel/kernel-module-virtio-can/files/virtio_can.h')
-rw-r--r-- | meta-egvirt/recipes-kernel/kernel-module-virtio-can/files/virtio_can.h | 54 |
1 files changed, 30 insertions, 24 deletions
diff --git a/meta-egvirt/recipes-kernel/kernel-module-virtio-can/files/virtio_can.h b/meta-egvirt/recipes-kernel/kernel-module-virtio-can/files/virtio_can.h index 0ca75c7a..7cf613bb 100644 --- a/meta-egvirt/recipes-kernel/kernel-module-virtio-can/files/virtio_can.h +++ b/meta-egvirt/recipes-kernel/kernel-module-virtio-can/files/virtio_can.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: BSD-3-Clause */ /* - * Copyright (C) 2021 OpenSynergy GmbH + * Copyright (C) 2021-2023 OpenSynergy GmbH */ #ifndef _LINUX_VIRTIO_VIRTIO_CAN_H #define _LINUX_VIRTIO_VIRTIO_CAN_H @@ -11,28 +11,37 @@ #include <linux/virtio_config.h> /* Feature bit numbers */ -#define VIRTIO_CAN_F_CAN_CLASSIC 0u -#define VIRTIO_CAN_F_CAN_FD 1u -#define VIRTIO_CAN_F_LATE_TX_ACK 2u -#define VIRTIO_CAN_F_RTR_FRAMES 3u +#define VIRTIO_CAN_F_CAN_CLASSIC 0 +#define VIRTIO_CAN_F_CAN_FD 1 +#define VIRTIO_CAN_F_LATE_TX_ACK 2 +#define VIRTIO_CAN_F_RTR_FRAMES 3 /* CAN Result Types */ -#define VIRTIO_CAN_RESULT_OK 0u -#define VIRTIO_CAN_RESULT_NOT_OK 1u +#define VIRTIO_CAN_RESULT_OK 0 +#define VIRTIO_CAN_RESULT_NOT_OK 1 /* CAN flags to determine type of CAN Id */ -#define VIRTIO_CAN_FLAGS_EXTENDED 0x8000u -#define VIRTIO_CAN_FLAGS_FD 0x4000u -#define VIRTIO_CAN_FLAGS_RTR 0x2000u +#define VIRTIO_CAN_FLAGS_EXTENDED 0x8000 +#define VIRTIO_CAN_FLAGS_FD 0x4000 +#define VIRTIO_CAN_FLAGS_RTR 0x2000 + +struct virtio_can_config { +#define VIRTIO_CAN_S_CTRL_BUSOFF (1u << 0) /* Controller BusOff */ + /* CAN controller status */ + __le16 status; +}; /* TX queue message types */ struct virtio_can_tx_out { -#define VIRTIO_CAN_TX 0x0001u +#define VIRTIO_CAN_TX 0x0001 __le16 msg_type; - __le16 reserved; + __le16 length; /* 0..8 CC, 0..64 CAN-FD, 0..2048 CAN-XL, 12 bits */ + __u8 reserved_classic_dlc; /* If CAN classic length = 8 then DLC can be 8..15 */ + __u8 padding; + __le16 reserved_xl_priority; /* May be needed for CAN XL priority */ __le32 flags; __le32 can_id; - __u8 sdu[64u]; + __u8 sdu[64]; }; struct virtio_can_tx_in { @@ -41,18 +50,21 @@ struct virtio_can_tx_in { /* RX queue message types */ struct virtio_can_rx { -#define VIRTIO_CAN_RX 0x0101u +#define VIRTIO_CAN_RX 0x0101 __le16 msg_type; - __le16 reserved; + __le16 length; /* 0..8 CC, 0..64 CAN-FD, 0..2048 CAN-XL, 12 bits */ + __u8 reserved_classic_dlc; /* If CAN classic length = 8 then DLC can be 8..15 */ + __u8 padding; + __le16 reserved_xl_priority; /* May be needed for CAN XL priority */ __le32 flags; __le32 can_id; - __u8 sdu[64u]; + __u8 sdu[64]; }; /* Control queue message types */ struct virtio_can_control_out { -#define VIRTIO_CAN_SET_CTRL_MODE_START 0x0201u -#define VIRTIO_CAN_SET_CTRL_MODE_STOP 0x0202u +#define VIRTIO_CAN_SET_CTRL_MODE_START 0x0201 +#define VIRTIO_CAN_SET_CTRL_MODE_STOP 0x0202 __le16 msg_type; }; @@ -60,10 +72,4 @@ struct virtio_can_control_in { __u8 result; }; -/* Indication queue message types */ -struct virtio_can_event_ind { -#define VIRTIO_CAN_BUSOFF_IND 0x0301u - __le16 msg_type; -}; - #endif /* #ifndef _LINUX_VIRTIO_VIRTIO_CAN_H */ |