Commit a5f8f0e1 authored by Matthias Fuchs's avatar Matthias Fuchs Committed by Marc Kleine-Budde

can: usb: esd_usb2: Add support for listen-only mode

Add listen-only mode for esd_usb2 driver.
Signed-off-by: default avatarMatthias Fuchs <matthias.fuchs@esd.eu>
Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parent e4bc6c06
...@@ -891,6 +891,9 @@ static int esd_usb2_set_bittiming(struct net_device *netdev) ...@@ -891,6 +891,9 @@ static int esd_usb2_set_bittiming(struct net_device *netdev)
u32 canbtr; u32 canbtr;
canbtr = ESD_USB2_UBR; canbtr = ESD_USB2_UBR;
if (priv->can.ctrlmode & CAN_CTRLMODE_LISTENONLY)
canbtr |= ESD_USB2_LOM;
canbtr |= (bt->brp - 1) & (ESD_USB2_BRP_MAX - 1); canbtr |= (bt->brp - 1) & (ESD_USB2_BRP_MAX - 1);
canbtr |= ((bt->sjw - 1) & (ESD_USB2_SJW_MAX - 1)) canbtr |= ((bt->sjw - 1) & (ESD_USB2_SJW_MAX - 1))
<< ESD_USB2_SJW_SHIFT; << ESD_USB2_SJW_SHIFT;
...@@ -971,6 +974,7 @@ static int esd_usb2_probe_one_net(struct usb_interface *intf, int index) ...@@ -971,6 +974,7 @@ static int esd_usb2_probe_one_net(struct usb_interface *intf, int index)
priv->index = index; priv->index = index;
priv->can.state = CAN_STATE_STOPPED; priv->can.state = CAN_STATE_STOPPED;
priv->can.ctrlmode_supported = CAN_CTRLMODE_LISTENONLY;
priv->can.clock.freq = ESD_USB2_CAN_CLOCK; priv->can.clock.freq = ESD_USB2_CAN_CLOCK;
priv->can.bittiming_const = &esd_usb2_bittiming_const; priv->can.bittiming_const = &esd_usb2_bittiming_const;
priv->can.do_set_bittiming = esd_usb2_set_bittiming; priv->can.do_set_bittiming = esd_usb2_set_bittiming;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment