Quantcast
Channel: Debian on Shuttle KD20 (PLX OXNAS 7821)
Viewing all 141 articles
Browse latest View live

Re: Debian on Shuttle KD20 (PLX OXNAS 7821)

$
0
0
I thought I already hit the "Post Message" button early today :) when I meant to post this:

The new driver is robust enough that it seems the necessary change might be as simple as this:

drivers/ata/sata_oxnas.c

SATA_OXNAS_MAX_PORTS = 2,

Re: Debian on Shuttle KD20 (PLX OXNAS 7821)

$
0
0
I already tried this and then I get a kernel panic. (posted it earlyer).

Maybe I had the wrong syntax in the dts(i), but I don't even see how the driver read the dts and switches between ports like the vendors driver.
So there might be more to do. I guess this driver is written for single sata, as the SATA_OXNAS_MAX_PORTS is hardcoded and not readed from dts.

But I'm happy about any input, to figure out how to enable the second port.

Re: Debian on Shuttle KD20 (PLX OXNAS 7821)

$
0
0
Peacemaker Wrote:
-------------------------------------------------------
> I already tried this and then I get a kernel
> panic. (posted it earlyer).
>
> Maybe I had the wrong syntax in the dts(i), but I
> don't even see how the driver read the dts and
> switches between ports like the vendors driver.
> So there might be more to do. I guess this driver
> is written for single sata, as the
> SATA_OXNAS_MAX_PORTS is hardcoded and not readed
> from dts.
>
> But I'm happy about any input, to figure out how
> to enable the second port.

Yes. I think possibly the kernel caused a panic is because of your dts. FDT is relatively new, so you wont find lots of drivers that have code handling it directly. Instead, this sata driver is typical (eg. sata_mv). As long as you have both dts and driver in sync then it will hopefully initialize the ports.

Re: Debian on Shuttle KD20 (PLX OXNAS 7821)

$
0
0
Hey, so I tried to understand what is causing exectly the kernel panic.

What I think is the core of the Problem:

void __iomem *port_base[SATA_OXNAS_MAX_PORTS];
void __iomem *sgdma_base[SATA_OXNAS_MAX_PORTS];

Here you get with max_ports=2 an array of 2. And thow I have to write an Array and only a number.

So I tried to change this
ata@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";
	};
to this
ata@45900000 {
		compatible = "plxtech,nas782x-sata";
			/*	port		sgdma		core	*/
		reg = <0x45900000,0x45910000 0x100>, <0x459B0000,0x459B0010 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";
	};

To give write an array, but I got syntax errors. :-(

I've not an idea how the device tree writes into an array in this file. And I don't found a helpfull manual to this.

Maybe someone have an idea or a link, that is helpfull

Re: Debian on Shuttle KD20 (PLX OXNAS 7821)

$
0
0
<0x45900000,0x45910000}
That } is a problem.

And we still need it to truly understand it is _one_ controller with _two_ ports. This really needs to be handled @ the driver code, and then only the difference adjusted @ the dts would be nr-ports.

Re: Debian on Shuttle KD20 (PLX OXNAS 7821)

$
0
0
Hey, the } was a mistake within the copy & past.

I tried several ways to input an array

Quote
And we still need it to truly understand it is _one_ controller with _two_ ports. This really needs to be handled @ the driver code, and then only the difference adjusted @ the dts would be nr-ports.

Sry warhead I do not realy get what you mean.

I realized that this board has 1 sata controler (phy) with 2 ports.
The number of ports is at the moment hardcoded, and as I see it this controls just the arraysize of 2 pointers.
I think the kernel panics because only the first entery of these arrays are written. My appproch was now, why don't easy write an array of an register instat of a single register.

Maybe you can tell me what is wrong with this idea

Re: Debian on Shuttle KD20 (PLX OXNAS 7821)

$
0
0
When the kernel attempts to initialize the sgdma controller for a second time, "You're gonna have a bad day"

Re: Debian on Shuttle KD20 (PLX OXNAS 7821)

$
0
0
Sure, but why do you think the drive is goning to inital the controller a second time, with an arraysize of 2 instead of 1 ?

As I read the bootlog it panics on instand, and there is no second initial with SATA_OXNAS_MAX_PORTS = 2

Re: Debian on Shuttle KD20 (PLX OXNAS 7821)

$
0
0
There should never be an array! Thats the point!

Re: Debian on Shuttle KD20 (PLX OXNAS 7821)

$
0
0
Thanks, Warhead
I see that the *.dts does not accept an array.

But what do you think of the array in the driver (sata_oxnas.c)? In the vendores driver there are similar code for the with an pointer-array for the port address.

Re: Debian on Shuttle KD20 (PLX OXNAS 7821)

$
0
0
In order to support more than 1 port, proper locking got to be implemented in the sata_oxnas driver.
The vendor SDK uses a quite complex setup for that to allow both, direct access and hardware raid with two disks. As we are quite far from supporting hardware-raid features in vanilla kernels, the best for now would be to implement locking as seen in
https://raw.githubusercontent.com/hynnet/hiwifi-openwrt-HC5661-HC5761/master/target/linux/oxnas/files-3.3/drivers/ata/sata_ox820.c
and having device-tree nodes for each port/phy and add them to the controller, similar to how it's done in
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/arm/boot/dts/kirkwood.dtsi

If I find the time, I'll give it a shot somewhen in the next days...

Re: Debian on Shuttle KD20 (PLX OXNAS 7821)

$
0
0
Hey, your right so far, Warhead has this driver in an old git. https://github.com/WarheadsSE/OX820-3.1-Linux

And beside from raid, cardreader, front usb3.0 and gpio, this non-fdt works so far.

The cardreader, front usb3.0 and gpio is I not the hard task.

With try to use the raid here I got:
[  273.010000] ata2.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
[  273.020000] ata2.00: cmd 35/00:00:80:24:04/00:04:00:00:00/e0 tag 0 dma 524288 out
[  273.020000]          res 40/00:01:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout)
[  273.030000] ata2: hard resetting link
[  273.120000] ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
[  273.120000] ata1.00: cmd 25/00:00:80:28:04/00:04:00:00:00/e0 tag 0 dma 524288 in
[  273.120000]          res 40/00:01:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout)
[  273.130000] ata1: hard resetting link
[  273.550000] ata2: SATA link up 1.5 Gbps (SStatus 113 SControl 310)
[  273.710000] ata1: SATA link up 1.5 Gbps (SStatus 113 SControl 310)
[  273.710000] ata1.00: failed to IDENTIFY (INIT_DEV_PARAMS failed, err_mask=0x80)
[  273.720000] ata1.00: revalidation failed (errno=-5)
udevd[291]: timeout: killing '/sbin/blkid -o udev -p /dev/md0' [1412]

udevd[291]: timeout: killing '/sbin/blkid -o udev -p /dev/md0' [1412]

udevd[291]: timeout: killing '/sbin/blkid -o udev -p /dev/md0' [1412]

udevd[291]: timeout: killing '/sbin/blkid -o udev -p /dev/md0' [1412]

udevd[291]: timeout: killing '/sbin/blkid -o udev -p /dev/md0' [1412]

[  278.710000] ata1: hard resetting link
[  278.710000] ata2.00: configured for UDMA/133
[  278.710000] ata2.00: device reported invalid CHS sector 0
[  278.720000] ata2: EH complete
udevd[291]: timeout: killing '/sbin/blkid -o udev -p /dev/md0' [1412]

[  279.220000] ata1: SATA link up 1.5 Gbps (SStatus 113 SControl 310)
udevd[291]: timeout: killing '/sbin/blkid -o udev -p /dev/md0' [1412]

udevd[291]: timeout: killing '/sbin/blkid -o udev -p /dev/md0' [1412]


I'm not sure if this driver is capable of fdt, so maybe it might be better to work on the "newer" sata driver and add there the second port. But after many hours of looking into the code of the sata_oxnas.c I realized my coding skills are to low :-(.

Re: Debian on Shuttle KD20 (PLX OXNAS 7821)

$
0
0
WarheadsSE Wrote:
-------------------------------------------------------
>
> #define
> SATA_REG_BASE			OXNAS_HW_PA_TO_VA(0x05900000)
> #define
> SATA_PHY_BASE			OXNAS_HW_PA_TO_VA(0x04900000)
> #define SATA_PHY_BASE_PA        0x44900000
> #define SATA_REG_BASE_PA        0x45900000
> #define SATA0_REGS_BASE     (SATA_REG_BASE +
> 0x00000)
> #define SATA1_REGS_BASE     (SATA_REG_BASE +
> 0x10000)
> 
> #define OX820SATA_SGDMA_CORESIZE    (0x10)
> #define OX820SATA_SGDMA_BASE0       ((u32*
> )(SATASGDMA_REGS_BASE + (0 *
> OX820SATA_SGDMA_CORESIZE)))
> #define OX820SATA_SGDMA_BASE1       ((u32*
> )(SATASGDMA_REGS_BASE + (1 *
> OX820SATA_SGDMA_CORESIZE)))
>
>
> The more I dig around, the more the described
> entry from bodhi seems accurate.
>
> This only real difference I see is that you need
> to have the port @ 0x45910000, and they appear to
> have the same DMA/SGDMA/etc.
>
> https://github.com/mibodhi/u-boot-oxnas/blob/oxnas
> /drivers/block/plxsata_ide.c
> https://github.com/mibodhi/u-boot-oxnas/blob/oxnas
> /arch/arm/include/asm/arch-nas782x/hardware.h

So - do you think it might be possible to use the second port only with a couple of changes and leaving first port unused?

It might help make both sata ports work if there was possibility to make them work separately first. If there was some way to find out what it needs to change used port, it might be a step forward.

Re: Debian on Shuttle KD20 (PLX OXNAS 7821)

Re: Debian on Shuttle KD20 (PLX OXNAS 7821)

$
0
0
Ohhhhh,... this is looking not so bad.

