NetBSD Problem Report #53356

From martin@duskware.de  Mon Jun 11 15:38:43 2018
Return-Path: <martin@duskware.de>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 469E67A104
	for <gnats-bugs@gnats.NetBSD.org>; Mon, 11 Jun 2018 15:38:43 +0000 (UTC)
From: martin@NetBSD.org
Reply-To: martin@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: sunxitwi2 fails at boot
X-Send-Pr-Version: 3.95

>Number:         53356
>Category:       kern
>Synopsis:       sunxitwi2 fails at boot
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    thorpej
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jun 11 15:40:00 +0000 2018
>Closed-Date:    Tue Jun 12 13:20:02 +0000 2018
>Last-Modified:  Mon Oct 15 03:10:01 +0000 2018
>Originator:     Martin Husemann
>Release:        NetBSD 8.99.19
>Organization:
The NetBSD Foundation, Inc.
>Environment:
System: NetBSD space-truckin.duskware.de 8.99.19 NetBSD 8.99.19 (SUNXI) #46: Mon Jun 11 10:45:03 CEST 2018 martin@night-owl.duskware.de:/usr/src/sys/arch/evbarm/compile/SUNXI evbarm
Architecture: earmv7hfeb
Machine: evbarm
>Description:

After recent i2c rototill, a CUBIETRUCK when booting a SUNXI kernel
fails with an (nearly) endless stream of:

sunxitwi2: autoconfiguration error: unexpected status 0x20: expect 0x18
sunxitwi2: autoconfiguration error: unexpected status 0x20: expect 0x18
sunxitwi2: autoconfiguration error: unexpected status 0x20: expect 0x18


>How-To-Repeat:
Just boot SUNXI on a cubietruck.

>Fix:
n/a

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: kern-bug-people->thorpej
Responsible-Changed-By: thorpej@NetBSD.org
Responsible-Changed-When: Mon, 11 Jun 2018 16:23:17 +0000
Responsible-Changed-Why:
Probably my fault.


From: Jason Thorpe <thorpej@me.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: kern/53356: sunxitwi2 fails at boot
Date: Mon, 11 Jun 2018 09:32:24 -0700

 > On Jun 11, 2018, at 8:40 AM, martin@NetBSD.org wrote:
 > After recent i2c rototill, a CUBIETRUCK when booting a SUNXI kernel
 > fails with an (nearly) endless stream of:
 >=20
 > sunxitwi2: autoconfiguration error: unexpected status 0x20: expect =
 0x18
 > sunxitwi2: autoconfiguration error: unexpected status 0x20: expect =
 0x18
 > sunxitwi2: autoconfiguration error: unexpected status 0x20: expect =
 0x18

 #define STAT_AWBT_AR    0x18    /* Address + write bit transd, ack recvd =
 */
 #define STAT_AWBT_ANR   0x20    /* Address + write bit transd, ack not =
 recvd */

 So, in other words, it=E2=80=99s waiting for the device to respond, but =
 there=E2=80=99s not one there and it freaks out.  It should not freak =
 out.  Instead, it should return an error after a suitable timeout.

 -- thorpej

From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: kern/53356: sunxitwi2 fails at boot
Date: Mon, 11 Jun 2018 18:40:15 +0200

 On Mon, Jun 11, 2018 at 04:35:01PM +0000, Jason Thorpe wrote:
 >  So, in other words, it=E2=80=99s waiting for the device to respond, but =
 >  there=E2=80=99s not one there and it freaks out.  It should not freak =
 >  out.  Instead, it should return an error after a suitable timeout.

 Maybe it does just that (for some strange value of suitable), but it spams
 dmesg big time while doing that. If the error is silent and timeout
 in a few seconds, all is fine (I actually haven't timed the booting,
 just noticed the strange dmesg later).

 Martin

From: Jason Thorpe <thorpej@me.com>
To: gnats-bugs@NetBSD.org
Cc: Jason Thorpe <thorpej@NetBSD.org>, gnats-admin@netbsd.org,
 netbsd-bugs@netbsd.org, martin@NetBSD.org
