From owner-freebsd-arm@FreeBSD.ORG Tue Mar 10 04:00:39 2015 Return-Path: Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 21B60FB4 for ; Tue, 10 Mar 2015 04:00:39 +0000 (UTC) Received: from mail-we0-x22d.google.com (mail-we0-x22d.google.com [IPv6:2a00:1450:400c:c03::22d]) (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 A48D9750 for ; Tue, 10 Mar 2015 04:00:38 +0000 (UTC) Received: by wesu56 with SMTP id u56so12851035wes.12 for ; Mon, 09 Mar 2015 21:00:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=p+16iq3ehxb8PpK3oFA7KcqZRED3aaKvp1FMyiijcFA=; b=V8ywXCeb3VPYh33eG3Q8x6JA+TwQJis+vuGhtPCWKT2dC/rnKGLrHK0JZGyUjEKNb/ 1WfG/yi4cwF5o1NFbqeRutZKyiR2O1gA79XBdrBD+MW0qZghuo3OyqPVaBr0vbaeaV1e dhXQcvx5btpMe5L0oRBA6N0w7L76HQVVjXHAdDRIdFtxikx90Lrycw0BgwJaHeTMussC /9MmBt9y7/4gvFdR1/T+4VEhJdqjMyYw4nsLAdh/NSFYw6HIwRywv2T0FXVggtL4WlHA ikXMAVMEsQZa88bae12YscVRzkRbzA7QC0vKVUC3PpudesxBwXxOe475a0ErY9fjO7eG J0nQ== MIME-Version: 1.0 X-Received: by 10.194.120.230 with SMTP id lf6mr63291856wjb.78.1425960037101; Mon, 09 Mar 2015 21:00:37 -0700 (PDT) Received: by 10.180.195.99 with HTTP; Mon, 9 Mar 2015 21:00:37 -0700 (PDT) In-Reply-To: <20150306191957.0603e0f3@zeta.dino.sk> References: <20150216093418.3d1be83b@zeta.dino.sk> <20150219075342.7d2e7eec@zeta.dino.sk> <20150302124103.689135d3@zeta.dino.sk> <20150303215040.13f8439f@zeta.dino.sk> <20150305123903.1050694f@zeta.dino.sk> <20150306191957.0603e0f3@zeta.dino.sk> Date: Tue, 10 Mar 2015 01:00:37 -0300 Message-ID: Subject: Re: Raspberry Pi SPI device example? From: Luiz Otavio O Souza To: Milan Obuch Content-Type: text/plain; charset=UTF-8 Cc: "freebsd-arm@freebsd.org" X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Mar 2015 04:00:39 -0000 On 6 March 2015 at 15:19, Milan Obuch wrote: > Now there is another problem to solve - there are two devices on the > spibus0, ILI9341 and STMPE610, on chip selects 0 and 1 respectively. > In the end, there will be 'ili' driver for the former and 'tsc' driver > for the later. Both will use SPIBUS_TRANSFER to transfer their > respective bytes, but could they interfere as they are on the same bus? > Is it necessary to use some kind of protection against that or does spi > bus driver ensure transfers cound not interfere? The SPI support is very simple at moment, there is no bus serialization and neither userland access. At least on RPi, each SPI transfer is serialized by the driver, so once a thread start a transfer, any other transfers will be put to sleep until the first one finishes. The problem is only if you need to guarantee that consecutive transfers to the same device won't be interrupted by another threads (e.g. in a read-modify-write cycle). I hope to eventually fix this (unless someone make it first). Luiz