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

Commit ac95beed authored by Bartlomiej Zolnierkiewicz's avatar Bartlomiej Zolnierkiewicz
Browse files

ide: add struct ide_port_ops (take 2)



* Move hooks for port/host specific methods from ide_hwif_t to
  'struct ide_port_ops'.

* Add 'const struct ide_port_ops *port_ops' to 'struct ide_port_info'
  and ide_hwif_t.

* Update host drivers and core code accordingly.

While at it:

* Rename ata66_*() cable detect functions to *_cable_detect() to match
  the standard naming. (Suggested by Sergei Shtylyov)

v2:
* Fix build for bast-ide. (Noticed by Andrew Morton)

Acked-by: default avatarSergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
parent 4a27214d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@ static int __init bastide_register(unsigned int base, unsigned int aux, int irq)

	ide_init_port_hw(hwif, &hw);
	hwif->mmio = 1;
	hwif->quirkproc = NULL;
	hwif->port_ops = NULL;

	idx[0] = i;

+11 −2
Original line number Diff line number Diff line
@@ -191,6 +191,10 @@ static void icside_maskproc(ide_drive_t *drive, int mask)
	local_irq_restore(flags);
}

static const struct ide_port_ops icside_v6_no_dma_port_ops = {
	.maskproc		= icside_maskproc,
};

#ifdef CONFIG_BLK_DEV_IDEDMA_ICS
/*
 * SG-DMA support.
@@ -266,6 +270,11 @@ static void icside_set_dma_mode(ide_drive_t *drive, const u8 xfer_mode)
		ide_xfer_verbose(xfer_mode), 2000 / drive->drive_data);
}

static const struct ide_port_ops icside_v6_port_ops = {
	.set_dma_mode		= icside_set_dma_mode,
	.maskproc		= icside_maskproc,
};

static void icside_dma_host_set(ide_drive_t *drive, int on)
{
}
@@ -379,7 +388,6 @@ static void icside_dma_init(ide_hwif_t *hwif)
{
	hwif->dmatable_cpu	= NULL;
	hwif->dmatable_dma	= 0;
	hwif->set_dma_mode	= icside_set_dma_mode;

	hwif->dma_host_set	= icside_dma_host_set;
	hwif->dma_setup		= icside_dma_setup;
@@ -462,6 +470,7 @@ icside_register_v5(struct icside_state *state, struct expansion_card *ec)
}

static const struct ide_port_info icside_v6_port_info __initdata = {
	.port_ops		= &icside_v6_no_dma_port_ops,
	.host_flags		= IDE_HFLAG_SERIALIZE |
				  IDE_HFLAG_NO_DMA | /* no SFF-style DMA */
				  IDE_HFLAG_NO_AUTOTUNE,
@@ -526,7 +535,6 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec)
	state->hwif[0]    = hwif;
	state->hwif[1]    = mate;

	hwif->maskproc    = icside_maskproc;
	hwif->hwif_data   = state;
	hwif->config_data = (unsigned long)ioc_base;
	hwif->select_data = sel;
@@ -539,6 +547,7 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec)
	if (ec->dma != NO_DMA && !request_dma(ec->dma, hwif->name)) {
		icside_dma_init(hwif);
		icside_dma_init(mate);
		d.port_ops = &icside_v6_dma_port_ops;
	} else
		d.mwdma_mask = d.swdma_mask = 0;

+6 −8
Original line number Diff line number Diff line
@@ -317,16 +317,14 @@ static u8 __devinit palm_bk3710_cable_detect(ide_hwif_t *hwif)
	return ATA_CBL_PATA80;
}

static void __devinit palm_bk3710_init_hwif(ide_hwif_t *hwif)
{
	hwif->set_pio_mode = palm_bk3710_set_pio_mode;
	hwif->set_dma_mode = palm_bk3710_set_dma_mode;

	hwif->cable_detect = palm_bk3710_cable_detect;
}
static const struct ide_port_ops palm_bk3710_ports_ops = {
	.set_pio_mode		= palm_bk3710_set_pio_mode,
	.set_dma_mode		= palm_bk3710_set_dma_mode,
	.cable_detect		= palm_bk3710_cable_detect,
};

static const struct ide_port_info __devinitdata palm_bk3710_port_info = {
	.init_hwif		= palm_bk3710_init_hwif,
	.port_ops		= &palm_bk3710_ports_ops,
	.host_flags		= IDE_HFLAG_NO_DMA, /* hack (no PCI) */
	.pio_mask		= ATA_PIO4,
	.udma_mask		= ATA_UDMA4,	/* (input clk 99MHz) */
+6 −2
Original line number Diff line number Diff line
@@ -782,8 +782,14 @@ static void __init cris_setup_ports(hw_regs_t *hw, unsigned long base)
	hw->ack_intr = cris_ide_ack_intr;
}

static const struct ide_port_ops cris_port_ops = {
	.set_pio_mode		= cris_set_pio_mode,
	.set_dma_mode		= cris_set_dma_mode,
};

static const struct ide_port_info cris_port_info __initdata = {
	.chipset		= ide_etrax100,
	.port_ops		= &cris_port_ops,
	.host_flags		= IDE_HFLAG_NO_ATAPI_DMA |
				  IDE_HFLAG_NO_DMA, /* no SFF-style DMA */
	.pio_mask		= ATA_PIO4,
@@ -810,8 +816,6 @@ static int __init init_e100_ide(void)
		ide_init_port_data(hwif, hwif->index);
		ide_init_port_hw(hwif, &hw);
		hwif->mmio = 1;
		hwif->set_pio_mode = &cris_set_pio_mode;
		hwif->set_dma_mode = &cris_set_dma_mode;
		hwif->ata_input_data = &cris_ide_input_data;
		hwif->ata_output_data = &cris_ide_output_data;
		hwif->atapi_input_bytes = &cris_atapi_input_bytes;
+5 −4
Original line number Diff line number Diff line
@@ -574,6 +574,7 @@ static unsigned int ide_get_mode_mask(ide_drive_t *drive, u8 base, u8 req_mode)
{
	struct hd_driveid *id = drive->id;
	ide_hwif_t *hwif = drive->hwif;
	const struct ide_port_ops *port_ops = hwif->port_ops;
	unsigned int mask = 0;

	switch(base) {
@@ -581,8 +582,8 @@ static unsigned int ide_get_mode_mask(ide_drive_t *drive, u8 base, u8 req_mode)
		if ((id->field_valid & 4) == 0)
			break;

		if (hwif->udma_filter)
			mask = hwif->udma_filter(drive);
		if (port_ops && port_ops->udma_filter)
			mask = port_ops->udma_filter(drive);
		else
			mask = hwif->ultra_mask;
		mask &= id->dma_ultra;
@@ -598,8 +599,8 @@ static unsigned int ide_get_mode_mask(ide_drive_t *drive, u8 base, u8 req_mode)
	case XFER_MW_DMA_0:
		if ((id->field_valid & 2) == 0)
			break;
		if (hwif->mdma_filter)
			mask = hwif->mdma_filter(drive);
		if (port_ops && port_ops->mdma_filter)
			mask = port_ops->mdma_filter(drive);
		else
			mask = hwif->mwdma_mask;
		mask &= id->dma_mword;
Loading