Re: [PATCH v4] fpga manager: Add Altera CvP driver
From: Anatolij Gustschin
Date: Sun May 14 2017 - 04:38:40 EST
On Wed, 3 May 2017 18:01:19 +0300
Andy Shevchenko andy.shevchenko@xxxxxxxxx wrote:
...
>> when 12 LSBs are zero, the bytes value has been decremented by
>> 4k, meaning that a new 4k data block has been written. Only
>> then the error checking is performed.
>
>If the size is less than 4k...?
then the final check below will catch it. And I doubt that config
images can be so small. The lowest size I've ever seen is more
than 1MiB.
...
>>>> pci config space access works without enabling the pci device,
>>>> writing commands to config space enables the device first. It is done
>>>> some lines below which you deleted when commenting (please see original
>>>> patch).
>>>
>>>Your comment didn't clarify what's going on along these lines.
>>>
>>>I checked original patch, I didn't find any type of
>>>pci_enable_device() call.
>>
>
>> I mean this part (instead of pci_enable_device()):
>
>> + /* Enable memory BAR access */
>> + pci_read_config_word(pdev, PCI_COMMAND, &cmd);
>> + if (!(cmd & PCI_COMMAND_MEMORY)) {
>> + cmd |= PCI_COMMAND_MEMORY;
>> + pci_write_config_word(pdev, PCI_COMMAND, cmd);
>> + }
>
>I see this code is used somewhere else (several places I suppose,
>drivers/video/fbdev/aty/atyfb_base.c is one of them).
other places set or clean additional pci command flags, use
different pci config accessors or contain debug code. And I reuse
pre-initialized cmd in the error path, so the usage pattern here
is not the same as in the atyfb_base driver.
--
Anatolij