From patchwork Tue Dec 30 19:28:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 5552901 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E8C31BF6C3 for ; Tue, 30 Dec 2014 19:32:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1F87D2017D for ; Tue, 30 Dec 2014 19:32:54 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 482B0200FE for ; Tue, 30 Dec 2014 19:32:53 +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 1Y62Uc-0005jp-Uj; Tue, 30 Dec 2014 19:30:10 +0000 Received: from mail-oi0-x22f.google.com ([2607:f8b0:4003:c06::22f]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Y62Tq-0005BI-2Y for linux-arm-kernel@lists.infradead.org; Tue, 30 Dec 2014 19:29:23 +0000 Received: by mail-oi0-f47.google.com with SMTP id v63so33489867oia.6 for ; Tue, 30 Dec 2014 11:29:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=AVGJ4vykrWqiAD/94yBX3e+tMjzEhg1DGEJV5dGsuN0=; b=KrTSBd91mqv88ZcKfkmW2hG9wHlGBSaY7WEeDJqJO+BlKsysbCXq/iXF+dCWAxNRjL U18okTrKS/jDR1jOk2D3tY/upaEvKw1HDRASC/9em5HMp7Vx8b0K6GDoBJg9SlQeo7/r LUvQjdS6iG2axhiiS6n+9FovP+L2idIsfkA4x9DYETVdZDQ3gfqqtlFH46Wr9H4iZ7bc FXOM6g7MOW9yqLZ+GKIXTd532cznPDzGmKk75bGAwhHm4mB1O947RXpOk+08l1cSEBcf GwgATaKy7R0XGVHYfJlgg3pzQEfQZhHwWyd4OgHRMqHHIT4vuLH4w5Px0HTQNYll+QZx SERQ== X-Received: by 10.202.80.21 with SMTP id e21mr35512707oib.65.1419967740761; Tue, 30 Dec 2014 11:29:00 -0800 (PST) Received: from rob-laptop.herring.priv (72-48-98-129.dyn.grandenetworks.net. [72.48.98.129]) by mx.google.com with ESMTPSA id e3sm20469216oib.27.2014.12.30.11.28.59 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 30 Dec 2014 11:28:59 -0800 (PST) From: Rob Herring To: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org Subject: [PATCH 3/9] ARM: versatile: add DT based PCI detection Date: Tue, 30 Dec 2014 13:28:32 -0600 Message-Id: <1419967718-26909-4-git-send-email-robherring2@gmail.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1419967718-26909-1-git-send-email-robherring2@gmail.com> References: <1419967718-26909-1-git-send-email-robherring2@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141230_112922_202484_659EFE1B X-CRM114-Status: GOOD ( 11.97 ) X-Spam-Score: -0.6 (/) Cc: Peter Maydell , Russell King , Rob Herring , Linus Walleij , arm@kernel.org, Bjorn Helgaas X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, 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 From: Rob Herring 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 | 46 ++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/arch/arm/mach-versatile/versatile_dt.c b/arch/arm/mach-versatile/versatile_dt.c index 9f9bc61..5053810 100644 --- a/arch/arm/mach-versatile/versatile_dt.c +++ b/arch/arm/mach-versatile/versatile_dt.c @@ -22,15 +22,61 @@ */ #include +#include +#include +#include #include #include +#include #include #include #include "core.h" +#define VERSATILE_SYS_PCICTL_OFFSET 0x44 + +static void __init versatile_dt_pci_init(void) +{ + u32 val; + void __iomem *base; + struct device_node *np; + struct property *newprop; + + np = of_find_compatible_node(NULL, NULL, "arm,core-module-versatile"); + if (!np) + return; + + base = of_iomap(np, 0); + if (!base) + return; + + /* Check if PCI backplane is detected */ + val = __raw_readl(base + VERSATILE_SYS_PCICTL_OFFSET); + if (val & 1) + goto err; + + np = of_find_compatible_node(NULL, NULL, "arm,versatile-pci"); + if (!np) + goto err; + + newprop = kzalloc(sizeof(*newprop), GFP_KERNEL); + if (!newprop) + goto err; + + 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"); +err: + iounmap(base); +} + static void __init versatile_dt_init(void) { + versatile_dt_pci_init(); + of_platform_populate(NULL, of_default_bus_match_table, versatile_auxdata_lookup, NULL); }