From owner-freebsd-arm@FreeBSD.ORG Fri Apr 3 22:15:38 2015 Return-Path: Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9081F7F5 for ; Fri, 3 Apr 2015 22:15:38 +0000 (UTC) Received: from mailhost.netlabit.sk (mailhost.netlabit.sk [84.245.65.72]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0F677AA4 for ; Fri, 3 Apr 2015 22:15:37 +0000 (UTC) Received: from zeta.dino.sk (fw1.dino.sk [84.245.95.252]) (AUTH: LOGIN milan) by mailhost.netlabit.sk with ESMTPA; Sat, 04 Apr 2015 00:10:27 +0200 id 00DCA892.551F0FD3.00007F66 Date: Sat, 4 Apr 2015 00:10:26 +0200 From: Milan Obuch To: freebsd-arm@freebsd.org Subject: PiTFT driver for Ilitek controller Message-ID: <20150404001026.4c0121ba@zeta.dino.sk> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.25; i386-portbld-freebsd10.1) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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: Fri, 03 Apr 2015 22:15:38 -0000 Hi, I am trying to write a driver for PiTFT, where Ilitek chip is used for TFT control. There is SPI bus used for connection to Raspberry, but with one GPIO pin added used as command flag. Programming this chip means series of command of varying length with first byte being marked as command byte. I know how to do a transfer on SPI bus, I can communicate with second controller chip on PiTFT used for touchscreen part of device, which uses only SPI, nothing added. For Ilitek chip, however, there is one pin more. This design seems to be used by other TFT/LCD controller chips. Now there is a problem - SPI controller in BCM2835, source file name is bcm2835_spi.c, works in interrupt mode. CD pin needs to be reset after first byte of transfer sequence is clocked onto bus, but how could this condition be checked? I think about some code added into bcm_spi_intr() function, but when is this routine called? I need to detect interrupt after first byte is transferred on SPI bus, is it possible to do this way? If interrupt is generated after every byte being transferred, then yes, it is not that complicated, but maybe it is generated only after more bytes are already transferred, using FIFO... I am trying to find some answer in BCM2835 ARM peripherals datasheet, but I am not sure I understand everything right, and there is not much written about SPI anyway, just some description of SPI, registers definition and simple programming outline, not too detailed. Regards, Milan