* [PATCH 5/11] ide-pmac: remove pmac_ide_{m,u}dma_enable()
@ 2007-07-22 18:24 Bartlomiej Zolnierkiewicz
2007-07-22 21:59 ` Benjamin Herrenschmidt
2007-07-22 23:47 ` Benjamin Herrenschmidt
0 siblings, 2 replies; 3+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2007-07-22 18:24 UTC (permalink / raw)
To: linux-ide; +Cc: Benjamin Herrenschmidt
* Fix pmac_ide_dma_check() to use pmac_ide_tune_chipset() and remove no longer
necessary pmac_ide_{m,u}dma_enable().
* While at it remove some dead code from pmac_ide_dma_check() (leftovers from
conversion to use ide_max_dma_mode()).
There should be no functionality changes caused by this patch.
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/ppc/pmac.c | 101 -------------------------------------------------
1 file changed, 2 insertions(+), 99 deletions(-)
Index: b/drivers/ide/ppc/pmac.c
===================================================================
--- a/drivers/ide/ppc/pmac.c
+++ b/drivers/ide/ppc/pmac.c
@@ -1669,105 +1669,13 @@ pmac_ide_destroy_dmatable (ide_drive_t *
}
/*
- * Pick up best MDMA timing for the drive and apply it
- */
-static int
-pmac_ide_mdma_enable(ide_drive_t *drive, u16 mode)
-{
- ide_hwif_t *hwif = HWIF(drive);
- pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)hwif->hwif_data;
- u32 *timings, *timings2;
- u32 timing_local[2];
- int ret;
-
- /* which drive is it ? */
- timings = &pmif->timings[drive->select.b.unit & 0x01];
- timings2 = &pmif->timings[(drive->select.b.unit & 0x01) + 2];
-
- /* Copy timings to local image */
- timing_local[0] = *timings;
- timing_local[1] = *timings2;
-
- /* Calculate controller timings */
- set_timings_mdma(drive, pmif->kind, &timing_local[0], &timing_local[1], mode);
-
- /* Set feature on drive */
- printk(KERN_INFO "%s: Enabling MultiWord DMA %d\n", drive->name, mode & 0xf);
- ret = pmac_ide_do_setfeature(drive, mode);
- if (ret) {
- printk(KERN_WARNING "%s: Failed !\n", drive->name);
- return 0;
- }
-
- /* Apply timings to controller */
- *timings = timing_local[0];
- *timings2 = timing_local[1];
-
- return 1;
-}
-
-/*
- * Pick up best UDMA timing for the drive and apply it
- */
-static int
-pmac_ide_udma_enable(ide_drive_t *drive, u16 mode)
-{
- ide_hwif_t *hwif = HWIF(drive);
- pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)hwif->hwif_data;
- u32 *timings, *timings2;
- u32 timing_local[2];
- int ret;
-
- /* which drive is it ? */
- timings = &pmif->timings[drive->select.b.unit & 0x01];
- timings2 = &pmif->timings[(drive->select.b.unit & 0x01) + 2];
-
- /* Copy timings to local image */
- timing_local[0] = *timings;
- timing_local[1] = *timings2;
-
- /* Calculate timings for interface */
- if (pmif->kind == controller_un_ata6
- || pmif->kind == controller_k2_ata6)
- ret = set_timings_udma_ata6( &timing_local[0],
- &timing_local[1],
- mode);
- else if (pmif->kind == controller_sh_ata6)
- ret = set_timings_udma_shasta( &timing_local[0],
- &timing_local[1],
- mode);
- else
- ret = set_timings_udma_ata4(&timing_local[0], mode);
- if (ret)
- return 0;
-
- /* Set feature on drive */
- printk(KERN_INFO "%s: Enabling Ultra DMA %d\n", drive->name, mode & 0x0f);
- ret = pmac_ide_do_setfeature(drive, mode);
- if (ret) {
- printk(KERN_WARNING "%s: Failed !\n", drive->name);
- return 0;
- }
-
- /* Apply timings to controller */
- *timings = timing_local[0];
- *timings2 = timing_local[1];
-
- return 1;
-}
-
-/*
* Check what is the best DMA timing setting for the drive and
* call appropriate functions to apply it.
*/
static int
pmac_ide_dma_check(ide_drive_t *drive)
{
- struct hd_driveid *id = drive->id;
- ide_hwif_t *hwif = HWIF(drive);
- pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)hwif->hwif_data;
int enable = 1;
- int map;
drive->using_dma = 0;
if (drive->media == ide_floppy)
@@ -1780,13 +1688,8 @@ pmac_ide_dma_check(ide_drive_t *drive)
if (enable) {
u8 mode = ide_max_dma_mode(drive);
- if (mode >= XFER_UDMA_0)
- drive->using_dma = pmac_ide_udma_enable(drive, mode);
- else if (mode >= XFER_MW_DMA_0)
- drive->using_dma = pmac_ide_mdma_enable(drive, mode);
-
- /* Apply settings to controller */
- pmac_ide_do_update_timings(drive);
+ if (mode && pmac_ide_tune_chipset(drive, mode) == 0)
+ drive->using_dma = 1;
}
return 0;
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 5/11] ide-pmac: remove pmac_ide_{m,u}dma_enable()
2007-07-22 18:24 [PATCH 5/11] ide-pmac: remove pmac_ide_{m,u}dma_enable() Bartlomiej Zolnierkiewicz
@ 2007-07-22 21:59 ` Benjamin Herrenschmidt
2007-07-22 23:47 ` Benjamin Herrenschmidt
1 sibling, 0 replies; 3+ messages in thread
From: Benjamin Herrenschmidt @ 2007-07-22 21:59 UTC (permalink / raw)
To: Bartlomiej Zolnierkiewicz; +Cc: linux-ide
On Sun, 2007-07-22 at 20:24 +0200, Bartlomiej Zolnierkiewicz wrote:
> * Fix pmac_ide_dma_check() to use pmac_ide_tune_chipset() and remove no longer
> necessary pmac_ide_{m,u}dma_enable().
>
> * While at it remove some dead code from pmac_ide_dma_check() (leftovers from
> conversion to use ide_max_dma_mode()).
>
> There should be no functionality changes caused by this patch.
>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> ---
> drivers/ide/ppc/pmac.c | 101 -------------------------------------------------
> 1 file changed, 2 insertions(+), 99 deletions(-)
>
> Index: b/drivers/ide/ppc/pmac.c
> ===================================================================
> --- a/drivers/ide/ppc/pmac.c
> +++ b/drivers/ide/ppc/pmac.c
> @@ -1669,105 +1669,13 @@ pmac_ide_destroy_dmatable (ide_drive_t *
> }
>
> /*
> - * Pick up best MDMA timing for the drive and apply it
> - */
> -static int
> -pmac_ide_mdma_enable(ide_drive_t *drive, u16 mode)
> -{
> - ide_hwif_t *hwif = HWIF(drive);
> - pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)hwif->hwif_data;
> - u32 *timings, *timings2;
> - u32 timing_local[2];
> - int ret;
> -
> - /* which drive is it ? */
> - timings = &pmif->timings[drive->select.b.unit & 0x01];
> - timings2 = &pmif->timings[(drive->select.b.unit & 0x01) + 2];
> -
> - /* Copy timings to local image */
> - timing_local[0] = *timings;
> - timing_local[1] = *timings2;
> -
> - /* Calculate controller timings */
> - set_timings_mdma(drive, pmif->kind, &timing_local[0], &timing_local[1], mode);
> -
> - /* Set feature on drive */
> - printk(KERN_INFO "%s: Enabling MultiWord DMA %d\n", drive->name, mode & 0xf);
> - ret = pmac_ide_do_setfeature(drive, mode);
> - if (ret) {
> - printk(KERN_WARNING "%s: Failed !\n", drive->name);
> - return 0;
> - }
> -
> - /* Apply timings to controller */
> - *timings = timing_local[0];
> - *timings2 = timing_local[1];
> -
> - return 1;
> -}
> -
> -/*
> - * Pick up best UDMA timing for the drive and apply it
> - */
> -static int
> -pmac_ide_udma_enable(ide_drive_t *drive, u16 mode)
> -{
> - ide_hwif_t *hwif = HWIF(drive);
> - pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)hwif->hwif_data;
> - u32 *timings, *timings2;
> - u32 timing_local[2];
> - int ret;
> -
> - /* which drive is it ? */
> - timings = &pmif->timings[drive->select.b.unit & 0x01];
> - timings2 = &pmif->timings[(drive->select.b.unit & 0x01) + 2];
> -
> - /* Copy timings to local image */
> - timing_local[0] = *timings;
> - timing_local[1] = *timings2;
> -
> - /* Calculate timings for interface */
> - if (pmif->kind == controller_un_ata6
> - || pmif->kind == controller_k2_ata6)
> - ret = set_timings_udma_ata6( &timing_local[0],
> - &timing_local[1],
> - mode);
> - else if (pmif->kind == controller_sh_ata6)
> - ret = set_timings_udma_shasta( &timing_local[0],
> - &timing_local[1],
> - mode);
> - else
> - ret = set_timings_udma_ata4(&timing_local[0], mode);
> - if (ret)
> - return 0;
> -
> - /* Set feature on drive */
> - printk(KERN_INFO "%s: Enabling Ultra DMA %d\n", drive->name, mode & 0x0f);
> - ret = pmac_ide_do_setfeature(drive, mode);
> - if (ret) {
> - printk(KERN_WARNING "%s: Failed !\n", drive->name);
> - return 0;
> - }
> -
> - /* Apply timings to controller */
> - *timings = timing_local[0];
> - *timings2 = timing_local[1];
> -
> - return 1;
> -}
> -
> -/*
> * Check what is the best DMA timing setting for the drive and
> * call appropriate functions to apply it.
> */
> static int
> pmac_ide_dma_check(ide_drive_t *drive)
> {
> - struct hd_driveid *id = drive->id;
> - ide_hwif_t *hwif = HWIF(drive);
> - pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)hwif->hwif_data;
> int enable = 1;
> - int map;
> drive->using_dma = 0;
>
> if (drive->media == ide_floppy)
> @@ -1780,13 +1688,8 @@ pmac_ide_dma_check(ide_drive_t *drive)
> if (enable) {
> u8 mode = ide_max_dma_mode(drive);
>
> - if (mode >= XFER_UDMA_0)
> - drive->using_dma = pmac_ide_udma_enable(drive, mode);
> - else if (mode >= XFER_MW_DMA_0)
> - drive->using_dma = pmac_ide_mdma_enable(drive, mode);
> -
> - /* Apply settings to controller */
> - pmac_ide_do_update_timings(drive);
> + if (mode && pmac_ide_tune_chipset(drive, mode) == 0)
> + drive->using_dma = 1;
> }
> return 0;
> }
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 5/11] ide-pmac: remove pmac_ide_{m,u}dma_enable()
2007-07-22 18:24 [PATCH 5/11] ide-pmac: remove pmac_ide_{m,u}dma_enable() Bartlomiej Zolnierkiewicz
2007-07-22 21:59 ` Benjamin Herrenschmidt
@ 2007-07-22 23:47 ` Benjamin Herrenschmidt
1 sibling, 0 replies; 3+ messages in thread
From: Benjamin Herrenschmidt @ 2007-07-22 23:47 UTC (permalink / raw)
To: Bartlomiej Zolnierkiewicz; +Cc: linux-ide
> static int
> pmac_ide_dma_check(ide_drive_t *drive)
> {
> - struct hd_driveid *id = drive->id;
Actually, this one breaks compile, "id" is used a bit further below in
that function.
Cheers,
Ben.
> - ide_hwif_t *hwif = HWIF(drive);
> - pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)hwif->hwif_data;
> int enable = 1;
> - int map;
> drive->using_dma = 0;
>
> if (drive->media == ide_floppy)
> @@ -1780,13 +1688,8 @@ pmac_ide_dma_check(ide_drive_t *drive)
> if (enable) {
> u8 mode = ide_max_dma_mode(drive);
>
> - if (mode >= XFER_UDMA_0)
> - drive->using_dma = pmac_ide_udma_enable(drive, mode);
> - else if (mode >= XFER_MW_DMA_0)
> - drive->using_dma = pmac_ide_mdma_enable(drive, mode);
> -
> - /* Apply settings to controller */
> - pmac_ide_do_update_timings(drive);
> + if (mode && pmac_ide_tune_chipset(drive, mode) == 0)
> + drive->using_dma = 1;
> }
> return 0;
> }
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-07-22 23:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-22 18:24 [PATCH 5/11] ide-pmac: remove pmac_ide_{m,u}dma_enable() Bartlomiej Zolnierkiewicz
2007-07-22 21:59 ` Benjamin Herrenschmidt
2007-07-22 23:47 ` Benjamin Herrenschmidt
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).