module_param(master, bool, 0444);
MODULE_PARM_DESC(master, "LIN interface is Master device");
module_param(baudrate, int, 0444);
MODULE_PARM_DESC(baudrate, "Baudrate of LIN interface");
module_param(master, bool, 0444);
MODULE_PARM_DESC(master, "LIN interface is Master device");
module_param(baudrate, int, 0444);
MODULE_PARM_DESC(baudrate, "Baudrate of LIN interface");
int tx_lim; /* actual limit of bytes to Tx */
int tx_cnt; /* number of already Tx bytes */
char lin_master; /* node is a master node */
int tx_lim; /* actual limit of bytes to Tx */
int tx_cnt; /* number of already Tx bytes */
char lin_master; /* node is a master node */
int lin_baud; /* LIN baudrate */
int lin_state; /* state */
char id_to_send; /* there is ID to be sent */
int lin_baud; /* LIN baudrate */
int lin_state; /* state */
char id_to_send; /* there is ID to be sent */
-#ifndef BREAK_BY_BAUD
- /* We didn't receive Break character -- fake it! */
- if ((sl->rx_cnt == SLLIN_BUFF_BREAK) && (*cp == 0x55)) {
- netdev_dbg(sl->dev, "LIN_RX[%d]: 0x00\n", sl->rx_cnt);
- sl->rx_buff[sl->rx_cnt++] = 0x00;
+ if (!sl->lin_break_by_baud ) {
+ /* We didn't receive Break character -- fake it! */
+ if ((sl->rx_cnt == SLLIN_BUFF_BREAK) && (*cp == 0x55)) {
+ netdev_dbg(sl->dev, "LIN_RX[%d]: 0x00\n",
+ sl->rx_cnt);
+ sl->rx_buff[sl->rx_cnt++] = 0x00;
+ }
if (sl->rx_cnt < SLLIN_BUFF_LEN) {
netdev_dbg(sl->dev, "LIN_RX[%d]: 0x%02x\n", sl->rx_cnt, *cp);
if (sl->rx_cnt < SLLIN_BUFF_LEN) {
netdev_dbg(sl->dev, "LIN_RX[%d]: 0x%02x\n", sl->rx_cnt, *cp);
break_baud = ((sl->lin_baud * 2) / 3);
sltty_change_speed(tty, break_baud);
break_baud = ((sl->lin_baud * 2) / 3);
sltty_change_speed(tty, break_baud);
tty->ops->flush_buffer(tty);
} else {
netdev_dbg(sl->dev, "flush_buffer is not implemented.\n");
tty->ops->flush_buffer(tty);
} else {
netdev_dbg(sl->dev, "flush_buffer is not implemented.\n");
sl->lin_baud = (baudrate == 0) ? LIN_DEFAULT_BAUDRATE : baudrate;
pr_debug("sllin: Baudrate set to %u\n", sl->lin_baud);
sl->lin_baud = (baudrate == 0) ? LIN_DEFAULT_BAUDRATE : baudrate;
pr_debug("sllin: Baudrate set to %u\n", sl->lin_baud);
+ sl->lin_break_by_baud = break_by_baud;
+
+ if (tty->ops->break_ctl == NULL && !sl->lin_break_by_baud) {
+ sl->lin_break_by_baud = true;
+ pr_notice ("sllin: break_ctl, switching to break_by_baud\n");
+ }
+
sl->lin_state = SLSTATE_IDLE;
hrtimer_init(&sl->rx_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
sl->lin_state = SLSTATE_IDLE;
hrtimer_init(&sl->rx_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-#ifdef BREAK_BY_BAUD
- pr_debug("sllin: Break is generated by baud-rate change.");
-#else
- pr_debug("sllin: Break is generated manually with tiny sleep.");
-#endif
+ if (break_by_baud)
+ pr_debug("sllin: Break is generated by baud-rate change.");
+ else
+ pr_debug("sllin: Break is generated manually with tiny sleep.");