From patchwork Mon Apr 12 03:47:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zev Weiss X-Patchwork-Id: 12196741 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8848BC433B4 for ; Mon, 12 Apr 2021 03:49:18 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0B49061004 for ; Mon, 12 Apr 2021 03:49:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0B49061004 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=bewilderbeest.net Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=bcGlvYx0Ihkgqec7w5SLTn92kQDiiKA7VmtyJUojCUo=; b=h5v0Pe1jTQ2RYSaC+TgdazsfU VwZJ7HJ0QXJKpNveU+Jemv+CWTOcBrB4Vx+xOSBb6RAl9ivoOJihc6HnBmCsimQtch8WafD1cqUDo sAZoiRC4gnVS4U6KXCdT4qobcv8t1fr+AESYe9LenNmrn6OAVAXqQH6T21OxxGht3hg04vgBPWgdi OMQCU8d4dPeRwdfP19XvtGT9eS3kYQn8K6qCnWcHYcyjf8MXck0PL+v/+pEPcvZQ2s6+Stnhqdj9+ b0ka+RQc21EuPgPoWzUEQMfzNJsyffGu4tf4TjXGhYf8Xo68fzcAdztb9OeeOgzkEtF6mOTxroTia g8XD2m5JA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lVnYA-005chJ-VE; Mon, 12 Apr 2021 03:47:47 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lVnXx-005cet-Dv for linux-arm-kernel@desiato.infradead.org; Mon, 12 Apr 2021 03:47:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=8nVxQe2nbHeXEJoGmKtLcyMdKnjX2BS4q8oiouaC58Q=; b=XmNouWRcHoODXghFtexPvrG9MH X2XvUCkSssufxk3ML86soU4nqH1WqI0gc04CnJkJHsPaN9TDDY/WeS7YqDiPnt74aC2e/qGoofFuQ uFaSYi0R8nIaVBH65OlEQTWSQEwFTx6rRzun7ivUY9a8N+t+tSISGNygBzqoy9mZry958wnkWKaSs 6FVUwOA/6gX3+tmwKaWqR2zjYiUzq1aHk9mR4l/mhejrF9lgxRoJJ92iofP3eH6vJQx9vYMCuEn40 BSnqx1Bo0ipJqKuBPNUUxOco8Yv5dah4MYoDlSieWCgkIHEBtwHgtNfH3THvijdEBmIOohjsLLzh0 xRJCfr0g==; Received: from thorn.bewilderbeest.net ([71.19.156.171]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lVnXv-005rY5-36 for linux-arm-kernel@lists.infradead.org; Mon, 12 Apr 2021 03:47:32 +0000 Received: from hatter.bewilderbeest.net (unknown [IPv6:2600:6c44:7f:ba20::7c6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: zev) by thorn.bewilderbeest.net (Postfix) with ESMTPSA id E434A685; Sun, 11 Apr 2021 20:47:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bewilderbeest.net; s=thorn; t=1618199250; bh=8nVxQe2nbHeXEJoGmKtLcyMdKnjX2BS4q8oiouaC58Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J328HRcJLqLeoStQyZNLZ5aTD2RQ7uQRbFy5xoz/KYh0i8y81OyPVX3D0y/P9iSxD p5CP+ed8vrgOitA3s8IA9FzLAdj1mngLZzlRCK8DaLDstmx7fG49SUlwKgVh0uOL7j 0Vf5VdcwSof20Klhk31mW8XvHBz0G7BuAx7qok6k= From: Zev Weiss To: Joel Stanley Cc: openbmc@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org, Andrew Jeffery , Zev Weiss , Rob Herring , Greg Kroah-Hartman , Rob Herring , Lubomir Rintel , - , linux-serial@vger.kernel.org Subject: [PATCH v6 1/4] dt-bindings: serial: 8250: deprecate aspeed, sirq-polarity-sense Date: Sun, 11 Apr 2021 22:47:09 -0500 Message-Id: <20210412034712.16778-2-zev@bewilderbeest.net> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210412034712.16778-1-zev@bewilderbeest.net> References: <20210412034712.16778-1-zev@bewilderbeest.net> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210411_204731_150268_E6A4A2CE X-CRM114-Status: UNSURE ( 7.96 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This property ties SIRQ polarity to SCU register bits that don't necessarily have any direct relationship to it; the only use of it was removed in commit c82bf6e133d3 ("ARM: aspeed: g5: Do not set sirq polarity"). Signed-off-by: Zev Weiss Reviewed-by: Joel Stanley Acked-by: Rob Herring --- Documentation/devicetree/bindings/serial/8250.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/serial/8250.yaml b/Documentation/devicetree/bindings/serial/8250.yaml index f54cae9ff7b2..491b9297432d 100644 --- a/Documentation/devicetree/bindings/serial/8250.yaml +++ b/Documentation/devicetree/bindings/serial/8250.yaml @@ -188,6 +188,7 @@ properties: offset and bit number to identify how the SIRQ polarity should be configured. One possible data source is the LPC/eSPI mode bit. Only applicable to aspeed,ast2500-vuart. + deprecated: true required: - reg From patchwork Mon Apr 12 03:47:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zev Weiss X-Patchwork-Id: 12196745 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0EA82C433B4 for ; Mon, 12 Apr 2021 03:49:34 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A86A061206 for ; Mon, 12 Apr 2021 03:49:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A86A061206 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=bewilderbeest.net Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=IyTs5+z/w72GnL1EKcfvU9g29MbvE9VEytrtVtDZ0iw=; b=hAJrhFFzMUff3ETVamLjvoFVd qkbYqsyGhczNE3tWc3rAKBXMywwB1fE/QcqLU96+ViDYDIOlP1bNwE6xvsxgUFA5FjkI6JE44SlcM qHUd9GH2XisBeBt8JFLjC4qB3FoVw6lsO9SmjlXMDtFC3N3yq+AYChkcDG/Nt5llZ9FanOLT2DJ9E 6dT0p6CPPngQxZMTWoKAb7ToHRFl86ejAa/XnwaHF59BByzsu+Y9ScR+N7Pe3cUHTxcIH9byLr8M9 2WbF8TqA+cXsCk5AbdoOSqVRHXy5sZ6HrDsH2lK2SriZGY5cCVN+yXBXeU2MXE3DzbqJ9z3cTnZ49 zsU6UbobA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lVnYJ-005ciG-Et; Mon, 12 Apr 2021 03:47:55 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lVnXy-005cfF-VM for linux-arm-kernel@desiato.infradead.org; Mon, 12 Apr 2021 03:47:35 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=fvG+KhGr56hUUimTU+sIx4n7YvDI7UPAddjCieqejpg=; b=kHIXVTi8wM2/OvTEg2ihWTblbu INve8gg29N9HW3vDjH2IRQucxywRhF8Xd56HXb/ugAhrQw8IWaorL5U4KxKubWYrepSskmRyHutiz btxa7mUkdAFMaAs5JCc8IjXYdz+Dbjgsy65CsRNtbvljK1WzOv5O5MHA9zhZHp2BDddqmkhCK7C0m ZRW5nX46ptfI9axJaMU1tTQw+Hpc8y/0tr1O/gMfvzm3l1M16KPyzoW5v22ozQoxqltHrZ2h7//j0 Us8qdl2ddGi7UyxQ+oZ+N7bp29xor6s7MDm/k7KXOtWYkGLbk48+ORFio8N7NF4aKs492RPZylR5U JYfSmUww==; Received: from thorn.bewilderbeest.net ([71.19.156.171]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lVnXw-005rYM-Fr for linux-arm-kernel@lists.infradead.org; Mon, 12 Apr 2021 03:47:33 +0000 Received: from hatter.bewilderbeest.net (unknown [IPv6:2600:6c44:7f:ba20::7c6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: zev) by thorn.bewilderbeest.net (Postfix) with ESMTPSA id 84736690; Sun, 11 Apr 2021 20:47:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bewilderbeest.net; s=thorn; t=1618199252; bh=fvG+KhGr56hUUimTU+sIx4n7YvDI7UPAddjCieqejpg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=njJTMX/KmoKkVAeUPHntoS+o7bdvrqN+M/JrYaMRLZvG0M4hhEJAyuQbDTdEm4/0x fkLEwDJYOgoGpO1PpR+BxaIyRV2k/GsbMpNl243A3KzZtngu2yRsgps9zT9gUF9tDP yP9ZNZyv0UWmKLq0No2pazYEkPVafxa4/DYazbmc= From: Zev Weiss To: Joel Stanley Cc: openbmc@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org, Andrew Jeffery , Zev Weiss , Greg Kroah-Hartman , Jiri Slaby , linux-serial@vger.kernel.org Subject: [PATCH v6 2/4] serial: 8250_aspeed_vuart: refactor sirq and lpc address setting code Date: Sun, 11 Apr 2021 22:47:10 -0500 Message-Id: <20210412034712.16778-3-zev@bewilderbeest.net> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210412034712.16778-1-zev@bewilderbeest.net> References: <20210412034712.16778-1-zev@bewilderbeest.net> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210411_204732_551051_9C223B61 X-CRM114-Status: GOOD ( 12.01 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This splits dedicated aspeed_vuart_set_{sirq,lpc_address}() functions out of the sysfs store functions in preparation for adding DT properties that will be poking the same registers. While we're at it, these functions now provide some basic bounds-checking on their arguments. Signed-off-by: Zev Weiss Reviewed-by: Andrew Jeffery --- drivers/tty/serial/8250/8250_aspeed_vuart.c | 51 ++++++++++++++------- 1 file changed, 35 insertions(+), 16 deletions(-) diff --git a/drivers/tty/serial/8250/8250_aspeed_vuart.c b/drivers/tty/serial/8250/8250_aspeed_vuart.c index c33e02cbde93..8433f8dbb186 100644 --- a/drivers/tty/serial/8250/8250_aspeed_vuart.c +++ b/drivers/tty/serial/8250/8250_aspeed_vuart.c @@ -72,22 +72,31 @@ static ssize_t lpc_address_show(struct device *dev, return snprintf(buf, PAGE_SIZE - 1, "0x%x\n", addr); } +static int aspeed_vuart_set_lpc_address(struct aspeed_vuart *vuart, u32 addr) +{ + if (addr > U16_MAX) + return -EINVAL; + + writeb(addr >> 8, vuart->regs + ASPEED_VUART_ADDRH); + writeb(addr >> 0, vuart->regs + ASPEED_VUART_ADDRL); + + return 0; +} + static ssize_t lpc_address_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct aspeed_vuart *vuart = dev_get_drvdata(dev); - unsigned long val; + u32 val; int err; - err = kstrtoul(buf, 0, &val); + err = kstrtou32(buf, 0, &val); if (err) return err; - writeb(val >> 8, vuart->regs + ASPEED_VUART_ADDRH); - writeb(val >> 0, vuart->regs + ASPEED_VUART_ADDRL); - - return count; + err = aspeed_vuart_set_lpc_address(vuart, val); + return err ? : count; } static DEVICE_ATTR_RW(lpc_address); @@ -105,27 +114,37 @@ static ssize_t sirq_show(struct device *dev, return snprintf(buf, PAGE_SIZE - 1, "%u\n", reg); } +static int aspeed_vuart_set_sirq(struct aspeed_vuart *vuart, u32 sirq) +{ + u8 reg; + + if (sirq > (ASPEED_VUART_GCRB_HOST_SIRQ_MASK >> ASPEED_VUART_GCRB_HOST_SIRQ_SHIFT)) + return -EINVAL; + + sirq <<= ASPEED_VUART_GCRB_HOST_SIRQ_SHIFT; + sirq &= ASPEED_VUART_GCRB_HOST_SIRQ_MASK; + + reg = readb(vuart->regs + ASPEED_VUART_GCRB); + reg &= ~ASPEED_VUART_GCRB_HOST_SIRQ_MASK; + reg |= sirq; + writeb(reg, vuart->regs + ASPEED_VUART_GCRB); + + return 0; +} + static ssize_t sirq_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct aspeed_vuart *vuart = dev_get_drvdata(dev); unsigned long val; int err; - u8 reg; err = kstrtoul(buf, 0, &val); if (err) return err; - val <<= ASPEED_VUART_GCRB_HOST_SIRQ_SHIFT; - val &= ASPEED_VUART_GCRB_HOST_SIRQ_MASK; - - reg = readb(vuart->regs + ASPEED_VUART_GCRB); - reg &= ~ASPEED_VUART_GCRB_HOST_SIRQ_MASK; - reg |= val; - writeb(reg, vuart->regs + ASPEED_VUART_GCRB); - - return count; + err = aspeed_vuart_set_sirq(vuart, val); + return err ? : count; } static DEVICE_ATTR_RW(sirq); From patchwork Mon Apr 12 03:47:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zev Weiss X-Patchwork-Id: 12196743 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 309D1C433ED for ; Mon, 12 Apr 2021 03:49:32 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CBA5061004 for ; Mon, 12 Apr 2021 03:49:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CBA5061004 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=bewilderbeest.net Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=BOl2l5YHCDwJgP7C0T8tqT065UrXxMRrPCNFFz7WgIM=; b=HVxtLHNGy2vb/oh1Jj3y8XDAq irnOmL/QR5I+2l2yjplxAujMq9L9tJKwplFEpsKHvVFWjnmLwF1JZneiY+PIdBHqkyp3w1Q2phkk7 ZypLUpMdsaRZAo7nTBO0agfXQt3vRTxbTEv4opWYfSZoy1hqQY01QbGJo1kO6Bp+aDDm6/o6gNt76 y0gMjpP50u3bbkpg+NaIU5u5XB0OqcAOVaOIfPogTw6ZSmw9b426XSzErvzMh60qd9hoZ/ocJts4z EBkfJH6ecJ80zzq3y/xv1T1Ol7mnVgONAsLLFtvctxQVoiScsBoeTTkjeUJIu2e3/MNEzeAIhWWVh mNxCGiwPg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lVnYT-005cjM-Jv; Mon, 12 Apr 2021 03:48:05 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lVnY0-005cgD-LR for linux-arm-kernel@desiato.infradead.org; Mon, 12 Apr 2021 03:47:36 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=/9Diyf4/VzFqW/JMu88ZYy2oWKINc/XukFJCIzq+LVQ=; b=dR251vMIXnMJbjgTnJSMf663XK X5OFTnt/hz9c8qFujLyFA8CWxA2SCyVNvRS9YTC84AHTWyi3piPU6uZrh918zhMqLwt0DfVfJTfck QxwtUnN+QOLyD8BePoAPmUD72xurBJinwY9bl+9uyQrvCDxwtMtoBhSl61d+l+GslCxQYPG4Wc0PH tnLX/rulIUQme1KMEJJfAgPp+MZ+Yw8XQq+EodFi/88gcRfSQyAUDHEwP6XZsHpUFV9yXjwL3QVbs 8faV5Pqs18jClA7CVPyeb4IuypP6IUkJXBXg2aYb52bpZvDVcbt/oQV9dr5bodT9n1+on1GJLfIEM BreboM6Q==; Received: from thorn.bewilderbeest.net ([2605:2700:0:5::4713:9cab]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lVnXy-005rYg-4E for linux-arm-kernel@lists.infradead.org; Mon, 12 Apr 2021 03:47:35 +0000 Received: from hatter.bewilderbeest.net (unknown [IPv6:2600:6c44:7f:ba20::7c6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: zev) by thorn.bewilderbeest.net (Postfix) with ESMTPSA id E4052729; Sun, 11 Apr 2021 20:47:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bewilderbeest.net; s=thorn; t=1618199253; bh=/9Diyf4/VzFqW/JMu88ZYy2oWKINc/XukFJCIzq+LVQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ecO0rNs9JS+7hUjnX8izr9hiCWWttkrflKbD1ivNG60uqdg/DxrZgG+EivCSGixRr BUnC1E69/NkaaEdyoR9npIxT5gtIC9ELEVweQTlHgxTjXRVOoSFWCVWIKrJyNAeqYe 4ST0qkve2xCGkUZ13+BG4IoyINslkXjwG34cVBiY= From: Zev Weiss To: Joel Stanley Cc: openbmc@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org, Andrew Jeffery , Zev Weiss , Greg Kroah-Hartman , Jiri Slaby , linux-serial@vger.kernel.org Subject: [PATCH v6 3/4] serial: 8250_aspeed_vuart: add aspeed, lpc-io-reg and aspeed, lpc-interrupts DT properties Date: Sun, 11 Apr 2021 22:47:11 -0500 Message-Id: <20210412034712.16778-4-zev@bewilderbeest.net> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210412034712.16778-1-zev@bewilderbeest.net> References: <20210412034712.16778-1-zev@bewilderbeest.net> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210411_204734_186984_E464DAAF X-CRM114-Status: GOOD ( 14.30 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org These allow describing all the Aspeed VUART attributes currently available via sysfs. aspeed,lpc-interrupts provides a replacement for the deprecated aspeed,sirq-polarity-sense property. Signed-off-by: Zev Weiss Reviewed-by: Andrew Jeffery --- drivers/tty/serial/8250/8250_aspeed_vuart.c | 51 ++++++++++++++++++++- 1 file changed, 49 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/8250/8250_aspeed_vuart.c b/drivers/tty/serial/8250/8250_aspeed_vuart.c index 8433f8dbb186..3c239d98747f 100644 --- a/drivers/tty/serial/8250/8250_aspeed_vuart.c +++ b/drivers/tty/serial/8250/8250_aspeed_vuart.c @@ -28,6 +28,10 @@ #define ASPEED_VUART_ADDRL 0x28 #define ASPEED_VUART_ADDRH 0x2c +#define ASPEED_VUART_DEFAULT_LPC_ADDR 0x3f8 +#define ASPEED_VUART_DEFAULT_SIRQ 4 +#define ASPEED_VUART_DEFAULT_SIRQ_POLARITY IRQ_TYPE_LEVEL_LOW + struct aspeed_vuart { struct device *dev; void __iomem *regs; @@ -386,6 +390,18 @@ static void aspeed_vuart_auto_configure_sirq_polarity( aspeed_vuart_set_sirq_polarity(vuart, (value & reg_mask) == 0); } +static int aspeed_vuart_map_irq_polarity(u32 dt) +{ + switch (dt) { + case IRQ_TYPE_LEVEL_LOW: + return 0; + case IRQ_TYPE_LEVEL_HIGH: + return 1; + default: + return -EINVAL; + } +} + static int aspeed_vuart_probe(struct platform_device *pdev) { struct of_phandle_args sirq_polarity_sense_args; @@ -393,8 +409,8 @@ static int aspeed_vuart_probe(struct platform_device *pdev) struct aspeed_vuart *vuart; struct device_node *np; struct resource *res; - u32 clk, prop; - int rc; + u32 clk, prop, sirq[2]; + int rc, sirq_polarity; np = pdev->dev.of_node; @@ -501,6 +517,37 @@ static int aspeed_vuart_probe(struct platform_device *pdev) of_node_put(sirq_polarity_sense_args.np); } + rc = of_property_read_u32(np, "aspeed,lpc-io-reg", &prop); + if (rc < 0) + prop = ASPEED_VUART_DEFAULT_LPC_ADDR; + + rc = aspeed_vuart_set_lpc_address(vuart, prop); + if (rc < 0) { + dev_err(&pdev->dev, "invalid value in aspeed,lpc-io-reg property\n"); + goto err_clk_disable; + } + + rc = of_property_read_u32_array(np, "aspeed,lpc-interrupts", sirq, 2); + if (rc < 0) { + sirq[0] = ASPEED_VUART_DEFAULT_SIRQ; + sirq[1] = ASPEED_VUART_DEFAULT_SIRQ_POLARITY; + } + + rc = aspeed_vuart_set_sirq(vuart, sirq[0]); + if (rc < 0) { + dev_err(&pdev->dev, "invalid sirq number in aspeed,lpc-interrupts property\n"); + goto err_clk_disable; + } + + sirq_polarity = aspeed_vuart_map_irq_polarity(sirq[1]); + if (sirq_polarity < 0) { + dev_err(&pdev->dev, "invalid sirq polarity in aspeed,lpc-interrupts property\n"); + rc = sirq_polarity; + goto err_clk_disable; + } + + aspeed_vuart_set_sirq_polarity(vuart, sirq_polarity); + aspeed_vuart_set_enabled(vuart, true); aspeed_vuart_set_host_tx_discard(vuart, true); platform_set_drvdata(pdev, vuart); From patchwork Mon Apr 12 03:47:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zev Weiss X-Patchwork-Id: 12196747 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D0F70C433ED for ; Mon, 12 Apr 2021 03:49:40 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7763F61206 for ; Mon, 12 Apr 2021 03:49:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7763F61206 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=bewilderbeest.net Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=tgSdDN8LA7UQtfHp01ZahdlNLXVUTmJ23P9qXOMyAYA=; b=KzoMYVn/FJID1MKfux/WbBlsG OLKIYWGcNwOmOr6U68+tsnPztBKicfWb7mv8ZeWc1NjMqfX6/lwj9PryFOEX6l1ChqT0x7S3xQrLg MZdfvb9sjAhAAcFhQjjcivcFNDApPRljhQ9ufCl5FvC0IOtpBLtzu+nu04NdphlqbDG6N/tIjiavG XrGkx+iYowJyXQZiAuSr2X/3EANUzjFQvE1q+jFwzX0agrFK8Xe3SyW7h3iNuiXpLGLQFziNEPJfo zf8Dy9ZVfnC8sQVz/cV7HY/oI0rlUEWrw7/ZSQz5MxKSIaFpHsqDOunuzmZa4LqC6koDVI8YveOH1 bt6v0qPnA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lVnYd-005cla-Pb; Mon, 12 Apr 2021 03:48:15 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lVnY1-005cgM-KR for linux-arm-kernel@desiato.infradead.org; Mon, 12 Apr 2021 03:47:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=/albO67Siapgg40SlotykH6502Gsgo5wrOXZM3rv/BI=; b=bSokA+gmfzaU8YAtVp/lZEJ8E0 fbyImHBxxvjl/Y1D4qBRLMS63InazpNFjQTPnWnOIJP2BoldeGWc2sRiVY1x5AdOzkrbLhj0OSPAp SHDp5TI2r1QtRZvijZAcx1BFApWHUdrsKtLvLvZNUvucE/q5KYzgZbk6OIuzg0WxZ7T+nUi+IoDtN Pjh2JJW2P0qhm7RpRYaTqlFkzVUJzsnE8xwsWAzWfIhMj0Wpz/Hqfsmn//+P4dhCTVhdTqOhldMv3 XQCNgOzY/pOeixKihmjySIGKJ0f9sgJnE+spxA+sCr2WpIkBosmVZXmfZXQbSN3Qev+L9g7sl/zqF f49oVUMQ==; Received: from thorn.bewilderbeest.net ([71.19.156.171]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lVnXz-005rZ3-7s for linux-arm-kernel@lists.infradead.org; Mon, 12 Apr 2021 03:47:36 +0000 Received: from hatter.bewilderbeest.net (unknown [IPv6:2600:6c44:7f:ba20::7c6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: zev) by thorn.bewilderbeest.net (Postfix) with ESMTPSA id 148FB8DA; Sun, 11 Apr 2021 20:47:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bewilderbeest.net; s=thorn; t=1618199255; bh=/albO67Siapgg40SlotykH6502Gsgo5wrOXZM3rv/BI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gGYLYauvWJb8VKYQAIiTwQH2olJqnETYCIN5+jJLib5xlsS140nCjB9dc1okysPIO HVatk5X7pyqdDduIl+NTt4pXgqSVOIlXrhJl/sWcC7HdMwIfoocWHBz9oc/Cu5X9cd DqiYorSCnlTit3G7NLGvOIiK3pTTCUgUZ6VdTNmI= From: Zev Weiss To: Joel Stanley Cc: openbmc@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org, Andrew Jeffery , Zev Weiss , Rob Herring , Greg Kroah-Hartman , Rob Herring , Lubomir Rintel , - , linux-serial@vger.kernel.org Subject: [PATCH v6 4/4] dt-bindings: serial: 8250: add aspeed, lpc-io-reg and aspeed, lpc-interrupts Date: Sun, 11 Apr 2021 22:47:12 -0500 Message-Id: <20210412034712.16778-5-zev@bewilderbeest.net> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210412034712.16778-1-zev@bewilderbeest.net> References: <20210412034712.16778-1-zev@bewilderbeest.net> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210411_204735_300139_BD38A210 X-CRM114-Status: UNSURE ( 9.69 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org These correspond to the existing lpc_address, sirq, and sirq_polarity sysfs attributes; the second element of aspeed,lpc-interrupts provides a replacement for the deprecated aspeed,sirq-polarity-sense property. Signed-off-by: Zev Weiss Reviewed-by: Rob Herring --- .../devicetree/bindings/serial/8250.yaml | 27 ++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/serial/8250.yaml b/Documentation/devicetree/bindings/serial/8250.yaml index 491b9297432d..0e82b076e199 100644 --- a/Documentation/devicetree/bindings/serial/8250.yaml +++ b/Documentation/devicetree/bindings/serial/8250.yaml @@ -12,8 +12,13 @@ maintainers: allOf: - $ref: /schemas/serial.yaml# - if: - required: - - aspeed,sirq-polarity-sense + anyOf: + - required: + - aspeed,lpc-io-reg + - required: + - aspeed,lpc-interrupts + - required: + - aspeed,sirq-polarity-sense then: properties: compatible: @@ -190,6 +195,20 @@ properties: applicable to aspeed,ast2500-vuart. deprecated: true + aspeed,lpc-io-reg: + $ref: '/schemas/types.yaml#/definitions/uint32' + description: | + The VUART LPC address. Only applicable to aspeed,ast2500-vuart. + + aspeed,lpc-interrupts: + $ref: "/schemas/types.yaml#/definitions/uint32-array" + minItems: 2 + maxItems: 2 + description: | + A 2-cell property describing the VUART SIRQ number and SIRQ + polarity (IRQ_TYPE_LEVEL_LOW or IRQ_TYPE_LEVEL_HIGH). Only + applicable to aspeed,ast2500-vuart. + required: - reg - interrupts @@ -221,6 +240,7 @@ examples: }; - | #include + #include serial@1e787000 { compatible = "aspeed,ast2500-vuart"; reg = <0x1e787000 0x40>; @@ -228,7 +248,8 @@ examples: interrupts = <8>; clocks = <&syscon ASPEED_CLK_APB>; no-loopback-test; - aspeed,sirq-polarity-sense = <&syscon 0x70 25>; + aspeed,lpc-io-reg = <0x3f8>; + aspeed,lpc-interrupts = <4 IRQ_TYPE_LEVEL_LOW>; }; ...