Just waiting for factory…So I am on SPI again. 🙂
Last time I have done the driver, but it is not working with mmc. I think there must be something wrong with it, but after my test, the driver works quite well, so I guess I should make some mistake in mmc driver config.
NEW SOURCE CODE HERE: spi-rt2880.c
I soldered another flash to a bare VoCore board, so I do not have to solder the eight wires. Connect CS1->CS0, SPICLK->SPICLK, MOSI->MOSI, MISO->MISO, also pull HOLD/WP to high, so now VoCore SPI1 is controlling the second flash.
It works very well by current openwrt in high speed(>935KHz).
Add the following code to replace spidev@1 in VOCORE.dts, set the flash to 500KHz.
m25p80@1 { #address-cells = <1>; #size-cells = <1>; compatible = "w25q128"; reg = <1>; linux,modalias = "m25p80", "w25q128"; spi-max-frequency = <500000>; partition@0 { label = "xxxx"; reg = <0x0 0x1000000>; }; };
From my test, the data is normal.
root@OpenWrt:/sys/devices/10000000.palmbus/10000b00.spi/spi_master/spi32766/spi32766.1# ls driver factory_id modalias mtd subsystem uevent root@OpenWrt:/sys/devices/10000000.palmbus/10000b00.spi/spi_master/spi32766/spi32766.1# cat factory_id D26210-44DB40312F
Its log:
Mon Sep 29 02:06:27 2014 authpriv.notice dropbear[1175]: Password auth succeeded for 'root' from 192.168.61.159:58928 Mon Sep 29 02:07:19 2014 kern.warn kernel: [ 1461.940000] m25p80 spi32766.1: low speed mode. Mon Sep 29 02:07:19 2014 kern.warn kernel: [ 1461.960000] m25p80 spi32766.1: delay = 1000 Mon Sep 29 02:07:19 2014 kern.warn kernel: [ 1461.970000] m25p80 spi32766.1: low speed mode. Mon Sep 29 02:07:19 2014 kern.warn kernel: [ 1461.980000] m25p80 spi32766.1: delay = 1000 Mon Sep 29 02:07:19 2014 kern.warn kernel: [ 1461.980000] m25p80 spi32766.1: cs = 1, on Mon Sep 29 02:07:19 2014 kern.warn kernel: [ 1462.000000] m25p80 spi32766.1: bit/x: 8,5 Mon Sep 29 02:07:19 2014 kern.warn kernel: [ 1462.000000] m25p80 spi32766.1: low speed mode.
Read data from the flash is also normal, just a little slow:
root@OpenWrt:/# hexdump -C /dev/mtdblock6 | head -10 00000000 27 05 19 56 d6 62 66 a6 53 88 7f 17 00 01 96 c0 |'..V.bf.S.......| 00000010 80 20 00 00 80 20 00 00 a3 c1 ed e5 05 05 01 00 |. ... ..........| 00000020 53 50 49 20 46 6c 61 73 68 20 49 6d 61 67 65 00 |SPI Flash Image.| 00000030 06 50 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |.P..............| 00000040 ff 00 00 10 00 00 00 00 fd 00 00 10 00 00 00 00 |................| 00000050 e9 01 00 10 00 00 00 00 e7 01 00 10 00 00 00 00 |................| 00000060 e5 01 00 10 00 00 00 00 e3 01 00 10 00 00 00 00 |................| 00000070 e1 01 00 10 00 00 00 00 df 01 00 10 00 00 00 00 |................| 00000080 dd 01 00 10 00 00 00 00 db 01 00 10 00 00 00 00 |................| 00000090 d9 01 00 10 00 00 00 00 d7 01 00 10 00 00 00 00 |................|
I think last time I should did something wrong in the mmc driver config…