Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 4 Mar 2015 14:11:29 -0300
From:      Luiz Otavio O Souza <lists.br@gmail.com>
To:        Milan Obuch <freebsd-arm@dino.sk>
Cc:        "freebsd-arm@freebsd.org" <freebsd-arm@freebsd.org>
Subject:   Re: Raspberry Pi SPI device example?
Message-ID:  <CAB=2f8x0MRWDXm30BA_Pc8VSEpLvHt5szb_9L4QEDuz1J%2BLstA@mail.gmail.com>
In-Reply-To: <20150303215040.13f8439f@zeta.dino.sk>
References:  <20150216093418.3d1be83b@zeta.dino.sk> <CAB=2f8xUGKWUPu1nk4PoD1ea4PO1BEy=fOZF8X2Y_hNEvTTPtg@mail.gmail.com> <20150219075342.7d2e7eec@zeta.dino.sk> <20150302124103.689135d3@zeta.dino.sk> <CAB=2f8zgy8WdFVK9wdN8VXUSw5vpUCOhqPxv2cSHAxiiAw23KA@mail.gmail.com> <20150303215040.13f8439f@zeta.dino.sk>

next in thread | previous in thread | raw e-mail | index | archive | help
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: <BCM2708/2835 SPI controller> mem 0x204000-0x20401f irq 62 on simplebus0
> spibus0: <OFW SPI bus> 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: <BCM2708/2835 SPI controller> mem 0x204000-0x20401f irq 62 on simplebus0
spibus0: <OFW SPI bus> on spi0
tsc0: probe
tsc0: probe
tsc0: <Touchscreen Controller> 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: <BCM2708/2835 SPI controller> mem 0x204000-0x20401f irq 62 on simplebus0
spibus0: <OFW SPI bus> on spi0
spibus0: <unknown card> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAB=2f8x0MRWDXm30BA_Pc8VSEpLvHt5szb_9L4QEDuz1J%2BLstA>