[PATCH 2/4] libata-core.c: add low-level I/O calls

2007-01-12 Thread Akira Iguchi
Using low-level I/O calls, similar functions
(ex: ata_pio_devchk() and ata_mmio_devchk()) can be merged.
And some branches which check MMIO/PIO flag can be removed.
The idea comes from drivers/ide IN*/OUT* calls.

By default, depending on the flag, default_pio_ops or default_mmio_ops
are used as low-level I/O calls. If your device needs special I/O calls
(ex: 32bit access in Celleb), you must initialize .io_ops in ata_port_info
and pass it to appropriate initialization functions (ex: ata_pci_init_one()).

Signed-off-by: Kou Ishizaki [EMAIL PROTECTED]
Signed-off-by: Akira Iguchi [EMAIL PROTECTED]
---

--- linux-2.6.20-rc4/drivers/ata/libata-core.c.orig 2007-01-13 
01:01:50.0 +0900
+++ linux-2.6.20-rc4/drivers/ata/libata-core.c  2007-01-13 01:02:58.0 
+0900
@@ -598,51 +598,7 @@ void ata_dev_disable(struct ata_device *
 }
 
 /**
- * ata_pio_devchk - PATA device presence detection
- * @ap: ATA channel to examine
- * @device: Device to examine (starting at zero)
- *
- * This technique was originally described in
- * Hale Landis's ATADRVR (www.ata-atapi.com), and
- * later found its way into the ATA/ATAPI spec.
- *
- * Write a pattern to the ATA shadow registers,
- * and if a device is present, it will respond by
- * correctly storing and echoing back the
- * ATA shadow register contents.
- *
- * LOCKING:
- * caller.
- */
-
-static unsigned int ata_pio_devchk(struct ata_port *ap,
-  unsigned int device)
-{
-   struct ata_ioports *ioaddr = ap-ioaddr;
-   u8 nsect, lbal;
-
-   ap-ops-dev_select(ap, device);
-
-   outb(0x55, ioaddr-nsect_addr);
-   outb(0xaa, ioaddr-lbal_addr);
-
-   outb(0xaa, ioaddr-nsect_addr);
-   outb(0x55, ioaddr-lbal_addr);
-
-   outb(0x55, ioaddr-nsect_addr);
-   outb(0xaa, ioaddr-lbal_addr);
-
-   nsect = inb(ioaddr-nsect_addr);
-   lbal = inb(ioaddr-lbal_addr);
-
-   if ((nsect == 0x55)  (lbal == 0xaa))
-   return 1;   /* we found a device */
-
-   return 0;   /* nothing found */
-}
-
-/**
- * ata_mmio_devchk - PATA device presence detection
+ * ata_devchk - PATA device presence detection
  * @ap: ATA channel to examine
  * @device: Device to examine (starting at zero)
  *
@@ -659,7 +615,7 @@ static unsigned int ata_pio_devchk(struc
  * caller.
  */
 
