Re: porting OpenBSD to Ox64

2024-03-25 Thread Peter J. Philipp

[CC'ed to Kettenis in case he doesn't read misc@]

On 3/24/24 20:43, Peter J. Philipp wrote:



On 3/24/24 14:09, Slava Voronzoff wrote:

On Fri, 22 Mar 2024 04:28:15 +0100
"Peter J. Philipp"  wrote:

  

No I didn't try a newer OBSD, I will soon though. :-)  And no I didn't
change anything in the DTB.

While this is an EXTREMELY dirty attempt to add it can you try somehow this 
patch for OpenBS-current kernel?
OR try to decompile dtb, edit dts file to change "bflb,bl808-uart" to something 
supported generic like ns16550a, recompile it back to dtb and load from OpenBSD's boot 
loader

Index: sys/dev/fdt/com_fdt.c
===
RCS file: /cvs/src/sys/dev/fdt/com_fdt.c,v
retrieving revision 1.9
diff -u -p -r1.9 com_fdt.c
--- sys/dev/fdt/com_fdt.c   31 Jan 2024 01:01:10 -  1.9
+++ sys/dev/fdt/com_fdt.c   24 Mar 2024 13:04:37 -
@@ -59,7 +59,8 @@ com_fdt_init_cons(void)
(node = fdt_find_cons("ns16550a")) == NULL &&
(node = fdt_find_cons("snps,dw-apb-uart")) == NULL &&
(node = fdt_find_cons("ti,omap3-uart")) == NULL &&
-   (node = fdt_find_cons("ti,omap4-uart")) == NULL)
+   (node = fdt_find_cons("ti,omap4-uart")) == NULL &&
+   (node = fdt_find_cons("bflb,bl808-uart")) == NULL)
return;
if (fdt_get_reg(node, 0, ))
return;
@@ -101,7 +102,8 @@ com_fdt_match(struct device *parent, voi
OF_is_compatible(faa->fa_node, "ns16550a") ||
OF_is_compatible(faa->fa_node, "snps,dw-apb-uart") ||
OF_is_compatible(faa->fa_node, "ti,omap3-uart") ||
-   OF_is_compatible(faa->fa_node, "ti,omap4-uart"));
+   OF_is_compatible(faa->fa_node, "ti,omap4-uart") ||
+   OF_is_compatible(faa->fa_node, "bflb,bl808-uart"));
  }
  
  void




Hi,

I don't know if it's so simple... but I just finished a bflbuart.c

driver. It is based on the sfuart.c driver and I used the

linux sources, and the bl808 reference manual to guide me.

https://github.com/pbug44/openbsd-src/commit/996f961786d17399d68ef8aef547a10ef22ca82b

However I noticed that there is no PLIC/INTR activity. Does

anyone know if this is due to no clock driver? If so that's

my next thing to do unless someone beats me to it. I have

another question. I added the bflbuart to the files.riscv64

and the Makefile doesn't update in 
/sys/arch/riscv64/compile/RAMDISK/obj/Makefile.. I don't know what I 
have to do it..for


now I manually updated this file.

Please excuse for the weird formatting. I'm still on thunderbird on 
OpenBSD and I'm not fully comfy with it.


Best Regards,

-pjp



Just a small update, this morning I wrote another driver bflbtimer.c 
based on sxitimer.c.  However there is no interrupts. But I'm glad to 
say that I possibly found the problem.  It's another T-HEAD problem and 
this time it's got to do with Strong-Ordering on mapping data, and the 
Ox64, which seems to be a little bit more strict than the Mango Pi.  To 
do this though the SBI needs to be recompiled and reflashed, I was going 
to do this anyhow but now I'm forced to.  Here is some developer from 
NUTTX documenting his work, which I gladly will learn from.


https://lupyuen.github.io/articles/plic3#enable-strong-order

I'm CC'ing this to Mark Kettenis in case he wanted to be informed on 
this.  Eventually I may even boot into an Ox64 by end of April!  I have 
my hopes up. :-)


Best Regards,

-pjp

--
*** I used to sign with -peter, but noticed it's not unique, -pjp may come up 
in the future, so please adjust for that ***


Re: porting OpenBSD to Ox64

2024-03-24 Thread Peter J. Philipp


On 3/24/24 14:09, Slava Voronzoff wrote:

On Fri, 22 Mar 2024 04:28:15 +0100
"Peter J. Philipp"  wrote:

  

No I didn't try a newer OBSD, I will soon though. :-)  And no I didn't
change anything in the DTB.

While this is an EXTREMELY dirty attempt to add it can you try somehow this 
patch for OpenBS-current kernel?
OR try to decompile dtb, edit dts file to change "bflb,bl808-uart" to something 
supported generic like ns16550a, recompile it back to dtb and load from OpenBSD's boot 
loader

