Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp22302388ybl; Mon, 6 Jan 2020 23:29:58 -0800 (PST) X-Google-Smtp-Source: APXvYqz56+KdY5NAvhYMsBWB+Lc7dl70hfK3vqf5QC10wEEtfIilo+EVEQtB9o5WPnMW6coHh7El X-Received: by 2002:a9d:7757:: with SMTP id t23mr125365864otl.315.1578382198690; Mon, 06 Jan 2020 23:29:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578382198; cv=none; d=google.com; s=arc-20160816; b=jfhX56Y/eRR8mhi4/qIKzeehqfXxWZM3s1j22vr6jYbA1QARkq47DKrIalx7hlH29O rckx9WCWL/9I7ssjLhDqMSsAnb1mHM3h6VC13I23In5iwo4uLn8suj3lvV6lQNheOOsA GQS23/iBioDD9x6AUSpr2KUwY9PErWrzhXW97X5n6YGy63FtpgaxXGbyB2pMPjqV6/Bb KLx765IRxPSVNwB537c9piEI/TH9HZfSsAaMKC62kXCIys1ZgpIKG+HFPNZtu2lKgkLQ GiXzIOrf2yEa6ZtNJJ5AMGx4Im1OWAw1JIz5pn8Xgg4Tny1sHGWgQIR7MSD4DdGnLqYe qfvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=9t7m3Lu1idYn6Lry31u/2jyXQC3MSYVWLnEWk0mS4+E=; b=bczmfZhyTnuY9M65PDa2XuURi5bB5EXUfdv9c+CSJWBjJu36cEPcXoKb8kQwWOJKhX x5e7dwkinhgn12goYzJ1EJlBie/QlUnsmuJ/Vg4A6VH/3cf7TTGoZz1j9SaSgbVg0lua yRuDtNqHSok/3ZxaBJXmfuq3mS0q8/WFk34z4cCTObnO+qfGEt+8k7GotRojUJSYYWqL Dm1GnrPDdfA/utKVa6b2s2X5WuOr/k+LkXyVscc4IbOH/mGEG/4le/zGn17tIjUAmFp4 7cXT8T73Uc2Xit+Ik1ipwvDwjwRn+SmsuD++BuyekYiX+w/fi3yB5WHar+5dBuY797aX Fypg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=v1dsSi51; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c2si33724020oig.255.2020.01.06.23.29.44; Mon, 06 Jan 2020 23:29:58 -0800 (PST) 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=@kernel.org header.s=default header.b=v1dsSi51; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727167AbgAGH1w (ORCPT + 99 others); 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