-static unsigned int ata_mmio_devchk(struct ata_port *ap,
+static unsigned int ata_devchk(struct ata_port *ap,
unsigned int device)
 {
struct ata_ioports *ioaddr = ap-ioaddr;
@@ -667,17 +623,17 @@ static unsigned int ata_mmio_devchk(stru
 
ap-ops-dev_select(ap, device);
 
-   writeb(0x55, (void __iomem *) ioaddr-nsect_addr);
-   writeb(0xaa, (void __iomem *) ioaddr-lbal_addr);
+   ap-io_ops-OUTB(0x55, ioaddr-nsect_addr);
+   ap-io_ops-OUTB(0xaa, ioaddr-lbal_addr);
 
-   writeb(0xaa, (void __iomem *) ioaddr-nsect_addr);
-   writeb(0x55, (void __iomem *) ioaddr-lbal_addr);
+   ap-io_ops-OUTB(0xaa, ioaddr-nsect_addr);
+   ap-io_ops-OUTB(0x55, ioaddr-lbal_addr);
 
-   writeb(0x55, (void __iomem *) ioaddr-nsect_addr);
-   writeb(0xaa, (void __iomem *) ioaddr-lbal_addr);
+   ap-io_ops-OUTB(0x55, ioaddr-nsect_addr);
+   ap-io_ops-OUTB(0xaa, ioaddr-lbal_addr);
 
-   nsect = readb((void __iomem *) ioaddr-nsect_addr);
-   lbal = readb((void __iomem *) ioaddr-lbal_addr);
+   nsect = ap-io_ops-INB(ioaddr-nsect_addr);
+   lbal = ap-io_ops-INB(ioaddr-lbal_addr);
 
if ((nsect == 0x55)  (lbal == 0xaa))
return 1;   /* we found a device */
@@ -686,27 +642,6 @@ static unsigned int ata_mmio_devchk(stru
 }
 
 /**
- * ata_devchk - PATA device presence detection
- * @ap: ATA channel to examine
- * @device: Device to examine (starting at zero)
- *
- * Dispatch ATA device presence detection, depending
- * on whether we are using PIO or MMIO to talk to the
- * ATA shadow registers.
- *
- * LOCKING:
- * caller.
- */
-
-static unsigned int ata_devchk(struct ata_port *ap,
-   unsigned int device)
-{
-   if (ap-flags  ATA_FLAG_MMIO)
-   return ata_mmio_devchk(ap, device);
-   return ata_pio_devchk(ap, device);
-}
-
-/**
  * ata_dev_classify - determine device type based on ATA-spec signature
  * @tf: ATA taskfile register set for device to be identified
  *
@@ -923,11 +858,7 @@ void ata_std_dev_select (struct ata_port
else
tmp = ATA_DEVICE_OBS | ATA_DEV1;
 
-   if (ap-flags  ATA_FLAG_MMIO) {
-   writeb(tmp, (void __iomem *) ap-ioaddr.device_addr);
-   } else {
-   outb(tmp, ap-ioaddr.device_addr);
-   }
+   ap-io_ops-OUTB(tmp, ap-ioaddr.device_addr);
ata_pause(ap);  /* needed; also flushes, for mmio */
 }
 
@@ -2623,13 +2554,8 @@ static void 

[PATCH 4/4] drivers/ata: PATA driver for Celleb

2007-01-12 Thread Akira Iguchi
This patch adds kernel configuration and driver code
for Celleb.

Because this PATA controller supports only 32bit access,
this driver define low-level calls in ata_io_operations.

Signed-off-by: Kou Ishizaki [EMAIL PROTECTED]
Signed-off-by: Akira Iguchi [EMAIL PROTECTED]
---

--- linux-2.6.20-rc4/drivers/ata/Kconfig.orig   2007-01-13 01:01:34.0 
+0900
+++ linux-2.6.20-rc4/drivers/ata/Kconfig2007-01-13 01:02:44.0 
+0900
@@ -518,6 +518,15 @@ config PATA_IXP4XX_CF
 
  If unsure, say N.
 
+config PATA_SCC
+tristate Toshiba's Cell Reference Set IDE support
+depends on PCI
+help
+  This option enables support for the built-in IDE controller on
+  Toshiba Cell Reference Board.
+
+  If unsure, say N.
+
 endif
 endmenu
 
--- linux-2.6.20-rc4/drivers/ata/Makefile.orig  2007-01-13 01:01:38.0 
+0900
+++ linux-2.6.20-rc4/drivers/ata/Makefile   2007-01-13 01:02:50.0 
+0900
@@ -56,6 +56,7 @@ obj-$(CONFIG_PATA_WINBOND_VLB)+= pata_w
 obj-$(CONFIG_PATA_SIS) += pata_sis.o
 obj-$(CONFIG_PATA_TRIFLEX) += pata_triflex.o
 obj-$(CONFIG_PATA_IXP4XX_CF)   += pata_ixp4xx_cf.o
+obj-$(CONFIG_PATA_SCC) += pata_scc.o
 obj-$(CONFIG_PATA_PLATFORM)+= pata_platform.o
 # Should be last but one libata driver
 obj-$(CONFIG_ATA_GENERIC)  += ata_generic.o
--- linux-2.6.20-rc4/drivers/ata/pata_scc.c.orig2007-01-13 
01:02:11.0 +0900
+++ linux-2.6.20-rc4/drivers/ata/pata_scc.c 2007-01-13 01:50:04.0 
+0900
@@ -0,0 +1,1141 @@
+/*
+ * Support for IDE interfaces on Celleb platform
+ *
+ * (C) Copyright 2006 TOSHIBA CORPORATION
+ *
+ * This code is based on drivers/ata/ata_piix.c:
+ *  Copyright 2003-2005 Red Hat Inc
+ *  Copyright 2003-2005 Jeff Garzik
+ *  Copyright (C) 1998-1999 Andrzej Krzysztofowicz, Author and Maintainer
+ *  Copyright (C) 1998-2000 Andre Hedrick [EMAIL PROTECTED]
+ *  Copyright (C) 2003 Red Hat Inc [EMAIL PROTECTED]
+ *
+ * and drivers/ata/libata-core.c:
+ *  Copyright 2003-2004 Red Hat, Inc.  All rights reserved.
+ *  Copyright 2003-2004 Jeff Garzik
+ *
+ * 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.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include linux/kernel.h
+#include linux/module.h
+#include linux/pci.h
+#include linux/init.h
+#include linux/blkdev.h
+#include linux/delay.h
+#include linux/device.h
+#include scsi/scsi_host.h
+#include linux/libata.h
+
+#define DRV_NAME   ata_scc
+#define DRV_VERSION0.1
+
+#define PCI_DEVICE_ID_TOSHIBA_SCC_ATA  0x01b4
+
+/* offset of CTRL registers */
+#define SCC_CTL_PIOSHT 0x000
+#define SCC_CTL_PIOCT  0x004
+#define SCC_CTL_MDMACT 0x008
+#define SCC_CTL_MCRCST 0x00C
+#define SCC_CTL_SDMACT 0x010
+#define SCC_CTL_SCRCST 0x014
+#define SCC_CTL_UDENVT 0x018
+#define SCC_CTL_TDVHSEL0x020
+#define SCC_CTL_MODEREG0x024
+#define SCC_CTL_ECMODE 0xF00
+#define SCC_CTL_MAEA0  0xF50
+#define SCC_CTL_MAEC0  0xF54
+#define SCC_CTL_CCKCTRL0xFF0
+
+/* offset of BMID registers */
+#define SCC_DMA_CMD0x000
+#define SCC_DMA_STATUS 0x004
+#define SCC_DMA_TABLE_OFS  0x008
+#define SCC_DMA_INTMASK0x010
+#define SCC_DMA_INTST  0x014
+#define SCC_DMA_PTERADD0x018
+#define SCC_REG_CMD_ADDR   0x020
+#define SCC_REG_DATA   0x000
+#define SCC_REG_ERR0x004
+#define SCC_REG_FEATURE0x004
+#define SCC_REG_NSECT  0x008
+#define SCC_REG_LBAL   0x00C
+#define SCC_REG_LBAM   0x010
+#define SCC_REG_LBAH   0x014
+#define SCC_REG_DEVICE 0x018
+#define SCC_REG_STATUS 0x01C
+#define SCC_REG_CMD0x01C
+#define SCC_REG_ALTSTATUS  0x020
+
+/* register value */
+#define TDVHSEL_MASTER 0x0001
+#define TDVHSEL_SLAVE  0x0004
+
+#define MODE_JCUSFEN   0x0080
+
+#define ECMODE_VALUE   0x01
+
+#define CCKCTRL_ATARESET   0x0004
+#define CCKCTRL_BUFCNT 0x0002
+#define CCKCTRL_CRST   0x0001
+#define CCKCTRL_OCLKEN 0x0100
+#define CCKCTRL_ATACLKOEN  0x0002
+#define CCKCTRL_LCLKEN 0x0001
+
+#define QCHCD_IOS_SS 

Re: [PATCH 0/4] drivers/ata: add low-level I/O calls

2007-01-12 Thread Benjamin Herrenschmidt
On Fri, 2007-01-12 at 10:24 +, Alan wrote:
 On Fri, 12 Jan 2007 19:00:45 +0900
 Akira Iguchi [EMAIL PROTECTED] wrote:
 
  Dear everyone,
  
  This is the patchset (based on 2.6.20-rc4) to add low-level I/O calls
  which access the taskfile registers. The idea comes from drivers/ide
  IN*/OUT* calls.
 
 I think this is the wrong approach. The existing code provides methods
 for things like read the status, write a taskfile and this is the
 style that should be kept.

I agree (Sorry Akira-san for the added work !), I've looked a bit and I
think that what we need is mainly an accessor for the control register
and for the LBA, and an ack for dmdma. It's unclear to me wether the
full taskfile access would be a good way to do the later though, I'm a
bit worried some HW might get upset if not accessing strictly only the
right registers (we all know how touchy those IDE controllers can be).

That would give us something like:

 - bmdma_irq_ack
 - dev_ctrl_read/write (unless we want to split that but there are
   quite a few different accesses so maybe not)
 - dev_sig read/write (read/write nsect/lbal, or maybe we want to let
drivers do their own post_reset)

I think that's it, unless I missd something. 'special' drivers can still
replace bmdma_start/stop etc..

That's just a very quick look, I might have missed something.

Ben.
 



-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/4] drivers/ata: add low-level I/O calls

2007-01-12 Thread Jeff Garzik

Akira Iguchi wrote:

Dear everyone,

This is the patchset (based on 2.6.20-rc4) to add low-level I/O calls
which access the taskfile registers. The idea comes from drivers/ide
IN*/OUT* calls.

As you know, these calls are unnecessary for most libata drivers.
But the Celleb PATA driver needs them to use the libata common code.
And using these calls, it is possible to remove similar code
about PIO/MMIO access.


Sorry, but NAK.

libata intentionally provides higher level hooks than just I/O accessors.

A low level I/O hook approach makes it difficult to take into account 
platform-specific details like mmiowb(), especially on embedded platforms.


The high level hook approach also enables greater efficiency.  For 
example, an embedded platform could do


__raw_writeb(datum, mmio_address + ATA_REG_FOO);
__raw_writeb(datum, mmio_address + ATA_REG_BAR);
eieio();

to optimize an entire taskfile-read or taskfile-write operation.

Jeff



-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Norco DS-1220 (sil3726+sil3124) / libata-tj bug report

2007-01-12 Thread Brad Fitzpatrick
Tejun,

On Mon, 8 Jan 2007, Tejun Heo wrote:

  Disks in DS-1220 show up, kinda, but don't work.  Errors reading /
  writing blocks.  Tried a single disk in both a PMP port and a direct
  (non-sil3726) port.

 From full dmesg...

 The following is when the drive is attached via PMP.

 18:29:55 ata3.01: (irq_stat 0x00020002, device error via D2H FIS)
 18:29:55 ata3.01: tag 0 cmd 0xc8 Emask 0x1 stat 0x50 err 0x0 (device error)

 And directly.

 19:30:23 ata6.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0
 19:30:23 ata6.00: (irq_stat 0x00060002, device error via D2H FIS)
 19:30:23 ata6.00: tag 0 cmd 0xc4 Emask 0x1 stat 0x50 err 0x0 (device error)
 19:30:23 ata6: EH complete

 Looks like a dead drive to me.  Care to post the result of 'smartctl -d
 ata -a /dev/sdX' and test other drives?

I tried another disk (but of the same type), and got the same results both
direct and via PMP.

Are these disks too old to be hot-plugged?  (but I recall the
identical errors happening on boot after I power-cycled the enclosure
and the host...)

Smartctl says:

smartctl -d ata -a /dev/sdd
smartctl version 5.34 [i686-pc-linux-gnu] Copyright (C) 2002-5 Bruce Allen
Home page is http://smartmontools.sourceforge.net/

=== START OF INFORMATION SECTION ===
Model Family: Western Digital Caviar SE (Serial ATA) family
Device Model: WDC WD2500JD-00GBB0
Serial Number:WD-WMAEP2562042
Firmware Version: 02.05D02
User Capacity:250,059,350,016 bytes
Device is:In smartctl database [for details use: -P show]
ATA Version is:   6
ATA Standard is:  Exact ATA specification draft version not indicated
Local Time is:Tue Jan  9 09:24:43 2007 PST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

General SMART Values:
Offline data collection status:  (0x82) Offline data collection activity
was completed without error.
Auto Offline Data Collection: Enabled.
Self-test execution status:  (   0) The previous self-test routine completed
without error or no self-test has ever
been run.
Total time to complete Offline
data collection: (7599) seconds.
Offline data collection
capabilities:(0x79) SMART execute Offline immediate.
No Auto Offline data collection support.
Suspend Offline collection upon new
command.
Offline surface scan supported.
Self-test supported.
Conveyance Self-test supported.
Selective Self-test supported.
SMART capabilities:(0x0003) Saves SMART data before entering
power-saving mode.
Supports SMART auto save timer.
Error logging capability:(0x01) Error logging supported.
No General Purpose Logging support.
Short self-test routine
recommended polling time:(   2) minutes.
Extended self-test routine
recommended polling time:(  95) minutes.
Conveyance self-test routine
recommended polling time:(   5) minutes.

SMART Attributes Data Structure revision number: 16
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME  FLAG VALUE WORST THRESH TYPE  UPDATED  
WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate 0x000b   200   200   051Pre-fail  Always   
-   0
  3 Spin_Up_Time0x0007   120   116   021Pre-fail  Always   
-   4533
  4 Start_Stop_Count0x0032   100   100   040Old_age   Always   
-   36
  5 Reallocated_Sector_Ct   0x0033   200   200   140Pre-fail  Always   
-   0
  7 Seek_Error_Rate 0x000b   200   200   051Pre-fail  Always   
-   0
  9 Power_On_Hours  0x0032   081   081   000Old_age   Always   
-   14040
 10 Spin_Retry_Count0x0013   100   253   051Pre-fail  Always   
-   0
 11 Calibration_Retry_Count 0x0013   100   253   051Pre-fail  Always   
-   0
 12 Power_Cycle_Count   0x0032   100   100   000Old_age   Always   
-   36
194 Temperature_Celsius 0x0022   121   253   000Old_age   Always   
-   29
196 Reallocated_Event_Count 0x0032   200   200   000Old_age   Always   
-   0
197 Current_Pending_Sector  0x0012   200   200   000Old_age   Always   
-   0
198 Offline_Uncorrectable   0x0012   200   200   000Old_age   Always   
-   0
199 UDMA_CRC_Error_Count0x000a   200   200   000Old_age   Always   
-  

Re: [2.6.18,19] SATA boot problems (ICH6/ICH6W)

2007-01-12 Thread Tejun Heo
Kovid Goyal wrote:
 ata3: SATA max UDMA/133 cmd 0xFE00 ctl 0xFE12 bmdma 0xFEA0 irq 17
 ata4: SATA max UDMA/133 cmd 0xFE20 ctl 0xFE32 bmdma 0xFEA8 irq 17
 scsi2 : ata_piix
 scsi3 : ata_piix

Hmmm... ata3.00 was /dev/sda1.  Presence testing seems to have failed.
Please give a shot at 2.6.20-rc4.  We dropped whole presence detection
thing and went back to polling IDENTIFY and that fixed a lot of
detection bugs.  I think your problem is one of those.

Thanks.

-- 
tejun
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: ICH6-M libata disk timeouts 2.6.18 - 2.6.19

2007-01-12 Thread Tejun Heo
Mike Accetta wrote:
 Here's a bit more information on these timeouts.  I noticed a mention
 of changing the command queue depth in a recent lkml post and decided
 to give that a whirl.
 
 This problem seems to be related to the depth of the queue.  When I
 set the value for /sys/block/sdb/device/queue_depth to 4 the raid1
 re-sync completes without incident.  When set to 5 it eventually gives
 the timeout error message (although at well past 50% of the re-sync).
 The problem was originally observed with the default setting (31).

Please post the result of 'hdparm -I /dev/sdb'.  Thanks.

-- 
tejun
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 19/19] ide: use PIO/MMIO operations directly where possible

