Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2527280imm; Wed, 3 Oct 2018 05:24:46 -0700 (PDT) X-Google-Smtp-Source: ACcGV627r+k+Obg62YKWzT61H1ESXV83bQhPDC+9Qfe+f1S+86x69gZf6FSF3kNppjSRpi2DIPAp X-Received: by 2002:a17:902:70c3:: with SMTP id l3-v6mr1371436plt.185.1538569486347; Wed, 03 Oct 2018 05:24:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538569486; cv=none; d=google.com; s=arc-20160816; b=RsDU10xSVpIuK/etiUBn+oWFI0j/tkAngiTKBosfKi3LHGzYplD9AEEXJ1ZATe8Ohz zLW1553ucknO94TB0EEBclosIzLVZg4AA5BFbPFBWPQ1olx6bKH8dVc4kRRdD+IOF+k3 TkmFrUmSDWsAP+cSOAvvpzpMouV+sXXzDjCZmMRVDhmPRK2LgeicbPb+fPQFim83ugBN dfLXEva/aIqCV8jasRQoBqn7fcnyaOcME2WNxzjvXp5sLtwmum3heHOgU0+0+ixjGoh9 y1pQqgI2dL8BHmVhg5l1exvPGGMWsdmflymVNXqpW/+dzwUyP98qkOjm6kfR/zBjL+k8 cr1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dmarc-filter:dkim-signature:dkim-signature; bh=eDutBve3lH0zQu3qNzjrjCVazAvdZdSKkvItv2C0Fxk=; b=Q+Unqjo3/GiYEvkKlXPVWEmSxAg+vz1hGGB35V0KhyytdTL9PE1ZY+3gqFRI1BF1XB QcXbs7IvF+AkQddbJ8e23YXGBj7Q1RKfzKhE8KXNRRZJTQtP9inxUN5ndXTp/iu/92lw 1FPSnCE3WTisfS2+ywNwFZUJXbIa4QoyGHwu6DJNI5PoDkbA4buFhg0fqdmKMLnMyS6X csJVVHBvFawngrPAJ5Ob8oZgQjT6Z5ut7abuL7C6kVfUlzZOZ7zJNfVvCdEmVqcQqWBW WLOklTyQEiaEs7clh2dwNUqIcfQjVXO7VPf2FYCVaeptoR+TNcjG7JNvL5q9SgC47EB/ NfXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b="PCm8eFu/"; dkim=pass header.i=@codeaurora.org header.s=default header.b="PCm8eFu/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u21-v6si1287064pgm.406.2018.10.03.05.24.30; Wed, 03 Oct 2018 05:24:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b="PCm8eFu/"; dkim=pass header.i=@codeaurora.org header.s=default header.b="PCm8eFu/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726798AbeJCTMf (ORCPT + 99 others); Wed, 3 Oct 2018 15:12:35 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:54724 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726670AbeJCTMf (ORCPT ); Wed, 3 Oct 2018 15:12:35 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id AC9E460B26; Wed, 3 Oct 2018 12:24:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1538569464; bh=/jV6mSQjvnhxUE/dknnGvRHvlUpfpw48/IFY8peH4M0=; h=From:To:Cc:Subject:Date:From; b=PCm8eFu/CZCfTDZ/01rYTWwSBQTmWbckdis6+mUuYgRxMlooF6us4pl4SDe1k2HG4 JCDvIwL9j5gUqJiMM3ZiBO2wqUkGC9tm3wOI23tTAM0uym8xBmV55l+d2nQRbQyYa8 vUzMFidJgO5quwJL4ou+WPsgeLtNJvYV3WjZWL3I= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED autolearn=no autolearn_force=no version=3.4.0 Received: from alokc-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: alokc@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 1619D60B26; Wed, 3 Oct 2018 12:24:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1538569464; bh=/jV6mSQjvnhxUE/dknnGvRHvlUpfpw48/IFY8peH4M0=; h=From:To:Cc:Subject:Date:From; b=PCm8eFu/CZCfTDZ/01rYTWwSBQTmWbckdis6+mUuYgRxMlooF6us4pl4SDe1k2HG4 JCDvIwL9j5gUqJiMM3ZiBO2wqUkGC9tm3wOI23tTAM0uym8xBmV55l+d2nQRbQyYa8 vUzMFidJgO5quwJL4ou+WPsgeLtNJvYV3WjZWL3I= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 1619D60B26 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=alokc@codeaurora.org From: Alok Chauhan To: swboyd@chromium.org, dianders@chromium.org, dkota@codeaurora.org, Andy Gross , David Brown , linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Alok Chauhan Subject: [PATCH] soc: qcom: Add irq clear handling during SE init Date: Wed, 3 Oct 2018 17:53:50 +0530 Message-Id: <1538569430-32374-1-git-send-email-alokc@codeaurora.org> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org when the kernel inits a SE, its quite possible we have pending interrupts from bootloaders which did not handle/clear them. So do this in kernel at the SE init, to avoid some of it causing bad behavior, while at it also club all the register writes needed to clear the se irqs into a function to avoid repeating it over. Signed-off-by: Alok Chauhan --- drivers/soc/qcom/qcom-geni-se.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/drivers/soc/qcom/qcom-geni-se.c b/drivers/soc/qcom/qcom-geni-se.c index feed3db2..1422fc5 100644 --- a/drivers/soc/qcom/qcom-geni-se.c +++ b/drivers/soc/qcom/qcom-geni-se.c @@ -215,6 +215,16 @@ static void geni_se_io_init(void __iomem *base) writel_relaxed(FORCE_DEFAULT, base + GENI_FORCE_DEFAULT_REG); } +static void geni_se_irq_clear(struct geni_se *se) +{ + writel_relaxed(0, se->base + SE_GSI_EVENT_EN); + writel_relaxed(0xffffffff, se->base + SE_GENI_M_IRQ_CLEAR); + writel_relaxed(0xffffffff, se->base + SE_GENI_S_IRQ_CLEAR); + writel_relaxed(0xffffffff, se->base + SE_DMA_TX_IRQ_CLR); + writel_relaxed(0xffffffff, se->base + SE_DMA_RX_IRQ_CLR); + writel_relaxed(0xffffffff, se->base + SE_IRQ_EN); +} + /** * geni_se_init() - Initialize the GENI serial engine * @se: Pointer to the concerned serial engine. @@ -228,6 +238,7 @@ void geni_se_init(struct geni_se *se, u32 rx_wm, u32 rx_rfr) { u32 val; + geni_se_irq_clear(se); geni_se_io_init(se->base); geni_se_io_set_mode(se->base); @@ -249,12 +260,7 @@ static void geni_se_select_fifo_mode(struct geni_se *se) u32 proto = geni_se_read_proto(se); u32 val; - writel_relaxed(0, se->base + SE_GSI_EVENT_EN); - writel_relaxed(0xffffffff, se->base + SE_GENI_M_IRQ_CLEAR); - writel_relaxed(0xffffffff, se->base + SE_GENI_S_IRQ_CLEAR); - writel_relaxed(0xffffffff, se->base + SE_DMA_TX_IRQ_CLR); - writel_relaxed(0xffffffff, se->base + SE_DMA_RX_IRQ_CLR); - writel_relaxed(0xffffffff, se->base + SE_IRQ_EN); + geni_se_irq_clear(se); val = readl_relaxed(se->base + SE_GENI_M_IRQ_EN); if (proto != GENI_SE_UART) { @@ -277,12 +283,7 @@ static void geni_se_select_dma_mode(struct geni_se *se) { u32 val; - writel_relaxed(0, se->base + SE_GSI_EVENT_EN); - writel_relaxed(0xffffffff, se->base + SE_GENI_M_IRQ_CLEAR); - writel_relaxed(0xffffffff, se->base + SE_GENI_S_IRQ_CLEAR); - writel_relaxed(0xffffffff, se->base + SE_DMA_TX_IRQ_CLR); - writel_relaxed(0xffffffff, se->base + SE_DMA_RX_IRQ_CLR); - writel_relaxed(0xffffffff, se->base + SE_IRQ_EN); + geni_se_irq_clear(se); val = readl_relaxed(se->base + SE_GENI_DMA_MODE_EN); val |= GENI_DMA_MODE_EN; -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project