From patchwork Wed Sep 20 15:20:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugo Villeneuve X-Patchwork-Id: 724802 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4D20CC00E86 for ; Wed, 20 Sep 2023 15:20:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234934AbjITPUd (ORCPT ); Wed, 20 Sep 2023 11:20:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235214AbjITPUa (ORCPT ); Wed, 20 Sep 2023 11:20:30 -0400 Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2EA4C6; Wed, 20 Sep 2023 08:20:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=x; h=Subject:Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Cc:To :From:subject:date:message-id:reply-to; bh=4cDaJORQqzyKHAyA2iGq/8fh2mCcULmschKPUjYldMA=; b=JrabJf9llWfHLeamA3PsNvq9Xx gQa81MX+dh1TZyATBqt26AVVzjJ6MkhWxpzXJXi0EJBi4HCcqGv/ywJ7T97ksk9NvqDAKZI1NKVEV qoRSUug7PYdp1U75hbQG2uGH8bJuSTQj+VoCdLar6buIhnvonqthxLr90/fT6136ORWY=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:43190 helo=pettiford.lan) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1qiyzy-0008Co-Af; Wed, 20 Sep 2023 11:20:18 -0400 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, jirislaby@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, hvilleneuve@dimonoff.com Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, devicetree@vger.kernel.org, hugo@hugovil.com Date: Wed, 20 Sep 2023 11:20:12 -0400 Message-Id: <20230920152015.1376838-2-hugo@hugovil.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230920152015.1376838-1-hugo@hugovil.com> References: <20230920152015.1376838-1-hugo@hugovil.com> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 70.80.174.168 X-SA-Exim-Mail-From: hugo@hugovil.com Subject: [PATCH 1/4] serial: sc16is7xx: use device_property APIs when configuring irda mode X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.hugovil.com) Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org From: Hugo Villeneuve Convert driver to be property provider agnostic and allow it to be used on non-OF platforms. Signed-off-by: Hugo Villeneuve --- drivers/tty/serial/sc16is7xx.c | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index 1fe2c3e08a35..db2bb1c0d36c 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -1408,6 +1408,29 @@ static int sc16is7xx_setup_gpio_chip(struct sc16is7xx_port *s) } #endif +static void sc16is7xx_setup_irda_ports(struct sc16is7xx_port *s) +{ + int i; + int ret; + int count; + u32 irda_port[2]; + struct device *dev = s->p[0].port.dev; + + count = device_property_count_u32(dev, "irda-mode-ports"); + if (count < 0 || count > ARRAY_SIZE(irda_port)) + return; + + ret = device_property_read_u32_array(dev, "irda-mode-ports", + irda_port, count); + if (ret) + return; + + for (i = 0; i < count; i++) { + if (irda_port[i] < s->devtype->nr_uart) + s->p[irda_port[i]].irda_mode = true; + } +} + /* * Configure ports designated to operate as modem control lines. */ @@ -1590,16 +1613,7 @@ static int sc16is7xx_probe(struct device *dev, sc16is7xx_power(&s->p[i].port, 0); } - if (dev->of_node) { - struct property *prop; - const __be32 *p; - u32 u; - - of_property_for_each_u32(dev->of_node, "irda-mode-ports", - prop, p, u) - if (u < devtype->nr_uart) - s->p[u].irda_mode = true; - } + sc16is7xx_setup_irda_ports(s); ret = sc16is7xx_setup_mctrl_ports(s); if (ret) From patchwork Wed Sep 20 15:20:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugo Villeneuve X-Patchwork-Id: 724801 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0230FC00523 for ; Wed, 20 Sep 2023 15:21:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235214AbjITPVG (ORCPT ); Wed, 20 Sep 2023 11:21:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235332AbjITPVE (ORCPT ); Wed, 20 Sep 2023 11:21:04 -0400 Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0EB70A9; Wed, 20 Sep 2023 08:20:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=x; h=Subject:Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Cc:To :From:subject:date:message-id:reply-to; bh=mZPLDcMaUIExqCo4DAdpXSfLndLye8GLI4DHLWOnM7c=; b=WAKkO6VscDyUqS0PqSmAgqUxgn 6OMWzZ5mQMXzHoaUfzzW6QerSuaagmXyc0kdUhK7wmhvhnR61vZPIEGT/CfuLflFFiW154DJetJ2L 2kqO+56nvgA3bctMQZKxKGDtYrp2tXSxEtBf9k/hUvu/IbtBXVpW2lto/54nEc1sL7rM=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:43190 helo=pettiford.lan) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1qiz0Z-0008Co-9W; Wed, 20 Sep 2023 11:20:55 -0400 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, jirislaby@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, hvilleneuve@dimonoff.com Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, devicetree@vger.kernel.org, hugo@hugovil.com Date: Wed, 20 Sep 2023 11:20:14 -0400 Message-Id: <20230920152015.1376838-4-hugo@hugovil.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230920152015.1376838-1-hugo@hugovil.com> References: <20230920152015.1376838-1-hugo@hugovil.com> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 70.80.174.168 X-SA-Exim-Mail-From: hugo@hugovil.com Subject: [PATCH 3/4] dt-bindings: sc16is7xx: add vendor prefix to irda-mode-ports property X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.hugovil.com) Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org From: Hugo Villeneuve The NXP-specific "irda-mode-ports" property lacks a proper vendor prefix. Add "nxp," prefix to comply with DT best practises. Signed-off-by: Hugo Villeneuve --- .../devicetree/bindings/serial/nxp,sc16is7xx.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Documentation/devicetree/bindings/serial/nxp,sc16is7xx.txt b/Documentation/devicetree/bindings/serial/nxp,sc16is7xx.txt index 1a7e4bff0456..d89815c5c562 100644 --- a/Documentation/devicetree/bindings/serial/nxp,sc16is7xx.txt +++ b/Documentation/devicetree/bindings/serial/nxp,sc16is7xx.txt @@ -21,8 +21,8 @@ Optional properties: the second cell is used to specify the GPIO polarity: 0 = active high, 1 = active low. -- irda-mode-ports: An array that lists the indices of the port that - should operate in IrDA mode. +- nxp,irda-mode-ports: An array that lists the indices of the port that + should operate in IrDA mode. - nxp,modem-control-line-ports: An array that lists the indices of the port that should have shared GPIO lines configured as modem control lines. @@ -80,8 +80,8 @@ Optional properties: the second cell is used to specify the GPIO polarity: 0 = active high, 1 = active low. -- irda-mode-ports: An array that lists the indices of the port that - should operate in IrDA mode. +- nxp,irda-mode-ports: An array that lists the indices of the port that + should operate in IrDA mode. - nxp,modem-control-line-ports: An array that lists the indices of the port that should have shared GPIO lines configured as modem control lines.