I compiled this openwrt, for so far, it is working.
+ uboot find 2 HDD
+ openwrt find 2 HDD
- Uboot Mac address must be set manual
- usb is not working (ehci timeouts)

But as I'm not a big fan of openwrt on a nas, I'll try to patch this for the debian-kernel.

For now on everything compiles quite well but I've got to fix the machine ID, as I got an error within wrong ID

Re: Debian on Shuttle KD20 (PLX OXNAS 7821)

$
0
0
Okay, I compiled an 3.18 Kernel for my Debian Initrd and did some short tests:

uImage3.18_2
Initrd_w

What is working:

- Booting with original uBoot
- Ethernet
- Both HDD and Raid

Whats not working:
- Cardreader
- USB3.0 is buggy

Everything else I'd tested yet.

The next I'll do some more test and hope to fix the usb3.0 & find out the kernel module for the cardreader :-)

Re: Debian on Shuttle KD20 (PLX OXNAS 7821)

$
0
0
Sounds nice.

I have not had enough time yet to try this with my Akitio Mycloud Mini and Silverstone DC01 devices.

Maybe some day at christmas.

BTW, did you use directly OpenWRT kernel or just patch original with the few patches?

Re: Debian on Shuttle KD20 (PLX OXNAS 7821)

Re: Debian on Shuttle KD20 (PLX OXNAS 7821)

$
0
0
Peacemaker Wrote:
-------------------------------------------------------
> I just patched 3.18.0 Kernel

OpenWRT kernel seems to have lots of generic patches. Maybe there is something necessary.

Re: Debian on Shuttle KD20 (PLX OXNAS 7821)

$
0
0
I uesd the additional files & all kernel patches from the openwrt trunk.

For now I compiled the released 3.18.1

There's not much changed to a prior version.

# SATA+Raid's working well ( ok a bit slow 80mb/s r/w)

What's not working, buggy, or not well:

# USB 3.0 & Cardreader: SD card / USB-Stick is recognized, but If you try access the storage, I got Errors.

Error for USB 3.0 if I try to mount the volume:

[10175.302950] usb 2-2: new SuperSpeed USB device number 2 using xhci_hcd
[10175.327321] usb 2-2: New USB device found, idVendor=0781, idProduct=5583
[10175.334033] usb 2-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[10175.341132] usb 2-2: Product: Ultra Fit
[10175.344983] usb 2-2: Manufacturer: SanDisk
[10175.349068] usb 2-2: SerialNumber: 4C530123240729103534
[10175.355845] usb-storage 2-2:1.0: USB Mass Storage device detected
[10175.364267] scsi host4: usb-storage 2-2:1.0
[10176.363292] scsi 4:0:0:0: Direct-Access     SanDisk  Ultra Fit        1.00 PQ            : 0 ANSI: 6
[10176.375859] sd 4:0:0:0: [sdb] 31266816 512-byte logical blocks: (16.0 GB/14.9             GiB)
[10176.384660] sd 4:0:0:0: [sdb] Write Protect is off
[10176.392517] sd 4:0:0:0: [sdb] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[10176.424995]  sdb: sdb1
[10176.433397] sd 4:0:0:0: [sdb] Attached SCSI removable disk
[10201.783930] EXT4-fs (sdb1): mounting ext3 file system using the ext4 subsystem
[10237.033382] xhci_hcd 0000:00:00.0: Assuming host is dying, halting host.
[10237.040279] xhci_hcd 0000:00:00.0: HC died; cleaning up
[10237.045754] usb 2-2: USB disconnect, device number 2
[10237.065679] sd 4:0:0:0: [sdb]
[10237.068812] Result: hostbyte=0x01 driverbyte=0x00
[10237.073528] sd 4:0:0:0: [sdb] CDB:
[10237.077009] cdb[0]=0x2a: 2a 00 00 00 00 20 00 00 10 00
[10237.082124] blk_update_request: I/O error, dev sdb, sector 32
[10237.087866] Buffer I/O error on dev sdb1, logical block 0, lost async page write
[10237.095275] Buffer I/O error on dev sdb1, logical block 1, lost async page write
[10237.103720] sd 4:0:0:0: [sdb]
[10237.106851] Result: hostbyte=0x01 driverbyte=0x00
[10237.111531] sd 4:0:0:0: [sdb] CDB:
[10237.115046] cdb[0]=0x2a: 2a 00 00 20 00 28 00 00 10 00
[10237.120176] blk_update_request: I/O error, dev sdb, sector 2097192
[10237.126359] Buffer I/O error on dev sdb1, logical block 262145, lost async page write
[10237.134205] Buffer I/O error on dev sdb1, logical block 262146, lost async page write
[10237.142072] JBD2: recovery failed
[10237.145402] EXT4-fs (sdb1): error loading journal

I've not much looked into fixing this, but If someone have an idea, I'm happy for help ?!

What I have not looked into is:

# All GPIO: LED's, Fan, Buttons


For now on I try to focus on USB 3.0 & the Performace tweaks on Samba / SSH,...
Viewing all 141 articles
Browse latest View live