[PATCH] Clean up redundant PHY write line for ULi526x Ethernet driver
From: Roy Zang [EMAIL PROTECTED] Clean up redundant PHY write line for ULi526x Ethernet Driver. Signed-off-by: Roy Zang [EMAIL PROTECTED] --- drivers/net/tulip/uli526x.c |1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/drivers/net/tulip/uli526x.c b/drivers/net/tulip/uli526x.c index ca2548e..53a8e65 100644 --- a/drivers/net/tulip/uli526x.c +++ b/drivers/net/tulip/uli526x.c @@ -1512,7 +1512,6 @@ static void uli526x_process_mode(struct uli526x_board_info *db) case ULI526X_100MFD: phy_reg = 0x2100; break; } phy_write(db-ioaddr, db-phy_addr, 0, phy_reg, db-chip_id); - phy_write(db-ioaddr, db-phy_addr, 0, phy_reg, db-chip_id); } } } -- 1.5.2 - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch 3/3] Add tsi108 On Chip Ethernet device driver support
On Mon, 2006-10-23 at 10:09, Zang Roy-r61911 wrote: On Thu, 2006-09-21 at 12:46, Jeff Garzik wrote: you should have a chip structure, that contains two structs (one for each interface/port) Jeff, I updated the code according to all your feedback and post it here http://www.spinics.net/lists/netdev/msg17120.html Any comment? Roy Jeff How about it? What's your comment? Roy - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch 3/3] Add tsi108 On Chip Ethernet device driver support
On Thu, 2006-09-21 at 12:46, Jeff Garzik wrote: you should have a chip structure, that contains two structs (one for each interface/port) Jeff, I updated the code according to all your feedback and post it here http://www.spinics.net/lists/netdev/msg17120.html Any comment? Roy - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch 3/3] Add tsi108 On Chip Ethernet device driver support
On Thu, 2006-09-21 at 12:46, Jeff Garzik wrote: + +/* Synchronization is needed between the thread and up/down events. + * Note that the PHY is accessed through the same registers for both + * interfaces, so this can't be made interface-specific. + */ + +static DEFINE_SPINLOCK(phy_lock); you should have a chip structure, that contains two structs (one for each interface/port) Do you mean you want to see this spinlock within dynamically allocated data structure, and not as a global variable? I am not sure :-). All your other comments have been addressed. The following is the updated tsi108 Ethernet port driver. Any comment? Signed-off-by: Alexandre Bounine[EMAIL PROTECTED] Signed-off-by: Roy Zang [EMAIL PROTECTED] diff --git a/drivers/net/tsi108_eth.c b/drivers/net/tsi108_eth.c new file mode 100644 index 000..6c3146d --- /dev/null +++ b/drivers/net/tsi108_eth.c @@ -0,0 +1,1709 @@ +/*** + + Copyright(c) 2006 Tundra Semiconductor Corporation. + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + this program; if not, write to the Free Software Foundation, Inc., 59 + Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +***/ + +/* This driver is based on the driver code originally developed + * for the Intel IOC80314 (ForestLake) Gigabit Ethernet by + * [EMAIL PROTECTED] * Copyright (C) 2003 TimeSys Corporation + * + * Currently changes from original version are: + * - porting to Tsi108-based platform and kernel 2.6 ([EMAIL PROTECTED]) + * - modifications to handle two ports independently and support for + * additional PHY devices ([EMAIL PROTECTED]) + * - Get hardware information from platform device. ([EMAIL PROTECTED]) + * + */ + +#include linux/module.h +#include linux/types.h +#include linux/init.h +#include linux/net.h +#include linux/netdevice.h +#include linux/etherdevice.h +#include linux/skbuff.h +#include linux/slab.h +#include linux/sched.h +#include linux/spinlock.h +#include linux/delay.h +#include linux/crc32.h +#include linux/mii.h +#include linux/device.h +#include linux/pci.h +#include linux/rtnetlink.h +#include linux/timer.h +#include linux/platform_device.h +#include linux/etherdevice.h + +#include asm/system.h +#include asm/io.h +#include asm/tsi108.h + +#include tsi108_eth.h + +#define MII_READ_DELAY 1 /* max link wait time in msec */ + +#define TSI108_RXRING_LEN 256 + +/* NOTE: The driver currently does not support receiving packets + * larger than the buffer size, so don't decrease this (unless you + * want to add such support). + */ +#define TSI108_RXBUF_SIZE 1536 + +#define TSI108_TXRING_LEN 256 + +#define TSI108_TX_INT_FREQ64 + +/* Check the phy status every half a second. */ +#define CHECK_PHY_INTERVAL (HZ/2) + +static int tsi108_init_one(struct platform_device *pdev); +static int tsi108_ether_remove(struct platform_device *pdev); + +struct tsi108_prv_data { + void __iomem *regs;/* Base of normal regs */ + void __iomem *phyregs; /* Base of register bank used for PHY access */ + + unsigned int phy; /* Index of PHY for this interface */ + unsigned int irq_num; + unsigned int id; + + struct timer_list timer;/* Timer that triggers the check phy function */ + unsigned int rxtail;/* Next entry in rxring to read */ + unsigned int rxhead;/* Next entry in rxring to give a new buffer */ + unsigned int rxfree;/* Number of free, allocated RX buffers */ + + unsigned int rxpending; /* Non-zero if there are still descriptors +* to be processed from a previous descriptor +* interrupt condition that has been cleared */ + + unsigned int txtail;/* Next TX descriptor to check status on */ + unsigned int txhead;/* Next TX descriptor to use */ + + /* Number of free TX descriptors. This could be calculated from +* rxhead and rxtail if one descriptor were left unused to disambiguate +* full and empty conditions, but it's simpler to just keep track +* explicitly. */ + + unsigned int txfree; + + unsigned int phy_ok;/* The PHY is currently powered on. */ + + /* PHY status (duplex is 1 for half, 2 for full, +
Re: [patch 3/3] Add tsi108 On Chip Ethernet device driver support
On Thu, 2006-09-21 at 12:46, Jeff Garzik wrote: Zang Roy-r61911 wrote: +struct tsi108_prv_data { + void __iomem *regs;/* Base of normal regs */ + void __iomem *phyregs; /* Base of register bank used for PHY access */ + + int phy;/* Index of PHY for this interface */ + int irq_num; + int id; + + struct timer_list timer;/* Timer that triggers the check phy function */ + int rxtail; /* Next entry in rxring to read */ + int rxhead; /* Next entry in rxring to give a new buffer */ + int rxfree; /* Number of free, allocated RX buffers */ + + int rxpending; /* Non-zero if there are still descriptors + * to be processed from a previous descriptor + * interrupt condition that has been cleared */ + + int txtail; /* Next TX descriptor to check status on */ + int txhead; /* Next TX descriptor to use */ most of these should be unsigned, to prevent bugs. + /* Number of free TX descriptors. This could be calculated from + * rxhead and rxtail if one descriptor were left unused to disambiguate + * full and empty conditions, but it's simpler to just keep track + * explicitly. */ + + int txfree; + + int phy_ok; /* The PHY is currently powered on. */ + + /* PHY status (duplex is 1 for half, 2 for full, + * so that the default 0 indicates that neither has + * yet been configured). */ + + int link_up; + int speed; + int duplex; + + tx_desc *txring; + rx_desc *rxring; + struct sk_buff *txskbs[TSI108_TXRING_LEN]; + struct sk_buff *rxskbs[TSI108_RXRING_LEN]; + + dma_addr_t txdma, rxdma; + + /* txlock nests in misclock and phy_lock */ + + spinlock_t txlock, misclock; + + /* stats is used to hold the upper bits of each hardware counter, + * and tmpstats is used to hold the full values for returning + * to the caller of get_stats(). They must be separate in case + * an overflow interrupt occurs before the stats are consumed. + */ + + struct net_device_stats stats; + struct net_device_stats tmpstats; + + /* These stats are kept separate in hardware, thus require individual + * fields for handling carry. They are combined in get_stats. + */ + + unsigned long rx_fcs; /* Add to rx_frame_errors */ + unsigned long rx_short_fcs; /* Add to rx_frame_errors */ + unsigned long rx_long_fcs; /* Add to rx_frame_errors */ + unsigned long rx_underruns; /* Add to rx_length_errors */ + unsigned long rx_overruns; /* Add to rx_length_errors */ + + unsigned long tx_coll_abort;/* Add to tx_aborted_errors/collisions */ + unsigned long tx_pause_drop;/* Add to tx_aborted_errors */ + + unsigned long mc_hash[16]; +}; + +/* Structure for a device driver */ + +static struct platform_driver tsi_eth_driver = { + .probe = tsi108_init_one, + .remove = tsi108_ether_remove, + .driver = { + .name = tsi-ethernet, + }, +}; + +static void tsi108_timed_checker(unsigned long dev_ptr); + +static void dump_eth_one(struct net_device *dev) +{ + struct tsi108_prv_data *data = netdev_priv(dev); + + printk(Dumping %s...\n, dev-name); + printk(intstat %x intmask %x phy_ok %d + link %d speed %d duplex %d\n, +TSI108_ETH_READ_REG(TSI108_EC_INTSTAT), +TSI108_ETH_READ_REG(TSI108_EC_INTMASK), data-phy_ok, +data-link_up, data-speed, data-duplex); + + printk(TX: head %d, tail %d, free %d, stat %x, estat %x, err %x\n, +data-txhead, data-txtail, data-txfree, +TSI108_ETH_READ_REG(TSI108_EC_TXSTAT), +TSI108_ETH_READ_REG(TSI108_EC_TXESTAT), +TSI108_ETH_READ_REG(TSI108_EC_TXERR)); + + printk(RX: head %d, tail %d, free %d, stat %x, + estat %x, err %x, pending %d\n\n, +data-rxhead, data-rxtail, data-rxfree, +TSI108_ETH_READ_REG(TSI108_EC_RXSTAT), +TSI108_ETH_READ_REG(TSI108_EC_RXESTAT), +TSI108_ETH_READ_REG(TSI108_EC_RXERR), data-rxpending); +} + +/* Synchronization is needed between the thread and up/down events. + * Note that the PHY is accessed through the same registers for both + * interfaces, so this can't be made interface-specific. + */ + +static DEFINE_SPINLOCK(phy_lock); you should have a chip structure, that contains two structs (one for each interface/port) Could you interpret the chip structure in more detail? Need I create two net_device struct for each port? Thanks. Roy - To unsubscribe from this list: send the line
[patch 0/3 v2] Add tsi108 On chip Ethernet device driver support
The Tundra Semiconductor Corporation (Tundra) Tsi108/9 is a host bridge for PowerPC processors that offers numerous system interconnect options for embedded application designers . The Tsi108/9 can interconnect 60x or MPX processors to PCI/X peripherals, DDR2-400 memory, Gigabit Ethernet, and Flash. Tsi108/109 is used on powerpc/mpc7448hpc2 platform. The following serial patches provide Tsi108/9 on chip Ethernet chip support. 1/3 : Config and Makefile modification. 2/3 : Header file 3/3 : C body file This serial patches fix the issues in the feedback from the previous patches. Feedback is welcomed. Roy - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[patch 3/3 v2] Add tsi108 On Chip Ethernet device driver support
The Tundra Semiconductor Corporation (Tundra) Tsi108/9 is a host bridge for PowerPC processors that offers numerous system interconnect options for embedded application designers . The Tsi108/9 can interconnect 60x or MPX processors to PCI/X peripherals, DDR2-400 memory, Gigabit Ethernet, and Flash. Tsi108/109 is used on powerpc/mpc7448hpc2 platform. The following patch provides Tsi108/9 on chip Ethernet chip driver support. Signed-off-by: Alexandre Bounine [EMAIL PROTECTED] Signed-off-by: Roy Zang [EMAIL PROTECTED] -- drivers/net/tsi108_eth.c | 1700 ++ 1 files changed, 1700 insertions(+), 0 deletions(-) diff --git a/drivers/net/tsi108_eth.c b/drivers/net/tsi108_eth.c new file mode 100644 index 000..5714f78 -- /dev/null +++ b/drivers/net/tsi108_eth.c @@ -0,0 +1,1700 @@ +/*** + + Copyright(c) 2006 Tundra Semiconductor Corporation. + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + this program; if not, write to the Free Software Foundation, Inc., 59 + Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +***/ + +/* This driver is based on the driver code originally developed + * for the Intel IOC80314 (ForestLake) Gigabit Ethernet by + * [EMAIL PROTECTED] * Copyright (C) 2003 TimeSys Corporation + * + * Currently changes from original version are: + * - porting to Tsi108-based platform and kernel 2.6 ([EMAIL PROTECTED]) + * - modifications to handle two ports independently and support for + * additional PHY devices ([EMAIL PROTECTED]) + * - Get hardware information from platform device. ([EMAIL PROTECTED]) + * + */ + +#include linux/config.h +#include linux/module.h +#include linux/types.h +#include linux/init.h +#include linux/net.h +#include linux/netdevice.h +#include linux/etherdevice.h +#include linux/skbuff.h +#include linux/slab.h +#include linux/sched.h +#include linux/spinlock.h +#include linux/delay.h +#include linux/crc32.h +#include linux/mii.h +#include linux/device.h +#include linux/pci.h +#include linux/rtnetlink.h +#include linux/timer.h +#include linux/platform_device.h + +#include asm/system.h +#include asm/io.h +#include asm/tsi108.h + +#include tsi108_eth.h + +#define MII_READ_DELAY 1 /* max link wait time in msec */ + +#define TSI108_RXRING_LEN 256 + +/* NOTE: The driver currently does not support receiving packets + * larger than the buffer size, so don't decrease this (unless you + * want to add such support). + */ +#define TSI108_RXBUF_SIZE 1536 + +#define TSI108_TXRING_LEN 256 + +#define TSI108_TX_INT_FREQ64 + +/* Check the phy status every half a second. */ +#define CHECK_PHY_INTERVAL (HZ/2) + +static int tsi108_init_one(struct platform_device *pdev); +static int tsi108_ether_remove(struct platform_device *pdev); + +struct tsi108_prv_data { + void __iomem *regs;/* Base of normal regs */ + void __iomem *phyregs; /* Base of register bank used for PHY access */ + + int phy;/* Index of PHY for this interface */ + int irq_num; + int id; + + struct timer_list timer;/* Timer that triggers the check phy function */ + int rxtail; /* Next entry in rxring to read */ + int rxhead; /* Next entry in rxring to give a new buffer */ + int rxfree; /* Number of free, allocated RX buffers */ + + int rxpending; /* Non-zero if there are still descriptors +* to be processed from a previous descriptor +* interrupt condition that has been cleared */ + + int txtail; /* Next TX descriptor to check status on */ + int txhead; /* Next TX descriptor to use */ + + /* Number of free TX descriptors. This could be calculated from +* rxhead and rxtail if one descriptor were left unused to disambiguate +* full and empty conditions, but it's simpler to just keep track +* explicitly. */ + + int txfree; + + int phy_ok; /* The PHY is currently powered on. */ + + /* PHY status (duplex is 1 for half, 2 for full, +* so that the default 0 indicates that neither has +* yet been configured). */ + + int link_up; + int speed; +
[patch 1/3 v2] Add tsi108 On Chip Ethernet device driver support
The Tundra Semiconductor Corporation (Tundra) Tsi108/9 is a host bridge for PowerPC processors that offers numerous system interconnect options for embedded application designers . The Tsi108/9 can interconnect 60x or MPX processors to PCI/X peripherals, DDR2-400 memory, Gigabit Ethernet, and Flash. Tsi108/109 is used on powerpc/mpc7448hpc2 platform. The following patch provides Tsi108/9 on chip Ethernet chip driver config and Makefile. Signed-off-by: Alexandre Bounine [EMAIL PROTECTED] Signed-off-by: Roy Zang [EMAIL PROTECTED] -- drivers/net/Kconfig |8 drivers/net/Makefile |1 + 2 files changed, 9 insertions(+), 0 deletions(-) diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index a2bd811..eb17060 100644 -- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig @@ -2221,6 +2221,14 @@ config SPIDER_NET This driver supports the Gigabit Ethernet chips present on the Cell Processor-Based Blades from IBM. +config TSI108_ETH + tristate Tundra TSI108 gigabit Ethernet support + depends on TSI108_BRIDGE + help +This driver supports Tundra TSI108 gigabit Ethernet ports. +To compile this driver as a module, choose M here: the module +will be called tsi108_eth. + config GIANFAR tristate Gianfar Ethernet depends on 85xx || 83xx || PPC_86xx diff --git a/drivers/net/Makefile b/drivers/net/Makefile index 8427bf9..da199e7 100644 -- a/drivers/net/Makefile +++ b/drivers/net/Makefile @@ -112,6 +112,7 @@ obj-$(CONFIG_B44) += b44.o obj-$(CONFIG_FORCEDETH) += forcedeth.o obj-$(CONFIG_NE_H8300) += ne-h8300.o 8390.o +obj-$(CONFIG_TSI108_ETH) += tsi108_eth.o obj-$(CONFIG_MV643XX_ETH) += mv643xx_eth.o obj-$(CONFIG_PPP) += ppp_generic.o slhc.o -- 1.4.0 - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch 3/3] Add tsi108 On Chip Ethernet device driver support
On Thu, 2006-09-21 at 12:26, Jeff Garzik wrote: Zang Roy-r61911 wrote: +#define TSI108_ETH_WRITE_REG(offset, val) \ + writel(le32_to_cpu(val),data-regs + (offset)) + +#define TSI108_ETH_READ_REG(offset) \ + le32_to_cpu(readl(data-regs + (offset))) + +#define TSI108_ETH_WRITE_PHYREG(offset, val) \ + writel(le32_to_cpu(val), data-phyregs + (offset)) + +#define TSI108_ETH_READ_PHYREG(offset) \ + le32_to_cpu(readl(data-phyregs + (offset))) NAK: 1) writel() and readl() are defined to be little endian. If your platform is different, then your platform should have its own foobus_writel() and foobus_readl(). Tsi108 bridge is designed for powerpc platform. Originally, I use out_be32() and in_be32(). While there is no obvious reason to object using this bridge in a little endian system. Maybe some extra hardware logic needed for the bus interface. le32_to_cpu() can be aware the endian difference. Any comment? 2) TSI108_ETH_WRITE_REG() is just way too long. TSI_READ(), TSI_WRITE(), TSI_READ_PHY() and TSI_WRITE_PHY() would be far more readable. More in next email. I will modify the name. Roy - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [patch 3/3] Add tsi108 On Chip Ethernet device driver support
I have some review comments about your driver; please consider them for fixing Thanks. + spin_unlock_irq(phy_lock); + msleep(10); + spin_lock_irq(phy_lock); + } hmm some places take phy_lock with disabling interrupts, while others don't. I sort of fear the others may be buggy are you sure those are ok? Could you interpret your comments in detail? Roy - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
patch blocked
Hi, Does anyone can tell me why some of my patches were blocked in the mailing list. I do not use attachment. The body of the mail is not exceed 40KB in size. Roy - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: patch blocked
On Tue, 2006-09-19 at 16:50, Matti Aarnio wrote: On Tue, Sep 19, 2006 at 04:33:17PM +0800, Zang Roy-r61911 wrote: Hi, Does anyone can tell me why some of my patches were blocked in the mailing list. I do not use attachment. The body of the mail is not exceed 40KB in size. Roy We are filtering by means of bogofilter, and we are training it with all messages gone thru the list as ham -- but words that it does not know are neutral to the statistics so entirely new kind of message will easily receive that is junk treatment. The rejection message does tell couple technical details, including where to contact to ask advice. Well, I do not receive any rejection message. I sent out four patches. Three of them reached the mailing list. One seemed to disappear. I was informed nothing. Roy - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch 3/3] Add tsi108 On Chip Ethernet device driver support
On Tue, 2006-09-12 at 22:43, Jeff Garzik wrote: Roland Dreier wrote: +struct tsi108_prv_data { + volatile u32 regs; /* Base of normal regs */ + volatile u32 phyregs; /* Base of register bank used for PHY access */ Why volatile? This looks really wrong here. Indeed. I will remove it. + data-regs = (u32)ioremap(einfo-regs, 0x400); /*FIX ME */ + data-phyregs = (u32)ioremap(einfo-phyregs, 0x400);/*FIX ME */ What needs to be fixed here? And why are you casting the result of ioremap to u32? Shouldn't you keep the normal return value? Oh, that's very, very wrong. I will find method to avoid this :-). Roy - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[patch 1/3] Add tsi108 on Chip Ethernet device driver support
Update the Kconfig and Makefile Signed-off-by: Alexandre Bounine [EMAIL PROTECTED] Signed-off-by: Roy Zang [EMAIL PROTECTED] --- drivers/net/Kconfig |8 drivers/net/Makefile |1 2 files changed, 9 insertions(+), 0 deletions(-) diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index a2bd811..eb17060 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig @@ -2221,6 +2221,14 @@ config SPIDER_NET This driver supports the Gigabit Ethernet chips present on the Cell Processor-Based Blades from IBM. +config TSI108_ETH + tristate Tundra TSI108 gigabit Ethernet support + depends on TSI108_BRIDGE + help +This driver supports Tundra TSI108 gigabit Ethernet ports. +To compile this driver as a module, choose M here: the module +will be called tsi108_eth. + config GIANFAR tristate Gianfar Ethernet depends on 85xx || 83xx || PPC_86xx diff --git a/drivers/net/Makefile b/drivers/net/Makefile index 8427bf9..da199e7 100644 --- a/drivers/net/Makefile +++ b/drivers/net/Makefile @@ -112,6 +112,7 @@ obj-$(CONFIG_B44) += b44.o obj-$(CONFIG_FORCEDETH) += forcedeth.o obj-$(CONFIG_NE_H8300) += ne-h8300.o 8390.o +obj-$(CONFIG_TSI108_ETH) += tsi108_eth.o obj-$(CONFIG_MV643XX_ETH) += mv643xx_eth.o obj-$(CONFIG_PPP) += ppp_generic.o slhc.o - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[patch 0/3] Add tsi108 On chip Ethernet device driver support
It seems that my previous patch was blocked because of the size :-). This serial of patches add tsi108/9 on chip Ethernet controller support. 1/3 : Config and Makefile modification. 2/3 : Header file 3/3 : C file Roy - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[patch 3/3] Add tsi108 On Chip Ethernet device driver support
The driver for tsi108/9 on chip Ethernet port Signed-off-by: Alexandre Bounine[EMAIL PROTECTED] Signed-off-by: Roy Zang [EMAIL PROTECTED] --- drivers/net/tsi108_eth.c | 1752 ++ 1 files changed, 1752 insertions(+), 0 deletions(-) diff --git a/drivers/net/tsi108_eth.c b/drivers/net/tsi108_eth.c new file mode 100644 index 000..eece2bb --- /dev/null +++ b/drivers/net/tsi108_eth.c @@ -0,0 +1,1752 @@ +/*** + + Copyright(c) 2005 Tundra Semiconductor Corporation. + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + this program; if not, write to the Free Software Foundation, Inc., 59 + Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +***/ + +/* This driver is based on the driver code originally developed + * for the Intel IOC80314 (ForestLake) Gigabit Ethernet by + * [EMAIL PROTECTED] * Copyright (C) 2003 TimeSys Corporation + * + * Currently changes from original version are: + * - portig to Tsi108-based platform and kernel 2.6 ([EMAIL PROTECTED]) + * - modifications to handle two ports independently and support for + * additional PHY devices ([EMAIL PROTECTED]) + * + */ + +#include linux/config.h +#include linux/module.h +#include linux/types.h +#include linux/init.h +#include linux/net.h +#include linux/netdevice.h +#include linux/etherdevice.h +#include linux/skbuff.h +#include linux/slab.h +#include linux/sched.h +#include linux/spinlock.h +#include linux/delay.h +#include linux/crc32.h +#include linux/mii.h +#include linux/device.h +#include linux/pci.h +#include linux/rtnetlink.h +#include linux/timer.h +#include linux/platform_device.h + +#include asm/system.h +#include asm/io.h +#include asm/tsi108.h + +#include tsi108_eth.h + +#undef DEBUG +#ifdef DEBUG +#define DBG(fmt...) do { printk(fmt); } while(0) +#else +#define DBG(fmt...) do { } while(0) +#endif + +typedef struct net_device net_device; +typedef struct sk_buff sk_buff; + +#define MII_READ_DELAY 1 /* max link wait time in msec */ + +#define TSI108_RXRING_LEN 256 + +/* NOTE: The driver currently does not support receiving packets + * larger than the buffer size, so don't decrease this (unless you + * want to add such support). + */ +#define TSI108_RXBUF_SIZE 1536 + +#define TSI108_TXRING_LEN 256 + +#define TSI108_TX_INT_FREQ64 + +/* Check the phy status every half a second. */ +#define CHECK_PHY_INTERVAL (HZ/2) + +static int tsi108_init_one(struct platform_device *pdev); +static int tsi108_ether_remove(struct platform_device *pdev); + +struct tsi108_prv_data { + volatile u32 regs; /* Base of normal regs */ + volatile u32 phyregs; /* Base of register bank used for PHY access */ + int phy;/* Index of PHY for this interface */ + int irq_num; + int id; + + struct timer_list timer;/* Timer that triggers the check phy function */ + int rxtail; /* Next entry in rxring to read */ + int rxhead; /* Next entry in rxring to give a new buffer */ + int rxfree; /* Number of free, allocated RX buffers */ + + int rxpending; /* Non-zero if there are still descriptors +* to be processed from a previous descriptor +* interrupt condition that has been cleared */ + + int txtail; /* Next TX descriptor to check status on */ + int txhead; /* Next TX descriptor to use */ + + /* Number of free TX descriptors. This could be calculated from +* rxhead and rxtail if one descriptor were left unused to disambiguate +* full and empty conditions, but it's simpler to just keep track +* explicitly. */ + + int txfree; + + int phy_ok; /* The PHY is currently powered on. */ + + /* PHY status (duplex is 1 for half, 2 for full, +* so that the default 0 indicates that neither has +* yet been configured). */ + + int link_up; + int speed; + int duplex; + + tx_desc *txring; + rx_desc *rxring; + sk_buff *txskbs[TSI108_TXRING_LEN]; + sk_buff *rxskbs[TSI108_RXRING_LEN]; + + dma_addr_t txdma, rxdma; + + /* txlock nests in misclock and phy_lock */ + +
RE: [PATCH] [2.6.17] Add tsi108 Ethernet device driver support
On Wed, 21 Jun 2006 12:00:40 +0800 Zang Roy-r61911 [EMAIL PROTECTED] wrote: This patch adds a net device driver and configuration options for Tundra Semiconductor Tsi108 integrated dual port Gigabit Ethernet controller Your patch forgot to include these: +#include asm/tsi108_irq.h +#include asm/tsi108.h Why would a net driver have files in include/asm/? The net driver is for a tsi108 on chip Ethernet controller. tsi108_irq provides the Ethernet IRQ number. tsi108.h provides the hw_info structure. Now tsi108.h has been in the kernel tree. I'd like to provide the tsi108_irq.h with tsi108 irq support in another patch. Any comment? Have some comments-via-diff, mainly trivial: Thanks for your patch. It works OK! I will integrate it in my next version. - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html