Skip to contentSkip to conversation

Add SBE 2T3E3 WAN driver

PATCH In review Krzysztof Halasa 2 participants 7 messages Jul 31, 2010 – Aug 12, 2010

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

PATCH 1/1 Add SBE 2T3E3 WAN driver

This is a driver for SBE Inc.'s dual port T3/E3 WAN cards. Based on their original GPLed driver.
It needs at least a new generic HDLC setup code (not yet written) before moving to drivers/net/wan.

---
I have generated the patch against v2.6.35-rc6. Compiles cleanly. Please let me know if it needs extra changes for e.g. staging tree. Thanks.

 drivers/staging/Kconfig              |    2 +
 drivers/staging/Makefile             |    1 +
 drivers/staging/sbe-2t3e3/2t3e3.h    |  896 ++++++++++++++++++++++++++++++++++
 drivers/staging/sbe-2t3e3/Kconfig    |   13 +
 drivers/staging/sbe-2t3e3/Makefile   |    4 +
 drivers/staging/sbe-2t3e3/cpld.c     |  366 ++++++++++++++
 drivers/staging/sbe-2t3e3/ctrl.c     |  363 ++++++++++++++
 drivers/staging/sbe-2t3e3/ctrl.h     |  131 +++++
 drivers/staging/sbe-2t3e3/dc.c       |  507 +++++++++++++++++++
 drivers/staging/sbe-2t3e3/exar7250.c |  217 ++++++++
 drivers/staging/sbe-2t3e3/exar7300.c |  182 +++++++
 drivers/staging/sbe-2t3e3/intr.c     |  651 ++++++++++++++++++++++++
 drivers/staging/sbe-2t3e3/io.c       |  352 +++++++++++++
 drivers/staging/sbe-2t3e3/main.c     |  171 +++++++
 drivers/staging/sbe-2t3e3/maps.c     |  104 ++++
 drivers/staging/sbe-2t3e3/module.c   |  210 ++++++++
 drivers/staging/sbe-2t3e3/netdev.c   |  142 ++++++
 include/linux/pci_ids.h              |    3 +
 18 files changed, 4315 insertions(+), 0 deletions(-)
drivers/staging/Kconfig +2 -0
index 984a754..3a21878 100644
@@ -147,5 +147,7 @@ source "drivers/staging/mrst-touchscreen/Kconfig"
 
 source "drivers/staging/msm/Kconfig"
 
+source "drivers/staging/sbe-2t3e3/Kconfig"
+
 endif # !STAGING_EXCLUDE_BUILD
 endif # STAGING
drivers/staging/Makefile +1 -0
index 9fa2513..39687c5 100644
@@ -54,3 +54,4 @@ obj-$(CONFIG_ADIS16255)		+= adis16255/
 obj-$(CONFIG_FB_XGI)		+= xgifb/
 obj-$(CONFIG_TOUCHSCREEN_MRSTOUCH)	+= mrst-touchscreen/
 obj-$(CONFIG_MSM_STAGING)	+= msm/
+obj-$(CONFIG_SBE_2T3E3)		+= sbe-2t3e3/
drivers/staging/sbe-2t3e3/2t3e3.h new file +896 -0

896 lines not on this page · raw message

drivers/staging/sbe-2t3e3/Kconfig new file +13 -0
new file mode 100644
index 0000000..8ec86cf
@@ -0,0 +1,13 @@
+config SBE_2T3E3
+	tristate "SBE wanPMC-2T3E3 support"
+	depends on HDLC && PCI
+	help
+	  Driver for wanPMC-2T3E3 cards by SBE Inc.
+
+	  If you have such a card, say Y here and see
+	  <http://www.kernel.org/pub/linux/utils/net/hdlc/>.
+
+	  To compile this as a module, choose M here: the
+	  module will be called sbe-2t3e3.
+
+	  If unsure, say N.
drivers/staging/sbe-2t3e3/Makefile new file +4 -0
new file mode 100644
index 0000000..2c7b097
@@ -0,0 +1,4 @@
+obj-$(CONFIG_SBE_2T3E3) += sbe-2t3e3.o
+
+sbe-2t3e3-objs := module.o netdev.o maps.o	\
+	main.o cpld.o intr.o ctrl.o io.o dc.o exar7250.o exar7300.o
drivers/staging/sbe-2t3e3/cpld.c new file +366 -0

366 lines not on this page · raw message

drivers/staging/sbe-2t3e3/ctrl.c new file +363 -0

363 lines not on this page · raw message

drivers/staging/sbe-2t3e3/ctrl.h new file +131 -0

