linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] scsi/libata: correct bug for ULi M5281
@ 2004-12-08  6:45 Clear.Zhang
  2004-12-11 19:15 ` Jeff Garzik
  0 siblings, 1 reply; 4+ messages in thread
From: Clear.Zhang @ 2004-12-08  6:45 UTC (permalink / raw)
  To: Jeff Garzik
  Cc: linux-kernel, linux-ide, andrebalsa, Peer.Chen, Emily.Jiang,
	Eric.Lo

[-- Attachment #1: Type: text/plain, Size: 7885 bytes --]


Hi, Jeff

The sata_uli patch for m5281 looks fine,but some of M5281 chip's PHY
is not stable sometime, so it need a workaround to correct the bug.

patch_M5281workaround is just for it.

The patch is applied to kernel 2.6.9. Pleases apply to new kernels, thanks
a lot.

Signed-off-by: Clear Zhang <Clear.Zhang@uli.com.tw>

Thanks                        (See attached file: patch_M5281workaround)
Clear



                                                                                                                                
                      Jeff Garzik                                                                                               
                      <jgarzik@pobox.c         收件人: Clear.Zhang@uli.com.tw                                                  
                      om>                      抄送:   Peer.Chen@uli.com.tw, Emily.Jiang@uli.com.tw, Eric.Lo@uli.com.tw        
                                               主题:   Re: [patch] net/tulip: Add support for ULi M526X                        
                      2004-11-17 05:12                                                                                          
                                                                                                                                
                                                                                                                                



The patch format looks good.  I will review and apply, thanks.

BTW, I just merged support for 5281 SATA.

The email containing this patch is attached.  This will appear in Linux
kernel 2.4.29 and 2.6.11.

Regards,

             Jeff




-----来自 Jeff Garzik <jgarzik@pobox.com> 的消息,在 Tue, 16 Nov 2004
02:21:31 -0500 -----
                                              
  收件人: linux-ide@vger.kernel.org           
                                              
    抄送: linux-kernel@vger.kernel.org        
                                              
    主题: [PATCH] ULi SATA fixes, new support 
                                              



Another one just checked into libata-dev-2.6.


 drivers/scsi/sata_uli.c |   51
+++++++++++++++++++++---------------------------
 1 files changed, 23 insertions(+), 28 deletions(-)

through these ChangeSets:

<jgarzik@pobox.com> (04/11/16 1.2169)
   [libata sata_uli] add 5281 support, fix SATA phy setup for others

   Contributed by Peer Chen @ ULi and tested by a user.

diff -Nru a/drivers/scsi/sata_uli.c b/drivers/scsi/sata_uli.c
--- a/drivers/scsi/sata_uli.c        2004-11-16 02:19:58 -05:00
+++ b/drivers/scsi/sata_uli.c        2004-11-16 02:19:58 -05:00
@@ -32,16 +32,18 @@
 #include <linux/libata.h>

 #define DRV_NAME        "sata_uli"
-#define DRV_VERSION           "0.2"
+#define DRV_VERSION           "0.5"

 enum {
             uli_5289                      = 0,
             uli_5287                      = 1,
+            uli_5281                      = 2,

             /* PCI configuration registers */
-            ULI_SCR_BASE                        = 0x90, /* sata0 phy SCR
registers */
-            ULI_SATA1_OFS                       = 0x10, /* offset from
sata0->sata1 phy regs */
-
+            ULI5287_BASE                        = 0x90, /* sata0 phy SCR
registers */
+            ULI5287_OFFS                        = 0x10, /* offset from
sata0->sata1 phy regs */
+            ULI5281_BASE                        = 0x60, /* sata0 phy SCR
registers */
+            ULI5281_OFFS                        = 0x60, /* offset from
sata0->sata1 phy regs */
 };

 static int uli_init_one (struct pci_dev *pdev, const struct pci_device_id
*ent);
@@ -51,6 +53,7 @@
 static struct pci_device_id uli_pci_tbl[] = {
             { PCI_VENDOR_ID_AL, 0x5289, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
uli_5289 },
             { PCI_VENDOR_ID_AL, 0x5287, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
uli_5287 },
+            { PCI_VENDOR_ID_AL, 0x5281, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
uli_5281 },
             { }         /* terminate list */
 };

@@ -125,33 +128,15 @@
 MODULE_DEVICE_TABLE(pci, uli_pci_tbl);
 MODULE_VERSION(DRV_VERSION);

-static unsigned int get_scr_cfg_addr(unsigned int port_no, unsigned int
sc_reg)
+static unsigned int get_scr_cfg_addr(struct ata_port *ap, unsigned int
sc_reg)
 {
-            unsigned int addr = ULI_SCR_BASE + (4 * sc_reg);
-
-            switch (port_no) {
-            case 0:
-                        break;
-            case 1:
-                        addr += ULI_SATA1_OFS;
-                        break;
-            case 2:
-                        addr += ULI_SATA1_OFS*4;
-                        break;
-            case 3:
-                        addr += ULI_SATA1_OFS*5;
-                        break;
-            default:
-                        BUG();
-                        break;
-            }
-            return addr;
+            return ap->ioaddr.scr_addr + (4 * sc_reg);
 }

 static u32 uli_scr_cfg_read (struct ata_port *ap, unsigned int sc_reg)
 {
             struct pci_dev *pdev = to_pci_dev(ap->host_set->dev);
-            unsigned int cfg_addr = get_scr_cfg_addr(ap->port_no, sc_reg);
+            unsigned int cfg_addr = get_scr_cfg_addr(ap, sc_reg);
             u32 val;

             pci_read_config_dword(pdev, cfg_addr, &val);
@@ -161,7 +146,7 @@
 static void uli_scr_cfg_write (struct ata_port *ap, unsigned int scr, u32
val)
 {
             struct pci_dev *pdev = to_pci_dev(ap->host_set->dev);
-            unsigned int cfg_addr = get_scr_cfg_addr(ap->port_no, scr);
+            unsigned int cfg_addr = get_scr_cfg_addr(ap, scr);

             pci_write_config_dword(pdev, cfg_addr, val);
 }
@@ -222,9 +207,11 @@
                         rc = -ENOMEM;
                         goto err_out_regions;
             }
-
+
             switch (board_idx) {
             case uli_5287:
+                        probe_ent->port[0].scr_addr = ULI5287_BASE;
+                        probe_ent->port[1].scr_addr = ULI5287_BASE +
ULI5287_OFFS;
                               probe_ent->n_ports = 4;

                               probe_ent->port[2].cmd_addr =
pci_resource_start(pdev, 0) + 8;
@@ -232,19 +219,27 @@
                         probe_ent->port[2].ctl_addr =
                                     (pci_resource_start(pdev, 1) |
ATA_PCI_CTL_OFS) + 4;
                         probe_ent->port[2].bmdma_addr =
pci_resource_start(pdev, 4) + 16;
+                        probe_ent->port[2].scr_addr = ULI5287_BASE +
ULI5287_OFFS*4;

                         probe_ent->port[3].cmd_addr =
pci_resource_start(pdev, 2) + 8;
                         probe_ent->port[3].altstatus_addr =
                         probe_ent->port[3].ctl_addr =
                                     (pci_resource_start(pdev, 3) |
ATA_PCI_CTL_OFS) + 4;
                         probe_ent->port[3].bmdma_addr =
pci_resource_start(pdev, 4) + 24;
+                        probe_ent->port[3].scr_addr = ULI5287_BASE +
ULI5287_OFFS*5;

                         ata_std_ports(&probe_ent->port[2]);
                         ata_std_ports(&probe_ent->port[3]);
                         break;

             case uli_5289:
-                        /* do nothing; ata_pci_init_native_mode did it all
*/
+                        probe_ent->port[0].scr_addr = ULI5287_BASE;
+                        probe_ent->port[1].scr_addr = ULI5287_BASE +
ULI5287_OFFS;
+                        break;
+
+            case uli_5281:
+                        probe_ent->port[0].scr_addr = ULI5281_BASE;
+                        probe_ent->port[1].scr_addr = ULI5281_BASE +
ULI5281_OFFS;
                         break;

             default:






[-- Attachment #2: patch_M5281workaround --]
[-- Type: application/octet-stream, Size: 11869 bytes --]

diff -uprN linux-2.6.9-vanilla/drivers/scsi/libata-core.c linux-2.6.9/drivers/scsi/libata-core.c
--- linux-2.6.9-vanilla/drivers/scsi/libata-core.c	2004-10-19 05:53:06.000000000 +0800
+++ linux-2.6.9/drivers/scsi/libata-core.c	2004-12-08 13:41:20.306537688 +0800
@@ -47,6 +47,8 @@
 
 #include "libata.h"
 
+u8 iftimeout=0;
+
 static unsigned int ata_busy_sleep (struct ata_port *ap,
 				    unsigned long tmout_pat,
 			    	    unsigned long tmout);
@@ -2421,6 +2423,9 @@ void ata_eng_timeout(struct ata_port *ap
 	struct ata_queued_cmd *qc;
 
 	DPRINTK("ENTER\n");
+	
+	//add by clear zhang 2004/12/7
+	iftimeout=1;
 
 	qc = ata_qc_from_tag(ap, ap->active_tag);
 	if (!qc) {
diff -uprN linux-2.6.9-vanilla/drivers/scsi/libata-scsi.c linux-2.6.9/drivers/scsi/libata-scsi.c
--- linux-2.6.9-vanilla/drivers/scsi/libata-scsi.c	2004-10-19 05:53:51.000000000 +0800
+++ linux-2.6.9/drivers/scsi/libata-scsi.c	2004-12-08 13:42:41.305224016 +0800
@@ -24,6 +24,7 @@
 
 #include <linux/kernel.h>
 #include <linux/blkdev.h>
+#include <linux/pci.h>
 #include <linux/spinlock.h>
 #include <scsi/scsi.h>
 #include "scsi.h"
@@ -33,6 +34,11 @@
 
 #include "libata.h"
 
+//add by clear zhang 2004/12/7
+#define print_clear(_x_) printk _x_ 
+//#define print_clear(_x_) NULL
+extern u8 iftimeout;
+
 typedef unsigned int (*ata_xlat_func_t)(struct ata_queued_cmd *qc, u8 *scsicmd);
 static void ata_scsi_simulate(struct ata_port *ap, struct ata_device *dev,
 			      struct scsi_cmnd *cmd,
@@ -622,11 +628,174 @@ static unsigned int ata_scsi_rw_xlat(str
 static int ata_scsi_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat)
 {
 	struct scsi_cmnd *cmd = qc->scsicmd;
+	
+	// add by clear zhang 2004/12/7 for ULi M5281 workaroud	
+	if(qc->ap->host_set->pdev->vendor==0x10b9 &&
+		qc->ap->host_set->pdev->device==0x5281)
+	{
+		
+		struct pci_dev *pdev_m5281=qc->ap->host_set->pdev;
+		u8 m5281_revision;
+		
+		cmd->result = SAM_STAT_GOOD;
+			              
+		pci_read_config_byte(pdev_m5281, PCI_REVISION_ID, &m5281_revision);
+		//printk("m5281_revision=0x%x\n",m5281_revision);
+		//version 0xa0,0xa1,0xb1 need workaroud	
+		if(m5281_revision==0xa0 ||m5281_revision==0xa1 ||m5281_revision==0xb1 )
+		{
+			u16 error_m5281;
+			unsigned long	scr_addr_m5281 = qc->ap->ioaddr.scr_addr;
+			
+			pci_read_config_word(pdev_m5281,scr_addr_m5281+6, &error_m5281);
+			
+			if ( unlikely(drv_stat & (ATA_ERR | ATA_BUSY | ATA_DRQ)) && iftimeout==0/*express not timeout*/)
+				ata_to_sense_error(qc, drv_stat);
+			//time out or drive status is ok			
+			else if ((error_m5281 & 0x3f8)!=0 || iftimeout==1) //the src errore present
+			{
+				u32 scr4_m5281;
+				u8  reset_m5281, stus, scr0_m5281;
+				
+				u8 kk, jj;
+              			u8 comreset=1, softreset=1;//success=0, fail=1
+		
+				printk("ULi sata error:0x%x\n",error_m5281);
+				//reset
+				// dma have been closed
+				//__save_flags(flags_m5281);
+				//__cli();
+				//com reset
+				for(kk=0;kk<20;kk++)
+				{
+					pci_read_config_byte(pdev_m5281,scr_addr_m5281+8,&reset_m5281);
+					reset_m5281 = reset_m5281 & 0xfe;
+					pci_write_config_byte(pdev_m5281,scr_addr_m5281+8,reset_m5281);
+					reset_m5281 = reset_m5281 | 0x01;
+					pci_write_config_byte(pdev_m5281,scr_addr_m5281+8,reset_m5281);		
+					
+					//delay two ms
+					mdelay(2);
+					
+					//reallert and clear erro bit
+					reset_m5281 = reset_m5281 & 0xfe;
+		        		pci_write_config_byte(pdev_m5281,scr_addr_m5281+8,reset_m5281);
+					mdelay(2);
+										
+					pci_read_config_byte(pdev_m5281,scr_addr_m5281,&scr0_m5281);
+					pci_read_config_dword(pdev_m5281,scr_addr_m5281+4,&scr4_m5281);
+					if(scr0_m5281!=0x13 ||(scr4_m5281 & 0x50000)!= 0x00050000 )
+					{
+						print_clear(("phy reset failed\n"));
+						print_clear(("scr0=0x%x\n", scr0_m5281));
+						print_clear(("scr4=0x%x\n", scr4_m5281));
+						continue;
+					}
+					else
+					{
+						//print_clear(("com reset success\n"));
+						//clear error bits
+						pci_write_config_dword(pdev_m5281,scr_addr_m5281+4,scr4_m5281);
+
+						comreset=0;//success
+						break;
+					}
+					
+				}
+				
+				if(comreset==0)
+				{
+					//stus= inb(qc->ap->ioaddr.status_addr);// get drive status 
+					jj=0;
+					do
+					{
+						mdelay(2);
+						stus= inb(qc->ap->ioaddr.status_addr);// get drive status 
+						jj++;
+						if(jj>=150)
+						{
+							break;
+						}
+					}while (stus!=0x50);
+					
+					//print_clear(("jj=0x%x\n", jj));
+										
+					if(stus!=0x50 /*&& iftimeout==1*/)
+					{
+						//print_clear(("soft reset\n"));
+						for(kk=0;kk<5;kk++)
+						{
+							outb(0x04,qc->ap->ioaddr.ctl_addr);	// set SRST 
+							mdelay(5);			// more than enough time 
+							outb(0,qc->ap->ioaddr.ctl_addr);	// clear 
+							jj=0;
+							do
+							{
+								mdelay(1);
+								stus= inb(qc->ap->ioaddr.status_addr);// get drive status 
+								jj++;
+								if(jj>=100)
+								{
+									break;
+								}
+							}while (stus!=0x50);
+
+							if(stus==0x50)
+							{
+								softreset=0;//sucess
+								break;
+							}
+							
+						}						
+				
+					}
+					if(stus==0x50)
+					{
+						softreset=0;
+					}
+					print_clear(("ULi drive status=0x%x\n",stus));
+					
+				}
+				iftimeout=0;			
+				//__restore_flags(flags_m5281);
+				
+
+				//set the command
+				//trnslate error can be done accoring to ata_to_sense_error
+						
+				if(comreset==1)
+				{
+					ata_to_sense_error(qc, 0x20);
+				}
+				else 
+				{
+					//print_clear(("to sys\n"));
+					ata_to_sense_error(qc, 0x1);	
+				}
+			}
+			else
+			{
+				cmd->result = SAM_STAT_GOOD;
+			}
 
-	if (unlikely(drv_stat & (ATA_ERR | ATA_BUSY | ATA_DRQ)))
-		ata_to_sense_error(qc, drv_stat);
+		}
+		else
+		{
+			if (unlikely(drv_stat & (ATA_ERR | ATA_BUSY | ATA_DRQ)))
+				ata_to_sense_error(qc, drv_stat);
+			else
+				cmd->result = SAM_STAT_GOOD;
+		}
+	}
+	//end add by clear zhang 2004/12/7
 	else
-		cmd->result = SAM_STAT_GOOD;
+	{
+
+		if (unlikely(drv_stat & (ATA_ERR | ATA_BUSY | ATA_DRQ)))
+			ata_to_sense_error(qc, drv_stat);
+		else
+			cmd->result = SAM_STAT_GOOD;
+	}
 
 	qc->scsidone(cmd);
 
@@ -1247,22 +1416,209 @@ void ata_scsi_badcmd(struct scsi_cmnd *c
 static int atapi_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat)
 {
 	struct scsi_cmnd *cmd = qc->scsicmd;
+	
+	// add by clear zhang 2004/12/7 for ULi M5281 workaroud	
+	if(qc->ap->host_set->pdev->vendor==0x10b9 &&
+		qc->ap->host_set->pdev->device==0x5281)
+	{
+		
+		struct pci_dev *pdev_m5281=qc->ap->host_set->pdev;
+		u8 m5281_revision;
+		
+		cmd->result = SAM_STAT_GOOD;
+			              
+		pci_read_config_byte(pdev_m5281, PCI_REVISION_ID, &m5281_revision);
+		//printk("m5281_revision=0x%x\n",m5281_revision);
+		//version 0xa0,0xa1,0xb1 need workaroud	
+		if(m5281_revision==0xa0 ||m5281_revision==0xa1 ||m5281_revision==0xb1 )
+		{
+			u16 error_m5281;
+			unsigned long	scr_addr_m5281 = qc->ap->ioaddr.scr_addr;
+			
+			pci_read_config_word(pdev_m5281,scr_addr_m5281+6, &error_m5281);
+			
+			if ( unlikely(drv_stat & (ATA_ERR | ATA_BUSY | ATA_DRQ)) && iftimeout==0/*express not timeout*/)
+				cmd->result = SAM_STAT_CHECK_CONDITION;
+			//time out or drive status is ok			
+			else if ((error_m5281 & 0x3f8)!=0 || iftimeout==1) //the src errore present
+			{
+				u32 scr4_m5281;
+				u8  reset_m5281, stus, scr0_m5281;
+				
+				u8 kk, jj;
+              			u8 comreset=1, softreset=1;//success=0, fail=1
+		
+				printk("ULi sata error:0x%x\n",error_m5281);
+				//reset
+				// dma have been closed
+				//__save_flags(flags_m5281);
+				//__cli();
+				//com reset
+				for(kk=0;kk<20;kk++)
+				{
+					pci_read_config_byte(pdev_m5281,scr_addr_m5281+8,&reset_m5281);
+					reset_m5281 = reset_m5281 & 0xfe;
+					pci_write_config_byte(pdev_m5281,scr_addr_m5281+8,reset_m5281);
+					reset_m5281 = reset_m5281 | 0x01;
+					pci_write_config_byte(pdev_m5281,scr_addr_m5281+8,reset_m5281);		
+					
+					//delay two ms
+					mdelay(2);
+					
+					//reallert and clear erro bit
+					reset_m5281 = reset_m5281 & 0xfe;
+		        		pci_write_config_byte(pdev_m5281,scr_addr_m5281+8,reset_m5281);
+					mdelay(2);
+										
+					pci_read_config_byte(pdev_m5281,scr_addr_m5281,&scr0_m5281);
+					pci_read_config_dword(pdev_m5281,scr_addr_m5281+4,&scr4_m5281);
+					if(scr0_m5281!=0x13 ||(scr4_m5281 & 0x50000)!= 0x00050000 )
+					{
+						print_clear(("phy reset failed\n"));
+						print_clear(("scr0=0x%x\n", scr0_m5281));
+						print_clear(("scr4=0x%x\n", scr4_m5281));
+						continue;
+					}
+					else
+					{
+						//print_clear(("com reset success\n"));
+						//clear error bits
+						pci_write_config_dword(pdev_m5281,scr_addr_m5281+4,scr4_m5281);
+
+						comreset=0;//success
+						break;
+					}
+					
+				}
+				
+				if(comreset==0)
+				{
+					//stus= inb(qc->ap->ioaddr.status_addr);// get drive status 
+					jj=0;
+					do
+					{
+						mdelay(2);
+						stus= inb(qc->ap->ioaddr.status_addr);// get drive status 
+						jj++;
+						if(jj>=150)
+						{
+							break;
+						}
+					}while (stus!=0x50);
+					
+					//print_clear(("jj=0x%x\n", jj));
+										
+					if(stus!=0x50 /*&& iftimeout==1*/)
+					{
+						//print_clear(("soft reset\n"));
+						for(kk=0;kk<5;kk++)
+						{
+							outb(0x04,qc->ap->ioaddr.ctl_addr);	// set SRST 
+							mdelay(5);			// more than enough time 
+							outb(0,qc->ap->ioaddr.ctl_addr);	// clear 
+							jj=0;
+							do
+							{
+								mdelay(1);
+								stus= inb(qc->ap->ioaddr.status_addr);// get drive status 
+								jj++;
+								if(jj>=100)
+								{
+									break;
+								}
+							}while (stus!=0x50);
+
+							if(stus==0x50)
+							{
+								softreset=0;//sucess
+								break;
+							}
+							
+						}						
+				
+					}
+					if(stus==0x50)
+					{
+						softreset=0;
+					}
+					print_clear(("ULi drive status=0x%x\n",stus));
+					
+				}
+				iftimeout=0;			
+				//__restore_flags(flags_m5281);
+				
+
+				//set the command
+				//trnslate error can be done accoring to ata_to_sense_error
+				cmd->result = SAM_STAT_CHECK_CONDITION;		
+				/*if(comreset==1)
+				{
+					ata_to_sense_error(qc, 0x20);
+				}
+				else 
+				{
+					//print_clear(("to sys\n"));
+					ata_to_sense_error(qc, 0x1);	
+				}*/
+			}
+			else 
+			{
+				u8 *scsicmd = cmd->cmnd;
+		
+				if (scsicmd[0] == INQUIRY) {
+					u8 *buf = NULL;
+					unsigned int buflen;
+		
+					buflen = ata_scsi_rbuf_get(cmd, &buf);
+					buf[2] = 0x5;
+					buf[3] = (buf[3] & 0xf0) | 2;
+					ata_scsi_rbuf_put(cmd);
+				}
+				cmd->result = SAM_STAT_GOOD;
+			}
 
-	if (unlikely(drv_stat & (ATA_ERR | ATA_BUSY | ATA_DRQ)))
-		cmd->result = SAM_STAT_CHECK_CONDITION;
-	else {
-		u8 *scsicmd = cmd->cmnd;
+		}
+		else
+		{
+			if (unlikely(drv_stat & (ATA_ERR | ATA_BUSY | ATA_DRQ)))
+				cmd->result = SAM_STAT_CHECK_CONDITION;
+			else {
+				u8 *scsicmd = cmd->cmnd;
+		
+				if (scsicmd[0] == INQUIRY) {
+					u8 *buf = NULL;
+					unsigned int buflen;
+		
+					buflen = ata_scsi_rbuf_get(cmd, &buf);
+					buf[2] = 0x5;
+					buf[3] = (buf[3] & 0xf0) | 2;
+					ata_scsi_rbuf_put(cmd);
+				}
+				cmd->result = SAM_STAT_GOOD;
+			}
+		}
+	}
+	//end add by clear zhang 2004/12/7
+	
+	else
+	{
 
-		if (scsicmd[0] == INQUIRY) {
-			u8 *buf = NULL;
-			unsigned int buflen;
-
-			buflen = ata_scsi_rbuf_get(cmd, &buf);
-			buf[2] = 0x5;
-			buf[3] = (buf[3] & 0xf0) | 2;
-			ata_scsi_rbuf_put(cmd);
+		if (unlikely(drv_stat & (ATA_ERR | ATA_BUSY | ATA_DRQ)))
+			cmd->result = SAM_STAT_CHECK_CONDITION;
+		else {
+			u8 *scsicmd = cmd->cmnd;
+	
+			if (scsicmd[0] == INQUIRY) {
+				u8 *buf = NULL;
+				unsigned int buflen;
+	
+				buflen = ata_scsi_rbuf_get(cmd, &buf);
+				buf[2] = 0x5;
+				buf[3] = (buf[3] & 0xf0) | 2;
+				ata_scsi_rbuf_put(cmd);
+			}
+			cmd->result = SAM_STAT_GOOD;
 		}
-		cmd->result = SAM_STAT_GOOD;
 	}
 
 	qc->scsidone(cmd);

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch] scsi/libata: correct bug for ULi M5281
  2004-12-08  6:45 Clear.Zhang
@ 2004-12-11 19:15 ` Jeff Garzik
  0 siblings, 0 replies; 4+ messages in thread
From: Jeff Garzik @ 2004-12-11 19:15 UTC (permalink / raw)
  To: Clear.Zhang
  Cc: linux-kernel, linux-ide, andrebalsa, Peer.Chen, Emily.Jiang,
	Eric.Lo

Clear.Zhang@uli.com.tw wrote:
> Hi, Jeff
> 
> The sata_uli patch for m5281 looks fine,but some of M5281 chip's PHY
> is not stable sometime, so it need a workaround to correct the bug.
> 
> patch_M5281workaround is just for it.
> 
> The patch is applied to kernel 2.6.9. Pleases apply to new kernels, thanks
> a lot.
> 
> Signed-off-by: Clear Zhang <Clear.Zhang@uli.com.tw>

I'm afraid I must reject this patch.  We do not wish to put
hardware-specific workarounds in libata-core.c or libata-scsi.c.

I would suggest either
(a) finding a way to add the workaround to sata_uli.c, or
(b) finding the "root cause" of the problem, and determine why the
libata code is insufficient.

Two suggestions I have while investigating your problem:
1) Replacing the ->phy_reset() hook may allow you to solve the problem
in sata_uli.c.
2) It is entirely possible that we need to add additional error handling
code to libata, including hooks back into the low-level driver (such as
sata_uli.c).

Regards,

	Jeff



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch] scsi/libata: correct bug for ULi M5281
       [not found] <OF72031848.8565651F-ON48256F6A.0025361E@uli.com.tw>
