Received: by 10.192.165.148 with SMTP id m20csp706949imm; Fri, 4 May 2018 05:16:19 -0700 (PDT) X-Google-Smtp-Source: AB8JxZq8bJsy/1hBSzr+TZYdm/6NV335bjbhwCQdOQ+U7rfEkQUj/fZEELdPbA3w4J2Wp8ggRRAy X-Received: by 2002:a63:894a:: with SMTP id v71-v6mr22803910pgd.423.1525436179767; Fri, 04 May 2018 05:16:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525436179; cv=none; d=google.com; s=arc-20160816; b=h10/Vky33zS7sVFRHO+obW7MuhFnMmTNOBwIPTfsWMnpRYdzOL2bVFDNOt1GJG90yv AbLZBgB8i0ZQkk/ctOX/n9ALvVBxb0LoBMdyYlth/F5VJ87QynQEaKQwSt/n5Dze395/ HZuhSdLhcdhhvPvSzrcywsPYV3RxXJzc91wViv09uxzGUWXQ1Ud3hTOhQuK5C/M/jt8G 145LEVbef8udumaqXA1+3y4UtbPiPUKDkNVehswsZz9ZVVxVmC1Z0RDPYXKLfLExmNF7 BQiUkcnP6TTWYt/N136ITc2+bMLTcV6+PnooZ46tkjZvLyWWGpu8TFnRD+IRBxmWEJl5 iD4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:references:in-reply-to:mime-version :dkim-signature:arc-authentication-results; bh=B/uP9BGabHYNbGmhtDrKkFb6Y424DA/wm0it/e+/Z3w=; b=YwJdsz174YZbJo33OY9u5JNHrQhMMY1Ii3d+Eexw0RBhOCaBxXEY5gMLVgZ4EHi8gh OE/oBVdQ3WCIwmiWP+eojZZnOnEkfPjIFp5zV8psbC0kg8fuoQEeVBcGfqwaaaI8I9Mk ZESo6BCyBMfhjIoZXElMPVsTw2Y5uGoQnSJb+sJ++yx/JC4iYWpdgYfpm0x+QFMS83HB 0BVVrLW/EV96wHUugfEB70I7c8Qj+Bg7Z3fyFnx9nje69R9Xo9dcxZ/fNKT1A/ByvzPD 3OQN1DmKp4colOPxjquteYOrx68KSZQtWVYhZKJQoAMkEa1PtGhui2OvOe1IXi2OFuDN oV6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Y5SuJV8H; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f4-v6si6724606pgs.16.2018.05.04.05.16.04; Fri, 04 May 2018 05:16:19 -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=@gmail.com header.s=20161025 header.b=Y5SuJV8H; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751341AbeEDMOo (ORCPT + 99 others); Fri, 4 May 2018 08:14:44 -0400 Received: from mail-io0-f193.google.com ([209.85.223.193]:33018 "EHLO mail-io0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751107AbeEDMOm (ORCPT ); Fri, 4 May 2018 08:14:42 -0400 Received: by mail-io0-f193.google.com with SMTP id e78-v6so25404370iod.0; Fri, 04 May 2018 05:14:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=B/uP9BGabHYNbGmhtDrKkFb6Y424DA/wm0it/e+/Z3w=; b=Y5SuJV8HnXb6rK+A+ux61hCdpz/8CpM0Vyowowr5acpSfm6iwF5SugOudDAmNGF2HQ qt/GVPR8FLAP6NtGheSiCXR4V+LbPeN0v/jY+yY6GRtautSWDWyuJLx53rMXlokx4Rx9 KOIS+Dqkrq2rd/nIgWISkuQzj5NVpvqCyzLTE5aL0q41jK5pgb8ngyXBd617nbnZNTlA he3zNVxRwu4wCCVI/+tX0WzUxgtupXxNzADsBGL2pLdXkcpXENwBPVeggHsHK1aNkzZJ eWTCrM23sBtyhHG+VfXN2d9cTeqvZRGGp/DoR4j6oPcQnzr9jlumhoHdxjAOkauEkOI7 kV4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=B/uP9BGabHYNbGmhtDrKkFb6Y424DA/wm0it/e+/Z3w=; b=DR8CN+amwyy3u70m5T4lLUPsqaIknUWpH4QgyILprF3fYIKmNlT3dwU/CR4EZuG+a8 Y0Qy/Svgf/qdznr+SCkUVDoiyFaj6hNmHRUIhmAo62LcV7qwdt2IOrWxS3kZO7kJXB0z BVQpDn9HOQNaqKz2hxLozBC7AJOOYXKiYph9fvDfC5yH/X1ZoNwz6OPF/2Tg85AXaBM6 J7N3v6bfBFVupvFYLK1rgzD97snL4R1TrgOcEBTRW2qYIHfEhDg6WlDJipXHn5KMoulB L7hl5Haufs7tqKNcYdpBfhIWxSJvxbcoXccuE9qGRPH1e1K1fHDuqPj580A2bOO53N9Y FDgg== X-Gm-Message-State: ALQs6tBbEDER2tW/iv/NV/s4z12p493ercXwIBp1FRSEveBudrm3AqeU aDagJjd+8QBABy0LtVaRcYerEjsE+uaOBtLZTm8= X-Received: by 2002:a6b:8bc8:: with SMTP id n191-v6mr30648439iod.145.1525436081990; Fri, 04 May 2018 05:14:41 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a4f:511:0:0:0:0:0 with HTTP; Fri, 4 May 2018 05:14:41 -0700 (PDT) In-Reply-To: References: <20180503183408.GA12152@kroah.com> From: =?UTF-8?Q?lo=C3=AFc_tourlonias?= Date: Fri, 4 May 2018 14:14:41 +0200 Message-ID: Subject: Re: serial: start_tx & buffer handling To: Muni Sekhar Cc: Greg KH , linux-kernel@vger.kernel.org, linux-serial , kernelnewbies Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi On Fri, May 4, 2018 at 6:31 AM, Muni Sekhar wrot= e: >> >> On Fri, May 4, 2018 at 12:04 AM, Greg KH wrote: >> > On Thu, May 03, 2018 at 08:08:48PM +0530, Muni Sekhar wrote: >> >> Hi All, >> >> >> >> I=E2=80=99m trying to understand how user mode buffer is written to l= ow level >> >> serial hardware registers. >> >> >> >> For this I read the kernel code and I came to know that from user mod= e >> >> write() API lands into kernel=E2=80=99s 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=E2=80=99s start_tx() (struct uart_op= s >> >> .start_tx). But here I could not find how the buffer kept in circ_buf >> >> is copied to serial port=E2=80=99s 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. >> > >> >> I=E2=80=99m looking for any existing sample code which does DMA transfer= s of >> UART transmitted data. I looked at the bcm63xx_uart.c, it looks it >> does not handle DMA transfers. Even copying the Tx buffer (from >> circ_buf) to UART_FIFO_REG happening in ISR. You can have a look at atmel_serial kernel module (built for ARM). https://elixir.bootlin.com/linux/latest/source/drivers/tty/serial/atmel_se= rial.c The dma buffer is linked to uart circular buffer in prepare_tx() function called from uart_startup(). It's released in release_tx() function called from uart_shutdown(). DMA buffer is managed in schedule_tx() function call= ed from a tasklet triggered by the ISR. HTH >> >> >> > thanks, >> > >> > greg k-h >> >> >> >> -- >> Thanks, >> Sekhar >> >> _______________________________________________ >> Kernelnewbies mailing list >> Kernelnewbies@kernelnewbies.org >> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies > >