linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Not able to set DMA mode other than default using hdparm
@ 2009-11-23 16:58 Pedanekar, Hemant
  2009-11-23 17:44 ` Sergei Shtylyov
  0 siblings, 1 reply; 3+ messages in thread
From: Pedanekar, Hemant @ 2009-11-23 16:58 UTC (permalink / raw)
  To: linux-ide@vger.kernel.org
  Cc: davinci-linux-open-source@linux.davincidsp.com, Pedanekar, Hemant

Hello,

I am getting following error when trying to set DMA transfer mode as UDMA2 on latest DaVinci (DM6467) git kernel using hdparm (9.27 or older):

# ./hdparm -d1 -Xudma2  /dev/hda
/dev/hda:hda: UDMA/66 mode selected
 setting using_dma to 1 (on)
hda: UDMA/66 mode selected
 setting xfermode to 66 (UltraDMA mode2)
 HDIO_DRIVE_CMD(setxfermode) failed: Invalid argument
 using_dma     =  1 (on)

It seems DMA mode setting other than the default mode returns this error. That is, if I use "-Xudma4" in above command it returns success as UDMA4 is the default mode on DM6467.

I made following change which allows hdparm to set any supported DMA mode. Can anyone confirm if this is a hdparm compatibility (incorrect use of ioctl?) or the patch below indeed fixes the issue?

diff --git a/drivers/ide/ide-ioctls.c b/drivers/ide/ide-ioctls.c
index d3440b5..6e7ae2b 100644
--- a/drivers/ide/ide-ioctls.c
+++ b/drivers/ide/ide-ioctls.c
@@ -162,7 +162,7 @@ static int ide_cmd_ioctl(ide_drive_t *drive, unsigned long arg)
        if (tf->command == ATA_CMD_SET_FEATURES &&
            tf->feature == SETFEATURES_XFER &&
            tf->nsect >= XFER_SW_DMA_0) {
-               xfer_rate = ide_find_dma_mode(drive, XFER_UDMA_6);
+               xfer_rate = ide_find_dma_mode(drive, tf->nsect);
                if (xfer_rate != tf->nsect) {
                        err = -EINVAL;
                        goto abort;


Thanks.
-
Hemant
 


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

* Re: Not able to set DMA mode other than default using hdparm
  2009-11-23 16:58 Not able to set DMA mode other than default using hdparm Pedanekar, Hemant
@ 2009-11-23 17:44 ` Sergei Shtylyov
  2009-11-23 18:10   ` Bartlomiej Zolnierkiewicz
  0 siblings, 1 reply; 3+ messages in thread
From: Sergei Shtylyov @ 2009-11-23 17:44 UTC (permalink / raw)
  To: Pedanekar, Hemant
  Cc: linux-ide@vger.kernel.org,
	davinci-linux-open-source@linux.davincidsp.com,
	Bartlomiej Zolnierkiewicz

Pedanekar, Hemant wrote:

> I am getting following error when trying to set DMA transfer mode as UDMA2 on latest DaVinci (DM6467) git kernel using hdparm (9.27 or older):

> # ./hdparm -d1 -Xudma2  /dev/hda
> /dev/hda:hda: UDMA/66 mode selected
>  setting using_dma to 1 (on)
> hda: UDMA/66 mode selected
>  setting xfermode to 66 (UltraDMA mode2)
>  HDIO_DRIVE_CMD(setxfermode) failed: Invalid argument
>  using_dma     =  1 (on)

> It seems DMA mode setting other than the default mode returns this error. That is, if I use "-Xudma4" in above command it returns success as UDMA4 is the default mode on DM6467.

> I made following change which allows hdparm to set any supported DMA mode. Can anyone confirm if this is a hdparm compatibility (incorrect use of ioctl?) or the patch below indeed fixes the issue?

> diff --git a/drivers/ide/ide-ioctls.c b/drivers/ide/ide-ioctls.c
> index d3440b5..6e7ae2b 100644
> --- a/drivers/ide/ide-ioctls.c
> +++ b/drivers/ide/ide-ioctls.c
> @@ -162,7 +162,7 @@ static int ide_cmd_ioctl(ide_drive_t *drive, unsigned long arg)
>         if (tf->command == ATA_CMD_SET_FEATURES &&
>             tf->feature == SETFEATURES_XFER &&
>             tf->nsect >= XFER_SW_DMA_0) {
> -               xfer_rate = ide_find_dma_mode(drive, XFER_UDMA_6);
> +               xfer_rate = ide_find_dma_mode(drive, tf->nsect);
>                 if (xfer_rate != tf->nsect) {
>                         err = -EINVAL;
>                         goto abort;
> 

    Looks like the patch is correct, the following commit has introduced the 
mistake:

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=a9c415090710a108edcd81b3392b90396f190a9a

    Could you resubmit your patch with proper description and sign-off?

MBR, Sergei

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

* Re: Not able to set DMA mode other than default using hdparm
  2009-11-23 17:44 ` Sergei Shtylyov
