Re: [PATCH v4 3/5] drivers/tty/serial: add driver for the ESP32 UART

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <jcmvbkbc@xxxxxxxxx>
> ---
> 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




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux