Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0ecdca26 authored by Bartlomiej Zolnierkiewicz's avatar Bartlomiej Zolnierkiewicz
Browse files

ide: use PIO/MMIO operations directly where possible (v2)



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

v2:
* updated for scc_pata

Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
parent 7569e8dc
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -81,8 +81,6 @@ static inline void hwif_setup(ide_hwif_t *hwif)
	hwif->OUTSW = mm_outsw;
	hwif->INW   = mm_inw;
	hwif->INSW  = mm_insw;
	hwif->OUTL  = NULL;
	hwif->INL   = NULL;
	hwif->OUTSL = NULL;
	hwif->INSL  = NULL;
}
+4 −1
Original line number Diff line number Diff line
@@ -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);

	/* specify r/w */
	hwif->OUTB(reading, hwif->dma_command);
+0 −24
Original line number Diff line number Diff line
@@ -49,11 +49,6 @@ static void ide_insw (unsigned long port, void *addr, u32 count)
	insw(port, addr, count);
}

static u32 ide_inl (unsigned long port)
{
	return (u32) inl(port);
}

static void ide_insl (unsigned long port, void *addr, u32 count)
{
	insl(port, addr, count);
@@ -79,11 +74,6 @@ static void ide_outsw (unsigned long port, void *addr, u32 count)
	outsw(port, addr, count);
}

static void ide_outl (u32 val, unsigned long port)
{
	outl(val, port);
}

static void ide_outsl (unsigned long port, void *addr, u32 count)
{
	outsl(port, addr, count);
@@ -94,12 +84,10 @@ void default_hwif_iops (ide_hwif_t *hwif)
	hwif->OUTB	= ide_outb;
	hwif->OUTBSYNC	= ide_outbsync;
	hwif->OUTW	= ide_outw;
	hwif->OUTL	= ide_outl;
	hwif->OUTSW	= ide_outsw;
	hwif->OUTSL	= ide_outsl;
	hwif->INB	= ide_inb;
	hwif->INW	= ide_inw;
	hwif->INL	= ide_inl;
	hwif->INSW	= ide_insw;
	hwif->INSL	= ide_insl;
}
@@ -123,11 +111,6 @@ static void ide_mm_insw (unsigned long port, void *addr, u32 count)
	__ide_mm_insw((void __iomem *) port, addr, count);
}

static u32 ide_mm_inl (unsigned long port)
{
	return (u32) readl((void __iomem *) port);
}

static void ide_mm_insl (unsigned long port, void *addr, u32 count)
{
	__ide_mm_insl((void __iomem *) port, addr, count);
@@ -153,11 +136,6 @@ static void ide_mm_outsw (unsigned long port, void *addr, u32 count)
	__ide_mm_outsw((void __iomem *) port, addr, count);
}

static void ide_mm_outl (u32 value, unsigned long port)
{
	writel(value, (void __iomem *) port);
}

static void ide_mm_outsl (unsigned long port, void *addr, u32 count)
{
	__ide_mm_outsl((void __iomem *) port, addr, count);
@@ -170,12 +148,10 @@ void default_hwif_mmiops (ide_hwif_t *hwif)
	   this one is controller specific! */
	hwif->OUTBSYNC	= ide_mm_outbsync;
	hwif->OUTW	= ide_mm_outw;
	hwif->OUTL	= ide_mm_outl;
	hwif->OUTSW	= ide_mm_outsw;
	hwif->OUTSL	= ide_mm_outsl;
	hwif->INB	= ide_mm_inb;
	hwif->INW	= ide_mm_inw;
	hwif->INL	= ide_mm_inl;
	hwif->INSW	= ide_mm_insw;
	hwif->INSL	= ide_mm_insl;
}
+0 −2
Original line number Diff line number Diff line
@@ -518,13 +518,11 @@ static void ide_hwif_restore(ide_hwif_t *hwif, ide_hwif_t *tmp_hwif)
	hwif->OUTB			= tmp_hwif->OUTB;
	hwif->OUTBSYNC			= tmp_hwif->OUTBSYNC;
	hwif->OUTW			= tmp_hwif->OUTW;
	hwif->OUTL			= tmp_hwif->OUTL;
	hwif->OUTSW			= tmp_hwif->OUTSW;
	hwif->OUTSL			= tmp_hwif->OUTSL;

	hwif->INB			= tmp_hwif->INB;
	hwif->INW			= tmp_hwif->INW;
	hwif->INL			= tmp_hwif->INL;
	hwif->INSW			= tmp_hwif->INSW;
	hwif->INSL			= tmp_hwif->INSL;

+7 −7
Original line number Diff line number Diff line
@@ -143,16 +143,16 @@ static void ht6560b_selectproc (ide_drive_t *drive)
		current_timing = timing;
		if (drive->media != ide_disk || !drive->present)
			select |= HT_PREFETCH_MODE;
		(void) HWIF(drive)->INB(HT_CONFIG_PORT);
		(void) HWIF(drive)->INB(HT_CONFIG_PORT);
		(void) HWIF(drive)->INB(HT_CONFIG_PORT);
		(void) HWIF(drive)->INB(HT_CONFIG_PORT);
		HWIF(drive)->OUTB(select, HT_CONFIG_PORT);
		(void)inb(HT_CONFIG_PORT);
		(void)inb(HT_CONFIG_PORT);
		(void)inb(HT_CONFIG_PORT);
		(void)inb(HT_CONFIG_PORT);
		outb(select, HT_CONFIG_PORT);
		/*
		 * Set timing for this drive:
		 */
		HWIF(drive)->OUTB(timing, IDE_SELECT_REG);
		(void) HWIF(drive)->INB(IDE_STATUS_REG);
		outb(timing, IDE_SELECT_REG);
		(void)inb(IDE_STATUS_REG);
#ifdef DEBUG
		printk("ht6560b: %s: select=%#x timing=%#x\n",
			drive->name, select, timing);
Loading