From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 800D2C38A24 for ; Thu, 7 May 2020 08:20:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5C3372084D for ; Thu, 7 May 2020 08:20:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588839611; bh=nGLRTK4hez5Fyysz7zTFJZsP23ORvEQ/cxKPGQGhVgk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=2QdSl14+5dwgsZ/HB1ekr4bq4ZkP0C0hKSAKQxWQQ33MYgM6hsP+bmhvT78xCkhSZ qx6xLVFrZWSXM6o/a+T/MxpG6RE2HtDrUx4iS31cPVJkCfQe/OwVvdkixhwWjSQE7O sfvzBFQEaPIy4kRWU/VdBgknQpDaibuf96FLFA7s= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725949AbgEGIUL (ORCPT ); Thu, 7 May 2020 04:20:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:37422 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725809AbgEGIUL (ORCPT ); Thu, 7 May 2020 04:20:11 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AFF8F2078C; Thu, 7 May 2020 08:20:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588839610; bh=nGLRTK4hez5Fyysz7zTFJZsP23ORvEQ/cxKPGQGhVgk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=k0s1gzdp1cf51NCY3wHwAZ+EHE7TuG+gHnOVSR3sjOgeie8GpAm0GtDH8RGx4jxLe ZwUA5PdRVH/rr4gMPVXfMFJv8zfquP+mwqKmE0VydkAgeiiy1R3a8fo8dDL1bD4N3b 53OGW1PbGoiaQMrJfa09NPPOhT9j4RPoSvhEWlzc= Date: Thu, 7 May 2020 10:20:07 +0200 From: Greg Kroah-Hartman To: Mikulas Patocka Cc: Arnd Bergmann , Richard Henderson , Ivan Kokshaysky , Matt Turner , alpha , Sinan Kaya , linux-serial@vger.kernel.org, linux-rtc@vger.kernel.org Subject: Re: [PATCH 1/2 v3] alpha: add a delay to inb_p, inb_w and inb_l Message-ID: <20200507082007.GD1024567@kroah.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-rtc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rtc@vger.kernel.org On Thu, May 07, 2020 at 04:06:31AM -0400, Mikulas Patocka wrote: > > > On Wed, 6 May 2020, Mikulas Patocka wrote: > > > > > > > On Wed, 6 May 2020, Arnd Bergmann wrote: > > > > > On Wed, May 6, 2020 at 1:21 PM Mikulas Patocka wrote: > > > > > > > /* > > > > * The yet supported machines all access the RTC index register via > > > > * an ISA port access but the way to access the date register differs ... > > > > + * > > > > + * The ISA bus on Alpha Avanti doesn't like back-to-back accesses, > > > > + * we need to add a small delay. > > > > */ > > > > #define CMOS_READ(addr) ({ \ > > > > outb_p((addr),RTC_PORT(0)); \ > > > > +udelay(2); \ > > > > inb_p(RTC_PORT(1)); \ > > > > > > > > > The inb_p() / outb_p() functions are meant to already have a delay in them, > > > maybe we should just add it there for alpha? > > > > > > Arnd > > > > Yes, that is possible too - it fixes the real time clock hang for me. > > > > > > -#define inb_p inb > > -#define inw_p inw > > -#define inl_p inl > > +#define inb_p(x) (ndelay(300), inb(x)) > > +#define inw_p(x) (ndelay(300), inw(x)) > > +#define inl_p(x) (ndelay(300), inl(x)) > > #define outb_p outb > > #define outw_p outw > > #define outl_p outl > > 300ns was too low. We need at least 1400ns to fix the hang reliably. > > Mikulas > > > From: Mikulas Patocka > > The patch 92d7223a74235054f2aa7227d207d9c57f84dca0 ("alpha: io: reorder > barriers to guarantee writeX() and iowriteX() ordering #2") broke boot on > the Alpha Avanti platform. > > The patch changes timing between accesses to the ISA bus, in particular, > it reduces the time between "write" access and a subsequent "read" access. > > This causes lock-up when accessing the real time clock and serial ports. > > This patch fixes the real time clock by adding a small delay to the inb_p, > inw_p and inl_p macros. > > Signed-off-by: Mikulas Patocka > Fixes: 92d7223a7423 ("alpha: io: reorder barriers to guarantee writeX() and iowriteX() ordering #2") > Cc: stable@vger.kernel.org # v4.17+ > > --- > arch/alpha/include/asm/io.h | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) This is not in a format that anyone can apply it in, please resend in a proper way if you wish for it to be accepted. thanks, greg k-h