From owner-freebsd-arm@freebsd.org Wed Oct 7 06:32:11 2020 Return-Path: Delivered-To: freebsd-arm@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B0EBF3FD349 for ; Wed, 7 Oct 2020 06:32:11 +0000 (UTC) (envelope-from agapon@gmail.com) Received: from mailman.nyi.freebsd.org (mailman.nyi.freebsd.org [IPv6:2610:1c1:1:606c::50:13]) by mx1.freebsd.org (Postfix) with ESMTP id 4C5kyg3K5Jz4Q2s for ; Wed, 7 Oct 2020 06:32:11 +0000 (UTC) (envelope-from agapon@gmail.com) Received: by mailman.nyi.freebsd.org (Postfix) id 71BEE3FD610; Wed, 7 Oct 2020 06:32:11 +0000 (UTC) Delivered-To: arm@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 716513FCE7C for ; Wed, 7 Oct 2020 06:32:11 +0000 (UTC) (envelope-from agapon@gmail.com) Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com [209.85.167.53]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4C5kyf1vVTz4Q7Y for ; Wed, 7 Oct 2020 06:32:10 +0000 (UTC) (envelope-from agapon@gmail.com) Received: by mail-lf1-f53.google.com with SMTP id r127so955821lff.12 for ; Tue, 06 Oct 2020 23:32:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=ukUuW6YqIdPRmpbh+a6xMhZRGx1j5Z2G1m/PwVNT0F4=; b=lXVG6uWDzo/HOcLEn0GB6a/Fw1qtsYYdqf2HCzxoY0mFl+IHAcwjU59ZitGSsf8ASU 9zhWHIqwIHqhsAARp3O0s6iY6V0EXyK3MVwYo4YdjTQLphVgenlFW8a2LZ0DDK8bzYaX ey/sQPbSkWwObLLNvTHoO7wlVgxcd9PqxIaF24RsFQbZGL7PsGlPXEnaVjHKG3RrnZ+e /nIaIvrd5iQ0+kCyPZf2QctLhkCNpeMM1MpIseCA3CPBvA0waibKoC1LL2ibpzN4CLIz 1Ayiuqj1/fTvkbZJWFSmjjNKjoMXmxK6qpDPGGByVY5+yKdElaUmGRBLqcfRHgnE2OHR qOzw== X-Gm-Message-State: AOAM531sOVfoYgUYIcvYhnu0Ran9QIaP7f04Jjk/n611hOENw7/w/4BT zV4EHPbN2Rfg+TmIroUTIOvLAE8aq/VIeA== X-Google-Smtp-Source: ABdhPJw19xI1/ljkCNR9BqFM/qcKh6xXp/VWu7rAN1eRgTqs7l1usuV7Soxddiumgqyqlzam0Guk4Q== X-Received: by 2002:a05:6512:214c:: with SMTP id s12mr484019lfr.578.1602052327893; Tue, 06 Oct 2020 23:32:07 -0700 (PDT) Received: from [192.168.0.88] (east.meadow.volia.net. [93.72.151.96]) by smtp.googlemail.com with ESMTPSA id l3sm186593lfc.34.2020.10.06.23.32.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 06 Oct 2020 23:32:06 -0700 (PDT) Subject: Re: nanopi/allwinner i2c not working. To: Daniel Braniss Cc: Emmanuel Vadot , "freebsd-arm@freebsd.org" References: <234D06ED-C99F-477E-8D95-492979084E7A@cs.huji.ac.il> <7934CE38-DC3F-450A-A131-19A7F88DA9EC@cs.huji.ac.il> <20201006104119.28f2262d47107d41025d193f@bidouilliste.com> <29A34854-E792-48CE-AF0A-E4C605BDFC3B@cs.huji.ac.il> <6416CA90-AB4C-4F8A-BCF4-7C9E5A4F2F8D@cs.huji.ac.il> <0ba109b4-784f-19ed-e52d-a40b75af872c@FreeBSD.org> <7C27FB6C-BF0D-4DAE-99D0-50849D2FBA5E@cs.huji.ac.il> <43a5d626-634c-2cc2-e8a5-ad4326a2d6e2@FreeBSD.org> <77DC054E-07B2-48F8-8051-C2796EE991B2@cs.huji.ac.il> <260839FF-7297-4FDC-82AC-13797938AC29@cs.huji.ac.il> From: Andriy Gapon Openpgp: preference=signencrypt Autocrypt: addr=avg@FreeBSD.org; prefer-encrypt=mutual; keydata= mDMEX1iFDhYJKwYBBAHaRw8BAQdAiu8JG/oLFkVkOAJqJc7Dx5KI/Q6C3SBI20EQm+DXnAu0 HkFuZHJpeSBHYXBvbiA8YXZnQEZyZWVCU0Qub3JnPoiWBBMWCAA+FiEEyCHHZM09l0OE3Ir/ 1A1+Gq8+L1EFAl9YhQ4CGwMFCQeEzgAFCwkIBwIGFQoJCAsCBBYCAwECHgECF4AACgkQ1A1+ Gq8+L1Fc0wD/ZjmhHfbCJywZU3aOxXIPjcz73FYEGMvqMCCLAWyLbSABALFL+1ZNrjV3BGjq 889cOYFuboA/Yn3eWezS+tfqYBsGuDgEX1iFDhIKKwYBBAGXVQEFAQEHQL6B20Xi600TrkpG P9fWjl7JtHNxqrHKhX6Kg7kgb4ILAwEIB4h+BBgWCAAmFiEEyCHHZM09l0OE3Ir/1A1+Gq8+ L1EFAl9YhQ4CGwwFCQeEzgAACgkQ1A1+Gq8+L1F3cgEAktp4h+IJUJxL1vn6zMOt//znni/J TanKfQuA8wGXcGkBAKpZJhqMkg+pKk7MGvJhgJ6nCpTZ+rMK6vZVZLUWc3QF Message-ID: Date: Wed, 7 Oct 2020 09:32:05 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Firefox/60.0 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <260839FF-7297-4FDC-82AC-13797938AC29@cs.huji.ac.il> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4C5kyf1vVTz4Q7Y X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of agapon@gmail.com designates 209.85.167.53 as permitted sender) smtp.mailfrom=agapon@gmail.com X-Spamd-Result: default: False [-2.56 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17:c]; RCVD_COUNT_THREE(0.00)[3]; TO_DN_ALL(0.00)[]; NEURAL_HAM_SHORT(-0.57)[-0.571]; FORGED_SENDER(0.30)[avg@FreeBSD.org,agapon@gmail.com]; RECEIVED_SPAMHAUS_PBL(0.00)[93.72.151.96:received]; MIME_TRACE(0.00)[0:+]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; MID_RHS_MATCH_FROM(0.00)[]; FROM_NEQ_ENVFROM(0.00)[avg@FreeBSD.org,agapon@gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.95)[-0.948]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; NEURAL_HAM_LONG(-1.04)[-1.039]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[arm@freebsd.org]; DMARC_NA(0.00)[FreeBSD.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[209.85.167.53:from]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.167.53:from]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[arm] X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Oct 2020 06:32:11 -0000 On 06/10/2020 23:29, Daniel Braniss wrote: > > >> On 6 Oct 2020, at 17:22, Andriy Gapon > > wrote: >> >> On 06/10/2020 17:00, Daniel Braniss wrote: >>> not too proud of it, but i’ll make it available. >>> it’s in https://www.cs.huji.ac.il/~danny/elockc.tar.bz >>> look in i2c.c >>> >>> in any case it works fine in 12.1. >> >> And it looks good to me as well. >> Could you please collect twsi debug output again? >> In head you do not need to recompile, you can just set hw.i2c.twsi_debug. > i did have to recompile Oh, I thought I committed that change, but now I see that I have not. It is a part of D26049. > iichb0: twsi_calc_baud_rate: Bus clock is at 24000000 > iichb0: twsi_reset: Using clock param=59 > iichb0: TWSI_WRITE: Writing 0 to 18 > iichb0: TWSI_WRITE: Writing 59 to 14 > iichb0: TWSI_WRITE: Writing 40 to c > iichb0: twsi_calc_baud_rate: Bus clock is at 24000000 > iichb0: twsi_reset: Using clock param=59 > iichb0: TWSI_WRITE: Writing 0 to 18 > iichb0: TWSI_WRITE: Writing 59 to 14 > iichb0: TWSI_WRITE: Writing 40 to c > iichb0: TWSI_WRITE: Writing c4 to c > iichb0: twsi_transfer: transmitting 2 messages > iichb0: TWSI_READ: read f8 from 10 > iichb0: twsi_transfer: status=f8 > iichb0: twsi_transfer: msg 0 is 9 bytes long > iichb0: twsi_transfer: msg 1 is 7 bytes long > iichb0: TWSI_WRITE: Writing e4 to c > iichb0: twsi_intr: Got interrupt Current msg=0 > iichb0: TWSI_READ: read 8 from 10 > iichb0: TWSI_READ: read cc from c > iichb0: twsi_intr: reg control=cc > iichb0: twsi_intr: Send the address (48)iichb0: TWSI_WRITE: Writing 48 to 8 Does that address (0x24 / 0x48 in 7-/8-bit representations) look correct? > iichb0: TWSI_WRITE: Writing c4 to c > iichb0: twsi_intr: Refresh reg_control > iichb0: TWSI_WRITE: Writing cc to c > iichb0: twsi_intr: Done with interrupts > > iichb0: twsi_intr: Got interrupt Current msg=0 > iichb0: TWSI_READ: read 20 from 10 > iichb0: TWSI_READ: read cc from c > iichb0: twsi_intr: reg control=cc > iichb0: twsi_intr: No ack received after transmitting the address The controller says that the device did not acknowledge its address. In other words, no device responded to the slave address. > iichb0: twsi_intr: Refresh reg_control > iichb0: twsi_transfer: pause finish > iichb0: TWSI_WRITE: Writing 8 to c > iichb0: twsi_transfer: Error, aborting (2) > iichb0: twsi_intr: Done with interrupts > > iichb0: TWSI_WRITE: Writing 0 to c > iichb0: TWSI_READ: read 30 from 10 > iichb0: twsi_transfer: status=30 > iichb0: TWSI_WRITE: Writing 0 to c > iichb0: TWSI_READ: read 30 from 10 > iichb0: twsi_transfer: status=30 > iichb0: TWSI_WRITE: Writing c4 to c > iichb0: twsi_transfer: transmitting 2 messages > iichb0: twsi_intr: Got interrupt Current msg=0 > iichb0: TWSI_READ: read 30 from 10 > iichb0: TWSI_READ: read 30 from 10 > iichb0: twsi_transfer: status=30 > iichb0: TWSI_READ: read cc from c > iichb0: twsi_transfer: msg 0 is 9 bytes long > iichb0: twsi_intr: reg control=cc > iichb0: twsi_transfer: msg 1 is 7 bytes long > > iichb0: twsi_intr: status=30 hot handled > iichb0: TWSI_WRITE: Writing e4 to c > iichb0: twsi_intr: Refresh reg_control > iichb0: twsi_transfer: pause finish > iichb0: TWSI_WRITE: Writing 8 to c > iichb0: twsi_transfer: Error, aborting (1) > iichb0: twsi_intr: Done with interrupts > > iichb0: TWSI_WRITE: Writing 0 to c > iichb0: TWSI_READ: read 10 from 10 > iichb0: twsi_transfer: status=10 > iichb0: TWSI_WRITE: Writing 0 to c > iichb0: TWSI_READ: read 10 from 10 > iichb0: twsi_transfer: status=10 The rest reads like gibberish because the driver did not stop the controller after the NACK (also, possibly some log messages were omitted from your email). I'd recommend once again to give https://reviews.freebsd.org/D26049 a try. I've just rebased it on the latest head, so it should apply cleanly. But as I said earlier, from the debug log it seems that the problem is either with the slave address or with the hardware (wiring, etc). It's also possible that that was a transient condition. -- Andriy Gapon