Re: SD card over (xilinx_)SPI, timeout error while CID

2009-06-11 Thread Ricardo Ribalda Delgado
Hello,

   It seems that I am facing the same problem!. I attach another trace
that also shows the sd I/O.

 I have also commented out the dma line at probe and no better results

  As you point, the card is unable to reply the cid. But not only
that, after that failure the card replyies allways FF!!! So it seems
that after that command the card is dead

  I have tried with spi modes 3 and 0, having the same results.

  Best regards

[   48.539108] irq: irq 16 on host
/p...@0/interrupt-control...@8700 mapped to virtual irq 27
[   48.570049] xilinx-xps-spi 8a00.xps-spi: at 0x8A00 mapped
to 0xD93A, irq=27
[   48.600625] Xilinx SPI: change mode 0, 0 bits/w, 0 cs_high
[   48.622642] Xilins SPI: cs off
[   48.853914] Xilinx SPI: change mode 3, 8 bits/w, 0 cs_high
[   48.875780] Xilins SPI: cs off
[   48.895013] mmc_spi spi1.0: ASSUMING SPI bus stays unshared!
[   48.921849] mmc0: clock 0Hz busmode 0 powermode 0 cs 0 Vdd 0 width 0 timing 0
[   48.945429] mmc0: clock 0Hz busmode 2 powermode 1 cs 1 Vdd 21 width
0 timing 0
[   48.968949] mmc_spi spi1.0: mmc_spi: power up (21)
[   48.990098] mmc_spi spi1.0: SD/MMC host mmc0, no DMA, no WP, no
poweroff, cd polling
[   49.014178] mmc0: clock 40Hz busmode 2 powermode 2 cs 1 Vdd 21
width 0 timing 0
[   49.038579] mmc_spi spi1.0: mmc_spi: power on (21)
[   49.059543] Xilinx SPI: cs on
[   49.078528] Spi  Transfer at 0x8A00
[   49.098000] Sending 29 bytes
[   49.099687] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[   49.119458] roff ff ff ff ff ff ff ff ff ff ff ff ff
[   49.161376] Received 29 bytes
[   49.163329] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[   49.183066] ff ff ff ff ff ff ff ff ff ff ff ff ff
[   49.218076] Xilinx SPI: cs on
[   49.235595] Spi  Transfer at 0x8A00
[   49.254150] Sending 10 bytes
[   49.255804] ff ff ff ff ff ff ff ff ff ff
[   49.289548] Received 10 bytes
[   49.291330] ff ff ff ff ff ff ff ff ff ff
[   49.324085] Xilinx SPI: change mode 7, 8 bits/w, 4 cs_high
[   49.343351] Xilins SPI: cs off
[   49.359698] Xilinx SPI: cs on
[   49.375759] Spi  Transfer at 0x8A00
[   49.392781] Sending 18 bytes
[   49.394467] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[   49.412181] ff ff
[   49.441053] Received 18 bytes
[   49.442834] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[   49.460487] ff ff
[   49.489213] Xilinx SPI: change mode 3, 8 bits/w, 0 cs_high
[   49.507989] Xilins SPI: cs off
[   49.524119] Xilinx SPI: change mode 3, 8 bits/w, 0 cs_high
[   49.542881] Xilins SPI: cs off
[   49.558995] mmc_spi spi1.0: mmc_spi:  clock to 40 Hz, 0
[   49.592549] mmc0: starting CMD0 arg  flags 00c0
[   49.611249] mmc_spi spi1.0:   mmc_spi: CMD0, resp R1
[   49.629037] Xilinx SPI: cs on
[   49.644017] Spi  Transfer at 0x8A00
[   49.660436] Sending 17 bytes
[   49.662539] ff 40 00 00 00 00 95 ff ff ff ff ff ff ff ff ff
[   49.679625] ff
[   49.706964] Received 17 bytes
[   49.709175] ff ff ff ff ff ff ff ff 01 ff ff ff ff ff ff ff
[   49.725994] ff
[   49.752770] Xilinx SPI: change mode 3, 8 bits/w, 0 cs_high
[   49.770409] Xilins SPI: cs off
[   49.785069] mmc0: req done (CMD0): 0: 0001   
[   49.804839] mmc0: starting CMD8 arg 01aa flags 02f5
[   49.822469] mmc_spi spi1.0:   mmc_spi: CMD8, resp R3/R4/R7
[   49.839895] Xilinx SPI: cs on
[   49.854839] Spi  Transfer at 0x8A00
[   49.870638] Sending 21 bytes
[   49.872294] ff 48 00 00 01 aa 87 ff ff ff ff ff ff ff ff ff
[   49.889218] ff ff ff ff ff
[   49.916288] Received 21 bytes
[   49.918498] ff ff ff ff ff ff ff ff 01 00 00 01 aa ff ff ff
[   49.935246] ff ff ff ff ff
[   49.962416] Xilinx SPI: change mode 3, 8 bits/w, 0 cs_high
[   49.980219] Xilins SPI: cs off
[   49.995410] mmc0: req done (CMD8): 0: 0001 01aa  
[   50.014912] mmc0: starting CMD5 arg  flags 02e1
[   50.033278] mmc_spi spi1.0:   mmc_spi: CMD5, resp R3/R4/R7
[   50.051561] Xilinx SPI: cs on
[   50.067193] Spi  Transfer at 0x8A00
[   50.083948] Sending 21 bytes
[   50.086041] ff 45 00 00 00 00 5b ff ff ff ff ff ff ff ff ff
[   50.103588] ff ff ff ff ff
[   50.132604] Received 21 bytes
[   50.134387] ff ff ff ff ff ff ff ff 05 ff ff ff ff ff ff ff
[   50.151844] ff ff ff ff ff
[   50.180735] mmc_spi spi1.0:   ... CMD5 response SPI_R3/R4/R: resp
0005 
[   50.201467] Xilinx SPI: change mode 3, 8 bits/w, 0 cs_high
[   50.220507] Xilins SPI: cs off
[   50.236890] mmc0: req done (CMD5): -22: 0005   
[   50.257701] mmc0: starting CMD55 arg  flags 00f5
[   50.277204] mmc_spi spi1.0:   mmc_spi: CMD55, resp R1
[   50.296051] Xilinx SPI: cs on
[   50.312639] Spi  Transfer at 0x8A00
[   50.330024] Sending 17 bytes
[   50.331710] ff 77 00 00 00 00 65 ff ff ff ff ff ff ff ff ff
[   50.349786] ff
[   50.379487] Received 17 bytes
[   50.381697] ff ff ff ff ff ff ff ff 01 ff ff ff ff ff ff ff
[   50.399768] ff
[   50.429230] Xilinx SPI: change 

