From mboxrd@z Thu Jan 1 00:00:00 1970 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS 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 39A56C33C9E for ; Tue, 7 Jan 2020 07:27:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0D713207E0 for ; Tue, 7 Jan 2020 07:27:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578382073; bh=P8hFPp3uFnhyZu1oBLEErxPKN0es1u5EN8j7fBkb+1k=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=zlvIhMH/lWm5y/OGvyECZ49/tONR8DhgJ06S20zYCRJd1AZ8zKVqEC47uHbwtoKdR HtP7smX8uwdFRMiYz1JJ/CGJEZAP6o20+H82MgYSj1tJL12sK7I3R7P+O81XLOU5KK ZQGZPRTlAFqHT6mop70cssNzgjnoMWTW9TF9DRds= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727514AbgAGH1w (ORCPT ); Tue, 7 Jan 2020 02:27:52 -0500 Received: from mail.kernel.org ([198.145.29.99]:55942 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725987AbgAGH1v (ORCPT ); Tue, 7 Jan 2020 02:27:51 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8D3B02075A; Tue, 7 Jan 2020 07:27:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578382071; bh=P8hFPp3uFnhyZu1oBLEErxPKN0es1u5EN8j7fBkb+1k=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=v1dsSi51n4knQ1iqV/Uw3nGuiblGG3wE4PmUSVVxBOLzv9kys/wbELrAaBTUDiwFQ 1DF2Pt0li7WvQAZubrHHDPKM+/TTA3HWN+KE7HGP3VJorxVc7eb/qTC4caaJvWUfm4 t9bj9MnVwagZemwIh2+FIRjqXu7e9PYLNksf4WFg= Date: Tue, 7 Jan 2020 08:27:48 +0100 From: Greg Kroah-Hartman To: Ivan Sistik Cc: Russell King , Florian Fainelli , Ray Jui , Scott Branden , bcm-kernel-feedback-list@broadcom.com, Eric Anholt , Stefan Wahren , Jiri Slaby , linux-arm-kernel@lists.infradead.org, linux-rpi-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Subject: Re: [PATCH] tty: serial: amba-pl011: added RS485 support Message-ID: <20200107072748.GA1014453@kroah.com> References: <20200106235203.27256-1-sistik@3ksolutions.sk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200106235203.27256-1-sistik@3ksolutions.sk> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 07, 2020 at 12:52:03AM +0100, Ivan Sistik wrote: > AMBA PL011 do not have hardware support for RS485. This implementation is > for drive enable signal (DE), which switch direction of RS485 driver chip. > This signal si drived by RTS pin. Correct multiplexor settings have to be > provided to Device Tree. Usually it is 'ctsrts', which is used for enabling > of HW flow control, too. > > DE signal is switched by starting transmition from serial core and data > transfer is initiated by first hrtimer if there is delay before send > enabled. > > There is missing FIFO empty interrupt in PL011. It is replaced by second > hrtimer which is started if there are no more data in port transmit buffer. > Notice that port transmit buffer is not the same as HW TX FIFO. Time of > this timmer is set to char send time and it is running until fifo is empty. > This kind of implementation cause that there can be unwanted delay of one > timer tick before DE signal is switched. This is used to prevent data loss > during transmit. Second timer can start first if there is delay after send > enabled. > > Signed-off-by: Ivan Sistik > --- > arch/arm/configs/bcm2835_defconfig | 1 + > drivers/tty/serial/Kconfig | 12 + > drivers/tty/serial/amba-pl011.c | 470 ++++++++++++++++++++++++++++- > 3 files changed, 480 insertions(+), 3 deletions(-) > > diff --git a/arch/arm/configs/bcm2835_defconfig b/arch/arm/configs/bcm2835_defconfig > index e9bc88937b1e..514888681913 100644 > --- a/arch/arm/configs/bcm2835_defconfig > +++ b/arch/arm/configs/bcm2835_defconfig > @@ -78,6 +78,7 @@ CONFIG_SERIAL_8250_SHARE_IRQ=y > CONFIG_SERIAL_8250_BCM2835AUX=y > CONFIG_SERIAL_AMBA_PL011=y > CONFIG_SERIAL_AMBA_PL011_CONSOLE=y > +CONFIG_SERIAL_AMBA_PL011_SOFT_RS485=y > CONFIG_SERIAL_DEV_BUS=y > CONFIG_TTY_PRINTK=y > CONFIG_I2C_CHARDEV=y > diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig > index df8bd0c7b97d..3cecd8a75691 100644 > --- a/drivers/tty/serial/Kconfig > +++ b/drivers/tty/serial/Kconfig > @@ -73,6 +73,18 @@ config SERIAL_AMBA_PL011_CONSOLE > your boot loader (lilo or loadlin) about how to pass options to the > kernel at boot time.) > > +config SERIAL_AMBA_PL011_SOFT_RS485 > + bool "RS485 software direction switching for ARM AMBA PL011 serial" > + depends on SERIAL_AMBA_PL011=y Why "=y" here? Shouldn't this just read: depends on SERIAL_AMBA_PL011? > + select SERIAL_CORE Is this needed? SERIAL_AMBA_PL011 already selects this. thanks, greg k-h From mboxrd@z Thu Jan 1 00:00:00 1970 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS 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 41C98C33C99 for ; Tue, 7 Jan 2020 07:27:57 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 13BB3207E0 for ; Tue, 7 Jan 2020 07:27:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="uS1G8U9f"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="v1dsSi51" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 13BB3207E0 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-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=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=tRzV26NdGz9/eiC1e1VdEbxQK0KD1IeK7jlSqqvEDUE=; b=uS1G8U9f+We2Dm xgRlAoN6Ydp4B5ZQ6xoqSS+NVyR07M0RPE1BtgG/2sD+mS7eelnsBd9WgWzkdmBypEA0ApLnUt5zQ BYUYPyhFnQzV/uED9AOm4tC+e64ZdzH0FdILla+YzXG6etMEgd0F/yq3Qi0g82647NaFErgt4W1Om p1KzUtiMo2qo/N7eBQ+TemXrp2pBB52B3as4IHQheUQS9iuXR8hF/bZO1hEj1XKJf0/ptgMKjyt6A 7abzYPIQZTFwdW1ZpbV8L+9Zw/0QjVhX3J+FsjGZKHVfU7zTJx90io8Hx554P9mxaqu6gk8tKWJFl iXwCnG24CI7IFQ8BhoBg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iojHO-0003z5-BF; Tue, 07 Jan 2020 07:27:54 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iojHL-0003yX-IH; Tue, 07 Jan 2020 07:27:52 +0000 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8D3B02075A; Tue, 7 Jan 2020 07:27:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578382071; bh=P8hFPp3uFnhyZu1oBLEErxPKN0es1u5EN8j7fBkb+1k=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=v1dsSi51n4knQ1iqV/Uw3nGuiblGG3wE4PmUSVVxBOLzv9kys/wbELrAaBTUDiwFQ 1DF2Pt0li7WvQAZubrHHDPKM+/TTA3HWN+KE7HGP3VJorxVc7eb/qTC4caaJvWUfm4 t9bj9MnVwagZemwIh2+FIRjqXu7e9PYLNksf4WFg= Date: Tue, 7 Jan 2020 08:27:48 +0100 From: Greg Kroah-Hartman To: Ivan Sistik Subject: Re: [PATCH] tty: serial: amba-pl011: added RS485 support Message-ID: <20200107072748.GA1014453@kroah.com> References: <20200106235203.27256-1-sistik@3ksolutions.sk> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200106235203.27256-1-sistik@3ksolutions.sk> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200106_232751_648641_ACD6768A X-CRM114-Status: GOOD ( 22.01 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Wahren , Florian Fainelli , Scott Branden , Ray Jui , Russell King , linux-kernel@vger.kernel.org, Eric Anholt , bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-serial@vger.kernel.org, Jiri Slaby , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Jan 07, 2020 at 12:52:03AM +0100, Ivan Sistik wrote: > AMBA PL011 do not have hardware support for RS485. This implementation is > for drive enable signal (DE), which switch direction of RS485 driver chip. > This signal si drived by RTS pin. Correct multiplexor settings have to be > provided to Device Tree. Usually it is 'ctsrts', which is used for enabling > of HW flow control, too. > > DE signal is switched by starting transmition from serial core and data > transfer is initiated by first hrtimer if there is delay before send > enabled. > > There is missing FIFO empty interrupt in PL011. It is replaced by second > hrtimer which is started if there are no more data in port transmit buffer. > Notice that port transmit buffer is not the same as HW TX FIFO. Time of > this timmer is set to char send time and it is running until fifo is empty. > This kind of implementation cause that there can be unwanted delay of one > timer tick before DE signal is switched. This is used to prevent data loss > during transmit. Second timer can start first if there is delay after send > enabled. > > Signed-off-by: Ivan Sistik > --- > arch/arm/configs/bcm2835_defconfig | 1 + > drivers/tty/serial/Kconfig | 12 + > drivers/tty/serial/amba-pl011.c | 470 ++++++++++++++++++++++++++++- > 3 files changed, 480 insertions(+), 3 deletions(-) > > diff --git a/arch/arm/configs/bcm2835_defconfig b/arch/arm/configs/bcm2835_defconfig > index e9bc88937b1e..514888681913 100644 > --- a/arch/arm/configs/bcm2835_defconfig > +++ b/arch/arm/configs/bcm2835_defconfig > @@ -78,6 +78,7 @@ CONFIG_SERIAL_8250_SHARE_IRQ=y > CONFIG_SERIAL_8250_BCM2835AUX=y > CONFIG_SERIAL_AMBA_PL011=y > CONFIG_SERIAL_AMBA_PL011_CONSOLE=y > +CONFIG_SERIAL_AMBA_PL011_SOFT_RS485=y > CONFIG_SERIAL_DEV_BUS=y > CONFIG_TTY_PRINTK=y > CONFIG_I2C_CHARDEV=y > diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig > index df8bd0c7b97d..3cecd8a75691 100644 > --- a/drivers/tty/serial/Kconfig > +++ b/drivers/tty/serial/Kconfig > @@ -73,6 +73,18 @@ config SERIAL_AMBA_PL011_CONSOLE > your boot loader (lilo or loadlin) about how to pass options to the > kernel at boot time.) > > +config SERIAL_AMBA_PL011_SOFT_RS485 > + bool "RS485 software direction switching for ARM AMBA PL011 serial" > + depends on SERIAL_AMBA_PL011=y Why "=y" here? Shouldn't this just read: depends on SERIAL_AMBA_PL011? > + select SERIAL_CORE Is this needed? SERIAL_AMBA_PL011 already selects this. thanks, greg k-h _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel