linux-can-next-for-5.11-20201120
-----BEGIN PGP SIGNATURE-----
iQFHBAABCgAxFiEEK3kIWJt9yTYMP3ehqclaivrt76kFAl+3q+gTHG1rbEBwZW5n
dXRyb25peC5kZQAKCRCpyVqK+u3vqYdjB/46Qv583QBIbM8YaXN+XTSfxSufp0Ku
G0R88mJKdOalgeiD58TaZ3hAegjOW44nCMmZP64mQB7XNvRiyNk8j69VDsRy+4Zy
r86Hi0TIlpeM5oNHb84SpvIO01elmuYNlaoU9t7NQV5YlKA2Lq+kcmMLGa7Z1zVk
IZ2KF2eF2V83p/4A5t1cgQV6LRlDBgAeoe/9pyG0mNX3Fv8lI3WIqjRkuevSm6iJ
XMEuc7kjUZ8Yd59Vvnipm89teD5lCyIpxeJ2hrOsiUlkwyosdCxewMeohJ596a2L
t5DoiT+3nJLOBQ/IKCYe5RoCf7sFZ8nfjqcNYeOm7Yw1CbXg9KwGZTU7
=BedD
-----END PGP SIGNATURE-----
Merge tag 'linux-can-next-for-5.11-20201120' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next
Marc Kleine-Budde says:
====================
pull-request: can-next 2020-11-20
The first patch is by Yegor Yefremov and he improves the j1939 documentaton by
adding tables for the CAN identifier and its fields.
Then there are 8 patches by Oliver Hartkopp targeting the CAN driver
infrastructure and drivers. These add support for optional DLC element to the
Classical CAN frame structure. See patch ea7800565a ("can: add optional DLC
element to Classical CAN frame structure") for details. Oliver's last patch
adds len8_dlc support to several drivers. Stefan Mätje provides a patch to add
len8_dlc support to the esd_usb2 driver.
The next patch is by Oliver Hartkopp, too and adds support for modification of
Classical CAN DLCs to CAN GW sockets.
The next 3 patches target the nxp,flexcan DT bindings. One patch by my adds the
missing uint32 reference to the clock-frequency property. Joakim Zhang's
patches fix the fsl,clk-source property and add the IMX_SC_R_CAN() macro to the
imx firmware header file, which will be used in the flexcan driver later.
Another patch by Joakim Zhang prepares the flexcan driver for SCU based
stop-mode, by giving the existing, GPR based stop-mode, a _GPR postfix.
The next 5 patches are by me, target the flexcan driver, and clean up the
.ndo_open and .ndo_stop callbacks. These patches try to fix a sporadically
hanging flexcan_close() during simultanious ifdown, sending of CAN messages and
probably open CAN bus. I was never able to reproduce, but these seem to fix the
problem at the reporting user. As these changes are rather big, I'd like to
mainline them via net-next/master.
The next patches are by Jimmy Assarsson and Christer Beskow, they add support
for new USB devices to the existing kvaser_usb driver.
The last patch is by Kaixu Xia and simplifies the return in the
mcp251xfd_chip_softreset() function in the mcp251xfd driver.
* tag 'linux-can-next-for-5.11-20201120' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next: (25 commits)
can: mcp251xfd: remove useless code in mcp251xfd_chip_softreset
can: kvaser_usb: Add new Kvaser hydra devices
can: kvaser_usb: kvaser_usb_hydra: Add support for new device variant
can: kvaser_usb: Add new Kvaser Leaf v2 devices
can: kvaser_usb: Add USB_{LEAF,HYDRA}_PRODUCT_ID_END defines
can: flexcan: flexcan_close(): change order if commands to properly shut down the controller
can: flexcan: flexcan_open(): completely initialize controller before requesting IRQ
can: flexcan: flexcan_rx_offload_setup(): factor out mailbox and rx-offload setup into separate function
can: flexcan: move enabling/disabling of interrupts from flexcan_chip_{start,stop}() to callers
can: flexcan: factor out enabling and disabling of interrupts into separate function
can: flexcan: rename macro FLEXCAN_QUIRK_SETUP_STOP_MODE -> FLEXCAN_QUIRK_SETUP_STOP_MODE_GPR
dt-bindings: firmware: add IMX_SC_R_CAN(x) macro for CAN
dt-bindings: can: fsl,flexcan: fix fsl,clk-source property
dt-bindings: can: fsl,flexcan: add uint32 reference to clock-frequency property
can: gw: support modification of Classical CAN DLCs
can: drivers: add len8_dlc support for esd_usb2 CAN adapter
can: drivers: add len8_dlc support for various CAN adapters
can: drivers: introduce helpers to access Classical CAN DLC values
can: update documentation for DLC usage in Classical CAN
can: rename CAN FD related can_len2dlc and can_dlc2len helpers
...
====================
Link: https://lore.kernel.org/r/20201120133318.3428231-1-mkl@pengutronix.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
commit
5e08723967
51 changed files with 676 additions and 406 deletions
|
|
@ -98,14 +98,13 @@ static inline unsigned int can_bit_time(const struct can_bittiming *bt)
|
|||
}
|
||||
|
||||
/*
|
||||
* get_can_dlc(value) - helper macro to cast a given data length code (dlc)
|
||||
* to u8 and ensure the dlc value to be max. 8 bytes.
|
||||
* can_cc_dlc2len(value) - convert a given data length code (dlc) of a
|
||||
* Classical CAN frame into a valid data length of max. 8 bytes.
|
||||
*
|
||||
* To be used in the CAN netdriver receive path to ensure conformance with
|
||||
* ISO 11898-1 Chapter 8.4.2.3 (DLC field)
|
||||
*/
|
||||
#define get_can_dlc(i) (min_t(u8, (i), CAN_MAX_DLC))
|
||||
#define get_canfd_dlc(i) (min_t(u8, (i), CANFD_MAX_DLC))
|
||||
#define can_cc_dlc2len(dlc) (min_t(u8, (dlc), CAN_MAX_DLEN))
|
||||
|
||||
/* Check for outgoing skbs that have not been created by the CAN subsystem */
|
||||
static inline bool can_skb_headroom_valid(struct net_device *dev,
|
||||
|
|
@ -171,6 +170,31 @@ static inline bool can_is_canfd_skb(const struct sk_buff *skb)
|
|||
return skb->len == CANFD_MTU;
|
||||
}
|
||||
|
||||
/* helper to get the data length code (DLC) for Classical CAN raw DLC access */
|
||||
static inline u8 can_get_cc_dlc(const struct can_frame *cf, const u32 ctrlmode)
|
||||
{
|
||||
/* return len8_dlc as dlc value only if all conditions apply */
|
||||
if ((ctrlmode & CAN_CTRLMODE_CC_LEN8_DLC) &&
|
||||
(cf->len == CAN_MAX_DLEN) &&
|
||||
(cf->len8_dlc > CAN_MAX_DLEN && cf->len8_dlc <= CAN_MAX_RAW_DLC))
|
||||
return cf->len8_dlc;
|
||||
|
||||
/* return the payload length as dlc value */
|
||||
return cf->len;
|
||||
}
|
||||
|
||||
/* helper to set len and len8_dlc value for Classical CAN raw DLC access */
|
||||
static inline void can_frame_set_cc_len(struct can_frame *cf, const u8 dlc,
|
||||
const u32 ctrlmode)
|
||||
{
|
||||
/* the caller already ensured that dlc is a value from 0 .. 15 */
|
||||
if (ctrlmode & CAN_CTRLMODE_CC_LEN8_DLC && dlc > CAN_MAX_DLEN)
|
||||
cf->len8_dlc = dlc;
|
||||
|
||||
/* limit the payload length 'len' to CAN_MAX_DLEN */
|
||||
cf->len = can_cc_dlc2len(dlc);
|
||||
}
|
||||
|
||||
/* helper to define static CAN controller features at device creation time */
|
||||
static inline void can_set_static_ctrlmode(struct net_device *dev,
|
||||
u32 static_mode)
|
||||
|
|
@ -186,11 +210,11 @@ static inline void can_set_static_ctrlmode(struct net_device *dev,
|
|||
dev->mtu = CANFD_MTU;
|
||||
}
|
||||
|
||||
/* get data length from can_dlc with sanitized can_dlc */
|
||||
u8 can_dlc2len(u8 can_dlc);
|
||||
/* get data length from raw data length code (DLC) */
|
||||
u8 can_fd_dlc2len(u8 dlc);
|
||||
|
||||
/* map the sanitized data length to an appropriate data length code */
|
||||
u8 can_len2dlc(u8 len);
|
||||
u8 can_fd_len2dlc(u8 len);
|
||||
|
||||
struct net_device *alloc_candev_mqs(int sizeof_priv, unsigned int echo_skb_max,
|
||||
unsigned int txqs, unsigned int rxqs);
|
||||
|
|
|
|||
|
|
@ -282,7 +282,7 @@ static inline int pucan_msg_get_channel(const struct pucan_rx_msg *msg)
|
|||
}
|
||||
|
||||
/* return the dlc value from any received message channel_dlc field */
|
||||
static inline int pucan_msg_get_dlc(const struct pucan_rx_msg *msg)
|
||||
static inline u8 pucan_msg_get_dlc(const struct pucan_rx_msg *msg)
|
||||
{
|
||||
return msg->channel_dlc >> 4;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue