Welcome! Log In Create A New Profile

Advanced

Ox820 device tree

Posted by tilator 
Ox820 device tree
April 30, 2014 09:44AM
Hi,

I can't find proper device tree for an Ox820 device anywhere. The device is like Pogoplug V3 except double sata ports.

Is it possible to get proper information for the device tree somewhere inside an old non-FDT kernel?
Re: Ox820 device tree
April 30, 2014 09:52AM
The non-dt kernel should have the information for the second sata port near the definitions of the first. I am not sure why you are asking this in the uBoot subforum.



Edited 1 time(s). Last edit at 04/30/2014 09:53AM by WarheadsSE.
Re: Ox820 device tree
April 30, 2014 10:37AM
WarheadsSE Wrote:
-------------------------------------------------------
> The non-dt kernel should have the information for
> the second sata port near the definitions of the
> first.

Are you talking about source code or something else? Can I get the info out with hexdump or some other means?

> I am not sure why you are asking this in
> the uBoot subforum.

I ask it here since uBoot find both sata devices. So, it must have all required info. I supposed it might be possible to print it out from running uBoot too somehow.
Re: Ox820 device tree
April 30, 2014 02:03PM
Source code my friend. This is not the kind of information that is usually available once the software is running.
Re: Ox820 device tree
April 30, 2014 02:43PM
Re: Ox820 device tree
April 30, 2014 03:14PM
bodhi Wrote:
-------------------------------------------------------
> tilator,
>
> > I ask it here since uBoot find both sata devices.
>
> Which U-Boot version did you see both SATA?

2013.10 for Oxnas:

****************************************************************************
U-Boot SPL 2013.10-ga72eb8f-dirty (Mar 26 2014 - 14:25:06)
Boot device: SATA
Attempting to set PLLA to 750 MHz ...
plla_ctrl0 : 0000000a
plla_ctrl1 : 000f0000
plla_ctrl2 : 001d01a0
plla_ctrl3 : 00000017

PLLA Set
Bus 0: OK
Device 0:
** File not found /boot/bootargs.bin **


U-Boot 2013.10 (Apr 30 2014 - 22:58:16) for OXNAS

DRAM: 256 MiB
IDE: Bus 0: OK Bus 1: OK
Device 0: Model: SAMSUNG HN-M101MBB Firm: 2AR10001 Ser#: S2RUJ9AB703398
Type: Hard Disk
Supports 48-bit addressing
Capacity: 953869.7 MB = 931.5 GB (1953525168 x 512)
Device 1: Model: SAMSUNG HN-M101MBB Firm: 2AR10001 Ser#: S2RUJ9HB700822
Type: Hard Disk
Supports 48-bit addressing
Capacity: 953869.7 MB = 931.5 GB (1953525168 x 512)
NAND: 256 MiB
In: serial
Out: serial
Err: serial
Net: mii0
Hit any key to stop autoboot: 0
OX820 #
*************************************************************************************

include/configs/ox820.h must be edited.

#define CONFIG_SYS_IDE_MAXDEVICE 1
#define CONFIG_SYS_IDE_MAXBUS 1

those are default settings. Needs just value 2 for the first setting or both. Result is same. Uboot lists both devices, but kernel always only one.



Edited 1 time(s). Last edit at 04/30/2014 03:22PM by tilator.
Re: Ox820 device tree
April 30, 2014 03:21PM
Take a look at:
u-boot-oxnas-oxnas/drivers/block/plxsata_ide.c

and also:
arch/arm/include/asm/arch-nas782x/hardware.h

Everything you need is in there, I think.

-bodhi
===========================
Wiki
latest Kirkwood kernel builds and rootfs
latest u-boot-kirkwood builds
latest Oxnas kernel builds and rootfs
latest u-boot-oxnas builds
latest MVEBU Armada kernel builds and rootfs
U-Boot & Kernel Booting process
bodhi's u-boot GitHub
bodhi's corner



Edited 2 time(s). Last edit at 04/30/2014 03:29PM by bodhi.
Re: Ox820 device tree
April 30, 2014 03:31PM
bodhi Wrote:
-------------------------------------------------------
> Take a look at:
> u-boot-oxnas-oxnas/drivers/block/plxsata_ide.c
>
> and also:
> arch/arm/include/asm/arch-nas782x/hardware.h
>
> Everything you need is in there, I think.

