Skip to contentSkip to conversation

can: add driver for Softing card

PATCH In review Kurt Van Dijck 3 participants 5 messages Jan 11, 2011 – Jan 22, 2011 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v3 cover can: add driver for Softing card

This series will add a driver for Softing PCMCIA CAN card.

This core CAN networking code exists for a few years in the socketCAN repository.
The updates since the latest socketCAN version:
* PCMCIA interfacing changed
* seperation between the two drivers via a platform:softing device
* added conditional bus-error reporting

About the platform_device ...
Softing Gmbh has PCMCIA & PCI cards. Both share the same
Dual Port RAM (DPRAM) interface. Therefore, the driver is split in 2 stages:

[1/2] softing.ko: Generic platform bus device driver
It expects a platform:softing device with an IO range that contains the DPRAM, and an IRQ line.

[2/2] softing_cs.ko: PCMCIA driver
This driver will create a platform:softing device on top of the pcmcia device.

The 2 drivers are not linked in a way that softing.ko depends on softing_cs.ko or vice versa. The reason for doing so is that the DPRAM interface takes quite some code, and building it directly on the PCMCIA or PCI device was difficult to follow.
The present design eliminates the need for exotic sysfs API's since all sysfs attributes know they are attached to a platform_device.

Differences since v1 of this series:
* whitespace issues
* use of time_after() to measure elapsed time.
* don't copy data for RTR frames (see commit since v1)
* use usleep_range(), not schedule().
* threaded irq
* fix iomem access (verify with sparse)
* totally 'endian-safe'
* drop error frame detection again. It's not right that when bus 1 enables error frames, bus 2 would get error frames too.
* drop the Kconfig dependency between softingcs.ko & softing.ko

Differences since v2 of this series:
* Even more whitespace issues
* Let softing_cs.ko depend on softing.ko in Kconfig. A real user will need them both
* Normalize all frequencies in Hz.
* Proper return codes from firmware communication functions.
* Drop some alignments
* Don't touch byte counters on RTR frames
* Fix bus-error-states
* Less obscure use of bitmasks
* use of __devinit/__devexit
...

Kurt

A message that is not in the archive (sent off-list or not yet received): 20110111143007.GB387-MxZ6Iy/zr/UdbCeoMzGj59i2O/[email protected]

#2 lore raw

PATCH v3 1/2 can: add driver for Softing card

This patch adds a driver for the platform:softing device. This will create (up to) 2 CAN network devices from 1 platform:softing device

---
 drivers/net/can/Kconfig                    |    2 +
 drivers/net/can/Makefile                   |    1 +
 drivers/net/can/softing/Kconfig            |   16 +
 drivers/net/can/softing/Makefile           |    5 +
 drivers/net/can/softing/softing.h          |  168 ++++++
 drivers/net/can/softing/softing_fw.c       |  692 +++++++++++++++++++++
 drivers/net/can/softing/softing_main.c     |  893 ++++++++++++++++++++++++++++
 drivers/net/can/softing/softing_platform.h |   41 ++
 8 files changed, 1818 insertions(+), 0 deletions(-)
drivers/net/can/Kconfig +2 -0
index d5a9db6..986195e 100644
@@ -117,6 +117,8 @@ source "drivers/net/can/sja1000/Kconfig"
 
 source "drivers/net/can/usb/Kconfig"
 
+source "drivers/net/can/softing/Kconfig"
+
 config CAN_DEBUG_DEVICES
 	bool "CAN devices debugging messages"
 	depends on CAN
drivers/net/can/Makefile +1 -0
index 07ca159..53c82a7 100644
@@ -9,6 +9,7 @@ obj-$(CONFIG_CAN_DEV)		+= can-dev.o
 can-dev-y			:= dev.o
 
 obj-y				+= usb/
+obj-y				+= softing/
 
 obj-$(CONFIG_CAN_SJA1000)	+= sja1000/
 obj-$(CONFIG_CAN_MSCAN)		+= mscan/