Re: SD card over (xilinx_)SPI, timeout error while CID

2009-06-11 Thread Lorenz Kolb

Hello,

Ricardo Ribalda Delgado wrote:

Hello,

   It seems that I am facing the same problem!. I attach another trace
that also shows the sd I/O.


Is the I/O logged from within the Xilinx-SPI-Driver or from within the 
mmc-spi-layer?


The response to CMD10 seems quite strange to me. The R1 answer to that 
command says that everything is OK, so what is done next is that the 
0xfe token will be expected by the mmc-spi-layer. Obviously that one is 
not received within the proper time (assuming your data-logging was done 
from within xilinx-spi-driver). Also be aware of printk() taking 
milliseconds for printing to console, within time critical routines that 
might not be the best choice for debugging.


What frequency does Your SPI-Bus use?


Also double check to completely disable the whole

  if (spi-master-dev.parent-dma_mask) {
...
  }

block within mmc_spi_probe(). That worked for us (as we already said as 
an ugly workaround).


Regards,
  Lorenz
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: SD card over (xilinx_)SPI, timeout error while CID

2009-06-11 Thread Ricardo Ribalda Delgado
Hello

  Thanks for your reply

 Is the I/O logged from within the Xilinx-SPI-Driver or from within the
 mmc-spi-layer?

