*** tpb has joined #litex | 00:00 | |
*** rohitksingh has quit IRC | 00:08 | |
*** rohitksingh has joined #litex | 00:21 | |
scanakci | I will try rocket as a first step with ethernet interface to make sure that the issue is not related to BlackParrot. I will also try another switch I guess. | 00:30 |
---|---|---|
scanakci | @daveshah: thanks. will keep in my mind | 00:30 |
*** rohitksingh has quit IRC | 01:10 | |
*** rohitksingh has joined #litex | 01:15 | |
somlo | _florent_: as of right now, litex commit 4d761e1a and liteeth master (466223e) both boots linux (incl. the liteeth driver) *and* is able to use the interface from within linux (ifconfig, wget, etc.) | 01:27 |
somlo | that's litex before the new soc commits | 01:27 |
somlo | I'll try the "leaky" bisect thing on litex again, to try and narrow it down further | 01:28 |
somlo | but at least we know it's not liteeth (anymore) :) | 01:28 |
somlo | scanakci: if you do try rocket to test your ethernet functionality right now, I recommend litex up to 4d761e1a, until the dust settles a bit more :) | 01:30 |
*** rohitksingh has quit IRC | 02:16 | |
*** CarlFK has joined #litex | 04:17 | |
*** _whitelogger has quit IRC | 04:43 | |
*** _whitelogger has joined #litex | 04:46 | |
*** rohitksingh has joined #litex | 04:49 | |
*** rohitksingh has quit IRC | 04:59 | |
*** tumbleweed_ has joined #litex | 05:07 | |
*** tumbleweed has quit IRC | 05:08 | |
*** rohitksingh has joined #litex | 05:33 | |
*** CarlFK has quit IRC | 06:30 | |
*** CarlFK has joined #litex | 07:17 | |
*** rohitksingh has quit IRC | 08:51 | |
levi | Re: ethernet autonegotiation and auto-crossover support: This is often something configurable in the phy, and often both by pin-strapping and MDIO registers. The designers of the board I'm using for some reason just didn't bother with a useful pin-strap config so the phy comes out of reset in 10Base-T half-duplex mode. I had to add code to the drivers in the bios and firmware code to set the mdio registers back to | 09:27 |
levi | reasonable values. | 09:27 |
levi | Dumping the mdio registers is at least a good source of diagnostic info for what the phy thinks is going on. | 09:28 |
*** tnt has left #litex | 09:29 | |
*** bunnie[m] has joined #litex | 09:34 | |
*** nrossi has joined #litex | 10:16 | |
*** xobs has joined #litex | 10:16 | |
*** sajattack[m] has joined #litex | 10:16 | |
_florent_ | somlo: i just built rocket on arty with ethernet and netboot is working fine here. I'm wondering if your issue could be related to the fact that CSR location have moved and you have not updated the csr.h for Linux or are not using a .dts file? If you want to use fixed CSR Locations, it's possible but you have to specify it in the SoC | 15:22 |
somlo | _florent_ netboot is working perfectly for me as well. It is the linux driver that's failing: the last "working" commit is 3921b63, the first "bad" one is right after, 379d47a | 15:56 |
somlo | I'd expect to see different values in csr.csv before I'd have to update my dts, but that's not the case | 15:56 |
somlo | _florent_: is netboot in the bios using irq, or is it polling? | 15:57 |
somlo | _florent_: for the record, during bisect I had to manually fix things like alignment, importing litedram native2axi, and cpu reset address :) | 15:59 |
somlo | but aside from all of that, once the bios.bin blob is downloaded over tftp and Linux boots all the way into busybox, when I "ifconfig" my eth0 and attempt to use it from Linux, it either works, or fails with "liteeth 12003800.mac eth0: LITEETH_READER_READY timed out" | 16:00 |
somlo | commit 379d47a8 looks pretty innocuous to me, but I'm much less familiar with the code than you, so I'll have to study it in more detail to see why it would impact Ethernet, of all things | 16:02 |
somlo | unless it's another one of those "git bisect is really not your friend in this context" issues I've kept bumping into over the last week :D | 16:03 |
somlo | _florent_: it *may* well turn out that we need to update the linux liteeth driver in some way to fit the new gateware behavior, or not... That is the question :) | 16:06 |
somlo | so I'm building the latest master (18a9d4ff) with blindly reverted 379d47a on top, to see what happens | 16:22 |
somlo | if that "fixes" the issue I'm having, only *then* will I attempt to engage higher brain functions and figure out *why* :) | 16:23 |
somlo | (might as well make sure I'm on the right track before I potentially overheat my neurons...) | 16:24 |
*** rohitksingh has joined #litex | 16:41 | |
somlo | _florent_: ok, reverting 379d47a (on top of latest master) *does* fix my issue | 16:53 |
somlo | so I'll try zooming in on how it might subtly affect Ethernet (and what else, if anything), soon as i get back from lunch :) | 16:54 |
_florent_ | somlo: i'm going to look too | 16:59 |
sajattack[m] | _florent_: can you look at my vga too? | 17:05 |
sajattack[m] | https://termbin.com/zu1u7 | 17:05 |
*** rohitksingh has quit IRC | 17:06 | |
sajattack[m] | I'll put up my modifications to litevideo as well | 17:06 |
*** rohitksingh has joined #litex | 17:08 | |
scanakci | thanks @somlo. I just tried netboot on Rocket with an older commit than 4d761e1a. No luck. At least, the problem is not directly related to Blackparrot for now :). Looks like a network configuration issue. | 17:08 |
_florent_ | sajattack[m]: i can look yes, have you been able to do some test doing the dma initialization in the firmware instead of the using the linux driver? doing it in the firmware should make things easier to understand/debug | 17:09 |
sajattack[m] | I looked at it briefly but didn't test it, no | 17:11 |
sajattack[m] | https://github.com/sajattack/litevideo/tree/de10nano | 17:12 |
tpb | Title: GitHub - sajattack/litevideo at de10nano (at github.com) | 17:12 |
sajattack[m] | I thought you had asked me to look if any of that was specific to 7-series, didn't realize you wanted me to try it | 17:14 |
sajattack[m] | https://github.com/sajattack/linux-on-litex-vexriscv/tree/vga | 17:21 |
tpb | Title: GitHub - sajattack/linux-on-litex-vexriscv at vga (at github.com) | 17:21 |
*** rohitksingh has quit IRC | 17:22 | |
*** rohitksingh has joined #litex | 17:24 | |
sajattack[m] | obviously very WIP code, I'll clean it up when it's working and ready for PR | 17:29 |
_florent_ | the best would indeed probably to integrate the initialization code to the firmware, then try to see if the DMA is outputing data (looking at valid signal or hsync/sync for example with a scope if you have one) | 17:30 |
sajattack[m] | so bring back emulator/framebuffer.c and associated code? | 17:32 |
*** rohitksingh has quit IRC | 17:42 | |
sajattack[m] | I guess just `git revert 9a9f01baf9fa29cfa36d7e0ff0b8cfa2b60a3926` | 17:45 |
_florent_ | yes the commit just before the video initialization moved to the linux driver | 17:50 |
* sajattack[m] sent a long message: < https://matrix.org/_matrix/media/r0/download/matrix.org/qnqlIFSIAbSBuYZhcJwKWiiw > | 18:02 | |
_florent_ | sajattack[m]: yes that's the 7-series specific part that you can remove | 18:08 |
_florent_ | it's here to configure the clocking | 18:09 |
sajattack[m] | ok | 18:09 |
_florent_ | but in your case, the pixel clock is fixed and generated by the main PLL | 18:09 |
sajattack[m] | got it | 18:10 |
scanakci | tftp worked one time with Rocket :). I could copy a fake boot.bin to DRAM. For a reason, I cant make it work again. It is not failing, just stuck at "fetching from: UDP/69". Getting closer I guess. | 18:15 |
sajattack[m] | linux gets stuck at the same spot, do I have to change something in the linux? | 18:27 |
sajattack[m] | interesting, my tv is switching between "invalid format" and "no signal" now | 18:27 |
_florent_ | sajattack[m]: yes for now no need to boot linux | 18:29 |
_florent_ | just try to get a signal on your tv with the code from the firmware | 18:29 |
sajattack[m] | ok | 18:29 |
_florent_ | when it will be working, you should see some random data from the DRAM | 18:30 |
sajattack[m] | maybe it should be hsync_n not hsync? on mister it's called hsync but maybe it's secretly inverted | 18:30 |
_florent_ | but these random datas should be stable on your screen | 18:30 |
_florent_ | once you have that, you can start modifying the firmware to write some data to the DRAM and see if you see these changes on the screen | 18:31 |
sajattack[m] | ok thanks | 18:33 |
*** rohitksingh has joined #litex | 18:40 | |
_florent_ | somlo: just looked at 379d47a, and that's the commit that modify the CSR mapping since SDRAM is now dynamically allocated: | 18:44 |
_florent_ | https://www.irccloud.com/pastebin/kYcscEYE/ | 18:44 |
tpb | Title: Snippet | IRCCloud (at www.irccloud.com) | 18:44 |
_florent_ | so you CSR mapping different from the previous one and this probably explains why it's working in the BIOS but not with the Linux Driver | 18:47 |
somlo | _florent_: hmmm, and now the csr.csv files are drastically different from each other as well... Guess I *do* have to modify the dts after all | 18:47 |
somlo | I thought I diffed them against each other and they were the same, but then again, the last week or so is a blur :) | 18:48 |
_florent_ | yes, you need to fix the CSR locations on the gateware, use modify the .dts | 18:48 |
_florent_ | if you want to fix things in the gateware, you can do something like that in your SoC: | 18:48 |
_florent_ | https://www.irccloud.com/pastebin/5eA2KtFH/ | 18:48 |
tpb | Title: Snippet | IRCCloud (at www.irccloud.com) | 18:48 |
_florent_ | and during the SoC elaboration, you should see there locations are reserved in the initial SoC report | 18:49 |
somlo | are they likely to bounce around a lot (in which case it might be worth fixing them)? | 18:49 |
somlo | Otherwise, updating the dts is probably cleaner | 18:50 |
_florent_ | or maybe you could look what we are doing in Linux-on-LiteX-Vexrisv | 18:50 |
_florent_ | we are generating a .json file and regenerating the .dts automatically | 18:50 |
_florent_ | https://github.com/litex-hub/linux-on-litex-vexriscv/blob/master/json2dts.py | 18:51 |
tpb | Title: linux-on-litex-vexriscv/json2dts.py at master · litex-hub/linux-on-litex-vexriscv · GitHub (at github.com) | 18:51 |
somlo | are you compiling the dtb blob into the bios as well ? | 18:51 |
_florent_ | not into the bios, the dtb is provided with the linux images | 18:52 |
somlo | the unpatched BBL actually expects that, I've been adding the dtb in manually as a simple matter of convenience so far | 18:52 |
somlo | oh, I remember, vexriscv linux is booted in several separate blobs | 18:53 |
sajattack[m] | my hsync pulse is 16.57khz | 18:53 |
somlo | I think the "canonical" "Right Way (tm)" to do it would be to indeed add the dtb to the bios, since that's where all the knowledge is available and authoritative all in one place :) | 18:53 |
_florent_ | somlo: yes that could be a next step :) | 18:54 |
sajattack[m] | should be 45 :/ | 18:54 |
somlo | except for 1. it makes the bios larger and 2. it's inconvenient during rapid iteration development :) | 18:54 |
_florent_ | sajattack[m]: ah ok, so that could explain things | 18:54 |
sajattack[m] | indeed | 18:55 |
sajattack[m] | is it trying to do 240p somehow? | 18:55 |
somlo | _florent_: IMHO the first next step would be to add some sort of json2dts.py like thing to LiteX, so that it can generate the dts similarly to how csr.csv is generated right now | 18:57 |
somlo | then it'd be a super simple makefile hack to optionally work that into the bios | 18:57 |
sajattack[m] | also it's only outputting an hsync after linux has started | 18:57 |
somlo | _florent_: that would make half of my out-of-tree BBL hackery disappear altogether :) | 18:58 |
_florent_ | somlo: yes i agree we should and a json2dts.py equivalent directly in LiteX, this one was an experiment and there are others version for Zephyr. We should have a single one integrated. | 19:00 |
sajattack[m] | I checked the rate of the pll and I think it's correct | 19:45 |
somlo | _florent_: allright, looks like I'm all the way back in business now :) Thanks for all your help! | 19:45 |
* somlo is about to find out if hacking in litesdcard support will shift csr allocations again :) | 19:46 | |
*** rohitksingh has quit IRC | 19:55 | |
Xiretza | how exactly does liteeth's wishbone endianness work? it seems to only affect SRAM data, but even that the wrong way around - and accesses to CSRs are always big-endian. | 20:45 |
scanakci | @somlo: is it possible to send me the necessary file(s) that I should put into my root tftp folder to boot up linux on rocket? After trying the third switch, I can finally copy a file into DRAM using tftp. I guess I only need a bbl based on your explanation here (https://www.contrib.andrew.cmu.edu/~somlo/BTCP/) | 21:09 |
tpb | Title: A Trustworthy, Free (Libre), Linux Capable, Self-Hosting 64bit RISC-V Computer (at www.contrib.andrew.cmu.edu) | 21:09 |
scanakci | For a reason, the copy process fails if the file size exceeds roughly 30MB. | 21:09 |
sajattack[m] | my vsync is also about a factor of 3 off | 21:15 |
sajattack[m] | 22Hz | 21:15 |
sajattack[m] | the proportion of vsync to hsync is correct however | 21:20 |
_florent_ | somlo: good that it's solved! | 21:24 |
_florent_ | Xiretza: it's possible we could avoid the endianness change in LiteEth, but it was probably needed with the way the buffers are accessed from the software in microudp.c | 21:26 |
_florent_ | sajattack[m]: so you pix clk is correct? the core is configured in rgb? Can you remind me the data_width of your SDRAM? | 21:28 |
sajattack[m] | I think the pixel clock is correct, triple checking it now. Not sure what you mean about rgb, sdram data is 16bits | 21:29 |
sajattack[m] | yes I'm quite sure the pixel clock is correct, dividing it by 16 gave 4.5-4.8, and setting it to 75 gives roughly the same result as setting it to 74.25 in terms of hsync | 21:30 |
sajattack[m] | there's no way it can't output a 75mhz clock, while there's a slight chance it couldn't output a 74.25, at least in my mind | 21:30 |
sajattack[m] | it looks like it's doing rgba, if that's what you mean | 21:32 |
sajattack[m] | `[ 1.377835] simple-framebuffer c8000000.framebuffer: format=a8b8g8r8, mode=1280x720x32, linelength=5120` | 21:32 |
_florent_ | it could also be that the resolution is too high and the SDRAM is not able to provide enough data | 21:36 |
_florent_ | can you try a lower resolution? | 21:36 |
_florent_ | like 640x480 first | 21:36 |
sajattack[m] | sure | 21:36 |
_florent_ | 1280x720x32 = 2.9Gbps, you don't have this bandwidth on your board | 21:37 |
_florent_ | what's the frequency of the CPU? | 21:37 |
sajattack[m] | oh | 21:37 |
sajattack[m] | 50MHz | 21:37 |
Xiretza | shouldn't that be immediately obvious from a timing check? | 21:38 |
Xiretza | or does litex not do that (by default)? | 21:38 |
_florent_ | sajattack[m]: sorry, my computation is not good, but i still think that's your issue | 21:39 |
_florent_ | it should work with a lower resolution | 21:39 |
sajattack[m] | ok that makes sense | 21:40 |
sajattack[m] | I'm synthesizing a 480p version as we speak | 21:40 |
_florent_ | Xiretza: for litevideo or liteeth? | 21:41 |
Xiretza | _florent_: I'm just wondering how a multi-gigabit clock slipped past synthesis | 21:42 |
somlo | scanakci: http://www.contrib.andrew.cmu.edu/~somlo/BTCP/boot.bin | 21:42 |
_florent_ | Xiretza: ah no it's different, it's the available bandwidth of the SDRAM controller | 21:43 |
somlo | scanakci: note, this is assuming the latest-and-greatest litex, which was working all along | 21:43 |
_florent_ | that is not able to provide enough data for the 1280x720x32 | 21:43 |
Xiretza | _florent_: ooooh I see, that makes sense | 21:43 |
scanakci | thank you!. One last question, what is lowest frequency that you used to test LiteETH with Rocket? | 21:43 |
scanakci | I saw some prior discussion which caused some problems on LiteETH due to the CPU frequency. it was a year ago, probably there is still a lowerbound. It may be higher, though. | 21:44 |
somlo | scanakci: so, the blob copies fine over tftp, and linux starts booting at cpu clocks as low as 40MHz | 21:45 |
sajattack[m] | I must have made a mistake, linux is still trying to do 720p | 21:45 |
Xiretza | scanakci: it should work down to 30 mhz now: https://github.com/enjoy-digital/liteeth/issues/30#issuecomment-583335583 | 21:46 |
tpb | Title: Netboot issues with 1Gbps and low CPU frequency (<55MHz) · Issue #30 · enjoy-digital/liteeth · GitHub (at github.com) | 21:46 |
somlo | but lately the linux ethernet driver initialization (upon kernel boot) started to hang at that frequency | 21:46 |
scanakci | okay, 40 MHz is great. | 21:46 |
somlo | 60 is my standard goto number that kinda works most of the time :) | 21:46 |
scanakci | @Xiretza: 30 MHz is even better :) | 21:46 |
scanakci | I see. above 50 MHz, I am getting some time violations which are hard to interpret for me due to my limited experience. I hope LiteEth works fine with 50MHz. | 21:47 |
_florent_ | scanakci: the theorical minimum is 125MHz/4 = 31.25MHz | 21:48 |
somlo | Xiretza: if you figure out more about CSR endianness in the absence of a CPU, please share :) | 21:49 |
sajattack[m] | _florent_: anythign I need to change other than emulator/framebuffer.c and pix_clk to get down to 480p? | 21:49 |
_florent_ | the data are read on 32-bit words in sys_clk and emitted on 8-bit words at 125MHz | 21:49 |
somlo | for me, subregisters (basic CSRs) are always accessible in whatever native endianness the CPU is using (I've never built a cpu-less LiteX) | 21:50 |
_florent_ | before the changes, the theorical minimum was 125MHz/2 = 62.5MHz, which explains the issues below 60MHz | 21:50 |
somlo | then, if compound multi-subregister CSRs are used, the subregisters themselves are always most-significant-chunk first (big-endian *like*) | 21:50 |
scanakci | okay, for 60MHz I could make tftp work for Rocket. Testing lower one. | 21:51 |
scanakci | https://usercontent.irccloud-cdn.com/file/FOgO3AD2/image.png | 21:51 |
scanakci | my litex is outdated. | 21:51 |
scanakci | This is the bbl that @somlo provided to me | 21:51 |
scanakci | I will check BlackParrot as next and see if tftp works fine. | 21:52 |
_florent_ | sajattack[m]: no, you only need to change pix clk and firmware | 21:53 |
somlo | scanakci: you need a linux* rocket variant | 21:54 |
scanakci | oh totally forgot :). | 21:54 |
sajattack[m] | ok, trying again, this time undef'ing the 720p rather than commenting it out | 21:54 |
somlo | the "standard" rocket doesn't have a MMU | 21:54 |
sajattack[m] | linux still claims it's outputting 720p | 21:56 |
scanakci | okay. | 21:56 |
somlo | Xiretza: here https://github.com/enjoy-digital/litex/issues/314 is what I've been able to figure out about CSRs so far (and I should probably update the references to the code, now that LiteX updated the SoC class hierarchy) | 21:56 |
tpb | Title: We need to document LiteX CSRs! · Issue #314 · enjoy-digital/litex · GitHub (at github.com) | 21:56 |
sajattack[m] | do I need to rebuild the buildroot? | 21:56 |
Xiretza | somlo: liteeth's endianness option doesn't affect CSRs, so they're always in litex-native format (big-endian). Don't think I have any multi-chunk registers to worry about. | 21:57 |
somlo | Xiretza: "litex-native" CSR format if one adds a little-endian CPU is actually little-endian :) That's what I was wondering what happens if you don't configure a CPU at all, and deal with the exposed data wires directly from the outside, over wishbone | 21:59 |
Xiretza | somlo: where does this endianness change occur then? | 22:00 |
somlo | hmm, that's another interesting question: if the litex-internal CPU is L.E. and sees its CSRs as also L.E., would an external CPU looking at the same stuff over a WB or AXI port see them as B.E ? | 22:01 |
*** rohitksingh has joined #litex | 22:01 | |
somlo | Xiretza: _florent_ and I talked about this a bit a while ago, and we *think* it's in the actual wiring of data lines when CPUs are connected in litex/soc/cores/cpu/*/core.py | 22:03 |
Xiretza | my observations of liteeth: let's assume there's a 1-byte register containing 0xAB at address 0x100. If I access 0x100, I get back 0x0000_00AB - the byte of interest is in the rightmost position. Now if I receive a byte 0xCD over the network, and read from the SRAM base address 0x200, I get back 0xCD00_0000 with endianness=big. To me, this seems wrong - if I want to get the *byte* at 0x200, I | 22:04 |
Xiretza | suddenly have to look at the leftmost byte. | 22:04 |
somlo | because if you initialize a scratch register with 0x12345678, for instance, and then read it in over a CSR bus with csr_data_width == 32, it comes back as 0x12345678 on *both* vexriscv *and* mor1k (le and be, respectively)! | 22:04 |
Xiretza | right now I work around that by treating the liteeth bus as big-endian, but setting endianness=little in the YAML. | 22:05 |
somlo | Xiretza: oh but SRAM endianness might be orthogonal to CSR endianness -- fun and games all around | 22:06 |
Xiretza | somlo: what would be an example of a little-endian CPU in litex? | 22:07 |
somlo | vexriscv | 22:07 |
somlo | or Rocket, but if you simulate vexriscv is much faster :) | 22:07 |
somlo | Xiretza: also recommend you try "--csr-data-width=32" to compare-and-contrast to the default (which is 8) | 22:09 |
somlo | e.g., "litex/litex/tools/litex_sim.py --csr-data-width 32 --cpu-type vexriscv" | 22:10 |
somlo | then "mr 0x82000000 0x100" from the bios prompt, to see what things look like to the CPU, from an endianness perspective | 22:11 |
somlo | the scratch register is 32 bits starting at 0x82000004 | 22:11 |
Xiretza | somlo: honestly not too concerned with a full litex build, that's another whole can of worms - I'm just looking for a working ethernet MAC. | 22:13 |
somlo | Xiretza: that's ok, just figured I'd get you interested in endianness issues, as a sanity check to what I think I know (which isn't much, and some of it is probably wrong) :D | 22:14 |
Xiretza | somlo: oh I'm interested, I just wish I didn't have to be ;) | 22:14 |
Xiretza | also, WRITER_LENGTH and WRITER_SLOT always come back as 0, not sure what's up with that, though very likely my fault. | 22:15 |
Xiretza | heh, in a way it was! thanks for the csr_data_width suggestion, somlo, I had no idea it was 8 by default - of course reading a whole 32-bit word will only give me a single byte of the multi-part CSR in that case. | 22:26 |
Xiretza | is there any real downside to having CSRs be as wide as machine words? I guess it might result in a little more logic, but runtime efficiency is way higher. | 22:32 |
sajattack[m] | _florent_: what do I need to change in linux? there's no hsync until linux starts, and linux is trying to do 720p no matter what | 22:45 |
sajattack[m] | ah it's the bloody json2dts I think | 22:47 |
levi | Could be a device tree thing? | 22:47 |
sajattack[m] | yes I think so levi | 22:48 |
sajattack[m] | whoever hardcoded this, argh! https://github.com/litex-hub/linux-on-litex-vexriscv/commit/9a9f01baf9fa29cfa36d7e0ff0b8cfa2b60a3926#diff-1b4068987a8de18511d022e172408370L260 | 22:50 |
tpb | Title: Add litevideo driver · litex-hub/linux-on-litex-vexriscv@9a9f01b · GitHub (at github.com) | 22:50 |
levi | There was a helpful #fixme note about it. :) | 22:51 |
sajattack[m] | lol | 22:52 |
sajattack[m] | LOL, linux is now reporting 640x480 but still giving me 16khz | 22:53 |
sajattack[m] | I might have to tap out here | 22:54 |
sajattack[m] | for now | 22:54 |
Generated by irclog2html.py 2.13.1 by Marius Gedminas - find it at mg.pov.lt!