From patchwork Sat Feb 11 12:52:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 726841 X-Patchwork-Delegate: blogic@openwrt.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from arrakis.dune.hu (arrakis.dune.hu [78.24.191.176]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vLBYf6jWbz9s83 for ; Sat, 11 Feb 2017 23:52:54 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="i0gk7H36"; dkim-atps=neutral Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 70557B913AE; Sat, 11 Feb 2017 13:52:50 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on arrakis.dune.hu X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP; Sat, 11 Feb 2017 13:52:50 +0100 (CET) Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 6F684B800FD for ; Sat, 11 Feb 2017 13:52:48 +0100 (CET) X-policyd-weight: using cached result; rate: -7 Received: from mail-lf0-f48.google.com (mail-lf0-f48.google.com [209.85.215.48]) by arrakis.dune.hu (Postfix) with ESMTPS for ; Sat, 11 Feb 2017 13:52:47 +0100 (CET) Received: by mail-lf0-f48.google.com with SMTP id v186so34151707lfa.1 for ; Sat, 11 Feb 2017 04:52:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=Rn725KPV080C7gTwQdf50qrGsY+K+KtGgrGvC5pto2c=; b=i0gk7H36dkKcF5KWwUpfqYW6lKDUMAR3OKZFKoHLjx1+6YE28ulfReZceHgDPba2Cm o0GfMAE4AIT47Xz/b/rOxKfpZ8svv6ZSimTueCGVtK3ts5w1xKeU1vHVsRffmXzf3zab rXy9WGghOgtgRYM5UR2mHJtT79W6g9WGZsbdk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Rn725KPV080C7gTwQdf50qrGsY+K+KtGgrGvC5pto2c=; b=Tcjhpcn9hgS/HwfFjYFuTcgQRmr01Xfw3GaA18RxvkmUbf5AwH0T+TMkbRQC93Es6Q uT1iMXEED4wGZf2s0L0b9ep+TQojafUdV/LVTgRJCZLlXqgE+Vo5aJQsR3uUhy1k4OXE uUmQlawm65W6bj0F7QGqca15M5Qblfe4jlWAjf5eIZbNMw8ZW59hxI29VkN8wdbuyv4e XQ2HPLzBHYq60MZLgfZb20lY4xs1HZ2+xNIFchvN8unOTHbRGBI+uTsmvmSxrdRQJ1wE IKMtLDyj8IG5vMJ90ftGGB7XKSondXEOYzdRc8985dUukb7QG+ubj3xa1PE87A0O1QFi yfqA== X-Gm-Message-State: AMke39m6YG8Xz0CqntvuNTinQhqX3lAHXYVWgBBchcTiPqj0w3cfzT5nwrinoyg+aw9nu8po X-Received: by 10.46.9.146 with SMTP id 140mr555099ljj.95.1486817566220; Sat, 11 Feb 2017 04:52:46 -0800 (PST) Received: from localhost.localdomain (c-357171d5.014-348-6c756e10.cust.bredbandsbolaget.se. [213.113.113.53]) by smtp.gmail.com with ESMTPSA id c65sm1276410ljd.44.2017.02.11.04.52.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 11 Feb 2017 04:52:44 -0800 (PST) From: Linus Walleij To: Hans Ulli Kroll , Florian Fainelli , Rob Herring , devicetree@vger.kernel.org, Bjorn Helgaas , Gavin Guo , Macpaul Lin Date: Sat, 11 Feb 2017 13:52:17 +0100 Message-Id: <20170211125220.10273-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.9.3 Subject: [OpenWrt-Devel] [PATCH 1/4] PCI: add DT bindings for Faraday Technology PCI Host Bridge X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: openwrt-devel@openwrt.org, Feng-Hsin Chiang , Paulius Zaleckas , linux-pci@vger.kernel.org, Janos Laube , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Errors-To: openwrt-devel-bounces@lists.openwrt.org Sender: "openwrt-devel" This adds device tree bindings for the Faraday technology PCI Host Bridge. This IP is found in the Storlink/Storm/Cortina Gemini SoC platform. Cc: Janos Laube Cc: Paulius Zaleckas Cc: Hans Ulli Kroll Cc: Florian Fainelli Cc: devicetree@vger.kernel.org Cc: Gavin Guo Cc: Macpaul Lin Cc: Feng-Hsin Chiang Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - Rename from Cortina prefixes to Faraday. This is clearly a Faraday IP block. - Support both the version with cascaded interrupts and the "dual" version with 1-to-1 mapped interrupts. - Change bus-range to <0x00 0xff> - Fix spelling mistake - Write a bit about swizzling interrupts on the interrupt controller side - Reasonable swizzling in the interrupt mapping example This can be merged to the PCI tree whenever it is considered fine for inclusion. --- .../devicetree/bindings/pci/faraday-pci.txt | 113 +++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 Documentation/devicetree/bindings/pci/faraday-pci.txt diff --git a/Documentation/devicetree/bindings/pci/faraday-pci.txt b/Documentation/devicetree/bindings/pci/faraday-pci.txt new file mode 100644 index 000000000000..5fbb0fc6b758 --- /dev/null +++ b/Documentation/devicetree/bindings/pci/faraday-pci.txt @@ -0,0 +1,113 @@ +Faraday Technology PCI Host Bridge + +This PCI bridge is found inside that Cortina Systems Gemini SoC platform and +is a generic IP block from Faraday Technology. It exists in two variants: +plain and dual PCI. The plain version embeds a cascading interrupt controller +into the host bridge. The dual version routes the interrupts to the host +chips interrupt controller. + +The host controller appear on the PCI bus with vendor ID 0x159b (Faraday +Technology) and product ID 0x4321. + +Mandatory properties: + +- compatible: should be one of + "faraday,pci" + "faraday,dual-pci" +- reg: memory base and size for the host bridge +- #address-cells: set to <3> +- #size-cells: set to <2> +- #interrupt-cells: set to <1> +- bus-range: set to <0x00 0xff> +- device_type, set to "pci" +- ranges: see pci.txt +- interrupt-map-mask: see pci.txt +- interrupt-map: see pci.txt + +Mandatory subnodes: +- For "faraday,pci" a node representing the interrupt-controller inside the + host bridge is mandatory. It has the following mandatory properties: + - interrupt: see interrupt-controller/interrupts.txt + - interrupt-parent: see interrupt-controller/interrupts.txt + - interrupt-controller: see interrupt-controller/interrupts.txt + - #address-cells: set to <0> + - #interrupt-cells: set to <1> + +I/O space considerations: + +The plain variant has 128MiB of non-prefetchable memory space, whereas the +"dual" variant has 64MiB. Take this into account when describing the ranges. + +Interrupt map considerations: + +The "dual" variant will get INT A, B, C, D from the system interrupt controller +and should point to respective interrupt in that controller in its +interrupt-map. + +The code which is the only documentation of how the Faraday PCI (the non-dual +variant) interrupts assigns the default interrupt mapping/swizzling has +typically been like this, doing the swizzling on the interrupt controller side +rather than in the interconnect: + +interrupt-map-mask = <0xf800 0 0 7>; +interrupt-map = + <0x4800 0 0 1 &pci_intc 0>, /* Slot 9 */ + <0x4800 0 0 2 &pci_intc 1>, + <0x4800 0 0 3 &pci_intc 2>, + <0x4800 0 0 4 &pci_intc 3>, + <0x5000 0 0 1 &pci_intc 1>, /* Slot 10 */ + <0x5000 0 0 2 &pci_intc 2>, + <0x5000 0 0 3 &pci_intc 3>, + <0x5000 0 0 4 &pci_intc 0>, + <0x5800 0 0 1 &pci_intc 2>, /* Slot 11 */ + <0x5800 0 0 2 &pci_intc 3>, + <0x5800 0 0 3 &pci_intc 0>, + <0x5800 0 0 4 &pci_intc 1>, + <0x6000 0 0 1 &pci_intc 3>, /* Slot 12 */ + <0x6000 0 0 2 &pci_intc 0>, + <0x6000 0 0 3 &pci_intc 1>, + <0x6000 0 0 4 &pci_intc 2>; + +Example: + +pci@50000000 { + compatible = "faraday,pci"; + reg = <0x50000000 0x100>; + interrupts = <8 IRQ_TYPE_LEVEL_HIGH>, /* PCI A */ + <26 IRQ_TYPE_LEVEL_HIGH>, /* PCI B */ + <27 IRQ_TYPE_LEVEL_HIGH>, /* PCI C */ + <28 IRQ_TYPE_LEVEL_HIGH>; /* PCI D */ + #address-cells = <3>; + #size-cells = <2>; + #interrupt-cells = <1>; + + bus-range = <0x00 0xff>; + ranges = /* 1MiB I/O space 0x50000000-0x500fffff */ + <0x01000000 0 0 0x50000000 0 0x00100000>, + /* 128MiB non-prefetchable memory 0x58000000-0x5fffffff */ + <0x02000000 0 0x58000000 0x58000000 0 0x08000000>; + interrupt-map-mask = <0xf800 0 0 7>; + interrupt-map = + <0x4800 0 0 1 &pci_intc 0>, /* Slot 9 */ + <0x4800 0 0 2 &pci_intc 1>, + <0x4800 0 0 3 &pci_intc 2>, + <0x4800 0 0 4 &pci_intc 3>, + <0x5000 0 0 1 &pci_intc 1>, /* Slot 10 */ + <0x5000 0 0 2 &pci_intc 2>, + <0x5000 0 0 3 &pci_intc 3>, + <0x5000 0 0 4 &pci_intc 0>, + <0x5800 0 0 1 &pci_intc 2>, /* Slot 11 */ + <0x5800 0 0 2 &pci_intc 3>, + <0x5800 0 0 3 &pci_intc 0>, + <0x5800 0 0 4 &pci_intc 1>, + <0x6000 0 0 1 &pci_intc 3>, /* Slot 12 */ + <0x6000 0 0 2 &pci_intc 0>, + <0x6000 0 0 3 &pci_intc 0>, + <0x6000 0 0 4 &pci_intc 0>; + pci_intc: interrupt-controller { + interrupt-parent = <&intcon>; + interrupt-controller; + #address-cells = <0>; + #interrupt-cells = <1>; + }; +};