Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp2354303pxm; Thu, 24 Feb 2022 23:40:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJwXXpvTaHiyfCbPrIhliQ7052NqQ7tIA2Tqe8Qrm5AfFGTYkql+xxY4JlyuysOfF4vvK+cj X-Received: by 2002:a17:903:2301:b0:150:140:c69e with SMTP id d1-20020a170903230100b001500140c69emr6231513plh.82.1645774850518; Thu, 24 Feb 2022 23:40:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645774850; cv=none; d=google.com; s=arc-20160816; b=ndWLvxpiziuubTqRuEQ+AewVDm4Qr9IJT0Vvwy3eM5MJWp22tODMOst1ZG0F2f87ns 4MLyw9DOOTU28RyrSRGRzirP8foBiQ6ut1ZMuGZkcEo3b/NDBq4yv3R+xc2TbH/MaNz2 J7zR1qD7cEat03wT3sJAjZ8LDy8VUzcY+KbDyGL2YyaChafmdpc+uSXlBfBTAczXVHFD Oet7DvqNTm30tMwrw48p9MbTQhYwRrIbOwmUmDUu7QPZrW874JtXg2/0+jNZ7NsfAyQ/ JzXTnZa4ZIMko9ZW+hRFDOJ5GDT7xq27TD3OtcwwlFngENE7l1H89oz3S/O35TgTp9BV I0jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=hOPDyy3AT3YOZd1QDbModA7q0gFc5fQG4N6N3X0Is6k=; b=Wp5yjFCVJocgq2+n5TNqkdKizXpeFGI52c1bfpzygNjfGW2Y28yGLkcCEAOff0wOo2 3TrosKByF14MU3NrvWG/GI7ga69XBCRDGDwEGOLttUQsvglpNkjWXDi33YKpYmDXJMqd TB6Fnd9GGuE/beLtNIiPCBnl4UhJ7pHK4sHIStbWOOSz9Ct+LBcbj52pJhEVPyZ0QXGf 07dkPTFFyeEbGW+uMh3AGvduACmvsANEBSvNANqPwSSsxpMuGYeM/LFsk+ElmgEfHAWe lgxzzaNixIl8+MO1LE9G2GOJmTK9AK+6R+AcGVKDodtI7Ohyy/wNadnBB9iGak25WPV0 iGQg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g6-20020a170902868600b0014ffa5402c1si1130289plo.450.2022.02.24.23.40.31; Thu, 24 Feb 2022 23:40:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237776AbiBYGIA (ORCPT + 99 others); Fri, 25 Feb 2022 01:08:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237761AbiBYGHx (ORCPT ); Fri, 25 Feb 2022 01:07:53 -0500 Received: from mail-sz.amlogic.com (mail-sz.amlogic.com [211.162.65.117]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BBFE16939B for ; Thu, 24 Feb 2022 22:07:20 -0800 (PST) Received: from droid09-sz.software.amlogic (10.28.8.19) by mail-sz.amlogic.com (10.28.11.5) with Microsoft SMTP Server id 15.1.2176.2; Fri, 25 Feb 2022 13:52:09 +0800 From: Qianggui Song To: Thomas Gleixner , Marc Zyngier CC: Qianggui Song , Kevin Hilman , Neil Armstrong , Jerome Brunet , Martin Blumenstingl , , , Subject: [PATCH v3 2/4] irqchip/meson-gpio: support more than 8 channels gpio irq Date: Fri, 25 Feb 2022 13:52:04 +0800 Message-ID: <20220225055207.1048-3-qianggui.song@amlogic.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220225055207.1048-1-qianggui.song@amlogic.com> References: <20220225055207.1048-1-qianggui.song@amlogic.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.28.8.19] X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Current meson gpio irqchip driver only support 8 channels for gpio irq line, later chips may have more then 8 channels, so need to modify code to support more. Signed-off-by: Qianggui Song --- drivers/irqchip/irq-meson-gpio.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/drivers/irqchip/irq-meson-gpio.c b/drivers/irqchip/irq-meson-gpio.c index d90ff0b92480..63841e1578f5 100644 --- a/drivers/irqchip/irq-meson-gpio.c +++ b/drivers/irqchip/irq-meson-gpio.c @@ -16,7 +16,7 @@ #include #include -#define NUM_CHANNEL 8 +#define MAX_NUM_CHANNEL 64 #define MAX_INPUT_MUX 256 #define REG_EDGE_POL 0x00 @@ -60,6 +60,7 @@ struct irq_ctl_ops { struct meson_gpio_irq_params { unsigned int nr_hwirq; + unsigned int nr_channels; bool support_edge_both; unsigned int edge_both_offset; unsigned int edge_single_offset; @@ -81,6 +82,7 @@ struct meson_gpio_irq_params { .edge_single_offset = 0, \ .pol_low_offset = 16, \ .pin_sel_mask = 0xff, \ + .nr_channels = 8, \ #define INIT_MESON_A1_COMMON_DATA(irqs) \ INIT_MESON_COMMON(irqs, meson_a1_gpio_irq_init, \ @@ -90,6 +92,7 @@ struct meson_gpio_irq_params { .edge_single_offset = 8, \ .pol_low_offset = 0, \ .pin_sel_mask = 0x7f, \ + .nr_channels = 8, \ static const struct meson_gpio_irq_params meson8_params = { INIT_MESON8_COMMON_DATA(134) @@ -136,8 +139,8 @@ static const struct of_device_id meson_irq_gpio_matches[] = { struct meson_gpio_irq_controller { const struct meson_gpio_irq_params *params; void __iomem *base; - u32 channel_irqs[NUM_CHANNEL]; - DECLARE_BITMAP(channel_map, NUM_CHANNEL); + u32 channel_irqs[MAX_NUM_CHANNEL]; + DECLARE_BITMAP(channel_map, MAX_NUM_CHANNEL); spinlock_t lock; }; @@ -207,8 +210,8 @@ meson_gpio_irq_request_channel(struct meson_gpio_irq_controller *ctl, spin_lock_irqsave(&ctl->lock, flags); /* Find a free channel */ - idx = find_first_zero_bit(ctl->channel_map, NUM_CHANNEL); - if (idx >= NUM_CHANNEL) { + idx = find_first_zero_bit(ctl->channel_map, ctl->params->nr_channels); + if (idx >= ctl->params->nr_channels) { spin_unlock_irqrestore(&ctl->lock, flags); pr_err("No channel available\n"); return -ENOSPC; @@ -450,10 +453,10 @@ static int meson_gpio_irq_parse_dt(struct device_node *node, struct meson_gpio_i ret = of_property_read_variable_u32_array(node, "amlogic,channel-interrupts", ctl->channel_irqs, - NUM_CHANNEL, - NUM_CHANNEL); + ctl->params->nr_channels, + ctl->params->nr_channels); if (ret < 0) { - pr_err("can't get %d channel interrupts\n", NUM_CHANNEL); + pr_err("can't get %d channel interrupts\n", ctl->params->nr_channels); return ret; } @@ -507,7 +510,7 @@ static int meson_gpio_irq_of_init(struct device_node *node, struct device_node * } pr_info("%d to %d gpio interrupt mux initialized\n", - ctl->params->nr_hwirq, NUM_CHANNEL); + ctl->params->nr_hwirq, ctl->params->nr_channels); return 0; -- 2.34.1