updated tulip workqueue patch
Updated version of Francois Romieu <romieu <at> fr.zoreil.com>'s patch to convert tulip to use workqueues.
drivers/net/tulip/21142.c +2 -2
@@ -26,9 +26,9 @@ static u16 t21142_csr15[] = { 0x0008, 0x/* Handle the 21143 uniquely: do autoselect with NWay, not the EEPROM list of available transceivers. */ -void t21142_timer (unsigned long data) +void t21142_media_task (void *data) { -struct net_device *dev = (struct net_device *)data; +struct net_device *dev = data;struct tulip_private *tp =netdev_priv (dev);void __iomem *ioaddr = tp->base_addr;int csr12 =ioread32 (ioaddr +CSR12 );
drivers/net/tulip/media.c +37 -3
@@ -44,8 +44,10 @@ static const unsigned char comet_miireg2/* MII transceiver control section. Read and write the MII registers using software-generated serial -MDIO protocol. See the MII specifications or DP83840A data sheet -for details. */ +MDIO protocol. +See IEEE 802.3-2002.pdf (Section 2, Chapter "22.2.4 Management functions") +or DP83840A data sheet for more details. +*/ int tulip_mdio_read (struct net_device *dev,int phy_id,int location) {
@@ -261,24 +263,56 @@ void tulip_select_media(struct net_devicu16 *reset_sequence = &((u16 *)(p+3 ))[init_length];int reset_length = p[2 + init_length*2 ]; misc_info = reset_sequence + reset_length; -if (startup) +if (startup) { +int timeout =10 ;/* max 1 ms */ for (i =0 ; i < reset_length; i++)iowrite32 (get_u16 (&reset_sequence[i]) <<16 , ioaddr +CSR15 ); + +/* flush posted writes */ +ioread32 (ioaddr +CSR15 ); + +/* Sect 3.10.3 in DP83840A.pdf (p39) */ +msleep (1 ); + +/* Section 4.2 in DP83840A.pdf (p43) */ +/* and IEEE 802.3 "22.2.4.1.1 Reset" */ +while (timeout-- && + (tulip_mdio_read (dev, phy_num,MII_BMCR ) &BMCR_RESET )) +msleep (1 ); + }for (i =0 ; i < init_length; i++)iowrite32 (get_u16 (&init_sequence[i]) <<16 , ioaddr +CSR15 ); + +ioread32 (ioaddr +CSR15 );/* flush posted writes */ }else {u8 *init_sequence = p +2 ;u8 *reset_sequence = p +3 + init_length;int reset_length = p[2 + init_length]; misc_info = (u16 *)(reset_sequence + reset_length);if (startup) { +int timeout =10 ;/* max 1 ms */ iowrite32 (mtable->csr12dir |0x100 , ioaddr +CSR12 );for (i =0 ; i < reset_length; i++)iowrite32 (reset_sequence[i], ioaddr +CSR12 ); + +/* flush posted writes */ +ioread32 (ioaddr +CSR12 ); + +/* Sect 3.10.3 in DP83840A.pdf (p39) */ +msleep (1 ); + +/* Section 4.2 in DP83840A.pdf (p43) */ +/* and IEEE 802.3 "22.2.4.1.1 Reset" */ +while (timeout-- && + (tulip_mdio_read (dev, phy_num,MII_BMCR ) &BMCR_RESET )) +msleep (1 ); }for (i =0 ; i < init_length; i++)iowrite32 (init_sequence[i], ioaddr +CSR12 ); + +ioread32 (ioaddr +CSR12 );/* flush posted writes */ } + tmp_info =get_u16 (&misc_info[1 ]);if (tmp_info) tp->advertising[phy_num] = tmp_info |1 ;
drivers/net/tulip/timer.c +12 -2
@@ -18,13 +18,14 @@#include "tulip.h" -void tulip_timer (unsigned long data) +void tulip_media_task (void *data) { -struct net_device *dev = (struct net_device *)data; +struct net_device *dev = data;struct tulip_private *tp =netdev_priv (dev);void __iomem *ioaddr = tp->base_addr;u32 csr12 =ioread32 (ioaddr +CSR12 );int next_tick =2 *HZ ; +unsigned long flags;if (tulip_debug >2 ) { printk(KERN_DEBUG "%s: Media selection tick, %s, status %8.8x mode"
@@ -126,6 +127,15 @@ void tulip_timer(unsigned long data) }break ; } + + +spin_lock_irqsave (&tp->lock, flags); +if (tp->timeout_recovery) { +tulip_tx_timeout_complete (tp, ioaddr); + tp->timeout_recovery =0 ; + } +spin_unlock_irqrestore (&tp->lock, flags); +/* mod_timer synchronizes us with potential add_timer calls * from interrupts. */
drivers/net/tulip/tulip.h +15 -2
@@ -46,6 +46,7 @@ struct tulip_chip_table {int valid_intrs;/* CSR7 interrupt enable settings */ int flags;void (*media_timer) (unsigned long data); +void (*media_task) (void *); };
@@ -367,6 +368,7 @@ struct tulip_private { unsigned int medialock:1; /* Don't sense media type. */ unsigned int mediasense:1; /* Media sensing in progress. */ unsigned int nway:1, nwayset:1; /* 21143 internal NWay. */ + unsigned int timeout_recovery:1;unsigned int csr0;/* CSR0 setting. */ unsigned int csr6;/* Current CSR6 control settings. */ unsigned char eeprom[EEPROM_SIZE ];/* Serial EEPROM contents. */
@@ -385,6 +387,7 @@ struct tulip_private {void __iomem *base_addr;int csr12_shadow;int pad0;/* Used for 8-byte alignment */ +struct work_struct media_work; };
@@ -399,7 +402,7 @@ struct eeprom_fixup {/* 21142.c */ extern u16 t21142_csr14[]; -void t21142_timer (unsigned long data); +void t21142_media_task (void *data);void t21142_start_nway (struct net_device *dev);void t21142_lnk_change (struct net_device *dev,int csr5);
@@ -437,7 +440,7 @@ void pnic_lnk_change(struct net_device *void pnic_timer (unsigned long data);/* timer.c */ -void tulip_timer (unsigned long data); +void tulip_media_task (void *data);void mxic_timer (unsigned long data);void comet_timer (unsigned long data);
@@ -486,4 +489,14 @@ static inline void tulip_restart_rxtx(st tulip_start_rxtx(tp); } +static inline void tulip_tx_timeout_complete (struct tulip_private *tp,void __iomem *ioaddr) +{ +/* Stop and restart the chip's Tx processes. */ +tulip_restart_rxtx (tp); +/* Trigger an immediate transmit demand. */ +iowrite32 (0 , ioaddr +CSR1 ); + + tp->stats.tx_errors++; +} +#endif /* __NET_TULIP_H__ */
drivers/net/tulip/tulip_core.c +44 -35
176 lines not on this page · raw message
_______________________________________________
parisc-linux mailing list
[email protected]
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux