NetBSD Problem Report #32212

From www@netbsd.org  Fri Dec  2 02:36:54 2005
Return-Path: <www@netbsd.org>
Received: by narn.netbsd.org (Postfix, from userid 31301)
	id 79A6663B883; Fri,  2 Dec 2005 02:36:54 +0000 (UTC)
Message-Id: <20051202023654.79A6663B883@narn.netbsd.org>
Date: Fri,  2 Dec 2005 02:36:54 +0000 (UTC)
From: johnny@zweig.org
Reply-To: johnny@zweig.org
To: gnats-bugs@netbsd.org
Subject: Add flag to src/sys/dev/i2c/i2c_exec.c
X-Send-Pr-Version: www-1.0

>Number:         32212
>Category:       kern
>Synopsis:       Add flag to src/sys/dev/i2c/i2c_exec.c
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    thorpej
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Fri Dec 02 02:37:00 +0000 2005
>Last-Modified:  Mon Aug 05 23:00:53 +0000 2019
>Originator:     Johnny Zweig
>Release:        2.0
>Organization:
Serious Cybernetics
>Environment:
N/A
>Description:
I would like to propose that iic_exec (in i2c_exec) pass a flag to the lower-layer I2C driver's initiate_xfer routine when it sends a RESTART (rather than an ordinary START).

The issue is that some I2C hardware returns a different status code after sending a repeated start than it does for a normal start, so my driver has to recover from the "I got an unexpected result code error" when waiting for the hardware to finish the "start" that initiate_xfer told it to send.

That is, iic_exec has state information to know when it is sending a repeated start, and my driver does not. This change would allow my driver to expect the right thing, rather than kludge around what (to my mind) is a shortcoming of the API.
>How-To-Repeat:

>Fix:
This amounts to adding a new definition for I2C_F_RESTART, and changing:

  if (I2C_OP_READ_P(op)) {
	/* Send REPEATED START. */
	if ((len + 1) == buflen &&
	    (error = iic_initiate_xfer(tag, addr, flags)) != 0)
		goto bad;
to:

  if (I2C_OP_READ_P(op)) {
	/* Send REPEATED START. */
	if ((len + 1) == buflen &&
	    (error = iic_initiate_xfer(tag, addr,
	     flags | I2C_F_RESTART)) != 0)
		goto bad;

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: kern-bug-people->thorpej
Responsible-Changed-By: maya@NetBSD.org
Responsible-Changed-When: Mon, 05 Aug 2019 23:00:53 +0000
Responsible-Changed-Why:
Was asked to assign the PR (as a reminder?)


>Unformatted:

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.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.