[PATCH v2 05/16] can: ems_usb: Added CAN FD initialization struct

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



cpc_generic_can_params is used to initialize the CPC-USB/FD in a CAN
controller independent way

Signed-off-by: Gerhard Uttenthaler <uttenthaler@xxxxxxxxxxxxxxxx>
---
 drivers/net/can/usb/ems_usb.c | 30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/drivers/net/can/usb/ems_usb.c b/drivers/net/can/usb/ems_usb.c
index e75fdd457919..cb7a002e8627 100644
--- a/drivers/net/can/usb/ems_usb.c
+++ b/drivers/net/can/usb/ems_usb.c
@@ -153,12 +153,40 @@ struct cpc_sja1000_params {
 	u8 outp_contr;
 };
 
+#define CPC_GENERICCONF_FD          BIT(0)
+#define CPC_GENERICCONF_FD_BOSCH    BIT(1)
+#define CPC_GENERICCONF_LISTEN_ONLY BIT(2)
+#define CPC_GENERICCONF_SINGLE_SHOT BIT(3)
+#define CPC_GENERICCONF_RESET_MODE  BIT(4)
+
+#define CPC_USB_RESET_MODE 0x00
+#define CPC_USB_RUN_MODE   0x01
+
+struct __packed cpc_generic_can_params {
+	__le32 config; /* config sets CAN initialization parameters like LOM */
+	__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 */
+	} nominal_bitrate;
+	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 */
+	} data_bitrate;
+	__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



[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux