Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1936667rdb; Tue, 3 Oct 2023 05:56:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH+K3Jvdh9gBIjlBUlQY61PlB03oCD/bV+BetsmNEF/CagbTi5ZyhzwefyC1zBxbkprg7oM X-Received: by 2002:a05:6a21:3e0a:b0:163:b85e:6337 with SMTP id bk10-20020a056a213e0a00b00163b85e6337mr6756574pzc.38.1696337799392; Tue, 03 Oct 2023 05:56:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696337799; cv=none; d=google.com; s=arc-20160816; b=XGXiob3a5MFi/e79uzRWC3j57lymRrbPOOz+iqMjN76uSs6KdeB4jLTlgmVaqsAPUF vB0LDaRCQBHIH9eNu33U6c7WUYQAeUo9iJz1Ku+JR9cjgrwKnW6KzaETiQEsafPbm4yh +sNeRYPtwPtRQdS/8EvwFaZZcaGlictILhxOTpMaM7be/lIXrSeiHtbxv8RvI7o1XS5b Z45hKlxpX2raCO919ETY3awXMTirXnKSrR+q1wZQ7vbdX2zKb5zRI4pDimDb/f0OebSl DBN2ojD2/GqPIwwZUXffcHdTzOGfh4iNxEF+3zDyJ/IihuftI7trxvWyk7TZft32uf1m SPVQ== 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=C02ZELk7P2P9msZzy1CBOMhvdI0/thS5X3hSCuYdm8I=; fh=CnQBB6Ftqk9bebJVVTwS0omEriTocO3IqLY7kUEn/jY=; b=Cv5B/3nK/XFEmNo5fvO8qNOJOjSnMDrs8AlimX95EyOC4u4FumFKWhaZR6skHNbtXG VadGSu/kQsO/M248OO6RkLG325MBb4fw9VV//E/mYsAE8zpWTzSNDwb3AlOSfC2H1dWr D1BusccRtKnMkn3U/DlqhBH0v1nZyP/0VfSDhKV18DphUJF7NWoLeR0X5hEFXrWCoVbd OhANUZ3To9K4TwmwTmoBQMgiRAZP9nkiJtqGVr2A/7nZPlWT5dOgGqWn7Bc2HcGpXBXm VU2GzQot/aL25BHlursgvqZyBncLiUCoEv/YF2rrVfpQ0oNTyG3stikuumyWQtTeC+Vj cZSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0eREALR8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id z25-20020a056a001d9900b0068fce4338bdsi1438641pfw.62.2023.10.03.05.56.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 05:56:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0eREALR8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (Postfix) with ESMTP id AE0F280CD70C; Tue, 3 Oct 2023 05:56:36 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232177AbjJCM4L (ORCPT + 99 others); Tue, 3 Oct 2023 08:56:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229803AbjJCM4K (ORCPT ); Tue, 3 Oct 2023 08:56:10 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4032DB8; Tue, 3 Oct 2023 05:56:07 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 82E43C433C7; Tue, 3 Oct 2023 12:56:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1696337766; bh=P59DIcTo4FzG58FgS8nftjaP4bwHuF5VoRmUVEhZMPk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=0eREALR8VLdselMS61TC2lTtnDrh36evlgLQL8Iawi3p1KRu7WY/ivxtWvsIZQzuS 78twgbM3ck7Nn97GeX3k8BiHm4Mlop3yiEE/l3mpEqCFVLrwOvbHb+wCfk3C37oyFq z5lIRsM/Dox4yZ7nSSjY8CRkwkjMqh83vfAPEwS8= Date: Tue, 3 Oct 2023 14:56:04 +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 3/5] drivers/tty/serial: add driver for the ESP32 UART Message-ID: <2023100348-visitor-browse-3142@gregkh> References: <20230928151631.149333-1-jcmvbkbc@gmail.com> <20230928151631.149333-4-jcmvbkbc@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230928151631.149333-4-jcmvbkbc@gmail.com> X-Spam-Status: No, score=-0.9 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 autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.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 (lipwig.vger.email [0.0.0.0]); Tue, 03 Oct 2023 05:56:36 -0700 (PDT) On Thu, Sep 28, 2023 at 08:16:29AM -0700, Max Filippov wrote: > Add driver for the UART controllers of the Espressif ESP32 and ESP32S3 > SoCs. Hardware specification is available at the following URLs: > > https://www.espressif.com/sites/default/files/documentation/esp32_technical_reference_manual_en.pdf > (Chapter 13 UART Controller) > https://www.espressif.com/sites/default/files/documentation/esp32-s3_technical_reference_manual_en.pdf > (Chapter 26 UART Controller) > > Signed-off-by: Max Filippov > --- > Changes v2->v3: > - rework brk handling in esp32_uart_rxint > - only increment port->icount.rx in case insert_flip_char() is called > - use HZ instead of msecs_to_jiffies(1000) in esp32_uart_put_char_sync > - add early return to esp32_uart_transmit_buffer > - use request_irq/free_irq instead of devm_* versions > - add blank lines before certain return statements > > Changes v1->v2: > - redefine register fields using BIT and GENMASK > - drop _MASK suffix from register field definitions > - drop *_SHIFT definitions where possible > - drop unused rxfifo_full_thrhd_mask and txfifo_empty_thrhd_mask > - split register reads/writes and bitwise operations into multiple lines > - use u8 instead of unsigned char in internal functions > - add timeout to esp32_uart_put_char_sync > - use uart_port_tx_limited in esp32_uart_transmit_buffer > - use IRQ_RETVAL in esp32_uart_int > - disable clock in esp32_uart_startup in case devm_request_irq fails > - rearrange devm_request_irq with enabling IRQs in the UART registers > - drop empty esp32_uart_release_port and esp32_uart_request_port > - simplify esp32_uart_tx_empty > - mask out unsupported CMSPAR flag in termios->c_cflag in > esp32_uart_set_termios > - invoke uart_update_timeout in esp32_uart_set_termios > - drop MODULE_DESCRIPTION > - rearrange esp32_uart_set_baud: return bool indicating whether baud > rate was set or not, use it in the esp32_uart_set_termios to set the > default 115200 > - turn 'locked' into bool in esp32_uart_console_write > - turn num_read into unsigned int in esp32_uart_earlycon_read > > drivers/tty/serial/Kconfig | 13 + > drivers/tty/serial/Makefile | 1 + > drivers/tty/serial/esp32_uart.c | 741 +++++++++++++++++++++++++++++++ > include/uapi/linux/serial_core.h | 3 + > 4 files changed, 758 insertions(+) > create mode 100644 drivers/tty/serial/esp32_uart.c > > diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig > index bdc568a4ab66..d9ca6b268f01 100644 > --- a/drivers/tty/serial/Kconfig > +++ b/drivers/tty/serial/Kconfig > @@ -1578,6 +1578,19 @@ config SERIAL_NUVOTON_MA35D1_CONSOLE > but you can alter that using a kernel command line option such as > "console=ttyNVTx". > > +config SERIAL_ESP32 > + tristate "Espressif ESP32 UART support" > + depends on XTENSA_PLATFORM_ESP32 || (COMPILE_TEST && OF) > + select SERIAL_CORE > + select SERIAL_CORE_CONSOLE > + select SERIAL_EARLYCON > + help > + Driver for the UART controllers of the Espressif ESP32xx SoCs. > + When earlycon option is enabled the following kernel command line > + snippets may be used: > + earlycon=esp32s3uart,mmio32,0x60000000,115200n8,40000000 > + earlycon=esp32uart,mmio32,0x3ff40000,115200n8 > + > endmenu > > config SERIAL_MCTRL_GPIO > diff --git a/drivers/tty/serial/Makefile b/drivers/tty/serial/Makefile > index 138abbc89738..7b73137df7f3 100644 > --- a/drivers/tty/serial/Makefile > +++ b/drivers/tty/serial/Makefile > @@ -88,6 +88,7 @@ obj-$(CONFIG_SERIAL_MILBEAUT_USIO) += milbeaut_usio.o > obj-$(CONFIG_SERIAL_SIFIVE) += sifive.o > obj-$(CONFIG_SERIAL_LITEUART) += liteuart.o > obj-$(CONFIG_SERIAL_SUNPLUS) += sunplus-uart.o > +obj-$(CONFIG_SERIAL_ESP32) += esp32_uart.o > > # GPIOLIB helpers for modem control lines > obj-$(CONFIG_SERIAL_MCTRL_GPIO) += serial_mctrl_gpio.o > diff --git a/drivers/tty/serial/esp32_uart.c b/drivers/tty/serial/esp32_uart.c > new file mode 100644 > index 000000000000..bb5471e8b6b6 > --- /dev/null > +++ b/drivers/tty/serial/esp32_uart.c > @@ -0,0 +1,741 @@ > +// SPDX-License-Identifier: GPL-2.0-or-later Same license and copyright question as I had on the ACM patch. thanks, greg k-h