[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20070814103013.6899813f@the-village.bc.nu>
Date: Tue, 14 Aug 2007 10:30:13 +0100
From: Alan Cox <alan@...rguk.ukuu.org.uk>
To: "Sonic Zhang" <sonic.adi@...il.com>
Cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH again] [libata] libata driver for bf548 on chip ATAPI
controller.
> +/**
> + * Register transfer timing table
> + */
Libata has a complete set of transfer mode tables and timing functions -
any reason for not using them ?
> + /* increase tcyc - tdvs (tcyc_tdvs) until we
> meed
> + * the minimum cycle length
> + */
> + while ( (tdvs + tcyc_tdvs) < tcyc ) {
> + tcyc_tdvs++;
> + }
Why not
if ((tdvs + tcyc_tvds) < tcyc)
tcyc_tdvs = tcyc - tdvs;
> + /* increase tk until we meed the minimum cycle
> length */
> + while ( (tkw+td) < n0 ) {
> + tkw++;
> + }
if (tkw + td < n0)
tkw = n0 - td;
(and fix up brackets)
>
> +static void inline wait_complete(unsigned long base, unsigned short
> mask)
> +{
> + unsigned short status;
> +
> + do {
> + status = ATAPI_GET_INT_STATUS(base) & mask;
> + } while (!status);
Does this need a timeout or can a device write never get stuck ?
> +static int bfin_port_start(struct ata_port *ap)
> +{
> + pr_debug("in atapi port start\n");
> + if (ap->udma_mask != 0 || ap->mwdma_mask != 0) {
> + if (request_dma(CH_ATAPI_RX, "BFIN ATAPI RX DMA") >= 0)
> {
> + if (request_dma(CH_ATAPI_TX,
> + "BFIN ATAPI TX DMA") >= 0) {
> + return 0;
> + }
> + free_dma(CH_ATAPI_RX);
> + }
> + ap->udma_mask = 0;
> + ap->mwdma_mask = 0;
> + dev_err(ap->dev, "Unable to request ATAPI DMA!\n");
> + return -EBUSY;
Is this an error case - if you clear the UDMA/MWDMA mask then DMA won't
be needed will it so you can continue after the problem but slowly ?
Otherwise looks sound. A lot of reset method duplication but that isn't
your fault and something that wants more work in libata to avoid
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists