[OpenWrt-Devel] lantiq: Initial linux 4.4 support (with SPI problems)

Daniel Schwierzeck daniel.schwierzeck at gmail.com
Sat Jan 16 10:34:46 EST 2016


Am Samstag, den 16.01.2016, 15:39 +0100 schrieb Martin Blumenstingl:
> Hi Daniel,
> 
> On Sat, Jan 16, 2016 at 1:06 AM, Martin Blumenstingl
> <martin.blumenstingl at googlemail.com> wrote:
> > > It is a complete rewrite with DT support and runs against the UGW
> > > -6.1.1
> > > kernel. Unfortunately I hadn't time yet to adapt and test it with
> > > OpenWRT. Maybe you want to volunteer for that ;)
> > Thanks for this update! I am going to test it on kernel 4.1 in the
> > next days and let you know about the results.
> I had to make 3 adjustments to get it working on OpenWrt:

nice, thanks for testing :)

> - replace INIT_COMPLECTION with reinit_completion (this is due the
> newer kernel version in OpenWrt)
> - use clk_get_fpi() to obtain the FPI clock (horrible, I am currently
> porting the lantiq clock code to the common clk framework, then we
> can
> pass this in correctly)
> - remove the " - 1" in "cs - 1" (it seems that your chipselect
> indexing in the .dts begins at 1, whereas the previous driver started
> at 0)

I fixed that because datasheets and pin descriptions in schematics use
CS1..CS6. I think DT should be in sync to the datasheets.

> 
> After that everything is working nicely on linux 4.1 (on my TD
> -W8970):
> [    0.926597] spi-lantiq 1e100800.spi: using internal chipselect 3
> [    0.931499] spi-lantiq 1e100800.spi: spi_clk 125000000,
> max_speed_hz 33250000, brt 2
> [    0.939351] m25p80 spi0.3: s25fl064k (8192 Kbytes)
> [    0.943763] 4 ofpart partitions found on MTD device spi0.3
> [    0.949192] Creating 4 MTD partitions on "spi0.3":
> [    0.953984] 0x000000000000-0x000000020000 : "u-boot"
> [    0.960136] 0x000000020000-0x0000007c0000 : "firmware"
> [    0.966720] 0x0000001cf40c-0x0000007c0000 : "rootfs"
> [    0.971380] mtd: device 2 (rootfs) set to be root filesystem
> [    0.976814] 1 squashfs-split partitions found on MTD device rootfs
> [    0.982126] 0x000000460000-0x0000007c0000 : "rootfs_data"
> [    1.030051] 0x0000007c0000-0x0000007d0000 : "config"
> [    1.034667] 0x0000007d0000-0x000000800000 : "boardconfig"
> [    1.040154] spi-lantiq 1e100800.spi: Lantiq SPI controller (TXFS
> 8,
> RXFS 8, DMA 32)
> 
> I have pushed my changes to the OpenWrt tree here: [0]
> My plan is to finish them soon (I want to do a little more testing,
> and I need to verify that my other dts changes are correct).

linux-4.4 finally has the patch [1] I was referring to. Maybe we should
also add it to 4.1. It is important to be able to setup each SPI pin
separately. You always should explicitely setup spi_clk and spi_do to
"lantiq,output = <1>" and spi_di to "lantiq,input". Depending on the
board, you optionally have to enable internal pull-up's, if there are
no external ones. The current DT pinmux setup with only one spi pin
group relies on the bootloader setup. This only works if the board
boots from SPI and the bootloader have to setup the SPI pins. With
other boot variants the SPI pins are likely not setup.

> 
> Thank you for your help!
> 
> 
> Regards,
> Martin
> 
> [0] https://github.com/xdarklight/openwrt/commits/lantiq-spi-driver-d
> aniel-v2
-- 
- Daniel
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list