Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp287851ybh; Tue, 17 Mar 2020 23:25:22 -0700 (PDT) X-Google-Smtp-Source: ADFU+vv+JScAOkJqQJiCSB7p/tKAnySjt9ELZwKiHuy7qxdPf9TP0l7D85taOZhZ2IxzQOrI5oR9 X-Received: by 2002:aca:cf0d:: with SMTP id f13mr1954334oig.162.1584512722322; Tue, 17 Mar 2020 23:25:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584512722; cv=none; d=google.com; s=arc-20160816; b=TygFaHNr29HUOOVkw2t75u6LywGXK0iAePZ3vuVHzB5n7f9IG0Dd4m+6/eNZS7T6KN m9gtu+0E7Hl/OYbyL9nL6J7GXcbR2zmDiC5vXVYlkbSZj2d2YZeLbT8w0lkrLLHXBEw1 Q3jGRMaTclVCjMFHiHcjvoefZVWX76djp4ViBxgmx8xxWcgMzUfHNGslhhx6WGN4l0hR tEvAFULa83zy9H8v3xM6zP4plMTFpTrXGfD91omkXnLBn42fwOwtRzGJnRm4SijgY79C eut3fM5H4jxw5kT4AoeeWm6VXa/CJvZbkCZSJ4EkmjuIUmutIUsHEpcjRjlO6WbGCNqV RFCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:subject:message-id:cc:to:from :dkim-signature; bh=yVxhTjIGSsBi1j8l4nZCtCI9CxiYbq8eizSoxYeSElA=; b=OX8+FZV/UciiFeIWVRGrTMq9umWLE4jjDxswFYz6sobfxugRDJ6mS7Gy6BuSFCEw2s QUDMpPS2rw+LMoojbrsd5TJDdATUME6pjWQ1W3cdJ4/nN/UmhLC3EBpkuz1dlfLpQMuq uPF6qj+LJk0naXhY4pimVRj3PRWNw8YbkbkBkeYIVqd4nwdPyAQiNK3eZrETUx9XmhOX s9UkjSROpklq4lHPLYUwzqfNOlWqhUJo6WwYu8VDbjBc/mTOKrUL3nerC2dUu2XBF/73 1ZmT0GJHlSQXYs6w7zeN74DbRsoEDdpxNR7pB4d5AKXXTV0z9TvUDfFW3721Mkpkrloh 3hIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@flygoat.com header.s=mail header.b=GPLloAQU; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i6si2838146oia.100.2020.03.17.23.25.10; Tue, 17 Mar 2020 23:25:22 -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=@flygoat.com header.s=mail header.b=GPLloAQU; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727168AbgCRGYp (ORCPT + 99 others); Wed, 18 Mar 2020 02:24:45 -0400 Received: from sender3-op-o12.zoho.com.cn ([124.251.121.243]:17877 "EHLO sender3-op-o12.zoho.com.cn" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726478AbgCRGYo (ORCPT ); Wed, 18 Mar 2020 02:24:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1584512582; s=mail; d=flygoat.com; i=jiaxun.yang@flygoat.com; h=From:To:Cc:Message-ID:Subject:Date:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Content-Type; bh=yVxhTjIGSsBi1j8l4nZCtCI9CxiYbq8eizSoxYeSElA=; b=GPLloAQUx8+ytqfQDi7UT8XXcUS3cn1EglwJeg1+Xwk78ruFbXYtfogNyWaCeMG+ efQEP+K11Kqx8TlF/Do9WB/Gp/BUiJuQvaH/aFoSDK3Y95C8KnUVG1o+HHlB+erlEbL cyP1zRnTMFGaE5AzzxIe9H0kPUySmR9x+TCFwWK0= Received: from localhost.localdomain (39.155.141.144 [39.155.141.144]) by mx.zoho.com.cn with SMTPS id 1584512581801223.36220452103066; Wed, 18 Mar 2020 14:23:01 +0800 (CST) From: Jiaxun Yang To: linux-mips@vger.kernel.org Cc: Jiaxun Yang , Huacai Chen , Thomas Gleixner , Jason Cooper , Marc Zyngier , Rob Herring , Mark Rutland , Ralf Baechle , Paul Burton , Allison Randal , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Message-ID: <20200318062102.8145-3-jiaxun.yang@flygoat.com> Subject: [PATCH v5 02/11] irqchip: loongson-liointc: Workaround LPC IRQ Errata Date: Wed, 18 Mar 2020 14:20:30 +0800 X-Mailer: git-send-email 2.26.0.rc2 In-Reply-To: <20200318062102.8145-1-jiaxun.yang@flygoat.com> References: <20200318062102.8145-1-jiaxun.yang@flygoat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoCNMailClient: External Content-Type: text/plain; charset=utf8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The 1.0 version of that controller has a bug that status bit of LPC IRQ sometimes doesn't get set correctly. So we can always blame LPC IRQ when spurious interrupt happens at the parent interrupt line which LPC IRQ supposed to route to. Co-developed-by: Huacai Chen Signed-off-by: Jiaxun Yang --- drivers/irqchip/irq-loongson-liointc.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/irqchip/irq-loongson-liointc.c b/drivers/irqchip/irq-l= oongson-liointc.c index 8b6d7b8ddaca..d5054e90eab8 100644 --- a/drivers/irqchip/irq-loongson-liointc.c +++ b/drivers/irqchip/irq-loongson-liointc.c @@ -32,6 +32,8 @@ =20 #define LIOINTC_SHIFT_INTx=094 =20 +#define LIOINTC_ERRATA_IRQ=0910 + struct liointc_handler_data { =09struct liointc_priv=09*priv; =09u32=09=09=09parent_int_map; @@ -41,6 +43,7 @@ struct liointc_priv { =09struct irq_chip_generic=09=09*gc; =09struct liointc_handler_data=09handler[LIOINTC_NUM_PARENT]; =09u8=09=09=09=09map_cache[LIOINTC_CHIP_IRQ]; +=09bool=09=09=09=09have_lpc_irq_errata; }; =20 static void liointc_chained_handle_irq(struct irq_desc *desc) @@ -54,8 +57,14 @@ static void liointc_chained_handle_irq(struct irq_desc *= desc) =20 =09pending =3D readl(gc->reg_base + LIOINTC_REG_INTC_STATUS); =20 -=09if (!pending) -=09=09spurious_interrupt(); +=09if (!pending) { +=09=09/* Always blame LPC IRQ if we have that bug and LPC IRQ is enabled *= / +=09=09if (handler->priv->have_lpc_irq_errata && +=09=09=09(handler->parent_int_map & ~gc->mask_cache & BIT(LIOINTC_ERRATA_I= RQ))) +=09=09=09pending =3D BIT(LIOINTC_ERRATA_IRQ); +=09=09else +=09=09=09spurious_interrupt(); +=09} =20 =09while (pending) { =09=09int bit =3D __ffs(pending); @@ -164,6 +173,9 @@ int __init liointc_of_init(struct device_node *node, =09=09goto out_iounmap; =09} =20 +=09if (of_device_is_compatible(node, "loongson,liointc-1.0")) +=09=09priv->have_lpc_irq_errata =3D true; + =09sz =3D of_property_read_variable_u32_array(node, "loongson,parent_int_m= ap", =09=09=09=09=09=09&of_parent_int_map[0], LIOINTC_NUM_PARENT, =09=09=09=09=09=09LIOINTC_NUM_PARENT); --=20 2.26.0.rc2