Index: sys/dev/fdt/com_fdt.c
===
RCS file: /cvs/src/sys/dev/fdt/com_fdt.c,v
retrieving revision 1.9
diff -u -p -r1.9 com_fdt.c
--- sys/dev/fdt/com_fdt.c   31 Jan 2024 01:01:10 -  1.9
+++ sys/dev/fdt/com_fdt.c   24 Mar 2024 13:04:37 -
@@ -59,7 +59,8 @@ com_fdt_init_cons(void)
(node = fdt_find_cons("ns16550a")) == NULL &&
(node = fdt_find_cons("snps,dw-apb-uart")) == NULL &&
(node = fdt_find_cons("ti,omap3-uart")) == NULL &&
-   (node = fdt_find_cons("ti,omap4-uart")) == NULL)
+   (node = fdt_find_cons("ti,omap4-uart")) == NULL &&
+   (node = fdt_find_cons("bflb,bl808-uart")) == NULL)
return;
if (fdt_get_reg(node, 0, ))
return;
@@ -101,7 +102,8 @@ com_fdt_match(struct device *parent, voi
OF_is_compatible(faa->fa_node, "ns16550a") ||
OF_is_compatible(faa->fa_node, "snps,dw-apb-uart") ||
OF_is_compatible(faa->fa_node, "ti,omap3-uart") ||
-   OF_is_compatible(faa->fa_node, "ti,omap4-uart"));
+   OF_is_compatible(faa->fa_node, "ti,omap4-uart") ||
+   OF_is_compatible(faa->fa_node, "bflb,bl808-uart"));
  }
  
  void




Hi,

I don't know if it's so simple... but I just finished a bflbuart.c

driver. It is based on the sfuart.c driver and I used the

linux sources, and the bl808 reference manual to guide me.

https://github.com/pbug44/openbsd-src/commit/996f961786d17399d68ef8aef547a10ef22ca82b

However I noticed that there is no PLIC/INTR activity. Does

anyone know if this is due to no clock driver? If so that's

my next thing to do unless someone beats me to it. I have

another question. I added the bflbuart to the files.riscv64

and the Makefile doesn't update in 
/sys/arch/riscv64/compile/RAMDISK/obj/Makefile.. I don't know what I 
have to do it..for


now I manually updated this file.

Please excuse for the weird formatting. I'm still on thunderbird on 
OpenBSD and I'm not fully comfy with it.


Best Regards,

-pjp

--
Over thirty years experience on UNIX-like Operating Systems starting with QNX.


Re: porting OpenBSD to Ox64

2024-03-21 Thread Peter J. Philipp



On 3/21/24 17:43, Mizsei Zoltán wrote:

Hi,

have you tried to boot a vanilla-current OBSD? Do you know if that "old 
7.4-current" version you have mentioned contains any not-yet-upstreamed patches?

Have you made any changes to the DTB or U-Boot?

Regards,
--ext


Already replied privately, but for the public record: 
https://mainrechner.de/dot.config.txt


This is the .config I used with the u-boot.

No I didn't try a newer OBSD, I will soon though. :-)  And no I didn't 
change anything in the DTB.


Best Regards,

-pjp



Peter J. Philipp írta 2024. márc.. 21, Cs-n 08:50 órakor:

Hi,

If anyone is interested in helping or just plain interested, here is my
prep work documented.  I've been on it sparingly since beginning of March.
I don't know how much time I want to invest in this but we'll see...

https://github.com/pbug44/openbsd-src/tree/Ox64

The Ox64 is a 8 dollar SoC utilizing a RISCV64 CPU (among other cores).  I
intend to use this for a Freifunk-like project which I call GardenNet.

https://sky.delphinusdns.org/eap-tls-idea.txt
(following link in german use chromium to translate or something):
https://wiki.freifunk-franken.de/w/Benutzer:PeterPhilipp#Ein_Garten_Netz_Knoten

Best Regards,
-pjp


--
*** I used to sign with -peter, but noticed it's not unique, -pjp may come up 
in the future, so please adjust for that ***



Re: porting OpenBSD to Ox64

2024-03-21 Thread Mizsei Zoltán
Hi,

have you tried to boot a vanilla-current OBSD? Do you know if that "old 
7.4-current" version you have mentioned contains any not-yet-upstreamed patches?

Have you made any changes to the DTB or U-Boot?

Regards,
--ext