2007-01-12 Thread Alan
On Fri, 12 Jan 2007 05:28:07 +0100
Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] wrote:

 [PATCH] ide: use PIO/MMIO operations directly where possible
 
 This results in smaller/faster/simpler code and allows future optimizations.
 Also remove no longer needed ide[_mm]_{inl,outl}() and ide_hwif_t.{INL,OUTL}.
 
 Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]

 --- a.orig/drivers/ide/ide-dma.c
 +++ a/drivers/ide/ide-dma.c
 @@ -565,7 +565,10 @@ int ide_dma_setup(ide_drive_t *drive)
   }
  
   /* PRD table */
 - hwif-OUTL(hwif-dmatable_dma, hwif-dma_prdtable);
 + if (hwif-mmio == 2)
 + writel(hwif-dmatable_dma, (void __iomem *)hwif-dma_prdtable);
 + else
 + outl(hwif-dmatable_dma, hwif-dma_prdtable);


This should simply be if (hwif-mmio)

mmio = 1 is still used by some amiga and other oddments and indicates
mmio in old form. I don't think this causes a bug as they don't use the
DMA layer, but its a bug waiting to happen if the mmio==1 case doesn't
get handled correctly or BUG()

Alan
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 18/19] ide: add ide_use_fast_pio() helper

2007-01-12 Thread Alan
On Fri, 12 Jan 2007 05:28:00 +0100
Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] wrote:

 [PATCH] ide: add ide_use_fast_pio() helper
 
 * add ide_use_fast_pio() helper for use by host drivers
 * add DMA capability and autodma checks to ide_use_dma()
   - au1xxx-ide/it8213/it821x drivers didn't check for (id-capability  1)

