<span style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">Hello,</span><div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">
<div>  I'm using kernel 3.6 on a i.MX23 processor.</div><div>I was able to enable and use a second SD Card by using interface SSP2 (I boot from a SD Card on SSP1). </div><div>The short story is, I need to keep BM_SSP_CTRL1_POLARITY bit in HW_SSP_CTRL1 register to a 1 value, while now it is initialized at 1, but after that it changes to 0.</div>

<div>How do I accomplish this?</div><div><br></div><div>Here I explain why I need this behaviour.</div><div>The SD Card is correctly recognised, (kern.log tells that I have a 1.84GB card in it is correct), but then I'm having some communication errors</div>

<div><br></div><div>[...]</div><div>Oct 18 19:19:30 debian kernel: [  527.800000] mmcblk1: error -84 transferring data, sector 0, nr 8, cmd response 0x900, card status 0x800b00</div><div><div>Oct 18 19:19:30 debian kernel: [  527.810000] mmcblk1: retrying using single block read</div>

<div>Oct 18 19:19:30 debian kernel: [  527.820000] mmcblk1: error -84 transferring data, sector 0, nr 8, cmd response 0x900, card status 0x0</div><div>Oct 18 19:19:30 debian kernel: [  527.830000] end_request: I/O error, dev mmcblk1, sector 0</div>

<div>Oct 18 19:19:30 debian kernel: [  527.840000] mmcblk1: error -84 transferring data, sector 1, nr 7, cmd response 0x900, card status 0x0</div><div>Oct 18 19:19:30 debian kernel: [  527.840000] end_request: I/O error, dev mmcblk1, sector 1</div>

<div>Oct 18 19:19:30 debian kernel: [  527.850000] mmcblk1: error -84 transferring data, sector 2, nr 6, cmd response 0x900, card status 0x0</div><div>Oct 18 19:19:30 debian kernel: [  527.860000] end_request: I/O error, dev mmcblk1, sector 2</div>

<div>Oct 18 19:19:30 debian kernel: [  527.870000] mmcblk1: error -84 transferring data, sector 3, nr 5, cmd response 0x900, card status 0x0</div><div>Oct 18 19:19:30 debian kernel: [  527.880000] end_request: I/O error, dev mmcblk1, sector 3</div>

<div>Oct 18 19:19:30 debian kernel: [  527.900000] mmcblk1: error -84 transferring data, sector 4, nr 4, cmd response 0x900, card status 0x0</div><div>Oct 18 19:19:30 debian kernel: [  527.910000] end_request: I/O error, dev mmcblk1, sector 4</div>

<div>Oct 18 19:19:30 debian kernel: [  527.940000] mmcblk1: error -84 transferring data, sector 5, nr 3, cmd response 0x900, card status 0x0</div><div>Oct 18 19:19:30 debian kernel: [  527.950000] end_request: I/O error, dev mmcblk1, sector 5</div>

<div>Oct 18 19:19:30 debian kernel: [  527.960000] mmcblk1: error -84 transferring data, sector 6, nr 2, cmd response 0x900, card status 0x0</div><div>Oct 18 19:19:30 debian kernel: [  527.960000] end_request: I/O error, dev mmcblk1, sector 6</div>

<div>Oct 18 19:19:30 debian kernel: [  527.980000] mmcblk1: error -84 transferring data, sector 7, nr 1, cmd response 0x900, card status 0x0</div><div>Oct 18 19:19:30 debian kernel: [  527.990000] end_request: I/O error, dev mmcblk1, sector 7</div>

<div>Oct 18 19:19:30 debian kernel: [  527.990000] quiet_error: 13 callbacks suppressed</div><div>Oct 18 19:19:30 debian kernel: [  528.000000] Buffer I/O error on device mmcblk1, logical block 0</div><div>Oct 18 19:19:30 debian kernel: [  528.020000] mmcblk1: error -110 sending stop command, original cmd response 0x900, card status 0x800b00</div>

</div><div>[...]</div><div><br></div><div>Here is some facts:</div><div>- if I'm right, SD standard says that data bits are sampled on the rising edge of the clock signal, and must be valid for at least 2.5ns after that.</div>

<div>- in mxs-mmc.c, I see that BM_SSP_CTRL1_POLARITY bit in HW_SSP_CTRL1 register is set in function mxs_mmc_reset -> this means data changes after falling edge (this information is contained in the imx23 datasheet p1042 -> <a href="http://www.freescale.com/files/dsp/doc/ref_manual/IMX23RM.pdf" style="color:rgb(17,85,204)" target="_blank">http://www.freescale.com/files/dsp/doc/ref_manual/IMX23RM.pdf</a> )</div>

<div>- with an oscilloscope I see that data bits correctly change after falling in edge during the first communications (the phase at 400 kHz clock)</div><div>- I see also that after this, when clock switches to high speed (default is 50MHz, but I slowed down because of hardware problems to 1 MHz), data bits change after rising edge</div>

<div>- in fact if I printk out HW_SSP_CTRL1, I see that BM_SSP_CTRL1_POLARITY is reset (-> data changes after rising edge).</div><div><br></div><div>The outcome is that even if I slow down to 1 MHz, I can't correctly read the content of the SD card. Looking at the oscilloscope if I measure signals near the SD Card I see that the clock rising edge is a little late, so the SD Card sees that bits changing when they're sampled.</div>

<div>I think that doing changes after the rising edge while in high speed is the correct thing, so there's enough time for data bits to settle.</div><div>Anyway, because of my hardware problems (SD Card is 50 cm away from the CPU), slowing down the card to 1MHz does not improve things because data are changed so close to the time at which they're sampled. Signals and good and squared, with no ringings, but that little time shift throws me in trouble).</div>

<div><br></div><div>I would need to keep the  BM_SSP_CTRL1_POLARITY bit to 1 even in high speed, so data bits change on the falling edge; data bits have all the time to settle before the arriving of the rising edge since the clock is as slow as 1MHz.</div>

<div>But I don't know how to keep this bit at 1.</div><div>There's only a reference in mxs-mmc.c to BM_SSP_CTRL1_POLARITY, when it is set to 1, so I can't figure where it gets changed and set to 0.</div><div>
<br>
</div><div>Any help is appreciated. Thank you very much in advance.</div><div>Best regards,</div><div>  Marco Lazzaroni</div></div>