From owner-freebsd-arm@FreeBSD.ORG Tue Mar 3 20:50:51 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 982FED12 for ; Tue, 3 Mar 2015 20:50:51 +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 3BDDA94D for ; Tue, 3 Mar 2015 20:50:50 +0000 (UTC) Received: from zeta.dino.sk (fw1.dino.sk [84.245.95.252]) (AUTH: LOGIN milan) by mailhost.netlabit.sk with ESMTPA; Tue, 03 Mar 2015 21:50:40 +0100 id 00DCA895.54F61EA1.00012F07 Date: Tue, 3 Mar 2015 21:50:40 +0100 From: Milan Obuch To: Luiz Otavio O Souza Subject: Re: Raspberry Pi SPI device example? Message-ID: <20150303215040.13f8439f@zeta.dino.sk> In-Reply-To: References: <20150216093418.3d1be83b@zeta.dino.sk> <20150219075342.7d2e7eec@zeta.dino.sk> <20150302124103.689135d3@zeta.dino.sk> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.25; i386-portbld-freebsd10.1) Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=_mailhost.netlabit.sk-77575-1425415841-0001-2" 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, 03 Mar 2015 20:50:51 -0000 This is a MIME-formatted message. If you see this text it means that your E-mail software does not support MIME-formatted messages. --=_mailhost.netlabit.sk-77575-1425415841-0001-2 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline 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 --=_mailhost.netlabit.sk-77575-1425415841-0001-2 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=tsc.c /*- * Copyright (c) 2015 * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPREC OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNEC FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINEC INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ /* * STMPE610 - touch screen controller/port expander */ #include __FBSDID("$FreeBSD$"); #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "spibus_if.h" #include "gpio_if.h" struct tsc_softc { device_t dev; device_t dev_gpio; }; struct tsc_softc *tsc_sc; static int tsc_probe(device_t dev) { device_set_desc(dev, "Touchscreen Controller"); device_printf(dev, "probe\n"); return (BUS_PROBE_DEFAULT); } static int tsc_attach(device_t dev) { struct tsc_softc *sc; sc = device_get_softc(dev); sc->dev = dev; tsc_sc = sc; device_printf(dev, "attach\n"); return (0); } static int tsc_detach(device_t dev) { struct tsc_softc *sc; sc = device_get_softc(dev); return (0); } static device_method_t tsc_methods[] = { DEVMETHOD(device_probe, tsc_probe), DEVMETHOD(device_attach, tsc_attach), DEVMETHOD(device_detach, tsc_detach), DEVMETHOD_END }; static driver_t tsc_driver = { "tsc", tsc_methods, sizeof(struct tsc_softc), }; static devclass_t tsc_devclass; DRIVER_MODULE(tsc, spibus, tsc_driver, tsc_devclass, 0, 0); --=_mailhost.netlabit.sk-77575-1425415841-0001-2--