Can you tell me what to change, please?
Re: Ox820 device tree
April 30, 2014 03:35PM
You need that line for your device tree:

"#define SATA_1_REGS_BASE 0x45910000"

In most device tree files, only SATA0 gets explicitly set up with its address of 0x45900000, just like defined one line above the one I just quoted.
"#define SATA_0_REGS_BASE 0x45900000"
Re: Ox820 device tree
April 30, 2014 03:40PM
ingmar_k Wrote:
-------------------------------------------------------
> You need that line for your device tree:
>
> "#define SATA_1_REGS_BASE 0x45910000"
>
> In most device tree files, only SATA0 gets
> explicitly set up with its address of 0x45900000,
> just like defined one line above the one I just
> quoted.
> "#define SATA_0_REGS_BASE 0x45900000"

Sounds good. Can you still tell me where to put the line. Kernel source or u-boot source?
Re: Ox820 device tree
April 30, 2014 03:42PM
You can use the oxnas kernel dts file as a base and clone the second SATA port from there. So whatever is needed in the kernel dts for SATA 1 entry, you would replicate that. If there is hardware specific info such as addresses, then you can find it in those 2 files.

linux-oxnas-3.12-tld-2/arch/arm/boot/dts/ox820-pogoplug-pro.dts

        sata@45900000 {
		status = "okay";
	};
	sata@45910000 {
		status = "okay";
	};


After that you can recompile the dts and get the new dtb.

LOL. Sorry ingmar! we are posting at the same time :)

-bodhi
===========================
Wiki
latest Kirkwood kernel builds and rootfs
latest u-boot-kirkwood builds
latest Oxnas kernel builds and rootfs
latest u-boot-oxnas builds
latest MVEBU Armada kernel builds and rootfs
U-Boot & Kernel Booting process
bodhi's u-boot GitHub
bodhi's corner



Edited 1 time(s). Last edit at 04/30/2014 03:43PM by bodhi.
Re: Ox820 device tree
April 30, 2014 03:42PM
You really don't get it. Device tree file (.dts), SATA definition. Now compare the current defintion and see where you could add one for the second SATA port.
Either that or you wait until someone else does the work.

Edit:
Hehe, bodhi to the rescue. :-D



Edited 2 time(s). Last edit at 04/30/2014 03:43PM by ingmar_k.
Re: Ox820 device tree
April 30, 2014 04:09PM
ingmar_k Wrote:
-------------------------------------------------------
> You really don't get it. Device tree file (.dts),
> SATA definition. Now compare the current defintion
> and see where you could add one for the second
> SATA port.
> Either that or you wait until someone else does
> the work.
>
> Edit:
> Hehe, bodhi to the rescue. :-D

I'm not that familiar with these things. I already found out myself that uboot had only one SATA devise set on and it needed to be changed. Now I'm just stuck with something else. I have been trying lots of different things.

But back to the point. I now added what bodhi told (sata@45910000 etc.) in the DTS file. I suppose this needs some change to the DTSI file too. It can't be correct like that.

These are the lines I suppose need to be edited:

