From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751693AbdENIid (ORCPT ); Sun, 14 May 2017 04:38:33 -0400 Received: from mail-out.m-online.net ([212.18.0.10]:56731 "EHLO mail-out.m-online.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751163AbdENIia (ORCPT ); Sun, 14 May 2017 04:38:30 -0400 X-Auth-Info: DldFz7hCxd2hOjYvvW9kuGIydE5O1z7F2POv/AfFxH8= Date: Sun, 14 May 2017 10:38:19 +0200 From: Anatolij Gustschin To: Andy Shevchenko Cc: linux-fpga@vger.kernel.org, Alan Tull , Moritz Fischer , matthew.gerlach@linux.intel.com, yi1.li@linux.intel.com, "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v4] fpga manager: Add Altera CvP driver Message-ID: <20170514103819.3035ef0e@crub> In-Reply-To: References: <1493579317-28608-1-git-send-email-agust@denx.de> <20170502115308.1e2f1233@crub> <20170503021439.6d812223@crub> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 3 May 2017 18:01:19 +0300 Andy Shevchenko andy.shevchenko@gmail.com 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