drivers/net/can/softing/Kconfig new file +16 -0
new file mode 100644
index 0000000..072f337
@@ -0,0 +1,16 @@
+config CAN_SOFTING
+	tristate "Softing Gmbh CAN generic support"
+	depends on CAN_DEV
+	---help---
+	  Support for CAN cards from Softing Gmbh & some cards
+	  from Vector Gmbh.
+	  Softing Gmbh CAN cards come with 1 or 2 physical busses.
+	  Those cards typically use Dual Port RAM to communicate
+	  with the host CPU. The interface is then identical for PCI
+	  and PCMCIA cards. This driver operates on a platform device,
+	  which has been created by softing_cs or softing_pci driver.
+	  Warning:
+	  The API of the card does not allow fine control per bus, but
+	  controls the 2 busses on the card together.
+	  As such, some actions (start/stop/busoff recovery) on 1 bus
+	  must bring down the other bus too temporarily.
drivers/net/can/softing/Makefile new file +5 -0
new file mode 100644
index 0000000..7db0445
@@ -0,0 +1,5 @@
+
+softing-y := softing_main.o softing_fw.o
+obj-$(CONFIG_CAN_SOFTING) += softing.o
+
+ccflags-$(CONFIG_CAN_DEBUG_DEVICES) := -DDEBUG
drivers/net/can/softing/softing.h new file +168 -0

168 lines not on this page · raw message

drivers/net/can/softing/softing_fw.c new file +692 -0

692 lines not on this page · raw message

drivers/net/can/softing/softing_main.c new file +893 -0

893 lines not on this page · raw message

drivers/net/can/softing/softing_platform.h new file +41 -0

41 lines not on this page · raw message

#3 lore raw

PATCH v3 2/2 can: add driver for Softing card

In reply to a message not in the archive

This patch adds the driver that creates a platform:softing device from a pcmcia_device
Note: the Kconfig indicates a dependency on the softing.ko driver, but this is purely to make configuration intuitive. This driver will work independent, but no CAN network devices appear until softing.ko is loaded too.

---
 drivers/net/can/softing/Kconfig      |   14 ++
 drivers/net/can/softing/Makefile     |    1 +
 drivers/net/can/softing/softing_cs.c |  360 ++++++++++++++++++++++++++++++++++
 3 files changed, 375 insertions(+), 0 deletions(-)
drivers/net/can/softing/Kconfig +14 -0
index 072f337..92bd6bd 100644
@@ -14,3 +14,17 @@ config CAN_SOFTING
 	  controls the 2 busses on the card together.
 	  As such, some actions (start/stop/busoff recovery) on 1 bus
 	  must bring down the other bus too temporarily.
+
+config CAN_SOFTING_CS
+	tristate "Softing Gmbh CAN pcmcia cards"
+	depends on PCMCIA
+	select CAN_SOFTING
+	---help---
+	  Support for PCMCIA cards from Softing Gmbh & some cards
+	  from Vector Gmbh.
+	  You need firmware for these, which you can get at
+	  http://developer.berlios.de/projects/socketcan/
+	  This version of the driver is written against
+	  firmware version 4.6 (softing-fw-4.6-binaries.tar.gz)
+	  In order to use the card as CAN device, you need the Softing generic
+	  support too.
drivers/net/can/softing/Makefile +1 -0
index 7db0445..c5e5016 100644
@@ -1,5 +1,6 @@
 
 softing-y := softing_main.o softing_fw.o
 obj-$(CONFIG_CAN_SOFTING) += softing.o
+obj-$(CONFIG_CAN_SOFTING_CS) += softing_cs.o
 
 ccflags-$(CONFIG_CAN_DEBUG_DEVICES) := -DDEBUG
drivers/net/can/softing/softing_cs.c new file +360 -0

360 lines not on this page · raw message

#4 lore raw

Hi,

I didn't get any remarks anymore on this series. Does this mean the PCMCIA interface is OK? I'm not so familiar with that part...

regards,
Kurt