131 lines not on this page · raw message

drivers/staging/sbe-2t3e3/dc.c new file +507 -0

507 lines not on this page · raw message

drivers/staging/sbe-2t3e3/exar7250.c new file +217 -0

217 lines not on this page · raw message

drivers/staging/sbe-2t3e3/exar7300.c new file +182 -0

182 lines not on this page · raw message

drivers/staging/sbe-2t3e3/intr.c new file +651 -0

310 lines not on this page · raw message

drivers/staging/sbe-2t3e3/io.c new file +352 -0

352 lines not on this page · raw message

drivers/staging/sbe-2t3e3/main.c new file +171 -0

171 lines not on this page · raw message

drivers/staging/sbe-2t3e3/maps.c new file +104 -0

104 lines not on this page · raw message

drivers/staging/sbe-2t3e3/module.c new file +210 -0

210 lines not on this page · raw message

drivers/staging/sbe-2t3e3/netdev.c new file +142 -0

142 lines not on this page · raw message

include/linux/pci_ids.h +3 -0
index 3bedcc1..1ee7ab0 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Part of the diff is not shown here. View the raw message.

#1 lore raw
Quoted 22 lines · Krzysztof Halasa

This is a driver for SBE Inc.'s dual port T3/E3 WAN cards. Based on their original GPLed driver.
It needs at least a new generic HDLC setup code (not yet written) before moving to drivers/net/wan.

---
I have generated the patch against v2.6.35-rc6. Compiles cleanly. Please let me know if it needs extra changes for e.g. staging tree. Thanks.

 drivers/staging/Kconfig              |    2 +
 drivers/staging/Makefile             |    1 +
 drivers/staging/sbe-2t3e3/2t3e3.h    |  896 ++++++++++++++++++++++++++++++++++
 drivers/staging/sbe-2t3e3/Kconfig    |   13 +
 drivers/staging/sbe-2t3e3/Makefile   |    4 +
 drivers/staging/sbe-2t3e3/cpld.c     |  366 ++++++++++++++
 drivers/staging/sbe-2t3e3/ctrl.c     |  363 ++++++++++++++
 drivers/staging/sbe-2t3e3/ctrl.h     |  131 +++++
 drivers/staging/sbe-2t3e3/dc.c       |  507 +++++++++++++++++++
 drivers/staging/sbe-2t3e3/exar7250.c |  217 ++++++++
Quoted 8 lines
 drivers/staging/sbe-2t3e3/exar7300.c |  182 +++++++
 drivers/staging/sbe-2t3e3/intr.c     |  651 ++++++++++++++++++++++++
 drivers/staging/sbe-2t3e3/io.c       |  352 +++++++++++++
 drivers/staging/sbe-2t3e3/main.c     |  171 +++++++
 drivers/staging/sbe-2t3e3/maps.c     |  104 ++++
 drivers/staging/sbe-2t3e3/module.c   |  210 ++++++++
 drivers/staging/sbe-2t3e3/netdev.c   |  142 ++++++
 include/linux/pci_ids.h              |    3 +

First off, read the top of the pci_ids.h file, which says to not add new entries that are only used in a single driver.

Secondly, why have this as a staging driver? What is lacking in it to get it merged into the main kernel tree as a "normal" driver? Hint, you need a TODO file in the driver directory that lists the things left to be done to it to get it merged, and a name/email address to send the patches to.

drivers/staging/sbe-2t3e3/2t3e3.h line 10

Quoted 12 lines

+++ b/drivers/staging/sbe-2t3e3/2t3e3.h

drivers/staging/sbe-2t3e3/2t3e3.h new file +10 -0
@@ -0,0 +1,896 @@
+/*
+ * SBE 2T3E3 synchronous serial card driver for Linux
+ *
+ * Copyright (C) 2009-2010 Krzysztof Halasa <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License
+ * as published by the Free Software Foundation.
+ *
+ * This code is based on a driver written by SBE Inc.

What driver would that have been? If it's based on someone else's work, it's nice to mention the copyright holders of that work you based yours on.

drivers/staging/sbe-2t3e3/2t3e3.h line 23

Quoted 13 lines
drivers/staging/sbe-2t3e3/2t3e3.h new file +13 -0
+ */
+
+#ifndef T3E3_H
+#define T3E3_H
+
+#include <linux/hdlc.h>
+#include <linux/interrupt.h>
+#include <linux/netdevice.h>
+#include <linux/pci.h>
+#include <linux/io.h>
+#include "ctrl.h"
+
+#define DRV_NAME "SBE 2T3E3"

