Tuesday, 2021-01-26

*** tpb has joined #litex00:00
*** indy has quit IRC00:10
*** indy has joined #litex00:20
*** lf_ has joined #litex00:45
*** lf has quit IRC00:45
*** chgavilana has quit IRC02:09
*** Degi_ has joined #litex03:46
*** Degi has quit IRC03:48
*** Degi_ is now known as Degi03:48
*** Bertl_oO is now known as Bertl_zZ05:15
*** _whitelogger has quit IRC06:12
*** _whitelogger has joined #litex06:14
*** hansfbaier has joined #litex08:15
*** Melkhior has joined #litex09:52
Melkhiorsomlo _florent_ Is HW design some sort of dark art ?:-)  Rocket is willing to load the boot.bin from the micro-sd card ... in SPI mode, as suggested by somlo.09:56
MelkhiorSo theoretically, SPI mode can work ; why can't it work for VexRiscV or my design, your guess is as good (or waaaaaay better if I'm honest) than mine :-)09:58
Melkhior... well back to normal: fixed the boot.bin to have a proper dts (with a SPI sdcard instead of SD-mode), regenerated the bitstream ... and SPI mode now fail as well.10:10
MelkhiorGuess I'll fall back to serialboot10:11
MelkhiorRemoved the sdcard from the DTS, serialboot'ed:10:37
Melkhior# cat /proc/cpuinfo10:37
Melkhiorprocessor       : 010:37
Melkhiorhart            : 010:37
Melkhiorisa             : rv64imafdc10:37
Melkhiormmu             : sv3910:37
Melkhioruarch           : sifive,rocket010:37
MelkhiorApparently, the sdcard is the 'root' of all evil ;-)10:38
*** hansfbaier has quit IRC10:46
*** hansfbaier has joined #litex10:48
*** Melkhior has quit IRC11:07
*** hansfbaier has quit IRC11:13
*** CarlFK[m] has quit IRC11:19
*** promach3 has quit IRC11:19
*** xobs has quit IRC11:19
*** jryans has quit IRC11:19
*** david-sawatzke[m has quit IRC11:19
*** sajattack[m] has quit IRC11:19
*** disasm[m] has quit IRC11:19
*** jevinskie[m] has quit IRC11:19
*** apolkosnik[m] has quit IRC11:19
*** leons has quit IRC11:19
*** promach3 has joined #litex11:31
*** tpb has joined #litex11:40
*** apolkosnik[m] has joined #litex11:53
*** xobs has joined #litex11:53
*** sajattack[m] has joined #litex11:53
*** david-sawatzke[m has joined #litex11:53
*** jevinskie[m] has joined #litex11:53
*** disasm[m] has joined #litex11:53
*** leons has joined #litex11:53
*** jryans has joined #litex11:53
*** CarlFK[m] has joined #litex11:53
*** midnight has quit IRC11:55
*** midnight has joined #litex11:57
*** Bertl_zZ is now known as Bertl12:00
somloMelkhior: in spi-mode, the sdcard only uses CSR/MMIO to transfer data -- while "native" litesdcard uses DMA. So the data takes very different paths between RAM and the actual microSD card13:18
*** Melkhior has joined #litex13:20
somlothen there's the somewhat less likely issue of electrical power. e.g., I have a trellisboard which also works fine with spi-mode sdcard, but will reset/crash the fpga when the physical card is inserted when using native mode -- *unless* I use an external power supply, which allows it to work fine...13:21
Melkhior@somlo so tw problems - one is SD-mode w/ rocket where the DMA fails, the other is that for some reason SPI-mode is essentially not working for me ? (it does worke very occasionnaly for reasons unknown...)13:21
MelkhiorCould be power, but with LiteX I have an external power supply rated 5V/3A (the SBus is limited to 5V/2A). Could be not enough capacitance/decoupling/...  ? I didn't really think about that bit when doing the board...13:24
somlopcb design and power are waaay outside my comfort zone :)13:25
Melkhiormine too :-)13:26
MelkhiorAlso I suppose sd-mode, being faster with more pins, is more power-hungry than SPI (as in your experience with the trellisboard)... and SD-mode is quite reliable read-only to load the kernel + rootfs with linux-on-litex-vexriscv ; it works even with my dual-core SoC with all the extra instructions and bigger cache (got the space in the FPGA, might13:28
Melkhioras well use it:-)  ).13:29
MelkhiorHowever, Linux doesn't see the sdcard at all, don't know why - it's in /proc/device-tree13:29
MelkhiorI'm guessing my kernel from buildroot is too old and doesn't have a driver ?13:30
MelkhiorBut newer buildroot don't compile, I'm stuck with 88a268354d13:30
somloI was going to say, depends on the kernel. I'd suggest trying the "litex-rebase" branch of https://github.com/litex-hub/linux13:30
somloalso not familiar with buildroot -- I use a raw busybox-based initramfs.cpio for rocket (my current goal is to get things working at all, doing useful stuff with it can wait for later ;)13:32
MelkhiorCould try that yes, keep the rootfs and only rebuild a newer kernel. Worth a shot...13:32
MelkhiorYes, I saw that - your instructions were quite nice, I got a boot.bin that works (via serialboot only;-)  ) fine with Rocket using them13:33
Melkhiorbuildroot had a bit more stuff, which is useful when your SoC has no ethernet and no working mass storage and the only interface to the outside world is the serial console :-)13:34
geertuMelkhior: Does https://github.com/geertu/linux/tree/litex-v5.11 work any better?13:53
geertuI use the rootfs and opensbi from the prebuilts, but my own kernel13:54
somloshorne: ping14:03
somlobrb14:24
*** somlo has quit IRC14:24
*** somlo has joined #litex14:27
Melkhior@geertu I'll try ASAP14:28
Melkhior@geertu Was able to compile to a 'good' image: the kernel loads fine; however I get a hang when accessing the sdcard it seems:14:48
Melkhior[    1.387471] printk: bootconsole [sbi0] disabled14:48
Melkhior[    1.387471] printk: bootconsole [sbi0] disabled14:48
Melkhior[    1.407928] libphy: Fixed MDIO Bus: probed14:48
Melkhior[    1.410771] i2c /dev entries driver14:48
Melkhior[    1.416094] litex-mmc f0005000.mmc: invalid resource14:48
Melkhior[    1.416925] MAP_RESOURCE 2 failed14:48
Melkhior(and yet both the kernel and rootfs were loaded from said sdcard!)14:50
somlothat's the devm_ioremap_resource call on the sdreader MMIO range failing14:51
somloMelkhior: the bios (loading kernel and rootfs) are a different code base; once the kernel starts booting, it won't use the bios, but rather its own built-in driver to talk to the hardware14:52
somlolow-hanging-fruit: typo in the DT node for the sdcard (wrong address for the third entry, the one specific to the sdreader)?14:53
MelkhiorOK ; btw @somlo I also tried the branch you suggested, but I must have messed up the configuration - I got a > 22 MiB image that wouldn't boot. @geertu branch has a default vexriscv config that worked for me14:53
MelkhiorDTS is14:54
Melkhior                mmc@f0005800 {14:54
Melkhior                        compatible = "litex,mmc";14:54
Melkhior                        bus-width = <0x4>;14:54
Melkhior                        reg = <0xf0005000 0x100 0xf0005800 0x100>;14:54
Melkhior                        status = "okay";14:54
Melkhior                };14:54
somlothe litex_rebase branch needs a vexriscv defconfig :)14:54
somloyou have too few entries in reg14:54
somloyou need four (address, size) pairs14:55
Melkhiorshould come out of json2dts.py ...14:55
MelkhiorI _think_14:55
MelkhiorSource file should be ./build/sbustoztex/sbustoztex.dts from linux-on-litex-vexriscv, says:14:56
Melkhior                mmc0: mmc@f0005800 {14:57
Melkhior                        compatible = "litex,mmc";14:57
Melkhior                        bus-width = <4>;14:57
Melkhior                        reg = <14:57
Melkhior                                0xf0005000 0x10014:57
Melkhior                                0xf0005800 0x10014:57
Melkhior                        >;14:57
Melkhior                        status = "okay";14:57
Melkhior                };14:57
Melkhioronly two as well14:57
geertuMelkhior: To fix the too large kernel image, you need https://github.com/geertu/linux/commit/d7894d2d078e5e255fa2e0e8bd3739079a854b3914:57
geertuand https://github.com/geertu/linux/commit/44d9a61725d2eb26228ba8e14bcdd16dbbb0e77714:57
somlotechnically, json2dts *should* take care of it, but I haven't adapted it to deal with rocket yet, so I'm not super familiar with it14:58
Melkhior@geertu OK thanks; though your branch works for me I might stick with that :-)14:58
geertuMelkhior: I have14:58
geertu            mmc0: mmc@f0004800 {14:58
geertu                compatible = "litex,mmc";14:58
geertu                reg = <14:58
geertu                    0xf0004800 0x10014:58
geertu                    0xf0005000 0x10014:58
somlothe four entries in reg <> should correspond to your csr.csv14:58
geertu                    0xf0005800 0x10014:58
geertu                    0xf0006000 0x100>;14:58
geertu                bus-width = <0x04>;14:58
Melkhior@somlo this is with VexRiscV ATM, as it works in the BIOS14:58
geertu                status = "okay";14:58
geertu            };14:58
geertualso with linux-on-litex-vexriscv?14:59
somloMelkhior: yes, understood. But since it's the same driver in linux, it'll need similar magic in DTS :)14:59
Melkhior:-)15:00
somloI was going to say: in csr.csv, you should have sdphy, sdcore, sdblock2mem, sdmem2block15:00
Melkhiormagic is the word...15:00
somlo"csr_base" entries15:00
somlothose are your start addresses for each of the four pairs in "reg"15:00
somlouse 0x100 for the extent of each pair as that should be "close enough"15:01
somloyour json2dts might be out of date or buggy, but as mentioned, I haven't dealt with it yet, so I don't know for sure15:01
MelkhiorOK will fix that and try again15:02
Melkhior(I don't seem to have a csr.csv, but I have a csr.json with the entries in decimal, close enough I guess:-)  )15:02
Melkhiormmm, goes further but then infinite loop in the kernel:15:09
Melkhior[    2.697537] litex-mmc f0005000.mmc: Requested clk_freq=0: set to 0 via div=25615:09
Melkhior[    3.745523] litex-mmc f0005000.mmc: Requested clk_freq=12500000: set to 0 via div=215:09
Melkhior[    4.973482] litex-mmc f0005000.mmc: Requested clk_freq=0: set to 0 via div=25615:09
Melkhior[    6.017523] litex-mmc f0005000.mmc: Requested clk_freq=12500000: set to 0 via div=215:09
Melkhior[    7.245492] litex-mmc f0005000.mmc: Requested clk_freq=0: set to 0 via div=25615:09
Melkhior[    8.289514] litex-mmc f0005000.mmc: Requested clk_freq=12500000: set to 0 via div=215:09
Melkhior[    9.517482] litex-mmc f0005000.mmc: Requested clk_freq=0: set to 0 via div=25615:09
Melkhior[   10.561525] litex-mmc f0005000.mmc: Requested clk_freq=12500000: set to 0 via div=215:09
Melkhior[   11.789480] litex-mmc f0005000.mmc: Requested clk_freq=0: set to 0 via div=25615:09
Melkhior[   12.833513] litex-mmc f0005000.mmc: Requested clk_freq=12500000: set to 0 via div=215:09
Melkhior(repeat ad nauseam)15:09
Melkhiorin the DTS, what should be the address of the 'mmc' ?15:10
MelkhiorI have mmc0: mmc@f000580015:10
geertuMelkhior: replace the dev_info() call by dev_dbg()15:10
geertuMelkhior: the address depends on what you have configured inyour SoC15:10
Melkhiorthat was the last block of registers, but geertu's DTS uses 4800 (the first block)15:10
Melkhiornow 5800 is in the middle for me ...15:11
Melkhiorshould it be the first block ?15:11
Melkhiorthat would be f0005000 whic his what the kernel reports15:11
somloMelkhior: when you built the bitstream, did you get/keep the csr.csv file that was generated during the build?15:15
somloit should contain the authoritative addresses that need to be placed in DT specific to your "hardware"15:15
somlolook for a line (in csr.csv) starting with "csr_base,sdphy"15:16
MelkhiorI have a csr.json instead, does it not have all the information ?15:16
somloshould have it, although maybe in a slightly different format ?15:16
somlosearch for "sdphy", "sdcore", sdblock2mem", and "sdmem2block" in your json file15:17
Melkhior    "csr_bases": {15:17
Melkhior(...)15:17
Melkhior       "sdphy": 4026552320,15:17
Melkhiorthat's F000500015:17
MelkhiorI fixed the DTS I think, that's how I get the kernel's infinite loop15:18
MelkhiorI have all four registers, with the same relative offset than Geert's (just a different base)15:19
somlowhat is the "clock-frequency" value for your CPU (also in DTS)?15:19
somloit's used to compute the divider for clocking the sdcard15:19
somloand it seems that's not going over too well in your environment15:19
Melkhior100 MHz15:21
somloso `clock-frequency = <100000000>;` then ?15:24
Melkhioryes15:25
Melkhior... in JSON: 50015:25
Melkhior... in JSON: "config_clock_frequency": 100000000,15:25
somlothe line that says "set to 0 via div=2" concerns me a bit15:27
Melkhior@geertu with 'dev_dbg' instead of 'dev_info' I get no output ?!?15:28
Melkhior@somlo yes seems the code sees host->freq at 0 ...15:28
MelkhiorI added 'host->freq = 100000000;' in the function, but it doesn't help much:15:28
Melkhior[    2.701396] litex-mmc f0005000.mmc: Requested clk_freq=0: set to 390625 via div=25615:28
Melkhior[    3.745428] litex-mmc f0005000.mmc: Requested clk_freq=12500000: set to 12500000 via di15:28
Melkhiorv=815:28
Melkhior[    4.973389] litex-mmc f0005000.mmc: Requested clk_freq=0: set to 390625 via div=25615:28
Melkhior[    6.017425] litex-mmc f0005000.mmc: Requested clk_freq=12500000: set to 12500000 via di15:28
Melkhiorv=815:29
Melkhior[    7.245391] litex-mmc f0005000.mmc: Requested clk_freq=0: set to 390625 via div=25615:29
Melkhior[    8.289433] litex-mmc f0005000.mmc: Requested clk_freq=12500000: set to 12500000 via di15:29
Melkhiorv=815:29
Melkhior(the 'set to XXX' value is 'host->freq / div', so I guess host->freq is 0)15:29
somloMelkhior: I was going to suggest https://pastebin.com/rM6YtKqp but you already did something similar15:31
Melkhiormmm the "config_clock_frequency": 100000000," in the JSON doesn't make it all the way to the DTS:15:31
tpbTitle: diff --git a/drivers/mmc/host/litex_mmc.c b/drivers/mmc/host/litex_mmc.cindex - Pastebin.com (at pastebin.com)15:31
Melkhior                cpu@0 {15:31
Melkhior                        clock-frequency = <0x0>;15:32
somloyeah, json2dts again -- maybe hard-code it directly in the dts...15:32
Melkhiorjust did :-)15:33
somlothere's something weird about how json2dts seems to not work for you -- I haven't used it, but if it's *this* broken (for linux-on-litex-vexriscv) someone would have noticed, I think. So I wonder where that breakage occurs for you, figuring that out might help fix a bunch of things...15:34
MelkhiorI'm running a slightly older version from late last october, didn't update everything for fear of breaking something - except for the sdcard (which may still be my HW!) everything works beautifully15:38
Melkhiorwith fixed DTS and unpatched kernel, I also get the 'infinite loop' with the proper divider (8 for 12500000)15:38
MelkhiorThis is SMP as well...15:39
Melkhior(OTOH, the 'rocket' tests are with all-new (from yesterday) repositories)15:41
geertuMelkhior: Things have changed since last Oct, both on the gateware as Linux driver side15:41
geertuSo you need to use a recent LiteX, linux-on-litex-vexriscv, and kernel15:42
MelkhiorIlitesdcard I _did_ update15:42
Melkhiorbut everything else might be older :-(15:42
MelkhiorOK15:43
MelkhiorI will need to restart in a new environment I guess, to have a clean LIteX setup15:44
Melkhiormight take a while :-(15:44
MelkhiorThanks a lot for all the help everyone :-)15:44
somloMelkhior: I have a morning routine of "git pull" for all repos I don't hack on, and fetch-upstream + rebase for everything where I do have current ongoing changes15:50
somloit's a bit of a treadmill, but better to have the latest and greatest, since things do tend to move at a pretty brisk pace :)15:51
somlo(even on days I otherwise have no time to play with LiteX, just to make sure I get to complain in a timely way about anything that affects me negatively :)15:51
Melkhior... my main desktop is still on Debian 9 as it works-for-me:-)  My mac laptop is from 2009. And - that FPGA board was bought for https://github.com/rdolbeau/SBusFPGA ; I'm still playing with 25+ years old SPARCstation...15:55
Melkhior"latest and greatest" is *not* my middle name :-)15:55
MelkhiorI guess for LiteX i should learn to update more :-)15:57
*** Melkhior has quit IRC16:06
somlo_florent_: I built rocket/litex for nexys4ddr with the jtagbone analyzer: https://pastebin.com/72Jdniu817:04
tpbTitle: diff --git a/litex_boards/targets/nexys4ddr.py b/litex_boards/targets/nexys4ddr. - Pastebin.com (at pastebin.com)17:04
_florent_somlo: not sure I tested jtagbone with the analyzer yet, I was planning to test it later this week17:06
_florent_so if you have issues, please report them :)17:06
somlobut my old litescope_cli command line: `litescope_cli -v basesoc_cpu_mem_axi_aw_payload_addr 0x80000000 -r basesoc_cpu_mem_axi_w_valid`17:06
somlofails with a `AssertionError: Found multiple candidates:` and a bunch of signals in my list17:06
somlorunning it without any arguments gets me a dump.vcd17:07
somlobut I can't use triggers, apparently17:07
_florent_somlo: ok, the issue you have should not be related to the change to jtagbone. This happens when checking the .csv with the passed triggers17:08
somloI can no longer build it the old way did `add_uartbone()` get renamed ?17:08
somlosorry, gotta run (take my Mom in for a vaccine), be back in an hour or so17:09
_florent_somlo: uartbone should still work with upstream, I'm going to check17:11
_florent_somlo: I'm able to build arty when  adding self.add_uartbone(name="serial") to the SoC and doing ./arty.py --uart-name=crossover17:14
*** kgugala has quit IRC17:25
*** Zguig has joined #litex18:12
ZguigHi guys, I did something that works to unable flashing the FPGA gateware for: linux virtex project / ecpix5 board (should be compatible with all boards having the flash function working). Could somebody have a look to the issue I have openned to check if I can commit my implementation? https://github.com/litex-hub/linux-on-litex-vexriscv/issues/18918:21
*** kgugala has joined #litex18:38
_florent_Hi Zguig, thanks for looking at that, sorry I saw your issue but haven't been able to answer before, just did18:41
ZguigHi _florent_, thanks for your reply, I will have a look to the  https://github.com/quartiq/bscan_spi_bitstreams/blob/master/lattice_bscan_spi.py that is required by OpenOCD to flash if I understood well the story18:42
ZguigI did the "easy" way :)18:43
*** dkozel has quit IRC18:43
_florent_Zguig: if this is too complicated, we could use an alternative, that would be nice to evaluate ECPProg: https://github.com/gregdavill/ecpprog and ECPDap: https://github.com/adamgreig/ecpdap18:48
ZguigIt seems not so easy to pass through OpenOCD for this. What don't you like in OpenFPGALoader ? It can do load and flash18:53
ZguigIn fact it is the official tool from the manufacturer of this board http://docs.lambdaconcept.com/ecpix-5/features/debug.html18:53
tpbTitle: Debug ECPIX-5 Documentation documentation (at docs.lambdaconcept.com)18:53
ZguigWhat I see nice with this project is the number of FPGA supported18:58
ZguigFrom what I saw in the boards, only few have flash implemented, based on custom routines18:59
_florent_Zguig: I have a preference for OpenOCD because that's also what we are using for Xilinx FPGAs19:01
_florent_but if using OpenFPGALoader makes flashing a lot easier on ECP5, we could use that19:02
ZguigAnd how did you manage to get the proxy gateware for xilinx?19:02
_florent_these are pre-generated19:03
_florent_but I was also able to generate them from Migen IIRC19:03
ZguigFrom xilinx tools?19:03
_florent_generate with Migen with the Xilinx tools yes19:04
_florent_generated19:04
_florent_sorry I have to go19:04
ZguigOK, thanks! I try to check if I can go further with OpenOCD19:04
*** Zguig has quit IRC19:46
somlo_florent_: fwiw, jtagbone and litescope work -- it's that the soc was internally renamed from "basesoc" to just "soc", so the names of the signals I was passing into the client were wrong19:54
somloso I think everything is fine from my perspective -- I can keep the console on the "standard" uart and do debugging/litescope over jtag, which is the intuitive thing to do -- thanks for implementing it, and sorry for the false alarm19:55
*** davidlattimore has quit IRC20:13
*** davidlattimore has joined #litex20:14
_florent_somlo: thanks for the feedback, nice to know it's working correctly. We should really get rid of this renaming, I'll try to look at it soon (https://github.com/enjoy-digital/litex/issues/667)20:19
somlo_florent_: litescope is awesome, and I love that I know how to use it now (thanks again for that, btw). But I just came to realize I actually need to understand the LiteSDCard (and DMA) FSMs, to even stand a chance of figuring out why they're misbehaving (and only under Linux, not in the bios)...20:26
somloso it looks like I have to go down a layer of abstraction and learn yet another new thing :D20:27
*** somlo has quit IRC20:28
*** somlo has joined #litex20:29
*** Bertl is now known as Bertl_oO21:39
*** oter has joined #litex22:26

Generated by irclog2html.py 2.17.2 by Marius Gedminas - find it at https://mg.pov.lt/irclog2html/!