For the IT8211/2 in SMART this check shouldn't be made.

   - ide-cris driver didn't set -autodma

You've changed the behaviour there. Should the default be autodma=0 ?

-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/19] new IDE quilt tree

2007-01-12 Thread Alan
Generally looks very good - couple of odd items I noticed I've send
replies about. Good to have someone working on the old IDE code again.

Alan
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 18/19] ide: add ide_use_fast_pio() helper

2007-01-12 Thread Bartlomiej Zolnierkiewicz

On 1/12/07, Alan [EMAIL PROTECTED] wrote:

On Fri, 12 Jan 2007 05:28:00 +0100
Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] wrote:

 [PATCH] ide: add ide_use_fast_pio() helper

 * add ide_use_fast_pio() helper for use by host drivers
 * add DMA capability and autodma checks to ide_use_dma()
   - au1xxx-ide/it8213/it821x drivers didn't check for (id-capability  1)

For the IT8211/2 in SMART this check shouldn't be made.


It is OK since in it821x_fixups() we set it explicitly:

if(strstr(id-model, Integrated Technology Express)) {
/* In raid mode the ident block is slightly buggy
   We need to set the bits so that the IDE layer knows
   LBA28. LBA48 and DMA ar valid */
id-capability |= 3; /* LBA28, DMA */

and we are better off using generic helper if we can
(which may later allow us to use generic tuning code).


   - ide-cris driver didn't set -autodma

You've changed the behaviour there. Should the default be autodma=0 ?


Before my patch hwif-autodma was only checked in the chipset specific
hwif-ide_dma_check implementations.  For ide-cris it is
cris_dma_check()
function so there no behavior change here.

Sorry for not explaining changes in detail in the patch description
(I will update it).

Bart
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 19/19] ide: use PIO/MMIO operations directly where possible

