Received: by 2002:a05:7412:518d:b0:e2:908c:2ebd with SMTP id fn13csp497111rdb; Thu, 5 Oct 2023 11:57:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFJ/lWwYE5Wn6oTAG68ezlCjGdMXK0tCIvP5aJwxz1s971ER1qIacLV4Zqi6D/QlL2f8hgN X-Received: by 2002:a05:6808:f8c:b0:3a4:225f:a15b with SMTP id o12-20020a0568080f8c00b003a4225fa15bmr7445062oiw.31.1696532259734; Thu, 05 Oct 2023 11:57:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696532259; cv=none; d=google.com; s=arc-20160816; b=tGa9SI4A51dR6Z5ZdLl4+plI7jh/l+UZBtbD5rcItZIxo4xLeVoSaWzKNUEMsgPpzf ySs2G4q1/td5odqpmkIWHbFOi3SLG8TcHmcf2VFBw3JWdEs2ApXjEDmh36svWvEpZEv4 dUCipnHRv6eYy7P5W9pA+yUlHB0BJE4IBLMPu6HuxuLk7AkD2il5F4jTlf5Q631VXIx8 JY35YhWu+E4jtLpt5d/+N1gnOgQYscSxyJvIW1LKPo6j2H7fpGTNfY+d+u2GrkL6c3Bl sBu9bl07OoUMwaaYOdKFkBNe21LmBoKiFJx8SDjCSHYfgIOs41FihUkH1wIF1jbCJ4ig lYSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=i1AMLurJBunku0Lw/5zg92xn9c4yiNHMGh1MI2Y4HJ4=; fh=CnQBB6Ftqk9bebJVVTwS0omEriTocO3IqLY7kUEn/jY=; b=ClTSTJZOOJceHHIsNBnjtLjuo3zYK4J50zXTJmkKtigQWUMaizq7j0z1gnzsUcf9EW jmUS5eq85ICw7/ZfKWwpKpUlK1ajeDXEnhq0ivUCCgy5TvzvpajA3TU+YJYDV6EhvFd5 Hf7io2AOCW1glpVlYHK/ALrYXrynrc/sTECdYoz7obFMbx+qyP7pQGyouk5w7nY20O1C m3+n/3roMOa9U3VJRi7EcLqKlmVKv6MRGRAJWTGG1Tf5IkrKAiYisLxVwL5FM3L/4zGS VghV5OltjiatoxWYkaEgoTfTLjgNpWsztPC2lriXn2nbuoCrG9ln5P/yNG2QjpRk8HyP OUJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=B31dv1Ow; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id bv193-20020a632eca000000b00578d3f8d4d4si1911513pgb.448.2023.10.05.11.57.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Oct 2023 11:57:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=B31dv1Ow; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id B9CDF84A3706; Thu, 5 Oct 2023 11:57:36 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231644AbjJES5J (ORCPT + 99 others); Thu, 5 Oct 2023 14:57:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231787AbjJES5F (ORCPT ); Thu, 5 Oct 2023 14:57:05 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7ED5510B; Thu, 5 Oct 2023 11:57:03 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 848FCC433CA; Thu, 5 Oct 2023 18:57:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1696532223; bh=gizQqh1m+4W+weyiowQQxLoR5ACpd0WvekMq4t9ZbJ0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=B31dv1Ow/PkeVGqh25lYleAADB7Ut8jocSfbrUqZPHTdnwIaORG0Gk7A/xL/4ef5q wRSo/qIEbk2Dewt/rEMKRmPyl0jnwcCgsF3E6OV+zFncxXb5Z27cp1QjI6eDybI9xY Fc4b7a+lq16Bx8Si3GQXqm+Yn4YdkFfSZ9WBgWbw= Date: Thu, 5 Oct 2023 20:57:00 +0200 From: Greg Kroah-Hartman To: Max Filippov Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, devicetree@vger.kernel.org, Jiri Slaby , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Ilpo =?iso-8859-1?Q?J=E4rvinen?= Subject: Re: [PATCH v4 5/5] drivers/tty/serial: add ESP32S3 ACM device driver Message-ID: <2023100544-rendering-identify-e0ad@gregkh> References: <20230928151631.149333-1-jcmvbkbc@gmail.com> <20230928151631.149333-6-jcmvbkbc@gmail.com> <2023100326-crushing-septic-4856@gregkh> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Thu, 05 Oct 2023 11:57:36 -0700 (PDT) On Tue, Oct 03, 2023 at 12:46:46PM -0700, Max Filippov wrote: > > > Hardware specification is available at the following URL: > > > > > > https://www.espressif.com/sites/default/files/documentation/esp32-s3_technical_reference_manual_en.pdf > > > (Chapter 33 USB Serial/JTAG Controller) > > > > I don't understand this driver, "ACM" is a USB host <-> gadget protocol, > > why do you need a platform serial driver for this? > > The USB part of this piece of hardware is fixed and not controllable, so > all we have is a very limited UART interface. But to the outside world > it's a USB device with the CDC-ACM interface. Where is the "outside world" here? The other end of the tty connection? So this is a "ACM gadget"? If so, please try to use that term as that's what we use in the kernel to keep things straight. > > > diff --git a/drivers/tty/serial/esp32_acm.c b/drivers/tty/serial/esp32_acm.c > > > new file mode 100644 > > > index 000000000000..f02abd2ac65e > > > --- /dev/null > > > +++ b/drivers/tty/serial/esp32_acm.c > > > @@ -0,0 +1,459 @@ > > > +// SPDX-License-Identifier: GPL-2.0-or-later > > > > Why "or later"? I have to ask, sorry. > > I don't really have a preference here. Is there a reason to choose > GPL-2.0 only for a new code? It's your call, you need to pick that, but I can provide recommendations if you want :) > > And no copyright information? That's fine, but be sure your company's > > lawyers are ok with it... > > There's no company behind this, just myself. Great, it's your copyright, be proud, put it on there! > > > + > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > + > > > +#define DRIVER_NAME "esp32s3-acm" > > > +#define DEV_NAME "ttyACM" > > > > There is already a ttyACM driver in the kernel, will this conflict with > > that one? And are you using the same major/minor numbers for it as > > well? If so, how is this going to work? > > I'll rename it to ttyS. I see that it coexists with the other driver that calls > its devices ttyS just fine. Great. But if you are going to be like a ACM gadget, use ttyGS like that driver does? > > > +static void esp32s3_acm_set_mctrl(struct uart_port *port, unsigned int mctrl) > > > +{ > > > +} > > > > Do you have to have empty functions for callbacks that do nothing? > > The serial core has unconditional calls to these callbacks. Ah, good catch, maybe we should fix up the serial core. > > > --- a/include/uapi/linux/serial_core.h > > > +++ b/include/uapi/linux/serial_core.h > > > @@ -248,4 +248,7 @@ > > > /* Espressif ESP32 UART */ > > > #define PORT_ESP32UART 124 > > > > > > +/* Espressif ESP32 ACM */ > > > +#define PORT_ESP32ACM 125 > > > > Why are these defines needed? What in userspace is going to require > > them? If nothing, please do not add them. > > I don't understand what the alternatives are. The comment for the > uart_ops::config_port() callback says that port->type should be set > to the type of the port found, and I see that almost every serial driver > defines a unique PORT_* for that. Yes, but not all do. If you don't need to do anything special, it can just claim to be a normal device, we've had threads about this on the list before. If you don't need to determine in userspace from the tty connection what device it is, just use the default one instead. thanks, greg k-h