Question: Status of marvell's PATA 88SE6101 controller on intel boards

2007-02-06 Thread Levitsky Maxim
Hello,

I am going to buy a intel DG965RYCK motherboard. The board looks ok to me , 
but I found that it contains marvell's 88SE6101 PATA controller , and I need to 
use PATA.

I also noticed that 2.6.20 adds experimentally support for that chip.
But driver says that it enables it via 'legacy mode'

I will be glad to hear whenever full support is planned or not.

And as last thing I want to ask you whenever current support is usable, 
that is can I use DMA , can I use DVD as at least reader for CD/DVD , 
and even better can I burn disks with it ( although I can live without it)

Your truly,
 Maxim Levitsky


Maxim Levitsky


 

Don't get soaked.  Take a quick peak at the forecast
with the Yahoo! Search weather shortcut.
http://tools.search.yahoo.com/shortcuts/#loc_weather
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Question: Status of marvell's PATA 88SE6101 controller on intel boards

2007-02-06 Thread Levitsky Maxim

--- Alan <[EMAIL PROTECTED]> wrote:

> > I also noticed that 2.6.20 adds experimentally support for that chip.
> > But driver says that it enables it via 'legacy mode'
> 
> Yes.
> 
> > I will be glad to hear whenever full support is planned or not.
> 
> At the moment it is not, but it may be a neccessary side effect of full
> support for the later SATA capable controllers in native SATA mode. In
> which case you might get it one day.
> 
> The legacy mode is itself as good as most typical PATA controllers and
> better than some.

And I don't need anything better , just normal recording on my PATA DVD writer.
I now have very old system and still DVD recording works fine , so I don't need 
anything more than
that

> >
> > And as last thing I want to ask you whenever current support is usable, 
> > that is can I use DMA , can I use DVD as at least reader for CD/DVD , 
> > and even better can I burn disks with it ( although I can live without it)
> 
> The legacy mode has full DMA support. What you don't get is the ability
> to queue multiple commands so the hardware can fire off a new command as
> the first completes and to have the hardware do some of the general
> poking around for us. 

So that means that DVD-writer will work too ?

> 
> Alan
> 

Thank you very much, I didn't expect so quick response.


Thank you, kernel developers for so great kernel.
  Maxim Levitsky



 

Looking for earth-friendly autos? 
Browse Top Cars by "Green Rating" at Yahoo! Autos' Green Center.
http://autos.yahoo.com/green_center/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Question: Status of marvell's PATA 88SE6101 controller on intel boards

2007-02-06 Thread Levitsky Maxim

--- Alan <[EMAIL PROTECTED]> wrote:

> On Tue, 6 Feb 2007 10:07:50 -0800 (PST)
> Levitsky Maxim <[EMAIL PROTECTED]> wrote:
> > So that means that DVD-writer will work too ?
> 
> It should do
> 
> Alan
> 

Thank you very much
   Maxim Levitsky


 

Have a burning question?  
Go to www.Answers.yahoo.com and get answers from real people who know.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] [NET] dmfe : number of fixes and features

2007-02-07 Thread Levitsky Maxim
Hello,

Before some time I decided to fix suspend/resume on my Davicom network card.
During development I also fixed couple of bugs and added support for link 
detection and WOL
Note : 2.6.20 already has support for link detection , but it is broken when 
card has external PHY
, like mine.

So here it goes:

[PATCH] [NET] [001] dmfe : trivial/spelling fixes
[PATCH] [NET] [002] dmfe : Fix possible oops
[PATCH] [NET] [003] dmfe : fix link detection
[PATCH] [NET] [004] dmfe : Add suspend/resume support
[PATCH] [NET] [005] dmfe : Add support for wake-on-lan

Maxim Levitsky


 

Food fight? Enjoy some healthy debate 
in the Yahoo! Answers Food & Drink Q&A.
http://answers.yahoo.com/dir/?link=list&sid=396545367
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] [NET] dmfe : number of fixes and features

2007-02-07 Thread Levitsky Maxim
From: Maxim Levitsky <[EMAIL PROTECTED]>
Subject: [PATCH] [NET] [001] dmfe : trivial/spelling fixes

Fix a typo, and wrap lines on 80-th column

Signed-off-by: Maxim Levitsky <[EMAIL PROTECTED]>

---

--- linux-2.6.20-org/drivers/net/tulip/dmfe.c   2007-02-03 11:47:52.0 
+0200
+++ linux-2.6.20-mod/drivers/net/tulip/dmfe.c   2007-02-07 14:41:29.0 
+0200
@@ -143,9 +145,13 @@
 #define DMFE_TX_TIMEOUT ((3*HZ)/2) /* tx packet time-out time 1.5 s" */
 #define DMFE_TX_KICK   (HZ/2)  /* tx packet Kick-out time 0.5 s" */
 
-#define DMFE_DBUG(dbug_now, msg, value) if (dmfe_debug || (dbug_now)) 
printk(KERN_ERR DRV_NAME ":
%s %lx\n", (msg), (long) (value))
+#define DMFE_DBUG(dbug_now, msg, value) if (dmfe_debug || (dbug_now)) \
+   printk(KERN_ERR DRV_NAME ": %s %lx\n", (msg), (long) (value))
 
-#define SHOW_MEDIA_TYPE(mode) printk(KERN_ERR DRV_NAME ": Change Speed to 
%sMhz %s duplex\n",mode
& 1 ?"100":"10", mode & 4 ? "full":"half");
+#define SHOW_MEDIA_TYPE(mode) \
+   printk(KERN_ERR DRV_NAME ": \
+   Change Speed to %sMhz %s duplex\n",mode & 1 ?"100":"10", \
+   mode & 4 ? "full":"half");
 
 
 /* CR9 definition: SROM/MII */
@@ -163,10 +169,17 @@
 
 #define SROM_V41_CODE   0x14
 
-#define SROM_CLK_WRITE(data, ioaddr)
outl(data|CR9_SROM_READ|CR9_SRCS,ioaddr);udelay(5);outl(data|CR9_SROM_READ|CR9_SRCS|CR9_SRCLK,ioaddr);udelay(5);outl(data|CR9_SROM_READ|CR9_SRCS,ioaddr);udelay(5);
+#define SROM_CLK_WRITE(data, ioaddr) \
+   outl(data|CR9_SROM_READ|CR9_SRCS,ioaddr);udelay(5);\
+   outl(data|CR9_SROM_READ|CR9_SRCS|CR9_SRCLK,ioaddr);udelay(5);\
+   outl(data|CR9_SROM_READ|CR9_SRCS,ioaddr);udelay(5);
+
+#define __CHK_IO_SIZE(pci_id, dev_rev) \
+   ( ((pci_id)==PCI_DM9132_ID) || ((dev_rev) >= 0x0230) ) ? \
+   DM9102A_IO_SIZE: DM9102_IO_SIZE
 
-#define __CHK_IO_SIZE(pci_id, dev_rev) ( ((pci_id)==PCI_DM9132_ID) || 
((dev_rev) >= 0x0230) )
? DM9102A_IO_SIZE: DM9102_IO_SIZE
-#define CHK_IO_SIZE(pci_dev, dev_rev) __CHK_IO_SIZE(((pci_dev)->device << 16) |
(pci_dev)->vendor, dev_rev)
+#define CHK_IO_SIZE(pci_dev, dev_rev) \
+   __CHK_IO_SIZE(((pci_dev)->device << 16) | (pci_dev)->vendor, dev_rev)
 
 /* Sten Check */
 #define DEVICE net_device
