Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp774517iog; Fri, 24 Jun 2022 13:55:38 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vMIqkITbj3f1A1szSs07pK/8AWxuhRB7DaRrtOPar6p5tK5QWU8G+tOUYTrObtdaR5YG0S X-Received: by 2002:a17:902:f689:b0:16a:4021:8848 with SMTP id l9-20020a170902f68900b0016a40218848mr929979plg.23.1656104137947; Fri, 24 Jun 2022 13:55:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656104137; cv=none; d=google.com; s=arc-20160816; b=DrgAXlE5IKJy4PxMHbPyUbY0ElrTTCFg9jc1BZ1PcH0RI+JQoybtY+DbgTvYRI/1I1 /h0boV5jdu6Hbb/Bl6xyaXC1T8e99Ey5D6uowR+te87InGJTn3DPiC9ys8xQufIfdYNY ML7oFYw85tD766KXDXMTU34hO7uZxhrktJoVw5vwgv4AqiPku0mFdjbDjfLsOS1NbIYJ 8/9NObbzLlcPL2TKvYd8Sg4UmOhC4GUABHbkrMbOnXsmm8kEx78Jvw4YPfTu1SqhA/KU jPo7xlKSdm2jPYDgutbL4pvYBG5AgNdDGgpv+iE6jcBJRLGUBKBkX/eGojuDzbl4wsHQ YV/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=rii1hcE+se4VgGeVfw2wyfb3N5rC4m68E1/RkFKMhGQ=; b=yOdE7PSV7fmqGxITC9sWuD+goOyxuhvpaTnZClGOWVmQm/G+Ibl/ZX2dytKeWNL6hi DEspFEL5d4DfMXR2fPc79sA6Y0BZr9NNH3y0BnWRVlM0v4R3BuLxZ3OPKCF5R5WuHbeI jMTWWaMN4/K9XKQQjF9DqaqZ++MBIs8rvh87DTKRkeUhOyku6hl9eW4YCumjhnobNfic JWSMRE35A3rJVHziY3DfJm9ichcaDL+Vw0tSaYFLw4Xa6byTO5unzUQ1fNI8gIFHlrtK rvzyxeABtwwJ3friEfAiOiZPYUuIwMWJgvqzeWkifBaY1+DtsZ8HjWkua2BfNKNfwg0X X7aA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=YefmMOMq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b13-20020aa78ecd000000b005251a2f06bbsi3846759pfr.59.2022.06.24.13.55.25; Fri, 24 Jun 2022 13:55:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=YefmMOMq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231524AbiFXUmf (ORCPT + 99 others); Fri, 24 Jun 2022 16:42:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231518AbiFXUme (ORCPT ); Fri, 24 Jun 2022 16:42:34 -0400 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 040D463630; Fri, 24 Jun 2022 13:42:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1656103353; x=1687639353; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=Gi3SedSmi1CW56jyMna7RkNN3gSo+ueP2DFVYUbNY9U=; b=YefmMOMqvvVJvEHGPSKQPiimdM9YM7A/kg4R4YOXzwTW+N51B2JPngLV 4nFYRTZ9IalC5azRscGaP49CHo1OTxSzEFboL8AquRzpWCCC9xy8ffs4J FIkr2SDpFM1Sxoi3osPDvcMN4XJGklfTuMjwKGHQMIvFZDdklj5yomIL9 P58Ac/+ztsNLbCwL8ZhXMskOn/Gk/kVfwAAlsNh/tddQfwHphf95A7dAu LhpyfiZ8FhH+Fs89lH2yanFc9Lvg/MvKjPVn5t+iNtfr+HqVfu7v9vE8J YqJ8T9ivI0Od2WZw3r7KSZsZQuUe77CVrXq5waFzFukMVkK00hoLthANJ w==; X-IronPort-AV: E=McAfee;i="6400,9594,10388"; a="278633905" X-IronPort-AV: E=Sophos;i="5.92,220,1650956400"; d="scan'208";a="278633905" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jun 2022 13:42:32 -0700 X-IronPort-AV: E=Sophos;i="5.92,220,1650956400"; d="scan'208";a="593381014" Received: from vhavel-mobl.ger.corp.intel.com (HELO ijarvine-MOBL2.ger.corp.intel.com) ([10.251.216.91]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jun 2022 13:42:29 -0700 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= To: linux-serial@vger.kernel.org, Greg KH , Jiri Slaby Cc: linux-kernel@vger.kernel.org, Andy Shevchenko , Lukas Wunner , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Lino Sanfilippo , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Arnd Bergmann , linux-api@vger.kernel.org, linux-arch@vger.kernel.org Subject: [PATCH v9 0/6] Add RS485 9th bit addressing mode support to DW UART Date: Fri, 24 Jun 2022 23:42:04 +0300 Message-Id: <20220624204210.11112-1-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patchset adds RS-485 9th bit addressing mode support to the DW UART driver and the necessary serial core bits to handle it. The addressing mode is configured through ->rs485_config() as was requested during the review of the earlier versions. The line configuration related ADDRB is still kept in ktermios->c_cflag to be able to take account the extra addressing bit while calculating timing, etc. but it is set/cleared by ->rs485_config(). Cc: Arnd Bergmann Cc: linux-api@vger.kernel.org Cc: linux-arch@vger.kernel.org v8 -> v9: - Tweak comments (struct fields info & one callback style correction) - Add struct layout checks as static_asserts v7 -> v8: - Use anonymous union/struct in serial_rs485 to create "v2" of it - Remove a stray newline change - Reorder local var declarations - Put ktermios param before serial_rs485 for rs485_config v6 -> v7: - Fixed typos in documentation & comment - Changes lsr typing from unsigned int to u16 v5 -> v6: - Reorder remaining patches - LSR changes are simpler due to helper added by LSR fix series - Depend on rs485_struct sanitization on catching much of invalid config - In order to be able to alter ADDRB in termios .c_cflag within .rs485_config(), take termios_rwsem and pass ktermios to it. - Moved addressing mode setup entirely into .rs485_config() - Use ndelay() instead of udelay() (uart_port->frame_time is in nsecs) Ilpo Järvinen (6): serial: 8250: make saved LSR larger serial: 8250: create lsr_save_mask serial: 8250_lpss: Use 32-bit reads serial: take termios_rwsem for ->rs485_config() & pass termios as param serial: Support for RS-485 multipoint addresses serial: 8250_dwlib: Support for 9th bit multipoint addressing Documentation/driver-api/serial/driver.rst | 2 + .../driver-api/serial/serial-rs485.rst | 26 ++++- drivers/tty/serial/8250/8250.h | 9 +- drivers/tty/serial/8250/8250_core.c | 4 + drivers/tty/serial/8250/8250_dw.c | 2 +- drivers/tty/serial/8250/8250_dwlib.c | 105 +++++++++++++++++- drivers/tty/serial/8250/8250_exar.c | 11 +- drivers/tty/serial/8250/8250_fintek.c | 2 +- drivers/tty/serial/8250/8250_fsl.c | 2 +- drivers/tty/serial/8250/8250_ingenic.c | 2 +- drivers/tty/serial/8250/8250_lpc18xx.c | 2 +- drivers/tty/serial/8250/8250_lpss.c | 2 +- drivers/tty/serial/8250/8250_omap.c | 7 +- drivers/tty/serial/8250/8250_pci.c | 2 +- drivers/tty/serial/8250/8250_port.c | 20 ++-- drivers/tty/serial/amba-pl011.c | 2 +- drivers/tty/serial/ar933x_uart.c | 2 +- drivers/tty/serial/atmel_serial.c | 2 +- drivers/tty/serial/fsl_lpuart.c | 4 +- drivers/tty/serial/imx.c | 2 +- drivers/tty/serial/max310x.c | 2 +- drivers/tty/serial/mcf.c | 3 +- drivers/tty/serial/omap-serial.c | 3 +- drivers/tty/serial/sc16is7xx.c | 2 +- drivers/tty/serial/serial_core.c | 36 +++++- drivers/tty/serial/stm32-usart.c | 2 +- drivers/tty/tty_ioctl.c | 4 + include/linux/serial_8250.h | 7 +- include/linux/serial_core.h | 1 + include/uapi/asm-generic/termbits-common.h | 1 + include/uapi/linux/serial.h | 20 +++- 31 files changed, 238 insertions(+), 53 deletions(-) -- 2.30.2