From owner-freebsd-arm@FreeBSD.ORG Wed Mar 4 17:11:31 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 5946AB86 for ; Wed, 4 Mar 2015 17:11:31 +0000 (UTC) Received: from mail-we0-x229.google.com (mail-we0-x229.google.com [IPv6:2a00:1450:400c:c03::229]) (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 DE09B269 for ; Wed, 4 Mar 2015 17:11:30 +0000 (UTC) Received: by wesq59 with SMTP id q59so10765572wes.3 for ; Wed, 04 Mar 2015 09:11:29 -0800 (PST) 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=RCqVjWcNTMHTqJDytqVNQXFQHAe4JJhKgzIlvaVFHyA=; b=CI3S1ezAbghMAGfn50KfsDk07z4Jja021FHTfifDA73ctj2CYT0yXCazJXy1E3Dh5y KNQT5gzPV8tCuUKcR2YkO57obOWij1ABBQLZxTpnhs1EDHWyTyLn83VRDFDZV/nRreuo kaSu/XICnwFbG375uTAXprJSL1T5ljUZeF2xDvgNuudE4bbNMmuO/Utvf3C4kEWXdUN9 WUXUoM/VIp2nkj0ImM3zzvtb6oE0eCBDT2Afekn+tDZO6hzNSI1g4YsgOLKjidPSEJLR hGqIydxhyEtaYX0qX5f2f2PCkQ7n9TFnFJ35j1LHV8aSoTVcUeTxnL2WwcEJ3FIIvVzC 5PQA== MIME-Version: 1.0 X-Received: by 10.180.92.71 with SMTP id ck7mr14285889wib.48.1425489089298; Wed, 04 Mar 2015 09:11:29 -0800 (PST) Received: by 10.180.195.99 with HTTP; Wed, 4 Mar 2015 09:11:29 -0800 (PST) In-Reply-To: <20150303215040.13f8439f@zeta.dino.sk> References: <20150216093418.3d1be83b@zeta.dino.sk> <20150219075342.7d2e7eec@zeta.dino.sk> <20150302124103.689135d3@zeta.dino.sk> <20150303215040.13f8439f@zeta.dino.sk> Date: Wed, 4 Mar 2015 14:11:29 -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: Wed, 04 Mar 2015 17:11:31 -0000 On 3 March 2015 at 17:50, Milan Obuch wrote: > On Mon, 2 Mar 2015 20:14:29 -0300 > Luiz Otavio O Souza wrote: > > [ snip ] > >> Edit the DTS source file (bcm2835.dtsi and/or rpi.dts in >> sys/boot/fdt/dts/arm/) and then the DTB will be built as part of the >> next kernel build (you can also build it manually in >> sys/modules/dtb/rpi). >> >> Here is a patch I'm using to attach a mx25l compatible flash on my RPi >> (old patch...): >> >> http://loos.com.br/mx25l-fdt-intr.diff >> >> And the DTS changes: >> >> Index: sys/boot/fdt/dts/rpi.dts >> =================================================================== >> --- sys/boot/fdt/dts/rpi.dts (revision 253747) >> +++ sys/boot/fdt/dts/rpi.dts (working copy) >> @@ -281,6 +281,14 @@ >> broadcom,function = "ALT3"; >> }; >> }; >> + >> + spi0 { >> + flash0 { >> + compatible = "flash,mx25l"; >> + spi-chipselect = <0>; >> + }; >> + }; >> + >> usb { >> hub { >> compatible = "usb,hub", "usb,device"; >> >> >> HTH, >> Luiz > > Hi, > > no success yet. I wrote simple skeleton containing only basic > functions, attached, but nothing shows any call to them. In my dts, I > put > > spi0 { > tsc0 { > compatible = "st,stmpe_tc"; > spi-chipselect = <0>; > }; > }; > > I tried some variations, too, but no change. There are just two lines > in dmesg mentioning spi: > > spi0: mem 0x204000-0x20401f irq 62 on simplebus0 > spibus0: on spi0 > > I think I am just missing something simple and obvious, but I can't see > it. Anybody knows what is missing here? > > Regards, > Milan It (kinda) works for me: spi0: mem 0x204000-0x20401f irq 62 on simplebus0 spibus0: on spi0 tsc0: probe tsc0: probe tsc0: at cs 0 on spibus0 tsc0: attach In case you have the DTS entry but not a driver for the device, you will see something like: spi0: mem 0x204000-0x20401f irq 62 on simplebus0 spibus0: on spi0 spibus0: at cs 0 Check if your dtb has the necessary nodes: # ofwdump -a [...] Node 0x1704: bsc1 Node 0x17a0: spi0 Node 0x1818: tsc0 Node 0x1854: dma Node 0x1914: mbox [...] And the node contents: # ofwdump -p /axi/spi0/tsc0 Node 0x1818: tsc0 compatible: 73 74 2c 73 74 6d 70 65 5f 74 63 00 'st,stmpe_tc' spi-chipselect: 00 00 00 00 Luiz