[PATCH 8139too] Dreamcast Broad Band Adaptor support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, 

Here's a patch to support SEGA Broad Band Adaptor with 8139too driver.
SEGA Broad Band Adapter is the network interface for Dreamcast.

The work has been done by Takeshi Yaegashi <t@keshi.org>, 
I'm sending this to you on behalf of him, as SuperH arch maintainer.

SEGA's implementation is quite special.  It has 32KB special memory
for DMA.  8139 can do DMA transfer from/to this special memory.

Since it's only 32KB, we can only allocate 16KB for receive buffer.
And as it only supports DMA to this special memory (not to main
memory), we cannot support pci_map_single functionality.

Please let me know if you have any question.

It would be good if you consider this to be included.  Thanks.

diff -ruNp v2.4.7/Documentation/Configure.help linux/Documentation/Configure.help
--- v2.4.7/Documentation/Configure.help	Fri Jul 20 09:48:15 2001
+++ linux/Documentation/Configure.help	Mon Jul 23 09:33:58 2001
@@ -8748,6 +8748,12 @@ CONFIG_8139TOO_8129
   of an internal one.  Disabling this option will save some memory
   by making the code size smaller.  If unsure, say Y.
 
+Support for Dreamcast Broad Band Adaptor
+CONFIG_8139TOO_DREAMCAST
+  This enables support for the SEGA Broad Band Adaptor for Dreamcast.
+  It uses 16KB buffer and doesn't support mapping main memory to DMA.
+  If unsure, say N.
+
 SiS 900 PCI Fast Ethernet Adapter support
 CONFIG_SIS900
   This is a driver for the Fast Ethernet PCI network cards based on
diff -ruNp v2.4.7/drivers/net/Config.in linux/drivers/net/Config.in
--- v2.4.7/drivers/net/Config.in	Wed Jul 18 10:53:55 2001
+++ linux/drivers/net/Config.in	Mon Jul 23 09:31:23 2001
@@ -171,6 +171,7 @@ if [ "$CONFIG_NET_ETHERNET" = "y" ]; the
       dep_mbool '      Use PIO instead of MMIO' CONFIG_8139TOO_PIO $CONFIG_8139TOO
       dep_mbool '      Support for automatic channel equalization (EXPERIMENTAL)' CONFIG_8139TOO_TUNE_TWISTER $CONFIG_8139TOO $CONFIG_EXPERIMENTAL
       dep_mbool '      Support for older RTL-8129/8130 boards' CONFIG_8139TOO_8129 $CONFIG_8139TOO
+      dep_mbool '      Support for Dreamcast Broad Band Adaptor' CONFIG_8139TOO_DREAMCAST $CONFIG_8139TOO
       dep_tristate '    SiS 900/7016 PCI Fast Ethernet Adapter support' CONFIG_SIS900 $CONFIG_PCI
       dep_tristate '    SMC EtherPower II' CONFIG_EPIC100 $CONFIG_PCI
       dep_tristate '    Sundance Alta support' CONFIG_SUNDANCE $CONFIG_PCI
diff -ruNp v2.4.7/drivers/net/8139too.c linux/drivers/net/8139too.c
--- v2.4.7/drivers/net/8139too.c	Wed Jul 18 10:53:55 2001
+++ linux/drivers/net/8139too.c	Mon Jul 23 09:28:20 2001
@@ -155,6 +155,12 @@ an MMIO register read.
 #include <asm/io.h>
 #include <asm/uaccess.h>
 
+#ifdef CONFIG_8139TOO_DREAMCAST
+#define CONFIG_8139TOO_BUF16K	1
+#define USE_NO_DMAMAP		1
+#else
+#define USE_NO_DMAMAP		0
+#endif
 
 #define RTL8139_DRIVER_NAME   DRV_NAME " Fast Ethernet driver " DRV_VERSION
 #define PFX DRV_NAME ": "
@@ -204,7 +210,11 @@ static int max_interrupt_work = 20;
 static int multicast_filter_limit = 32;
 
 /* Size of the in-memory receive ring. */
-#define RX_BUF_LEN_IDX	2	/* 0==8K, 1==16K, 2==32K, 3==64K */
+#ifdef CONFIG_8139TOO_BUF16K
+#define RX_BUF_LEN_IDX 1 /* 0==8K, 1==16K, 2==32K, 3==64K */
+#else
+#define RX_BUF_LEN_IDX 2 /* 0==8K, 1==16K, 2==32K, 3==64K */
+#endif
 #define RX_BUF_LEN (8192 << RX_BUF_LEN_IDX)
 #define RX_BUF_PAD 16
 #define RX_BUF_WRAP_PAD 2048 /* spare padding to handle lack of packet wrap */
@@ -256,6 +266,7 @@ typedef enum {
 	DELTA8139,
 	ADDTRON8139,
 	DFE538TX,
+	SEGABBA,
 	RTL8129,
 } board_t;
 
@@ -272,6 +283,7 @@ static struct {
 	{ "Delta Electronics 8139 10/100BaseTX", RTL8139_CAPS },
 	{ "Addtron Technolgy 8139 10/100BaseTX", RTL8139_CAPS },
 	{ "D-Link DFE-538TX (RealTek RTL8139)", RTL8139_CAPS },
+	{ "SEGA Broadband Adapter", RTL8139_CAPS },
 	{ "RealTek RTL8129", RTL8129_CAPS },
 };
 
@@ -284,6 +296,7 @@ static struct pci_device_id rtl8139_pci_
 	{0x1500, 0x1360, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DELTA8139 },
 	{0x4033, 0x1360, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ADDTRON8139 },
 	{0x1186, 0x1300, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DFE538TX },
+	{0x11db, 0x1234, PCI_ANY_ID, PCI_ANY_ID, 0, 0, SEGABBA },
 
 #ifdef CONFIG_8139TOO_8129
 	{0x10ec, 0x8129, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8129 },
@@ -682,10 +695,17 @@ static const u16 rtl8139_intr_mask =
 	PCIErr | PCSTimeout | RxUnderrun | RxOverflow | RxFIFOOver |
 	TxErr | TxOK | RxErr | RxOK;
 
+#ifdef CONFIG_8139TOO_BUF16K 
+static const unsigned int rtl8139_rx_config =
+	  (RX_EARLY_THRESH << RxCfgEarlyRxShift) | RxCfgRcv16K | RxNoWrap |
+	  (RX_FIFO_THRESH << RxCfgFIFOShift) |
+	  (RX_DMA_BURST << RxCfgDMAShift);
+#else
 static const unsigned int rtl8139_rx_config =
 	  (RX_EARLY_THRESH << RxCfgEarlyRxShift) | RxCfgRcv32K | RxNoWrap |
 	  (RX_FIFO_THRESH << RxCfgFIFOShift) |
 	  (RX_DMA_BURST << RxCfgDMAShift);
+#endif
 
 
 static void __rtl8139_cleanup_dev (struct net_device *dev)
@@ -1721,7 +1741,7 @@ static int rtl8139_start_xmit (struct sk
 	assert (tp->tx_info[entry].mapping == 0);
 
 	tp->tx_info[entry].skb = skb;
-	if ((long) skb->data & 3) {	/* Must use alignment buffer. */
+	if (USE_NO_DMAMAP || (long) skb->data & 3) {	/* Must use alignment buffer. */
 		/* tp->tx_info[entry].mapping = 0; */
 		memcpy (tp->tx_buf[entry], skb->data, skb->len);
 		dma_addr = tp->tx_bufs_dma + (tp->tx_buf[entry] - tp->tx_bufs);
-- 
-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux