Skip to contentSkip to conversation

can: Add driver for esd CAN-USB/2 device

PATCH Superseded Matthias Fuchs 2 participants 4 messages May 10, 2010 3 messages not in the archive

Subsystems (3)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 can: Add driver for esd CAN-USB/2 device

This patch adds a driver for esd's USB high speed
CAN interface. The driver supports devices with
multiple CAN interfaces.

---

version 2:
- use bus-error reporting and counters
- minor cleanup
- rebased against current net-next-2.6 tree
- initial post to linux-usb list for review

 drivers/net/can/usb/Kconfig    |    6 +
 drivers/net/can/usb/Makefile   |    1 +
 drivers/net/can/usb/esd_usb2.c | 1126 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 1133 insertions(+), 0 deletions(-)
 create mode 100644 drivers/net/can/usb/esd_usb2.c
drivers/net/can/usb/Kconfig +6 -0
index 97ff6fe..0452549 100644
@@ -7,4 +7,10 @@ config CAN_EMS_USB
 	  This driver is for the one channel CPC-USB/ARM7 CAN/USB interface
 	  from EMS Dr. Thomas Wuensche (http://www.ems-wuensche.de).
 
+config CAN_ESD_USB2
+        tristate "ESD USB/2 CAN/USB interface"
+        ---help---
+          This driver supports the CAN-USB/2 interface
+          from esd electronic system design gmbh (http://www.esd.eu).
+
 endmenu
drivers/net/can/usb/Makefile +1 -0
index 0afd51d..fce3cf1 100644
@@ -3,5 +3,6 @@
 #
 
 obj-$(CONFIG_CAN_EMS_USB) += ems_usb.o
+obj-$(CONFIG_CAN_ESD_USB2) += esd_usb2.o
 
 ccflags-$(CONFIG_CAN_DEBUG_DEVICES) := -DDEBUG
drivers/net/can/usb/esd_usb2.c new file +1126 -0

1,126 lines not on this page · raw message

Signature · 1 line
1.5.6.3

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

Hi Matthias,

Quoted 9 lines · Matthias Fuchs

This patch adds a driver for esd's USB high speed
CAN interface. The driver supports devices with
multiple CAN interfaces.

---

version 2:
- use bus-error reporting and counters

I don't find support for CAN_CTRLMODE_BERR_REPORTING, apart from setting the flag. If it's set bus error interrupts should be enabled or disabled otherwise.

Wolfgang.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw

Hi Wolfgang,

Quoted 10 lines · Wolfgang Grandegger

Hi Matthias,

Quoted 7 lines · Matthias Fuchs

This patch adds a driver for esd's USB high speed
CAN interface. The driver supports devices with
multiple CAN interfaces.

---

Quoted 8 lines
Quoted 2 lines

version 2:
- use bus-error reporting and counters

I don't find support for CAN_CTRLMODE_BERR_REPORTING, apart from setting the flag. If it's set bus error interrupts should be enabled or disabled otherwise.

Wolfgang.

I expect my implementation to be complete.

1) In esd_usb2_rx_event() I pass tx/rxerr in cf->data[6/7].
2) I implemented esd_usb2_get_berr_counter(). This function will return the last tx/rx error counters from the hardware that are kept in priv->bec.
3) tx/rx error counter cannot be requested from the hardware so they are stored in priv->bec when they are received from the hardware. There is no way to enable or disable this behavior.
4) Finally I enabled the whole interface via CAN_CTRLMODE_BERR_REPORTING for the CAN framework.

I don't see where I missed anything.

Matthias

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw
Quoted 23 lines · Matthias Fuchs

Hi Wolfgang,

Quoted 10 lines · Wolfgang Grandegger

Hi Matthias,

Quoted 7 lines · Matthias Fuchs

This patch adds a driver for esd's USB high speed
CAN interface. The driver supports devices with
multiple CAN interfaces.

---

Quoted 8 lines
Quoted 2 lines

version 2:
- use bus-error reporting and counters

I don't find support for CAN_CTRLMODE_BERR_REPORTING, apart from setting the flag. If it's set bus error interrupts should be enabled or disabled otherwise.

Wolfgang.

I expect my implementation to be complete.

Quoted 9 lines

1) In esd_usb2_rx_event() I pass tx/rxerr in cf->data[6/7].
2) I implemented esd_usb2_get_berr_counter(). This function will return the last tx/rx error counters from the hardware that are kept in priv->bec.
3) tx/rx error counter cannot be requested from the hardware so they are stored in priv->bec when they are received from the hardware. There is no way to enable or disable this behavior.
4) Finally I enabled the whole interface via CAN_CTRLMODE_BERR_REPORTING for the CAN framework.

BERR_REPORTING != bus error counter

Quoted 1 line

I don't see where I missed anything.

The equivalent to the following SJA1000 code is missing:

           /* enable interrupts */
           if (priv->can.ctrlmode & CAN_CTRLMODE_BERR_REPORTING)
                   priv->write_reg(priv, REG_IER, IRQ_ALL);
           else
                   priv->write_reg(priv, REG_IER, IRQ_ALL & ~IRQ_BEI);

The user must now explicitly enable bus error reporting with "ip ... type can berr_reporting on ....

Wolfgang.

Quoted 3 lines

Matthias