spaces and all caps isn't the nicest thing for linux drivers, it does odd things in sysfs for some scripts (the space thing, not the uppercase.)

thanks,

greg k-h

#2 lore raw
Quoted 4 lines · Greg KH
Quoted 1 line
 include/linux/pci_ids.h              |    3 +

First off, read the top of the pci_ids.h file, which says to not add new entries that are only used in a single driver.

These entries are also needed for the tulip Ethernet driver, to avoid initializing these ports (they are using Tulip DECchips with custom FPGA for HDLC). I posted a patch on netdev list.

Quoted 2 lines

Secondly, why have this as a staging driver? What is lacking in it to get it merged into the main kernel tree as a "normal" driver?

The main reason is the interface ("PRIVATE" netdev ioctls) for controlling the hdlcX devices is not stable. The plan is to write a new user-kernel interface for generic HDLC, this driver (and other ones) will then use it. For now, there is a separate utility from SBE for this card.

Quoted 4 lines

Hint, you
need a TODO file in the driver directory that lists the things left to be done to it to get it merged, and a name/email address to send the patches to.

Ok.

Quoted 5 lines
Quoted 1 line

+ * This code is based on a driver written by SBE Inc.

What driver would that have been? If it's based on someone else's work, it's nice to mention the copyright holders of that work you based yours on.

I don't have any details, I'm only told the driver is open-source and the file name starts with SBE. No copyright notices except this one:

$ grep LIC *
linux_sbe2t3e3.c:MODULE_LICENSE("GPL");

BTW SBE Inc. (division?) has been acquired by One Stop Systems, they seem to still sell this hw, but I can't see any drivers available for downloading (though they mention "open source Linux drivers").

Quoted 5 lines
Quoted 1 line

+#define DRV_NAME "SBE 2T3E3"

spaces and all caps isn't the nicest thing for linux drivers, it does odd things in sysfs for some scripts (the space thing, not the uppercase.)

It seems the DRV_NAME is only used for various printk() and for pci_request_regions(). Does it still cause problems?

Signature · 1 line
Krzysztof Halasa
#3 lore raw
Quoted 10 lines · Krzysztof Halasa
Quoted 4 lines · Greg KH
Quoted 1 line
 include/linux/pci_ids.h              |    3 +

First off, read the top of the pci_ids.h file, which says to not add new entries that are only used in a single driver.

These entries are also needed for the tulip Ethernet driver, to avoid initializing these ports (they are using Tulip DECchips with custom FPGA for HDLC). I posted a patch on netdev list.

Then make the patch part of that submission, I can't add non-staging patches to the drivers/staging/ tree if at all possible.

Quoted 8 lines
Quoted 2 lines

Secondly, why have this as a staging driver? What is lacking in it to get it merged into the main kernel tree as a "normal" driver?

The main reason is the interface ("PRIVATE" netdev ioctls) for controlling the hdlcX devices is not stable. The plan is to write a new user-kernel interface for generic HDLC, this driver (and other ones) will then use it. For now, there is a separate utility from SBE for this card.

Ah, ick. Is this going to be fixed up anytime soon?

Quoted 6 lines
Quoted 4 lines

Hint, you
need a TODO file in the driver directory that lists the things left to be done to it to get it merged, and a name/email address to send the patches to.

Ok.

Care to respin this with the TODO file?`

Quoted 11 lines
Quoted 5 lines
Quoted 1 line

+ * This code is based on a driver written by SBE Inc.

What driver would that have been? If it's based on someone else's work, it's nice to mention the copyright holders of that work you based yours on.

I don't have any details, I'm only told the driver is open-source and the file name starts with SBE. No copyright notices except this one:

$ grep LIC *
linux_sbe2t3e3.c:MODULE_LICENSE("GPL");

Wait, you wrote this driver, yet you don't have any details about the driver you based it on? That makes absolutely no sense. Please clarify.

And look, you do have a copy of the file, right there. Care to post it somewhere? We need to see the license and other markings on it to know about this driver, right? Where did you get it from?

Quoted 3 lines

BTW SBE Inc. (division?) has been acquired by One Stop Systems, they seem to still sell this hw, but I can't see any drivers available for downloading (though they mention "open source Linux drivers").

Any links would be appreciated.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

+#define DRV_NAME "SBE 2T3E3"

spaces and all caps isn't the nicest thing for linux drivers, it does odd things in sysfs for some scripts (the space thing, not the uppercase.)

It seems the DRV_NAME is only used for various printk() and for pci_request_regions(). Does it still cause problems?

It's not nice, hopefully you can fix it up. Well, remove it entirely would be good, but you can add that to the TODO file :)

thanks,

greg k-h

#4 lore raw
Quoted 6 lines · Greg KH
Quoted 3 lines

These entries are also needed for the tulip Ethernet driver, to avoid initializing these ports (they are using Tulip DECchips with custom FPGA for HDLC). I posted a patch on netdev list.

Then make the patch part of that submission, I can't add non-staging patches to the drivers/staging/ tree if at all possible.

I did, I just didn't want a dependency and thus the change to pci_ids.h is present in both patches, with the assumption git will take care of it when merging.

Quoted 7 lines
Quoted 5 lines

The main reason is the interface ("PRIVATE" netdev ioctls) for controlling the hdlcX devices is not stable. The plan is to write a new user-kernel interface for generic HDLC, this driver (and other ones) will then use it. For now, there is a separate utility from SBE for this card.

Ah, ick. Is this going to be fixed up anytime soon?

Well, I hope so. Depends on the definition of "soon", though. Something like several months, realistically.

Quoted 1 line

Care to respin this with the TODO file?`

