Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2337942imu; Thu, 10 Jan 2019 12:21:18 -0800 (PST) X-Google-Smtp-Source: ALg8bN7Gn9PApH89u9w7QjObJIMqyKF2k5a7C8JkPADUsT14qmd5MEdVMQS1rLwX/e7WZlaBVJpQ X-Received: by 2002:a63:f047:: with SMTP id s7mr10693125pgj.441.1547151678334; Thu, 10 Jan 2019 12:21:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547151678; cv=none; d=google.com; s=arc-20160816; b=oTIFywrSOULepGkH15jquHosysNlAb6llgkUTr4F4h3eT3CFkHI5Ge6bTZwbqw3M3T GXdeM70nh5EKInh9Wx97SFTrHFlNY1i6K/bnFW9EWBIqeWHI4tlKQd9uYdR9M54FDZmi UQQKpI7BDv9ybSZpSH5WZ+cp5aO2e3P/8GGekpei8pRX3vbPeBSegDO6ebgU+9oyEyk2 q6DU/5OukucKQFruBRygoOibzivFOrES3Bnvn73tVUaTLviXAFvWgjaVuGcmDE0NqmEy muOwrhKwfr1AP4sX1TbL0QXb4jToXNlhW5+65v8mn39dH7lbOPmf8dHwIlf6GBftp9AM 5w8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=m7zd4F4iCg7LqUJrAtDsKz7+E+kJNDA5tf+6CtbsY7Q=; b=LEezvEszuSHJWCnkJ4dv8+7Co09zFu33TrzjQ+G1xmsea7BU2uShg8S58sRa7ISCiV oV8Gf1AvOXPLY4EuOVlgFfcr5xOUmFvxFOKZB11fZ01Danclh/SJD6jEbvF21qDRYiCv pgFBA7HpY0mqkvyHjac3lNxNIgLSVlwhfVFsZiDItFmZ18gKx8Rs02IXXQYWs+vJOmIo DUKhVYVZMO4p801pguxJpgOeAKGw4jYLUp0BQoECtJfnw2bzp3aKmTrUCiqPZz5VUw1f c80Kvzu6BRHcDpFHzsxKg1gz7PwjTDOhA6Y0z3ejqcXahirxEuXnDKQzHnrvyM9Kpo2g EHCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b="eU/+6VpX"; 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 o19si6305436pfi.261.2019.01.10.12.21.02; Thu, 10 Jan 2019 12:21:18 -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=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b="eU/+6VpX"; 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 S1729767AbfAJQRV (ORCPT + 99 others); Thu, 10 Jan 2019 11:17:21 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:51456 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727771AbfAJQRU (ORCPT ); Thu, 10 Jan 2019 11:17:20 -0500 Received: by mail-wm1-f66.google.com with SMTP id b11so11838960wmj.1 for ; Thu, 10 Jan 2019 08:17:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brainfault-org.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=m7zd4F4iCg7LqUJrAtDsKz7+E+kJNDA5tf+6CtbsY7Q=; b=eU/+6VpX2yaywkjodLF6Hqp2XAB7DKmZTsrA7KnUGxFncAS2CJADrKxdofrFgLRw4P eHTNOAh1gHe46rsFeSp2MFaNJM2XL1q1hbbBBgVLpvbebUHzGaDuhyTaQ6scTu7gK7W+ JO4pL6k/kY/3+Geqs0v2vSmuQwVhq1eoIXJZq8Y2GOAvx9G2mRE3hymg+A25pc9zOe5I +T5/SlxjLqqM0IiV4vfUPBow9aT+D4DYXMyuC+UYOg4rSBbYgRzB1iQgfuE66Xl9b3WF HZDIv757/25JbpwnUqO3hbQp4zUVnHUQ8DLs2TNClWyUnMCGMZ5iAvE6T5Y0P+hoUkJK H0OQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=m7zd4F4iCg7LqUJrAtDsKz7+E+kJNDA5tf+6CtbsY7Q=; b=ALuXlFxEyU+V7XtZWWNN9et7yoyafmkqZqxucLCTUYY9zIJIYbnMZkjNjA7XbQGAVz 52twKPgiUKHsv3RYYvnNxMKybeFkvBNqX7ikaYAPHtOrmeyvrlidWIQ3prpLZ2nXe3Au i+WwIqACtdHMd88b9HORt3yWnwbfN5pbVnX/UIH4hMfystP8op6MMESyCFaE5VrEzETA DqGdtbhjNH+GkXV/qe2yA84DRW9IFw2IGXV/zHKjUAUeIwlY5yPKEjaGArmgKiDNwdhz beycFFXy+d3/gByZcR7lgYNf69asYgjq52gu3NsMI9az7Ozg+liZ6qm4F7Fq/cqHLMF8 yzpg== X-Gm-Message-State: AJcUukcZ4Qn9UDqsGK8fhLyE9v8o3dNeYlV1+M2F+m0BLd4bbewr/39K 6vLAvk0Vh+4GNm56q0AWImH0EVNKMjbw8ABZACaR/Q== X-Received: by 2002:a1c:f509:: with SMTP id t9mr11115100wmh.76.1547137038333; Thu, 10 Jan 2019 08:17:18 -0800 (PST) MIME-Version: 1.0 References: <20181204135507.3706-1-anup@brainfault.org> <20181204135507.3706-2-anup@brainfault.org> In-Reply-To: From: Anup Patel Date: Thu, 10 Jan 2019 21:47:07 +0530 Message-ID: Subject: Re: [PATCH] tty/serial: emit CR before NL in RISC-V SBL console To: Andreas Schwab Cc: Greg Kroah-Hartman , Jiri Slaby , Palmer Dabbelt , Albert Ou , Atish Patra , Christoph Hellwig , Rob Herring , linux-riscv@lists.infradead.org, "linux-kernel@vger.kernel.org List" , linux-serial@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 10, 2019 at 8:56 PM Andreas Schwab wrote: > > On Jan 10 2019, Anup Patel wrote: > > > Instead of doing '\n' handling here, we should do it in BBL or > > OpenSBI (i.e. SBI runtime firmware) otherwise all users of > > SBI_CONSOLE_PUTCHAR (namely, Linux, FreeBSD, > > FreeRTOS, U-Boot S-mode, etc) will endup having '\n' > > handling. > > I don't think the serial driver should do NLCR handling on its own, > without being instructed by the tty layer. Since the earlycon does not > have a tty layer, it needs to handle it explicitly. I tried to investigate more. What you suggest is correct but we should use uart_console_write() API. Instead of explicitly doing NLCR here, we should do something as follows: static void sbi_putc(struct uart_port *port, int c) { sbi_console_putchar(c); } static void sbi_console_write(struct console *con, const char *s, unsigned n) { struct earlycon_device *dev = con->data; uart_console_write(&dev->port, s, n, sbi_putc); } The uart_console_write() does the NLCR handling. Regards, Anup