IRC logs for #openrisc Wednesday, 2014-06-11

--- Log opened Wed Jun 11 00:00:29 2014
stekernheh, I want to get an oversight over the differences between jonas linux tree and mainline, so I'm rebasing his tree. In the process I find gems like this: /* * i2c-ocores.c: I2C bus driver for OpenCores I2C controller06:01
stekern * (
stekern *06:01
stekern * Peter Korsgaard <>06:01
stekern *06:01
stekern * Support for the GRLIB port of the controller by06:01
stekern * Andreas Larsson <>06:01
stekern *06:01
stekern * This file is licensed under the terms of the GNU General Public License06:01
stekern * version 2.  This program is licensed "as is" without any warranty of any06:01
stekern * kind, whether express or implied.06:01
stekern */06:02
stekern#include <linux/err.h>06:02
stekern#include <linux/kernel.h>06:02
stekern#include <linux/module.h>06:02
stekern#include <linux/errno.h>06:02
stekern#include <linux/platform_device.h>06:02
stekern#include <linux/i2c.h>06:02
stekern#include <linux/interrupt.h>06:02
stekern#include <linux/wait.h>06:02
stekern#include <linux/i2c-ocores.h>06:02
stekern#include <linux/slab.h>06:02
stekern#include <linux/io.h>06:02
stekern#include <linux/log2.h>06:02
stekernstruct ocores_i2c {06:02
stekernvoid __iomem *base;06:02
stekernu32 reg_shift;06:02
stekernu32 reg_io_width;06:02
stekernwait_queue_head_t wait;06:02
stekernstruct i2c_adapter adap;06:02
stekernstruct i2c_msg *msg;06:02
stekernint pos;06:02
stekernint nmsgs;06:02
stekernint state; /* see STATE_ */06:02
stekernint clock_khz;06:02
stekernvoid (*setreg)(struct ocores_i2c *i2c, int reg, u8 value);06:03
stekernu8 (*getreg)(struct ocores_i2c *i2c, int reg);06:03
stekern/* registers */06:03
stekern#define OCI2C_PRELOW006:03
stekern#define OCI2C_PREHIGH106:03
stekern#define OCI2C_CONTROL206:03
stekern#define OCI2C_DATA306:03
stekern#define OCI2C_CMD4 /* write only */06:03
stekern#define OCI2C_STATUS4 /* read only, same address as OCI2C_CMD */06:03
stekern#define OCI2C_CTRL_IEN0x4006:03
stekern#define OCI2C_CTRL_EN0x8006:03
stekern#define OCI2C_CMD_START0x9106:03
stekern#define OCI2C_CMD_STOP0x4106:03
stekern#define OCI2C_CMD_READ0x2106:03
stekern#define OCI2C_CMD_WRITE0x1106:03
stekern#define OCI2C_CMD_READ_ACK0x2106:03
stekern#define OCI2C_CMD_READ_NACK0x2906:03
stekern#define OCI2C_CMD_IACK0x0106:03
stekern#define OCI2C_STAT_IF0x0106:03
stekern#define OCI2C_STAT_TIP0x0206:03
stekern#define OCI2C_STAT_ARBLOST0x2006:03
stekern#define OCI2C_STAT_BUSY0x4006:03
stekern#define OCI2C_STAT_NACK0x8006:03
stekern#define STATE_DONE006:04
stekern#define STATE_START106:04
stekern#define STATE_WRITE206:04
stekern#define STATE_READ306:04
stekern#define STATE_ERROR406:04
stekern#define TYPE_OCORES006:04
stekern#define TYPE_GRLIB106:04
stekernstatic void oc_setreg_8(struct ocores_i2c *i2c, int reg, u8 value)06:04
stekerniowrite8(value, i2c->base + (reg << i2c->reg_shift));06:04
stekernstatic void oc_setreg_16(struct ocores_i2c *i2c, int reg, u8 value)06:04
stekern{ iowrite16(value, i2c->base + (reg << i2c->reg_shift));06:04
stekernstatic void oc_setreg_32(struct ocores_i2c *i2c, int reg, u8 value)06:04
stekerniowrite32(value, i2c->base + (reg << i2c->reg_shift));06:04
stekernstatic inline u8 oc_getreg_8(struct ocores_i2c *i2c, int reg)06:04
stekern{ return ioread8(i2c->base + (reg << i2c->reg_shift));06:04
stekernstatic inline u8 oc_getreg_16(struct ocores_i2c *i2c, int reg)06:04
stekerngems like this:
stekernI have no idea what that supposed to do, where it comes from and why it has been added06:05
olofkstekern: Looks a bit like a modified example or something07:43
olofkstekern: Hmm... I find traces of some scet module in orpsoc as well,filedetails?repname=openrisc&path=%2Fopenrisc%2Ftrunk%2Forpsocv2%2Fboards%2Factel%2Fordb1a3pe1500%2Fsyn%2Fsynplify%2Fbin%2FMakefile&rev=41507:47
olofkCould it be something for TechEdSat perhaps?07:53
_franck__stekern: I added dts features to your ocfb.c driver. I kept the module argument and if it's not here it takes timings from dts:
_franck__ocfb.c :
stekern_franck__: that looks good I think, you can send that off as a patch08:46
stekernput the fbdev maintainers on cc, and the fbdev list08:46
stekernoh, and put me on cc as well ;)08:48
stekernolofk: maybe, but what does it do?08:48
olofkcd SCan for Extra Terrestials?08:52
olofkI want to compile a linux kernel. Haven't done that for quite some time. Are the instructions at valid?08:55
olofkSpecifically this : make CROSS_COMPILER=or32-linux-08:55
olofk...and can I disable the built-in device tree? I want o experiment with embedding it in a wb_ram and use a generic kernel09:08
_franck__olofk: you can use or1k-elf if you do that:
_franck__and if you set "Builtin DTB" to nothing, you can pass your device-tree address to the Kernel via r3 (I never tested this)09:19
stekernolofk: if you want some inspiration, I did that in orpsocv210:22
_franck_anyone knows where upstream sources of mkimage are ?10:23
_franck_I'd like to add openrisc target in it10:23
stekernisn't it in u-boot?10:24
stekern(so openrisc is already in the upstream)10:24
_franck_oh you're right, in tools/10:25
_franck_so we just have to wait 5 years un tils it gets in our favrorite distribution ;)10:25
olofkstekern: Cool. That should be quite similar to what I was looking for. I guess it works just fine to have external dtb then?12:08
olofkand is the upstream kernel usable for OpenRISC nowadays? I have no explicit need for SMP and atomics atm12:09
olofkAhh.. but I would need a separate busybox for initramfs then.12:11
olofkBut I guess it's not impossible to build my own initramfs. Any good guides for that?12:12
_franck__you can copy the arch/openrisc/support directory from jonas repo to your vanilla repo12:15
olofkAh cool. Good idea12:16
olofkAnd it's enough to just set Cross-compiler tool prefix to or1k-elf- and then make ARCH=openrisc defconfig && make ?12:17
_franck__yes. However, the busybox we have in current Jonas repo depends on syscalls only present in that Kernel12:19
_franck__I just did that 2 days ago12:19
olofkSo are those syscalls meant to be upstreamed?12:19
_franck__so to make it works you need to compile le latest uClibc toolchain and recompile busybox12:20
_franck__we don't need that anymore in the kernel12:20
olofkbut if I use Jonas' kernel and busybox, then it's ok for now?12:21
olofkstekern: You've been running a few verilator sims lately, right? I tried to run my freshly baked kernel, but it exited with NOP_EXIT after a few seconds12:33
olofkUsing mor1kx-generic and supplying the kernel with --elf-load12:34
olofkwhoops... maybe I shouldn't have removed the device tree to begin with :)12:40
olofkhmm... that wasn't it12:41
olofkWorks in icarus now with a little hack to clear the rf before starting the sim12:49
ysionneaufunny, I had the same kind of issue with iverilog and Isim with lm3212:50
ysionneauI needed to add initialization of register file12:50
ysionneauelse it was all 'xxx'12:50
olofkYes. Lot's of porn in those simulations :)12:51
_franck__olofk: you still don't have a real board ? I can lend you a de2-70 if you want, I don't use it12:55
olofk_franck__: I got way too many boards. Just haven't finished my fusesoc ports yet :)12:56
olofkWhat's the console_unlock function in the kernel?13:03
olofkLooks like my simulation is spinning around in there13:03
olofkIs that after the boot is complete?13:04
olofkok... that was a bit optimistic. I'm still somewhere in the first printk :)13:24
olofkI'll let it run for a few hours13:25
olofkHas anyone tried the UART in mor1kx-generic with Icarus btw?13:25
olofkI have a distinct feeling that this simulation won't proceed any further. May be it's time to investigate why console_unlock is so interesting so the simulation wants to stay there14:16
stekernysionneau: but the verilator sims initiate everything to 0 (i.e., x doesn't exist there)14:20
_franck__can't we pass bootargs to the kernel via GPR ? that would be good to have14:21
stekernwe can pass the fdt, which can contain bootargs14:22
stekernmy original patch for that had the bootargs in r3 and fdt in r4, but Jonas wanted to keep it fdt only14:22
_franck__well, but if you want to pass some args from your bootloader for testing you don't want to generate your devitree everytime14:23
stekernin u-boot it's simple to regenerate the device-tree14:23
stekernfrom what I've heard, in barebox as well14:23
_franck__I know it can edit it14:23
_franck__ok, it's going to stay like this14:24
stekernthere's another reason, the bootargs parsing in the kernel became a bit messier as well iirc, if they can come from two sources14:25
stekernolofk: is there 32MB of memory in the upstream mor1kx-generic?14:40
olofkstekern: I think so15:45
olofkBut I increased it some more to be safe15:46
olofkHaven't checked wb_intercon though...hmm..15:46
olofkah no. That one says 8MB15:47
olofkMaybe wb_intercon should output size and offset as parameters in the .vh file, so that the top-level can pick those up15:48
olofkHaving mor1kx-generic default to 32MB would be good as well15:51
olofkSame thing with or1ksim. We should increase default mem to 32MB and perhaps make some more sensible defaults so that we can run linux without a config file15:51
stekernyes, I have a set of patches (including setting ram to 32) that needs to be pushed16:12
stekernit's just that I constantly through ugly hacks into orpsoc_top.v and tb.cpp, so I never get around to it :(16:26
stekernso, iow... if you now have a nice clean 32MB patch, push it! ;)16:27
olofkHmmm... not sure what's going on here even after looking at the vcd19:34
olofkIt is supposed to jal to a function, but it just stops19:42
stekernthat doesn't sound useful19:52
stekerncan you give me your vmlinux?19:53
olofkI have dug a little deeper now and there are some conflicts in the waveforms19:59
olofkAround icache. Haven't found out the root cause yet though. Doesn't seem to get anything strange on iwb or dwb19:59
olofkThink I got it20:08
olofkMight need to clear itlb_translate_regs as well20:08
_franck_hmm, upstrem kernel crash after some time20:19
olofkIt's not hanging anymore, but spinning around in memset. Maybe that's normal20:24
_franck_stekern: you told us "I want to get an oversight over the differences between jonas linux tree and mainline"20:31
_franck_did you find something ?20:31
stekern_franck_: yes, I'm onto it20:32
stekernI'm sifting through 740 commits right now ;)20:32
stekernI've narrowed them down to ~40020:32
_franck_ok, then I let you work20:33
stekernI'm doing it more manually than necessary, it's interesting poking around in the history too20:33
olofkOh for fuck sake Linux. Didn't you just spend a few million cycles in memset? Why did you have to go back there again?20:34
stekernbut _franck_, at least this one is missing in upstream:
--- Log closed Wed Jun 11 20:39:53 2014
--- Log opened Wed Jun 11 20:40:16 2014
-!- Irssi: #openrisc: Total of 40 nicks [0 ops, 0 halfops, 0 voices, 40 normal]20:40
-!- Irssi: Join to #openrisc was synced in 22 secs20:40
olofkNeeded to clear the dpram for the immu as well20:40
stekernin verilator?20:40
olofkNo, Icarus :)20:41
olofkJust sucks that I haven't gotten around to implement any input20:41
stekernhey... what does your significant other say about being at samanthafox?20:41
olofkShe named her actually :)20:42
olofkI just booted the same kernel in or1ksim to see how far I am.... still got a bit to go :(20:43
stekernhehe, get your verilator swinging20:43
olofkNaahh... I'll rerun it without --vcd and --trace_enable instead. Not likely to go through 19GB VCD or 166MB trace logs anyway20:45
olofkWell, trace logs could be nice of course20:45
olofkShouldn't those dpram in immu really be cleared?20:47
olofkFor FPGA it's ok of course20:47
stekernthe assumption is that sw shall clear them before turning on the IMMU20:49
stekernbut I don't think the kernel does it properly, it only clears one of the dprams20:50
stekernin real hw, that's always enough though, since everything else is don't care if that one is clear20:50
olofkah ok20:55
jtdesousa_franck__ thanks for the suggestions for my openocd patch21:58
--- Log closed Thu Jun 12 00:00:30 2014

Generated by 2.15.2 by Marius Gedminas - find it at!