It is take from inside the spi driver.


 The response to CMD10 seems quite strange to me. The R1 answer to that
 command says that everything is OK, so what is done next is that the 0xfe
 token will be expected by the mmc-spi-layer. Obviously that one is not
 received within the proper time (assuming your data-logging was done from
 within xilinx-spi-driver). Also be aware of printk() taking milliseconds for
 printing to console, within time critical routines that might not be the
 best choice for debugging.

I will retry tomorrow removing all the spi debug and report what happens.


 What frequency does Your SPI-Bus use?


33Mhz arghh. just checked is over the standard...  Tomorrow I will
test with a slower clk


 Also double check to completely disable the whole

  if (spi-master-dev.parent-dma_mask) {
    ...
  }

Tomorow morning i will double check it, but it was something we
removed from the very begining (we dont have dma for the spi and we
suppose it was an error)  In my last log check:

[   48.990098] mmc_spi spi1.0: SD/MMC host mmc0, no DMA, no WP, no
poweroff, cd polling





Anyway the problem is definitely here:

[   52.094569] mmc0: starting CMD10 arg  flags 00b5
[   52.113755] mmc0: blksz 16 blocks 1 flags 0200 tsac 0 ms nsac 64
[   52.134240] mmc_spi spi1.0:   mmc_spi: CMD10, resp R1
[   52.152922] Xilinx SPI: cs on
[   52.169228] Spi  Transfer at 0x8A00
[   52.186386] Sending 9 bytes
[   52.187978] ff 4a 00 00 00 00 1b ff ff
[   52.218225] Received 9 bytes
[   52.219911] ff ff ff ff ff ff ff ff 00
[   52.249970] mmc_spi spi1.0: mmc_spi: read block, 16 bytes
[   52.269009] Xilinx SPI: cs on
[   52.285210] Spi  Transfer at 0x8A00
[   52.302276] Sending 1 bytes
[   52.303867] ff
[   52.332598] Received 1 bytes
[   52.334287] ff
[   52.362345] Xilinx SPI: cs on
[   52.377675] Spi  Transfer at 0x8A00
[   52.393815] Sending 1 bytes
[   52.395408] ff
[   52.422215] Received 1 bytes
[   52.423901] ff


It tries to read the cid and the only thing it get from the sd back
are 0xff. I have made it loop without timeout and I keep receiving
0xff


Also after the cid read the sd card dont reply to any command
weird.  lets see tomorrow with a slower clk.


 Thanks for your commends


  Best regards


-- 
Ricardo Ribalda
http://www.eps.uam.es/~rribalda/
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: SD card over (xilinx_)SPI, timeout error while CID

2009-06-11 Thread Wolfgang Denk
Dear Ricardo Ribalda Delgado,

In message aa76a2be0906111349s2ff947eo35149ef14e29d...@mail.gmail.com you 
wrote:
 
  What frequency does Your SPI-Bus use?
 
 33Mhz arghh. just checked is over the standard...  Tomorrow I will
 test with a slower clk

Just some really stupid questions:

This is with a 4xx core, right? Is this the same SPI controller design
like in AMCC's 40x and 44x cores, i. e. with a FIFO of depth 1?

Assuming you're running your SPI clock at 1 MHz,  you  get  one  data
byte  and  thus  one interrupt at a rate of 125 kHz. I doubt your CPU
can handle such a load?


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
A witty saying proves nothing, but saying  something  pointless  gets
people's attention.
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: SD card over (xilinx_)SPI, timeout error while CID

2009-06-11 Thread Ricardo Ribalda Delgado
Hello Wolfgang


 This is with a 4xx core, right? Is this the same SPI controller design
 like in AMCC's 40x and 44x cores, i. e. with a FIFO of depth 1?

It is a ppc440 but it is does not have ans  spi controller as in the
amcc. The spi controller is a xilinx core allocated at the plb bus,
including a deeper fifo.

The actual version  does not have a sustained speed of 33Mhz but a can
have a peak speed of 33 MHz


   Thanks for your comment


-- 
Ricardo Ribalda
http://www.eps.uam.es/~rribalda/
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: SD card over (xilinx_)SPI, timeout error while CID

2009-06-08 Thread Lorenz Kolb

Peter Korsgaard wrote:

Joachim == Joachim Foerster j...@gmx.de writes:



Hi,

 Joachim Any hints? Does anybody use SD card support with
 Joachim mmc_spi+xilinx_spi ?

I don't, but have you compared the spi signals on a scope in the 2
setups? Is timing significantly different?

  

Hi,

we just tried to find differences for the timing with the oszi:

Here are to screenshots taken from the initial first few data bytes that are
communicated. At least at that time there does not seem to be any timing 
issue.


2.6.26 using arch ppc and virtex-devices:

http://img145.imageshack.us/img145/9662/2626virtexdevices.jpg

2.6.29.4 using arch powerpc:

http://img145.imageshack.us/img145/9847/2629devtree.jpg

For explanation:

yellow = chan 1 = MOSI = trigger
green = chan 2 = chipselect not
blue = chan 3 = clock
red = chan 4 = MOSI

Looks like we're gonna have to switch to a logic analyzer
(with spi-mode sdcard analyzing support) as we cannot see any differences
in the short timeframe our oszi does measure, though checking the timing
does not look too promising.

We even configured the Xilinx-SPI core to go down to ~780 kHz just to be 
safe,

did not help either.

Regards,

Lorenz
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: SD card over (xilinx_)SPI, timeout error while CID

2009-06-06 Thread Peter Korsgaard
 Joachim == Joachim Foerster j...@gmx.de writes:

Hi,

 Joachim Any hints? Does anybody use SD card support with
 Joachim mmc_spi+xilinx_spi ?

I don't, but have you compared the spi signals on a scope in the 2
setups? Is timing significantly different?

-- 
Bye, Peter Korsgaard
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


RE: SD card over (xilinx_)SPI, timeout error while CID

2009-06-05 Thread John Linn
 -Original Message-
 From: Joachim Foerster [mailto:j...@gmx.de]
 Sent: Friday, June 05, 2009 9:34 AM
 To: linuxppc-...@ozlabs.org; John Linn;
dbrown...@users.sourceforge.net
 Cc: lor...@missinglinkelectronics.com;
joac...@missinglinkelectronics.com
 Subject: SD card over (xilinx_)SPI, timeout error while CID
 
 Hi,
 
 we have a very strange problem with SD-card-over-SPI support using
 2.6.29.4 on our custom PowerPC 405 (Virtex-4 FX FPGA) based board. To
 summarize the problem in one sentence: mmc_spi gets a timeout (error
 -110) after sending MMC command CMD10 (CID, card identification?).
 
 The attached log file shows device registration messages during bootup
 and debug/error messages after inserting a SD card.
 
 ATM we are migrating from 2.6.26 (old arch/ppc-based, non-device-tree)
 to the already mentioned version 2.6.29.4 (arch/powerpc, device tree).
 We use Xilinx' opb_spi core (v1.00.e, EDK 9.1.02i) inside the FPGA,
 which is connected to a SD card slot. With our old 2.6.26 kernel, SD
 cards _are working fine_!.
 
 To solve the problem, among other things, we tried 2.6.26+arch/powerpc
 (applying only necessary patches to support/include SPI, MMC OF
 bindings) - but the result is the same (error -110). The same is also
 true for
 2.6.28+arch/powerpc and Linus-HEAD+arch/powerpc . Then we checked
these
 patches, which add OF bindings for
 SPI/MMC/..., line by line and did not find any hint.
 For debugging we added a lot of printks ;-) and noticed that then
there
 are less timeouts (error -110), but  CRC check errors (-EILSEQ,
 mmc_spi.c, mmc_spi_readblock) happen - maybe even signal
