From owner-freebsd-arm@freebsd.org Thu Feb 4 15:49:13 2016 Return-Path: Delivered-To: freebsd-arm@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CD6FDA9B894 for ; Thu, 4 Feb 2016 15:49:13 +0000 (UTC) (envelope-from jau789@gmail.com) Received: from mail-wm0-x229.google.com (mail-wm0-x229.google.com [IPv6:2a00:1450:400c:c09::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 668971482; Thu, 4 Feb 2016 15:49:13 +0000 (UTC) (envelope-from jau789@gmail.com) Received: by mail-wm0-x229.google.com with SMTP id p63so218152468wmp.1; Thu, 04 Feb 2016 07:49:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-type:content-transfer-encoding; bh=8cjir02QF8g3rzP6GxSFAn0BfCI8tdxVsGIHM+6ZrZI=; b=m3+VXcLn76B8qtaFP0waynPn22y4teikhVOPWEoNZHqu/0B+EfzEJeC7IZqNnvKTFc FdNipi1ZLvXKrP7EMD6BBVPkrfDU2DEEcwB/C2gQWrX/LWK9AE2jtydZ+Lh2hIbZuXKA iqygHHzy3ZpB3AicnNCQmmImig8yoKaoEnPD7O5f0aArzOHnmx3QzmLCVcOLh57gyHxI DzSAZq25mukwSRi8BRyOX+pcwMymbPFNdy1BWnG66g3dqpJlG8kAY/lgOEbu4Uq6qt8p bhRqf4wwddb/QoENMNibHimrgVJRecqnecDNukDOIHQN0hFlZuxLxL2LUpu4ZNCpVuOU wt5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-type :content-transfer-encoding; bh=8cjir02QF8g3rzP6GxSFAn0BfCI8tdxVsGIHM+6ZrZI=; b=Ht2As5FCC8ryKCeV+MQktq2XJRqRqqOeODXb5Igoahe0Ua2p7KMyBseNspEDgITk58 00zjvj1OkIncohAxK61poXjOv6l0u/3DUrVaN3Ax4zazDYdXVfQgUboChgdRRSxu+PeA eAz6wGHpBF7XVSBxw9Ui2PI+D0oZBfpr61MFjzKoxlYbE+jTMdov8ZoLDSPHeY8FQz2+ VRyZsRaeXnj9b9zF5v+BrSKc58Vid83m1ooJNRyNVsdKaSYe2Lr/VMtfcYxdASz/T1dI 0jm1ZjKM5pYrGHGcyR1szU6BLX0Fwo9ZxLTvsUr7bDVvNq4Kpy13Sal64zgfR8XejHkH KBfQ== X-Gm-Message-State: AG10YORqNGYpuqhOWWlpMCl2S35Rd1DHpG52W0KWf5Y0UPJfb26A9oX2xekJBSYNASBMCA== X-Received: by 10.194.203.99 with SMTP id kp3mr8964478wjc.3.1454600951918; Thu, 04 Feb 2016 07:49:11 -0800 (PST) Received: from [192.168.1.131] (xdsl-205-1.nblnetworks.fi. [83.145.205.1]) by smtp.googlemail.com with ESMTPSA id i5sm11865656wja.23.2016.02.04.07.49.10 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 04 Feb 2016 07:49:11 -0800 (PST) Subject: Re: ds3231 suddenly failing To: Ian Lepore , freebsd-arm References: <56B21158.80401@gmail.com> <1454511243.1736.3.camel@freebsd.org> From: Jukka Ukkonen X-Enigmail-Draft-Status: N1110 Message-ID: <56B372F5.3090506@gmail.com> Date: Thu, 4 Feb 2016 17:49:09 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 In-Reply-To: <1454511243.1736.3.camel@freebsd.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2016 15:49:14 -0000 On 02/03/16 16:54, Ian Lepore wrote: > On Wed, 2016-02-03 at 16:40 +0200, Jukka Ukkonen wrote: >> Hello all, >> >> Previously my RPI2 had no problems with ds3231 RTC. >> Now 11.0-CURRENT r295206 shows these during boot... >> >> ds32310: at addr 0x1a0 on iicbus1 >> ds32310: cannot read from RTC. >> >> Trying sysctl dev.ds3231 gives me this... >> >> dev.ds3231.0.%parent: iicbus1 >> dev.ds3231.0.%pnpinfo: name=rtc compat=maxim,ds3231 >> dev.ds3231.0.%location: addr=0x1a0 >> dev.ds3231.0.%driver: ds3231 >> dev.ds3231.0.%desc: Maxim DS3231 RTC >> dev.ds3231.%parent: >> >> Trying "i2c -s" does not show anything on either >> /dev/iic0 or /dev/iic1. >> >> AFAIK I have not changed anything in the build. >> >> Checking the contents of rpi2.dtb says this about >> the clock chip... >> >> rtc { >> compatible = "maxim,ds3231"; >> reg = <0xd0>; >> }; >> >> I guess that the alert "cannot read from RTC." is >> due to the fact that "addr 0x1a0" does not match >> "reg = <0xd0>;" in the DTB. It just does not dawn >> to me where the kernel found the alternate value. >> Any ideas? >> >> --jau > > You didn't say what version you were running previously that had no > problems, but there was an update a while back that changed the i2c > device addressing in dts files to match the published standard, which > requires 7-bit addresses. Freebsd has always used 8-bit addresses in > i2c drivers. (0x1a0 is 0xd0 left-shifted by 1). > > So, just adjust the address in your dts to 0x68 and it should start > working again. > > -- Ian > Quite right. I did not say what was the previous version for the simple reason that I installed the new OS version on the same SD card without checking the old version first. Anyhow your hint was spot on. When I shifted the 0xd0 value down one bit in the DTS file the lost ds3231 returned to service again. Thanks. It seems that the ds3231 manual page still says only this... ----- On a FDT(4) based system the following properties must be set: compatible Must always be set to "maxim,ds3231". reg The i2c address of ds3231. The default address for ds3231 is 0xd0. ----- Obviously if left as is this tends to be misleading. The proper value "reg = <0x68>" and the automatic shift by one bit position should be explained in the manual page. --jau