From patchwork Tue Dec 11 14:27:26 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 1862701 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 4855FDF215 for ; Tue, 11 Dec 2012 14:34:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753251Ab2LKOeg (ORCPT ); Tue, 11 Dec 2012 09:34:36 -0500 Received: from arroyo.ext.ti.com ([192.94.94.40]:44663 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753114Ab2LKOef (ORCPT ); Tue, 11 Dec 2012 09:34:35 -0500 Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id qBBEYVj1017579; Tue, 11 Dec 2012 08:34:31 -0600 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id qBBEYV1D022896; Tue, 11 Dec 2012 08:34:31 -0600 Received: from dlelxv22.itg.ti.com (172.17.1.197) by dfle73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.1.323.3; Tue, 11 Dec 2012 08:34:30 -0600 Received: from localhost (h79-33.vpn.ti.com [172.24.79.33]) by dlelxv22.itg.ti.com (8.13.8/8.13.8) with ESMTP id qBBEYTgm025557; Tue, 11 Dec 2012 08:34:30 -0600 Date: Tue, 11 Dec 2012 16:27:26 +0200 From: Felipe Balbi To: Felipe Balbi CC: Jack Mitchell , , Shubhrajyoti Datta Subject: Re: AM335x BeagleBone SPI Issues Message-ID: <20121211142725.GA17708@arwen.pp.htv.fi> Reply-To: References: <50C5E23D.5040605@communistcode.co.uk> <20121210135337.GA10219@arwen.pp.htv.fi> <50C5F6A8.5060701@communistcode.co.uk> <20121210145947.GK11038@arwen.pp.htv.fi> <50C5FD73.1000408@communistcode.co.uk> <20121210183500.GB14303@arwen.pp.htv.fi> <50C70846.7010207@communistcode.co.uk> <20121211102011.GG19367@arwen.pp.htv.fi> <50C70D42.8030400@communistcode.co.uk> <20121211114810.GH19367@arwen.pp.htv.fi> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20121211114810.GH19367@arwen.pp.htv.fi> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Hi again, On Tue, Dec 11, 2012 at 01:48:10PM +0200, Felipe Balbi wrote: > On Tue, Dec 11, 2012 at 10:38:58AM +0000, Jack Mitchell wrote: > > On 11/12/12 10:20, Felipe Balbi wrote: > > >Hi, > > > > > >On Tue, Dec 11, 2012 at 10:17:42AM +0000, Jack Mitchell wrote: > > > > > > > > > > > >>Shubhro, Felipe, > > >> > > >>Thank you, the reordering dma patch fixed the dma issue I was having! > > >>However, the bad news, I now get the same results for the dma and > > >>non-dma spidev test. While the scope shows the SPI clk and data is > > >>fine, the reading from the program still shows 0x00 for all words. > > > > > > > > >>dmesg shows nothing of interest apart from the spi bus setting up. > > >>Any ideas? > > >> > > >>To iterate for my own sanity; I have bridged pins 18 and 21 on the P9 > > >>header which should be the d0 and d1 spi data pins for spi0. This > > >>result of 0x00 usually comes from a result of not joining the pins, > > >>but I can assure you they are joined! > > >> > > >>Thank you for the help so far. > > >according to the schematics [1], those pins are muxed as UART2_TXD and > > >I2C1_SDA, have you remuxed them properly ? Can you try with pins 29 and > > >30 on the same header ? That's SPI1, so you will have to add DT data for > > >spidev on that bus too. > > > > > >[1] http://beagleboard.org/static/beaglebone/latest/Docs/Hardware/BONE_SCH.pdf > > > > > > > No change unfortunately: > > > > root@beaglebone:~# ./spidev > > spi mode: 0 > > bits per word: 16 > > max speed: 24000000 Hz (24000 KHz) > > > > 00 00 00 00 00 00 > > 00 00 00 00 00 00 > > 00 00 00 00 00 00 > > 00 00 00 00 00 00 > > 00 00 00 00 00 00 > > 00 00 00 00 00 00 > > 00 00 > > > > root@beaglebone:~# ./spidev -D /dev/s > > shm/ spidev1.0 spidev2.0 stderr stdin stdout > > root@beaglebone:~# ./spidev -D /dev/spidev2.0 one thing caught my attention, shouldn't you be passing '-l' argument here for loopback testing ? That would mean you need to make sure your "spi->mode" has SPI_LOOP flag set. Currently there is no way to do that via DeviceTree (AFAICT), so please apply ths patch to your tree and set spi-loopback; property for your spidev entry: diff --git a/Documentation/devicetree/bindings/spi/spi-bus.txt b/Documentation/devicetree/bindings/spi/spi-bus.txt index 296015e..1949586 100644 --- a/Documentation/devicetree/bindings/spi/spi-bus.txt +++ b/Documentation/devicetree/bindings/spi/spi-bus.txt @@ -55,6 +55,8 @@ contain the following properties. chip select active high - spi-3wire - (optional) Empty property indicating device requires 3-wire mode. +- spi-loopback - (optional) Empty property indicating device requires + loopback mode. If a gpio chipselect is used for the SPI slave the gpio number will be passed via the cs_gpio diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 3f1b9ee..6bcdc03 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -868,6 +868,8 @@ static void of_register_spi_devices(struct spi_master *master) spi->mode |= SPI_CS_HIGH; if (of_find_property(nc, "spi-3wire", NULL)) spi->mode |= SPI_3WIRE; + if (of_find_property(nc, "spi-loopback", NULL)) + spi->mode |= SPI_LOOP; /* Device speed */ prop = of_get_property(nc, "spi-max-frequency", &len);