Signed-off-by: Gerhard Uttenthaler <uttenthaler@xxxxxxxxxxxxxxxx> --- drivers/net/can/usb/ems_usb.c | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/drivers/net/can/usb/ems_usb.c b/drivers/net/can/usb/ems_usb.c index fa96217c7d72..4ed0d681a68c 100644 --- a/drivers/net/can/usb/ems_usb.c +++ b/drivers/net/can/usb/ems_usb.c @@ -142,7 +142,7 @@ struct __packed cpc_canfd_msg { #define CPC_FDFLAG_XTD 0x80 /* Representation of the CAN parameters for the SJA1000 controller */ -struct cpc_sja1000_params { +struct __packed cpc_sja1000_params { u8 mode; u8 acc_code0; u8 acc_code1; @@ -157,12 +157,41 @@ struct cpc_sja1000_params { u8 outp_contr; }; +#define CPC_GENERICCONF_FD 0x00000001 +#define CPC_GENERICCONF_FD_BOSCH 0x00000002 +#define CPC_GENERICCONF_LISTEN_ONLY 0x00000004 +#define CPC_GENERICCONF_SINGLE_SHOT 0x00000008 +#define CPC_GENERICCONF_RESET_MODE 0x00000010 + +#define CPC_USB_RESET_MODE 0x00 +#define CPC_USB_RUN_MODE 0x01 + +struct __packed cpc_generic_can_params { + /* config sets CAN initialization parameters like LOM */ + __le32 config; + __le32 can_clk; + struct { + __le16 tseg1; // Time segment 1 (before sample point) + __le16 tseg2; // Time segment 2 (after sample point) + __le16 brp; // Baud rate rate prescaler + __le16 sjw; // (Re)synchronization jump width + } n; // nominal baud rate + struct { + __le16 tseg1; // Time segment 1 (before sample point) + __le16 tseg2; // Time segment 2 (after sample point) + __le16 brp; // Baud rate prescaler + __le16 sjw; // (Re)synchronization jump width + } d; // data baud rate + __le32 reserved[5]; // Set to 0. Reserved for future use +}; + /* CAN params message representation */ -struct cpc_can_params { +struct __packed cpc_can_params { u8 cc_type; union { struct cpc_sja1000_params sja1000; + struct cpc_generic_can_params generic; } cc_params; }; -- 2.26.2 -- EMS Dr. Thomas Wuensche e.K. Sonnenhang 3 85304 Ilmmuenster HR Ingolstadt, HRA 170106 Phone: +49-8441-490260 Fax : +49-8441-81860 http://www.ems-wuensche.com