• Home
  • Raw
  • Download

Lines Matching refs:bt

117 static int can_calc_bittiming(struct net_device *dev, struct can_bittiming *bt,  in can_calc_bittiming()  argument
133 if (bt->sample_point) { in can_calc_bittiming()
134 sample_point_nominal = bt->sample_point; in can_calc_bittiming()
136 if (bt->bitrate > 800000) in can_calc_bittiming()
138 else if (bt->bitrate > 500000) in can_calc_bittiming()
150 brp = priv->clock.freq / (tsegall * bt->bitrate) + tseg % 2; in can_calc_bittiming()
158 bitrate_error = abs(bt->bitrate - bitrate); in can_calc_bittiming()
185 do_div(v64, bt->bitrate); in can_calc_bittiming()
198 bt->sample_point = can_update_sample_point(btc, sample_point_nominal, in can_calc_bittiming()
204 bt->tq = (u32)v64; in can_calc_bittiming()
205 bt->prop_seg = tseg1 / 2; in can_calc_bittiming()
206 bt->phase_seg1 = tseg1 - bt->prop_seg; in can_calc_bittiming()
207 bt->phase_seg2 = tseg2; in can_calc_bittiming()
210 if (!bt->sjw || !btc->sjw_max) { in can_calc_bittiming()
211 bt->sjw = 1; in can_calc_bittiming()
214 if (bt->sjw > btc->sjw_max) in can_calc_bittiming()
215 bt->sjw = btc->sjw_max; in can_calc_bittiming()
217 if (tseg2 < bt->sjw) in can_calc_bittiming()
218 bt->sjw = tseg2; in can_calc_bittiming()
221 bt->brp = best_brp; in can_calc_bittiming()
224 bt->bitrate = priv->clock.freq / in can_calc_bittiming()
225 (bt->brp * (CAN_SYNC_SEG + tseg1 + tseg2)); in can_calc_bittiming()
230 static int can_calc_bittiming(struct net_device *dev, struct can_bittiming *bt, in can_calc_bittiming() argument
243 static int can_fixup_bittiming(struct net_device *dev, struct can_bittiming *bt, in can_fixup_bittiming() argument
250 tseg1 = bt->prop_seg + bt->phase_seg1; in can_fixup_bittiming()
251 if (!bt->sjw) in can_fixup_bittiming()
252 bt->sjw = 1; in can_fixup_bittiming()
253 if (bt->sjw > btc->sjw_max || in can_fixup_bittiming()
255 bt->phase_seg2 < btc->tseg2_min || bt->phase_seg2 > btc->tseg2_max) in can_fixup_bittiming()
258 brp64 = (u64)priv->clock.freq * (u64)bt->tq; in can_fixup_bittiming()
265 bt->brp = (u32)brp64; in can_fixup_bittiming()
267 if (bt->brp < btc->brp_min || bt->brp > btc->brp_max) in can_fixup_bittiming()
270 alltseg = bt->prop_seg + bt->phase_seg1 + bt->phase_seg2 + 1; in can_fixup_bittiming()
271 bt->bitrate = priv->clock.freq / (bt->brp * alltseg); in can_fixup_bittiming()
272 bt->sample_point = ((tseg1 + 1) * 1000) / alltseg; in can_fixup_bittiming()
279 can_validate_bitrate(struct net_device *dev, struct can_bittiming *bt, in can_validate_bitrate() argument
287 if (bt->bitrate == bitrate_const[i]) in can_validate_bitrate()
297 static int can_get_bittiming(struct net_device *dev, struct can_bittiming *bt, in can_get_bittiming() argument
309 if (!bt->tq && bt->bitrate && btc) in can_get_bittiming()
310 err = can_calc_bittiming(dev, bt, btc); in can_get_bittiming()
311 else if (bt->tq && !bt->bitrate && btc) in can_get_bittiming()
312 err = can_fixup_bittiming(dev, bt, btc); in can_get_bittiming()
313 else if (!bt->tq && bt->bitrate && bitrate_const) in can_get_bittiming()
314 err = can_validate_bitrate(dev, bt, bitrate_const, in can_get_bittiming()
973 struct can_bittiming bt; in can_changelink() local
987 memcpy(&bt, nla_data(data[IFLA_CAN_BITTIMING]), sizeof(bt)); in can_changelink()
988 err = can_get_bittiming(dev, &bt, in can_changelink()
995 if (priv->bitrate_max && bt.bitrate > priv->bitrate_max) { in can_changelink()
1001 memcpy(&priv->bittiming, &bt, sizeof(bt)); in can_changelink()