From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=198.175.65.19 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796389000; b=YMrG7/ZCVKn9moinHQDr+zoYB/ZxjE0+K07ibX/HfU3c0OICc8GuBnmyVl7MUKG5xwJH at3Bw/Qcy2mlbNEe9RP7EtP1vk9WTmd28NYaRGrtI7USsvc5ZBzWMpAFOEdphZ51mS2fM 5dGO16t7sqDgiQM418J23hl3w6Ufvw9Z9rNJa620PjWL5STJUAEgNyaVslaYEFJXh/IjP om4Z30uZ88mZxbgau6ENiPFn9rd1ahO+cMeQEEdXh5/M91+B+2wvOhSxpD/9jh4fZLOer 0WOS/IsZjr4/24v6oXduOtumKy3XXjlktu/roDrN0hD41kCpCRATNCaSko1oI2kAbBg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796389000; h=DMARC-Filter:DKIM-Signature:X-CSE-ConnectionGUID:X-CSE-MsgGUID: X-IronPort-AV:X-IronPort-AV:Received:X-CSE-ConnectionGUID: X-CSE-MsgGUID:X-ExtLoop1:X-IronPort-AV:Received:From:Date:To:cc: Subject:In-Reply-To:Message-ID:References:MIME-Version:Content-Type; bh=3ojSZbeiRFZZHwWuZ8PlOLXQQ3r+JilGrfvz1MgQGag=; b=gGTNfJpE7XucLPxQlf0XrtuQ6wV95PI6kn8VT5as5htD/yCXWeGz+oyNFQoWM7UJq53p JKOHFR2a7VcOdGplxTjG/FWP6Mi1B6T3UlDp0b1TY+S4abzNR6qBA3kpILxr2DOLHveRO MED7AB+q3sCGJ1HLemmZs/nLzGAyne5UjEGU/53UVANDFZGLNkfGBe3Pi+dclbx4snwXI 8RKE63uKUzO58cpDmI5jzKGLqoFJ3Sd4UK98Q9R/BZwn3mQNpDbVyBPN+EzFY0RS+EkcJ L76nev8nKnAQ1nJacWpfX1qNeDchZuze3ayPQmawkkmOxuYfVgQiT2YXmsuSgiAIuYQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=fBCid3th; arc=none smtp.remote-ip=198.175.65.19 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6263D606A683; Fri, 4 Dec 2026 12:56:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 6263D606A683 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=fBCid3th DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796389000; x=1827925000; h=from:date:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=3ojSZbeiRFZZHwWuZ8PlOLXQQ3r+JilGrfvz1MgQGag=; b=fBCid3thf/IZLeNV4KhdEB5X0CepOpXtjEmZ+eKFgqkd3yjaXAKITHyg XCg+TQzZJ/imbLOYfqv3PKqf9k/ErSKj8IlJjsWrsGJPkwx4lVbxWxwvh QDdwbgEW9iWNA+NWsN9UMdVuxeQKYx35FQ9qZO02apUH+F01IPTeMaBVE L+kibgtWyb9Hk2DyBwytxHijEpUbsijrh2NPEiiKoVj4TxryYaJd5uo+m YZ6KM75AgdiNRHIpH8r1lVC/2D2Y7r431hPzS/fIVtHhmZLLxZHy8OwzV sR9nEsiQuiwvOLyO/gOogtQM5q0eS+KTdnzBjyA+0M88BCsAuqtyfV5dD w==; X-CSE-ConnectionGUID: oUhBTbA5R4+yjKthnuf+tg== X-CSE-MsgGUID: iQIrCZm+T6mpRWuAmYnwrA== X-IronPort-AV: E=McAfee;i="6800,10657,11986"; a="5447309" X-IronPort-AV: E=Sophos;i="6.29,78,1794902400"; d="scan'208";a="5447309" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by orvoesa111.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Dec 2026 04:56:40 -0800 X-CSE-ConnectionGUID: a3GYUSqlREe7x+DQxXxrhQ== X-CSE-MsgGUID: b0gmS7vfQ1edMbBEls3bEw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.29,78,1794902400"; d="scan'208";a="14194798" Received: from ijarvine-mobl1.ger.corp.intel.com (HELO localhost) ([10.245.245.47]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Dec 2026 04:56:37 -0800 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Date: Fri, 4 Dec 2026 14:56:33 +0200 (EET) To: Andy Shevchenko cc: Fuyao Kashizuku , linux-serial , Greg Kroah-Hartman , Jiri Slaby , LKML Subject: Re: [PATCH] serial: 8250_dwlib: Restore NOTEMT for em485 In-Reply-To: Message-ID: <7ca747fc-f0d7-8379-5d32-a66e510a7ffa@linux.intel.com> References: X-Mailing-List: linux-serial@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII On Fri, 4 Dec 2026, Andy Shevchenko wrote: > On Sat, Nov 21, 2026 at 02:35:15PM +0800, Fuyao Kashizuku wrote: > > > > A DesignWare UART using software RS485 can transmit one byte and then > > leave the next write queued indefinitely. > > > > dw8250_setup_port() sets UART_CAP_NOTEMT because the UART does not > > interrupt when the shift register becomes empty. If neither hardware > > nor platform data supplies a component parameter register (CPR) value, > > the driver leaves UPF_FIXED_TYPE clear. When autoconfig() identifies > > a 16550A, it replaces the capabilities with the type defaults and drops > > UART_CAP_NOTEMT. > > > > If the TX FIFO empties while the shift register is still busy, __stop_tx() > > then returns without arming the stop timer or clearing THRI. With no > > further interrupt when the last bit leaves the wire, em485 can stay in > > transmit mode and a subsequent write can remain queued. > > > > Restore UART_CAP_NOTEMT in the DW software RS485 configuration callback. > > This lets the existing em485 timer finish the transmission and release > > RTS after the last character. > > ... > > > +static int dw8250_em485_config(struct uart_port *p, struct ktermios *termios, > > + struct serial_rs485 *rs485) > > +{ > > + > > + struct uart_8250_port *up = up_to_u8250p(p); > > + > > + /* > > + * Without CPR, 8250 autoconfiguration can overwrite capabilities. > > + * Restore NOTEMT before enabling emulation: DW has no TEMT interrupt. > > Hmm... The end of the phrase raises a Q: Is it true for *all* versions of > the DW 8250 IP (there are differences between 4.x and older once which might > be related)? My impression there's no TEMT interrupt in DW UART. But if I understand the comment correctly, this problem seem to relate CPRless HW falling back to autoconfig which overwrites what capabilities dwlib set (autoconfig is really annoying as it respects nothing?). > > + */ > > + up->capabilities |= UART_CAP_NOTEMT; > > + > > + return serial8250_em485_config(p, termios, rs485); > > +} > > -- i.