Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp5110606ybc; Tue, 26 Nov 2019 21:46:50 -0800 (PST) X-Google-Smtp-Source: APXvYqyos0GdEigJQ7tROzhqTZA7VXY3X0BPBrxnrR/eZ8c02JqvKZbwR6SFeP0e7txLV/LPLCKg X-Received: by 2002:a05:6402:2058:: with SMTP id bc24mr30120946edb.2.1574833610799; Tue, 26 Nov 2019 21:46:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574833610; cv=none; d=google.com; s=arc-20160816; b=Fx53cTJd0n8H4OCGHSBr4BL4XIztnfSPZvlA7KR0ykPLUGdidYITJ0zqA6KewVmWwL vtVGDW+NndirFUCU/Rs2c+n3L0ldPzaxH/t/0QY59qcJptJrcUB/OS30fZcj6xBELYVI kjay4MlvntwECkUd5BS1jw6fDtAarRZI9uVz2DaDu8olL57VaUIR82lm+9ZZTwRMz6Vm j/Jg76YNffJCKBMRBcxO88564iu4evl6klJTecUtu91N88UwLXbBaXEJOPSgNoq4Jib6 uSFylQzGDRShdP4lRJP15IbKujXmBegVQicNYwu1FqV0zAcRoqmJqwzICUqzMVriTx3B UUOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=ghIhQuJ9aHS97LO4zAtdQCLPCJDJTY7NbKzwS6TyyAw=; b=ot0vgE/sqxpIwa5Yb/BOypA45RCz1zHO07ccMzPE5SgzaxnRMTG+b4AzL502joOZ2R Ce8WiRdCUMI7sCC15P/s9bo/6G2YmZ17ohnXi5+ze6dCppK6MJlUyOjQdhmOfGrYlTSK rR0ETtQWEa4Ro7Q7yBnHy6qf8Ue1WxLkre7eVmHXJmDKk06nPil5yyAzyN8UvCJMOOgz N4bzBYrsgYfWa//kehFFTLPuCUbq+k1+DK7hjwqhwltaeRjLHZ3XyXR1JwwqVNtleM8B VqL3bDaN/mre2aNCxXCUzn77YEgwuefrknzAZXFDWs19J356+ifFxT+weLswel6akzqN Ashw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=qndVf33Y; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w21si8354247eja.324.2019.11.26.21.46.26; Tue, 26 Nov 2019 21:46:50 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=qndVf33Y; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726634AbfK0FpY (ORCPT + 99 others); Wed, 27 Nov 2019 00:45:24 -0500 Received: from fllv0016.ext.ti.com ([198.47.19.142]:48138 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726092AbfK0FpY (ORCPT ); Wed, 27 Nov 2019 00:45:24 -0500 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id xAR5iw31020018; Tue, 26 Nov 2019 23:44:58 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1574833498; bh=ghIhQuJ9aHS97LO4zAtdQCLPCJDJTY7NbKzwS6TyyAw=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=qndVf33YNLkQZU0nWotc7RdalzlFQ+JstoxF8ycG9eZBnDYfY/9carjo8SclfjI4X j7o7vWluLgW7LnpKzrtc4uwH7N7pAKZHZl8RyJCZFurCkosFACCMWgNW7VwRkjky9H 7zU+CnLxcJxErGfyfY9QjF2lQdJhb6HJnbDh4Nis= Received: from DLEE113.ent.ti.com (dlee113.ent.ti.com [157.170.170.24]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id xAR5iwf4108619 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 26 Nov 2019 23:44:58 -0600 Received: from DLEE103.ent.ti.com (157.170.170.33) by DLEE113.ent.ti.com (157.170.170.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3; Tue, 26 Nov 2019 23:44:58 -0600 Received: from fllv0040.itg.ti.com (10.64.41.20) by DLEE103.ent.ti.com (157.170.170.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3 via Frontend Transport; Tue, 26 Nov 2019 23:44:58 -0600 Received: from [10.24.69.157] (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id xAR5iocX018864; Tue, 26 Nov 2019 23:44:51 -0600 Subject: Re: [PATCH 3/5] PCI: rcar: Add R-Car PCIe endpoint device tree bindings To: Rob Herring , Geert Uytterhoeven CC: "Lad, Prabhakar" , Bjorn Helgaas , Mark Rutland , Magnus Damm , Marek Vasut , Yoshihiro Shimoda , linux-pci , Catalin Marinas , Will Deacon , Lorenzo Pieralisi , Arnd Bergmann , Greg Kroah-Hartman , Andrew Murray , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Linux Kernel Mailing List , Linux ARM , Linux-Renesas , Chris Paterson , "Lad, Prabhakar" References: <20191106193609.19645-1-prabhakar.mahadev-lad.rj@bp.renesas.com> <20191106193609.19645-4-prabhakar.mahadev-lad.rj@bp.renesas.com> <20191113040802.GA8269@bogus> From: Kishon Vijay Abraham I Message-ID: <3b218f7f-78a8-c158-80ac-67a3b9f5970c@ti.com> Date: Wed, 27 Nov 2019 11:14:08 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <20191113040802.GA8269@bogus> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 13/11/19 9:38 AM, Rob Herring wrote: > On Thu, Nov 07, 2019 at 09:08:35PM +0100, Geert Uytterhoeven wrote: >> Hi Prabhakar, >> >> On Thu, Nov 7, 2019 at 10:26 AM Lad, Prabhakar >> wrote: >>> On Thu, Nov 7, 2019 at 8:44 AM Geert Uytterhoeven wrote: >>>> On Wed, Nov 6, 2019 at 8:36 PM Lad Prabhakar wrote: >>>>> From: "Lad, Prabhakar" >>>>> >>>>> This patch adds the bindings for the R-Car PCIe endpoint driver. >>>>> >>>>> Signed-off-by: Lad, Prabhakar >>>> >>>> Thanks for your patch! >>>> >>>>> --- /dev/null >>>>> +++ b/Documentation/devicetree/bindings/pci/rcar-pci-ep.txt >>>>> @@ -0,0 +1,43 @@ >>>>> +* Renesas R-Car PCIe Endpoint Controller DT description >>>>> + >>>>> +Required properties: >>>>> + "renesas,pcie-ep-r8a774c0" for the R8A774C0 SoC; >>>>> + "renesas,pcie-ep-rcar-gen3" for a generic R-Car Gen3 or >>>>> + RZ/G2 compatible device. >>>> >>>> Unless I'm missing something, this is for the exact same hardware block as >>>> Documentation/devicetree/bindings/pci/rcar-pci.txt? >>>> So shouldn't you amend those bindings, instead of adding new compatible >>>> values? >>>> Please remember that DT describes hardware, not software policy. >>>> So IMHO choosing between host and endpoint is purely a configuration >>>> issue, and could be indicated by the presence or lack of some DT properties. >>>> E.g. host mode requires both "bus-range" and "device_type" properties, >>>> so their absence could indicate endpoint mode. >>>> >>> yes its the same hardware block as described in the rcar-pci.txt, I >>> did think about amending it >>> but it might turn out to be bit messy, >>> >>> required properties host ======required properties Endpoint >>> ====================||================== >>> 1: reg || reg >>> 2:bus-range || reg names >>> 3: device_type || resets >>> 4: ranges || clocks >>> 5: dma-ranges || clock-names >>> 6: interrupts || >>> 7: interrupt-cells || >>> 8: interrupt-map-mask || >>> 9: clocks || >>> 10: clock-names || >> >> We have a similar situation with SPI, where a controller can operate in >> master or slave mode, based on the absence or presence of the >> "spi-slave" DT property. >> >>> and if I go ahead with the same compatible string that would mean to >>> add support for endpoint >>> mode in the host driver itself. I did follow the examples of >> >> You can still have two separate drivers, binding against the same >> compatible value. Just let the .probe() function return -ENODEV if it >> discovers (by looking at DT properties) if the node is configured for >> the other mode. >> Which brings us to my next questions: is there any code that could be >> shared between the drivers for the two modes? >> >>> rockchip/cadence/designware where >>> its the same hardware block but has two different binding files one >>> for host mode and other for >>> endpoint mode. >> >> Having two separate DT binding documents sounds fine to me, if unifying >> them makes things too complex. >> However, I think they should use the same compatible value, because the >> hardware block is the same, but just used in a different mode. >> >> Rob/Mark: Any input from the DT maintainers? > > Separate files makes sense because different modes will want to > include different common schemas. We've generally been doing different > compatibles too which makes validating the node has the right set of > properties easier. > >>>>> +- reg: Five register ranges as listed in the reg-names property >>>>> +- reg-names: Must include the following names >>>>> + - "apb-base" >>>>> + - "memory0" >>>>> + - "memory1" >>>>> + - "memory2" >>>>> + - "memory3" >>>> >>>> What is the purpose of the last 4 regions? >>>> Can they be chosen by the driver, at runtime? >>>> >>> no the driver cannot choose them at runtime, as these are the only >>> PCIE memory(0/1/2/3) ranges >>> in the AXI address space where host memory can be mapped. >> >> Are they fixed by the PCIe hardware, i.e. could they be looked up by the >> driver based on the compatible value? > > That would be strange for a memory range. > > Sounds like like 'ranges' though I'm not sure if 'ranges' for an EP > makes sense or what that should look like. These are similar to "memory node" with multiple address, size pairs. I'm thinking if these should be added as a subnode within PCIe EP controller device tree node? Thanks Kishon