Will do, sure.

Quoted 3 lines

And look, you do have a copy of the file, right there. Care to post it somewhere? We need to see the license and other markings on it to know about this driver, right? Where did you get it from?

I got it from a friend along with a card. That's exactly what they received from SBE. It's a driver for older Linux only, something like up to 2.6.20 maybe. I'm told they have no newer version (i.e. working with newer kernels; they may have a version with the new company name).

SBE (embedded devices division?) doesn't exist anymore, but this particular piece of hardware is there:

http://www.onestopsystems.com/communication_wan_f.php

I posted the driver here:
http://userweb.kernel.org/~chris/SBE_2T3_Linux_2.0c.tgz

Quoted 5 lines
Quoted 2 lines

It seems the DRV_NAME is only used for various printk() and for pci_request_regions(). Does it still cause problems?

It's not nice, hopefully you can fix it up. Well, remove it entirely would be good, but you can add that to the TODO file :)

Ah, doing a simple search & replace isn't a problem for me. Just wanted to confirm it's not nice.

Will post a revised patch shortly, of course.

Signature · 1 line
Krzysztof Halasa
#5 lore raw
In reply to Greg KH

Greg,

I have added the TODO file and removed #define DRV_NAME "SBE 2T3E3". The include/linux/pci_ids.h chunk is now also in Linus' tree, I'm still not removing it from this patch to avoid dependency on the very tip. Tested with 2.6.35.

TIA for looking into this.
BTW the original driver tarball is now accessible at
http://userweb.kernel.org/~chris/SBE_2T3_Linux_2.0c.tgz

+++

This is a driver for SBE Inc.'s dual port T3/E3 WAN cards. Based on their original GPLed driver.
It needs at least a new generic HDLC setup code (not yet written) before moving to drivers/net/wan.

 drivers/staging/Kconfig              |    2 +
 drivers/staging/Makefile             |    1 +
 drivers/staging/sbe-2t3e3/2t3e3.h    |  894 ++++++++++++++++++++++++++++++++++
 drivers/staging/sbe-2t3e3/Kconfig    |   13 +
 drivers/staging/sbe-2t3e3/Makefile   |    4 +
 drivers/staging/sbe-2t3e3/TODO       |    6 +
 drivers/staging/sbe-2t3e3/cpld.c     |  366 ++++++++++++++
 drivers/staging/sbe-2t3e3/ctrl.c     |  362 ++++++++++++++
 drivers/staging/sbe-2t3e3/ctrl.h     |  131 +++++
 drivers/staging/sbe-2t3e3/dc.c       |  502 +++++++++++++++++++
 drivers/staging/sbe-2t3e3/exar7250.c |  217 ++++++++
 drivers/staging/sbe-2t3e3/exar7300.c |  182 +++++++
 drivers/staging/sbe-2t3e3/intr.c     |  635 ++++++++++++++++++++++++
 drivers/staging/sbe-2t3e3/io.c       |  352 +++++++++++++
 drivers/staging/sbe-2t3e3/main.c     |  171 +++++++
 drivers/staging/sbe-2t3e3/maps.c     |  104 ++++
 drivers/staging/sbe-2t3e3/module.c   |  210 ++++++++
 drivers/staging/sbe-2t3e3/netdev.c   |  142 ++++++
 include/linux/pci_ids.h              |    3 +
 19 files changed, 4297 insertions(+), 0 deletions(-)
