* [PATCH] can-calc-bit-timing: add support for rcar_can
@ 2016-02-29 10:18 Ramesh Shanmugasundaram
2016-02-29 10:29 ` Marc Kleine-Budde
0 siblings, 1 reply; 4+ messages in thread
From: Ramesh Shanmugasundaram @ 2016-02-29 10:18 UTC (permalink / raw)
To: mkl, wg; +Cc: linux-can, Ramesh Shanmugasundaram
Signed-off-by: Ramesh Shanmugasundaram <ramesh.shanmugasundaram@bp.renesas.com>
---
Hi Mark,
This patch is generated on top of can-utils master
commit:
cda6117 can: avoid using timeval for uapi
in response to https://www.mail-archive.com/netdev@vger.kernel.org/msg99549.html
can-calc-bit-timing.c | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/can-calc-bit-timing.c b/can-calc-bit-timing.c
index 9031a78..b6236f0 100644
--- a/can-calc-bit-timing.c
+++ b/can-calc-bit-timing.c
@@ -219,6 +219,26 @@ static void printf_btr_ti_hecc(struct can_bittiming *bt, int hdr)
}
}
+static void printf_btr_rcar_can(struct can_bittiming *bt, int hdr)
+{
+ if (hdr) {
+ printf("%10s", "CiBCR");
+ } else {
+ uint32_t bcr;
+#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)
+
+ 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,6 +492,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,
+ },
}
};
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] can-calc-bit-timing: add support for rcar_can
2016-02-29 10:18 [PATCH] can-calc-bit-timing: add support for rcar_can Ramesh Shanmugasundaram
@ 2016-02-29 10:29 ` Marc Kleine-Budde
2016-02-29 10:41 ` [PATCH v2] " Ramesh Shanmugasundaram
0 siblings, 1 reply; 4+ messages in thread
From: Marc Kleine-Budde @ 2016-02-29 10:29 UTC (permalink / raw)
To: Ramesh Shanmugasundaram, wg; +Cc: linux-can
[-- Attachment #1: Type: text/plain, Size: 2283 bytes --]
On 02/29/2016 11:18 AM, Ramesh Shanmugasundaram wrote:
> Signed-off-by: Ramesh Shanmugasundaram <ramesh.shanmugasundaram@bp.renesas.com>
> ---
> Hi Mark,
>
> This patch is generated on top of can-utils master
>
> commit:
> cda6117 can: avoid using timeval for uapi
>
> in response to https://www.mail-archive.com/netdev@vger.kernel.org/msg99549.html
>
> can-calc-bit-timing.c | 35 +++++++++++++++++++++++++++++++++++
> 1 file changed, 35 insertions(+)
>
> diff --git a/can-calc-bit-timing.c b/can-calc-bit-timing.c
> index 9031a78..b6236f0 100644
> --- a/can-calc-bit-timing.c
> +++ b/can-calc-bit-timing.c
> @@ -219,6 +219,26 @@ static void printf_btr_ti_hecc(struct can_bittiming *bt, int hdr)
> }
> }
>
> +static void printf_btr_rcar_can(struct can_bittiming *bt, int hdr)
> +{
> + if (hdr) {
> + printf("%10s", "CiBCR");
> + } else {
> + uint32_t bcr;
> +#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)
> +
> + 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,6 +492,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,
> + },
> }
^^^
This doesn't look right, fixed while applying.
thanks,
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 455 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2] can-calc-bit-timing: add support for rcar_can
2016-02-29 10:29 ` Marc Kleine-Budde
@ 2016-02-29 10:41 ` Ramesh Shanmugasundaram
2016-02-29 10:50 ` Marc Kleine-Budde
0 siblings, 1 reply; 4+ messages in thread
From: Ramesh Shanmugasundaram @ 2016-02-29 10:41 UTC (permalink / raw)
To: mkl, wg; +Cc: linux-can, Ramesh Shanmugasundaram
Signed-off-by: Ramesh Shanmugasundaram <ramesh.shanmugasundaram@bp.renesas.com>
---
Hi Marc,
Thanks. Missed it while removing the hacks. This v2 patch corrects it.
can-calc-bit-timing.c | 36 +++++++++++++++++++++++++++++++++++-
1 file changed, 35 insertions(+), 1 deletion(-)
diff --git a/can-calc-bit-timing.c b/can-calc-bit-timing.c
index 9031a78..b89536b 100644
--- a/can-calc-bit-timing.c
+++ b/can-calc-bit-timing.c
@@ -219,6 +219,26 @@ static void printf_btr_ti_hecc(struct can_bittiming *bt, int hdr)
}
}
+static void printf_btr_rcar_can(struct can_bittiming *bt, int hdr)
+{
+ if (hdr) {
+ printf("%10s", "CiBCR");
+ } else {
+ uint32_t bcr;
+#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)
+
+ 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 +492,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[] = {
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] can-calc-bit-timing: add support for rcar_can
2016-02-29 10:41 ` [PATCH v2] " Ramesh Shanmugasundaram
@ 2016-02-29 10:50 ` Marc Kleine-Budde
0 siblings, 0 replies; 4+ messages in thread
From: Marc Kleine-Budde @ 2016-02-29 10:50 UTC (permalink / raw)
To: Ramesh Shanmugasundaram, wg; +Cc: linux-can
[-- Attachment #1: Type: text/plain, Size: 587 bytes --]
On 02/29/2016 11:41 AM, Ramesh Shanmugasundaram wrote:
> Signed-off-by: Ramesh Shanmugasundaram <ramesh.shanmugasundaram@bp.renesas.com>
> ---
> Hi Marc,
>
> Thanks. Missed it while removing the hacks. This v2 patch corrects it.
I've already fixed it myself and pushed to master.
thanks,
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 455 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-02-29 10:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-29 10:18 [PATCH] can-calc-bit-timing: add support for rcar_can Ramesh Shanmugasundaram
2016-02-29 10:29 ` Marc Kleine-Budde
2016-02-29 10:41 ` [PATCH v2] " Ramesh Shanmugasundaram
2016-02-29 10:50 ` Marc Kleine-Budde
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).