Received: by 10.192.165.148 with SMTP id m20csp2172575imm; Thu, 3 May 2018 11:35:29 -0700 (PDT) X-Google-Smtp-Source: AB8JxZq/Bja69cR4QJ7A3moTzAus2yGzQNjSlyg0bUcSQDLrYxeXsb4/dANMoOb+dT0pa5dlbA50 X-Received: by 10.98.233.3 with SMTP id j3mr21357613pfh.196.1525372529269; Thu, 03 May 2018 11:35:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525372529; cv=none; d=google.com; s=arc-20160816; b=w/V5vip+EE3OhRTMxEVxAF0rxXX/HgfVUdNJVKqij4SBX9yITRpTvqDmmkmzgpvJbX ZTQ1M6SX9Qgydky9GEunVic/g9zA//ESPOpAos5SCSB76DzMpmQk0spbCevY6jZA/AsO jc9i/t0H2S32WgYm08lZ2im4BSjehjNOOArOmSP43T4k7QzzusB8LmWzxVZbmM84Xy6O 0JqAsZZpHMm9IFgBjvkLtTJFHsy/cYhJQpwERJ5XBf7h9iLIDit8+i57DRw6PniRyMnr hC/1DpQVkavB5g30XpRTyHVXSJyBtC3PMsRZC/loZO+nq/w5WCVL5XpT92YExyUuYkuo iwiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=3V/zVAwImQx+aGjSNZ4JUFHwqesrsijm/ZYWN+Miwpc=; b=UejMPSTviEen7pSqs5tlpTNd4xXX8SfwqNudNnXtfjX2jsIUwhSz6nNVuxUHyb1L2S hT87MFGDxII/dwVEqFzZGCwL0cbVunKNPh8B6Gv66k615HDEPt2Hy3jIepqB5k88pTQK 1mPcHJvMqfvFHJ0C28jxciUvRfGYTJwIJLkqhU2AwGRv2ugKP1DQD+p/TaNRgZ06Jhjj mYa6qgMFUs3F34TBw+LCWNFVgLLfpLANJjaAlOesw3t6UsFBEvslIRZB66ZKNI3bphEJ iItffzd26XTsq8yeN15FUemH+S1hKkBjlBR8PnrMxpszYpbcITNtc4qbqxJzAqASzQHW kqVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=afpVS/fY; 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 h12-v6si1264995pls.37.2018.05.03.11.35.14; Thu, 03 May 2018 11:35:29 -0700 (PDT) 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=@messagingengine.com header.s=fm2 header.b=afpVS/fY; 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 S1751301AbeECSeY (ORCPT + 99 others); Thu, 3 May 2018 14:34:24 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:51519 "EHLO out1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750969AbeECSeU (ORCPT ); Thu, 3 May 2018 14:34:20 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 479B521BDC; Thu, 3 May 2018 14:34:20 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Thu, 03 May 2018 14:34:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=3V/zVA wImQx+aGjSNZ4JUFHwqesrsijm/ZYWN+Miwpc=; b=afpVS/fYTeMW9F+s1NLbtV pKe/nEhgfEtBNH9K77qVjdPuIm6n/ZtKaNQ+Bx1Yx7LGi5UNUebCWABx9TsKBi1w BiWBi1w23LTdFx8scG77rbpmnLSXgZfgV84t2PdEAHsmnZfaAeKdPajopiMVA2J+ KiPR+XhA6hcFNHohsoRt0zH574kavvU4/B2zdFKgLXXsnYdU6geMXJP/qIVQzn6S KZGmAN4M2ySEPViQs/ltbnr9Qk4I4zoa4E8uZtSGKjLZ+az7mWYOWTgMuZLxLywx E8meeQt1XjiZZuwOXE9Shs/0Qy0CDsLdCXWA8FYL73pSBcIvsLkm0lhuZjBe3ZVA == X-ME-Sender: Received: from localhost (unknown [104.132.1.102]) by mail.messagingengine.com (Postfix) with ESMTPA id DCFAAE509A; Thu, 3 May 2018 14:34:19 -0400 (EDT) Date: Thu, 3 May 2018 11:34:08 -0700 From: Greg KH To: Muni Sekhar Cc: linux-serial , linux-kernel@vger.kernel.org, kernelnewbies Subject: Re: serial: start_tx & buffer handling Message-ID: <20180503183408.GA12152@kroah.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 03, 2018 at 08:08:48PM +0530, Muni Sekhar wrote: > Hi All, > > I’m trying to understand how user mode buffer is written to low level > serial hardware registers. > > For this I read the kernel code and I came to know that from user mode > write() API lands into kernel’s tty_write() ("drivers/tty/tty_io.c") > and then it calls a uart_write() ("drivers/tty/serial/serial_core.c"). > > In uart_write(), the buffer is copied to circ_buf and then it calls > low level serial hardware driver’s start_tx() (struct uart_ops > .start_tx). But here I could not find how the buffer kept in circ_buf > is copied to serial port’s TX_FIFO registers? > > Can someone take a moment to explain me on this? It all depends on which specific UART driver you are looking at, they all do it a bit different depending on the hardware. Which one are you looking at? Look at what the start_tx callback does for that specific driver, that should give you a hint as to how data starts flowing. Usually an interrupt is enabled that is used to flush the buffer out to the hardware. thanks, greg k-h