From patchwork Tue Dec 8 20:44:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 7802271 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 510AF9F387 for ; Tue, 8 Dec 2015 20:46:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6611320453 for ; Tue, 8 Dec 2015 20:46:56 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7F81E2042B for ; Tue, 8 Dec 2015 20:46:55 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1a6P88-0008TQ-MT; Tue, 08 Dec 2015 20:45:00 +0000 Received: from mail-ob0-f178.google.com ([209.85.214.178]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1a6P7u-0008OF-7C for linux-arm-kernel@lists.infradead.org; Tue, 08 Dec 2015 20:44:47 +0000 Received: by obciw8 with SMTP id iw8so21211476obc.1 for ; Tue, 08 Dec 2015 12:44:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=vJYs7arFWk9q1W0Ut6dGGZAb4K5JAPXC64Kzm0kLd/U=; b=eNtmDBzLvPUDh9Pc1oUtCd3mz1gNBdJ3+WDS2yksqdA+DnM3T31u9cqPo7w0bRWWr3 toD26CLjA1GCl67axAP5D6erwEBJ5TsW4mqheKAVS6CidNQPIv74+wOUKblV0YIACWzB any6pLkBn25X4Bu2ZCtsYD0gRKJ49U58MNrC6NLFlnVxZi3gRc1S+lTQSBZXcEgtiKdm qj5csLCp9DpqWh7V/f+R0jRkncArXprpTaWc5O/aAk8RpCwP3bkU6U9FKsBIMF2gGcNx 9Z6IUQr7OBaKKvMkyVpz4jvHZbIC0vLBhwgxaAd3SX0XFPhVD0zlL/lDPll+7QTeCH2J 7k6g== X-Received: by 10.60.150.237 with SMTP id ul13mr1399832oeb.49.1449607465396; Tue, 08 Dec 2015 12:44:25 -0800 (PST) Received: from rob-hp-laptop.herring.priv (72-48-98-129.dyn.grandenetworks.net. [72.48.98.129]) by smtp.googlemail.com with ESMTPSA id ct9sm2033801oec.15.2015.12.08.12.44.24 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 08 Dec 2015 12:44:25 -0800 (PST) From: Rob Herring To: Arnd Bergmann , Linus Walleij Subject: [PATCH 1/4] ARM: versatile: add DT based PCI detection Date: Tue, 8 Dec 2015 14:44:15 -0600 Message-Id: <1449607458-16850-2-git-send-email-robh@kernel.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1449607458-16850-1-git-send-email-robh@kernel.org> References: <1449607458-16850-1-git-send-email-robh@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151208_124446_370481_2124EE15 X-CRM114-Status: GOOD ( 13.93 ) X-Spam-Score: -2.4 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Russell King , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Disable the Versatile PCI DT node when no PCI backplane is detected. This will prevent the Versatile PCI driver from probing when PCI is not populated. Signed-off-by: Rob Herring Cc: Russell King Cc: Linus Walleij --- arch/arm/mach-versatile/versatile_dt.c | 50 ++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/arch/arm/mach-versatile/versatile_dt.c b/arch/arm/mach-versatile/versatile_dt.c index 7de3e92..a585758 100644 --- a/arch/arm/mach-versatile/versatile_dt.c +++ b/arch/arm/mach-versatile/versatile_dt.c @@ -22,15 +22,65 @@ */ #include +#include +#include +#include #include #include +#include #include #include #include "core.h" +#define VERSATILE_SYS_PCICTL_OFFSET 0x44 +static void __iomem *versatile_sys_base; + +static void __init versatile_dt_pci_init(void) +{ + u32 val; + struct device_node *np; + struct property *newprop; + + np = of_find_compatible_node(NULL, NULL, "arm,versatile-pci"); + if (!np) + return; + + /* Check if PCI backplane is detected */ + val = readl(versatile_sys_base + VERSATILE_SYS_PCICTL_OFFSET); + if (val & 1) { + /* + * Enable PCI accesses. Note that the documentaton is + * inconsistent whether or not this is needed, but the old + * driver had it so we will keep it. + */ + writel(1, versatile_sys_base + VERSATILE_SYS_PCICTL_OFFSET); + return; + } + + newprop = kzalloc(sizeof(*newprop), GFP_KERNEL); + if (!newprop) + return; + + newprop->name = kstrdup("status", GFP_KERNEL); + newprop->value = kstrdup("disabled", GFP_KERNEL); + newprop->length = sizeof("disabled"); + of_update_property(np, newprop); + + pr_info("Not plugged into PCI backplane!\n"); +} + static void __init versatile_dt_init(void) { + struct device_node *np; + + np = of_find_compatible_node(NULL, NULL, "arm,core-module-versatile"); + if (np) + versatile_sys_base = of_iomap(np, 0); + WARN_ON(!versatile_sys_base); + + versatile_dt_pci_init(); + of_platform_populate(NULL, of_default_bus_match_table, versatile_auxdata_lookup, NULL); }