drivers/staging/Kconfig +2 -0
index 984a754..3a21878 100644
@@ -147,5 +147,7 @@ source "drivers/staging/mrst-touchscreen/Kconfig"
 
 source "drivers/staging/msm/Kconfig"
 
+source "drivers/staging/sbe-2t3e3/Kconfig"
+
 endif # !STAGING_EXCLUDE_BUILD
 endif # STAGING
drivers/staging/Makefile +1 -0
index 9fa2513..39687c5 100644
@@ -54,3 +54,4 @@ obj-$(CONFIG_ADIS16255)		+= adis16255/
 obj-$(CONFIG_FB_XGI)		+= xgifb/
 obj-$(CONFIG_TOUCHSCREEN_MRSTOUCH)	+= mrst-touchscreen/
 obj-$(CONFIG_MSM_STAGING)	+= msm/
+obj-$(CONFIG_SBE_2T3E3)		+= sbe-2t3e3/
drivers/staging/sbe-2t3e3/2t3e3.h new file +894 -0

894 lines not on this page · raw message

drivers/staging/sbe-2t3e3/Kconfig new file +13 -0
new file mode 100644
index 0000000..8ec86cf
@@ -0,0 +1,13 @@
+config SBE_2T3E3
+	tristate "SBE wanPMC-2T3E3 support"
+	depends on HDLC && PCI
+	help
+	  Driver for wanPMC-2T3E3 cards by SBE Inc.
+
+	  If you have such a card, say Y here and see
+	  <http://www.kernel.org/pub/linux/utils/net/hdlc/>.
+
+	  To compile this as a module, choose M here: the
+	  module will be called sbe-2t3e3.
+
+	  If unsure, say N.
drivers/staging/sbe-2t3e3/Makefile new file +4 -0
new file mode 100644
index 0000000..2c7b097
@@ -0,0 +1,4 @@
+obj-$(CONFIG_SBE_2T3E3) += sbe-2t3e3.o
+
+sbe-2t3e3-objs := module.o netdev.o maps.o	\
+	main.o cpld.o intr.o ctrl.o io.o dc.o exar7250.o exar7300.o
drivers/staging/sbe-2t3e3/TODO new file +6 -0
new file mode 100644
index 0000000..624b20f
@@ -0,0 +1,6 @@
+TODO:
+	- additional cleaning and tests
+	- wait for the new configuration interface in generic HDLC layer and
+	  when available, convert the driver to it
+
+Please send patches to Krzysztof Halasa <[email protected]>.
\ No newline at end of file
drivers/staging/sbe-2t3e3/cpld.c new file +366 -0

366 lines not on this page · raw message

drivers/staging/sbe-2t3e3/ctrl.c new file +362 -0

362 lines not on this page · raw message

drivers/staging/sbe-2t3e3/ctrl.h new file +131 -0

131 lines not on this page · raw message

drivers/staging/sbe-2t3e3/dc.c new file +502 -0

502 lines not on this page · raw message

drivers/staging/sbe-2t3e3/exar7250.c new file +217 -0

217 lines not on this page · raw message

drivers/staging/sbe-2t3e3/exar7300.c new file +182 -0

182 lines not on this page · raw message

drivers/staging/sbe-2t3e3/intr.c new file +635 -0

311 lines not on this page · raw message

drivers/staging/sbe-2t3e3/io.c new file +352 -0

352 lines not on this page · raw message

drivers/staging/sbe-2t3e3/main.c new file +171 -0

171 lines not on this page · raw message

drivers/staging/sbe-2t3e3/maps.c new file +104 -0

104 lines not on this page · raw message

drivers/staging/sbe-2t3e3/module.c new file +210 -0

210 lines not on this page · raw message

drivers/staging/sbe-2t3e3/netdev.c new file +142 -0

142 lines not on this page · raw message

include/linux/pci_ids.h +3 -0
index 3bedcc1..1ee7ab0 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Part of the diff is not shown here. View the raw message.

#6 lore raw
Quoted 10 lines · Krzysztof Halasa

Greg,

I have added the TODO file and removed #define DRV_NAME "SBE 2T3E3". The include/linux/pci_ids.h chunk is now also in Linus' tree, I'm still not removing it from this patch to avoid dependency on the very tip. Tested with 2.6.35.

TIA for looking into this.
BTW the original driver tarball is now accessible at
http://userweb.kernel.org/~chris/SBE_2T3_Linux_2.0c.tgz

Thanks for puttting it up.

I'll queue this up in a few weeks after the 2.6.36 merge window closes and things settle down.

greg k-h