NetBSD Problem Report #48855

From www@NetBSD.org  Fri May 30 21:04:44 2014
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	(using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id C4003A6512
	for <gnats-bugs@gnats.NetBSD.org>; Fri, 30 May 2014 21:04:44 +0000 (UTC)
Message-Id: <20140530210443.4A02BA6524@mollari.NetBSD.org>
Date: Fri, 30 May 2014 21:04:43 +0000 (UTC)
From: yunixx@gmail.com
Reply-To: yunixx@gmail.com
To: gnats-bugs@NetBSD.org
Subject: i2cscan on RPi NetBSD build finds device for all addresses
X-Send-Pr-Version: www-1.0

>Number:         48855
>Category:       port-arm
>Synopsis:       i2cscan on RPi NetBSD build finds device for all addresses
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    port-arm-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri May 30 21:05:00 +0000 2014
>Last-Modified:  Sat Jan 24 00:25:00 +0000 2015
>Originator:     Yunis Mustafa
>Release:        evbarm-earmhf 201405181900Z
>Organization:
>Environment:
NetBSD rpi 6.99.42 NetBSD 6.99.42 (RPI) #0: Sun May 18 20:34:46 UTC 2014  builds@b44.netbsd.org:/home/builds/ab/HEAD/evbarm-earmhf/201405181900Z-obj/home/builds/ab/HEAD/src/sys/arch/evbarm/compile/RPI evbarm
>Description:
i2cscan /dev/iic0 (or iic1) erroneously detects devices and prints out the following for pretty much every address:

/dev/iic0: found device at 0x09
/dev/iic0: found device at 0x0a
/dev/iic0: found device at 0x0b
/dev/iic0: found device at 0x0d
/dev/iic0: found device at 0x0e
/dev/iic0: found device at 0x0f
/dev/iic0: found device at 0x10
/dev/iic0: found device at 0x11
/dev/iic0: found device at 0x12
/dev/iic0: found device at 0x13
/dev/iic0: found device at 0x14
/dev/iic0: found device at 0x15
/dev/iic0: found device at 0x16
/dev/iic0: found device at 0x17
/dev/iic0: found device at 0x18
/dev/iic0: found device at 0x19
/dev/iic0: found device at 0x1a
/dev/iic0: found device at 0x1b
/dev/iic0: found device at 0x1c
/dev/iic0: found device at 0x1d
/dev/iic0: found device at 0x1e
/dev/iic0: found device at 0x1f
/dev/iic0: found device at 0x20
/dev/iic0: found device at 0x21
/dev/iic0: found device at 0x22
/dev/iic0: found device at 0x23
/dev/iic0: found device at 0x24
/dev/iic0: found device at 0x25
/dev/iic0: found device at 0x26
/dev/iic0: found device at 0x27
/dev/iic0: found device at 0x29
/dev/iic0: found device at 0x2a
/dev/iic0: found device at 0x2b
/dev/iic0: found device at 0x2c
/dev/iic0: found device at 0x2d
/dev/iic0: found device at 0x2e
/dev/iic0: found device at 0x2f
/dev/iic0: found device at 0x38
/dev/iic0: found device at 0x39
/dev/iic0: found device at 0x3a
/dev/iic0: found device at 0x3b
/dev/iic0: found device at 0x3c
/dev/iic0: found device at 0x3d
/dev/iic0: found device at 0x3e
/dev/iic0: found device at 0x3f
/dev/iic0: found device at 0x40
/dev/iic0: found device at 0x41
/dev/iic0: found device at 0x42
/dev/iic0: found device at 0x43
/dev/iic0: found device at 0x44
/dev/iic0: found device at 0x45
/dev/iic0: found device at 0x46
/dev/iic0: found device at 0x47
/dev/iic0: found device at 0x4c
/dev/iic0: found device at 0x4d
/dev/iic0: found device at 0x4e
/dev/iic0: found device at 0x4f
/dev/iic0: found device at 0x60
/dev/iic0: found device at 0x62
/dev/iic0: found device at 0x63
/dev/iic0: found device at 0x64
/dev/iic0: found device at 0x65
/dev/iic0: found device at 0x66
/dev/iic0: found device at 0x67
/dev/iic0: found device at 0x68
/dev/iic0: found device at 0x69
/dev/iic0: found device at 0x6a
/dev/iic0: found device at 0x6b
/dev/iic0: found device at 0x6c
/dev/iic0: found device at 0x6d
/dev/iic0: found device at 0x6e
/dev/iic0: found device at 0x6f
/dev/iic0: found device at 0x70
/dev/iic0: found device at 0x71
/dev/iic0: found device at 0x72
/dev/iic0: found device at 0x73
/dev/iic0: found device at 0x74
/dev/iic0: found device at 0x75
/dev/iic0: found device at 0x76
/dev/iic0: found device at 0x77
/dev/iic0: 80 devices found
>How-To-Repeat:
i2cscan /dev/iic0

on a Raspberry Pi
>Fix:
On further debugging, it seems that the iic_smbus_quick_write() used by i2cscan.c to detect the devices returns success erroneously for some reason. 

If iic_smbus_receive_byte() is used instead to detect the devices, it correctly detects only the actual devices connected to the i2c bus (at least in my testing with an i2c device with address 0x11)

>Audit-Trail:
From: "Jonathan A. Kollasch" <jakllsch@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/48855 CVS commit: src/sys/arch/arm/broadcom
Date: Sat, 24 Jan 2015 00:23:37 +0000

 Module Name:	src
 Committed By:	jakllsch
 Date:		Sat Jan 24 00:23:37 UTC 2015

 Modified Files:
 	src/sys/arch/arm/broadcom: bcm2835_bsc.c

 Log Message:
 Catch NAKs from the device more often.

 Should fix PR#48855 and maybe PR#48932.


 To generate a diff of this commit:
 cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/broadcom/bcm2835_bsc.c

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

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.