Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp664923pxk; Wed, 16 Sep 2020 13:47:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxM5zU48+1mbtjtRIQpYqK5DUgeKEEdXe4P9S6bjso1yxh7TT1IWey7JXMMcQ2IRtJXAJgK X-Received: by 2002:a17:906:90d5:: with SMTP id v21mr27075546ejw.123.1600289252229; Wed, 16 Sep 2020 13:47:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600289252; cv=none; d=google.com; s=arc-20160816; b=llUOtW21yt9mLjm111liBrckpZkKuoyOdfjNDff+Bpp+Kdc27redO54PuysRWCL/cf N57LZH+SomlwHDEPW/x8bhN6loegoIv71ATg9aoY3seFBm3cLxP6jEk9kzk4wsWbk/+b rgMzcSCfqlbhjdX/CMHKthN5hEjVv+r9ssgsrN7na6NHAeWmXr6RowIkwiZTiopiQdoA neg0XDiRi8MeB5k9LFm4RrkTawTDTD3zNrG+NqUKvfntfiANgXaOpK7GD/+lMV4AtQEp Isjvujt0ln74iI70V+cAWlIDhgVDPllteS1uzJ6tiRSDADUxm1Meua9vYVoqiOdZVHrA k5uw== 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:dkim-signature; bh=EkdGaMAWsiITjixL8vtqkk4znvOu3Q/xzFs2YIEcfEY=; b=UkAFKxFOS0FhPggZRCdDyVVJ0h4LMYIzNbCgku9lBsRkeBspO2ym2LZ8tTNrD4AMiv n+u/UIFYjM0+ZT+sVI09hJIWid4fSR1Lbzlouk7LsW2dqMUztlxItWfo90ily1KSLuBp 0dDz7F2qMWXPRUcVBOZbQDq+4brs0jjTVCLGqWI1esh5OPbIiuYBPxyoa1qLxXk4TPfu mMkV/g4N67G+CTjiGPINwQCHYS6LCrGUawDdh3l8IY3ecsQqcglh/5AY9XnjuJqMAMVk S8vQ1v8qvOICmrkgUWTacP3aPLMajZUZh8Bm8a/4+vphq1HzmMCXRkRY6QzdFFiPgIpc iNKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dpvpqsnv; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mf8si12525692ejb.197.2020.09.16.13.47.09; Wed, 16 Sep 2020 13:47:32 -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=@linaro.org header.s=google header.b=dpvpqsnv; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728462AbgIPUqF (ORCPT + 99 others); Wed, 16 Sep 2020 16:46:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726731AbgIPRDY (ORCPT ); Wed, 16 Sep 2020 13:03:24 -0400 Received: from mail-lj1-x241.google.com (mail-lj1-x241.google.com [IPv6:2a00:1450:4864:20::241]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EDD90C02C2AE for ; Wed, 16 Sep 2020 09:37:09 -0700 (PDT) Received: by mail-lj1-x241.google.com with SMTP id u21so6474464ljl.6 for ; Wed, 16 Sep 2020 09:37:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=EkdGaMAWsiITjixL8vtqkk4znvOu3Q/xzFs2YIEcfEY=; b=dpvpqsnv1se+B+N0B3X73ZARW0xp0qYtrllJbwUMEaTaPYAhDr3QA1JvBn8NUzvi/Z s8/YO99GSsIQU66VS4Y21URWzrqFy3MCSfvxw+pZqn4rifzBbNx2BJgMeksakO170Z52 JPksnTeACT5MlZRIedoBUIaPfuTTJMYrmuNm4nBCXCwlym2M+aUB2z4kYkJ0ouJaSY00 70k7LERJHRRCJjPRwRId0KijyzilqRY9bkwG2n2Sba11nDKP2TEzW5F79CkYt4U8RCAV +RMne5o9ys2+dp6NFUda1mLsnvldt8KlUv+Tr51FA+G/lZn1INDC4VhR7AUJMAsKGndQ DMuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=EkdGaMAWsiITjixL8vtqkk4znvOu3Q/xzFs2YIEcfEY=; b=aGU23kGNEox2eEFDCLy7NOL2skQ8T2YVi+0vybGewDMVcQJeuu9uI+OLfmqCrqWkW6 ruXYY9I6aJCeOAc1IIK7d94pFlmRUnPkF81TRO2IPoxfk5leUC4GfIltqVD/9DDD0XEY DFODMwsTP9uQuk4TWUdFZJQdAGVYJDM1CZMkTogGTTmhWJb1/e6JdAfrCaamBpLFrSS0 5VEOrabxxIxvO0Zjn2tCil1VtQQMMcJcGRIWF2LPVhfPtI5I2wHq2Rw0umxbSJN67C/T hqvcuar6SZAkx7vkqAD7tZqdJbXNGFazNMEtBLKOQupcouXKYOBRUscM1V9gXya5zu7W 1gbA== X-Gm-Message-State: AOAM532kVL4do8YuxdfNqnzwQM7e8lRsXWhFRvrn7rxap74g2guth4pG cpgmxDVzMsjFxaXBp3gBXppb3g== X-Received: by 2002:a2e:a587:: with SMTP id m7mr8896222ljp.133.1600274227566; Wed, 16 Sep 2020 09:37:07 -0700 (PDT) Received: from gilgamesh.semihalf.com (193-106-246-138.noc.fibertech.net.pl. [193.106.246.138]) by smtp.gmail.com with ESMTPSA id o15sm4684400lfo.188.2020.09.16.09.37.06 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Sep 2020 09:37:07 -0700 (PDT) From: Grzegorz Jaszczyk To: tglx@linutronix.de, jason@lakedaemon.net, maz@kernel.org, s-anna@ti.com Cc: grzegorz.jaszczyk@linaro.org, robh+dt@kernel.org, lee.jones@linaro.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, david@lechnology.com, praneeth@ti.com Subject: [PATCH v7 4/5] irqchip/irq-pruss-intc: Implement irq_{get,set}_irqchip_state ops Date: Wed, 16 Sep 2020 18:36:37 +0200 Message-Id: <1600274198-30470-2-git-send-email-grzegorz.jaszczyk@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1600274198-30470-1-git-send-email-grzegorz.jaszczyk@linaro.org> References: <1600274198-30470-1-git-send-email-grzegorz.jaszczyk@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: David Lechner This implements the irq_get_irqchip_state and irq_set_irqchip_state callbacks for the TI PRUSS INTC driver. The set callback can be used by drivers to "kick" a PRU by injecting a PRU system event. Co-developed-by: Suman Anna Signed-off-by: Suman Anna Signed-off-by: David Lechner Co-developed-by: Grzegorz Jaszczyk Signed-off-by: Grzegorz Jaszczyk Reviewed-by: Lee Jones --- v6->v7: - Add Co-developed-by tags. v5->v6: - Drop example from the commit log v4->v5: - No change. v3->v4: - Update commit message v2->v3: - Get rid of unnecessary pruss_intc_check_write() and use pruss_intc_write_reg directly. v1->v2: - https://patchwork.kernel.org/patch/11069769/ --- drivers/irqchip/irq-pruss-intc.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/drivers/irqchip/irq-pruss-intc.c b/drivers/irqchip/irq-pruss-intc.c index e7ba358..bfe529a 100644 --- a/drivers/irqchip/irq-pruss-intc.c +++ b/drivers/irqchip/irq-pruss-intc.c @@ -12,6 +12,7 @@ * Copyright (C) 2019 David Lechner */ +#include #include #include #include @@ -323,6 +324,43 @@ static void pruss_intc_irq_relres(struct irq_data *data) module_put(THIS_MODULE); } +static int pruss_intc_irq_get_irqchip_state(struct irq_data *data, + enum irqchip_irq_state which, + bool *state) +{ + struct pruss_intc *intc = irq_data_get_irq_chip_data(data); + u32 reg, mask, srsr; + + if (which != IRQCHIP_STATE_PENDING) + return -EINVAL; + + reg = PRU_INTC_SRSR(data->hwirq / 32); + mask = BIT(data->hwirq % 32); + + srsr = pruss_intc_read_reg(intc, reg); + + *state = !!(srsr & mask); + + return 0; +} + +static int pruss_intc_irq_set_irqchip_state(struct irq_data *data, + enum irqchip_irq_state which, + bool state) +{ + struct pruss_intc *intc = irq_data_get_irq_chip_data(data); + + if (which != IRQCHIP_STATE_PENDING) + return -EINVAL; + + if (state) + pruss_intc_write_reg(intc, PRU_INTC_SISR, data->hwirq); + else + pruss_intc_write_reg(intc, PRU_INTC_SICR, data->hwirq); + + return 0; +} + static struct irq_chip pruss_irqchip = { .name = "pruss-intc", .irq_ack = pruss_intc_irq_ack, @@ -330,6 +368,8 @@ static struct irq_chip pruss_irqchip = { .irq_unmask = pruss_intc_irq_unmask, .irq_request_resources = pruss_intc_irq_reqres, .irq_release_resources = pruss_intc_irq_relres, + .irq_get_irqchip_state = pruss_intc_irq_get_irqchip_state, + .irq_set_irqchip_state = pruss_intc_irq_set_irqchip_state, }; static int pruss_intc_validate_mapping(struct pruss_intc *intc, int event, -- 2.7.4