linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oliver Hartkopp <socketcan@hartkopp.net>
To: "linux-can@vger.kernel.org" <linux-can@vger.kernel.org>,
	Stephane Grosjean <s.grosjean@peak-system.com>
Subject: [PATCH RFC] can fd: Add separate bittiming infrastructure
Date: Wed, 15 Jan 2014 18:54:16 +0100	[thread overview]
Message-ID: <52D6CB48.9010206@hartkopp.net> (raw)

Introduce a second set of bitrate configuration for the (potential different)
data bitrate. The CAN FD arbitration bitrate is stored in the existing
bittiming configuration space.

TODO:
The functions can_calc_bittiming(), can_fixup_bittiming() should change their
parameters from

	(struct net_device *dev, struct can_bittiming *bt)
to
	(struct can_bittiming *bt, const struct can_bittiming_const *btc, const struct can_clock *clk)

to be able to pass the two sets of bittiming parameters (CAN / CAN FD).

And some more changes in dev.c taking care of the two bitrates (when FD is
enabled).

Btw. starting with the first idea of a separate bittiming setup. Any comments?

Regards,
Oliver

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>

---

diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h
index fb0ab65..ce4d15c 100644
--- a/include/linux/can/dev.h
+++ b/include/linux/can/dev.h
@@ -33,9 +33,10 @@ enum can_mode {
 struct can_priv {
 	struct can_device_stats can_stats;
 
-	struct can_bittiming bittiming;
-	const struct can_bittiming_const *bittiming_const;
-	struct can_clock clock;
+	struct can_bittiming bittiming, data_bittiming;
+	const struct can_bittiming_const *bittiming_const,
+		*data_bittiming_const;
+	struct can_clock clock, data_clock;
 
 	enum can_state state;
 	u32 ctrlmode;
diff --git a/include/uapi/linux/can/netlink.h b/include/uapi/linux/can/netlink.h
index df944ed..bd0493a2 100644
--- a/include/uapi/linux/can/netlink.h
+++ b/include/uapi/linux/can/netlink.h
@@ -96,6 +96,7 @@ struct can_ctrlmode {
 #define CAN_CTRLMODE_3_SAMPLES		0x04	/* Triple sampling mode */
 #define CAN_CTRLMODE_ONE_SHOT		0x08	/* One-Shot mode */
 #define CAN_CTRLMODE_BERR_REPORTING	0x10	/* Bus-error reporting */
+#define CAN_CTRLMODE_FD			0x20	/* CAN FD mode */
 
 /*
  * CAN device statistics
@@ -122,6 +123,9 @@ enum {
 	IFLA_CAN_RESTART_MS,
 	IFLA_CAN_RESTART,
 	IFLA_CAN_BERR_COUNTER,
+	IFLA_CAN_DATA_BITTIMING,
+	IFLA_CAN_DATA_BITTIMING_CONST,
+	IFLA_CAN_DATA_CLOCK,
 	__IFLA_CAN_MAX
 };
 

             reply	other threads:[~2014-01-15 17:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-15 17:54 Oliver Hartkopp [this message]
2014-01-16 16:30 ` [PATCH RFC] can fd: Add separate bittiming infrastructure Marc Kleine-Budde
2014-01-17  7:44 ` Stephane Grosjean
2014-01-18 17:34   ` Oliver Hartkopp
2014-01-21  8:42     ` Stephane Grosjean
2014-01-21  9:56       ` Oliver Hartkopp
2014-01-21 10:22       ` [RFC] can fd: backward compatibility for CANFD8 Oliver Hartkopp

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52D6CB48.9010206@hartkopp.net \
    --to=socketcan@hartkopp.net \
    --cc=linux-can@vger.kernel.org \
    --cc=s.grosjean@peak-system.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).