Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2760060pxk; Sun, 27 Sep 2020 21:37:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzbYlEmdDVUhLLgQnaI2Edf9TCSUgiWdkDgmZj2q1RhYOwWh49yTz00sGPLRdjclPKG0jMO X-Received: by 2002:a17:906:4951:: with SMTP id f17mr13755011ejt.29.1601267830686; Sun, 27 Sep 2020 21:37:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601267830; cv=none; d=google.com; s=arc-20160816; b=RsrfasKuqeeTLE7JnPxoRfbejKUshFLZZF9h6u/Giu1lQxC0g64Xu+N+0rlPForMWI hXWcCU9Efx0xzu0IcD6AmL7RTcJ4a6+r7ztwyrcT4f+ODnt/UlJ2FEj9jRYwKbOA7AMo UahOJwqELdHNvUtx4UJVzqKlOuWzRlIJNLubungEJjaB0LzrxIWHofrmnUSF0t+AOaCs I8ES1v09eFczHyPIid9dkcvjtasM/YkBWQV//xZ65jGbsemAud5aLW3Y7GXMEV7iH8zD o6oNLQ1Z9WJdzYOEaFsnAeLzU6AtJjLpayIRF7Z8xWEBQl92FMlTi78HlOoC/o2C550V WFrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dmarc-filter:sender:dkim-signature; bh=4BnMQDZQ/7CM0fb8kxd7piyz8sTUmxgCM86hjgX4qtY=; b=Me3mhX1Lzi+nH5rFkc3KiWkYHyXqjPQi89LNqTIkBGLolRkkwMcBp8Eqs2R0Fsk2JV /JHkVI8V616ts8UpCXdGKkzWtQmu3VH+0PpK7kGiyi3TsQB1XbhObopZVPC8ZSozgVYw 5U5cXMFYzugYHZkJ1uxKnwVKWCZ2WpeCaXvjQtdy7sVUOUW2LGueXaQOc6c/BhoXt2if wJue6z0rtrGJ3S77FJ0Ueyo+8DX5i2KkkAf8VVXwl5E5I2Esq2rBgV56mH2FM9Mj0H2/ rhwE+XnYHjyXu7A2T70KsD8SWBIHV7VPkrUTSZX9j+XRf2lVjwnang5rIxZ7RoVf3KMZ 0HPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=lpKw4Y2H; 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 q20si6685125ejx.248.2020.09.27.21.36.48; Sun, 27 Sep 2020 21:37:10 -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=pass header.i=@mg.codeaurora.org header.s=smtp header.b=lpKw4Y2H; 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 S1726651AbgI1Ec4 (ORCPT + 99 others); Mon, 28 Sep 2020 00:32:56 -0400 Received: from m42-4.mailgun.net ([69.72.42.4]:42529 "EHLO m42-4.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726638AbgI1Ecz (ORCPT ); Mon, 28 Sep 2020 00:32:55 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1601267575; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=4BnMQDZQ/7CM0fb8kxd7piyz8sTUmxgCM86hjgX4qtY=; b=lpKw4Y2HY4FCXEWDOgfVqLIDt7NyzEKw3v1bHSdv01Y4YVnD2u4kYYBFt0PPnGdPwnjHx0xJ pQUyyc8g4+H+MfxkDqvHeM9pMTpUwdUx66rvhk18Agl1elNeKhtgvMp87oS7LV4NKT01h+KL ClnqD67Qze+0byoXqOlWKFLk+qg= X-Mailgun-Sending-Ip: 69.72.42.4 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-n05.prod.us-west-2.postgun.com with SMTP id 5f716777d106659f82125c48 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Mon, 28 Sep 2020 04:32:55 GMT Sender: mkshah=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id DD379C433B6; Mon, 28 Sep 2020 04:32:54 +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=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00,SPF_FAIL, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mkshah-linux.qualcomm.com (unknown [202.46.22.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 A868EC433A1; Mon, 28 Sep 2020 04:32:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org A868EC433A1 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=fail 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 v6 6/6] irqchip: qcom-pdc: Reset PDC interrupts during init Date: Mon, 28 Sep 2020 10:02:04 +0530 Message-Id: <1601267524-20199-7-git-send-email-mkshah@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1601267524-20199-1-git-send-email-mkshah@codeaurora.org> References: <1601267524-20199-1-git-send-email-mkshah@codeaurora.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Kexec can directly boot into a new kernel without going to complete reboot. This can leave the previous kernel's configuration for PDC interrupts as is. Clear previous kernel's configuration during init by setting interrupts in enable bank to zero. The IRQs specified in qcom,pdc-ranges property are the only ones that can be used by the new kernel so clear only those IRQs. The remaining ones may be in use by a different kernel and should not be set by new kernel. Acked-by: Linus Walleij Suggested-by: Stephen Boyd Reviewed-by: Stephen Boyd Reviewed-by: Douglas Anderson Signed-off-by: Maulik Shah --- drivers/irqchip/qcom-pdc.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/irqchip/qcom-pdc.c b/drivers/irqchip/qcom-pdc.c index acc0620..bd39e9d 100644 --- a/drivers/irqchip/qcom-pdc.c +++ b/drivers/irqchip/qcom-pdc.c @@ -341,7 +341,8 @@ static const struct irq_domain_ops qcom_pdc_gpio_ops = { static int pdc_setup_pin_mapping(struct device_node *np) { - int ret, n; + int ret, n, i; + u32 irq_index, reg_index, val; n = of_property_count_elems_of_size(np, "qcom,pdc-ranges", sizeof(u32)); if (n <= 0 || n % 3) @@ -370,6 +371,14 @@ static int pdc_setup_pin_mapping(struct device_node *np) &pdc_region[n].cnt); if (ret) return ret; + + for (i = 0; i < pdc_region[n].cnt; i++) { + reg_index = (i + pdc_region[n].pin_base) >> 5; + irq_index = (i + pdc_region[n].pin_base) & 0x1f; + val = pdc_reg_read(IRQ_ENABLE_BANK, reg_index); + val &= ~BIT(irq_index); + pdc_reg_write(IRQ_ENABLE_BANK, reg_index, val); + } } return 0; -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation