All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] can-calc-bittiming: add stm32 bxcan
@ 2021-06-24  3:19 Kurt Van Dijck
  2021-06-24  3:19 ` [PATCH 2/3] can-calc-bittiming: add c_can Kurt Van Dijck
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Kurt Van Dijck @ 2021-06-24  3:19 UTC (permalink / raw)
  To: linux-can; +Cc: Kurt Van Dijck

Signed-off-by: Kurt Van Dijck <dev.kurt@vandijck-laurijssen.be>
---
 can-calc-bit-timing.c | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/can-calc-bit-timing.c b/can-calc-bit-timing.c
index d99bd22..fb61947 100644
--- a/can-calc-bit-timing.c
+++ b/can-calc-bit-timing.c
@@ -273,6 +273,22 @@ static void printf_btr_rcar_can(struct can_bittiming *bt, bool hdr)
 	}
 }
 
+static void printf_btr_bxcan(struct can_bittiming *bt, bool hdr)
+{
+	if (hdr) {
+		printf("%10s", "CAN_BTR");
+	} else {
+		uint32_t btr;
+
+		btr = (((bt->brp -1) & 0x3ff) << 0) |
+			(((bt->prop_seg + bt->phase_seg1 -1) & 0xf) << 16) |
+			(((bt->phase_seg2 -1) & 0x7) << 20) |
+			(((bt->sjw -1) & 0x3) << 24);
+
+		printf("0x%08x", btr);
+	}
+}
+
 static struct calc_bittiming_const can_calc_consts[] = {
 	{
 		.bittiming_const = {
@@ -417,6 +433,22 @@ static struct calc_bittiming_const can_calc_consts[] = {
 			{ .clk = 65000000, },
 		},
 		.printf_btr = printf_btr_rcar_can,
+	}, {
+		.bittiming_const = {
+			.name = "bxcan",
+			.tseg1_min = 1,
+			.tseg1_max = 16,
+			.tseg2_min = 1,
+			.tseg2_max = 8,
+			.sjw_max = 4,
+			.brp_min = 1,
+			.brp_max = 1024,
+			.brp_inc = 1,
+		},
+		.ref_clk = {
+			{ .clk = 48000000, },
+		},
+		.printf_btr = printf_btr_bxcan,
 	},
 };
 
-- 
2.25.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-06-24 11:15 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-24  3:19 [PATCH 1/3] can-calc-bittiming: add stm32 bxcan Kurt Van Dijck
2021-06-24  3:19 ` [PATCH 2/3] can-calc-bittiming: add c_can Kurt Van Dijck
2021-06-24  3:19 ` [PATCH 3/3] can-calc-bittiming: add mcan Kurt Van Dijck
2021-06-24 10:50   ` Marc Kleine-Budde
2021-06-24 10:57     ` Kurt Van Dijck
2021-06-24 11:12       ` Marc Kleine-Budde
2021-06-24 11:15       ` Marc Kleine-Budde
2021-06-24  6:20 ` [PATCH 1/3] can-calc-bittiming: add stm32 bxcan Marc Kleine-Budde
2021-06-24 10:37   ` Kurt Van Dijck
2021-06-24 10:40     ` Marc Kleine-Budde

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.