@@ -329,7 +342,7 @@ static void dmfe_program_DM9802(struct d
 static void dmfe_HPNA_remote_cmd_chk(struct dmfe_board_info * );
 static void dmfe_set_phyxcer(struct dmfe_board_info *);
 
-/* DM910X network baord routine  */
+/* DM910X network board routine  */
 
 /*
  * Search DM910X board ,allocate space and register it
@@ -402,8 +415,11 @@ static int __devinit dmfe_init_one (stru
db->dev = dev;
 
/* Allocate Tx/Rx descriptor memory */
-   db->desc_pool_ptr = pci_alloc_consistent(pdev, sizeof(struct tx_desc) * 
DESC_ALL_CNT + 0x20,
&db->desc_pool_dma_ptr);
-   db->buf_pool_ptr = pci_alloc_consistent(pdev, TX_BUF_ALLOC * 
TX_DESC_CNT + 4,
&db->buf_pool_dma_ptr);
+   db->desc_pool_ptr = pci_alloc_consistent(pdev, sizeof(struct tx_desc) 
+   * DESC_ALL_CNT + 0x20, &db->desc_pool_dma_ptr);
+   
+   db->buf_pool_ptr = pci_alloc_consistent(pdev, TX_BUF_ALLOC 
+   * TX_DESC_CNT + 4, &db->buf_pool_dma_ptr);
 
db->first_tx_desc = (struct tx_desc *) db->desc_pool_ptr;
db->first_tx_desc_dma = db->desc_pool_dma_ptr;
@@ -440,7 +457,8 @@ static int __devinit dmfe_init_one (stru
 
/* read 64 word srom data */
for (i = 0; i < 64; i++)
-   ((u16 *) db->srom)[i] = cpu_to_le16(read_srom_word(db->ioaddr, 
i));
+   ((u16 *) db->srom)[i] = 
+   cpu_to_le16(read_srom_word(db->ioaddr, i));
 
/* Set Node address */
for (i = 0; i < 6; i++)
@@ -722,7 +742,8 @@ static int dmfe_stop(struct DEVICE *dev)
 
 #if 0
/* show statistic counter */
-   printk(DRV_NAME ": FU:%lx EC:%lx LC:%lx NC:%lx LOC:%lx TXJT:%lx 
RESET:%lx RCR8:%lx FAL:%lx
TT:%lx\n",
+   printk(DRV_NAME ": FU:%lx EC:%lx LC:%lx NC:%lx LOC:%lx TXJT:%lx 
+   RESET:%lx RCR8:%lx FAL:%lx TT:%lx\n",
db->tx_fifo_underrun, db->tx_excessive_collision,
db->tx_late_collision, db->tx_no_carrier, db->tx_loss_carrier,
db->tx_jabber_timeout, db->reset_count, db->reset_cr8,
@@ -919,7 +940,8 @@ static void dmfe_rx_packet(struct DEVICE
db->rx_avail_cnt--;
db->interval_rx_cnt++;
 
-   pci_unmap_single(db->pdev, le32_to_cpu(rxptr->rdes2), 
RX_ALLOC_SIZE, PCI_DMA_FROMDEVICE);
+   pci_unmap_single(db->pdev, le32_to_cpu(rxptr->rdes2), 
+RX_ALLOC_SIZE, PCI_DMA_FROMDEVICE);
if ( (rdes0 & 0x300) != 0x300) {
/* A packet without First/Last flag */
/* reuse this SKB */
@@ -1259,7 +1334,8 @@ static void dmfe_reuse_skb(struct dmfe_b
 
if (!(rxptr->rdes0 & cpu_to_le3

Re: [PATCH] [NET] dmfe : number of fixes and features

2007-02-07 Thread Levitsky Maxim
From: Maxim Levitsky <[EMAIL PROTECTED]>
Subject: [PATCH] [NET] [002] dmfe : Fix possible oops

Deallocate memory after driver is unregistred to prevent oops
Don't dereference NULL pointer that can be returned by dev_alloc_skb in case of 
oom

Signed-off-by: Maxim Levitsky <[EMAIL PROTECTED]>

---

--- linux-2.6.20-mod/drivers/net/tulip/dmfe.c   2007-02-07 18:27:07.0 
+0200
+++ linux-2.6.20-test/drivers/net/tulip/dmfe.c  2007-02-07 18:27:59.0 
+0200
@@ -497,13 +497,16 @@ static void __devexit dmfe_remove_one (s
DMFE_DBUG(0, "dmfe_remove_one()", 0);
 
if (dev) {
+   
+   unregister_netdev(dev);
+   pci_release_regions(pdev);
+   
+   
pci_free_consistent(db->pdev, sizeof(struct tx_desc) *
DESC_ALL_CNT + 0x20, db->desc_pool_ptr,
db->desc_pool_dma_ptr);
pci_free_consistent(db->pdev, TX_BUF_ALLOC * TX_DESC_CNT + 4,
db->buf_pool_ptr, db->buf_pool_dma_ptr);
-   unregister_netdev(dev);
-   pci_release_regions(pdev);
free_netdev(dev);   /* free board information */
pci_set_drvdata(pdev, NULL);
}
@@ -921,7 +924,7 @@ static inline u32 cal_CRC(unsigned char 
 static void dmfe_rx_packet(struct DEVICE *dev, struct dmfe_board_info * db)
 {
struct rx_desc *rxptr;
-   struct sk_buff *skb;
+   struct sk_buff *skb, *newskb;
int rxlen;
u32 rdes0;
 
@@ -974,8 +977,10 @@ static void dmfe_rx_packet(struct DEVICE
/* Good packet, send to upper layer */
/* Shorst packet used new SKB */
if ( (rxlen < RX_COPY_SIZE) &&
-   ( (skb = dev_alloc_skb(rxlen + 
2) )
+   ( (newskb = dev_alloc_skb(rxlen 
+ 2) )
!= NULL) ) {
+   
+   skb = newskb;
/* size less than COPY_SIZE, 
allocate a rxlen SKB */
skb->dev = dev;
skb_reserve(skb, 2); /* 16byte 
align */



 

Expecting? Get great news right away with email Auto-Check. 
Try the Yahoo! Mail Beta.
http://advision.webevents.yahoo.com/mailbeta/newmail_tools.html 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] [NET] dmfe : number of fixes and features

2007-02-07 Thread Levitsky Maxim
From: Maxim Levitsky <[EMAIL PROTECTED]>
Subject: [PATCH] [NET] [003] dmfe : fix link detection

Cleanup link detection
Fix link not detected when using external PHY

Signed-off-by: Maxim Levitsky <[EMAIL PROTECTED]>

---

CR12's bits 0 and 1 show link status/speed only for internal PHY.
In case external one is used, only bit 6 shows link status via special line , 
and can be left
unnconected
Thus we need to check bit 6 and also query PHY for link status
Note: internal phy is standard phy , so will indicate link status too.

--- linux-2.6.20-mod/drivers/net/tulip/dmfe.c   2007-02-07 18:40:33.0 
+0200
+++ linux-2.6.20-test/drivers/net/tulip/dmfe.c  2007-02-07 18:44:01.0 
+0200
@@ -147,7 +147,7 @@
printk(KERN_ERR DRV_NAME ": %s %lx\n", (msg), (long) (value))
 
 #define SHOW_MEDIA_TYPE(mode) \
-   printk(KERN_ERR DRV_NAME ": \
+   printk(KERN_INFO DRV_NAME ": \
Change Speed to %sMhz %s duplex\n",mode & 1 ?"100":"10", \
mode & 4 ? "full":"half");
 
@@ -242,7 +242,6 @@ struct dmfe_board_info {
u8 media_mode;  /* user specify media mode */
u8 op_mode; /* real work media mode */
u8 phy_addr;
-   u8 link_failed; /* Ever link failed */
u8 wait_reset;  /* Hardware failed, need to reset */
u8 dm910x_chk_mode; /* Operating mode check */
u8 first_in_callback;   /* Flag to record state */
@@ -536,7 +535,6 @@ static int dmfe_open(struct DEVICE *dev)
db->tx_packet_cnt = 0;
db->tx_queue_cnt = 0;
db->rx_avail_cnt = 0;
-   db->link_failed = 1;
db->wait_reset = 0;
 
db->first_in_callback = 0;
@@ -1091,6 +1089,8 @@ static void dmfe_timer(unsigned long dat
struct dmfe_board_info *db = netdev_priv(dev);
unsigned long flags;
 
+   int link_ok, link_ok_phy;
+
DMFE_DBUG(0, "dmfe_timer()", 0);
spin_lock_irqsave(&db->lock, flags);
 
@@ -1155,22 +1155,45 @@ static void dmfe_timer(unsigned long dat
else
tmp_cr12 = inb(db->ioaddr + DCR12); /* DM9102/DM9102A */
 
+   
if ( ((db->chip_id == PCI_DM9102_ID) &&
(db->chip_revision == 0x0230)) ||
((db->chip_id == PCI_DM9132_ID) &&
(db->chip_revision == 0x0210)) ) {
/* DM9102A Chip */
if (tmp_cr12 & 2)
-   tmp_cr12 = 0x0; /* Link failed */
+   link_ok = 0;
else
-   tmp_cr12 = 0x3; /* Link OK */
+   link_ok = 1;
+   }
+   else
+   /*0x43 is used instead of 0x3 because bit 6 should be 
+   connected to external PHY and specify its link status.*/
+   link_ok = (tmp_cr12 & 0x43) ? 1 : 0;
+   
+   
+   /* If chip reports that link is failed it could be because external 
+   PHY is not conected correctly to chip (through pin 89).
+   To be sure ask PHY too.
+   */
+   
+   /* need a dummy read because of PHY's register latch*/
+   phy_read (db->ioaddr, db->phy_addr, 1, db->chip_id); 
+   link_ok_phy = (phy_read (db->ioaddr, 
+  db->phy_addr, 1, db->chip_id) & 0x4) ? 1 : 0;
+   
+
+   
+   if (link_ok_phy != link_ok) {
+   DMFE_DBUG (0, "PHY and chip report different link status", 0);
+   link_ok = link_ok | link_ok_phy;
}
 
-   if ( !(tmp_cr12 & 0x3) && !db->link_failed ) {
+   if ( !link_ok && netif_carrier_ok(dev) ) {
/* Link Failed */
DMFE_DBUG(0, "Link Failed", tmp_cr12);
-   db->link_failed = 1;
-   netif_carrier_off(db->dev);
+   
+   netif_carrier_off(dev);
 
/* For Force 10/100M Half/Full mode: Enable Auto-Nego mode */
/* AUTO or force 1M Homerun/Longrun don't need */
@@ -1184,19 +1207,17 @@ static void dmfe_timer(unsigned long dat
db->cr6_data&=~0x0200;  /* bit9=0, HD mode */
update_cr6(db->cr6_data, db->ioaddr);
}
-   } else
-   if ((tmp_cr12 & 0x3) && db->link_failed) {
-   DMFE_DBUG(0, "Link link OK", tmp_cr12);
-   db->link_failed = 0;
+   
+   } else if (!netif_carrier_ok(dev)) {
+   
+   DMFE_DBUG(0, "Link OK", tmp_cr12);
 
/* Auto Sense Speed */
-   if ( (db->media_mode & DMFE_AUTO) &&
-   dmfe_sense_speed(db) )
-   db->link_failed = 1;
-   else
-   netif_carrier_on(db->dev);
+   if (! (db->media_mode & DMFE_AUTO) || !dmfe_sense_speed(db)) {
+   netif_carrier_on(dev)

Re: [PATCH] [NET] dmfe : number of fixes and features

2007-02-07 Thread Levitsky Maxim
From: Maxim Levitsky <[EMAIL PROTECTED]>
Subject: [PATCH] [NET] [004] dmfe : Add suspend/resume support

Adds support for suspend/resume

---


--- linux-2.6.20-mod/drivers/net/tulip/dmfe.c   2007-02-07 18:46:13.0 
+0200
+++ linux-2.6.20-test/drivers/net/tulip/dmfe.c  2007-02-07 18:50:52.0 
+0200
@@ -55,9 +55,6 @@
 
 TODO
 
-Implement pci_driver::suspend() and pci_driver::resume()
-power management methods.
-
 Check on 64 bit boxes.
 Check and fix on big endian boxes.
 
@@ -2027,11 +2024,59 @@ static struct pci_device_id dmfe_pci_tbl
 MODULE_DEVICE_TABLE(pci, dmfe_pci_tbl);
 
 
+
+static int dmfe_suspend(struct pci_dev *pci_dev, pm_message_t state)
+{
+u32 tmp;
+
+struct net_device *dev = pci_get_drvdata(pci_dev);
+struct dmfe_board_info *db = netdev_priv(dev);
+
+/* Disable upper layer interface */
+netif_device_detach(dev);
+
+/* Disable Tx/Rx */
+db->cr6_data &= ~(CR6_RXSC | CR6_TXSC);
+update_cr6(db->cr6_data, dev->base_addr);
+
+/* Disable Interrupt */
+outl(0, dev->base_addr + DCR7);
+outl(inl(dev->base_addr + DCR5), dev->base_addr + DCR5);
+
+/* Fre RX buffers */
+dmfe_free_rxbuffer(db);
+
+/* Power down device*/
+pci_set_power_state(pci_dev ,  pci_choose_state(pci_dev,state));
+pci_save_state(pci_dev);
+
+return 0;
+}
+
+static int dmfe_resume(struct pci_dev *pci_dev)
+{
+struct net_device *dev = pci_get_drvdata(pci_dev);
+u32 tmp;
+
+pci_restore_state(pci_dev);
+pci_set_power_state(pci_dev ,PCI_D0);
+
+/* Re-initilize DM910X board */
+dmfe_init_dm910x(dev);
+
+/* Restart upper layer interface */
+netif_device_attach(dev);
+
+return 0;
+}
+
 static struct pci_driver dmfe_driver = {
.name   = "dmfe",
.id_table   = dmfe_pci_tbl,
.probe  = dmfe_init_one,
.remove = __devexit_p(dmfe_remove_one),
+.suspend= dmfe_suspend,
+.resume = dmfe_resume
 };
 
 MODULE_AUTHOR("Sten Wang, [EMAIL PROTECTED]");



 

Need a quick answer? Get one in minutes from people who know.
Ask your question on www.Answers.yahoo.com
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] [NET] dmfe : number of fixes and features

2007-02-07 Thread Levitsky Maxim
From: Maxim Levitsky <[EMAIL PROTECTED]>
Subject: [PATCH] [NET] [005] dmfe : Add support for wake-on-lan

Adds support for wake on lan feature

Signed-off-by: Maxim Levitsky <[EMAIL PROTECTED]>

---

This board supports WOL on magic packet / link change / specific packet
This adds support for WOL on magic packet / link change

Note : WOL is enabled when you suspend system ether to disk or ram, and is not 
enabled when you
turn system off


--- linux-2.6.20-mod/drivers/net/tulip/dmfe.c   2007-02-07 18:53:19.0 
+0200
+++ linux-2.6.20-test/drivers/net/tulip/dmfe.c  2007-02-07 18:55:44.0 
+0200
@@ -122,6 +122,11 @@
 #define DM9801_NOISE_FLOOR 8
 #define DM9802_NOISE_FLOOR 5
 
+#define DMFE_WOL_LINKCHANGE0x2000
+#define DMFE_WOL_SAMPLEPACKET  0x1000
+#define DMFE_WOL_MAGICPACKET   0x0800
+
+
 #define DMFE_10MHF  0
 #define DMFE_100MHF 1
 #define DMFE_10MFD  4
@@ -242,6 +247,7 @@ struct dmfe_board_info {
u8 wait_reset;  /* Hardware failed, need to reset */
u8 dm910x_chk_mode; /* Operating mode check */
u8 first_in_callback;   /* Flag to record state */
+   u8 wol_mode;/* user WOL settings */
struct timer_list timer;
 
/* System defined statistic counter */
@@ -423,6 +429,7 @@ static int __devinit dmfe_init_one (stru
db->chip_id = ent->driver_data;
db->ioaddr = pci_resource_start(pdev, 0);
db->chip_revision = dev_rev;
+   db->wol_mode = 0;
 
db->pdev = pdev;
 
@@ -1054,7 +1061,11 @@ static void dmfe_set_filter_mode(struct 
spin_unlock_irqrestore(&db->lock, flags);
 }
 
-static void netdev_get_drvinfo(struct net_device *dev,
+/*
+ * Ethtool interace 
+ */
+
+static void dmfe_ethtool_get_drvinfo(struct net_device *dev,
   struct ethtool_drvinfo *info)
 {
struct dmfe_board_info *np = netdev_priv(dev);
@@ -1068,9 +1079,35 @@ static void netdev_get_drvinfo(struct ne
dev->base_addr, dev->irq);
 }
 
+static int dmfe_ethtool_set_wol(struct net_device *dev, 
+   struct ethtool_wolinfo *wolinfo)
+{
+   struct dmfe_board_info *db = netdev_priv(dev);
+   
+   if (wolinfo->wolopts & (WAKE_UCAST | WAKE_MCAST | WAKE_BCAST | 
+   WAKE_ARP | WAKE_MAGICSECURE))
+  return -EOPNOTSUPP;
+   
+   db->wol_mode = wolinfo->wolopts;
+   return 0;
+}
+
+static void dmfe_ethtool_get_wol(struct net_device *dev, 
+struct ethtool_wolinfo *wolinfo)
+{
+   struct dmfe_board_info *db = netdev_priv(dev);
+   
+   wolinfo->supported = WAKE_PHY | WAKE_MAGIC;
+   wolinfo->wolopts = db->wol_mode;
+   return;
+}
+
+
 static const struct ethtool_ops netdev_ethtool_ops = {
-   .get_drvinfo= netdev_get_drvinfo,
+   .get_drvinfo= dmfe_ethtool_get_drvinfo,
.get_link   = ethtool_op_get_link,
+   .set_wol= dmfe_ethtool_set_wol,
+   .get_wol= dmfe_ethtool_get_wol,
 };
 
 /*
@@ -2046,6 +2083,20 @@ static int dmfe_suspend(struct pci_dev *
 /* Fre RX buffers */
 dmfe_free_rxbuffer(db);
 
+/* Enable WOL */
+pci_read_config_dword(pci_dev, 0x40, &tmp);
+tmp &= ~(WAKE_PHY|WAKE_MAGIC);
+
+if (db->wol_mode & WAKE_PHY)
+   tmp |= DMFE_WOL_LINKCHANGE;
+if (db->wol_mode & WAKE_MAGIC)
+   tmp |= DMFE_WOL_MAGICPACKET;
+
+pci_write_config_dword(pci_dev, 0x40, tmp);
+
+pci_enable_wake(pci_dev, PCI_D3hot, 1);
+pci_enable_wake(pci_dev, PCI_D3cold, 1);
+
 /* Power down device*/
 pci_set_power_state(pci_dev ,  pci_choose_state(pci_dev,state));
 pci_save_state(pci_dev);
@@ -2064,6 +2115,15 @@ static int dmfe_resume(struct pci_dev *p
 /* Re-initilize DM910X board */
 dmfe_init_dm910x(dev);
 
+/* Disable WOL */
+pci_read_config_dword(pci_dev, 0x40, &tmp);
+
+tmp &= (DMFE_WOL_LINKCHANGE | DMFE_WOL_MAGICPACKET);
+pci_write_config_dword(pci_dev, 0x40, tmp);
+
+pci_enable_wake(pci_dev, PCI_D3hot, 0);
+pci_enable_wake(pci_dev, PCI_D3cold, 0);
+
 /* Restart upper layer interface */
 netif_device_attach(dev);
 



 

The fish are biting. 
Get more visitors on your site using Yahoo! Search Marketing.
http://searchmarketing.yahoo.com/arp/sponsoredsearch_v2.php
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] [NET] dmfe : number of fixes and features

2007-02-07 Thread Levitsky Maxim

--- Randy Dunlap <[EMAIL PROTECTED]> wrote:

> On Wed, 7 Feb 2007 09:57:21 -0800 (PST) Levitsky Maxim wrote:
> 
> > Hello,
> > 
> > Before some time I decided to fix suspend/resume on my Davicom network card.
> > During development I also fixed couple of bugs and added support for link 
> > detection and WOL
> > Note : 2.6.20 already has support for link detection , but it is broken 
> > when card has external
> PHY
> > , like mine.
> > 
> > So here it goes:
> > 
> > [PATCH] [NET] [001] dmfe : trivial/spelling fixes
> > [PATCH] [NET] [002] dmfe : Fix possible oops
> > [PATCH] [NET] [003] dmfe : fix link detection
> > [PATCH] [NET] [004] dmfe : Add suspend/resume support
> > [PATCH] [NET] [005] dmfe : Add support for wake-on-lan
> 
> Hi,
> Please use a different Subject: line for each patch (like you have
> listed them above).
> 
> Also, please send network driver patches to netdev@vger.kernel.org .
> 
> Oops, MAINTAINERS should list netdev@ for DMFE.
> And it does list a maintainer for DMFE, so you should cc: him on
> the patches.
> 
> Thanks.
> ---
> ~Randy
> 

Thanks , its first time I post patches here.
Maxim levitsky


 

Don't pick lemons.
See all the new 2007 cars at Yahoo! Autos.
http://autos.yahoo.com/new_cars.html 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] [NET] dmfe : number of fixes and features

2007-02-07 Thread Levitsky Maxim
--- Ismail Dönmez <[EMAIL PROTECTED]> wrote:

> Hi,
> On Wednesday 07 February 2007 19:57:21 you wrote:
> > Hello,
> >
> > Before some time I decided to fix suspend/resume on my Davicom network
> > card. During development I also fixed couple of bugs and added support for
> > link detection and WOL Note : 2.6.20 already has support for link detection
> > , but it is broken when card has external PHY , like mine.
> >
> > So here it goes:
> >
> > [PATCH] [NET] [001] dmfe : trivial/spelling fixes
> > [PATCH] [NET] [002] dmfe : Fix possible oops
> > [PATCH] [NET] [003] dmfe : fix link detection
> > [PATCH] [NET] [004] dmfe : Add suspend/resume support
> > [PATCH] [NET] [005] dmfe : Add support for wake-on-lan
> 
> 
> CC netdev@vger.kernel.org for network patches.
> 
> Regards,
> ismail
> 

I sended all pathes again and I CC'd both maintainer and netdev@vger.kernel.org

 Sincerely,
Maxim Levitsky


 

8:00? 8:25? 8:40? Find a flick in no time 
with the Yahoo! Search movie showtime shortcut.
http://tools.search.yahoo.com/shortcuts/#news
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


OT: I don't recive mail from linux-kernel

2007-02-08 Thread Levitsky Maxim
Good day,

I don't recive mail from LKML
I am very sorry that I did't ask this before,

Before lot of time (about half a year) I lost password to my email box.
But I managed to find it in old notebook, after about three months, and I found 
that my mailbox
ceased to recive mail from LKML.

Then I decided not to do anything about that cause I was't needed this 
subsrciption, and I read
LKML through GMANE. 

But now things changed, cause I wrote number of patches, and it is very 
difficult to send patches
without subscription.

So I want to ask you whenever my mailbox is banned or not and gently ask you to 
lift it if yes,
case I said the reason my mailbox was unaviable ( or at least I think so)

Best regards ,
 Maxim Levitsky

PS: I like linux kernel very much, especially the fact that it is written in C, 
I already had
studied lot of it's code , and now I am focused on fixing drivers that I use on 
my system.




 

Now that's room service!  Choose from over 150,000 hotels
in 45,000 destinations on Yahoo! Travel to find your fit.
http://farechase.yahoo.com/promo-generic-14795097
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: OT: I don't recive mail from linux-kernel

2007-02-08 Thread Levitsky Maxim

--- David Miller <[EMAIL PROTECTED]> wrote:

> From: Levitsky Maxim <[EMAIL PROTECTED]>
> Date: Thu, 8 Feb 2007 05:09:25 -0800 (PST)
> 
> > But now things changed, cause I wrote number of patches, and it is
> > very difficult to send patches without subscription.
> 
> You don't need to be subscribed in order to send postings to the
> mailing list.
> 

Nevermind that, I just registered a gmail account maximlevitsky at gmail.com so 
I won't use this
one anymore, because yahoo webmail corrupts patches. I will unsubscribe this 
account now from lkml

 Cheers,
 Maxim Levitsky





 

Finding fabulous fares is fun.  
Let Yahoo! FareChase search your favorite travel sites to find flight and hotel 
bargains.
http://farechase.yahoo.com/promo-generic-14795097
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] [NETDEV] [000] dmfe : fix bugs and add features

2007-02-07 Thread Levitsky Maxim
Hello,

Before some time I decided to fix suspend/resume on my Davicom network card.
During development I also fixed couple of bugs and added support for link 
detection and WOL
Note : 2.6.20 already has support for link detection , but it is broken when 
card has external PHY
, like mine.

So here it goes:

[PATCH] [NET] [001] dmfe : trivial/spelling fixes
[PATCH] [NET] [002] dmfe : Fix possible oops
[PATCH] [NET] [003] dmfe : fix link detection
[PATCH] [NET] [004] dmfe : Add suspend/resume support
[PATCH] [NET] [005] dmfe : Add support for wake-on-lan

        Maxim Levitsky


 

Finding fabulous fares is fun.  
Let Yahoo! FareChase search your favorite travel sites to find flight and hotel 
bargains.
http://farechase.yahoo.com/promo-generic-14795097
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] [NETDEV] [001] dmfe : trivial/spelling fixes

2007-02-07 Thread Levitsky Maxim
From: Maxim Levitsky <[EMAIL PROTECTED]>
Subject: [PATCH] [NET] [001] dmfe : trivial/spelling fixes

Fix a typo, and wrap lines on 80-th column

Signed-off-by: Maxim Levitsky <[EMAIL PROTECTED]>

---

--- linux-2.6.20-org/drivers/net/tulip/dmfe.c   2007-02-03 11:47:52.0 
+0200
+++ linux-2.6.20-mod/drivers/net/tulip/dmfe.c   2007-02-07 14:41:29.0 
+0200
@@ -143,9 +145,13 @@
 #define DMFE_TX_TIMEOUT ((3*HZ)/2) /* tx packet time-out time 1.5 s" */
 #define DMFE_TX_KICK   (HZ/2)  /* tx packet Kick-out time 0.5 s" */
 
-#define DMFE_DBUG(dbug_now, msg, value) if (dmfe_debug || (dbug_now)) 
printk(KERN_ERR DRV_NAME ":
%s %lx\n", (msg), (long) (value))
+#define DMFE_DBUG(dbug_now, msg, value) if (dmfe_debug || (dbug_now)) \
+   printk(KERN_ERR DRV_NAME ": %s %lx\n", (msg), (long) (value))
 
-#define SHOW_MEDIA_TYPE(mode) printk(KERN_ERR DRV_NAME ": Change Speed to 
%sMhz %s duplex\n",mode
& 1 ?"100":"10", mode & 4 ? "full":"half");
+#define SHOW_MEDIA_TYPE(mode) \
+   printk(KERN_ERR DRV_NAME ": \
+   Change Speed to %sMhz %s duplex\n",mode & 1 ?"100":"10", \
+   mode & 4 ? "full":"half");
 
 
 /* CR9 definition: SROM/MII */
@@ -163,10 +169,17 @@
 
 #define SROM_V41_CODE   0x14
 
-#define SROM_CLK_WRITE(data, ioaddr)
outl(data|CR9_SROM_READ|CR9_SRCS,ioaddr);udelay(5);outl(data|CR9_SROM_READ|CR9_SRCS|CR9_SRCLK,ioaddr);udelay(5);outl(data|CR9_SROM_READ|CR9_SRCS,ioaddr);udelay(5);
+#define SROM_CLK_WRITE(data, ioaddr) \
+   outl(data|CR9_SROM_READ|CR9_SRCS,ioaddr);udelay(5);\
+   outl(data|CR9_SROM_READ|CR9_SRCS|CR9_SRCLK,ioaddr);udelay(5);\
+   outl(data|CR9_SROM_READ|CR9_SRCS,ioaddr);udelay(5);
+
+#define __CHK_IO_SIZE(pci_id, dev_rev) \
+   ( ((pci_id)==PCI_DM9132_ID) || ((dev_rev) >= 0x0230) ) ? \
+   DM9102A_IO_SIZE: DM9102_IO_SIZE
 
-#define __CHK_IO_SIZE(pci_id, dev_rev) ( ((pci_id)==PCI_DM9132_ID) || 
((dev_rev) >= 0x0230) )
? DM9102A_IO_SIZE: DM9102_IO_SIZE
-#define CHK_IO_SIZE(pci_dev, dev_rev) __CHK_IO_SIZE(((pci_dev)->device << 16) |
(pci_dev)->vendor, dev_rev)
+#define CHK_IO_SIZE(pci_dev, dev_rev) \
+   __CHK_IO_SIZE(((pci_dev)->device << 16) | (pci_dev)->vendor, dev_rev)
 
 /* Sten Check */
 #define DEVICE net_device
@@ -329,7 +342,7 @@ static void dmfe_program_DM9802(struct d
 static void dmfe_HPNA_remote_cmd_chk(struct dmfe_board_info * );
 static void dmfe_set_phyxcer(struct dmfe_board_info *);
 
-/* DM910X network baord routine  */
+/* DM910X network board routine  */
 
 /*
  * Search DM910X board ,allocate space and register it
@@ -402,8 +415,11 @@ static int __devinit dmfe_init_one (stru
db->dev = dev;
 
/* Allocate Tx/Rx descriptor memory */
-   db->desc_pool_ptr = pci_alloc_consistent(pdev, sizeof(struct tx_desc) * 
DESC_ALL_CNT +
0x20,
&db->desc_pool_dma_ptr);
-   db->buf_pool_ptr = pci_alloc_consistent(pdev, TX_BUF_ALLOC * 
TX_DESC_CNT + 4,
&db->buf_pool_dma_ptr);
+   db->desc_pool_ptr = pci_alloc_consistent(pdev, sizeof(struct tx_desc) 
+   * DESC_ALL_CNT + 0x20, &db->desc_pool_dma_ptr);
+   
+   db->buf_pool_ptr = pci_alloc_consistent(pdev, TX_BUF_ALLOC 
+   * TX_DESC_CNT + 4, &db->buf_pool_dma_ptr);
 
db->first_tx_desc = (struct tx_desc *) db->desc_pool_ptr;
db->first_tx_desc_dma = db->desc_pool_dma_ptr;
@@ -440,7 +457,8 @@ static int __devinit dmfe_init_one (stru
 
/* read 64 word srom data */
for (i = 0; i < 64; i++)
-   ((u16 *) db->srom)[i] = cpu_to_le16(read_srom_word(db->ioaddr, 
i));
+   ((u16 *) db->srom)[i] = 
+   cpu_to_le16(read_srom_word(db->ioaddr, i));
 
/* Set Node address */
for (i = 0; i < 6; i++)
@@ -722,7 +742,8 @@ static int dmfe_stop(struct DEVICE *dev)
 
 #if 0
/* show statistic counter */
-   printk(DRV_NAME ": FU:%lx EC:%lx LC:%lx NC:%lx LOC:%lx TXJT:%lx 
RESET:%lx RCR8:%lx FAL:%lx
TT:%lx\n",
+   printk(DRV_NAME ": FU:%lx EC:%lx LC:%lx NC:%lx LOC:%lx TXJT:%lx 
+   RESET:%lx RCR8:%lx FAL:%lx TT:%lx\n",
db->tx_fifo_underrun, db->tx_excessive_collision,
db->tx_late_collision, db->tx_no_carrier, db->tx_loss_carrier,
db->tx_jabber_timeout, db->reset_count, db->reset_cr8,
@@ -919,7 +940,8 @@ static void dmfe_rx_packet(struct DEVICE
db->rx_avail_cnt--;
db->interval_rx_cnt++;
 
-   pci_unmap_single(db->pdev, le32_to_cpu(rxptr->rdes2), 
RX_ALLOC_SIZE,
PCI_DMA_FROMDEVICE);
+   pci_unmap_single(db->pdev, le32_to_cpu(rxptr->rdes2), 
+    RX_ALLOC_SIZE, PCI_DMA_FROMDEVICE);
if ( (rdes0 & 0x300) != 0x300) {
/* A packet without First/Last flag */
/* reuse this SKB */
@@ -1259,7 +1334,8 @@ static void dmfe_reuse_skb(struct dmfe_b
 
if (!(rxptr->rdes0 & cpu_to_le3

[PATCH] [NETDEV] [002] dmfe : Fix possible oops

2007-02-07 Thread Levitsky Maxim
From: Maxim Levitsky <[EMAIL PROTECTED]>
Subject: [PATCH] [NET] [002] dmfe : Fix possible oops

Deallocate memory after driver is unregistred to prevent oops
Don't dereference NULL pointer that can be returned by dev_alloc_skb in case of 
oom

Signed-off-by: Maxim Levitsky <[EMAIL PROTECTED]>

---

--- linux-2.6.20-mod/drivers/net/tulip/dmfe.c   2007-02-07 18:27:07.0 
+0200
+++ linux-2.6.20-test/drivers/net/tulip/dmfe.c  2007-02-07 18:27:59.0 
+0200
@@ -497,13 +497,16 @@ static void __devexit dmfe_remove_one (s
DMFE_DBUG(0, "dmfe_remove_one()", 0);
 
    if (dev) {
+   
+   unregister_netdev(dev);
+   pci_release_regions(pdev);
+   
+   
pci_free_consistent(db->pdev, sizeof(struct tx_desc) *
DESC_ALL_CNT + 0x20, db->desc_pool_ptr,
    db->desc_pool_dma_ptr);
pci_free_consistent(db->pdev, TX_BUF_ALLOC * TX_DESC_CNT + 4,
db->buf_pool_ptr, db->buf_pool_dma_ptr);
-   unregister_netdev(dev);
-   pci_release_regions(pdev);
free_netdev(dev);   /* free board information */
pci_set_drvdata(pdev, NULL);
}
@@ -921,7 +924,7 @@ static inline u32 cal_CRC(unsigned char 
 static void dmfe_rx_packet(struct DEVICE *dev, struct dmfe_board_info * db)
 {
struct rx_desc *rxptr;
-   struct sk_buff *skb;
+   struct sk_buff *skb, *newskb;
int rxlen;
u32 rdes0;
 
@@ -974,8 +977,10 @@ static void dmfe_rx_packet(struct DEVICE
/* Good packet, send to upper layer */
/* Shorst packet used new SKB */
if ( (rxlen < RX_COPY_SIZE) &&
-   ( (skb = dev_alloc_skb(rxlen + 
2) )
+   ( (newskb = dev_alloc_skb(rxlen 
+ 2) )
!= NULL) ) {
+   
+   skb = newskb;
/* size less than COPY_SIZE, 
allocate a rxlen SKB
*/
skb->dev = dev;
skb_reserve(skb, 2); /* 16byte 
align */



 

8:00? 8:25? 8:40? Find a flick in no time 
with the Yahoo! Search movie showtime shortcut.
http://tools.search.yahoo.com/shortcuts/#news
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] [NETDEV] [003] dmfe : fix link detection

2007-02-07 Thread Levitsky Maxim
From: Maxim Levitsky <[EMAIL PROTECTED]>
Subject: [PATCH] [NET] [003] dmfe : fix link detection

Cleanup link detection
Fix link not detected when using external PHY

Signed-off-by: Maxim Levitsky <[EMAIL PROTECTED]>

---

CR12's bits 0 and 1 show link status/speed only for internal PHY.
In case external one is used, only bit 6 shows link status via special line , 
and can be left
unnconected
Thus we need to check bit 6 and also query PHY for link status
Note: internal phy is standard phy , so will indicate link status too.

--- linux-2.6.20-mod/drivers/net/tulip/dmfe.c   2007-02-07 18:40:33.0 
+0200
+++ linux-2.6.20-test/drivers/net/tulip/dmfe.c  2007-02-07 18:44:01.0 
+0200
@@ -147,7 +147,7 @@
printk(KERN_ERR DRV_NAME ": %s %lx\n", (msg), (long) (value))
 
 #define SHOW_MEDIA_TYPE(mode) \
-   printk(KERN_ERR DRV_NAME ": \
+   printk(KERN_INFO DRV_NAME ": \
Change Speed to %sMhz %s duplex\n",mode & 1 ?"100":"10", \
mode & 4 ? "full":"half");
 
@@ -242,7 +242,6 @@ struct dmfe_board_info {
u8 media_mode;  /* user specify media mode */
u8 op_mode; /* real work media mode */
u8 phy_addr;
-   u8 link_failed; /* Ever link failed */
u8 wait_reset;  /* Hardware failed, need to reset */
u8 dm910x_chk_mode; /* Operating mode check */
u8 first_in_callback;   /* Flag to record state */
@@ -536,7 +535,6 @@ static int dmfe_open(struct DEVICE *dev)
db->tx_packet_cnt = 0;
db->tx_queue_cnt = 0;
db->rx_avail_cnt = 0;
-   db->link_failed = 1;
db->wait_reset = 0;
 
db->first_in_callback = 0;
@@ -1091,6 +1089,8 @@ static void dmfe_timer(unsigned long dat
struct dmfe_board_info *db = netdev_priv(dev);
    unsigned long flags;
 
+   int link_ok, link_ok_phy;
+
DMFE_DBUG(0, "dmfe_timer()", 0);
spin_lock_irqsave(&db->lock, flags);
 
@@ -1155,22 +1155,45 @@ static void dmfe_timer(unsigned long dat
else
tmp_cr12 = inb(db->ioaddr + DCR12); /* DM9102/DM9102A */
 
+   
if ( ((db->chip_id == PCI_DM9102_ID) &&
(db->chip_revision == 0x0230)) ||
((db->chip_id == PCI_DM9132_ID) &&
(db->chip_revision == 0x0210)) ) {
/* DM9102A Chip */
if (tmp_cr12 & 2)
-   tmp_cr12 = 0x0; /* Link failed */
+   link_ok = 0;
else
-   tmp_cr12 = 0x3; /* Link OK */
+   link_ok = 1;
+   }
+   else
+   /*0x43 is used instead of 0x3 because bit 6 should be 
+   connected to external PHY and specify its link status.*/
+   link_ok = (tmp_cr12 & 0x43) ? 1 : 0;
+   
+   
+   /* If chip reports that link is failed it could be because external 
+   PHY is not conected correctly to chip (through pin 89).
+   To be sure ask PHY too.
+   */
+   
+   /* need a dummy read because of PHY's register latch*/
+   phy_read (db->ioaddr, db->phy_addr, 1, db->chip_id); 
+   link_ok_phy = (phy_read (db->ioaddr, 
+          db->phy_addr, 1, db->chip_id) & 0x4) ? 1 : 0;
+   
+
+   
+   if (link_ok_phy != link_ok) {
+   DMFE_DBUG (0, "PHY and chip report different link status", 0);
+   link_ok = link_ok | link_ok_phy;
}
 
-   if ( !(tmp_cr12 & 0x3) && !db->link_failed ) {
+   if ( !link_ok && netif_carrier_ok(dev) ) {
/* Link Failed */
DMFE_DBUG(0, "Link Failed", tmp_cr12);
-   db->link_failed = 1;
-   netif_carrier_off(db->dev);
+   
+   netif_carrier_off(dev);
 
/* For Force 10/100M Half/Full mode: Enable Auto-Nego mode */
/* AUTO or force 1M Homerun/Longrun don't need */
@@ -1184,19 +1207,17 @@ static void dmfe_timer(unsigned long dat
db->cr6_data&=~0x0200;  /* bit9=0, HD mode */
update_cr6(db->cr6_data, db->ioaddr);
}
-   } else
-   if ((tmp_cr12 & 0x3) && db->link_failed) {
-   DMFE_DBUG(0, "Link link OK", tmp_cr12);
-   db->link_failed = 0;
+   
+   } else if (!netif_carrier_ok(dev)) {
+   
+   DMFE_DBUG(0, "Link OK", tmp_cr12);
 
/* Auto Sense Speed */
-   if ( (db->media_mode & DMFE_AUTO) &&
-   dmfe_sense_speed(db) )
-   db->link_failed = 1;
-   else
-   netif_carrier_on(db->dev);
+   if (! (db->media_mode & DMFE_AUTO) || !dmfe_sense_speed(db)) {
+   netif_carrier_on(dev)

[PATCH] [NETDEV] [004] dmfe : Add suspend/resume support

2007-02-07 Thread Levitsky Maxim
From: Maxim Levitsky <[EMAIL PROTECTED]>
Subject: [PATCH] [NETDEV] [004] dmfe : Add suspend/resume support

Adds support for suspend/resume

---


--- linux-2.6.20-mod/drivers/net/tulip/dmfe.c   2007-02-07 18:46:13.0 
+0200
+++ linux-2.6.20-test/drivers/net/tulip/dmfe.c  2007-02-07 18:50:52.0 
+0200
@@ -55,9 +55,6 @@
 
     TODO
 
-    Implement pci_driver::suspend() and pci_driver::resume()
-    power management methods.
-
     Check on 64 bit boxes.
     Check and fix on big endian boxes.
 
@@ -2027,11 +2024,59 @@ static struct pci_device_id dmfe_pci_tbl
 MODULE_DEVICE_TABLE(pci, dmfe_pci_tbl);
 
 
+
+static int dmfe_suspend(struct pci_dev *pci_dev, pm_message_t state)
+{
+    u32 tmp;
+
+    struct net_device *dev = pci_get_drvdata(pci_dev);
+    struct dmfe_board_info *db = netdev_priv(dev);
+    
+    /* Disable upper layer interface */
+    netif_device_detach(dev);
+    
+    /* Disable Tx/Rx */
+    db->cr6_data &= ~(CR6_RXSC | CR6_TXSC);
+    update_cr6(db->cr6_data, dev->base_addr);
+    
+    /* Disable Interrupt */
+    outl(0, dev->base_addr + DCR7);
+    outl(inl(dev->base_addr + DCR5), dev->base_addr + DCR5);
+    
+    /* Fre RX buffers */
+    dmfe_free_rxbuffer(db);
+
+    /* Power down device*/
+    pci_set_power_state(pci_dev ,  pci_choose_state(pci_dev,state));
+    pci_save_state(pci_dev);
+
+    return 0;
+}
+
+static int dmfe_resume(struct pci_dev *pci_dev)
+{
+    struct net_device *dev = pci_get_drvdata(pci_dev);
+    u32 tmp;
+
+    pci_restore_state(pci_dev);
+    pci_set_power_state(pci_dev ,PCI_D0);
+    
+    /* Re-initilize DM910X board */
+    dmfe_init_dm910x(dev);
+        
+    /* Restart upper layer interface */
+    netif_device_attach(dev);
+
+    return 0;
+}
+
 static struct pci_driver dmfe_driver = {
.name   = "dmfe",
.id_table   = dmfe_pci_tbl,
.probe  = dmfe_init_one,
.remove = __devexit_p(dmfe_remove_one),
+        .suspend        = dmfe_suspend,
+        .resume         = dmfe_resume
 };
 
 MODULE_AUTHOR("Sten Wang, [EMAIL PROTECTED]");



 

Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.
http://new.mail.yahoo.com
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] [NETDEV] [005] dmfe : Add support for wake-on-lan

2007-02-07 Thread Levitsky Maxim
From: Maxim Levitsky <[EMAIL PROTECTED]>
Subject: [PATCH] [NETDEV] [005] dmfe : Add support for wake-on-lan

Adds support for wake on lan feature

Signed-off-by: Maxim Levitsky <[EMAIL PROTECTED]>

---

This board supports WOL on magic packet / link change / specific packet
This adds support for WOL on magic packet / link change

Note : WOL is enabled when you suspend system ether to disk or ram, and is not 
enabled when you
turn system off


--- linux-2.6.20-mod/drivers/net/tulip/dmfe.c   2007-02-07 18:53:19.0 
+0200
+++ linux-2.6.20-test/drivers/net/tulip/dmfe.c  2007-02-07 18:55:44.0 
+0200
@@ -122,6 +122,11 @@
 #define DM9801_NOISE_FLOOR 8
 #define DM9802_NOISE_FLOOR 5
 
+#define DMFE_WOL_LINKCHANGE0x2000
+#define DMFE_WOL_SAMPLEPACKET  0x1000
+#define DMFE_WOL_MAGICPACKET   0x0800
+
+
 #define DMFE_10MHF      0
 #define DMFE_100MHF     1
 #define DMFE_10MFD      4
@@ -242,6 +247,7 @@ struct dmfe_board_info {
u8 wait_reset;  /* Hardware failed, need to reset */
u8 dm910x_chk_mode; /* Operating mode check */
u8 first_in_callback;   /* Flag to record state */
+   u8 wol_mode;/* user WOL settings */
struct timer_list timer;
 
/* System defined statistic counter */
@@ -423,6 +429,7 @@ static int __devinit dmfe_init_one (stru
db->chip_id = ent->driver_data;
db->ioaddr = pci_resource_start(pdev, 0);
db->chip_revision = dev_rev;
+   db->wol_mode = 0;
 
db->pdev = pdev;
 
@@ -1054,7 +1061,11 @@ static void dmfe_set_filter_mode(struct 
spin_unlock_irqrestore(&db->lock, flags);
 }
 
-static void netdev_get_drvinfo(struct net_device *dev,
+/*
+ * Ethtool interace 
+ */
+
+static void dmfe_ethtool_get_drvinfo(struct net_device *dev,
       struct ethtool_drvinfo *info)
 {
struct dmfe_board_info *np = netdev_priv(dev);
@@ -1068,9 +1079,35 @@ static void netdev_get_drvinfo(struct ne
dev->base_addr, dev->irq);
 }
 
+static int dmfe_ethtool_set_wol(struct net_device *dev, 
+   struct ethtool_wolinfo *wolinfo)
+{
+   struct dmfe_board_info *db = netdev_priv(dev);
+   
+   if (wolinfo->wolopts & (WAKE_UCAST | WAKE_MCAST | WAKE_BCAST | 
+       WAKE_ARP | WAKE_MAGICSECURE))
+      return -EOPNOTSUPP;
+   
+   db->wol_mode = wolinfo->wolopts;
+   return 0;
+}
+
+static void dmfe_ethtool_get_wol(struct net_device *dev, 
+    struct ethtool_wolinfo *wolinfo)
+{
+   struct dmfe_board_info *db = netdev_priv(dev);
+   
+   wolinfo->supported = WAKE_PHY | WAKE_MAGIC;
+   wolinfo->wolopts = db->wol_mode;
+   return;
+}
+
+
 static const struct ethtool_ops netdev_ethtool_ops = {
-   .get_drvinfo= netdev_get_drvinfo,
+   .get_drvinfo= dmfe_ethtool_get_drvinfo,
.get_link               = ethtool_op_get_link,
+   .set_wol= dmfe_ethtool_set_wol,
+   .get_wol= dmfe_ethtool_get_wol,
 };
 
 /*
@@ -2046,6 +2083,20 @@ static int dmfe_suspend(struct pci_dev *
     /* Fre RX buffers */
     dmfe_free_rxbuffer(db);
 
+    /* Enable WOL */
+    pci_read_config_dword(pci_dev, 0x40, &tmp);
+    tmp &= ~(WAKE_PHY|WAKE_MAGIC);
+    
+    if (db->wol_mode & WAKE_PHY)
+       tmp |= DMFE_WOL_LINKCHANGE;
+    if (db->wol_mode & WAKE_MAGIC)
+       tmp |= DMFE_WOL_MAGICPACKET;
+    
+    pci_write_config_dword(pci_dev, 0x40, tmp);
+    
+    pci_enable_wake(pci_dev, PCI_D3hot, 1);
+    pci_enable_wake(pci_dev, PCI_D3cold, 1);
+    
     /* Power down device*/
     pci_set_power_state(pci_dev ,  pci_choose_state(pci_dev,state));
     pci_save_state(pci_dev);
@@ -2064,6 +2115,15 @@ static int dmfe_resume(struct pci_dev *p
     /* Re-initilize DM910X board */
     dmfe_init_dm910x(dev);
         
+    /* Disable WOL */
+    pci_read_config_dword(pci_dev, 0x40, &tmp);
+    
+    tmp &= (DMFE_WOL_LINKCHANGE | DMFE_WOL_MAGICPACKET);
+    pci_write_config_dword(pci_dev, 0x40, tmp);
+    
+    pci_enable_wake(pci_dev, PCI_D3hot, 0);
+    pci_enable_wake(pci_dev, PCI_D3cold, 0);
+    
     /* Restart upper layer interface */
     netif_device_attach(dev);


 

Food fight? Enjoy some healthy debate 
in the Yahoo! Answers Food & Drink Q&A.
http://answers.yahoo.com/dir/?link=list&sid=396545367
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] [NETDEV] [005] dmfe : Add support for wake-on-lan [FIXED]

2007-02-07 Thread Levitsky Maxim
Hello , I just noticed a error in my patch , just a mistake , sorry please

in dmfe_resume I mixed DMFE_WOL_LINKCHANGE | DMFE_WOL_MAGICPACKET , and 
WAKE_PHY | WAKE_MAGIC

here goes updated patch:

From: Maxim Levitsky <[EMAIL PROTECTED]>
Subject: [PATCH] [NET] [005] dmfe : Add support for wake-on-lan

Adds support for wake on lan feature

Signed-off-by: Maxim Levitsky <[EMAIL PROTECTED]>

---

This board supports WOL on magic packet / link change / specific packet
This adds support for WOL on magic packet / link change

Note : WOL is enabled when you suspend system ether to disk or ram, and is not 
enabled when you
turn system off


--- linux-2.6.20-mod/drivers/net/tulip/dmfe.c   2007-02-07 18:53:19.0 
+0200
+++ linux-2.6.20-test/drivers/net/tulip/dmfe.c  2007-02-07 18:55:44.0 
+0200
@@ -122,6 +122,11 @@
 #define DM9801_NOISE_FLOOR 8
 #define DM9802_NOISE_FLOOR 5
 
+#define DMFE_WOL_LINKCHANGE0x2000
+#define DMFE_WOL_SAMPLEPACKET  0x1000
+#define DMFE_WOL_MAGICPACKET   0x0800
+
+
 #define DMFE_10MHF  0
 #define DMFE_100MHF 1
 #define DMFE_10MFD  4
@@ -242,6 +247,7 @@ struct dmfe_board_info {
u8 wait_reset;  /* Hardware failed, need to reset */
u8 dm910x_chk_mode; /* Operating mode check */
u8 first_in_callback;   /* Flag to record state */
+   u8 wol_mode;/* user WOL settings */
struct timer_list timer;
 
/* System defined statistic counter */
@@ -423,6 +429,7 @@ static int __devinit dmfe_init_one (stru
db->chip_id = ent->driver_data;
db->ioaddr = pci_resource_start(pdev, 0);
db->chip_revision = dev_rev;
+   db->wol_mode = 0;
 
db->pdev = pdev;
 
@@ -1054,7 +1061,11 @@ static void dmfe_set_filter_mode(struct 
spin_unlock_irqrestore(&db->lock, flags);
 }
 
-static void netdev_get_drvinfo(struct net_device *dev,
+/*
+ * Ethtool interace 
+ */
+
+static void dmfe_ethtool_get_drvinfo(struct net_device *dev,
   struct ethtool_drvinfo *info)
 {
struct dmfe_board_info *np = netdev_priv(dev);
@@ -1068,9 +1079,35 @@ static void netdev_get_drvinfo(struct ne
dev->base_addr, dev->irq);
 }
 
+static int dmfe_ethtool_set_wol(struct net_device *dev, 
+   struct ethtool_wolinfo *wolinfo)
+{
+   struct dmfe_board_info *db = netdev_priv(dev);
+   
+   if (wolinfo->wolopts & (WAKE_UCAST | WAKE_MCAST | WAKE_BCAST | 
+   WAKE_ARP | WAKE_MAGICSECURE))
+  return -EOPNOTSUPP;
+   
+   db->wol_mode = wolinfo->wolopts;
+   return 0;
+}
+
+static void dmfe_ethtool_get_wol(struct net_device *dev, 
+struct ethtool_wolinfo *wolinfo)
+{
+   struct dmfe_board_info *db = netdev_priv(dev);
+   
+   wolinfo->supported = WAKE_PHY | WAKE_MAGIC;
+   wolinfo->wolopts = db->wol_mode;
+   return;
+}
+
+
 static const struct ethtool_ops netdev_ethtool_ops = {
-   .get_drvinfo= netdev_get_drvinfo,
+   .get_drvinfo= dmfe_ethtool_get_drvinfo,
.get_link   = ethtool_op_get_link,
+   .set_wol= dmfe_ethtool_set_wol,
+   .get_wol= dmfe_ethtool_get_wol,
 };
 
 /*
@@ -2046,6 +2083,20 @@ static int dmfe_suspend(struct pci_dev *
 /* Fre RX buffers */
 dmfe_free_rxbuffer(db);
 
+/* Enable WOL */
+pci_read_config_dword(pci_dev, 0x40, &tmp);
+tmp &= ~(DMFE_WOL_LINKCHANGE|DMFE_WOL_MAGICPACKET);
+
+if (db->wol_mode & WAKE_PHY)
+   tmp |= DMFE_WOL_LINKCHANGE;
+if (db->wol_mode & WAKE_MAGIC)
+   tmp |= DMFE_WOL_MAGICPACKET;
+
+pci_write_config_dword(pci_dev, 0x40, tmp);
+
+pci_enable_wake(pci_dev, PCI_D3hot, 1);
+pci_enable_wake(pci_dev, PCI_D3cold, 1);
+
 /* Power down device*/
 pci_set_power_state(pci_dev ,  pci_choose_state(pci_dev,state));
 pci_save_state(pci_dev);
@@ -2064,6 +2115,15 @@ static int dmfe_resume(struct pci_dev *p
 /* Re-initilize DM910X board */
 dmfe_init_dm910x(dev);
 
+/* Disable WOL */
+pci_read_config_dword(pci_dev, 0x40, &tmp);
+
+tmp &= (DMFE_WOL_LINKCHANGE | DMFE_WOL_MAGICPACKET);
+pci_write_config_dword(pci_dev, 0x40, tmp);
+
+pci_enable_wake(pci_dev, PCI_D3hot, 0);
+pci_enable_wake(pci_dev, PCI_D3cold, 0);
+
 /* Restart upper layer interface */
 netif_device_attach(dev);
 



 

No need to miss a message. Get email on-the-go 
with Yahoo! Mail for Mobile. Get started.
http://mobile.yahoo.com/mail 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/