From patchwork Thu Jun 26 07:10:22 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sricharan R X-Patchwork-Id: 32526 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f200.google.com (mail-ob0-f200.google.com [209.85.214.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B3FB7201EF for ; Thu, 26 Jun 2014 07:13:54 +0000 (UTC) Received: by mail-ob0-f200.google.com with SMTP id wm4sf17144747obc.7 for ; Thu, 26 Jun 2014 00:13:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe:content-type; bh=/AZNeRsuvDc6XCpSoAfORQ86+dOYCknYMkj5q2U+ZAw=; b=HEXLGCfX+/V+x4yGOiZPWqVpSqWSBL5WGoSNFa00ExZpytWLizzNVwwaROji7V4PQX rcaHxp4HVSwV2JEcFFtT2JibV01Wn4rZ1dTPbkcI4SJcFYErb2CDivCS/RZlkIndR3U7 bDKNJFRRFJm1wMry5+VyHS9Ub+s6sR9I4skX/xaTemiQoEmUNI38K3NeE5ULrDZ/1Hcn 3kWQSs1Hh5D/3FhWjoQIXsDTpBulp+cag0GQe3uZrWMWyicvPkAo7bCJx/561CVK/Iaa 9FTWFEKQDRS6YK3M2CoPiT+QRzY4/2JNxTIMPykBHKRz5/Oz7wnn/EbMDhfzG3+T2wZU q1AQ== X-Gm-Message-State: ALoCoQkjojqJ7i2ITOi8CYX7zW9D1Hej7n2U78WvSmRjXSXy8ufyT/ryhiayOwGEMJK3AlnwUTxD X-Received: by 10.42.62.202 with SMTP id z10mr1637783ich.7.1403766834257; Thu, 26 Jun 2014 00:13:54 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.102.178 with SMTP id w47ls96304qge.55.gmail; Thu, 26 Jun 2014 00:13:54 -0700 (PDT) X-Received: by 10.52.138.232 with SMTP id qt8mr589722vdb.44.1403766834138; Thu, 26 Jun 2014 00:13:54 -0700 (PDT) Received: from mail-vc0-f170.google.com (mail-vc0-f170.google.com [209.85.220.170]) by mx.google.com with ESMTPS id qq10si3839770vcb.65.2014.06.26.00.13.54 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 26 Jun 2014 00:13:54 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.170 as permitted sender) client-ip=209.85.220.170; Received: by mail-vc0-f170.google.com with SMTP id hy10so3064815vcb.15 for ; Thu, 26 Jun 2014 00:13:54 -0700 (PDT) X-Received: by 10.58.187.19 with SMTP id fo19mr551744vec.45.1403766834030; Thu, 26 Jun 2014 00:13:54 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp10241vcb; Thu, 26 Jun 2014 00:13:53 -0700 (PDT) X-Received: by 10.66.102.74 with SMTP id fm10mr18495234pab.79.1403766833183; Thu, 26 Jun 2014 00:13:53 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id hl2si8578595pac.30.2014.06.26.00.13.52; Thu, 26 Jun 2014 00:13:52 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755301AbaFZHNb (ORCPT + 27 others); Thu, 26 Jun 2014 03:13:31 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:48379 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755204AbaFZHN3 (ORCPT ); Thu, 26 Jun 2014 03:13:29 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id s5Q7CtSA009798; Thu, 26 Jun 2014 02:12:55 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id s5Q7CtYe025258; Thu, 26 Jun 2014 02:12:55 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.3.174.1; Thu, 26 Jun 2014 02:12:55 -0500 Received: from uda0393807.india.ti.com. (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id s5Q7CTSV000852; Thu, 26 Jun 2014 02:12:51 -0500 From: Sricharan R To: , , , CC: , , , , , , , , Subject: [PATCH V4 04/16] irqchip: crossbar: Initialise the crossbar with a safe value Date: Thu, 26 Jun 2014 12:40:22 +0530 Message-ID: <1403766634-18543-5-git-send-email-r.sricharan@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1403766634-18543-1-git-send-email-r.sricharan@ti.com> References: <1403766634-18543-1-git-send-email-r.sricharan@ti.com> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: r.sricharan@ti.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.170 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Nishanth Menon Since crossbar is s/w configurable, the initial settings of the crossbar cannot be assumed to be sane. This implies that: a) On initialization all un-reserved crossbars must be initialized to a known 'safe' value. b) When unmapping the interrupt, the safe value must be written to ensure that the crossbar mapping matches with interrupt controller usage. So provide a safe value in the dt data to map if '0' is not safe for the platform and use it during init and unmap While at this, fix the below checkpatch warning. Fixes checkpatch warning: WARNING: Unnecessary space before function pointer arguments #37: FILE: drivers/irqchip/irq-crossbar.c:37: + void (*write) (int, int); Signed-off-by: Nishanth Menon Signed-off-by: Sricharan R Acked-by: Santosh Shilimkar --- .../devicetree/bindings/arm/omap/crossbar.txt | 3 +++ drivers/irqchip/irq-crossbar.c | 19 +++++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/arm/omap/crossbar.txt b/Documentation/devicetree/bindings/arm/omap/crossbar.txt index 0795765..5f45c78 100644 --- a/Documentation/devicetree/bindings/arm/omap/crossbar.txt +++ b/Documentation/devicetree/bindings/arm/omap/crossbar.txt @@ -22,6 +22,9 @@ Optional properties: SOC-specific hard-wiring of those irqs which unexpectedly bypasses the crossbar. These irqs have a crossbar register, but still cannot be used. +- ti,irqs-safe-map: integer which maps to a safe configuration to use + when the interrupt controller irq is unused (when not provided, default is 0) + Examples: crossbar_mpu: @4a020000 { compatible = "ti,irq-crossbar"; diff --git a/drivers/irqchip/irq-crossbar.c b/drivers/irqchip/irq-crossbar.c index 0533a71..4be30c0 100644 --- a/drivers/irqchip/irq-crossbar.c +++ b/drivers/irqchip/irq-crossbar.c @@ -23,16 +23,18 @@ /* * @int_max: maximum number of supported interrupts + * @safe_map: safe default value to initialize the crossbar * @irq_map: array of interrupts to crossbar number mapping * @crossbar_base: crossbar base address * @register_offsets: offsets for each irq number */ struct crossbar_device { uint int_max; + uint safe_map; uint *irq_map; void __iomem *crossbar_base; int *register_offsets; - void (*write) (int, int); + void (*write)(int, int); }; static struct crossbar_device *cb; @@ -88,8 +90,10 @@ static void crossbar_domain_unmap(struct irq_domain *d, unsigned int irq) { irq_hw_number_t hw = irq_get_irq_data(irq)->hwirq; - if (hw > GIC_IRQ_START) + if (hw > GIC_IRQ_START) { cb->irq_map[hw - GIC_IRQ_START] = IRQ_FREE; + cb->write(hw - GIC_IRQ_START, cb->safe_map); + } } static int crossbar_domain_xlate(struct irq_domain *d, @@ -214,6 +218,17 @@ static int __init crossbar_of_init(struct device_node *node) reserved += size; } + of_property_read_u32(node, "ti,irqs-safe-map", &cb->safe_map); + + /* Initialize the crossbar with safe map to start with */ + for (i = 0; i < max; i++) { + if (cb->irq_map[i] == IRQ_RESERVED || + cb->irq_map[i] == IRQ_SKIP) + continue; + + cb->write(i, cb->safe_map); + } + register_routable_domain_ops(&routable_irq_domain_ops); return 0;