shifts/sampling
 errors?
 
 To complete confusion :-( the same setup (xilinx_spi+opb_spi) using an
 ADS7846 touchscreen controller as SPI slave _does work_ correctly
 
 Our current guess is, that it could be a more basic (?) error in
 arch/powerpc . But we have no lead ATM.
 
 Any hints? Does anybody use SD card support with mmc_spi+xilinx_spi ?
 

There were definitely some changes to the spi driver as I had to make it
use the device tree.
I have not tested with SD as I don't have a board with SD memory. I have
only tested
with a serial eeprom.

Sorry not much help. If I had to guess I would also think it might be
device tree related.

-- John

  Joachim
 
 --
 for reference: relevant DTS entry:
 
 opb_spi_0: s...@4124 {
   #address-cells = 1;
   #size-cells = 0;
 
   compatible = xlnx,opb-spi-1.00.e;
   reg = 0x4124 0x1;
   interrupt-parent = opb_intc_0;
   interrupts = 7 2;
 
   xlnx,depth = 0x10;
   xlnx,dev-blk-id = 0x4;
   xlnx,dev-mir-enable = 0x0;
   xlnx,family = virtex4;
   xlnx,fifo-exist = 0x1;
   xlnx,interrupt-present = 0x1;
   xlnx,ip-reg-bar-offset = 0x60;
   xlnx,num-bits-reg = 0x8;
   xlnx,num-bits-sr = 0x8;
   xlnx,num-offchip-ss-bits = 0x0;
   xlnx,num-ss-bits = 0x1;
   xlnx,occupancy-num-bits = 0x4;
   xlnx,spi-slave-only = 0x0;
 
   mmc-s...@0 {
   compatible = mmc-spi-slot;
   reg = 0;
   gpios = opb_gpio_1 0 1;
   voltage-ranges = 3300 3300;
   spi-max-frequency = 625;
   };
 };
 
 dmesg during boot sequence, messages concerning SPI and MMC/SD only:
 
 [   30.677087] xilinx-xps-spi 4124.spi: at 0x4124 mapped to
 0xC904, irq=18
 [   30.875967] mmc_spi spi32766.0: SD/MMC host mmc0, no WP, no
poweroff,
 cd polling
 
 dmesg after inserting a SD card:
 
 [  105.375146] mmc0: clock 0Hz busmode 2 powermode 1 cs 1 Vdd 21 width
0
 timing 0
 [  105.381246] mmc_spi spi32766.0: mmc_spi: power up (21)
 [  105.388286] mmc0: clock 40Hz busmode 2 powermode 2 cs 1 Vdd 21
 width 0 timing 0
 [  105.394839] mmc_spi spi32766.0: mmc_spi: power on (21)
 [  105.400197] mmc_spi spi32766.0: xilinx_spi_setup, unsupported mode
 bits 4
 [  105.406601] mmc_spi spi32766.0: can't change chip-select polarity
 [  105.414666] mmc0: starting CMD0 arg  flags 00c0
 [  105.419176] mmc_spi spi32766.0:   mmc_spi: CMD0, resp R1
 [  105.424511] mmc_spi spi32766.0: xilinx_spi_setup, mode 0, 8 bits/w,
0
 nsec/bit
 [  105.431557] mmc0: req done (CMD0): 0: 0001  
 
 [  105.439251] mmc0: starting CMD8 arg 01aa flags 02f5
 [  105.443770] mmc_spi spi32766.0:   mmc_spi: CMD8, resp R3/R4/R7
 [  105.449740] mmc_spi spi32766.0: xilinx_spi_setup, mode 0, 8 bits/w,
0
 nsec/bit
 [  105.456789] mmc0: req done (CMD8): 0: 0001 01aa 
 
 [  105.463502] mmc0: starting CMD5 arg  flags 02e1
 [  105.468999] mmc_spi spi32766.0:   mmc_spi: CMD5, resp R3/R4/R7
 [  105.474968] mmc_spi spi32766.0:   ... CMD5 response SPI_R3/R4/R:
resp
 0005 
 [  105.482448] mmc_spi spi32766.0: xilinx_spi_setup, mode 0, 8 bits/w,
0
 nsec/bit
 [  105.489606] mmc0: req done (CMD5): -22: 0005  
 
 [  105.496511] mmc0: starting CMD55 arg  flags 00f5
 [  105.502092] mmc_spi