Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2605141ybt; Mon, 22 Jun 2020 02:37:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxE4emuYkdO3qugL9xOTkaZybsIkF7FwC3WHIhIc7oY/YGMymyr4AgXWRgKXJN+imCI7E5W X-Received: by 2002:a17:906:90b:: with SMTP id i11mr14665757ejd.343.1592818669677; Mon, 22 Jun 2020 02:37:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592818669; cv=none; d=google.com; s=arc-20160816; b=0i12qXjSF2mQCB38+15m+U6hyV+J713WNK9scVsnh6liEfxXieqJhiuoSE0mmUzCq8 V++fXLRpROcb4urUvW0fzpgSLME5Qpn25DCwI1wp/6ozSK7kGIZHPJ8dBRCnq4i9X2ks 4kKuA2ccCwbIHXjw8jIAQwe2Ub+VJuuRSQekSIXDIIc27WEhhx6Z698i7mCd075r/jpt tTI0jNAYF4+pfggsp/sq8kwppnsMY+sZhHExmve2yT8KfVeg832qbggjlebJvnGykrUq OCLT62VKloKUKDPsFbt8ZArbJo/cF5ActRPoKg7ySXRvcHpMz9EqLLXs8Vtovfc1nByk B15Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dmarc-filter:dkim-signature; bh=qY8kwUGUQvJmFqhD+3PhiES4ZiCcfYGjUj/PxGa7Klg=; b=bQRy6s/iebJawwWMxT8RmaX7wFKSuYZIRX/KiQdH9ILCJIVJh1hyv68HXY0e/PKVKQ BuGEnIigGLEeE8o19SWNOOY/8j2NBk8fcYHvp3r691UgLONv4qT+B+E1nqt7I5iv38WE C4YswPiOdDrypxTrf75Q1MxFooXU7JJXOotps/pWlhv1Ws0A/nN0uNIWAOsUs8X8stVE DEQ7Oru1MubULIIgoLbeDGrMcsxJgm3I2Fi7iY/ND8mfietOTSzzDlPfLI34OC+/utpB Onv/zOcUvTi/acTEFz3gP7ZoqxuMvCmT8dacTDr6RMwCxbd5oXRXUJ+S/lMVg6qgzLCg M35w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=Y3LkYrr2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g22si9106760eds.26.2020.06.22.02.37.27; Mon, 22 Jun 2020 02:37:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=Y3LkYrr2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727020AbgFVJdQ (ORCPT + 99 others); Mon, 22 Jun 2020 05:33:16 -0400 Received: from mail29.static.mailgun.info ([104.130.122.29]:23064 "EHLO mail29.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726997AbgFVJdP (ORCPT ); Mon, 22 Jun 2020 05:33:15 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1592818395; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=qY8kwUGUQvJmFqhD+3PhiES4ZiCcfYGjUj/PxGa7Klg=; b=Y3LkYrr2UuFY0fNU3rPpiMvnGvU7fANkrqyO3786GdHvynyNAfybtAQtZnxsQJHPnUw1UaA2 VqtjKBCv9ahKrX1qKolIpTt5OvG/Azq9sR5VSDABfsgaUQrwcBEa3s/aTVuzEQq0xzP0Wyx8 cQCZiXmvcXO7e0MNRBIhNcutiV4= X-Mailgun-Sending-Ip: 104.130.122.29 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n15.prod.us-east-1.postgun.com with SMTP id 5ef07ad1567385e8e785baff (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Mon, 22 Jun 2020 09:33:05 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id E1FE2C433AD; Mon, 22 Jun 2020 09:33:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mkshah-linux.qualcomm.com (blr-c-bdr-fw-01_GlobalNAT_AllZones-Outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: mkshah) by smtp.codeaurora.org (Postfix) with ESMTPSA id 81E5FC43395; Mon, 22 Jun 2020 09:32:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 81E5FC43395 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=mkshah@codeaurora.org From: Maulik Shah To: bjorn.andersson@linaro.org, maz@kernel.org, linus.walleij@linaro.org, swboyd@chromium.org, evgreen@chromium.org, mka@chromium.org Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-gpio@vger.kernel.org, agross@kernel.org, tglx@linutronix.de, jason@lakedaemon.net, dianders@chromium.org, rnayak@codeaurora.org, ilina@codeaurora.org, lsrao@codeaurora.org, Maulik Shah Subject: [PATCH v3 5/5] irqchip: qcom-pdc: Reset all pdc interrupts during init Date: Mon, 22 Jun 2020 15:01:48 +0530 Message-Id: <1592818308-23001-6-git-send-email-mkshah@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1592818308-23001-1-git-send-email-mkshah@codeaurora.org> References: <1592818308-23001-1-git-send-email-mkshah@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Clear previous kernel's configuration during init by resetting all interrupts in enable bank to zero. Signed-off-by: Maulik Shah --- drivers/irqchip/qcom-pdc.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/irqchip/qcom-pdc.c b/drivers/irqchip/qcom-pdc.c index 8beb6f7..11a9d3a 100644 --- a/drivers/irqchip/qcom-pdc.c +++ b/drivers/irqchip/qcom-pdc.c @@ -19,6 +19,7 @@ #include #include +#define PDC_MAX_IRQS_PER_REG 32 #define PDC_MAX_IRQS 168 #define PDC_MAX_GPIO_IRQS 256 @@ -339,6 +340,7 @@ static const struct irq_domain_ops qcom_pdc_gpio_ops = { static int pdc_setup_pin_mapping(struct device_node *np) { int ret, n; + u32 reg, max_regs, max_pins = 0; n = of_property_count_elems_of_size(np, "qcom,pdc-ranges", sizeof(u32)); if (n <= 0 || n % 3) @@ -367,8 +369,19 @@ static int pdc_setup_pin_mapping(struct device_node *np) &pdc_region[n].cnt); if (ret) return ret; + max_pins += pdc_region[n].cnt; } + if (max_pins > PDC_MAX_IRQS) + return -EINVAL; + + max_regs = max_pins / PDC_MAX_IRQS_PER_REG; + if (max_pins % PDC_MAX_IRQS_PER_REG) + max_regs++; + + for (reg = 0; reg < max_regs; reg++) + pdc_reg_write(IRQ_ENABLE_BANK, reg, 0); + return 0; } -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation