From: "Jung-Ik (John) Lee" <jilee@google.com>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: Robert Hancock <hancockrwd@gmail.com>,
Daniel Walker <dwalker@fifo99.com>,
linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org,
Grant Grundler <grundler@google.com>,
Gwendal Grignou <gwendal@google.com>,
Eric Uhrhane <ericu@google.com>
Subject: Re: [PATCH] libata: Add pata_atp867x driver for Artop/Acard ATP867X controllers
Date: Sat, 12 Sep 2009 21:55:33 -0700 [thread overview]
Message-ID: <8b5805ff0909122155u77a869c5t89a81fbf1a7eb391@mail.gmail.com> (raw)
In-Reply-To: <4AAC632E.3090902@pobox.com>
On Sat, Sep 12, 2009 at 8:12 PM, Jeff Garzik <jgarzik@pobox.com> wrote:
> On 09/12/2009 10:41 PM, Jung-Ik (John) Lee wrote:
>>
>> On Sat, Sep 12, 2009 at 5:55 PM, Jeff Garzik<jgarzik@pobox.com> wrote:
>>>
>>>
>>> General comment:
>>>
>>> * since you use iomap to map the region, you should use ioread{8,16,32} /
>>> iowrite{8,16,32} accessors. Do not use inb/outb/inl/outl/etc.
>>
>> .
>> I used them for runtime hot registers by separately mapping them
>> simply to avoid an extra overhead of ioread/iowrite, over the
>> portability.
>> I know it's not a good idea but in this case for these hot ports can
>> in/out be used?
>
> It is _highly_ unlikely that the overhead is even measureable above the
> noise, I would think. Do you have data showing that ioread/iowrite impose a
> noticeable penalty?
I agree in that it's hard to measure/signify the additional overhead,
since those io insts are already too slow.
Anyways, the two extra "if"s and one PIO_MASK on every ioread/iowrite
are pure overhead on top of in/out insts.
Thanks,
-John
>
>
>>
>>
>>>
>>> * run through scripts/checkpatch.pl
>>>
>>
>> Weird. I don't see any WS issues you pointed below in my source code
>> or git diff file, except UT = T/4 below.
>
> My apologies; most of those appear to be problems with Thunderbird. I think
> it renders <tab> incorrectly.
>
>
>>>> +static void atp867x_set_dmamode(struct ata_port *ap, struct ata_device
>>>> *adev)
>>>> +{
>>>> + struct pci_dev *pdev = to_pci_dev(ap->host->dev);
>>>> + struct atp867x_priv *dp = ap->private_data;
>>>> + u8 speed = adev->dma_mode;
>>>> + u8 b;
>>>> + u8 mode;
>>>> +
>>>> +
>>>> + switch (speed) {
>>>> + case XFER_UDMA_6:
>>>> + mode = ATP867X_IO_DMAMODE_UDMA_6;
>>>> + break;
>>>> + case XFER_UDMA_5:
>>>> + mode = ATP867X_IO_DMAMODE_UDMA_5;
>>>> + break;
>>>> + case XFER_UDMA_4:
>>>> + mode = ATP867X_IO_DMAMODE_UDMA_4;
>>>> + break;
>>>> + case XFER_UDMA_3:
>>>> + mode = ATP867X_IO_DMAMODE_UDMA_3;
>>>> + break;
>>>> + case XFER_UDMA_2:
>>>> + mode = ATP867X_IO_DMAMODE_UDMA_2;
>>>> + break;
>>>> + case XFER_UDMA_1:
>>>> + mode = ATP867X_IO_DMAMODE_UDMA_1;
>>>> + break;
>>>> + case XFER_UDMA_0:
>>>> + mode = ATP867X_IO_DMAMODE_UDMA_0;
>>>> + break;
>>>> + default:
>>>> + printk(KERN_WARNING "ATP867X: Unsupported speed %#x."
>>>> + " Default to XFER_UDMA_0.\n", (unsigned)speed);
>>>> + mode = ATP867X_IO_DMAMODE_UDMA_0;
>>>
>>> a table would be nice, preferred over a switch statement. You may use
>>> ARRAY_SIZE() macro to generate a constant at compile time for number of
>>> elements in array.
>>
>> OK. I had it in a pure math like mode = speed - XFER_UDMA_0 +1;
>
> That's fine too.
>
>
>
>
>>>> + /*
>>>> + * Broken BIOS might not set latency high enough
>>>> + */
>>>> + pci_read_config_byte(pdev, PCI_LATENCY_TIMER,&v);
>>>> + if (v< 0x80) {
>>>> + v = 0x80;
>>>> + pci_write_config_byte(pdev, PCI_LATENCY_TIMER, v);
>>>> + printk(KERN_DEBUG "ATP867X: set latency timer of device
>>>> %s"
>>>> + " to %d\n", pci_name(pdev), v);
>>>> + }
>>>
>>> this seems pointless - pci_set_master() already does this
>>>
>> pci_set_master won't re-set it if BIOS set it to somewhere between 16
>> and 256. This controller wants 0x80.
>> so, if BIOS set to less than 0x80, like 0x20, pci_set_master will keep
>> the value.
>> I could do this via pci fixup or quirks but that seems too much for
>> this simple setting.
>
> Given your explanation, that's fine.
>
> Jeff
>
>
>
>
next prev parent reply other threads:[~2009-09-13 4:55 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-12 2:06 Jung-Ik (John) Lee
2009-09-12 2:14 ` Daniel Walker
2009-09-12 10:59 ` Jung-Ik (John) Lee
2009-09-12 16:49 ` Robert Hancock
2009-09-13 0:17 ` Jung-Ik (John) Lee
2009-09-13 0:26 ` Jung-Ik (John) Lee
2009-09-13 0:31 ` Jeff Garzik
2009-09-13 0:37 ` Jung-Ik (John) Lee
2009-09-13 0:55 ` Jeff Garzik
2009-09-13 2:41 ` Jung-Ik (John) Lee
2009-09-13 3:12 ` Jeff Garzik
2009-09-13 4:55 ` Jung-Ik (John) Lee [this message]
2009-09-13 5:50 ` Robert Hancock
2009-09-15 4:32 ` Jung-Ik (John) Lee
2009-09-17 20:51 ` Jeff Garzik
2009-09-13 0:38 ` Jeff Garzik
2009-09-13 0:50 ` Jung-Ik (John) Lee
2009-09-15 0:38 ` Alan Cox
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=8b5805ff0909122155u77a869c5t89a81fbf1a7eb391@mail.gmail.com \
--to=jilee@google.com \
--cc=dwalker@fifo99.com \
--cc=ericu@google.com \
--cc=grundler@google.com \
--cc=gwendal@google.com \
--cc=hancockrwd@gmail.com \
--cc=jgarzik@pobox.com \
--cc=linux-ide@vger.kernel.org \
--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®