2007-01-12 Thread Bartlomiej Zolnierkiewicz

On 1/12/07, Alan [EMAIL PROTECTED] wrote:

On Fri, 12 Jan 2007 05:28:07 +0100
Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] wrote:

 [PATCH] ide: use PIO/MMIO operations directly where possible

 This results in smaller/faster/simpler code and allows future optimizations.
 Also remove no longer needed ide[_mm]_{inl,outl}() and ide_hwif_t.{INL,OUTL}.

 Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]

 --- a.orig/drivers/ide/ide-dma.c
 +++ a/drivers/ide/ide-dma.c
 @@ -565,7 +565,10 @@ int ide_dma_setup(ide_drive_t *drive)
   }

   /* PRD table */
 - hwif-OUTL(hwif-dmatable_dma, hwif-dma_prdtable);
 + if (hwif-mmio == 2)
 + writel(hwif-dmatable_dma, (void __iomem *)hwif-dma_prdtable);
 + else
 + outl(hwif-dmatable_dma, hwif-dma_prdtable);


This should simply be if (hwif-mmio)

mmio = 1 is still used by some amiga and other oddments and indicates
mmio in old form. I don't think this causes a bug as they don't use the
DMA layer, but its a bug waiting to happen if the mmio==1 case doesn't
get handled correctly or BUG()


mmio = 1 isn't used in the current IDE code and we have BUG_ON()
for it in ide.c:ide_hwif_request_regions() so the above change is safe.

Anyway thanks for bringing mmio = 1 issue - it can be converted
to flag now (will let us avoid similar confusions in the future).

Bart
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 18/19] ide: add ide_use_fast_pio() helper

2007-01-12 Thread Bartlomiej Zolnierkiewicz

On 1/12/07, Alan [EMAIL PROTECTED] wrote:

   if(strstr(id-model, Integrated Technology Express)) {
   /* In raid mode the ident block is slightly buggy
  We need to set the bits so that the IDE layer knows
  LBA28. LBA48 and DMA ar valid */
   id-capability |= 3;/* LBA28, DMA */

 and we are better off using generic helper if we can
 (which may later allow us to use generic tuning code).

IT8212 in smart mode has no tuning at all, the real modes are hidden by
the controller. Some firmware versions don't seem to be like being fed
set features commands either hence the total lack of tuning.


[ The discussed ide: add ide_use_fast_pio() helper patch doesn't fix it
 but it doesn't break anything either (it doesn't change the current
behavior). ]

It seems that it821x_tune_chipset() is buggy since it sends SET FEATURES
command even when in smart mode.  Shouldn't there be don't tune flag
in it812x_fixups() to tell it821x_tune_chipset() to not send SET FEATURES
commands?