Peter J. Philipp írta 2024. márc.. 21, Cs-n 08:50 órakor:
> Hi,
>
> If anyone is interested in helping or just plain interested, here is my
> prep work documented.  I've been on it sparingly since beginning of March.
> I don't know how much time I want to invest in this but we'll see...
>
> https://github.com/pbug44/openbsd-src/tree/Ox64
>
> The Ox64 is a 8 dollar SoC utilizing a RISCV64 CPU (among other cores).  I
> intend to use this for a Freifunk-like project which I call GardenNet.
>
> https://sky.delphinusdns.org/eap-tls-idea.txt
> (following link in german use chromium to translate or something):
> https://wiki.freifunk-franken.de/w/Benutzer:PeterPhilipp#Ein_Garten_Netz_Knoten
>
> Best Regards,
> -pjp

-- 
--Z--



Re: porting OpenBSD to Ox64

2024-03-21 Thread Peter J. Philipp



On 3/21/24 12:27, Benjamin Stürz wrote:

Hi,

I'm also interested.
I might be able to provide testing.

OK great!  I'm going to help you  all a little by providing what I have 
so far.


These flash images were built on a devuan Linux (like debian), on a vmm

running on OpenBSD.  They seem to work for me rudamentally, thus far.

https://mainrechner.de/images/

(it's still uploading as I write this mail)

There is a SHA256 file and a SHA256.sig file along with a 
oceans11-openbsd.pub


signify key.  So that you can quickly confirm the checksum. Ultimately 
it would


be cool to build this all on native OpenBSD, if someone wants to attempt 
that,


you're more than welcome to!

https://wiki.pine64.org/wiki/Ox64

that link is the instructions on how to do this, including flashing 
(which is also


mentioned on my README.md on the first mentioned URL at github).

And as mentioned before here is some datasheets and other documents that

I collected over the last year or so: https://mainrechner.de/riscv.html

Best Regards,

-pjp


On 21.03.24 08:50, Peter J. Philipp wrote:

Hi,

If anyone is interested in helping or just plain interested, here is my
prep work documented.  I've been on it sparingly since beginning of 
March.

I don't know how much time I want to invest in this but we'll see...

https://github.com/pbug44/openbsd-src/tree/Ox64

The Ox64 is a 8 dollar SoC utilizing a RISCV64 CPU (among other 
cores).  I

intend to use this for a Freifunk-like project which I call GardenNet.

https://sky.delphinusdns.org/eap-tls-idea.txt
(following link in german use chromium to translate or something):
https://wiki.freifunk-franken.de/w/Benutzer:PeterPhilipp#Ein_Garten_Netz_Knoten 



Best Regards,
-pjp




--
*** I used to sign with -peter, but noticed it's not unique, -pjp may come up 
in the future, so please adjust for that ***



Re: porting OpenBSD to Ox64

2024-03-21 Thread Benjamin Stürz

Hi,

I'm also interested.
I might be able to provide testing.

On 21.03.24 08:50, Peter J. Philipp wrote:

Hi,

If anyone is interested in helping or just plain interested, here is my
prep work documented.  I've been on it sparingly since beginning of March.
I don't know how much time I want to invest in this but we'll see...

https://github.com/pbug44/openbsd-src/tree/Ox64

The Ox64 is a 8 dollar SoC utilizing a RISCV64 CPU (among other cores).  I
intend to use this for a Freifunk-like project which I call GardenNet.

https://sky.delphinusdns.org/eap-tls-idea.txt
(following link in german use chromium to translate or something):
https://wiki.freifunk-franken.de/w/Benutzer:PeterPhilipp#Ein_Garten_Netz_Knoten

Best Regards,
-pjp





Re: porting OpenBSD to Ox64

2024-03-21 Thread Mizsei Zoltán
Hi,

I can definetely spend some time with NUTTX, as I already wanted to do that for 
a different reason.
However I fear my USB UART adapters won't work with 200 baud transfer rate, 
so I have ordered an RpiPico, but it will take a while to receive it, till that 
day I won't be able to help you :(

--ext

Peter J. Philipp írta 2024. márc.. 21, Cs-n 09:54 órakor:
> On 3/21/24 09:10, Mizsei Zoltán wrote:
>> Hi.
>>
>> I am interested in this topic, as i have one in my drawer. My programming 
>> skills probably not up to the task, but I would be more than happy to help 
>> you with testing, etc.
>>
>> Regards,
>>
>> --ext
>
> Excellent!
>
> Yes I could use this sort of help.  In particular if you want to fiddle 
> with Apache NUTTX and see if you can utilize the wifi.  It seems to
>
> me that I can use a little bit of RAM for this.  My idea is this:
>
> If it is at all possible, boot on cpu 0 (OpenBSD) and then alloc some 
> contiguous RAM (10 MB perhaps?) from the PSRAM.  Once that is
>
> done we need to fork a thread or process from the kernel and start the 
> bootprocess with it for the c905(?) 32-bit core which has direct
>
> access to the wifi device.  Then we need some interprocess communication 
> between the 802.11 stack on OpenBSD and the NUTTX
>
> wifi driver.  Both CPU's will run in a hybrid/asynchronous fashion (as 
> far as I understand it if either doesn't touch the RAM of the other
>
> it will be ok locking wise).  If anyone wants to chime in here, if this 
> is an insane idea let me know.  I understand that a async mode is
>
> possible afaik.  So we need the NUTTX as a firmware (perhaps 2 MB in 
> size or so), it needs programming to communicate with the
>
> c906 64-bit core, we can work that out somehow.  If you want to build a 
> toolbox for this entire thing where we can just convert it to a
>
> firmware.  What do you think does this make sense, are you up for it?  
> It really needs little programming, perhaps a make file or a
>
> script to build NUTTX, I have linux devuan here (on native hardware and 
> vmm) and this is what I could use.
>
> https://nuttx.apache.org/  and here is the Reference manual for the 
> BL808:  https://mainrechner.de/BL808_RM_en_1.3.pdf
>
> So as a first step we need to figure out if NUTTX actually has drivers 
> for this SoC and that they work.  If not, we'll have to consider
>
> another approach.
>
> Best Regards,
>
> -pjp
>
>
> -- 
> *** I used to sign with -peter, but noticed it's not unique, -pjp may 
> come up in the future, so please adjust for that ***

