From: "Sonic Zhang" <sonic.adi@gmail.com>
To: "Alan Cox" <alan@lxorguk.ukuu.org.uk>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH again] [libata] libata driver for bf548 on chip ATAPI controller.
Date: Wed, 15 Aug 2007 14:54:57 +0800 [thread overview]
Message-ID: <4e5ebad50708142354l7a462684x7dbf84b4bac1fcb0@mail.gmail.com> (raw)
In-Reply-To: <4e5ebad50708142314o6bb64b6bocf75166cb9999205@mail.gmail.com>
forgot to reply to all.
On 8/15/07, Sonic Zhang <sonic.adi@gmail.com> wrote:
> On 8/14/07, Alan Cox <alan@lxorguk.ukuu.org.uk> wrote:
> > > +/**
> > > + * Register transfer timing table
> > > + */
> >
> > Libata has a complete set of transfer mode tables and timing functions -
> > any reason for not using them ?
>
> These code are from the sample code in hardware manual. I will check
> the libata source to see if I can rewrite them in libata functions.
>
> >
> >
> > > + /* 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)
>
> Yes, your suggestion is better.
>
> > >
> > > +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 ?
>
> The hardware manual says whenever an ATAPI operation is done or
> terminated in error by the devices, a bit in the status register is
> set. Is a timeout still necessary?
>
>
> >
> > > +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 ?
>
> UDMA/MWDMA masks are set in ata_host_alloc_pinfo(), where it is
> cleared? If these masks are cleared before port starts, this driver
> falls back to PIO mode. Why this is an error case?
>
>
> >
> > 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
> >
> >
>
next prev parent reply other threads:[~2007-08-15 6:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1187056118.16255.1.camel@sevens.analog.com>
2007-08-14 2:25 ` Sonic Zhang
2007-08-14 9:30 ` Alan Cox
[not found] ` <4e5ebad50708142314o6bb64b6bocf75166cb9999205@mail.gmail.com>
2007-08-15 6:54 ` Sonic Zhang [this message]
2007-08-15 8:55 ` Sonic Zhang
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=4e5ebad50708142354l7a462684x7dbf84b4bac1fcb0@mail.gmail.com \
--to=sonic.adi@gmail.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=linux-kernel@vger.kernel.org \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®