Bart
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 18/19] ide: add ide_use_fast_pio() helper

2007-01-12 Thread Alan
 It seems that it821x_tune_chipset() is buggy since it sends SET FEATURES
 command even when in smart mode.  Shouldn't there be don't tune flag
 in it812x_fixups() to tell it821x_tune_chipset() to not send SET FEATURES
 commands?

It's itdev-smart but falls through to ide_config_drive_speed while it
should probably just copy bits of the code from it. Thats all fixed in
the libata driver which allows chip specific mode setup.

-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 18/19] ide: add ide_use_fast_pio() helper

2007-01-12 Thread Bartlomiej Zolnierkiewicz

On 1/12/07, Alan [EMAIL PROTECTED] wrote:

 It seems that it821x_tune_chipset() is buggy since it sends SET FEATURES
 command even when in smart mode.  Shouldn't there be don't tune flag
 in it812x_fixups() to tell it821x_tune_chipset() to not send SET FEATURES
 commands?

It's itdev-smart but falls through to ide_config_drive_speed while it
should probably just copy bits of the code from it. Thats all fixed in
the libata driver which allows chip specific mode setup.


ide_config_drive_speed() does the following things:
1. disables host DMA
2. sends SET FEATURES command (in polling mode)
3. re-enables host DMA (only if DMA mode was set)
4. updates drive-id-dma_{ultra,mword,1word}
5. updates drive-{current,init}_speed

1. and 2. should really go to higher layers
3. obviously shouldn't be done for itdev-smart
4. also shouldn't be done for itdevsmart
  (we are not changing speed mode)
5. should be done once outside of it821x_tune_chipset()

Therefore current TODO looks like:
* moving DMA fiddling code out of ide_config_drive_speed()
* setting drive-{current,init} speed in it821x_fixups()
* fixing it821x not to call ide_config_drive_speed() for itdev-smart

Fixing user space generated requests requires more work
(i.e. adding -set_mode method)...

I'll try to cook up some patches later unless somebody beats me to it.

Thanks,
Bart
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: ahci_softreset prevents acpi_power_off

2007-01-12 Thread Tejun Heo
Hello,

Faik Uygur wrote:
 We have a Sony PCG-6H1M laptop. It started failing to poweroff with our 
 switch 
 from 2.6.16 stable series kernels to 2.6.18 stable series. Rebooting works.
 
 While searching for the cause, I have found these reported bug reports in the 
 kernel bugzilla which may be related to this bug:
 
 http://bugzilla.kernel.org/show_bug.cgi?id=6982
 http://bugzilla.kernel.org/show_bug.cgi?id=7447

Seems mostly unrelated.

 According to git bisect, this is the first bad commit:
 
 4658f79bec0b51222e769e328c2923f39f3bda77 is first bad commit
 commit 4658f79bec0b51222e769e328c2923f39f3bda77
 Author: Tejun Heo [EMAIL PROTECTED]
 Date:   Wed Mar 22 21:07:03 2006 +0900
 
 [PATCH] ahci: add softreset
 
 Now that libata is smart enought to handle both soft and hard resets,
 add softreset method.
 
 Signed-off-by: Tejun Heo [EMAIL PROTECTED]
 Signed-off-by: Jeff Garzik [EMAIL PROTECTED]
 
 :04 04 ba0a16d0ef82b6577bb61cfb18e6d9df9ee0984e 
 d0fc78d8f9bbe238f98ac8964562a33e64b30605 M  drivers
 
 With v2.6.20-rc4 from git, it is still failing to poweroff. By not compiling 
 CONFIG_SCSI_SATA_AHCI, it successfully powers off.
 
 Also with CONFIG_SCSI_SATA_AHCI, reverting this patch manually by setting 
 softreset to NULL in ata_do_eh calls in ahci.c makes the machine poweroff.