@ 2009-11-23 18:10   ` Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 3+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-11-23 18:10 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: Pedanekar, Hemant, linux-ide@vger.kernel.org,
	davinci-linux-open-source@linux.davincidsp.com

On Monday 23 November 2009 06:44:30 pm Sergei Shtylyov wrote:
> Pedanekar, Hemant wrote:
> 
> > I am getting following error when trying to set DMA transfer mode as UDMA2 on latest DaVinci (DM6467) git kernel using hdparm (9.27 or older):
> 
> > # ./hdparm -d1 -Xudma2  /dev/hda
> > /dev/hda:hda: UDMA/66 mode selected
> >  setting using_dma to 1 (on)
> > hda: UDMA/66 mode selected
> >  setting xfermode to 66 (UltraDMA mode2)
> >  HDIO_DRIVE_CMD(setxfermode) failed: Invalid argument
> >  using_dma     =  1 (on)
> 
> > It seems DMA mode setting other than the default mode returns this error. That is, if I use "-Xudma4" in above command it returns success as UDMA4 is the default mode on DM6467.
> 
> > I made following change which allows hdparm to set any supported DMA mode. Can anyone confirm if this is a hdparm compatibility (incorrect use of ioctl?) or the patch below indeed fixes the issue?
> 
> > diff --git a/drivers/ide/ide-ioctls.c b/drivers/ide/ide-ioctls.c
> > index d3440b5..6e7ae2b 100644
> > --- a/drivers/ide/ide-ioctls.c
> > +++ b/drivers/ide/ide-ioctls.c
> > @@ -162,7 +162,7 @@ static int ide_cmd_ioctl(ide_drive_t *drive, unsigned long arg)
> >         if (tf->command == ATA_CMD_SET_FEATURES &&
> >             tf->feature == SETFEATURES_XFER &&
> >             tf->nsect >= XFER_SW_DMA_0) {
> > -               xfer_rate = ide_find_dma_mode(drive, XFER_UDMA_6);
> > +               xfer_rate = ide_find_dma_mode(drive, tf->nsect);
> >                 if (xfer_rate != tf->nsect) {
> >                         err = -EINVAL;
> >                         goto abort;
> > 
> 
>     Looks like the patch is correct, the following commit has introduced the 
> mistake:
> 
> http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=a9c415090710a108edcd81b3392b90396f190a9a

Indeed, there is a thinko in the above commit and the patch corrects it.

>     Could you resubmit your patch with proper description and sign-off?

You may also add:

	Acked-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

while at it:

Thanks.
--
Bartlomiej Zolnierkiewicz

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

end of thread, other threads:[~2009-11-23 18:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-23 16:58 Not able to set DMA mode other than default using hdparm Pedanekar, Hemant
2009-11-23 17:44 ` Sergei Shtylyov
2009-11-23 18:10   ` Bartlomiej Zolnierkiewicz

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).