f_ changed the topic of ##raspberrypi-internals to: The inner workings of the Raspberry Pi (Low level VPU/HW) -- for general queries please visit #raspberrypi -- open firmware: https://librerpi.github.io/ -- VC4 VPU Programmers Manual: https://github.com/hermanhermitage/videocoreiv/wiki -- chat logs: https://libera.irclog.whitequark.org/~h~raspberrypi-internals -- bridged to matrix and discord
<f_ridge> <c​lever___/D> after studying linux and the pdf for a few hours, i figured out how to make sense of page 81 and table 4-11`
Ad0 has quit [Ping timeout: 252 seconds]
Ad0 has joined ##raspberrypi-internals
jcea has quit [Ping timeout: 240 seconds]
srk has joined ##raspberrypi-internals
<f_ridge> <c​lever___/D> got CMD6 query working
<f_ridge> <c​lever___/D> ```
<f_ridge> <c​lever___/D> bool BCM2708SDHost::send_raw(uint32_t, uint32_t):135: CMD 6, arg=0xfffff0
<f_ridge> <c​lever___/D> bool BCM2708SDHost::wait_and_get_response():276: Cmd: 6 Resp: 00000900 0000066e ffffffff ffffffff 0x01806400 0x01800180 0x01800180 0x00000380 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0xc01edc78 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0xc01edc78 0x00000001 0x00090000 0
<f_ridge> <c​lever___/D> ```
<f_ridge> <c​lever___/D> ```
<f_ridge> <c​lever___/D> bool BCM2708SDHost::send_raw(uint32_t, uint32_t):135: CMD 6, arg=0xfffff0
<f_ridge> <c​lever___/D> bool BCM2708SDHost::wait_and_get_response():276: Cmd: 6 Resp: 00000900 0000066e ffffffff ffffffff
<f_ridge> <c​lever___/D> 0x01806400 0x01800180 0x01800180 0x00000380 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0xc01edc78 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0xc01edc78 0x00000001 0x00090000 0xc0103418 0x8000858e 0xc010341c 0xc01edc78 0xc0103428 0x8000863e 0x00000000 0xc01edc78 0xc010343c
<f_ridge> <c​lever___/D> ```(edited)
<f_ridge> <c​lever___/D> a CMD6 query, and the 512 byte reply
<f_ridge> <c​lever___/D> ah, printed beyond the end of the buffer, oops
<f_ridge> <c​lever___/D> ```
<f_ridge> <c​lever___/D> bool BCM2708SDHost::send_raw(uint32_t, uint32_t):135: CMD 6, arg=0xfffff0
<f_ridge> <c​lever___/D> bool BCM2708SDHost::wait_and_get_response():276: Cmd: 6 Resp: 00000900 0000066e ffffffff ffffffff
<f_ridge> <c​lever___/D> 0x01806400 0x01800180 0x01800180 0x00000380 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
<f_ridge> <c​lever___/D> ```(edited)
<f_ridge> <c​lever___/D> `0x00648001 0x80018001 0x80018001 0x80030000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 `
<f_ridge> <c​lever___/D> and with some byte swaps applies, it now makes sense
<f_ridge> <c​lever___/D> the card requires 100mA, and supports functions 0 and 15 in groups 2-6
<f_ridge> <c​lever___/D> in group 1, it supports functions 0/1/15, which is default and high speed
NightMonkey has quit [Ping timeout: 256 seconds]
<f_ridge> <c​lever___/D> and if i select high-speed mode, it asks for 200mA
NightMonkey has joined ##raspberrypi-internals
<f_ridge> <x​2x6_/D> Hmm, you used argument 0xffffff0
<f_ridge> <x​2x6_/D> in spec it said for check regime it should be bit 31 set as 0. And I thought everything else should be default
<f_ridge> <x​2x6_/D> How did you guess to use all 0xffs?
<f_ridge> <x​2x6_/D> And in which part of code you do that query?
<f_ridge> <x​2x6_/D> I tried your argument. Definitely not enouh
<f_ridge> <x​2x6_/D> I tried your argument. Definitely not enouhg(edited)
<f_ridge> <c​lever___/D> bit 31 being set, is a request to change the functions in each group
<f_ridge> <c​lever___/D> nibbles 0 thru 5 (bits 0-3, 4-7, ...) are function groups, each one can be set to a different function
<f_ridge> <c​lever___/D> so if you want to switch into high-speed mode, bits 0:3 must contain a `1`
<f_ridge> <c​lever___/D> putting an `f` in all of the others, is a request to not modified those groups
<f_ridge> <c​lever___/D> having bit 31 clear, is a query to see if the card supports that, and how many mA the card will draw
<f_ridge> <c​lever___/D> and bit 31 being set, is a request to actually change to that mode
<f_ridge> <x​2x6_/D> That means you don't run in CMD6 in check mode to test if arguments will be supported?
<f_ridge> <c​lever___/D> i ran it with bit 31 clear at first, but function group 1 set to 0 (a typo really), and it returned 512 bits of status data
<f_ridge> <G​itHub Lines/D> ```c
<f_ridge> <G​itHub Lines/D> err = bcm2835_emmc_cmd6(CMD6_MODE_CHECK,
<f_ridge> <G​itHub Lines/D> ```
<f_ridge> <x​2x6_/D> any idea why id does not work in my case? My code see a bunch of errors in the interrupts as soon as cmd is written to emmc register and can not get response
<f_ridge> <c​lever___/D> ~3 things ive noticed for cmd6
<f_ridge> <x​2x6_/D> I have just pushed to the tree, but there I just tried to override argument with your value - this does not work.
<f_ridge> <c​lever___/D> 1: it returns an R1 response (32bits of data)
<f_ridge> <c​lever___/D> 2: it returns 512 bits of data on the DAT pins (treat it like a 64 byte block read)
<f_ridge> <c​lever___/D> 3: the card must be selected (CMD7 i think it was?)
<f_ridge> <x​2x6_/D> its all there
<f_ridge> <c​lever___/D> are you getting any response?
Lightsword has quit [Quit: ZNC]
Lightsword has joined ##raspberrypi-internals
<f_ridge> <c​lever___/D> ```c
<f_ridge> <c​lever___/D> bool sd_switch(int mode, int group, int value, uint32_t *resp) {
<f_ridge> <c​lever___/D> LTRACEF("(%d, %d, %d, %p)\n", mode, group, value, resp);
<f_ridge> <c​lever___/D> uint32_t arg = (!!mode) << 31 | 0xffffff;
<f_ridge> <c​lever___/D> arg &= ~(0xF << (group * 4));
<f_ridge> <c​lever___/D> arg |= (value & 0xF) << (group * 4);
<f_ridge> <c​lever___/D> *REG32(SH_HBCT) = 64;
<f_ridge> <c​lever___/D> *REG32(SH_HBLC) = 1;
<f_ridge> <c​lever___/D> send_raw(SD_SEND_SWITCH_FUNC | SH_CMD_READ_CMD_SET, arg);
<f_ridge> <c​lever___/D> if (wait_and_get_response()) {
<f_ridge> <c​lever___/D> return read_data(resp, 64);
<f_ridge> <c​lever___/D> } else {
<f_ridge> <c​lever___/D> logf("CMD6 fail\n");
<f_ridge> <c​lever___/D> return false;
<f_ridge> <c​lever___/D> }
<f_ridge> <c​lever___/D> }
<f_ridge> <c​lever___/D> uint32_t switch_reply[64/4];
<f_ridge> <c​lever___/D> sd_switch(0, 0, 0, switch_reply);
<f_ridge> <c​lever___/D> for (unsigned int i=0; i<(64/4); i++) {
<f_ridge> <c​lever___/D> printf("0x%08x ", htonl(switch_reply[i]));
<f_ridge> <c​lever___/D> }
<f_ridge> <c​lever___/D> puts("");
<f_ridge> <c​lever___/D> sd_switch(1, 0, 1, switch_reply);
<f_ridge> <c​lever___/D> for (unsigned int i=0; i<(64/4); i++) {
<f_ridge> <c​lever___/D> printf("0x%08x ", htonl(switch_reply[i]));
<f_ridge> <c​lever___/D> }
<f_ridge> <c​lever___/D> puts("");
<f_ridge> <c​lever___/D> ```
<f_ridge> <c​lever___/D> this will first query things, then switch them
<f_ridge> <c​lever___/D> but its not entirely according to spec, its asking for the support of one thing, then using something else entirely
<f_ridge> <c​lever___/D> and you should ideally check the reply, and see what it supports
<f_ridge> <c​lever___/D> i'm heading off to bed
Herc has quit [Read error: Connection reset by peer]
HerculeP has joined ##raspberrypi-internals
Roy_Mustang has joined ##raspberrypi-internals
Lightsword_ has joined ##raspberrypi-internals
srk- has joined ##raspberrypi-internals
t0mm13b_ has joined ##raspberrypi-internals
Lightsword has quit [*.net *.split]
srk has quit [*.net *.split]
t0mm13b has quit [*.net *.split]
A_Dragon has quit [*.net *.split]
NeddySeagoon has quit [*.net *.split]
mithro has quit [*.net *.split]
gruetzkopf has quit [*.net *.split]
Lightsword_ is now known as Lightsword
srk- is now known as srk
gruetzkopf has joined ##raspberrypi-internals
NeddySeagoon has joined ##raspberrypi-internals
mithro has joined ##raspberrypi-internals
Roy_Mustang is now known as A_Dragon
jcea has joined ##raspberrypi-internals
NeddySeagoon has quit [*.net *.split]
mithro has quit [*.net *.split]
gruetzkopf has quit [*.net *.split]
mithro has joined ##raspberrypi-internals
NeddySeagoon has joined ##raspberrypi-internals
gruetzkopf has joined ##raspberrypi-internals
Stromeko has quit [Quit: Going… gone.]
Stromeko has joined ##raspberrypi-internals
dolphinana has joined ##raspberrypi-internals
juri_ has quit [Ping timeout: 252 seconds]
juri_ has joined ##raspberrypi-internals
clever has quit [Ping timeout: 240 seconds]
clever has joined ##raspberrypi-internals
dolphinana has quit [Quit: Leaving]