From owner-freebsd-arm@freebsd.org Sun Jan 6 22:22:49 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 1D383149D7EC for ; Sun, 6 Jan 2019 22:22:49 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound1.eu.mailhop.org (outbound1.eu.mailhop.org [52.28.251.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4C7B494224 for ; Sun, 6 Jan 2019 22:22:48 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1546813360; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=itflmnMCGWfFJtYQVE0kOlCTYxOJzTmYvirDtvYTwJppLmY8hVLg6SX2DdHguPkVb9Qb7fbeNVegw NyR5WB5hDaW6yQddxznagU7+TUbe7IQ1BNcKS497VUE3dZvtO2TLeCmDcnBH72arKfDfB+L4wpJL5r xWc8H5KdUWkjTDXIM/FsyTTVZ1K2rtIB4UINWmh3FHk6002Wr9IWnyxfVs+RU9pUM3Asdr7oulRBfB DwWR8BaPbJtGeMb9oKyqkWa+Ka9AjHg5Hao1FnP6WQIrK6B/+Pb+i8V+URDCypRcfNQlHWPmnsfVVV bnC8TAcgUkaQQIwp+bxWqHhT8QIMLRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:dkim-signature:from; bh=V+NON8UEmPAuY5X15MlLGkNcV7N0m0dCNy1jiOO8vq4=; b=WSIahIkM7lL+6ptszID4zcG0CRetla3pnV9TsDnBtZF+TFGLqxI14ZYFwbw76dD4r1SQp4n3/rRpc vyvH8GqHvuZ6JKge2RhKCW/SAYQROu0dhVTkG2LJN00jICWxeOdn+UNuTkaeZxyovavCzFKI7UCvVp KnuwBQZBDzwsUrZH/hUr4i8GkuK4RdYvktnvnX25aILNrPXDP/zjAVQVOO67MlqpAuUrp45xzVs68a OqfWZCtXJEbeMQd5U3RBZPHAa03ZitOs6xWRAW8NgnnzkjoWsMmu1lYdgojqz0dco7vCCwXV6HwQW5 RnwEKpEJ574KmFfOJWuha/Ab+tPDlkw== ARC-Authentication-Results: i=1; outbound3.eu.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:from; bh=V+NON8UEmPAuY5X15MlLGkNcV7N0m0dCNy1jiOO8vq4=; b=Rv9NNHflFaFOZD8fDOUr7g451DTM4Wybx0KdoNZHMPEgjlGmoSeC1wgi/0Gyw4nribDe/r0Z6IOUP 5t3o44UKZLdGGUnXjS7/WlRfSeBbxuBqOq+0awUPU6A95hNyhanFVO8c3rOFZRRdhuOmEZmY8Aoe9u PB40c7hAFZOBnENBzQAEMJcq5G+C/MAZgGkeMJIxQe//qdpvkNnINk1y5JqMIhQdVnuYOtW0UK0ea7 8WYTKSaEpjIS3jiw7aQ1MwlD54azba+z+orLK1/Ye80ZhNkj99U0xQbCtV+IhB3G+hIalvW2bfJ0bi XGP2mNlP7dEHTgvQ22pp1nN8FIgX0qA== X-MHO-RoutePath: aGlwcGll X-MHO-User: 9191b62d-1201-11e9-8a28-a1efd8da9a94 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound3.eu.mailhop.org (Halon) with ESMTPSA id 9191b62d-1201-11e9-8a28-a1efd8da9a94; Sun, 06 Jan 2019 22:22:37 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id x06MMYfV048519; Sun, 6 Jan 2019 15:22:35 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: <1546813354.98537.18.camel@freebsd.org> Subject: Re: i2c on RPi Zero? From: Ian Lepore To: Emmanuel Vadot , Oleksandr Tymoshenko Cc: freebsd-arm@freebsd.org Date: Sun, 06 Jan 2019 15:22:34 -0700 In-Reply-To: <20190105230306.2ad9d0ba2c2df0e8fac5f053@bidouilliste.com> References: <229e0d36-a07b-8551-9613-0bf5748352e7@hedeland.org> <20190105195808.GA53872@bluezbox.com> <20190105215608.GA55315@bluezbox.com> <20190105230306.2ad9d0ba2c2df0e8fac5f053@bidouilliste.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.1 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4C7B494224 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.99 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.99)[-0.987,0]; ASN(0.00)[asn:16509, ipnet:52.28.0.0/16, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] 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: Sun, 06 Jan 2019 22:22:49 -0000 On Sat, 2019-01-05 at 23:03 +0100, 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: > > > > > > > > > > FreeBSD-12.0-STABLE-arm-armv6-RPI-B-20190103-r342709.img - > > > > > still no > > > > > luck. > > > > > > > > > > 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".) > > > > > > > > > > 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. > > > > > > > > > > (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.) > > > > 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: > > > > > > > > dtparam=i2c > > > > > > > > This should make boot firmware to enable device nodes in the > > > > device > > > > tree blob during the boot. > > > 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). > > > > > > Should I file a PR for this? I assume that the i2c nodes being > > > disabled is not intentional... > > 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). I agree. SPI and i2c are not required to boot the board so there is no reason to enable them by default. The pins used for those things can be configured for multiple purposes, so the choice of how they should be configured by default is completely arbitrary. There is no reason for freebsd to make a different arbitrary decision than the one already made by our upstream source of FDT data. -- Ian