
I am just following this .. read it .. I am doing first steps which is on the SDIO aka SDHost
https://iosoft.blog/2020/03/08/zerowi-part3/
Now the only thing I know is the question he asks why the CRC fails

It is because the Pi SDHost rolls the CRC out of the register ... the SD card does the same.
Code: Select all
It’d be nice to understand why two of the commands have failed CRCs,
but the Linux driver ignores that error, so I will as well.
The above sequence is implemented in my code as follows:
I commented the CRC issue on the SDCard host .. .The Pi SDHost cant do CRC it's been cleaved ... hence the linux driver notes the error and ignores it.
Code: Select all
/* The CID is Big Endian and secondly the Pi butchers it by not having CRC */
/* So the CID appears shifted 8 bits right with first 8 bits reading zero */
Now the blogger manually toggles the SDIO lines to clock the data out. Your code sets up the SDhost properly and fires the data out using it so it is a lot more advanced than his code. However he has nutted out the sequence by parsing massive data dumps so we can simply follow it with the SDHost doing the work.
So now back to code ... so this is the code I am following for step one from the blog
I had to do that because I have reached the end of your code and you haven't provided any more

I don't know what the first 2 lines do yet ... your code doesn't have those functions
So I am picking it up from the second delay and currently I get to sdio_cmd(3, 0, &resp);
So what I am after is a valid rca.
Code: Select all
int rca;
sdio_cmd52(SD_FUNC_BUS, 0x06, 0, SD_RD, 0, 0);
usdelay(20000);
sdio_cmd52(SD_FUNC_BUS, 0x06, 8, SD_WR, 0, 0);
usdelay(20000);
sdio_cmd(0, 0, 0);
sdio_cmd(8, 0x1aa, 0);
// Enable I/O mode
sdio_cmd(5, 0, 0);
sdio_cmd(5, 0x200000, 0);
// Assert SD device
sdio_cmd(3, 0, &resp);
rca = SWAP16(resp.rsp3.rcax);
sdio_cmd7(rca, 0);
If you go to the next part on the blog the next thing we are going to do is download the binary to the wifi chip.
There is a clunk here the blogger doesn't do ... I want to handshake with the wifi chip and change the SDIO speed
up to high speed. I do not want to be communicating at 400Khz on what is probably a 100Mhz bus. I assume it
is like SD cards you negotiate the speed. So we are going to have to work that out from the linux driver the blogger
could never do that speed manually.
So at the moment we are following the linux driver but using your functions you got from U-boot and I fixed but following the blog. So it's a mashup of all the different code ... what could possibly go wrong

If you want to jump ahead that is cmd 3 on a normal SDCard on an SDHost
https://github.com/LdB-ECM/Raspberry-Pi ... rd.c#L2433
Note he jumps straight to CMD7 after CMD3 .... on an SDCard you send CMD 9 and engage high speed, I suspect we will do same.