@ 2005-02-06  4:43 ` Jeff Garzik
  0 siblings, 0 replies; 4+ messages in thread
From: Jeff Garzik @ 2005-02-06  4:43 UTC (permalink / raw)
  To: Clear.Zhang
  Cc: linux-kernel, linux-ide, andrebalsa, Peer.Chen, Emily.Jiang,
	Eric.Lo

Clear.Zhang@uli.com.tw wrote:
> Hi Jeff,
> 
> I've correct the patch according to your suggestion.
> But we need libata-core.c to export some functions.
> Here is the patch. Please check it and apply it to new kernels.
> Thanks a lot.


I'm afraid I cannot accept even the updated version of your patch.

Your second patch updates libata-core, and adds ULi-specific code to it.

What we need to do is

1) determine if your problem is ULi-specific, or applies to other
controllers

2a) If the problem is not ULi-specific, simply update libata to new
behavior.

2b) If the problem is ULi-specific, libata must be modified such that
all ULi-specific reset procedures are in sata_uli.c, and _no code is
duplicated from libata_.  This may require that we change the libata
API.  In Linux, it is OK to change the driver API when there is a problem :)

Regards,

	Jeff



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch] scsi/libata: correct bug for ULi M5281
       [not found] <OF934C846F.FCC47C36-ON48256FA0.0024A886@uli.com.tw>
@ 2005-02-06  7:08 ` Jeff Garzik
  0 siblings, 0 replies; 4+ messages in thread
From: Jeff Garzik @ 2005-02-06  7:08 UTC (permalink / raw)
  To: Peer.Chen; +Cc: Clear.Zhang, linux-kernel, linux-ide, Emily.Jiang, Eric.Lo

Peer.Chen@uli.com.tw wrote:
> Hi,Jeff:
> We didn't add the ULi-specific code to libata-core,just export some
> functions of it,is it ok?
> The problem is ULi-specific,so the reset procedures must be in sata_uli.c.

OK, thanks for explaining.

We still have the problem that code is duplicated from libata-scsi.c,
unless I am missing the latest patch from ULi?

	Jeff




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-02-06  7:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <OF934C846F.FCC47C36-ON48256FA0.0024A886@uli.com.tw>
2005-02-06  7:08 ` [patch] scsi/libata: correct bug for ULi M5281 Jeff Garzik
     [not found] <OF72031848.8565651F-ON48256F6A.0025361E@uli.com.tw>
2005-02-06  4:43 ` Jeff Garzik
2004-12-08  6:45 Clear.Zhang
2004-12-11 19:15 ` Jeff Garzik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).