Sunday, 2017-04-16

*** tpb has joined #timvideos00:00
futarisIRCcloudmithro: Still not having any luck with getting litex_uart_isr to run. I tried tying the irq line high in qemu too. Are we sure that the cpu irqs are connected tot the bus irqs etc?00:09
futarisIRCcloudTIMER_PERIOD is wrong in hw/openrisc/cputimer.c for litex.00:36
*** CarlFK has quit IRC02:21
futarisIRCcloudOk. Getting somewhere with toggling the IRQs in QEMU.02:30
mithrofutarisIRCcloud: I definately that the IRQs working in QEMU with our bare metal hardware02:39
futarisIRCcloudLet me e-mail you some diffs.02:41
mithrofutarisIRCcloud: I've also gotten bitbanging SPI flash and SD Card via SPI working in QEMU02:41
futarisIRCcloudYeah, I saw those changes you pushed last night. You don't have a physical SD card on any boards, though do you?02:42
mithroMost of them do02:43
mithroWe have just never used them...02:43
mithrofutarisIRCcloud: Definitely had the CPU jumping to the ISR because I saw seeing the print message I disabled02:44
mithroI'm just getting up now, will be around in 15-20 minutes02:45
futarisIRCcloudI'm pretty sure we need to toggle the IRQ for the ISR to happen (more than once).02:51
futarisIRCcloudActually, I think the tiny change in pic_cpu.c that I made (for DEBUG), makes the biggest difference. Without it I wasn't getting any interrupts through. :S03:01
futarisIRCcloudToggle the IRQ enough, and the current code will eventually "Welcome to Buildroot" / "buildroot login:"03:18
mithrofutarisIRCcloud: Are you not clearing the IRQ?03:45
mithroI'm around now03:45
futarisIRCcloudI wasn't.03:47
mithrofutarisIRCcloud: You are now, and it works?03:47
futarisIRCcloudNo. Tx is still broken03:47
futarisIRCcloudAll the post console tx happens from the isr03:48
mithrofutarisIRCcloud: Okay, so the easiest way for me to get the same thing you have is for you to push your changes to GitHub (or other git repo) and me pull that03:51
futarisIRCcloudnew branch?03:52
mithrofutarisIRCcloud: If you want to use timvideos repos - yeah just push a brunch under futaris/xxxx IE "git remote add git+ssh://; git push tv master:futaris/master"03:53
mithrofutarisIRCcloud: tell me when you have04:03
futarisIRCcloudMithro: Ok. Just out at the moment. The patches I sent were all against HEAD or linux-hacks HEAD.04:07
futarisIRCcloudMain thing is to move uart interrupt to irq 2, and add some debug to qemu.04:07
futarisIRCcloudNot sure what the real hardware does, regarding interrupts, which is why I was having qemu so I could easily toggle etc.04:08
*** tvCommitBot has joined #timvideos04:09
tvCommitBot[linux-litex] mithro pushed 1 new commit to master:
tvCommitBotlinux-litex/master 70a7cdd Tim 'mithro' Ansell: Hacks Hacks Hacks - SD Card via SPI GPIO + GPIO MMIO kind of works though.04:09
*** tvCommitBot has left #timvideos04:09
futarisIRCcloudCan you look at moving the uart interrupt in litex hardware?04:10
mithrofutarisIRCcloud: I can make it so that interrupt zero isn't used and everything should automatically move down04:14
futarisIRCcloudThat should work too04:14
mithrofutarisIRCcloud: error: drivers/tty/serial/uart-litex.c: patch does not apply04:16
futarisIRCcloudSorry. The linux side is just modifying dts (irq) and a lot of hacks for printing etc. Nothing interesting in uart-litex other than changing IRQF to level high (IIRC)04:19
mithrofutarisIRCcloud: I don't see you clearing the pending IRQs in the uart driver? Without that you'll just get the IRQ asserted straight away again?04:19
mithrofutarisIRCcloud: You don't seem to be doing anything with the EV registers?04:21
futarisIRCcloudDidn't get that far. Only just got irqs happening.04:22
futarisIRCcloudIn the real hardware, does clearing the pending ev also clear the hw interrupt?04:23
mithrofutarisIRCcloud: If you clear all the pending EV flags or disable the EV then yes the hw interrupt is deasserted04:23
futarisIRCcloudIRQ_HANDLED stops the event happening again in Linux(without the toggle), IIRC.04:24
*** tvCommitBot has joined #timvideos04:24
tvCommitBot[qemu-litex] mithro pushed 1 new commit to linux-hacks:
tvCommitBotqemu-litex/linux-hacks 83113eb Tim 'mithro' Ansell: Hack hack hackss......04:24
*** tvCommitBot has left #timvideos04:24
mithrofutarisIRCcloud: I'm not sure I understand?04:25
futarisIRCcloudReturn irq_handled in the isr04:28
mithroe0001000.serial: ttyLX0 at MMIO 0xe0001000 (irq = 2, base_baud = 0) is a litex_uart04:34
mithrodrivers/tty/serial/uart-litex.c requested irq 204:34
mithrofutarisIRCcloud: That is what I should be expecting right?04:37
mithrofutarisIRCcloud: Okay, and you are expecting an IRQ event?04:39
mithrofutarisIRCcloud: But your not going to get any unless you touch the EV registers?04:43
futarisIRCcloudI modified qemu first, to enable ev by default.04:44
*** CarlFK has joined #timvideos04:44
*** ChanServ sets mode: +v CarlFK04:44
futarisIRCcloudI was just trying to check the qemu irq path to Linux kernel first.04:44
futarisIRCcloudI'm probably not going to get a chance to work on this tomorrow.05:08
mithrofutarisIRCcloud: Okay, So I've written the IRQ handling in the qemu uart to make more sense05:15
*** SamSagaZ has quit IRC05:18
futarisIRCcloudmithro: I'm back at a PC again now.05:22
mithrofutarisIRCcloud: Let me check that my new IRQ code for the UART works05:23
mithrois there a way to make printf output binary?05:39
futarisIRCcloudNo. But you can printf %08x and get hexadecimal...05:45
mithrofutarisIRCcloud: So, it turns out I was wrong about the way the IRQs trigger05:51
futarisIRCcloudmithro: How?05:51
mithroThey trigger on a falling edge of the trigger signal05:52
mithroIE when new_line_value == 0 and old_line_value == 105:53
futarisIRCcloudtransition from 1->0.05:53
futarisIRCcloudSo TX IRQ should happen every time the buffer is EMPTY?05:54
mithroWhen ~tx_fifo.sink.ready goes from 1->0 (IE not-ready -> ready)05:55
futarisIRCcloudSo TX IRQ happens every time the TX FIFO goes from full to not-full.05:57
mithrofutarisIRCcloud: Yeah, it seems so06:01
futarisIRCcloudqemu_chr_fe_write_all eventually overflows .06:07
futarisIRCcloudThere is something called fifo8_create in serial.c ... for recv_fifo and xmit_fifo.06:08
tpbTitle: Snippet | IRCCloud (at
mithrofutarisIRCcloud: Then my litex_uart_isr breakpoint triggers06:14
futarisIRCcloudserial has serial_watch_cb(). qemu_chr_fe_add_watch() gets called from the serial_xmit() function. serial_watch_cb  calls serial_xmit() back again.06:14
*** tvCommitBot has joined #timvideos06:16
tvCommitBot[qemu-litex] mithro pushed 1 new commit to linux-hacks:
tvCommitBotqemu-litex/linux-hacks 751a543 Tim 'mithro' Ansell: Fixing the uart IRQ stuff.06:16
*** tvCommitBot has left #timvideos06:16
futarisIRCcloudThe TX is failing due to overflow in qemu_chr_fe_write_all() ... See serial.c:269 ...06:17
mithroWell, things are segfaulting now :-P06:20
tpbTitle: Snippet | IRCCloud (at
mithrofutarisIRCcloud: So this looks like it is kind of working06:47
futarisIRCcloudYeah, but qemu_chr_fe_write_all needs to be fixed with to fe with the callbacks.06:48
futarisIRCcloudSo besides litex-uart.c, where does the VMStateDescription come from?06:50
*** tvCommitBot has joined #timvideos06:53
tvCommitBot[qemu-litex] mithro pushed 2 new commits to linux-hacks:
tvCommitBotqemu-litex/linux-hacks 1a8a5d2 Tim 'mithro' Ansell: litex-uart: Making debug printing.06:53
tvCommitBotqemu-litex/linux-hacks 13cc615 Tim 'mithro' Ansell: Temp hack.06:53
*** tvCommitBot has left #timvideos06:53
mithrofutarisIRCcloud: I'm not seeing any overflows of qemu_chr_fe_write_all ?06:54
*** tvCommitBot has joined #timvideos06:55
tvCommitBot[linux-litex] mithro force-pushed master from 70a7cdd to 65b7fd0:
tvCommitBotlinux-litex/master 33a194f Tim 'mithro' Ansell: Hacks Hacks Hacks - SD Card via SPI GPIO + GPIO MMIO kind of works though.06:55
tvCommitBotlinux-litex/master 65b7fd0 Tim 'mithro' Ansell: Working maybe?06:55
*** tvCommitBot has left #timvideos06:55
futarisIRCcloudThe bytes don't all get through.06:55
futarisIRCcloudIf you check the result of fe_write_all, it'll fail..06:56
futarisIRCcloudI linked to this yesterday, I think:06:58
tpbTitle: [Qemu-devel] [PATCH 0/5] Global fix / workaround usage of qemu_chr_fe_wr (at
mithrofutarisIRCcloud: I'm never getting a failure on that....07:00
futarisIRCcloudWhoops. I mean if it is qemu_chr_fe_write() ... _all doesn't block, it just drops bytes.07:01
tpbTitle: Snippet | IRCCloud (at
futarisIRCcloudI've almost got the fe_write() changes from serial implemented.07:05
*** tvCommitBot has joined #timvideos07:10
tvCommitBot[qemu-litex] mithro pushed 1 new commit to linux-hacks:
tvCommitBotqemu-litex/linux-hacks f8521ea Tim 'mithro' Ansell: litex-uart: Error checking of qemu_chr_fe_write_all07:10
*** tvCommitBot has left #timvideos07:10
futarisIRCcloudr != 1 && r != 0 ???07:12
mithro Returns: the number of bytes consumed (0 if no assicated CharDriver)07:12
mithroSince we only ever send one byte07:12
mithror == 0 and r == 1 are okay07:13
futarisIRCcloudSomething is still broken. Even after the patch.07:18
mithroI don't know why you think it is dropping characters?07:19
futarisIRCcloudBecause it's not giving me the "Welcome to Buildroot" - only "Welcom" .07:20
futarisIRCcloudIf you're not attaching an initramfs, you might not see this.07:20
mithrofutarisIRCcloud: Hit enter?07:20
mithrofutarisIRCcloud: Your tx code in the uart driver still needs work07:21
futarisIRCcloudYeah, uart tx is still broken07:21
mithrofutarisIRCcloud: in the Linux code, not qemu07:22
futarisIRCcloudYeah, linux code is still broken.07:23
mithroIf you hit enter, you will see the "e to Buildroot\n buildroot login:" appear07:24
tpbTitle: Snippet | IRCCloud (at
mithrofutarisIRCcloud: That is what I get when I hit enter07:27
futarisIRCcloudOk. I'm reverting to whats in HEAD, and recompiling... The tx work isn't completing.07:29
*** tvCommitBot has joined #timvideos07:31
tvCommitBot[linux-litex] mithro pushed 1 new commit to master:
tvCommitBotlinux-litex/master 0fa4ce2 Tim 'mithro' Ansell: Fixing the non-ISR TX function.07:31
*** tvCommitBot has left #timvideos07:31
mithroWhat is the buildroot default login/password?07:40
futarisIRCcloudStill behaves the same. Not sure why you took the spin_lock / unlock out.07:40
futarisIRCcloudno password07:41
futarisIRCcloudI wonder if my buildroot linux kernel .config is an issue. Are you using the .config from linux-litex ?07:43
futarisIRCcloudHmm. try return TIOCSER_TEMT; in uart_tx_empty() ...07:45
futarisIRCcloudreturn 0; causes it to slow down.07:45
mithroWhich way around?07:48
mithroTIOCSER_TEMT when the TX is not empty?07:48
futarisIRCcloud return TIOCSER_TEMT;07:49
futarisIRCcloudsince we don't implement a TX FIFO anyway.07:49
mithrofutarisIRCcloud: So, the litex_uart_receive doesn't seem to be triggering user space...07:49
futarisIRCcloudAre we getting into tty_insert_flip_char ?07:50
futarisIRCcloudAre we still stuck in the ISR?07:51
mithroNo, the IRQs seem to be working fine07:52
futarisIRCcloudI don't get past fifo_wr_idx: 1. No breakpoint.07:53
mithrofutarisIRCcloud: Are you on the linux-hacks branch for qemu?07:55
*** tvCommitBot has joined #timvideos07:55
tvCommitBot[linux-litex] mithro pushed 2 new commits to master:
tvCommitBotlinux-litex/master 7661af4 Tim 'mithro' Ansell: Trying to get receive working.07:55
tvCommitBotlinux-litex/master ba6fe84 Tim 'mithro' Ansell: Disable sd card for the moment.07:55
*** tvCommitBot has left #timvideos07:55
futarisIRCcloudYes. I'm just adding a printf again to pic_cpu.c07:56
tpbTitle: Snippet | IRCCloud (at
mithrofutarisIRCcloud: Which device tree are you using?07:57
futarisIRCcloudAdding the printf "fixes" it.07:57
futarisIRCcloudMy breakpoints show us stuck in the isr.07:58
futarisIRCcloudBut then again I modified uart_receive() which is probably breaking it.07:59
mithroWhen I ctrl-c in gdb I get cpuidle_idle_call07:59
futarisIRCcloudCommenting out the extra stat modifiers in uart_receive()08:01
mithrofutarisIRCcloud: If I try and put a breakpoint on the litex_uart_isr now qemu segfaults08:01
futarisIRCclouduart_rx correct?08:05
mithrofutarisIRCcloud: Well see above, I can see the characters in the printf...08:05
mithroI think I figured it out08:07
mithroFrustratingly it worked once08:10
mithroIt's working now08:10
mithrofutarisIRCcloud: Pushing...08:11
*** tvCommitBot has joined #timvideos08:11
tvCommitBot[linux-litex] mithro pushed 1 new commit to master:
tvCommitBotlinux-litex/master 5410f26 Tim 'mithro' Ansell: Kind of working.08:11
*** tvCommitBot has left #timvideos08:11
mithrofutarisIRCcloud: I can login with that patch08:12
futarisIRCcloudOk. Trying now.08:12
mithrofutarisIRCcloud: linux-litex == 5410f26c68581a25f48a6e202b59dfe444183281, qemu-litex == 5e75055810e12e2b86b0408d5c725f37b9e56a3008:14
futarisIRCcloudYep. Works for me.  I can remove my printf from pic_cpu too..08:18
futarisIRCcloudIf the TXFULL stuff is correct, it'll probably work on real hardware, but I suspect the timers will be out.08:21
futarisIRCcloudtime: clock_gettime(MONOTONIC) failed .08:24
mithroI'm unclear if the or1k timer stuff exists in real hardware - we have our own timer implementation08:27
futarisIRCcloudcat /proc/interrupts seems to be fine for litex_uart too.08:27
futarisIRCcloudYou don't use the SPR_TTMR on openrisc?08:29
tpbTitle: litex/ at master · enjoy-digital/litex · GitHub (at
mithroCheck the options08:32
tpbTitle: litex/ at master · enjoy-digital/litex · GitHub (at
mithroI think that disables the timer08:33
tpbTitle: mor1kx/mor1kx_ctrl_cappuccino.v at 69b97fcb43b35d6c6639ecc68e63d912c09ee8da · openrisc/mor1kx · GitHub (at
futarisIRCcloudLooks like it from looking at the VHDL.08:36
futarisIRCcloudkernel/time.c is the relevant stuff in the linux kernel.08:36
futarisIRCcloudSection 14 of openrisc-arch-1.1-rev0.pdf ...08:37
futarisIRCcloudYou should at least get "Linux not supported on devices without tick timer"08:39
mithrofutarisIRCcloud: Do you want to see if you can get a timer driver going?08:52
futarisIRCcloudWhere is the initialisation code in the bare-metal firmware?09:02
mithrofutarisIRCcloud: In libbase which is part of litex I think?09:04
tpbTitle: litex/time.c at ab075f3d80881bc118c438f6e2684a1525a26d2f · enjoy-digital/litex · GitHub (at
mithrofutarisIRCcloud: I think we probably want some common helper functions for dealing with EV objects?09:07
tpbTitle: HDMI2USB-firmware-prebuilt/csr.h at master · timvideos/HDMI2USB-firmware-prebuilt · GitHub (at
futarisIRCcloudEV objects?09:08
mithroEventManager objects -- the thing which handles the IRQs in LiteX/MiSoC09:10
mithro It always consists of 3 CSR registers, "STATUS, PENDING, ENABLE"09:11
mithrofutarisIRCcloud: btw
tpbTitle: Figure out if we are using litex or or1k timer? · Issue #11 · timvideos/linux-litex · GitHub (at
mithrofutarisIRCcloud: Ohhh - maybe the reason you couldn't put the UART on interrupt zero is that the timer seems to be connected to that?09:21
tpbTitle: qemu/cpu.h at master · qemu/qemu · GitHub (at
futarisIRCcloudNot sure if the kernel wasn't allowing it, and/or qemu.09:24
Joelwmithro: Hi! No! I'm developing IoT stuff for a truck manufacturer in Japan09:40
mithroJoelw: Ahh well, I met someone building hardware for tracking small animals the other day09:41
JoelwAh interesting! Which company do they work for? Or privately?09:41
mithroJoelw: I think they are the company - some guy here in Sydney09:42
mithro_florent_: We have Linux pretty much booting on qemu or1k with litex based peripherals09:43
_florent_mithro: great! I'll try to reproduce that soon!09:46
mithro_florent_: Not yet attempted it on real hardware09:49
mithro_florent_: QQ While you are here - You were working on some SPI related stuff, did you improve the SPI master in litex at all?09:50
mithrofutarisIRCcloud: I'll put together a patch to disable the or1k timer in QEMU tomorrow probably09:51
mithroI'm probably going to call it a night shortly09:54
mithrofutarisIRCcloud: I'll probably also send my first qemu patches to the mailing list tomorrow, just want shorne to take one more look over them...09:56
futarisIRCcloudmithro: Ok. The linux drivers are fairly dirty at the moment (too).09:57
mithrofutarisIRCcloud: These are some minor or1k CPU patches - adding support for evbar and such09:58
mithro_florent_: I've also been merging the arty-soc into the HDMI2USB firmware because I want a small/portable Vivado based platform10:03
mithroAnyway, I'm calling it a night now10:04
mithroHave a good evening everyone!10:04
*** rohitksingh has joined #timvideos10:11
_florent_mithro: no but I should push the new version derived from the misoc one that I'm using now:11:47
tpbTitle: litejesd204b-ad9154-demo/ at master · enjoy-digital/litejesd204b-ad9154-demo · GitHub (at
tpbTitle: litejesd204b-ad9154-demo/ at master · enjoy-digital/litejesd204b-ad9154-demo · GitHub (at
*** sb0 has joined #timvideos12:25
*** rohitksingh has quit IRC12:45
*** rohitksingh has joined #timvideos12:48
*** cr1901_modern has joined #timvideos15:08
*** futarisIRCcloud has quit IRC16:52
*** rohitksingh has quit IRC18:34
*** f15h has joined #timvideos20:42
*** f15h has quit IRC23:49

Generated by 2.13.1 by Marius Gedminas - find it at!