Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp193564imw; Fri, 15 Jul 2022 00:50:17 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vhULF/pVYyxlBBuIVGZSd/R8b1bLDiCmtDAZgaWFpite5hHzFp12V3Iho4ZrYDitpE0r+a X-Received: by 2002:a17:907:28c8:b0:72b:97cd:d628 with SMTP id en8-20020a17090728c800b0072b97cdd628mr12420832ejc.208.1657871417648; Fri, 15 Jul 2022 00:50:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657871417; cv=none; d=google.com; s=arc-20160816; b=MwSRkIkfEi1i9ZHJrKCmwaCdd5gn/6W57odYtlCJ11l3MfztSoESZznW3gm7vWF09C VQQ0F6RWBPq54KM4QLmv0PmNt0y+1Jj7ii1wT56sV+LRNA/5k9qkgQAut02ja+Rpn7iu BQAF0PB8Vz0S0iOZKk+WNrsYBBvZajQvsh/PQehjvBdr5uNm4qnLjrUCtq50PlZD3ri3 L3tbmS81RW7tlLo3dQ2k4to6oi2eC56RaHGa9chvUAYjaMU81Clx9BEkxzAUpbZRS8d/ ExhDlSLTPEpObCQVE5tu5+v4Xcznp9LQ1krP6M4GBumDM0+FhRUXzqR8KTI9ZYe9424V f54Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:user-agent:references:in-reply-to :subject:cc:to:from:date:content-transfer-encoding:mime-version :dkim-signature; bh=6SnvQG5VhCJCXnGPvoEalEA0+MbJXBkQo3LdF+0/Y4Y=; b=Jr9gcdDRX1VANs08MCfTIP44hxT8Usnl3a0+v7M81UNcsTer24sXMFz1JXcQoi9mWB 1A32ggVThR1bxAauvPWjoRCpqfp7m/9rUc2YU5cZFaarTdSArVTJipmZ/oeLqi+6eSz0 tYvxg5nglmG38G1+/IPusdTX7uzKJmHz8QLCOZX8cura4N1lov2bx/UbEypZH9MSl3/j cAm+tYjxEo4ARhj/a+VeMPdBb6Wwc6LprIIHGBSNUjMl1UKYSXUyvs6+h8Gse9ytTJ57 EYY0ozk77FF+7NF4lwN/hF97hKy6aEkGaVawnc3mz5rxm/dl3xaLefWHN/K/3T9OyF5w lydw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=g44IL4KK; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hv11-20020a17090760cb00b0072b3bc0d215si2270393ejc.149.2022.07.15.00.49.53; Fri, 15 Jul 2022 00:50:17 -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=@walle.cc header.s=mail2016061301 header.b=g44IL4KK; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232055AbiGOHmK (ORCPT + 99 others); Fri, 15 Jul 2022 03:42:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229693AbiGOHmI (ORCPT ); Fri, 15 Jul 2022 03:42:08 -0400 Received: from ssl.serverraum.org (ssl.serverraum.org [176.9.125.105]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89C737C1A1; Fri, 15 Jul 2022 00:42:07 -0700 (PDT) Received: from ssl.serverraum.org (web.serverraum.org [172.16.0.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ssl.serverraum.org (Postfix) with ESMTPSA id D48DD2223E; Fri, 15 Jul 2022 09:42:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1657870925; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6SnvQG5VhCJCXnGPvoEalEA0+MbJXBkQo3LdF+0/Y4Y=; b=g44IL4KKkMiMQ/5uce+1CnL1rNVoDMJaJfLZ6Cvf11WSO8lmkxBH9aYJI4Twoo3nTG3OEv b3giAdZYwCij/S81+8q6iKp4Kvzayymviu0dxbxyBGDEKlDXCH1ZJKlVYgOABYY4rUTAjV lGEaY8K37kZs6IBBgwWtj0AqkcbwaSY= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 15 Jul 2022 09:42:05 +0200 From: Michael Walle To: Sherry Sun Cc: gregkh@linuxfoundation.org, jirislaby@kernel.org, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, dl-linux-imx Subject: Re: [PATCH 2/2] tty: serial: fsl_lpuart: writing a 1 and then a 0 to trigger a break character In-Reply-To: References: <20220715025944.11076-1-sherry.sun@nxp.com> <20220715025944.11076-3-sherry.sun@nxp.com> <509669b26b5899088e9b77ed94d103ee@walle.cc> User-Agent: Roundcube Webmail/1.4.13 Message-ID: X-Sender: michael@walle.cc X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,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 Hi, Am 2022-07-15 09:20, schrieb Sherry Sun: >> Subject: Re: [PATCH 2/2] tty: serial: fsl_lpuart: writing a 1 and then >> a 0 to >> trigger a break character >> >> Hi, >> >> Am 2022-07-15 04:59, schrieb Sherry Sun: >> > According to the lpuart reference manual, need to writing a 1 and then >> > a >> > 0 to the UARTCTRL_SBK field queues a break character in the transmit >> > data stream. Only writing a 1 cannot trigger the break character, so >> > fix it. >> >> I don't think this is correct. The tty core will already call this: >> .break_ctl(port, 1) >> usleep() >> .break_ctl(port, 0) >> >> So you'll have your 1->0 transition. >> >> My RM from the LS1028A says the following: >> >> | Writing a 1 and then a 0 to SBK queues a break character in the >> | transmit data stream. Additional break characters of 10 to 13, or 13 >> | to 16 if LPUART_STATBRK13] is set, bit times of logic 0 are queued >> as >> | long as SBK is set. Depending on the timing of the set and clear of >> | SBK relative to the information currently being transmitted, a >> second >> | break character may be queued before software clears SBK. >> >> To me it seems that setting the SBK bit just pulls the TX line low and >> releasing >> it will return to normal transmitter mode. >> > > Hi Michael, > > Actually set break_ctl(tty, -1) then break_ctl(tty, 0) is only done in > the send_break() function. > If we call TIOCSBRK from user space, it will only set break_ctl(tty, > -1) without break_ctl(tty, 0). That is expected. no? There is also the TIOCCBRK which will clear the break. TIOCSBRK will just turn the break on. I'm not sure if the break is already transmitted when the SBK bit is set, though. Is that your problem here? I'd need to check that on the real hardware. > And from the definition of .break_ctl(port,ctl), the callback is used > to Control the transmission of a break > signal(Documentation/driver-api/serial/driver.rst), if ctl is nonzero, > it should queues a break character. I don't think it is reasonable to > call break_ctl() twice in order to send one break signal. Maybe Gred can correct me, but to me it seems like the .break_ctl() will set the *state* according to the argument, that is either turning it on or turning it off (Except if TTY_DRIVER_HARDWARE_BREAK is set, but that doesn't seem to be supported by the ioctl interface.) > Also I have tried other uart IP, such as drivers/tty/serial/imx.c, it > also queues a break character if we call break_ctl() once. So I > believe the break_ctl() in lpuart driver should be fixed. -michael