diff options
Diffstat (limited to 'drivers/net/can/dev.c')
-rw-r--r-- | drivers/net/can/dev.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c index 9bf1116e5b5..25695bde054 100644 --- a/drivers/net/can/dev.c +++ b/drivers/net/can/dev.c | |||
@@ -150,7 +150,19 @@ static int can_calc_bittiming(struct net_device *dev, struct can_bittiming *bt) | |||
150 | bt->prop_seg = tseg1 / 2; | 150 | bt->prop_seg = tseg1 / 2; |
151 | bt->phase_seg1 = tseg1 - bt->prop_seg; | 151 | bt->phase_seg1 = tseg1 - bt->prop_seg; |
152 | bt->phase_seg2 = tseg2; | 152 | bt->phase_seg2 = tseg2; |
153 | bt->sjw = 1; | 153 | |
154 | /* check for sjw user settings */ | ||
155 | if (!bt->sjw || !btc->sjw_max) | ||
156 | bt->sjw = 1; | ||
157 | else { | ||
158 | /* bt->sjw is at least 1 -> sanitize upper bound to sjw_max */ | ||
159 | if (bt->sjw > btc->sjw_max) | ||
160 | bt->sjw = btc->sjw_max; | ||
161 | /* bt->sjw must not be higher than tseg2 */ | ||
162 | if (tseg2 < bt->sjw) | ||
163 | bt->sjw = tseg2; | ||
164 | } | ||
165 | |||
154 | bt->brp = best_brp; | 166 | bt->brp = best_brp; |
155 | /* real bit-rate */ | 167 | /* real bit-rate */ |
156 | bt->bitrate = priv->clock.freq / (bt->brp * (tseg1 + tseg2 + 1)); | 168 | bt->bitrate = priv->clock.freq / (bt->brp * (tseg1 + tseg2 + 1)); |