can-calc-bit-timing: add support for rcar_can
Signed-off-by: Ramesh Shanmugasundaram <ramesh.shanmugasundaram@bp.renesas.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>pull/16/head
parent
cda61171f1
commit
c689803204
|
|
@ -219,6 +219,27 @@ static void printf_btr_ti_hecc(struct can_bittiming *bt, int hdr)
|
|||
}
|
||||
}
|
||||
|
||||
#define RCAR_CAN_BCR_TSEG1(x) (((x) & 0x0f) << 20)
|
||||
#define RCAR_CAN_BCR_BPR(x) (((x) & 0x3ff) << 8)
|
||||
#define RCAR_CAN_BCR_SJW(x) (((x) & 0x3) << 4)
|
||||
#define RCAR_CAN_BCR_TSEG2(x) ((x) & 0x07)
|
||||
|
||||
static void printf_btr_rcar_can(struct can_bittiming *bt, int hdr)
|
||||
{
|
||||
if (hdr) {
|
||||
printf("%10s", "CiBCR");
|
||||
} else {
|
||||
uint32_t bcr;
|
||||
|
||||
bcr = RCAR_CAN_BCR_TSEG1(bt->phase_seg1 + bt->prop_seg - 1) |
|
||||
RCAR_CAN_BCR_BPR(bt->brp - 1) |
|
||||
RCAR_CAN_BCR_SJW(bt->sjw - 1) |
|
||||
RCAR_CAN_BCR_TSEG2(bt->phase_seg2 - 1);
|
||||
|
||||
printf("0x%08x", bcr << 8);
|
||||
}
|
||||
}
|
||||
|
||||
static struct can_bittiming_const can_calc_consts[] = {
|
||||
{
|
||||
.name = "sja1000",
|
||||
|
|
@ -472,7 +493,21 @@ static struct can_bittiming_const can_calc_consts[] = {
|
|||
|
||||
.ref_clk = 13000000,
|
||||
.printf_btr = printf_btr_ti_hecc,
|
||||
}
|
||||
},
|
||||
{
|
||||
.name = "rcar_can",
|
||||
.tseg1_min = 4,
|
||||
.tseg1_max = 16,
|
||||
.tseg2_min = 2,
|
||||
.tseg2_max = 8,
|
||||
.sjw_max = 4,
|
||||
.brp_min = 1,
|
||||
.brp_max = 1024,
|
||||
.brp_inc = 1,
|
||||
|
||||
.ref_clk = 65000000,
|
||||
.printf_btr = printf_btr_rcar_can,
|
||||
},
|
||||
};
|
||||
|
||||
static long common_bitrates[] = {
|
||||
|
|
|
|||
Loading…
Reference in New Issue