03:21
jcea has quit [Ping timeout: 268 seconds]
03:33
jcea has joined ##raspberrypi-internals
03:42
jcea has quit [Ping timeout: 268 seconds]
04:50
<
f_ridge >
<x2x6_/D> Whats the difference between previous?
05:17
<
f_ridge >
<clever___/D> mostly just changing various clocks in the system, ive improve the output more and automated it futher
05:17
<
f_ridge >
<clever___/D> ```
05:17
<
f_ridge >
<clever___/D> 55.555556 MHz, 228968 uSec to read 1MB 36.636597 mbits/sec
05:17
<
f_ridge >
<clever___/D> 50.000000 MHz, 228968 uSec to read 1MB 36.636597 mbits/sec
05:17
<
f_ridge >
<clever___/D> 45.454545 MHz, 228971 uSec to read 1MB 36.636116 mbits/sec
05:17
<
f_ridge >
<clever___/D> 41.666667 MHz, 229000 uSec to read 1MB 36.631477 mbits/sec
05:17
<
f_ridge >
<clever___/D> 38.461538 MHz, 229031 uSec to read 1MB 36.626518 mbits/sec
05:17
<
f_ridge >
<clever___/D> 35.714286 MHz, 238523 uSec to read 1MB 35.168968 mbits/sec
05:17
<
f_ridge >
<clever___/D> 33.333333 MHz, 253992 uSec to read 1MB 33.027058 mbits/sec
05:17
<
f_ridge >
<clever___/D> 31.250000 MHz, 270878 uSec to read 1MB 30.968214 mbits/sec
05:17
<
f_ridge >
<clever___/D> 29.411765 MHz, 287763 uSec to read 1MB 29.151100 mbits/sec
05:17
<
f_ridge >
<clever___/D> 27.777778 MHz, 304654 uSec to read 1MB 27.534868 mbits/sec
05:18
<
f_ridge >
<clever___/D> 26.315789 MHz, 321539 uSec to read 1MB 26.088928 mbits/sec
05:18
<
f_ridge >
<clever___/D> 25.000000 MHz, 338429 uSec to read 1MB 24.786907 mbits/sec
05:18
<
f_ridge >
<clever___/D> 23.809524 MHz, 355315 uSec to read 1MB 23.608932 mbits/sec
05:18
<
f_ridge >
<clever___/D> 22.727273 MHz, 372203 uSec to read 1MB 22.537724 mbits/sec
05:18
<
f_ridge >
<clever___/D> 21.739130 MHz, 389093 uSec to read 1MB 21.559391 mbits/sec
05:18
<
f_ridge >
<clever___/D> 20.833333 MHz, 405981 uSec to read 1MB 20.662563 mbits/sec
05:18
<
f_ridge >
<clever___/D> 20.000000 MHz, 422868 uSec to read 1MB 19.837416 mbits/sec
05:18
<
f_ridge >
<clever___/D> 19.230769 MHz, 439756 uSec to read 1MB 19.075596 mbits/sec
05:18
<
f_ridge >
<clever___/D> 18.518519 MHz, 456646 uSec to read 1MB 18.370047 mbits/sec
05:18
<
f_ridge >
<clever___/D> 17.857143 MHz, 473533 uSec to read 1MB 17.714939 mbits/sec
05:18
<
f_ridge >
<clever___/D> 17.241379 MHz, 490422 uSec to read 1MB 17.104877 mbits/sec
05:18
<
f_ridge >
<clever___/D> 16.666667 MHz, 507309 uSec to read 1MB 16.535500 mbits/sec
05:18
<
f_ridge >
<clever___/D> 16.129032 MHz, 524198 uSec to read 1MB 16.002747 mbits/sec
05:18
<
f_ridge >
<clever___/D> ```
05:18
<
f_ridge >
<clever___/D> this would be when the VPU clock is set to 500mhz, on a pi3
05:19
<
f_ridge >
<clever___/D> sdhost is referenced off the VPU clock, so that 55mhz at the top, is just 500mhz/9
05:19
<
f_ridge >
<clever___/D> but when i graph things (oh, fun, font problems during svg->png, lol), it shows a clear linear relationship between mhz and mbit, until it hits a wall
05:19
<
f_ridge >
<clever___/D> so the best i can get out of sdhost read, is 36mbit, when the VPU is running at 500mhz
05:19
<
f_ridge >
<clever___/D> but this is also entirely without DMA
05:20
<
f_ridge >
<clever___/D> the nearly 1:1 ratio between mhz and mbit, also says that i'm still in 1bit mode
05:21
<
f_ridge >
<x2x6_/D> I am stuck in trying to figure out the magic values in initialization sequence
05:22
<
f_ridge >
<x2x6_/D> Its not really easy to navigate the simplified SDHOST specification pdf beause it describes SPI mode as whell
05:22
<
f_ridge >
<clever___/D> i think you mean sdhci
05:22
<
f_ridge >
<clever___/D> there are no official docs for sdhost
05:23
<
f_ridge >
<x2x6_/D> well, not stuck, but there's too much to check
05:23
<
f_ridge >
<clever___/D> and yeah, i'm also confused by what the proper init sequence is
05:23
<
f_ridge >
<clever___/D> but i have figured out a hint, on why one of my old cards fails to boot
05:23
<
f_ridge >
<x2x6_/D> Its not really easy to navigate the simplified SDHCI specification pdf beause it describes SPI mode as whell(edited)
05:23
<
f_ridge >
<clever___/D> my init sequence, sends CMD8 to check to see what voltages the card supports
05:24
<
f_ridge >
<clever___/D> but, it is valid for a card to just not support CMD8
05:24
<
f_ridge >
<clever___/D> so, how do you detect this? how do you init such a card?
05:27
<
f_ridge >
<x2x6_/D> I am not sure also , I am looking in this section and trying to guess if this is applied to my card
05:27
<
f_ridge >
<clever___/D> the lexar cards i bought, clearly say `UHS-I` on the package
05:29
<
f_ridge >
<clever___/D> yeah, so that will just return thru 186, if its on such an old card
05:29
<
f_ridge >
<clever___/D> likely with a timeout error
05:29
<
f_ridge >
<x2x6_/D> Why do you think timeout error will be there?
05:29
<
f_ridge >
<clever___/D> because when the card doesnt support CMD8, it will just not respond
05:30
<
f_ridge >
<x2x6_/D> I think it will return a PATTERN but not the same supported voltage bit
05:30
<
f_ridge >
<clever___/D> and then a timeout will fire
05:30
<
f_ridge >
<x2x6_/D> ahh
05:30
<
f_ridge >
<clever___/D> the pdf also says, if the voltage you sent isnt supported, it just wont respond
05:31
<
f_ridge >
<x2x6_/D> Ok, yes, then if emmc controller returns with timeout, then it does not support
05:32
<
f_ridge >
<x2x6_/D> Ok, yes, then if emmc controller returns with timeout, then it does not support the suggested voltage(edited)
05:32
<
f_ridge >
<clever___/D> yep
05:32
<
f_ridge >
<clever___/D> the other bit i'm stuck on, is getting ACMD6 to work, SD_APP_SET_BUS_WIDTH
05:33
<
f_ridge >
<clever___/D> youve got that handled over in `bcm2835_emmc_reset_handle_scr`
05:34
<
f_ridge >
<clever___/D> ah, it looks like you send ACMD51, then parse that to see what the card handles
05:34
<
f_ridge >
<x2x6_/D> yes. I am going to revise this after I revise acmd41
05:35
<
f_ridge >
<x2x6_/D> Just to see it actually is done right
05:35
<
f_ridge >
<x2x6_/D> and all DATAn lines are in play
05:35
<
f_ridge >
<clever___/D> in my case, i just blindly send ACMD6, and dont even change the sd controller to 4bit mode
05:35
<
f_ridge >
<clever___/D> and things still work, when they shouldnt!
05:36
<
f_ridge >
<x2x6_/D> What about acmd41?
05:37
<
f_ridge >
<clever___/D> i am sending that one, right before ACMD6
05:38
<
f_ridge >
<x2x6_/D> It is not shown here but shown somewhere else that acmd41 first sent as a query and then as configuration. I've copy pasted it from somewhere I don't remember.
05:39
<
f_ridge >
<clever___/D> ah, i can see how it might still be in ident mode here...
05:39
<
f_ridge >
<clever___/D> let me check my code closer, and compare to that
05:39
<
f_ridge >
<clever___/D> after i do ACMD41 and ACMD6, i go on to `identify_card()`
05:40
<
f_ridge >
<clever___/D> `identify_card()` will do CMD2, CMD3, bingo, now its in data mode!
05:40
<
f_ridge >
<clever___/D> then CMD10 and CMD9,
05:40
<
f_ridge >
<clever___/D> then CMD10 and CMD9(edited)
05:41
<
f_ridge >
<clever___/D> so i think you can only do ACMD6 after CMD3 ?
05:41
<
f_ridge >
<clever___/D> let me try implementing ACMD51, so i can get the data you have
05:44
<
f_ridge >
<clever___/D> it looks like ACMD51 returns 8 bytes over the DAT pins?
05:49
<
f_ridge >
<clever___/D> ```
05:50
<
f_ridge >
<clever___/D> 4.698505 [EMMC:identify_card]: sending ACMD51
05:50
<
f_ridge >
<clever___/D> 4.902578 [EMMC:wait_for_fifo_data]: ERROR: no FIFO data, timed out after 100000us!
05:50
<
f_ridge >
<clever___/D> 5.108664 [EMMC:wait_for_fifo_data]: ERROR: no FIFO data, timed out after 100000us!
05:50
<
f_ridge >
<clever___/D> 5.114646 [EMMC:identify_card]: done 0x0 0x0
05:50
<
f_ridge >
<clever___/D> ```
05:56
<
f_ridge >
<x2x6_/D> Trying to figure out ACMD41 - looks like first you need to send all zeroes arguemnt to ACMD41 in inquiry mode, then set sometinh. In iquiry mode it should send OCR and some other stuff
05:57
<
f_ridge >
<clever___/D> ```
05:57
<
f_ridge >
<clever___/D> 8.048801 [EMMC:identify_card]: sending ACMD51
05:57
<
f_ridge >
<clever___/D> bool BCM2708SDHost::send_raw(uint32_t, uint32_t):131: CMD 55, arg=0
05:57
<
f_ridge >
<clever___/D> bool BCM2708SDHost::send_raw(uint32_t, uint32_t):131: CMD 51, arg=0
05:57
<
f_ridge >
<clever___/D> bool BCM2708SDHost::wait_and_get_response():222: Cmd: 51 Resp: ffffffff 0000ff7f 7fffffff 00a40002
05:57
<
f_ridge >
<clever___/D> 8.073831 [EMMC:wait_and_get_response]: ERROR: sdhost status: 0x40
05:57
<
f_ridge >
<clever___/D> 8.279918 [EMMC:wait_for_fifo_data]: ERROR: no FIFO data, timed out after 100000us!
05:57
<
f_ridge >
<clever___/D> 8.505090 [EMMC:wait_for_fifo_data]: ERROR: no FIFO data, timed out after 100000us!
05:57
<
f_ridge >
<clever___/D> 8.530199 [EMMC:identify_card]: done 0x0 0x0
05:57
<
f_ridge >
<clever___/D> ```
05:58
<
f_ridge >
<clever___/D> ah but your showing 41, and i'm stuck on 51
05:59
<
f_ridge >
<clever___/D> 41 is something i send during `query_voltage_and_type()`
05:59
<
f_ridge >
<clever___/D> ACMD41 is something i send during `query_voltage_and_type()`(edited)
06:10
<
f_ridge >
<clever___/D> oh, ive got an idea...
06:12
<
f_ridge >
<clever___/D> ```
06:12
<
f_ridge >
<clever___/D> [root@system76:/sys/devices/pci0000:00/0000:00:1c.4/0000:02:00.0/rtsx_pci_sdmmc.0/mmc_host/mmc0/mmc0:59b4]# for x in cid csd dsr name ocr rca scr ssr; do echo $x $(cat $x);done
06:12
<
f_ridge >
<clever___/D> cid ad4c534c583132381035846b42017501
06:12
<
f_ridge >
<clever___/D> csd 400e0032db790003ae077f800a400001
06:12
<
f_ridge >
<clever___/D> dsr 0x404
06:12
<
f_ridge >
<clever___/D> name LX128
06:12
<
f_ridge >
<clever___/D> ocr 0x00300000
06:12
<
f_ridge >
<clever___/D> rca 0x59b4
06:12
<
f_ridge >
<clever___/D> scr 0245848700000000
06:12
<
f_ridge >
<clever___/D> ssr 00000000080000000400a00100fd3a1e000800000001fc0000000000000000000000000000000000000000000000000000000000000000000000000000000000
06:12
<
f_ridge >
<clever___/D> ```
06:12
<
f_ridge >
<clever___/D> with that, i can read the SCR from linux
06:12
<
f_ridge >
<clever___/D> and ACMD51 is to send the SCR
06:13
<
f_ridge >
<clever___/D> so, i now know that it should contain `0245848700000000`
06:14
<
f_ridge >
<clever___/D> `MMC_DEV_ATTR(scr, "%08x%08x\n", card->raw_scr[0], card->raw_scr[1]);` is how linux renders it
06:16
<
f_ridge >
<clever___/D> and checking the linux source, yeah, it does look like it returns the reply over DAT
06:19
<
f_ridge >
<x2x6_/D> But ACMD41 is working in your case?
06:19
<
f_ridge >
<clever___/D> ```
06:19
<
f_ridge >
<clever___/D> bool BCM2708SDHost::send_raw(uint32_t, uint32_t):131: CMD 55, arg=0
06:19
<
f_ridge >
<clever___/D> bool BCM2708SDHost::send_raw(uint32_t, uint32_t):131: CMD 41, arg=1075838976
06:19
<
f_ridge >
<clever___/D> bool BCM2708SDHost::wait_and_get_response():222: Cmd: 41 Resp: c0ff8000 00003f7f ffffffff 00004820
06:19
<
f_ridge >
<clever___/D> 7.973160 [EMMC:query_voltage_and_type]: SD card has arrived!
06:19
<
f_ridge >
<clever___/D> ```
06:19
<
f_ridge >
<clever___/D> yeah, this is the debug from then
06:19
<
f_ridge >
<x2x6_/D> Because it sends OCR register and mine is kind of meaningless and deviates from spec
06:19
<
f_ridge >
<x2x6_/D> 00ff8000|00000000|00000000|00000000
06:19
<
f_ridge >
<x2x6_/D> This is what I get first time I run it
06:19
<
f_ridge >
<x2x6_/D> What do you use as an argument?
06:20
<
f_ridge >
<GitHub Lines/D> ```cpp
06:20
<
f_ridge >
<GitHub Lines/D> /* set voltage */
06:20
<
f_ridge >
<GitHub Lines/D> t = MMC_OCR_3_3V_3_4V;
06:20
<
f_ridge >
<GitHub Lines/D> if (r[0] == 0x1AA) {
06:20
<
f_ridge >
<GitHub Lines/D> t |= MMC_OCR_HCS;
06:20
<
f_ridge >
<GitHub Lines/D> is_sdhc = true;
06:20
<
f_ridge >
<GitHub Lines/D> }
06:20
<
f_ridge >
<GitHub Lines/D> /* query voltage and type */
06:21
<
f_ridge >
<GitHub Lines/D> for (;;) {
06:21
<
f_ridge >
<GitHub Lines/D> send(MMC_APP_CMD); /* 55 */
06:21
<
f_ridge >
<GitHub Lines/D> send_no_resp(SD_APP_OP_COND, t);
06:21
<
f_ridge >
<GitHub Lines/D> ```
06:21
<
f_ridge >
<clever___/D> ```
06:21
<
f_ridge >
<clever___/D> #define MMC_OCR_HCS (1<<30) /* SD only */
06:21
<
f_ridge >
<clever___/D> :#define MMC_OCR_3_3V_3_4V (1<<21)
06:21
<
f_ridge >
<clever___/D> ```
06:21
<
f_ridge >
<clever___/D> ```
06:21
<
f_ridge >
<clever___/D> #define MMC_OCR_HCS (1<<30) /* SD only */
06:21
<
f_ridge >
<clever___/D> #define MMC_OCR_3_3V_3_4V (1<<21)
06:22
<
f_ridge >
<clever___/D> ```(edited)
06:22
<
f_ridge >
<x2x6_/D> So you don't query?
06:22
<
f_ridge >
<GitHub Lines/D> ```cpp
06:22
<
f_ridge >
<GitHub Lines/D> if (!wait_and_get_response())
06:22
<
f_ridge >
<GitHub Lines/D> return false;
06:22
<
f_ridge >
<GitHub Lines/D> if (r[0] & MMC_OCR_MEM_READY)
06:22
<
f_ridge >
<GitHub Lines/D> break;
06:23
<
f_ridge >
<GitHub Lines/D> //logf("waiting for SD (0x%x) ...\n", r[0]);
06:23
<
f_ridge >
<GitHub Lines/D> udelay(100);
06:23
<
f_ridge >
<GitHub Lines/D> ```
06:23
<
f_ridge >
<clever___/D> after sending the command, it will wait for a certain value in `r[0]`
06:23
<
f_ridge >
<x2x6_/D> I mean in the spec it says first to send with all zeroes in arg
06:23
<
f_ridge >
<clever___/D> and if it doesnt get that, it waits 100uSec, and sends it again
06:23
<
f_ridge >
<clever___/D> ah, yeah, i dont see the code doing that
06:24
<
f_ridge >
<x2x6_/D> Why if (1aa) then its sdhc and HCS?
06:24
<
f_ridge >
<GitHub Lines/D> ```cpp
06:24
<
f_ridge >
<GitHub Lines/D> /* identify */
06:24
<
f_ridge >
<GitHub Lines/D> send(SD_SEND_IF_COND, 0x1AA);
06:24
<
f_ridge >
<GitHub Lines/D> wait_and_get_response();
06:24
<
f_ridge >
<GitHub Lines/D> /* set voltage */
06:24
<
f_ridge >
<GitHub Lines/D> t = MMC_OCR_3_3V_3_4V;
06:24
<
f_ridge >
<GitHub Lines/D> if (r[0] == 0x1AA) {
06:25
<
f_ridge >
<GitHub Lines/D> t |= MMC_OCR_HCS;
06:25
<
f_ridge >
<GitHub Lines/D> is_sdhc = true;
06:25
<
f_ridge >
<GitHub Lines/D> }
06:25
<
f_ridge >
<GitHub Lines/D> ```
06:25
<
f_ridge >
<clever___/D> the aa is the check pattern
06:25
<
f_ridge >
<clever___/D> your code refers to the check pattern as `CMD8_ARG_PATTERN`
06:25
<
f_ridge >
<x2x6_/D> Yes, but its CMD8
06:25
<
f_ridge >
<x2x6_/D> It does not assume the check for sdhc.
06:25
<
f_ridge >
<clever___/D> `#define SD_SEND_IF_COND 8 /* R7 */`
06:25
<
f_ridge >
<x2x6_/D> SDCH - is high capacity type. It should be ruled out from queriying the card's OCR
06:25
<
f_ridge >
<clever___/D> this code is a bit of a mess, i dont fully understand all of the choices the previous author did
06:26
<
f_ridge >
<GitHub Lines/D> ```cpp
06:26
<
f_ridge >
<GitHub Lines/D> /* fuck me with a rake ... gently */
06:26
<
f_ridge >
<GitHub Lines/D> ```
06:26
<
f_ridge >
<x2x6_/D> Yes, I know do the same revisiting and wonder all of those magic ifs)
06:26
<
f_ridge >
<clever___/D> i also suspect the previous author was having a lot of trouble making it work
06:34
<
f_ridge >
<clever___/D> ```
06:34
<
f_ridge >
<clever___/D> 7.047046 [EMMC:identify_card]: sending ACMD51
06:34
<
f_ridge >
<clever___/D> bool BCM2708SDHost::send_raw(uint32_t, uint32_t):131: CMD 55, arg=0
06:34
<
f_ridge >
<clever___/D> bool BCM2708SDHost::wait_and_get_response():222: Cmd: 55 Resp: ffffffff 0000ff7f dfe00290 4000eb81
06:34
<
f_ridge >
<clever___/D> 7.066022 [EMMC:wait_and_get_response]: ERROR: sdhost status: 0x40
06:34
<
f_ridge >
<clever___/D> bool BCM2708SDHost::send_raw(uint32_t, uint32_t):131: CMD 51, arg=0
06:34
<
f_ridge >
<clever___/D> bool BCM2708SDHost::wait_and_get_response():222: Cmd: 51 Resp: ffffffff 0000ff7f 7fffffff 00a40002
06:34
<
f_ridge >
<clever___/D> 7.106048 [EMMC:wait_and_get_response]: ERROR: sdhost status: 0x40
06:34
<
f_ridge >
<clever___/D> 7.130053 [EMMC:identify_card]: ACMD51 fail
06:34
<
f_ridge >
<clever___/D> ```
06:34
<
f_ridge >
<clever___/D> is CMD55 meant to fail with a timeout??
06:36
<
f_ridge >
<clever___/D> reading section 4.3.9, it sounds like `CMD55` should have a normal response, which should have the `APP_CMD` bit set
06:41
<
f_ridge >
<x2x6_/D> All right, seems ACMD41 is solved.
06:41
<
f_ridge >
<x2x6_/D> So where do you use CMD55? I don't even have it in code
06:42
<
f_ridge >
<clever___/D> CMD55 is used for all ACMD's
06:44
<
f_ridge >
<x2x6_/D> ok,
06:44
<
f_ridge >
<clever___/D> ```c
06:44
<
f_ridge >
<clever___/D> static int bcm2835_emmc_run_acmd(struct bcm2835_emmc_cmd *c,
06:44
<
f_ridge >
<clever___/D> uint64_t timeout_usec, bool mode_polling)
06:45
<
f_ridge >
<clever___/D> {
06:45
<
f_ridge >
<clever___/D> int acmd_idx;
06:45
<
f_ridge >
<clever___/D> int status;
06:45
<
f_ridge >
<clever___/D> struct bcm2835_emmc_cmd acmd;
06:45
<
f_ridge >
<clever___/D> bcm2835_emmc_cmd_init(&acmd, BCM2835_EMMC_CMD55, c->rca << 16);
06:45
<
f_ridge >
<clever___/D> ```
06:45
<
f_ridge >
<clever___/D> ah, found the 55 in your codebase
06:47
<
f_ridge >
<x2x6_/D> So it should have RCA
06:47
<
f_ridge >
<clever___/D> oh, good catch
06:48
<
f_ridge >
<x2x6_/D> and you had 0
06:48
<
f_ridge >
<clever___/D> but the pdf also says all 32 bits are stuff bits
06:48
<
f_ridge >
<clever___/D> what happens if i supply an rca anyways?
06:48
<
f_ridge >
<clever___/D> `bool BCM2708SDHost::wait_and_get_response():222: Cmd: 55 Resp: 00000720 0000377b ffffffff 02900009`
06:48
<
f_ridge >
<clever___/D> with `rca << 16`
06:48
<
f_ridge >
<clever___/D> `bool BCM2708SDHost::wait_and_get_response():222: Cmd: 55 Resp: ffffffff 0000ff7f dfe00290 4000eb81`
06:48
<
f_ridge >
<clever___/D> with `0`
06:48
<
f_ridge >
<x2x6_/D> one strange thing is that ACMD41 is actually also an ACMD and at this point RCA is not communicated yet, so it can be 0
06:48
<
f_ridge >
<clever___/D> ahh
06:48
<
f_ridge >
<x2x6_/D> RCA is relative address, that is assigned by us to the card
06:48
<
f_ridge >
<x2x6_/D> something line
06:48
<
f_ridge >
<x2x6_/D> something like(edited)
06:49
<
f_ridge >
<clever___/D> `[6357011.507402] mmc0: new ultra high speed SDR104 SDXC card at address 59b4`
06:49
<
f_ridge >
<clever___/D> yep, linux prints it when detecting a card
06:49
<
f_ridge >
<x2x6_/D> I was wrong - RCA is an output from CMD3
06:49
<
f_ridge >
<x2x6_/D> )
06:50
<
f_ridge >
<x2x6_/D> what a mess
06:50
<
f_ridge >
<clever___/D> it seems to be in place to support sharing a single CMD pin across many sd cards
06:50
<
f_ridge >
<clever___/D> and yet, you can only query it when the CMD pin is private
06:51
<
f_ridge >
<clever___/D> checking my code, i can find a `select_card()` function
06:51
<
f_ridge >
<clever___/D> that will just CMD7 with the rca
06:52
<
f_ridge >
<x2x6_/D> So CMD3 is SEND_RCA
06:52
<
f_ridge >
<x2x6_/D> CMD7 is SELECT_CARD,
06:52
<
f_ridge >
<x2x6_/D> and only after that you can acutally use CMD55
06:53
<
f_ridge >
<x2x6_/D> looks like
06:54
<
f_ridge >
<clever___/D> i think i just need to set `rca = 0` in my init code, and always send it
06:54
<
f_ridge >
<clever___/D> then there wont be any confusion on when the default of 0 is ok
06:57
<
f_ridge >
<clever___/D> ```
06:57
<
f_ridge >
<clever___/D> bool BCM2708SDHost::send_raw(uint32_t, uint32_t):131: CMD 55, arg=1504968704
06:57
<
f_ridge >
<clever___/D> bool BCM2708SDHost::wait_and_get_response():227: Cmd: 55 Resp: 00000720 0000377b ffffffff 02900009
06:57
<
f_ridge >
<clever___/D> bool BCM2708SDHost::send_raw(uint32_t, uint32_t):131: CMD 51, arg=0
06:57
<
f_ridge >
<clever___/D> bool BCM2708SDHost::wait_and_get_response():227: Cmd: 51 Resp: ffffffff 0000ff7f cdc00001 ffffffff
06:57
<
f_ridge >
<clever___/D> 4.924246 [EMMC:wait_and_get_response]: ERROR: sdhost status: 0x40
06:57
<
f_ridge >
<clever___/D> ```
06:57
<
f_ridge >
<clever___/D> the 55 is now succeeding here, but the ACMD51 still fails
06:58
<
f_ridge >
<clever___/D> however, i notice, `select_card()` i think is needed any time your going to use the DAT pins
06:59
<
f_ridge >
<clever___/D> ```
06:59
<
f_ridge >
<clever___/D> bool BCM2708SDHost::send_raw(uint32_t, uint32_t):131: CMD 51, arg=0
06:59
<
f_ridge >
<clever___/D> bool BCM2708SDHost::wait_and_get_response():227: Cmd: 51 Resp: 00000920 00003348 ffffffff 0002480c
06:59
<
f_ridge >
<clever___/D> ```
06:59
<
f_ridge >
<clever___/D> yep, bingo
07:00
<
f_ridge >
<clever___/D> ` 4.915689 [EMMC:identify_card]: done 0x87844502 0x0`
07:00
<
f_ridge >
<clever___/D> vs
07:00
<
f_ridge >
<clever___/D> `scr 0245848700000000`
07:03
<
f_ridge >
<x2x6_/D> I don't think selec card should always be used
07:03
<
f_ridge >
<clever___/D> this code just calls it later in the init sequence, and then never again
07:04
<
f_ridge >
<clever___/D> since there is no other card on the bus, the card just remains selected forever
07:04
<
f_ridge >
<clever___/D> but i was reading SCR before that point
07:04
<
f_ridge >
<clever___/D> i think i also figured out the 4bit flag
07:04
<
f_ridge >
<clever___/D> something in the init code was resetting it back to 1bit mode
07:04
<
f_ridge >
<x2x6_/D> my cards SCR is like this SCR: 87840502|32640001
07:05
<
f_ridge >
<clever___/D> by moving the ACMD6 further down, it seems to stick now, and cause major transfer errors (host still in 1bit mode)
07:05
<
f_ridge >
<clever___/D> ` 5.351208 [EMMC:real_read_block]: ERROR: transfer error on FIFO word 114: 0x21`
07:05
<
f_ridge >
<clever___/D> `#define SDHSTS_CRC16_ERROR 0x20`
07:06
<
f_ridge >
<x2x6_/D> so ACMD6 is to use 4 data lines right?
07:06
<
f_ridge >
<clever___/D> yep
07:07
<
f_ridge >
<GitHub Lines/D> ```c
07:07
<
f_ridge >
<GitHub Lines/D> #define SDHCFG_WIDE_EXT_BUS (1<<2)
07:07
<
f_ridge >
<GitHub Lines/D> #define SDHCFG_WIDE_INT_BUS (1<<1)
07:07
<
f_ridge >
<GitHub Lines/D> ```
07:07
<
f_ridge >
<x2x6_/D> then you have to set emmc control reg
07:07
<
f_ridge >
<clever___/D> i now need to set one of these, to tell the host about the change
07:07
<
f_ridge >
<x2x6_/D> yep
07:07
<
f_ridge >
<clever___/D> wide-int is always set
07:07
<
f_ridge >
<clever___/D> wide-ext is only set if in 4bit mode
07:08
<
f_ridge >
<clever___/D> my restart code specifically clears wide-ext, then sets the register with only wide-int and slow-card
07:09
<
f_ridge >
<x2x6_/D> so we need to make sure both of this is set
07:09
<
f_ridge >
<x2x6_/D> and working
07:10
<
f_ridge >
<clever___/D> ```
07:10
<
f_ridge >
<clever___/D> 55.555556 MHz, 226398 uSec to read 1MB 37.052483 mbits/sec
07:10
<
f_ridge >
<clever___/D> 50.000000 MHz, 226426 uSec to read 1MB 37.047901 mbits/sec
07:11
<
f_ridge >
<clever___/D> 45.454545 MHz, 228975 uSec to read 1MB 36.635475 mbits/sec
07:11
<
f_ridge >
<clever___/D> 41.666667 MHz, 228973 uSec to read 1MB 36.635796 mbits/sec
07:11
<
f_ridge >
<clever___/D> 38.461538 MHz, 226411 uSec to read 1MB 37.050354 mbits/sec
07:11
<
f_ridge >
<clever___/D> 33.333333 MHz, 228978 uSec to read 1MB 36.634995 mbits/sec
07:11
<
f_ridge >
<clever___/D> 31.250000 MHz, 228990 uSec to read 1MB 36.633076 mbits/sec
07:11
<
f_ridge >
<clever___/D> 29.411765 MHz, 226433 uSec to read 1MB 37.046757 mbits/sec
07:11
<
f_ridge >
<clever___/D> 27.777778 MHz, 228981 uSec to read 1MB 36.634514 mbits/sec
07:11
<
f_ridge >
<clever___/D> 26.315789 MHz, 226431 uSec to read 1MB 37.047081 mbits/sec
07:11
<
f_ridge >
<clever___/D> 25.000000 MHz, 226407 uSec to read 1MB 37.051010 mbits/sec
07:11
<
f_ridge >
<clever___/D> 22.727273 MHz, 229076 uSec to read 1MB 36.619324 mbits/sec
07:11
<
f_ridge >
<clever___/D> 21.739130 MHz, 229064 uSec to read 1MB 36.621243 mbits/sec
07:11
<
f_ridge >
<clever___/D> 20.833333 MHz, 229030 uSec to read 1MB 36.626678 mbits/sec
07:11
<
f_ridge >
<clever___/D> 20.000000 MHz, 226490 uSec to read 1MB 37.037434 mbits/sec
07:11
<
f_ridge >
<clever___/D> 19.230769 MHz, 229036 uSec to read 1MB 36.625717 mbits/sec
07:11
<
f_ridge >
<clever___/D> 18.518519 MHz, 228997 uSec to read 1MB 36.631954 mbits/sec
07:12
<
f_ridge >
<clever___/D> 17.857143 MHz, 226457 uSec to read 1MB 37.042828 mbits/sec
07:12
<
f_ridge >
<clever___/D> 17.241379 MHz, 226481 uSec to read 1MB 37.038902 mbits/sec
07:12
<
f_ridge >
<clever___/D> 16.666667 MHz, 226500 uSec to read 1MB 37.035797 mbits/sec
07:12
<
f_ridge >
<clever___/D> 16.129032 MHz, 226502 uSec to read 1MB 37.035469 mbits/sec
07:12
<
f_ridge >
<clever___/D> 15.625000 MHz, 229077 uSec to read 1MB 36.619164 mbits/sec
07:12
<
f_ridge >
<clever___/D> 15.151515 MHz, 229072 uSec to read 1MB 36.619961 mbits/sec
07:12
<
f_ridge >
<clever___/D> 14.705882 MHz, 229040 uSec to read 1MB 36.625080 mbits/sec
07:12
<
f_ridge >
<clever___/D> 14.285714 MHz, 226494 uSec to read 1MB 37.036777 mbits/sec
07:12
<
f_ridge >
<clever___/D> 13.157895 MHz, 226443 uSec to read 1MB 37.045120 mbits/sec
07:12
<
f_ridge >
<clever___/D> 12.820513 MHz, 226411 uSec to read 1MB 37.050354 mbits/sec
07:12
<
f_ridge >
<clever___/D> 12.500000 MHz, 226402 uSec to read 1MB 37.051826 mbits/sec
07:12
<
f_ridge >
<clever___/D> ```
07:12
<
f_ridge >
<clever___/D> and boom, thats lookin good!
07:12
<
f_ridge >
<clever___/D> its able to sustain 37mbit, across the entire clock range
07:12
<
f_ridge >
<clever___/D> 12mhz should give it 48mbit, so the bottleneck is now the lack of dma
07:13
<
f_ridge >
<clever___/D> ```
07:13
<
f_ridge >
<clever___/D> 55.444444 MHz, 226426 uSec to read 1MB 37.047901 mbits/sec
07:13
<
f_ridge >
<clever___/D> 49.900000 MHz, 226426 uSec to read 1MB 37.047901 mbits/sec
07:13
<
f_ridge >
<clever___/D> 45.363636 MHz, 226397 uSec to read 1MB 37.052647 mbits/sec
07:13
<
f_ridge >
<clever___/D> 41.583333 MHz, 226362 uSec to read 1MB 37.058376 mbits/sec
07:13
<
f_ridge >
<clever___/D> 38.384615 MHz, 226394 uSec to read 1MB 37.053139 mbits/sec
07:13
<
f_ridge >
<clever___/D> 35.642857 MHz, 238183 uSec to read 1MB 35.219173 mbits/sec
07:13
<
f_ridge >
<clever___/D> 33.266667 MHz, 253992 uSec to read 1MB 33.027058 mbits/sec
07:13
<
f_ridge >
<clever___/D> 31.187500 MHz, 270877 uSec to read 1MB 30.968328 mbits/sec
07:13
<
f_ridge >
<clever___/D> 29.352941 MHz, 287763 uSec to read 1MB 29.151100 mbits/sec
07:13
<
f_ridge >
<clever___/D> 27.722222 MHz, 304653 uSec to read 1MB 27.534960 mbits/sec
07:13
<
f_ridge >
<clever___/D> 26.263158 MHz, 321541 uSec to read 1MB 26.088766 mbits/sec
07:13
<
f_ridge >
<clever___/D> 24.950000 MHz, 338428 uSec to read 1MB 24.786980 mbits/sec
07:13
<
f_ridge >
<clever___/D> 23.761905 MHz, 355314 uSec to read 1MB 23.608999 mbits/sec
07:13
<
f_ridge >
<clever___/D> 22.681818 MHz, 372203 uSec to read 1MB 22.537724 mbits/sec
07:14
<
f_ridge >
<clever___/D> 21.695652 MHz, 389092 uSec to read 1MB 21.559446 mbits/sec
07:14
<
f_ridge >
<clever___/D> 20.791667 MHz, 405980 uSec to read 1MB 20.662615 mbits/sec
07:14
<
f_ridge >
<clever___/D> 19.960000 MHz, 422869 uSec to read 1MB 19.837368 mbits/sec
07:14
<
f_ridge >
<clever___/D> 19.192308 MHz, 439757 uSec to read 1MB 19.075554 mbits/sec
07:14
<
f_ridge >
<clever___/D> 18.481481 MHz, 456645 uSec to read 1MB 18.370087 mbits/sec
07:14
<
f_ridge >
<clever___/D> ```
07:14
<
f_ridge >
<clever___/D> and if i comment that out, i instead get this, 37mbit at the higher clocks, and then it drops off with clock rate
07:14
<
f_ridge >
<clever___/D> the only worrying thing, is that i randomly get crc16 errors, even as low as 7mhz
07:14
<
f_ridge >
<clever___/D> ```
07:14
<
f_ridge >
<clever___/D> 8.064516 MHz, 267580 uSec to read 1MB 31.349907 mbits/sec
07:14
<
f_ridge >
<clever___/D> 7.936508 MHz, 271887 uSec to read 1MB 30.853289 mbits/sec
07:14
<
f_ridge >
<clever___/D> 7.812500 MHz, 276191 uSec to read 1MB 30.372488 mbits/sec
07:15
<
f_ridge >
<clever___/D> 7.692308 MHz, 280495 uSec to read 1MB 29.906445 mbits/sec
07:15
<
f_ridge >
<clever___/D> 23.480640 [EMMC:real_read_block]: ERROR: transfer error on FIFO word 125: 0x21
07:15
<
f_ridge >
<clever___/D> 23.505766 [EMMC:real_read_block]: ERROR: Transfer error, status: 0x0
07:15
<
f_ridge >
<clever___/D> 7.575758 MHz, 50133 uSec to read 1MB 167.327072 mbits/sec
07:15
<
f_ridge >
<clever___/D> 7.462687 MHz, 289104 uSec to read 1MB 29.015884 mbits/sec
07:15
<
f_ridge >
<clever___/D> 7.352941 MHz, 293410 uSec to read 1MB 28.590055 mbits/sec
07:15
<
f_ridge >
<clever___/D> 7.246377 MHz, 297714 uSec to read 1MB 28.176733 mbits/sec
07:15
<
f_ridge >
<clever___/D> 24.500437 [EMMC:real_read_block]: ERROR: transfer error on FIFO word 126: 0x21
07:15
<
f_ridge >
<clever___/D> 24.525567 [EMMC:real_read_block]: ERROR: Transfer error, status: 0x0
07:15
<
f_ridge >
<clever___/D> 7.142857 MHz, 50147 uSec to read 1MB 167.280350 mbits/sec
07:15
<
f_ridge >
<clever___/D> ```
07:16
<
f_ridge >
<x2x6_/D> Nice!
07:17
<
f_ridge >
<x2x6_/D> I mean nice that you have fast reads
07:17
<
f_ridge >
<x2x6_/D> but CRC errors are daunting of course. strange
07:18
<
f_ridge >
<clever___/D> at least this time, i can detect them and retry
07:21
<
f_ridge >
<clever___/D> just pure 36mbit, all the way down to ~9mhz!
07:22
<
f_ridge >
<clever___/D> i should get some sleep now, its 4:22 am!
09:40
Stromeko has quit [Quit: Going… gone.]
09:44
Stromeko has joined ##raspberrypi-internals
11:43
<
f_ridge >
<x2x6_/D> In the meantime I have brushed my SCR handling code a little bit, to understand that I did not set CONTROL0 HIGH_SPEED enable bit. It was never tunred on
11:44
<
f_ridge >
<x2x6_/D> And now when I turn in on, my next CMDs fail. Probably I need to enable high speed on the SD card some how
11:47
<
f_ridge >
<x2x6_/D> In your code I dont see it either
12:11
ungeskriptet has joined ##raspberrypi-internals
12:17
jcea has joined ##raspberrypi-internals
14:02
jcea has quit [Ping timeout: 240 seconds]
16:51
Ad0 has quit [Ping timeout: 252 seconds]
16:57
Ad0 has joined ##raspberrypi-internals
17:11
<
f_ridge >
<clever___/D> oh, i can see how getting that wrong would really screw over the comms
17:12
<
f_ridge >
<clever___/D> but i also cant see any sign of that existing in sdhost, so how does that work?
18:05
<
f_ridge >
<x2x6_/D> I thought you told you have this bit set in your code.
18:07
<
f_ridge >
<x2x6_/D> From which document is this screenshot?
18:17
<
f_ridge >
<clever___/D> page 61
18:19
<
f_ridge >
<clever___/D> the issue, is that i'm not using the emmc/sdhci controller, but sdhost, and i dont see a matching value in the linux driver
18:20
<
f_ridge >
<x2x6_/D> What capabilities register are they talking about?
18:20
<
f_ridge >
<x2x6_/D> Ok
18:21
<
f_ridge >
<clever___/D> page 103
18:22
<
f_ridge >
<clever___/D> and make sure you go by the number on the page itself, not what the pdf reader claims
18:23
<
f_ridge >
<x2x6_/D> In the doc you have found this register is on offset 0x40
18:23
<
f_ridge >
<x2x6_/D> In bcm2835 doc there is a gap
18:24
<
f_ridge >
<x2x6_/D> I'll check what's there
18:25
<
f_ridge >
<clever___/D> i think the main point of the capabilities register, is for a universal sdhci driver to discover what the hw can do on its own
18:25
<
f_ridge >
<clever___/D> but the bcm2835 pdf, is explaining the hardware to you, so you can just write the driver to match the pdf
18:26
<
f_ridge >
<clever___/D> and then your driver will malfunction if you ever try it on another device, lol
18:28
<
f_ridge >
<x2x6_/D> Actually all capability register values are 0
18:29
<
f_ridge >
<clever___/D> thats strange
18:31
<
f_ridge >
<x2x6_/D> I though in that post these values are some how renamed values for CONTROL0 register and that BUS WIDTH and HIGH_SPEED bit is what you are talking about. So your CONTROL0 HIGH_SPEED bit was not set?
18:32
<
f_ridge >
<clever___/D> those values are from sdhost, which has a radically different interface
18:32
<
f_ridge >
<x2x6_/D> But today you tuned SDHCI right?
18:32
<
f_ridge >
<clever___/D> nope, i got sdhost into 4bit mode
18:33
<
f_ridge >
<x2x6_/D> So it also knows how to pass those CMDx commands?
18:33
<
f_ridge >
<clever___/D> yep
18:33
<
f_ridge >
<x2x6_/D> I mean sdhost
18:33
<
f_ridge >
<x2x6_/D> Ok, understood
18:34
<
f_ridge >
<x2x6_/D> So, without this HS I am on 25MHz
18:34
<
f_ridge >
<x2x6_/D> So, without this HS bit I am on 25MHz(edited)
18:34
<
f_ridge >
<clever___/D> but 25mhz 4bit sdr, is still 100mbit, or 12.5 mbyte/sec
18:34
<
f_ridge >
<clever___/D> and how does that compare to what the h264 encoder generates?
18:37
<
f_ridge >
<x2x6_/D> I am currently revising the driver to understand what is the maximum possible output.
18:37
<
f_ridge >
<x2x6_/D> I still not sure what is sdr
18:38
<
f_ridge >
<clever___/D> sdr is sending one symbol per clock, in this case, 4 bits per clock cycle
18:38
<
f_ridge >
<clever___/D> ddr is sending 2 symbols per clock, on the rising and faling edge
18:38
<
f_ridge >
<clever___/D> so 4bit ddr can move 8 bits per clock cycle
18:39
<
f_ridge >
<x2x6_/D> I kind of know that for sdcard there is 3.3 volt regimes that are Default mode (25MHz) and High speed (50Mhz) , others are 1.8v
18:39
<
f_ridge >
<x2x6_/D> So on raspberry pi we are limited with 3.3v regimets, so these are Default speed mode and High speed mode. Isn't that so?
18:41
<
f_ridge >
<x2x6_/D> By the way, i really think if setting sw driver art aside, it's possible to solder in 1.8v circuitry to the SDcard Vdd pin)
18:41
<
f_ridge >
<x2x6_/D> By the way, i really think if setting sw driver part aside, it's possible to solder in 1.8v circuitry to the SDcard Vdd pin)(edited)
18:41
<
f_ridge >
<clever___/D> i think it needs 3.3v vdd, and 1.8v IO
18:41
<
f_ridge >
<clever___/D> which is more complicated to do
18:42
<
f_ridge >
<x2x6_/D> Hmm, yes, maybe some level shifter could join the party)
18:43
<
f_ridge >
<x2x6_/D> Anyways, do you agree that SDR is not an option for raspberry or I am reading the wrong place?)
18:43
<
f_ridge >
<clever___/D> the pi0-pi3 is SDR only
18:43
<
f_ridge >
<x2x6_/D> But also, I would like for normal people to be able to just buy raspberry and use my soft without having to go through soldering)
18:44
<
f_ridge >
<x2x6_/D> But how?) They don't support 1.8v
18:44
<
f_ridge >
<x2x6_/D> where is it written?
18:45
<
f_ridge >
<clever___/D> are you able to boot the pi normally?
18:45
<
f_ridge >
<clever___/D> into linux
18:46
<
f_ridge >
<x2x6_/D> Not immediately , I have corrupted both of my sdcards with my soft)
18:46
<
f_ridge >
<clever___/D> let me boot my pi2w
18:48
<
f_ridge >
<x2x6_/D> All info I have show more or less the same thing
18:48
<
f_ridge >
<x2x6_/D> sdr/ddr are 1.8
18:49
<
f_ridge >
<clever___/D> ```
18:49
<
f_ridge >
<clever___/D> root@raspberrypi:~# cat /sys/kernel/debug/mmc0/ios
18:49
<
f_ridge >
<clever___/D> clock: 50000000 Hz
18:49
<
f_ridge >
<clever___/D> actual clock: 50000000 Hz
18:49
<
f_ridge >
<clever___/D> vdd: 21 (3.3 ~ 3.4 V)
18:49
<
f_ridge >
<clever___/D> bus mode: 2 (push-pull)
18:49
<
f_ridge >
<clever___/D> chip select: 0 (don't care)
18:49
<
f_ridge >
<clever___/D> power mode: 2 (on)
18:49
<
f_ridge >
<clever___/D> bus width: 2 (4 bits)
18:49
<
f_ridge >
<clever___/D> timing spec: 2 (sd high-speed)
18:50
<
f_ridge >
<clever___/D> signal voltage: 0 (3.30 V)
18:50
<
f_ridge >
<clever___/D> driver type: 0 (driver type B)
18:50
<
f_ridge >
<clever___/D> root@raspberrypi:~# cat /sys/kernel/debug/mmc1/ios
18:50
<
f_ridge >
<clever___/D> clock: 50000000 Hz
18:50
<
f_ridge >
<clever___/D> actual clock: 50000000 Hz
18:50
<
f_ridge >
<clever___/D> vdd: 21 (3.3 ~ 3.4 V)
18:50
<
f_ridge >
<clever___/D> bus mode: 2 (push-pull)
18:50
<
f_ridge >
<clever___/D> chip select: 0 (don't care)
18:50
<
f_ridge >
<clever___/D> power mode: 2 (on)
18:50
<
f_ridge >
<clever___/D> bus width: 2 (4 bits)
18:50
<
f_ridge >
<clever___/D> timing spec: 2 (sd high-speed)
18:50
<
f_ridge >
<clever___/D> signal voltage: 0 (3.30 V)
18:50
<
f_ridge >
<clever___/D> driver type: 0 (driver type B)
18:50
<
f_ridge >
<clever___/D> root@raspberrypi:~# ```
18:50
<
f_ridge >
<clever___/D> one of these is sdhost, the other is sdhci
18:51
<
f_ridge >
<clever___/D> one handles the SD card, the other wifi
18:51
<
f_ridge >
<clever___/D> they are both supplying 3.3v on vdd, and using 3.3v IO, at 50mhz, 4bit, SDR
18:51
<
f_ridge >
<clever___/D> so that seems to imply that 3.3v 50mhz works fine?
18:51
<
f_ridge >
<x2x6_/D> Yes, but probably not in SDR but in HIGH SPEED. Where do you see SDR?)
18:51
<
f_ridge >
<x2x6_/D> timing spec: 2 (sd high-speed)
18:51
<
f_ridge >
<x2x6_/D> So I somehow need to make HS bit working in CONTROL0
18:57
<
f_ridge >
<GitHub Lines/D> ```c
18:57
<
f_ridge >
<GitHub Lines/D> if (ios->timing == MMC_TIMING_SD_HS ||
18:57
<
f_ridge >
<GitHub Lines/D> ios->timing == MMC_TIMING_MMC_HS ||
18:57
<
f_ridge >
<GitHub Lines/D> ios->timing == MMC_TIMING_MMC_HS400 ||
18:57
<
f_ridge >
<GitHub Lines/D> ios->timing == MMC_TIMING_MMC_HS200 ||
18:57
<
f_ridge >
<GitHub Lines/D> ios->timing == MMC_TIMING_MMC_DDR52 ||
18:57
<
f_ridge >
<GitHub Lines/D> ios->timing == MMC_TIMING_UHS_SDR50 ||
18:57
<
f_ridge >
<GitHub Lines/D> ios->timing == MMC_TIMING_UHS_SDR104 ||
18:57
<
f_ridge >
<GitHub Lines/D> ios->timing == MMC_TIMING_UHS_DDR50 ||
18:58
<
f_ridge >
<GitHub Lines/D> ios->timing == MMC_TIMING_UHS_SDR25)
18:58
<
f_ridge >
<GitHub Lines/D> ctrl |= SDHCI_CTRL_HISPD;
18:58
<
f_ridge >
<GitHub Lines/D> else
18:58
<
f_ridge >
<GitHub Lines/D> ctrl &= ~SDHCI_CTRL_HISPD;
18:58
<
f_ridge >
<GitHub Lines/D> ```
18:58
<
f_ridge >
<clever___/D> if the SD driver core asks for one of those timing modes, the sdhci driver will enable high speed mode
18:59
<
f_ridge >
<x2x6_/D> All right!
19:00
<
f_ridge >
<GitHub Lines/D> ```c
19:00
<
f_ridge >
<GitHub Lines/D> /*
19:00
<
f_ridge >
<GitHub Lines/D> * Select timing parameters for host.
19:00
<
f_ridge >
<GitHub Lines/D> */
19:00
<
f_ridge >
<GitHub Lines/D> void mmc_set_timing(struct mmc_host *host, unsigned int timing)
19:00
<
f_ridge >
<GitHub Lines/D> {
19:00
<
f_ridge >
<GitHub Lines/D> host->ios.timing = timing;
19:00
<
f_ridge >
<GitHub Lines/D> mmc_set_ios(host);
19:00
<
f_ridge >
<GitHub Lines/D> }
19:00
<
f_ridge >
<GitHub Lines/D> ```
19:00
<
f_ridge >
<clever___/D> this can set that timing flag
19:19
<
f_ridge >
<x2x6_/D> I am completely lost with this kernel code and what I see in registers when I run pi.
19:19
<
f_ridge >
<x2x6_/D> So in kernel there is a small branching based on the preset value.
19:19
<
f_ridge >
<x2x6_/D> Preset value bit is taken from CONTROL2 register. This whole register is read as 0 in my case, along with all capabilities. Then after high speed is set, they disable clock and set some timings. This maps to setting UHSMODE field in control2 register. But it does not have HIGH SPEED, only SDR12,25,50,etc, as discussed SDR's are all 1.8
19:19
<
f_ridge >
<x2x6_/D> It does not make sense for me)
19:20
<
f_ridge >
<x2x6_/D> If i disable clock during setting CONTROL0 to HS, then enable back i still get corrupted behavior.
19:20
<
f_ridge >
<x2x6_/D> probably I don't understand what SDR is. Have to read more
20:37
Stromeko has quit [Quit: Going… gone.]
20:38
Stromeko has joined ##raspberrypi-internals
20:55
<
f_ridge >
<x2x6_/D> Ok, thanks, SDR is having two data bits in one pulse - on risign and falling edges but...
20:55
<
f_ridge >
<x2x6_/D> this is still not relevant. Looking at this screenshot HS bit description does not mention switch to SDR. it tells that instead of falling edge , rising edge will be the point of putting new bit
20:55
<
f_ridge >
<clever___/D> other way around, DDR is 2 bits per pulse
20:55
<
f_ridge >
<clever___/D> the first d stands for double
20:56
<
f_ridge >
<x2x6_/D> These are the only settings for UHS mode in CONTROL2 register.
20:58
<
f_ridge >
<x2x6_/D> aa
20:59
<
f_ridge >
<x2x6_/D> , ok so sdr is single and probably SDR50 now will be the right value
21:02
<
f_ridge >
<clever___/D> yep
21:02
<
f_ridge >
<clever___/D> as far as i know, sdr50 is the best the pi0-pi3 range can do, and sdr50 is what ive gotten sdhost to do
21:03
<
f_ridge >
<clever___/D> the pi4 can do ddr50, giving you twice the data rate
21:04
<
f_ridge >
<clever___/D> let me cross reference the bcm2835 and sd pdf's
21:04
<
f_ridge >
<clever___/D> UHSMODE is bits 16-18 of CONTROL2, which also contains TUNED and TUNEON, that may be important
21:04
<
f_ridge >
<clever___/D> CONTROL2 is at offset 3c
21:06
<
f_ridge >
<clever___/D> the sdhci doc calls that `2.2.24 Auto CMD Error Status Register (Cat.A Offset 03Ch)`
21:07
<
f_ridge >
<clever___/D> which doesnt match up at all
21:56
<
f_ridge >
<clever___/D> ```
21:56
<
f_ridge >
<clever___/D> #define SDHCI_AUTO_CMD_STATUS 0x3C
21:57
<
f_ridge >
<clever___/D> #define SDHCI_HOST_CONTROL2 0x3E
21:57
<
f_ridge >
<clever___/D> ```
21:57
<
f_ridge >
<clever___/D> ah, linux is treating it as 2 x 16bit
21:57
<
f_ridge >
<clever___/D> but bcm2835.pdf is treating it as 1 x 32bit
21:57
<
f_ridge >
<clever___/D> UHSMODE lands within control2 at 3e
21:57
<
f_ridge >
<clever___/D> which sdhci calls `Host Control 2`
21:58
<
f_ridge >
<clever___/D> `2.2.25 Host Control 2 Register (Cat.C Offset 03Eh)`
21:58
<
f_ridge >
<clever___/D> here is the sdhci version of the UHSMODE you posted
22:07
<
f_ridge >
<clever___/D> @x2x6_ this implies that you must trigger the tuning procedure before going up to SDR50 speeds
22:14
<
f_ridge >
<GitHub Lines/D> ```c
22:14
<
f_ridge >
<GitHub Lines/D> * The Host Controller needs tuning in case of SDR104 and DDR50
22:14
<
f_ridge >
<GitHub Lines/D> * mode, and for SDR50 mode when Use Tuning for SDR50 is set in
22:14
<
f_ridge >
<GitHub Lines/D> * the Capabilities register.
22:14
<
f_ridge >
<GitHub Lines/D> * If the Host Controller supports the HS200 mode then the
22:14
<
f_ridge >
<GitHub Lines/D> * tuning function has to be executed.
22:14
<
f_ridge >
<GitHub Lines/D> ```