--- Log opened Wed Jun 11 00:00:29 2014 | ||
stekern | heh, 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 controller | 06:01 |
---|---|---|
stekern | * (http://www.opencores.org/projects.cgi/web/i2c/overview). | 06:01 |
stekern | * | 06:01 |
stekern | * Peter Korsgaard <jacmet@sunsite.dk> | 06:01 |
stekern | * | 06:01 |
stekern | * Support for the GRLIB port of the controller by | 06:01 |
stekern | * Andreas Larsson <andreas@gaisler.com> | 06:01 |
stekern | * | 06:01 |
stekern | * This file is licensed under the terms of the GNU General Public License | 06:01 |
stekern | * version 2. This program is licensed "as is" without any warranty of any | 06: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 |
stekern | struct ocores_i2c { | 06:02 |
stekern | void __iomem *base; | 06:02 |
stekern | u32 reg_shift; | 06:02 |
stekern | u32 reg_io_width; | 06:02 |
stekern | wait_queue_head_t wait; | 06:02 |
stekern | struct i2c_adapter adap; | 06:02 |
stekern | struct i2c_msg *msg; | 06:02 |
stekern | int pos; | 06:02 |
stekern | int nmsgs; | 06:02 |
stekern | int state; /* see STATE_ */ | 06:02 |
stekern | int clock_khz; | 06:02 |
stekern | void (*setreg)(struct ocores_i2c *i2c, int reg, u8 value); | 06:03 |
stekern | u8 (*getreg)(struct ocores_i2c *i2c, int reg); | 06:03 |
stekern | }; | 06:03 |
stekern | /* registers */ | 06:03 |
stekern | #define OCI2C_PRELOW0 | 06:03 |
stekern | #define OCI2C_PREHIGH1 | 06:03 |
stekern | #define OCI2C_CONTROL2 | 06:03 |
stekern | #define OCI2C_DATA3 | 06: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_IEN0x40 | 06:03 |
stekern | #define OCI2C_CTRL_EN0x80 | 06:03 |
stekern | #define OCI2C_CMD_START0x91 | 06:03 |
stekern | #define OCI2C_CMD_STOP0x41 | 06:03 |
stekern | #define OCI2C_CMD_READ0x21 | 06:03 |
stekern | #define OCI2C_CMD_WRITE0x11 | 06:03 |
stekern | #define OCI2C_CMD_READ_ACK0x21 | 06:03 |
stekern | #define OCI2C_CMD_READ_NACK0x29 | 06:03 |
stekern | #define OCI2C_CMD_IACK0x01 | 06:03 |
stekern | #define OCI2C_STAT_IF0x01 | 06:03 |
stekern | #define OCI2C_STAT_TIP0x02 | 06:03 |
stekern | #define OCI2C_STAT_ARBLOST0x20 | 06:03 |
stekern | #define OCI2C_STAT_BUSY0x40 | 06:03 |
stekern | #define OCI2C_STAT_NACK0x80 | 06:03 |
stekern | #define STATE_DONE0 | 06:04 |
stekern | #define STATE_START1 | 06:04 |
stekern | #define STATE_WRITE2 | 06:04 |
stekern | #define STATE_READ3 | 06:04 |
stekern | #define STATE_ERROR4 | 06:04 |
stekern | #define TYPE_OCORES0 | 06:04 |
stekern | #define TYPE_GRLIB1 | 06:04 |
stekern | static void oc_setreg_8(struct ocores_i2c *i2c, int reg, u8 value) | 06:04 |
stekern | { | 06:04 |
stekern | iowrite8(value, i2c->base + (reg << i2c->reg_shift)); | 06:04 |
stekern | } | 06:04 |
stekern | static 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 |
stekern | } | 06:04 |
stekern | static void oc_setreg_32(struct ocores_i2c *i2c, int reg, u8 value) | 06:04 |
stekern | { | 06:04 |
stekern | iowrite32(value, i2c->base + (reg << i2c->reg_shift)); | 06:04 |
stekern | } | 06:04 |
stekern | static inline u8 oc_getreg_8(struct ocores_i2c *i2c, int reg) | 06:04 |
stekern | { return ioread8(i2c->base + (reg << i2c->reg_shift)); | 06:04 |
stekern | } | 06:04 |
stekern | static inline u8 oc_getreg_16(struct ocores_i2c *i2c, int reg) | 06:04 |
stekern | oops.... | 06:04 |
stekern | gems like this: http://git.openrisc.net/cgit.cgi/jonas/linux/tree/drivers/char/scet.c | 06:04 |
stekern | I have no idea what that supposed to do, where it comes from and why it has been added | 06:05 |
olofk | stekern: Looks a bit like a modified example or something | 07:43 |
olofk | stekern: Hmm... I find traces of some scet module in orpsoc as well http://opencores.org/websvn,filedetails?repname=openrisc&path=%2Fopenrisc%2Ftrunk%2Forpsocv2%2Fboards%2Factel%2Fordb1a3pe1500%2Fsyn%2Fsynplify%2Fbin%2FMakefile&rev=415 | 07:47 |
olofk | Could 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: https://github.com/fjullien/linux/commit/07818d6a8f1426ab4f262036f1cb1e9565dcd0d5 | 08:16 |
_franck__ | ocfb.c :https://github.com/fjullien/linux/commit/afa480f0b5b517fbbe1277019dab4096f9b91686 | 08:16 |
stekern | _franck__: that looks good I think, you can send that off as a patch | 08:46 |
stekern | put the fbdev maintainers on cc, and the fbdev list | 08:46 |
stekern | oh, and put me on cc as well ;) | 08:48 |
stekern | olofk: maybe, but what does it do? | 08:48 |
olofk | cd SCan for Extra Terrestials? | 08:52 |
olofk | -cd | 08:52 |
olofk | I want to compile a linux kernel. Haven't done that for quite some time. Are the instructions at http://opencores.org/or1k/Linux valid? | 08:55 |
olofk | Specifically 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 kernel | 09:08 |
_franck__ | olofk: you can use or1k-elf if you do that: https://github.com/fjullien/linux/commit/0c49b3f4afbbee34e66b8fdadbe5833a59a60f23 | 09:15 |
_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 |
stekern | olofk: if you want some inspiration, I did that in orpsocv2 | 10:22 |
stekern | http://git.openrisc.net/cgit.cgi/stefan/orpsoc/tree/boards/xilinx/atlys/rtl/verilog/fdt/fdt.v | 10:23 |
_franck_ | anyone knows where upstream sources of mkimage are ? | 10:23 |
_franck_ | I'd like to add openrisc target in it | 10:23 |
stekern | isn'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 |
stekern | right | 10:29 |
olofk | stekern: 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 |
olofk | and is the upstream kernel usable for OpenRISC nowadays? I have no explicit need for SMP and atomics atm | 12:09 |
olofk | Ahh.. but I would need a separate busybox for initramfs then. | 12:11 |
olofk | But 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 repo | 12:15 |
olofk | Ah cool. Good idea | 12:16 |
olofk | And 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 Kernel | 12:19 |
olofk | hmm | 12:19 |
_franck__ | I just did that 2 days ago | 12:19 |
olofk | So 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 busybox | 12:20 |
_franck__ | we don't need that anymore in the kernel | 12:20 |
olofk | but if I use Jonas' kernel and busybox, then it's ok for now? | 12:21 |
_franck__ | yes | 12:22 |
olofk | stekern: 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 seconds | 12:33 |
olofk | Using mor1kx-generic and supplying the kernel with --elf-load | 12:34 |
olofk | whoops... maybe I shouldn't have removed the device tree to begin with :) | 12:40 |
olofk | hmm... that wasn't it | 12:41 |
olofk | Works in icarus now with a little hack to clear the rf before starting the sim | 12:49 |
ysionneau | funny, I had the same kind of issue with iverilog and Isim with lm32 | 12:50 |
ysionneau | I needed to add initialization of register file | 12:50 |
ysionneau | else it was all 'xxx' | 12:50 |
olofk | Yes. 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 it | 12:55 |
olofk | _franck__: I got way too many boards. Just haven't finished my fusesoc ports yet :) | 12:56 |
_franck__ | ok | 12:56 |
olofk | What's the console_unlock function in the kernel? | 13:03 |
olofk | Looks like my simulation is spinning around in there | 13:03 |
olofk | Is that after the boot is complete? | 13:04 |
olofk | ok... that was a bit optimistic. I'm still somewhere in the first printk :) | 13:24 |
olofk | I'll let it run for a few hours | 13:25 |
olofk | Has anyone tried the UART in mor1kx-generic with Icarus btw? | 13:25 |
olofk | I 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 there | 14:16 |
stekern | ysionneau: 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 have | 14:21 |
stekern | we can pass the fdt, which can contain bootargs | 14:22 |
stekern | my original patch for that had the bootargs in r3 and fdt in r4, but Jonas wanted to keep it fdt only | 14:22 |
_franck__ | well, but if you want to pass some args from your bootloader for testing you don't want to generate your devitree everytime | 14:23 |
stekern | in u-boot it's simple to regenerate the device-tree | 14:23 |
stekern | from what I've heard, in barebox as well | 14:23 |
_franck__ | I know it can edit it | 14:23 |
_franck__ | ok, it's going to stay like this | 14:24 |
stekern | there's another reason, the bootargs parsing in the kernel became a bit messier as well iirc, if they can come from two sources | 14:25 |
stekern | olofk: is there 32MB of memory in the upstream mor1kx-generic? | 14:40 |
olofk | stekern: I think so | 15:45 |
olofk | But I increased it some more to be safe | 15:46 |
olofk | Haven't checked wb_intercon though...hmm.. | 15:46 |
olofk | ah no. That one says 8MB | 15:47 |
olofk | Maybe wb_intercon should output size and offset as parameters in the .vh file, so that the top-level can pick those up | 15:48 |
olofk | Having mor1kx-generic default to 32MB would be good as well | 15:51 |
olofk | Same 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 file | 15:51 |
stekern | yes, I have a set of patches (including setting ram to 32) that needs to be pushed | 16:12 |
stekern | it's just that I constantly through ugly hacks into orpsoc_top.v and tb.cpp, so I never get around to it :( | 16:26 |
stekern | so, iow... if you now have a nice clean 32MB patch, push it! ;) | 16:27 |
olofk | Hmmm... not sure what's going on here even after looking at the vcd | 19:34 |
olofk | It is supposed to jal to a function, but it just stops | 19:42 |
stekern | that doesn't sound useful | 19:52 |
stekern | can you give me your vmlinux? | 19:53 |
olofk | Sure | 19:58 |
olofk | I have dug a little deeper now and there are some conflicts in the waveforms | 19:59 |
olofk | Around icache. Haven't found out the root cause yet though. Doesn't seem to get anything strange on iwb or dwb | 19:59 |
olofk | https://www.dropbox.com/s/cs9k22jqm3jj1ok/vmlinux | 20:04 |
olofk | Think I got it | 20:08 |
olofk | Might need to clear itlb_translate_regs as well | 20:08 |
_franck_ | hmm, upstrem kernel crash after some time | 20:19 |
olofk | It's not hanging anymore, but spinning around in memset. Maybe that's normal | 20: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 it | 20:32 |
stekern | I'm sifting through 740 commits right now ;) | 20:32 |
stekern | I've narrowed them down to ~400 | 20:32 |
_franck_ | ok, then I let you work | 20:33 |
stekern | I'm doing it more manually than necessary, it's interesting poking around in the history too | 20:33 |
olofk | Oh 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 |
stekern | but _franck_, at least this one is missing in upstream: http://git.openrisc.net/cgit.cgi/jonas/linux/commit/?h=master-next&id=ee49d953576d9b65ce858077ac407ef2f1a5996e | 20:36 |
olofk | Yes!!!! | 20:37 |
olofk | http://aaa33b919c8e7a63.paste.se/ | 20:39 |
--- 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 secs | 20:40 | |
olofk | Needed to clear the dpram for the immu as well | 20:40 |
stekern | in verilator? | 20:40 |
olofk | No, Icarus :) | 20:41 |
stekern | oh... | 20:41 |
olofk | Just sucks that I haven't gotten around to implement any input | 20:41 |
stekern | hey... what does your significant other say about being at samanthafox? | 20:41 |
olofk | She named her actually :) | 20:42 |
olofk | I just booted the same kernel in or1ksim to see how far I am.... still got a bit to go :( | 20:43 |
stekern | hehe, get your verilator swinging | 20:43 |
olofk | Naahh... I'll rerun it without --vcd and --trace_enable instead. Not likely to go through 19GB VCD or 166MB trace logs anyway | 20:45 |
olofk | Well, trace logs could be nice of course | 20:45 |
olofk | Shouldn't those dpram in immu really be cleared? | 20:47 |
olofk | For FPGA it's ok of course | 20:47 |
stekern | the assumption is that sw shall clear them before turning on the IMMU | 20:49 |
stekern | but I don't think the kernel does it properly, it only clears one of the dprams | 20:50 |
stekern | in real hw, that's always enough though, since everything else is don't care if that one is clear | 20:50 |
olofk | ah ok | 20:55 |
jtdesousa | _franck__ thanks for the suggestions for my openocd patch | 21:58 |
--- Log closed Thu Jun 12 00:00:30 2014 |
Generated by irclog2html.py 2.15.2 by Marius Gedminas - find it at mg.pov.lt!