Wow, this is one of the most amazing error report.  ahci softreset
preventing system halt?

 I have attached the dmesg output with defined ATA_DEBUG, ATA_VERBOSE_DEBUG
 if it helps. Also you may find lspci output attached. 
 
 Please let me know if anything else is needed.

Does everything else work okay?  Can you access devices attached to
ahci?  What happens when you try to shutdown?  If possible, please post
dmesg of shutting down.  You can store it easily using netconsole
(Documentation/networking/netconsole.txt).

Thanks.

-- 
tejun
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


2.6.20-rc5: known unfixed regressions

2007-01-12 Thread Adrian Bunk
On Fri, Jan 12, 2007 at 02:27:48PM -0500, Linus Torvalds wrote:
...
 A lot of developers (including me) will be gone next week for 
 Linux.Conf.Au, so you have a week of rest and quiet to test this, and 
 report any problems. 
 
 Not that there will be any, right? You all behave now!
...

This still leaves the old regressions we have not yet fixed...


This email lists some known regressions in 2.6.20-rc5 compared to 2.6.19.

If you find your name in the Cc header, you are either submitter of one
of the bugs, maintainer of an affectected subsystem or driver, a patch
of you caused a breakage or I'm considering you in any other way possibly
involved with one or more of these issues.

Due to the huge amount of recipients, please trim the Cc when answering.


Subject: pktcdvd fails with pata_amd
References : http://bugzilla.kernel.org/show_bug.cgi?id=7810
Submitter  : [EMAIL PROTECTED]
Status : unknown


Subject: problems with CD burning
References : http://www.spinics.net/lists/linux-ide/msg06545.html
Submitter  : Uwe Bugla [EMAIL PROTECTED]
Status : unknown


Subject: BUG: scheduling while atomic: hald-addon-stor/...
 cdrom_{open,release,ioctl} in trace
References : http://lkml.org/lkml/2006/12/26/105
 http://lkml.org/lkml/2006/12/29/22
 http://lkml.org/lkml/2006/12/31/133
Submitter  : Jon Smirl [EMAIL PROTECTED]
 Damien Wyart [EMAIL PROTECTED]
 Aaron Sethman [EMAIL PROTECTED]
Status : unknown


Subject: 'shutdown -h now' reboots the system  (CONFIG_USB_SUSPEND)
References : http://lkml.org/lkml/2006/12/25/40
Submitter  : Berthold Cogel [EMAIL PROTECTED]
Handled-By : Alexey Starikovskiy [EMAIL PROTECTED]
Status : problem is being debugged


Subject: USB keyboard unresponsive after some time
References : http://lkml.org/lkml/2006/12/25/35
 http://lkml.org/lkml/2006/12/26/106
Submitter  : Florin Iucha [EMAIL PROTECTED]
Handled-By : Jiri Kosina [EMAIL PROTECTED]
 Alan Stern [EMAIL PROTECTED]
Status : problem is being debugged


Subject: BUG: at fs/inotify.c:172 set_dentry_child_flags()
References : http://bugzilla.kernel.org/show_bug.cgi?id=7785
Submitter  : Cijoml Cijomlovic Cijomlov [EMAIL PROTECTED]
Handled-By : Nick Piggin [EMAIL PROTECTED]
Status : problem is being debugged


Subject: BUG: at mm/truncate.c:60 cancel_dirty_page()  (XFS)
References : http://lkml.org/lkml/2007/1/5/308
Submitter  : Sami Farin [EMAIL PROTECTED]
Handled-By : David Chinner [EMAIL PROTECTED]
Status : problem is being discussed


Subject: BUG: at mm/truncate.c:60 cancel_dirty_page()  (reiserfs)
References : http://lkml.org/lkml/2007/1/7/117
 http://lkml.org/lkml/2007/1/10/202
Submitter  : Malte Schröder [EMAIL PROTECTED]
Handled-By : Vladimir V. Saveliev [EMAIL PROTECTED]
 Nick Piggin [EMAIL PROTECTED]
Patch  : http://lkml.org/lkml/2007/1/10/202
Status : problem is being discussed


-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html