From owner-freebsd-arm@freebsd.org Wed Jan 18 01:08:04 2017 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 01A12CB457E for ; Wed, 18 Jan 2017 01:08:04 +0000 (UTC) (envelope-from gonzo@bluezbox.com) Received: from id.bluezbox.com (id.bluezbox.com [45.55.20.155]) (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 D77B01C9B for ; Wed, 18 Jan 2017 01:08:03 +0000 (UTC) (envelope-from gonzo@bluezbox.com) Received: from [127.0.0.1] (helo=id.bluezbox.com) by id.bluezbox.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.87 (FreeBSD)) (envelope-from ) id 1cTejF-0003n8-TL; Tue, 17 Jan 2017 17:07:58 -0800 Received: (from gonzo@localhost) by id.bluezbox.com (8.15.2/8.15.2/Submit) id v0I17v36014577; Tue, 17 Jan 2017 17:07:57 -0800 (PST) (envelope-from gonzo@bluezbox.com) X-Authentication-Warning: id.bluezbox.com: gonzo set sender to gonzo@bluezbox.com using -f Date: Tue, 17 Jan 2017 17:07:57 -0800 From: Oleksandr Tymoshenko To: George Mitchell Cc: "freebsd-arm@freebsd.org" Subject: Re: Serial Peripheral Interface? Message-ID: <20170118010757.GA14547@bluezbox.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: FreeBSD/11.0-RELEASE-p2 (amd64) User-Agent: Mutt/1.6.1 (2016-04-27) X-Spam-Level: -- X-Spam-Report: Spam detection software, running on the system "id.bluezbox.com", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see The administrator of that system for details. Content preview: George Mitchell (george+freebsd@m5p.com) wrote: > The Raspberry Pi (among others) has two IIC interfaces on the GPIO > connector, and there are /dev/iic0 and /dev/iic1 visible to userland. > It also has two SPI interfaces, but despite the presence of "device > spibus" and "device bcm2835_spi" in the RPI-B configuration file, I > have been unable to detect any userland interface to the serial > peripheral interface lines (except the dev.spibus and dev.spi sysctl > entries). Is it possible to use the SPI interfaces somehow from > userland? [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: github.com] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jan 2017 01:08:04 -0000 George Mitchell (george+freebsd@m5p.com) wrote: > The Raspberry Pi (among others) has two IIC interfaces on the GPIO > connector, and there are /dev/iic0 and /dev/iic1 visible to userland. > It also has two SPI interfaces, but despite the presence of "device > spibus" and "device bcm2835_spi" in the RPI-B configuration file, I > have been unable to detect any userland interface to the serial > peripheral interface lines (except the dev.spibus and dev.spi sysctl > entries). Is it possible to use the SPI interfaces somehow from > userland? There is somewhat cumbersome spigen interface. It's not available as a module (yet), only as kernel cimpile-time option. You'll have to add "device spigen" to kernel config and rebuild the kernel. Also there are some limitations. You can't specify mode or CS number from userland, CS 0 and mode 0 is assumed. You can find usage example here: https://github.com/gonzoua/freebsd-embedded-demos/blob/master/libssd1306/ssd1306_spi.c There are plans to replace spigen with better API but I am not aware about the actual timeline for this. -- gonzo