Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp3046011pxb; Mon, 18 Apr 2022 14:22:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyfv8QPmvKPcylIcAsC8ehvoNHOLJ8bvCAGKneXSIReJO/D+nt1/5y4pBVduqdE3QiJdXnC X-Received: by 2002:aa7:d292:0:b0:41d:7933:1f00 with SMTP id w18-20020aa7d292000000b0041d79331f00mr13933789edq.237.1650316947798; Mon, 18 Apr 2022 14:22:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650316947; cv=none; d=google.com; s=arc-20160816; b=bZgk7xBOF/bpkAS8JiBdN7PPfy93nvI4MAV2MoT7mPx0p5ti/aIdpGnWW+cTWIrTZM MTsufm5yBseWw5C7ofIoBrkkp3IpU3A+PbhHL7HF6sCrCxaSiCLaFgtyJHC2xW/xDJ7Z syamP1FkD92DUyeWSph630R+vDuskd3caAoD+wsHBDWOK65PW6jNuTCTFdTZ1cNwjtUu 4IGV5jwUm9fC3tOJafoIYaHqsGAMKzyjxr5opRtED4rg5HEpt+MIB4Bkb49DO9IGMl2E Ow1wwKjKKohd+PpRcAU8Rw/2CmHc+Zrj+RRHlf3kNZ6I9y68W/h2YV54VuaLCiysS9Ks mQ+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:message-id :in-reply-to:subject:cc:to:from:date; bh=DOfzltY8t7/Q0Xg5LKP6D0rL64vHZPcFrCYgcwHqL7s=; b=AcfBj/WwkGe+XG+MGuFsqZ9J/ksEc/aL9snKb8P3ojgnCEWt+1EmfX4f8pJc/C5/fR qpLxcL9B3KdalxwP/bG5GaKNRBiATup+9LxO9vXRYrqFqmf09NI/RG+a8rgBjhBdC9Hw Yb4ozA94+gOJUcojA+NjJ++IR6tAy4Dn/DjLSbFTvkAXlhftQ9AXLidXIu7JzFbaJPYA DPSW87SV18K1LjdsW6CW3twpdVFvZjob85rzJdQSsFa+aYkX0l9bABioacouKdapCNOY PRum0y8cy3/ekRjaWLoZZZDzsVVEwbyeu4qjv1j0YlTnw3JrwiPPX8FT0YtDA6hfQauL XzHw== ARC-Authentication-Results: i=1; mx.google.com; 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 bf2-20020a0564021a4200b0041953d28471si6819532edb.235.2022.04.18.14.22.02; Mon, 18 Apr 2022 14:22:27 -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; 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 S1345531AbiDRPvA (ORCPT + 99 others); Mon, 18 Apr 2022 11:51:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345756AbiDRPua (ORCPT ); Mon, 18 Apr 2022 11:50:30 -0400 Received: from angie.orcam.me.uk (angie.orcam.me.uk [IPv6:2001:4190:8020::34]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5BF15B867; Mon, 18 Apr 2022 08:28:41 -0700 (PDT) Received: by angie.orcam.me.uk (Postfix, from userid 500) id B226092009E; Mon, 18 Apr 2022 17:28:40 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by angie.orcam.me.uk (Postfix) with ESMTP id AC96192009C; Mon, 18 Apr 2022 16:28:40 +0100 (BST) Date: Mon, 18 Apr 2022 16:28:40 +0100 (BST) From: "Maciej W. Rozycki" To: Andy Shevchenko cc: Greg Kroah-Hartman , Jiri Slaby , "open list:SERIAL DRIVERS" , Linux Kernel Mailing List Subject: Re: [PATCH v4 5/5] serial: 8250: Add proper clock handling for OxSemi PCIe devices In-Reply-To: Message-ID: References: User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,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 On Mon, 18 Apr 2022, Andy Shevchenko wrote: > > With the baud base set to 15625000 and the unsigned 16-bit UART_DIV_MAX > > limitation imposed by `serial8250_get_baud_rate' standard baud rates > > below 300bps become unavailable in the regular way, e.g. the rate of > > 200bps requires the baud base to be divided by 78125 and that is beyond > > the unsigned 16-bit range. The historic spd_cust feature can still be > > used to obtain such rates if so required. > > > > See Documentation/tty/device_drivers/oxsemi-tornado.rst for more details. > > I'm not sure I understand how this change can have the 8250_port > changes which were done in the previous patches. What did I miss? You mean the `->mcr' part? It's required to keep the CLKSEL bit set at all times. > Also, looking at the below if the two *_icr_*() functions were moved > from 8250_port, how they have been used before? Dead code? They continue being used throughout 8250_port.c: `serial_icr_read' in `autoconfig_has_efr' and `serial_icr_write' in `serial8250_stop_tx', `__start_tx', and `serial8250_do_startup'. If they were dead, GCC would complain about their presence (without `__maybe_unused' annotation or an equivalent syntax to get the `unused' function atttribute). Now `serial_icr_write' is also used by `pci_oxsemi_tornado_set_divisor', and for consistency I chose to export `serial_icr_read' as well. Let me know if these explanations have cleared your concerns. > > + /* Old custom speed handling. */ > > + if (baud == 38400 && (port->flags & UPF_SPD_MASK) == UPF_SPD_CUST) { > > This part is not needed. We have a BOTHER mechanism in the kernel > that works for each driver that supports it in the generic way, hence > the user space tool wouldn't be patched to support this exact card > separately. Using SPD_CUST is a step back. As previously discussed I maintain this is a reasonable compromise until we have issues with BOTHER and other regular termios interfaces such as B200 fixed; specifically the 16-bit UART_DIV_MAX limitation making it impossible to request baud rates below 300bps, as also noted in the change description, and the inability to set exact clock rates which may be required in some applications relying on the presence of the SPD_CUST feature. NB I agree that wiring SPD_CUST to the 38400bps baud rate hasn't been particularly fortunate, but that's what used to be available in terms of the API back in 1990s, as I previously explained. I have now posted v5 with the grammatical issues fixed and an additional update to make use of the DIV_ROUND_CLOSEST macro I have come across while looking into an unrelated issue. Thank you for your review. Maciej