From owner-freebsd-arm@freebsd.org Sat Jan 5 23:47:55 2019 Return-Path: Delivered-To: freebsd-arm@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B926B1427C13 for ; Sat, 5 Jan 2019 23:47:55 +0000 (UTC) (envelope-from mmitchel@gmail.com) Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 503B873A80 for ; Sat, 5 Jan 2019 23:47:54 +0000 (UTC) (envelope-from mmitchel@gmail.com) Received: by mail-pg1-x542.google.com with SMTP id d72so19044383pga.9 for ; Sat, 05 Jan 2019 15:47:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=lQrgUmR9cIdWJLO3y6w7qfXa0cZYaErYpeVLOuOly64=; b=ZzBLUd7EO3ekbEQEG6Hu4g/0WcNoE1uwtx699R8uL9MLh7IPpkAraShCpCsGO+unhZ mnsKlxueOzQLAt0sDge+iW+8/peEOFuwzzI9/rdC3XKwzhW4asVNIpmvN85xPfALa6W8 hGdIaEBkKfrNzrXx8Vu0FZpNzIK8drvpsEn7c9md+tldoq4ft2ab5zY2IAI/bJGO42bt GJeViPHyHl2O/8xAQZrF6Sj/0MT46u4CZ1Ad6mcZTzkkP79UPtJpWYET6Tgoq/SafeMP rq+BFgzTq57/DhhpKe0ZBut5qOdEqQZX7w3dIRH8YqyKNyJTxrmdb2UTGxNGlwLX02oj eqPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=lQrgUmR9cIdWJLO3y6w7qfXa0cZYaErYpeVLOuOly64=; b=JZUbWji3qXP7EWm6Mw1nnQCkbcvg5PyKvAugJE2Jw0rfHIf9HKcIFoWy74ZSlKQs4y /s94HIBKLPIRnIzkFbi7fPycrtuJEbJmO4kogkVN6WTFDjlzXxxqCjD1yp9hbi99E7j9 QIv0EKTq/rZ0M7ch4eLLjXZKWFF0KD7FSJQAaV+8N+noAmz+0yg32jj+ghZ0orUb0rwg LhrUvfa5hYN+oElhGeZiAY49LWQYu805XhsyGG9ePy8NXOUdQnCsWyiAAKu0Rb8OX2XN iVTa737eplLd6IQXVUuOMocT38agJYyr6r/yN713OQ2n49fbQA2t09DNrGHwlKoNmeVh nl7g== X-Gm-Message-State: AJcUukeDOlBFbjWHWrg4AHJCUfszZewDfTn0NsOiofORYjjgvskz0D1H YLWFyIij0YSAJy7q+caSYGHdIZIxuXWo X-Google-Smtp-Source: ALg8bN7nGW3H8V1Ahe7tGdEqKUOf92HKKBpM5DeoIpLQQ9AhVrvEivcAEURQ0vVz6vZgYSQJ6NKqew== X-Received: by 2002:a63:a84a:: with SMTP id i10mr6320184pgp.263.1546732072717; Sat, 05 Jan 2019 15:47:52 -0800 (PST) Received: from ?IPv6:2600:8801:9900:167:692c:a35f:a173:be4f? ([2600:8801:9900:167:692c:a35f:a173:be4f]) by smtp.gmail.com with ESMTPSA id t87sm199383958pfk.122.2019.01.05.15.47.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 05 Jan 2019 15:47:52 -0800 (PST) From: "Michael Mitchell (megabyte)" Message-Id: <4C1DFE20-8124-47EB-995C-F1029C1FA4DA@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 12.2 \(3445.102.3\)) Subject: Re: i2c on RPi Zero? Date: Sat, 5 Jan 2019 15:47:50 -0800 In-Reply-To: Cc: Emmanuel Vadot , freebsd-arm@freebsd.org To: Per Hedeland References: <229e0d36-a07b-8551-9613-0bf5748352e7@hedeland.org> <20190105195808.GA53872@bluezbox.com> <20190105215608.GA55315@bluezbox.com> <20190105230306.2ad9d0ba2c2df0e8fac5f053@bidouilliste.com> X-Mailer: Apple Mail (2.3445.102.3) X-Rspamd-Queue-Id: 503B873A80 X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=ZzBLUd7E; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of mmitchel@gmail.com designates 2607:f8b0:4864:20::542 as permitted sender) smtp.mailfrom=mmitchel@gmail.com X-Spamd-Result: default: False [0.91 / 15.00]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; MV_CASE(0.50)[]; URI_COUNT_ODD(1.00)[7]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[gmail.com:+]; MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+,1:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; MID_RHS_MATCH_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com.dwl.dnswl.org : 127.0.5.0]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.35)[-0.346,0]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; NEURAL_SPAM_SHORT(0.55)[0.552,0]; NEURAL_HAM_LONG(-0.89)[-0.889,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-arm@freebsd.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2.4.5.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; SUBJECT_ENDS_QUESTION(1.00)[]; IP_SCORE(0.10)[ip: (4.44), ipnet: 2607:f8b0::/32(-2.20), asn: 15169(-1.67), country: US(-0.08)] Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jan 2019 23:47:56 -0000 simplified: why would freebsd demand a different device tree than what you get when you download it from raspberrypi.org = ? all the internet documentation describes how to manipulate the device tree. we are at their mercy for the boot up folder as it is... mdm > On Jan 5, 2019, at 3:39 PM, Per Hedeland wrote: >=20 > On 2019-01-05 23:03, Emmanuel Vadot wrote: >> On Sat, 5 Jan 2019 13:56:08 -0800 >> Oleksandr Tymoshenko wrote: >>> Per Hedeland (per@hedeland.org) wrote: >>>> On 2019-01-05 20:58, Oleksandr Tymoshenko wrote: >>>>> Per Hedeland (per@hedeland.org) wrote: >>>>>> I did a bit more testing on the Zero to see if the FreeBSD = version >>>>>> mattered: >>>>>>=20 >>>>>> FreeBSD-12.0-STABLE-arm-armv6-RPI-B-20190103-r342709.img - still = no >>>>>> luck. >>>>>>=20 >>>>>> FreeBSD-11.2-STABLE-arm-armv6-RPI-B-20190103-r342709.img - works! >>>>>> (I.e. dmesg reports as below and /dev/iic{0,1} get created - I = haven't >>>>>> tested actual usage beyond having 'i2c -s' report "no devices = found".) >>>>>>=20 >>>>>> I guess that the i2c support hasn't been removed intentionally, >>>>>> i.e. this seems to be a regression - or is there some additional >>>>>> config etc required to enable it with FreeBSD-12? The iic and = iicbus >>>>>> drivers appear to be built into the kernel in both 11 and 12. >>>>>>=20 >>>>>> (I haven't tested FreeBSD-12 on the Pi B, but I would guess that = the >>>>>> result will be the same as on the Zero, since it seems the = hardware is >>>>>> the same.) >>>>>=20 >>>>> There was a transition in device tree files between 11 and 12. >>>>> bcm2708-rpi-0-w.dtb has i2c nodes but they're disabled by default. >>>>> Try editing config.txt on FAT partition and adding following line: >>>>>=20 >>>>> dtparam=3Di2c >>>>>=20 >>>>> This should make boot firmware to enable device nodes in the = device >>>>> tree blob during the boot. >>>>=20 >>>> Thanks a lot! I can confirm that this makes i2c "work" on Zero with >>>> 12-RELEASE (almost) to the extent described above for 11.2-STABLE = (it >>>> detects/creates only iic0, not iic1, but as far as I understand = from >>>> other sources, iic0 is all that is needed for "plain B" and thus = also >>>> for Zero). >>>>=20 >>>> Should I file a PR for this? I assume that the i2c nodes being >>>> disabled is not intentional... >>>=20 >>> Yes, please do. There are also other devices, that should be enabled = by >>> default, like SPI. >> Why should we enabled them by default ? >> We have no correct way for switching a pin to gpio mode (you can do >> that with gpioctl on some system but I consider it as a bug) so if I >> want to use the i2c/spi/whatever pins as gpio and the default image = set >> it to another function I'm stuck. >> Using the rpi fundation dtb means that every settings that they set >> for Linux will also be set for us, so every tutorial on the web where >> people saying that you should set something in config.txt will apply = to >> FreeBSD too. >> The current settings aren't a bug, it's a feature (c). >=20 > OK... - so your take seems to be that FreeBSD users should google for > the "Linux way" to (e.g.) enable i2c on RPi. I googled "enable i2c on > raspberry pi" now, and indeed it brought up lots of Linux stuff, but > unfortunately it mostly says to run 'raspi-config', which I can't find > on my FreeBSD installation (and didn't actually expect to, of course). >=20 > If I explicitly add "config.txt" to the search string, I do indeed > find some info about what to put in that file - but of course I > wouldn't have done that if I didn't already know that this was the > file that needed to be edited... >=20 > I'm all for using "standard" components (even when "standard" means > "Linux"), and reducing the amount of FreeBSD-specific work that you > and others need to put in to support FreeBSD on these "odd" systems - > and as a long time (Free)BSD user, I actually prefer to edit a file > over running some GUI tool without knowing what it does. >=20 > But I really think there needs to be a bit more help directed > specifically at the FreeBSD user here (if there is and I just haven't > found it, please enlighten me). A few words (besides "configuration > for start.elf":-) about what config.txt is good for, and perhaps a > pointer to e.g. > https://www.raspberrypi.org/documentation/configuration/device-tree.md > (found it from your hints, thanks!), on the > https://wiki.freebsd.org/FreeBSD/arm/Raspberry%20Pi page may be > enough. >=20 > And despite the whining above, I really do appreciate all your efforts > to make it possible to run FreeBSD on these systems - many thanks! >=20 > --Per Hedeland > _______________________________________________ > freebsd-arm@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-arm > To unsubscribe, send any mail to "freebsd-arm-unsubscribe@freebsd.org"