Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2531227pxb; Thu, 11 Feb 2021 15:11:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJx2fbYuTDZ71RY6+38BN/yYTZ2F3cFc7XSK22NIX9n+4KGwzhh0lQ3q3b8dl3xJ7somlDg+ X-Received: by 2002:a17:906:3105:: with SMTP id 5mr64815ejx.168.1613085064833; Thu, 11 Feb 2021 15:11:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613085064; cv=none; d=google.com; s=arc-20160816; b=WuXWC0nvwM6EX0DYM9sF7IjKqBj6R9VWMNxDikie4tnWuWDCeKoo69W700nQIi4zsP XgbStAbYKpnBZ7heqb/JjvVFW4v6ZQP8338HYFemYIeNjt4Kc/EV0BtIjiH6wpsfEtrn QJxATbGNOXhAuAIPOpOJm02mUXQS5XWEF1gSG2/7PZ/a/KEj1eW9k0+Q0/aaeuA2kLbk kKJgVuMPsYC8NAYJb6ujhFOP7/eDRE0MBhHilvY4NAoNLrsrZfG19TSrcK6Xh6Sd+mYk SrFxIimktvmIEGOI/rH7R3BLHIHx5TaXRfp4eLcV9UxOFF/URzAYwV14oaqui4kF/QOA gk4Q== 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=1JD+F06Y+vv4Bjxm/9vS34cUG1/d3eYEltHBP8T+2Es=; b=xI+vaCQwU06ljiMaudqzMWaKLa1kQHbNz0G21G9Hp3Ukddpys7DKPHloERUvE18VBR IN+lFfli7w/nehc6s5WPOgmJ3rQAnz4FH8ZJ+pmpv1CTvHZ0TRWb5FpW0dwLB8RLxN1R UHt3ksBBSDtvmcm9wAEjay0IpZywWXxa1/em6AE7UJzeabWFMdkVDgVqZhTcJrdfs7of ZgHqO7f7+CA+EifNvyM7fXokebS4FvhSR2m5x8x/o1WGeQ8BzVPLML834VND9OXaZIRA yOcSujbn0bKqVZ9BKXI0xyrA1rxpIWl6SsPF0ZwtAzDe1XoH2GSP5A0cpV6WGXlvyaQl yChw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gf2si5282151ejb.154.2021.02.11.15.10.41; Thu, 11 Feb 2021 15:11:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229683AbhBKXKD (ORCPT + 99 others); Thu, 11 Feb 2021 18:10:03 -0500 Received: from angie.orcam.me.uk ([157.25.102.26]:47402 "EHLO angie.orcam.me.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229564AbhBKXKC (ORCPT ); Thu, 11 Feb 2021 18:10:02 -0500 Received: by angie.orcam.me.uk (Postfix, from userid 500) id 2AC2B9200B4; Fri, 12 Feb 2021 00:09:20 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by angie.orcam.me.uk (Postfix) with ESMTP id 242799200B3; Fri, 12 Feb 2021 00:09:20 +0100 (CET) Date: Fri, 12 Feb 2021 00:09:20 +0100 (CET) From: "Maciej W. Rozycki" To: Thomas Gleixner cc: Linus Torvalds , Serge Belyshev , Dirk Gouders , =?UTF-8?Q?Micka=C3=ABl_Sala=C3=BCn?= , LKML , Alexandre Belloni , Jason Gunthorpe , Miroslav Lichvar , John Stultz , Prarit Bhargava , Alessandro Zummo , linux-rtc@vger.kernel.org, Peter Zijlstra Subject: Re: [PATCH V2] rtc: mc146818: Dont test for bit 0-5 in Register D In-Reply-To: <87wnvrbmqx.fsf@nanos.tec.linutronix.de> Message-ID: References: <20201206214613.444124194@linutronix.de> <20201206220541.594826678@linutronix.de> <19a7753c-c492-42e4-241a-8a052b32bb63@digikod.net> <871re7hlsg.fsf@nanos.tec.linutronix.de> <98cb59e8-ecb4-e29d-0b8f-73683ef2bee7@digikod.net> <87y2gfg18p.fsf@nanos.tec.linutronix.de> <87tur3fx7w.fsf@nanos.tec.linutronix.de> <877dnrc2sv.fsf@depni.sinp.msu.ru> <8735yfd2q4.fsf@nanos.tec.linutronix.de> <87zh0nbnha.fsf@nanos.tec.linutronix.de> <87wnvrbmqx.fsf@nanos.tec.linutronix.de> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 1 Feb 2021, Thomas Gleixner wrote: > >> While it cures the problem on the reporters machine it breaks machines > >> with Intel chipsets which use bit 0-5 of the D register. So check only > >> for bit 6 being 0 which is the case on these Intel machines as well. > > > > This looks fine, but it might also be worth it simply just checking > > for the only really special value: 0xff, and going "ok, that looks > > like missing hardware". > > > > That's what a few other drivers historically do in their probing > > routines, so it's not unheard of (ie you can find drivers doing that > > kind of > > > > /* If we read 0xff from the LSR, there is no UART here. */ > > if (inb(.. port ..) == 0xff) > > > > in their init routines. > > > > Not a big deal either way, I just think it would be more in like with > > what other places do in similar situations > > Yeah, we can do that as well. Either way is fine. Given that evidently vendors appear to start playing with 146818 clones it may be worth it to peek at the D and the C register and checking they are not 0xff both at a time for robustness before concluding no RTC is present. The C register is supposed to hold zeros in bits 3:0. A read of the C register will drop interrupt bits, but I guess it does not matter at the probe time. FWIW, Maciej