Subject: Re: kern/53356: sunxitwi2 fails at boot
Date: Mon, 11 Jun 2018 09:49:11 -0700

 > On Jun 11, 2018, at 9:45 AM, Martin Husemann <martin@duskware.de> =
 wrote:
 >=20
 > Maybe it does just that (for some strange value of suitable), but it =
 spams
 > dmesg big time while doing that. If the error is silent and timeout
 > in a few seconds, all is fine (I actually haven't timed the booting,
 > just noticed the strange dmesg later).

 Will be sending you a patch out-of-band.  It should progress eventually, =
 but the message spam is bogging the while thing down (because GENERIC is =
 wild-carding the i2c address locators, no doubt).

 Perhaps i2c indirect config should also reject wildcard address =
 locators.

 -- thorpej

From: Jason Thorpe <thorpej@me.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: kern/53356: sunxitwi2 fails at boot
Date: Mon, 11 Jun 2018 09:36:16 -0700

 > On Jun 11, 2018, at 9:35 AM, Jason Thorpe <thorpej@me.com> wrote:
 >=20
 > #define STAT_AWBT_AR    0x18    /* Address + write bit transd, ack =
 recvd =3D
 > */
 > #define STAT_AWBT_ANR   0x20    /* Address + write bit transd, ack not =
 =3D
 > recvd */
 >=20
 > So, in other words, it=3DE2=3D80=3D99s waiting for the device to =
 respond, but =3D
 > there=3DE2=3D80=3D99s not one there and it freaks out.  It should not =
 freak =3D
 > out.  Instead, it should return an error after a suitable timeout.
 >=20

 Looking at it again, it seems that we just need to get rid of the =
 printf; seems appropriate for a special-case.

 -- thorpej

State-Changed-From-To: open->closed
State-Changed-By: thorpej@NetBSD.org
State-Changed-When: Tue, 12 Jun 2018 13:20:02 +0000
State-Changed-Why:
Fixed; sent Matrin patch out-of-band, and he confirmed issue is addressed.


From: "Jason R Thorpe" <thorpej@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/53356 CVS commit: src/sys/dev/i2c
Date: Tue, 12 Jun 2018 13:18:48 +0000

 Module Name:	src
 Committed By:	thorpej
 Date:		Tue Jun 12 13:18:48 UTC 2018

 Modified Files:
 	src/sys/dev/i2c: gttwsi_core.c

 Log Message:
 When initiating a transfer, if a device isn't present, we won't
 get an ACK after sending the address.  Check for this alternate
 state and suppress the error message when it occurs.

 Fixes PR kern/53356.


 To generate a diff of this commit:
 cvs rdiff -u -r1.5 -r1.6 src/sys/dev/i2c/gttwsi_core.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Soren Jacobsen" <snj@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/53356 CVS commit: [netbsd-8] src/sys/dev/i2c
Date: Mon, 15 Oct 2018 03:09:07 +0000

 Module Name:	src
 Committed By:	snj
 Date:		Mon Oct 15 03:09:07 UTC 2018

 Modified Files:
 	src/sys/dev/i2c [netbsd-8]: gttwsi_core.c gttwsivar.h

 Log Message:
 Pull up following revision(s) (requested by bouyer in ticket #1061):
 	sys/dev/i2c/gttwsi_core.c: revision 1.4-1.8 via patch
 	sys/dev/i2c/gttwsivar.h: revision 1.4 via patch
 Use IPL_VM for bus lock so we can do i2c xfers from interrupt context
 Don't sleep with IPL_VM lock held.
 When initiating a transfer, if a device isn't present, we won't
 get an ACK after sending the address.  Check for this alternate
 state and suppress the error message when it occurs.
 Fixes PR kern/53356.
 Bail early if gttwsi_send_start() fails in gttwsi_initiate_xfer() to
 avoid unexpected state error message later (on Allwinner H5).
 Expand code covered by sc->sc_mtx, to make sure an interrupt would not be
 handled before the cv_timedwait_sig() call, or while polling.
 Seems to fix "sunxitwi0: send STOP failed" messages frequently seen related
 to axp20x0 sensors.


 To generate a diff of this commit:
 cvs rdiff -u -r1.2 -r1.2.12.1 src/sys/dev/i2c/gttwsi_core.c \
     src/sys/dev/i2c/gttwsivar.h

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.