LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
To: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org,
	Russell King <rmk@arm.linux.org.uk>
Subject: Re: [PATCH 7/8] ide: add struct ide_port_info instances to legacy host drivers
Date: Sat, 2 Feb 2008 00:35:30 +0100	[thread overview]
Message-ID: <200802020035.30918.bzolnier@gmail.com> (raw)
In-Reply-To: <479E3AEA.5090600@ru.mvista.com>


Hi,

On Monday 28 January 2008, Sergei Shtylyov wrote:
> Hello.
> 
> Bartlomiej Zolnierkiewicz wrote:
> 
> > * Remove 'struct pci_dev *dev' argument from ide_hwif_setup_dma().
> 
> > * Un-static ide_hwif_setup_dma() and add CONFIG_BLK_DEV_IDEDMA_PCI=n version.
> 
> > * Add 'const struct ide_port_info *d' argument to ide_device_add[_all]().
> 
> > * Factor out generic ports init from ide_pci_setup_ports() to ide_init_port(),
> >   move it to ide-probe.c and call it in in ide_device_add_all() instead of
> >   ide_pci_setup_ports().
> 
> > * Move ->mate setup to ide_device_add_all() from ide_port_init().
> 
> > * Add IDE_HFLAG_NO_AUTOTUNE host flag for host drivers that don't enable
> >   ->autotune currently.
> 
> > * Setup hwif->chipset in ide_init_port() but iff pi->chipset is set
> >   (to not override setup done by ide_hwif_configure()).
> 
> > * Add ETRAX host handling to ide_device_add_all().
> 
> > * cmd640.c: set IDE_HFLAG_ABUSE_* also for CONFIG_BLK_DEV_CMD640_ENHANCED=n.
> 
> > * pmac.c: make pmac_ide_setup_dma() return an error value and move DMA masks
> >   setup to pmac_ide_setup_device().
> 
> > * Add 'struct ide_port_info' instances to legacy host drivers, pass them to
> >   ide_device_add() calls and then remove open-coded ports initialization.
> 
> > Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> 
> > Index: b/drivers/ide/arm/icside.c
> > ===================================================================
> > --- a/drivers/ide/arm/icside.c
> > +++ b/drivers/ide/arm/icside.c
> > @@ -459,11 +456,19 @@ icside_register_v5(struct icside_state *
> >  
> >  	idx[0] = hwif->index;
> >  
> > -	ide_device_add(idx);
> > +	ide_device_add(idx, NULL);
> >  
> >  	return 0;
> >  }
> >  
> > +static const struct ide_port_info icside_v6_port_info __initdata = {
> > +	.host_flags		= IDE_HFLAG_SERIALIZE |
> > +				  IDE_HFLAG_NO_DMA | /* no SFF-style DMA */
> > +				  IDE_HFLAG_NO_AUTOTUNE,
> > +	.mwdma_mask		= ATA_MWDMA2,
> > +	.swdma_mask		= ATA_SWDMA2,
> > +};
> > +
> 
>     Interesting... this driver's support for SWDMA0 is broken since the cycle 
> should be 960 ns long, not 480, and SWDMA2 is underclocked using the same 
> cycle as SWDMA1, 480 ns...

Added Russell to Cc:.

> > Index: b/drivers/ide/cris/ide-cris.c
> > ===================================================================
> > --- a/drivers/ide/cris/ide-cris.c
> > +++ b/drivers/ide/cris/ide-cris.c
> > @@ -753,6 +753,15 @@ static void cris_set_dma_mode(ide_drive_
> >  		cris_ide_set_speed(TYPE_DMA, 0, strobe, hold);
> >  }
> >  
> > +static const struct ide_port_info cris_port_info __initdata = {
> > +	.chipset		= ide_etrax100,
> > +	.host_flags		= IDE_HFLAG_NO_ATAPI_DMA |
> > +				  IDE_HFLAG_NO_DMA, /* no SFF-style DMA */
> > +	.pio_mask		= ATA_PIO4,
> > +	.udma_mask		= cris_ultra_mask,
> 
>     Hm, I wonder which value it will assume, 0x07 or 0?  Not sure even after 
> looking at the source... :-)

This is tricky since it depends on the CRIS version
(0x07 on CRIS V32 and 0x00 on CRIS V10).

> > +	.mwdma_mask		= ATA_MWDMA2,
> > +};
> > +
> >  static int __init init_e100_ide(void)
> >  {
> >  	hw_regs_t hw;
> > Index: b/drivers/ide/ide-probe.c
> > ===================================================================
> > --- a/drivers/ide/ide-probe.c
> > +++ b/drivers/ide/ide-probe.c
> > @@ -1289,12 +1289,86 @@ static void hwif_register_devices(ide_hw
> >  	}
> >  }
> >  
> > -int ide_device_add_all(u8 *idx)
> > +static void ide_init_port(ide_hwif_t *hwif, unsigned int port,
> > +			  const struct ide_port_info *d)
> >  {
> > -	ide_hwif_t *hwif;
> > +	if (d->chipset != ide_etrax100)
> > +		hwif->channel = port;
> 
>    Hm, what's so special about ide_etrax100?

The driver supports *4* channels and it didn't set ->channel at all.

Since in the meantime ide-cris got marked as BROKEN I guess that a patch
removing above code would be OK.

> > +int ide_device_add_all(u8 idx[MAX_HWIFS], const struct ide_port_info *d)
> 
>     Function prototype doesn't match with one from <linux/ide.h> which has the 
> first argument as a pointer...

I fixed it locally, thanks.

> > +{
> > +	ide_hwif_t *hwif, *mate = NULL;
> >  	int i, rc = 0;
> >  
> >  	for (i = 0; i < MAX_HWIFS; i++) {
> > +		if (d == NULL || idx[i] == 0xff) {
> 
>     Why check for (d == NULL) every time and not do it once and break from the 
> loop or even do it before the loop?

To save on some code lines and resulting code size
(ide_device_add_all is not performance critical).

Bart

  reply	other threads:[~2008-02-01 23:23 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-06 17:02 [PATCH 0/8] ide: more IDE probing code rework Bartlomiej Zolnierkiewicz
2008-01-06 17:02 ` [PATCH 1/8] dtc2278: fix ->io_32bit handling Bartlomiej Zolnierkiewicz
2008-01-06 17:02 ` [PATCH 2/8] au1xxx-ide: " Bartlomiej Zolnierkiewicz
2008-01-06 17:02 ` [PATCH 3/8] atiixp/cs5535/scc_pata: fix "idex=ata66" parameter handling Bartlomiej Zolnierkiewicz
2008-01-06 17:02 ` [PATCH 4/8] macide: remove drive->capacity64 quirk Bartlomiej Zolnierkiewicz
2008-01-06 17:02 ` [PATCH 5/8] ide: always set DMA masks in ide_pci_setup_ports() Bartlomiej Zolnierkiewicz
2008-01-29 20:02   ` Sergei Shtylyov
2008-01-06 17:03 ` [PATCH 6/8] ide: separate PCI specific init from generic init " Bartlomiej Zolnierkiewicz
2008-01-06 17:03 ` [PATCH 7/8] ide: add struct ide_port_info instances to legacy host drivers Bartlomiej Zolnierkiewicz
2008-01-28 20:28   ` Sergei Shtylyov
2008-02-01 23:35     ` Bartlomiej Zolnierkiewicz [this message]
2008-02-11 18:36       ` Russell King
2008-02-10 16:07   ` Atsushi Nemoto
2008-02-10 17:04     ` Bartlomiej Zolnierkiewicz
2008-02-10 23:16       ` Bartlomiej Zolnierkiewicz
2008-02-11 12:01         ` Atsushi Nemoto
2008-01-06 17:03 ` [PATCH 8/8] ide: add ->cable_detect method to ide_hwif_t Bartlomiej Zolnierkiewicz
2008-01-12 20:05   ` Sergei Shtylyov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200802020035.30918.bzolnier@gmail.com \
    --to=bzolnier@gmail.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rmk@arm.linux.org.uk \
    --cc=sshtylyov@ru.mvista.com \
    --subject='Re: [PATCH 7/8] ide: add struct ide_port_info instances to legacy host drivers' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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