-- 
--Z--



Re: porting OpenBSD to Ox64

2024-03-21 Thread Peter J. Philipp



On 3/21/24 09:10, Mizsei Zoltán wrote:

Hi.

I am interested in this topic, as i have one in my drawer. My programming 
skills probably not up to the task, but I would be more than happy to help you 
with testing, etc.

Regards,

--ext


Excellent!

Yes I could use this sort of help.  In particular if you want to fiddle 
with Apache NUTTX and see if you can utilize the wifi.  It seems to


me that I can use a little bit of RAM for this.  My idea is this:

If it is at all possible, boot on cpu 0 (OpenBSD) and then alloc some 
contiguous RAM (10 MB perhaps?) from the PSRAM.  Once that is


done we need to fork a thread or process from the kernel and start the 
bootprocess with it for the c905(?) 32-bit core which has direct


access to the wifi device.  Then we need some interprocess communication 
between the 802.11 stack on OpenBSD and the NUTTX


wifi driver.  Both CPU's will run in a hybrid/asynchronous fashion (as 
far as I understand it if either doesn't touch the RAM of the other


it will be ok locking wise).  If anyone wants to chime in here, if this 
is an insane idea let me know.  I understand that a async mode is


possible afaik.  So we need the NUTTX as a firmware (perhaps 2 MB in 
size or so), it needs programming to communicate with the


c906 64-bit core, we can work that out somehow.  If you want to build a 
toolbox for this entire thing where we can just convert it to a


firmware.  What do you think does this make sense, are you up for it?  
It really needs little programming, perhaps a make file or a


script to build NUTTX, I have linux devuan here (on native hardware and 
vmm) and this is what I could use.


https://nuttx.apache.org/  and here is the Reference manual for the 
BL808:  https://mainrechner.de/BL808_RM_en_1.3.pdf


So as a first step we need to figure out if NUTTX actually has drivers 
for this SoC and that they work.  If not, we'll have to consider


another approach.

Best Regards,

-pjp


--
*** I used to sign with -peter, but noticed it's not unique, -pjp may come up 
in the future, so please adjust for that ***



Re: porting OpenBSD to Ox64

2024-03-21 Thread Mizsei Zoltán
Hi.

I am interested in this topic, as i have one in my drawer. My programming 
skills probably not up to the task, but I would be more than happy to help you 
with testing, etc.

Regards,

--ext

Peter J. Philipp írta 2024. márc.. 21, Cs-n 08:50 órakor:
> Hi,
>
> If anyone is interested in helping or just plain interested, here is my
> prep work documented.  I've been on it sparingly since beginning of March.
> I don't know how much time I want to invest in this but we'll see...
>
> https://github.com/pbug44/openbsd-src/tree/Ox64
>
> The Ox64 is a 8 dollar SoC utilizing a RISCV64 CPU (among other cores).  I
> intend to use this for a Freifunk-like project which I call GardenNet.
>
> https://sky.delphinusdns.org/eap-tls-idea.txt
> (following link in german use chromium to translate or something):
> https://wiki.freifunk-franken.de/w/Benutzer:PeterPhilipp#Ein_Garten_Netz_Knoten
>
> Best Regards,
> -pjp

-- 
--Z--