*********************************'''

sata@45900000 {
compatible = "plxtech,nas782x-sata";
/* port sgdma core */
reg = <0x45900000 0x100>, <0x459B0000 0x10>, <0x459E0000 0x2000>,
/* phy descriptors (optional) */
<0x44900000 0x0C>, <0x50000000 0x1000>;
interrupts = <0 18 0x304>;
clocks = <&stdclk 4>;
resets = <&rst 11>, <&rst 12>, <&rst 13>;
reset-names = "sata", "link", "phy";
status = "disabled";
};
******************************

Base address must be changed as well as SGDMA. Is this correct? Is there anything else to change?



Edited 1 time(s). Last edit at 04/30/2014 04:14PM by tilator.
Re: Ox820 device tree
April 30, 2014 04:19PM
Or this

linux-oxnas-3.12-tld-2/arch/arm/boot/dts/ox820-pogoplug-pro.dts
         sata@45900000 {
 		status = "okay";
	        nr-ports = <2>;
 	};

The idea is just cloning the first SATA port, whatever definition that needs to be cloned. If you can't find any thing else related to SATA 1 in the kernel dts, then that's all you would need. Try both and see if you can get the kernel recognize SATA 2 in dtb.

-bodhi
===========================
Wiki
latest Kirkwood kernel builds and rootfs
latest u-boot-kirkwood builds
latest Oxnas kernel builds and rootfs
latest u-boot-oxnas builds
latest MVEBU Armada kernel builds and rootfs
U-Boot & Kernel Booting process
bodhi's u-boot GitHub
bodhi's corner
Re: Ox820 device tree
April 30, 2014 04:34PM
bodhi Wrote:
-------------------------------------------------------
> Or this
>
> linux-oxnas-3.12-tld-2/arch/arm/boot/dts/ox820-pog
> oplug-pro.dts
>
>          sata@45900000 {
>  		status = "okay";
> 	        nr-ports = <2>;
>  	};
>
>
> The idea is just cloning the first SATA port,
> whatever definition that needs to be cloned. If
> you can't find any thing else related to SATA 1 in
> the kernel dts, then that's all you would need.
> Try both and see if you can get the kernel
> recognize SATA 2 in dtb.

The only things found related to second SATA in old kernel source are base address and sgdma setting. That's why it sounds so odd and it's not easy to get it going. If I only change those settings, there will be something overlapping while kernel boots. I just don't know what else to change and how.

Can clock and IRQ be same for both SATA? I suppose they must need some other memory settings not to be same. Is this correct?

Base address and SGDMA are simply because they can be found from old source, but there are still core, phy descriptors, irq and clock settings that I don't know if they must be changed or not.
Re: Ox820 device tree
April 30, 2014 04:36PM
tilator,

I already found out myself that uboot had only one SATAdevise set on and it needed to be changed

I'm afraid you're confusing me :) the U-Boot 2013.10 that you've installed recognized both SATAs as you showed above.

-bodhi
===========================
Wiki
latest Kirkwood kernel builds and rootfs
latest u-boot-kirkwood builds
latest Oxnas kernel builds and rootfs
latest u-boot-oxnas builds
latest MVEBU Armada kernel builds and rootfs
U-Boot & Kernel Booting process
bodhi's u-boot GitHub
bodhi's corner
Re: Ox820 device tree
April 30, 2014 04:49PM
bodhi Wrote:
-------------------------------------------------------
> tilator,
>
>
> I already found out myself that uboot had only one
> SATAdevise set on and it needed to be changed
>
>
> I'm afraid you're confusing me :) the U-Boot
> 2013.10 that you've installed recognized both
> SATAs as you showed above.

U-boot 2013.10 recognizes both with the settings changes. Originally it did not. But even now while u-boot show both drives, kernel will only show one.
Re: Ox820 device tree
April 30, 2014 04:57PM
OK. So you're not running the version out of kref's source tree, you have patched it.

Regarding this:
sata@45900000 { 
compatible = "plxtech,nas782x-sata"; 
/*	port	 sgdma	 core	*/ 
reg = <0x45900000 0x100>, <0x459B0000 0x10>, <0x459E0000 0x2000>, 
/*	phy	 descriptors (optional)	*/ 
<0x44900000 0x0C>, <0x50000000 0x1000>; 
interrupts = <0 18 0x304>; 
clocks = <&stdclk 4>; 
resets = <&rst 11>, <&rst 12>, <&rst 13>; 
reset-names = "sata", "link", "phy"; 
status = "disabled"; 
};

I can only suggest that reading the U-Boot driver code, especially the files I listed above, will tell what needs to be changed.

-bodhi
===========================
Wiki
latest Kirkwood kernel builds and rootfs
latest u-boot-kirkwood builds
latest Oxnas kernel builds and rootfs
latest u-boot-oxnas builds
latest MVEBU Armada kernel builds and rootfs
U-Boot & Kernel Booting process
bodhi's u-boot GitHub
bodhi's corner
Re: Ox820 device tree
April 30, 2014 05:23PM
bodhi Wrote:
-------------------------------------------------------
> OK. So you're not running the version out of
> kref's source tree, you have patched it.

U-boot is kref's version _but_ settings for CONFIG_SYS_IDE_MAXDEVICE and CONFIG_SYS_IDE_MAXBUS are changed from 1 to 2. Everything else is exactly as they are in kref's source.

> I can only suggest that reading the U-Boot driver code, especially the files I listed above, will tell what needs to be changed.

I'll do that. Are you sure the kernel is OK? Or might it be something wrong with it and it will only support one drive even if u-boot supports both?
Re: Ox820 device tree
April 30, 2014 06:21PM
Re: Ox820 device tree
May 01, 2014 02:18AM
bodhi Wrote:
-------------------------------------------------------
> tilator,
>
> Look for the SATA driver in kernel drivers/ata. If
> number of ports is defined/hardcoded, it should be
> in there.

Yes, I did that before.

There is hard coded setting "SATA_OXNAS_MAX_PORTS = 1". I did try to set value 2 and ended up with booting errors.

I have to try this again because the u-boot sata settings were not correct then.

So, originally there are several things to change: u-boot settings for SATA port/drive count, DTS structure and maybe hardcoded setting in this kernel file drivers/ata/sata_oxnas.c

I'm not an expert with these thing. That's why I'm extremely grateful to have some help here.



Edited 1 time(s). Last edit at 05/01/2014 02:30AM by tilator.
Re: Ox820 device tree
May 01, 2014 02:37PM
tilator,

Glad I could answer some of your questions. Even though I have this plug for a long time, I lost interested in it after successfully getting Debian squeeze rootfs running with ALARM kernel. I have only recently started playing with it again upon learning of kref's works to get it running later u-boot and kernel.

Let us know your progress.

-bodhi
===========================
Wiki
latest Kirkwood kernel builds and rootfs
latest u-boot-kirkwood builds
latest Oxnas kernel builds and rootfs
latest u-boot-oxnas builds
latest MVEBU Armada kernel builds and rootfs
U-Boot & Kernel Booting process
bodhi's u-boot GitHub
bodhi's corner
Re: Ox820 device tree
May 02, 2014 11:00PM
> Let us know your progress.

There is not much to tell, but let's put it here.

I have been trying to compile DTS/DTB file using u-boot source.

I suppose all needed settings are there. The Pogoplug V3 DTS file might be done with u-boot settings CONFIG_SYS_IDE_MAXDEVICE=1 and CONFIG_SYS_IDE_MAXBUS=1. Result is of cource one SATA node. It works for Pogoplug but not some other ox820 devices.

My device has two SATA ports. They both are connected to the same bus and u-boot reports them as IDE 0:0 and IDE 0:1 devices. I expect it just needs CONFIG_SYS_IDE_MAXDEVICE setting to be 2 and then compiled again.

But I still do not have it done because I run in other errors while compiling it. If I only knew what settings u-boot needs to compile DTS for Pogoplug. It might be much easier then.

By the way, this same trouble considers owners of Shuttle Omninas KD20 too. I suppose this same problem prevents them to get second SATA working.
Re: Ox820 device tree
May 03, 2014 02:35PM
Re: Ox820 device tree
May 10, 2014 02:26AM
> Let us know your progress.


Since you wanted to know:

Kernel 3.13.5 registers second SCSI host. Something is still wrong since both are at same address.

****************************************************************************

[root@Isharing2 ~]# ls -la /sys/class/scsi_host/
total 0
drwxr-xr-x 2 root root 0 1970-01-01 02:00 .
drwxr-xr-x 26 root root 0 1970-01-01 02:00 ..
lrwxrwxrwx 1 root root 0 1970-01-01 02:00 host0 -> ../../devices/45900000.sata/ata1/host0/scsi_host/host0
lrwxrwxrwx 1 root root 0 1970-01-01 02:00 host1 -> ../../devices/45900000.sata/ata2/host1/scsi_host/host1
[root@Isharing2 ~]# uname -a
Linux Isharing2 3.13.5 #9 SMP Sat May 10 11:08:53 EEST 2014 armv6l armv6l armv6l GNU/Linux
[root@Isharing2 ~]#

****************************************************************************

What I did is:

1. changed u-boot source settings in ox820.h. Both CONFIG_SYS_IDE_MAXBUS and CONFIG_SYS_IDE_MAXDEVICE to 2.
2. hard coded kernel source /drivers/ata/sata_oxnas.c row 1756 "host = ata_host_alloc_pinfo(&ofdev->dev, ppi, SATA_OXNAS_MAX_PORTS);" last argument to number 2 too.



Edited 1 time(s). Last edit at 05/10/2014 03:34AM by tilator.
Re: Ox820 device tree
May 10, 2014 03:36AM
Re: Ox820 device tree
May 10, 2014 05:09AM
bodhi Wrote:
-------------------------------------------------------
> Try this kernel I've just uploaded:
> http://forum.doozan.com/read.php?2,16044
>
> The /proc/device-tree does polulate correctly.


Thanks, I'll try it.

It seems to me like the whole trouble comes from the device tree. I suppose SATA_OXNAS_MAX_PORTS = 1 setting in kernel sata_oxnas.c file is hard coded solely because port count has not come properly from device tree and someone has decided to hard code it there.

Am I right?

sata_oxnas.c code seems to work with port count 2 except where port_base and sgdma_base are set (code row numbers 1709 and 1710 with 3.13.5 source) in function sata_oxnas_probe.

Both those base addresses has been hard coded too for one SATA_port because device tree has not been properly set.

I suppose SATA_OXNAS_MAX_PORTS setting should come from device tree and hard coding has been done because this has not been working properly.

Does this make any sense to you or am I totally lost here ;-)


BTW: I took a look at your kernel. My device does not have PCI and it will not boot with PCI enabled kernel. If you can compile it without PCI support I can give it a try.



Edited 1 time(s). Last edit at 05/10/2014 05:13AM by tilator.
Re: Ox820 device tree
May 10, 2014 12:26PM
tilator,

Quote

> It seems to me like the whole trouble comes from
> the device tree. I suppose SATA_OXNAS_MAX_PORTS =
> 1 setting in kernel sata_oxnas.c file is hard
> coded solely because port count has not come
> properly from device tree and someone has decided
> to hard code it there.
>
> Am I right?

> I suppose SATA_OXNAS_MAX_PORTS setting should come
> from device tree and hard coding has been done
> because this has not been working properly.
>

I don't think so. I think it only means that the driver was coded for a certain SoC chip which either has only 1 port, or they don't want to activate the 2nd port. And the array dimension needs to be static at compile time, therefore it is a #define. But the fact that it was coded this way, it might work when you change this constant to 2 (providing there is no bug :). I have not looked closely, so that is just my casual observation.

-bodhi
===========================
Wiki
latest Kirkwood kernel builds and rootfs
latest u-boot-kirkwood builds
latest Oxnas kernel builds and rootfs
latest u-boot-oxnas builds
latest MVEBU Armada kernel builds and rootfs
U-Boot & Kernel Booting process
bodhi's u-boot GitHub
bodhi's corner
Re: Ox820 device tree
May 10, 2014 05:40PM
tilator,

Quote

> BTW: I took a look at your kernel. My device does
> not have PCI and it will not boot with PCI enabled
> kernel. If you can compile it without PCI support
> I can give it a try.

You could try to boot with this attached dtb. I think it should work with the Pogo V3 Classic, even booting the full Pogo Pro kernel, since it does not have pci controller in it.

-bodhi
===========================
Wiki
latest Kirkwood kernel builds and rootfs
latest u-boot-kirkwood builds
latest Oxnas kernel builds and rootfs
latest u-boot-oxnas builds
latest MVEBU Armada kernel builds and rootfs
U-Boot & Kernel Booting process
bodhi's u-boot GitHub
bodhi's corner
Attachments:
open | download - ox820-pogoplug-classic.dtb (6.9 KB)
Re: Ox820 device tree
May 11, 2014 03:35AM
> You could try to boot with this attached dtb. I
> think it should work with the Pogo V3 Classic,
> even booting the full Pogo Pro kernel, since it
> does not have pci controller in it.


Thanks again. I'll try it today.

BTW: is there a simple typo in the instructions at the line beginning dpkg -i and ending .bz2
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: