Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754494AbbDUHfm (ORCPT ); Tue, 21 Apr 2015 03:35:42 -0400 Received: from mail-wi0-f175.google.com ([209.85.212.175]:33640 "EHLO mail-wi0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752421AbbDUHfj (ORCPT ); Tue, 21 Apr 2015 03:35:39 -0400 Date: Tue, 21 Apr 2015 08:35:34 +0100 From: Lee Jones To: York Sun Cc: Julia.Lawall@lip6.fr, linux-i2c@vger.kernel.org, wolfram@the-dreams.de, linux-kernel@vger.kernel.org Subject: Re: Need some guidance on i2c-ocores driver Message-ID: <20150421073534.GK3447@x1> References: <55304D8E.8070204@freescale.com> <55312AF7.7070504@freescale.com> <20150420064231.GE3447@x1> <55352839.70905@freescale.com> <20150420181651.GF3447@x1> <5535460B.2060309@freescale.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <5535460B.2060309@freescale.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1637 Lines: 36 > >> mfd_add_devices() is called, it uses &dev->resource as the base. So the BAR will > >> be the parent. Check the code in mfd-core.c, mfd_add_device(), > >> > >> if ((cell->resources[r].flags & IORESOURCE_MEM) && mem_base) { > >> res[r].parent = mem_base; > >> res[r].start = mem_base->start + cell->resources[r].start; > >> res[r].end = mem_base->start + cell->resources[r].end; > >> } > >> > >> So the MFD resource is within its parent. When later the device driver request a > >> region, will it get conflict with the parent? > > > > I doubt you'll want to map the same memory area in both the parent and > > the child device drivers. Only map the registers you plan to use in > > the driver you plan to use them. If you need multiple devices to > > access the same registers then you need to create an API, complete > > with locking, in the MFD parent device. > > Thanks for pointing out. I thought at first the conflict was due to my > pci_ioremap_bar(). I went ahead to remove the mapping but still not working. > Your email inspired me to take a deeper look at my code and I found my error. I > have called pci_request_regions() which reserves all BARs. I think that's my > root cause. Thanks for helping me. You are welcome. -- Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/