# [SOLVED] Marvell 88SE6111 IDE Problems

## pacman99

Hi,

I'm having problems with my Marvell 88SE6111 IDE Controller found on my ASUS P5K SE board. 

lspci says:

```
03:00.0 IDE interface: Marvell Technology Group Ltd. Device 6121 (rev b2)
```

Using the drivers that came with my motherboard, I get:

```
SERVERU Source code # make

make ARCH=x86_64 CC=cc LD=ld CROSS_COMPILE= V= -C /lib/modules/2.6.25-gentoo-r2/build M=`pwd` modules

make[1]: Entering directory `/usr/src/linux-2.6.25-gentoo-r2'

make[1]: *** No rule to make target `code'.  Stop.

make[1]: Leaving directory `/usr/src/linux-2.6.25-gentoo-r2'

make: *** [all] Error 2
```

Using drivers from Asus' site for the Marvel 6121 controller using the guidelines suggested in this post: https://forums.gentoo.org/viewtopic-t-558785-highlight-marvell+88se6111.html, I get:

```
SERVERU thor-nonraid # make

make ARCH=x86_64 CC=cc LD=ld CROSS_COMPILE= V= -C /lib/modules/2.6.25-gentoo-r2/build M=`pwd` modules

make[1]: Entering directory `/usr/src/linux-2.6.25-gentoo-r2'

  CC [M]  /home/Mar6121/1.0.0.9/thor-nonraid/linux/linux_sense.o

/home/Mar6121/1.0.0.9/thor-nonraid/linux/linux_sense.c: In function 'HBA_Translate_Req_Status_To_OS_Status':

/home/Mar6121/1.0.0.9/thor-nonraid/linux/linux_sense.c:23: error: 'struct scsi_cmnd' has no member named 'use_sg'

/home/Mar6121/1.0.0.9/thor-nonraid/linux/linux_sense.c:50: error: 'struct scsi_cmnd' has no member named 'use_sg'

/home/Mar6121/1.0.0.9/thor-nonraid/linux/linux_sense.c:53: error: 'struct scsi_cmnd' has no member named 'request_buffer'

/home/Mar6121/1.0.0.9/thor-nonraid/linux/linux_sense.c:54: error: 'struct scsi_cmnd' has no member named 'use_sg'

/home/Mar6121/1.0.0.9/thor-nonraid/linux/linux_sense.c:60: error: 'struct scsi_cmnd' has no member named 'request_bufflen'

make[2]: *** [/home/Mar6121/1.0.0.9/thor-nonraid/linux/linux_sense.o] Error 1

make[1]: *** [_module_/home/Mar6121/1.0.0.9/thor-nonraid] Error 2

make[1]: Leaving directory `/usr/src/linux-2.6.25-gentoo-r2'

make: *** [all] Error 2
```

My kernel options have the following relevant options enabled:

```
<*>     generic/default IDE chipset support

<*>   Marvell PATA support via legacy mode   

<*> SCSI disk support

<*> SCSI CDROM support
```

I'm not sure what to do at this point to get my IDE controller working. Fortunately gentoo is installed on a sata drive that's not affected by this controller.

ThanksLast edited by pacman99 on Mon May 12, 2008 5:56 am; edited 1 time in total

----------

## pacman99

figured it out. The guidelines posted at: https://forums.gentoo.org/viewtopic-t-558785-highlight-marvell+88se6111.html were correct but did not apply to the 2.6.25 kernel. I had to downgrade to 2.6.24-r7 then play around with the source as described in the last post of that thread to get it to work  :Smile: 

----------

## SVMartin80

I might buy me an Asus P5Q, which also has a Marvell 88SE6111 chip. Does latest Gentoo version support it out of the box? Is performance ok? (incl. DMA) I plan to use it in a RAID-0 setup. Can you confirm that this also works?

----------

## emerald

I've modified the marvell driver found at the asus page to work with newer kernels and created a kernel patch, which can be found here:

http://www.home.liji.de/kernel/addons/patchsets/2.6.25.6/marvell_88se61xx.patch

http://www.home.liji.de/kernel/addons/patchsets/2.6.26/marvell_88se61xx.patch

Supported chips are Marvell 88SE6121 88SE6122 88SE6141 88SE8145.

The chip called 886111 is some manuals seems to be a 88SE6121.

Here http://www.home.liji.de/kernel/addons/patchsets/ you will also find a (probably working but untested) patch for 2.6.24 and soon for later kernels too till a working driver for this chip is included into mainline.

Btw, the driver only works in non-raid mode.

Don't panic if the links are not accessible, it's a pc at home, which might be turned off now and then, just try again later.

----------

## slaterson

 *emerald wrote:*   

> I've modified the marvell driver found at the asus page to work with 2.6.25 and created a kernel patch, which can be found here:
> 
> http://www.home.liji.de/kernel/addons/patchsets/2.6.25.6/marvell_88se61xx.patch
> 
> Here http://www.home.liji.de/kernel/addons/patchsets/ you will also find a (probably working but untested) patch for 2.6.24 and soon for later kernels too till a working driver for this chip is included into mainline.
> ...

 

i'd like to give this a try.  how/where do i apply your patch?  it looks like a kernel patch, not a patch for the downloaded driver/module.

also, is this better than sata_mv that is included in the kernel now?

thanks

----------

## emerald

 *slaterson wrote:*   

> 
> 
> i'd like to give this a try.  how/where do i apply your patch?  it looks like a kernel patch, not a patch for the downloaded driver/module.
> 
> also, is this better than sata_mv that is included in the kernel now?
> ...

 

It is a kernel patch, an external module is usually more hassle than internal (and as kernel patch it can also staically be compiled into the kernel).

The patch has to be applied like any other patch (assuming the /usr/src/linux symlink is correct):

```

cd /usr/src/linux

cat /<path>/marvell_88se61xx.patch | patch -p1

# check for no rejects

make menuconfig

# select the driver in scsi submenu

```

The sata_mv driver supports other devices, not the Marvell 88SE6121/6122/6141/6145 chips.

The aforementioned 88SE6111 chip should in fact be the 88SE6121, probably check with lspci too.

----------

## slaterson

i installed the patch, built a kernel and booted.  i got a kernel panic because the patched kernel with the marvell driver switched my hard drive order, sdaX became sdbX and sdbX became sdaX.  i booted to the unpatched kernel, changed me grub config (changed root=/dev/sda3 to root=/dev/sdb3 for teh patched kernel line in grub.conf) and i also updated my fstab to use /dev/sdbX instead of /dev/sdaX.  the system then booted up just fine, however i'd like to retain my 'normal' configuration, sda remains as sda and sdb remains as sdb.

my system consists of two hard drives and a dvd burner.  there is one sata hard drive, one ata hard drive and the ata dvd burner.  previously the sata hdd would be sda, now its sdb.

any way to fix that or is the driver simply ordering the drives different due to proper discovery (compared to the previous driver i was using)?

thanks

----------

## emerald

This driver is working as a SCSI driver and the SCSI devices are parsed first, this fact is not changeable.

So your option is to compile the 88SE61xx driver (mv) as module and let udev handle it automatically or auto-insert the driver on boot. If you are not using the AHCI driver it's no problem that way and it will work.

If you are using the AHCI driver you will somehow have to prevent the AHCI driver from claiming the marvell chip (possibly via kernel parameter), but i don't know how at the moment (except patching the AHCI driver). Since the AHCI driver will (without parameter) automatically claim control of the marvell chip on load it's also no use to compile both as module and insert the AHCI driver first, then the other one won't load and you can't use the ide port (same as without this mv driver).

In case you want both, the AHCI and the Marvell driver, as i do, you will have to live with the changed harddisk layout, at least till a better working marvell driver is incorporated in mainline.

You can try this patch (for 2.6.25), which should prevent the AHCI driver from claiming the marvell chips (and then use the marvell-module-method), but no test and guarantee from my part:

http://www.home.liji.de/kernel/tmp/ahci-dont-claim-marvell-chips.patch

Another way is for grub to use the label-mount: root=LABEL=<hdd-label> which, depending on your grub configuration may/should work and for fstab too, or, as i do, at least for fstab, not to use the /dev/sdYX devices but the symlinks created by udev in /dev/disk/by-id/ and /dev/disk/by-path/ , where the id will always be the same for the same harddisk (harddisk-dependent id) and the path will be the same as long as the controller stay in the same slot (on the same mainboard), which means the PCI-bus-numbering will stay the same.

----------

## slaterson

thanks for the thorough reply.

i've got ahci enabled in my kernel along with the marvell driver from your patch, of course.  i am not sure i need ahci, i need to better understand what it does.  i just built a new computer, the last time i made a major upgrade was several years ago when sata didn't exist, so i am behind on the current technology.

one thing that i discovered today is that my cdrom is no longer showing up.  i am not when it stopped being identified, it was before i applied your patch - i have been tweaking the kernel hear and there for a few weeks now...

----------

## emerald

The output of lspci will help a even more specific answer alot, dmesg output too.

Gernerally, if you enabled AHCI mode for any SATA controller in your mainboard BIOS you need the AHCI driver, otherwise (probably) not at all.

```
<*>   AHCI SATA support
```

If you enabled the AHCI driver, without this ahci-dont-claim-marvell-chips.patch patch the AHCI driver will support your harddisk connected to the SATA ports of the Marvell chip too. But by doing so you lose any chance to use the IDE port of the Marvell chip. So, to prevent the AHCI driver to take 'ownership' of the Marvell chip you should patch your kernel with this patch.

The Marvell 88SE61xx (mv) driver you should compile as module now

```
<M>   Marvell Storage Controller 6121/6122/6141/6145
```

so udev will load the driver after the AHCI driver was already loaded.

That way your SATA harddisk should be sda, the IDE harddisk sdb and the IDE DVD drive stays sr0.

So, just to be sure, get clean sources, apply both patches, select the AHCI and mv driver as just explained and it should work your way.

(I care little about the naming of the harddisks so i don't use the ahci-dont-claim-marvell-chips.patch, so i can't tell about it working or not but it still should do the right thing.)

In case you want to try the older legacy mode for the Intel chipset you can probably avoid the AHCI driver but you will have to select

```
<*>   Intel ESB, ICH, PIIX3, PIIX4 PATA/SATA support
```

and only in case there's a Intel IDE port, you need

```
<*>   Intel PATA MPIIX support
```

too.

----------

## slaterson

ok, let me see if i understand fully.  and a little more info from me...

i do have ahci enabled in my bios, i dual boot this computer with windows xp and want to keep the sata controller in ahci mode for performance reasons, at least in windows.

to get access to all my hard drives - ata dvd burner, ata hard disk and the sata drive - i need to patch my kernel with the 'dont-claim' patch you provided.  also, i need to compile it as a module and compile the ahci driver into the kernel.  this will give me access to the sata drive and the ata devices (dvd and hdd).  my only concern is booting linux - the sata is the drive that gentoo is installed on, so my first thought is that i need the 6121 driver installed not as a module but statically in the kernel.

if i fully understand, a second option is to turn the ahci driver off, only use the 6121 driver (from your previous patch) compiled into the kernel (not as a module) and also turn on piix4 pata/sata support, if i have appropriate hardware.  here is my lspci output:

```
00:00.0 Host bridge: Intel Corporation DRAM Controller (rev 02)

00:01.0 PCI bridge: Intel Corporation PCI Express Root Port (rev 02)

00:1a.0 USB Controller: Intel Corporation USB UHCI Controller #4 (rev 02)

00:1a.1 USB Controller: Intel Corporation USB UHCI Controller #5 (rev 02)

00:1a.2 USB Controller: Intel Corporation USB UHCI Controller #6 (rev 02)

00:1a.7 USB Controller: Intel Corporation USB2 EHCI Controller #2 (rev 02)

00:1b.0 Audio device: Intel Corporation HD Audio Controller (rev 02)

00:1c.0 PCI bridge: Intel Corporation PCI Express Port 1 (rev 02)

00:1c.4 PCI bridge: Intel Corporation PCI Express Port 5 (rev 02)

00:1c.5 PCI bridge: Intel Corporation PCI Express Port 6 (rev 02)

00:1d.0 USB Controller: Intel Corporation USB UHCI Controller #1 (rev 02)

00:1d.1 USB Controller: Intel Corporation USB UHCI Controller #2 (rev 02)

00:1d.2 USB Controller: Intel Corporation USB UHCI Controller #3 (rev 02)

00:1d.7 USB Controller: Intel Corporation USB2 EHCI Controller #1 (rev 02)

00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev 92)

00:1f.0 ISA bridge: Intel Corporation LPC Interface Controller (rev 02)

00:1f.2 IDE interface: Intel Corporation 2 port SATA IDE Controller (rev 02)

00:1f.3 SMBus: Intel Corporation SMBus Controller (rev 02)

00:1f.5 IDE interface: Intel Corporation 2 port SATA IDE Controller (rev 02)

01:00.0 VGA compatible controller: nVidia Corporation Unknown device 0402 (rev a1)

02:00.0 Ethernet controller: Attansic Technology Corp. L1 Gigabit Ethernet Adapter (rev b0)

03:00.0 IDE interface: Marvell Technology Group Ltd. Unknown device 6121 (rev b1)
```

am i understanding correctly?  i am hoping to try this out tomorrow, however the computer is currently processing about 10000 photos which may force me to wait a day or two.

thanks

----------

## emerald

 *slaterson wrote:*   

> 
> 
> i do have ahci enabled in my bios, i dual boot this computer with windows xp and want to keep the sata controller in ahci mode for performance reasons, at least in windows.
> 
> 

 

To keep AHCI mode is a wise decision, imho, not only in windows but Linux too  :Very Happy: 

Since Windows is in AHCI mode switching to legacy mode would probably not even be possible.

 *slaterson wrote:*   

> 
> 
> to get access to all my hard drives - ata dvd burner, ata hard disk and the sata drive - i need to patch my kernel with the 'dont-claim' patch you provided.
> 
> 

 

To just gain access you only need the Marvell driver patch, in this case both, AHCI and Marvell driver compiled statically into the kernel. The caveat is, your IDE harddrive will become sda, your SATA harddrive besomes sdb, since the Marvell driver is enumerated first by the kernel.

Since gentoo is installed on the SATA drive you need the AHCI driver statically compiled in.

Now, to keep your SATA harddisk as sda, you need the AHCI driver statically, but patched with the don't claim patch, so the AHCI driver will leave the Marvell chip alone and the Marvell driver, compiled as module, should be inserted by udev later on so your IDE devices become accessible. Since you don't need them to boot it's no problem to have the driver as module.

 *slaterson wrote:*   

> 
> 
> if i fully understand, a second option is to turn the ahci driver off, only use the 6121 driver (from your previous patch) compiled into the kernel (not as a module) and also turn on piix4 pata/sata support, if i have appropriate hardware.

 

This - legacy mode - i'm not sure if it really works that way, but it should, use the Marvell driver as module, as before, and use the Intel drivers statically to gain access to your SATA harddrive. But since you might have to switch the harddisk driver in Windows it probably is not an option. (Whether the driver switch works in Windows or not i'm not sure.)

----------

## slaterson

 *emerald wrote:*   

> To keep AHCI mode is a wise decision, imho, not only in windows but Linux too 
> 
> Since Windows is in AHCI mode switching to legacy mode would probably not even be possible.

 

yes, i would definitely prefer to kept it enabled, i have noticed much better performance with it on.

 *emerald wrote:*   

> To just gain access you only need the Marvell driver patch, in this case both, AHCI and Marvell driver compiled statically into the kernel. The caveat is, your IDE harddrive will become sda, your SATA harddrive besomes sdb, since the Marvell driver is enumerated first by the kernel.
> 
> Since gentoo is installed on the SATA drive you need the AHCI driver statically compiled in.
> 
> Now, to keep your SATA harddisk as sda, you need the AHCI driver statically, but patched with the don't claim patch, so the AHCI driver will leave the Marvell chip alone and the Marvell driver, compiled as module, should be inserted by udev later on so your IDE devices become accessible. Since you don't need them to boot it's no problem to have the driver as module.

 

ok, i think i have everything working without applying the dont-claim patch.  i have ahci and marvell compiled statically into the kernel, my sata drive becomes sdb which i can live with if i know it is happening and this morning i did some coherent (meaning i was awake and thinking clearly) investigation and my dvd burner is recognised just fine.  it to had its named changed somewhere along the line since i last used it.

am i missing anything?

thanks a lot for all the help!  i've been trying to get the marvell driver to work since i got this new motherboard a month ago.

----------

## emerald

 *slaterson wrote:*   

> 
> 
> am i missing anything?
> 
> 

 

I don't know if you are missing any hardisks or such  :Wink: 

I got the mainboard last wednesday (one week ago) and, lacking of IDE harddisks, only the DVD writer was unusable, it still bothered me  :Wink:  so i prepared the driver and updated it do be compatible with 2.6.24 and 2.6.25.

I'm glad you have everything working now  :Very Happy: 

----------

## slaterson

when i first got mine i had a major problem as no live cds would recognise my hard drives.  i finally found the rescuecd that would work and then struggled to get the system to boot as i went through kernel config tweaking for a day or two before i found something that actually worked.  now i have been tweaking and testing and trying get better performance, i think after the patch that you provided it is performing rather nicely.

how long before your patch is included in the kernel?  :Smile: 

----------

## emerald

 *slaterson wrote:*   

> when i first got mine i had a major problem as no live cds would recognise my hard drives.  i finally found the rescuecd that would work and then struggled to get the system to boot as i went through kernel config tweaking for a day or two before i found something that actually worked.  now i have been tweaking and testing and trying get better performance, i think after the patch that you provided it is performing rather nicely.
> 
> 

 

I switched from an Athlon64 X2 to Intel Core2 Quad, recompiled the kernel on the old system to support the new hardware, and booted the kernel up in the new system, keeping everything as it was  :Very Happy: 

As live-cd supporting much hardware i can recommend the SystemRescueCD www.sysresccd.org it allows booting a 32 and 64 bit kernel for chrooting too and can be installed to usb stick  :Very Happy: 

I used this one to test the system before i booted up my working system, so i won't destroy anything important.

 *slaterson wrote:*   

> 
> 
> how long before your patch is included in the kernel? 

 

.. i'd say never since this work is based on the work of a marvell programmer, just not kept up-to-date.

----------

## slaterson

ok, one more question from something i noticed...

this is a sata ii controller however dmesg shows this:

```
ata1: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
```

how do i get it to come up at 3.0 Gbps?

thanks!

----------

## emerald

 *slaterson wrote:*   

> 
> 
> how do i get it to come up at 3.0 Gbps?
> 
> 

 

probably using a SATA 2 harddisk:

```

ata2: SATA link up 1.5 Gbps (SStatus 113 SControl 300)

ata2.00: ATA-6: WDC WD3200JD-22KLB0, 08.05J08, max UDMA/100

ata2.00: 625142448 sectors, multi 0: LBA48

ata2.00: configured for UDMA/100

ata3: SATA link up 3.0 Gbps (SStatus 123 SControl 300)

ata3.00: ATA-7: SAMSUNG HD753LJ, 1AA01109, max UDMA7

ata3.00: 1465149168 sectors, multi 0: LBA48 NCQ (depth 31/32)

ata3.00: configured for UDMA/133

```

----------

## Monkeh

Actually, more likely by removing the tiny jumper on the drive which is limiting the speed.

----------

## slaterson

i have a sata ii disk.  its a seagate ST3500630AS

here is some info:

```
#dmesg | grep ata

ata_piix 0000:00:1f.2: version 2.12

ata_piix 0000:00:1f.2: MAP [ P0 -- P1 -- ]

scsi1 : ata_piix

scsi2 : ata_piix

ata1: SATA max UDMA/133 cmd 0xb000 ctl 0xac00 bmdma 0xa480 irq 22

ata2: SATA max UDMA/133 cmd 0xa880 ctl 0xa800 bmdma 0xa488 irq 22

ata1: SATA link up 1.5 Gbps (SStatus 113 SControl 300)

ata1.00: ATA-7: ST3500630AS, 3.AAK, max UDMA/133

ata1.00: 976773168 sectors, multi 16: LBA48 NCQ (depth 0/32)

ata1.00: configured for UDMA/133

ata2: SATA link down (SStatus 0 SControl 300)

ata_piix 0000:00:1f.5: MAP [ P0 -- P1 -- ]

scsi3 : ata_piix

scsi4 : ata_piix

ata3: SATA max UDMA/133 cmd 0xc000 ctl 0xbc00 bmdma 0xb480 irq 22

ata4: SATA max UDMA/133 cmd 0xb880 ctl 0xb800 bmdma 0xb488 irq 22

ata3: SATA link down (SStatus 0 SControl 300)

ata4: SATA link down (SStatus 0 SControl 300)
```

is the intel piix driver taking over here?  disable it in the kernel?

----------

## emerald

hmm, since the ata_piix takes the controller i wonder if it's running in ahci mode?

deactivate the ata_piix in kernel too so this one won't claim the harddrive controller.

 *slaterson wrote:*   

> 
> 
> ```
> 
> ata1.00: ATA-7: ST3500630AS, 3.AAK, max UDMA/133 
> ...

 

ATA-7 seems to mean it's a sata 2 drive, so it's probably the legacy driver

----------

## slaterson

i'll make the kernel update as soon as openoffice is done emerging...

in a previous comment you mentioned upgrading to a quad core...  i went from a p4 3.0 ghz (hyperthreading) with 2 gb of ram to a q6600 with 8 gb of ram.  the speed difference is jaw dropping.  i can do things in 20 minutes with my photography that used to take me a week.  literally.

----------

## slaterson

 *Monkeh wrote:*   

> Actually, more likely by removing the tiny jumper on the drive which is limiting the speed.

 

i missed this message.  i'll have a look at the drive also to see if it has the jumper in place.

thanks!

----------

## emerald

 *slaterson wrote:*   

> i'll make the kernel update as soon as openoffice is done emerging...
> 
> in a previous comment you mentioned upgrading to a quad core...  i went from a p4 3.0 ghz (hyperthreading) with 2 gb of ram to a q6600 with 8 gb of ram.  the speed difference is jaw dropping.  i can do things in 20 minutes with my photography that used to take me a week.  literally.

 

I went from a Athlon64 X2 4400+ with 4G DDR Ram to a C2Q9450 with 8G DDR3 Ram, the effect was similar for me. Most obvious was Openoffice installation, it took like 8+ hours on the Athlon and on the new system not much more than 1 hour (without ccache).

----------

## Monkeh

 *slaterson wrote:*   

>  *Monkeh wrote:*   Actually, more likely by removing the tiny jumper on the drive which is limiting the speed. 
> 
> i missed this message.  i'll have a look at the drive also to see if it has the jumper in place.
> 
> thanks!

 

It will have. Seagate drives ship with them in place. Though really, there's little point in removing them.

----------

## slaterson

removing the jumper did the trick.  no performance gain but its nice to see that the system is operating as it should and the configuration is correct.

thanks!

----------

## Monogram

I just wanted to give my thanks... great job: emerald... I was trying to resolve this issue for over a week now without much luck - till I came across this posting. I applied all patches and now I got my optical drive on Marvell 6121 controller working fine. 

refer to: https://forums.gentoo.org/viewtopic-t-705323.html

May I inquire as to how you achieved this? / how you edited / patched the drivers? I'd love to know.

Thanks again.

----------

## SysGhost

Greetings.

Nice to see there is a solution for the by-now-well-known problem with ahci claiming all SATA controllers it can find.

I tried to reach this patch http://www.home.liji.de/kernel/tmp/ahci-dont-claim-marvell-chips.patch for a while now. Either you are not up and running very much, or it has gone missing.

I could hold a copy of it on my own web-server that are up 24/7 for better availability.

----------

## emerald

 *SysGhost wrote:*   

> I tried to reach this patch http://www.home.liji.de/kernel/tmp/ahci-dont-claim-marvell-chips.patch for a while now. Either you are not up and running very much, or it has gone missing.
> 
> 

 

I was off for 2 days for hardware change, now back on  :Very Happy: 

Anyway, i keep the patches in another location too, just not as current is in the former one.

2.6.25

http://www.emi-sama.de/patches/kernel/2.6.25/marvell_88se61xx.patch

http://www.emi-sama.de/patches/kernel/2.6.25/ahci-dont-claim-marvell-chips.patch

2.6.26

http://www.emi-sama.de/patches/kernel/2.6.26/marvell_88se61xx.patch

http://www.emi-sama.de/patches/kernel/2.6.26/ahci-dont-claim-marvell-chips.patch

2.6.27

http://www.emi-sama.de/patches/kernel/2.6.27/marvell_88se61xx.patch

http://www.emi-sama.de/patches/kernel/2.6.27/ahci-dont-claim-marvell-chips.patch

----------

## SysGhost

Thanks! I'll see if these solves my problems too...

As I mentioned. I'll keep a copy of those patches available aswell: (should be available 24 / 7 as long the server don't explode and burn up violently)

(Those who do download: I don't have my mimetype configured ... yet, so rightclick and choose "save link as". Or cut'n'paste into a simple textdocument)

kernel 2.6.25:

http://ghostnet.sytes.net/patches/kernel/2.6.25/marvell_88se61xx.patch

http://ghostnet.sytes.net/patches/kernel/2.6.25/ahci-dont-claim-marvell-chips.patch

kernel 2.6.26:

http://ghostnet.sytes.net/patches/kernel/2.6.26/marvell_88se61xx.patch

http://ghostnet.sytes.net/patches/kernel/2.6.26/ahci-dont-claim-marvell-chips.patch

----------

## Monogram

I seem to be having a problem (initially: https://forums.gentoo.org/viewtopic-t-705323.html).

I've got everything working thanks to emerald little patch as far as my SATA optical drive on the Marvell 6121 and bios raid on the ati sb600 controller.

However on the Marvel 6111 (which I believe is in fact an IDE interface) I have a ide/pata hard-drive that seems to be going through ahci drivers?

I have Marvell drivers compiled as module as well as related stuff.

I've noticed that the overall operation on the drive is rather slow  (~ 2megs a sec)... and I cant seem to be able to enable DMA on the drive.

Any suggestions?

----------

## emerald

 *Monogram wrote:*   

> 
> 
> However on the Marvel 6111 (which I believe is in fact an IDE interface) I have a ide/pata hard-drive that seems to be going through ahci drivers?
> 
> I have Marvell drivers compiled as module as well as related stuff.
> ...

 

Read this post https://forums.gentoo.org/viewtopic-p-5166961.html#5166961 about the AHCI and Marvell driver interaction.

Edit: wrong post

----------

## SysGhost

Update on my progress here:

That simple "AHCI don't claim 61xx" patch worked just fine.

Next step was trying to get that 6121 driver compiled and loaded (I prefer having it in modular form)

For a while I was looking under SATA section of the menu-configuration (make menuconfig)

...nothing!

After a while I got myself to look under scsi section and there I found it: 

Device Drivers ---> 

   SCSI device support --->

      SCSI low-level drivers --->

         Marvell Storage Controller 6121/6122/6141/6145

Compiled, installed and loaded, I got it working... almost...

As the driver tries to detect my SATA Bluray reader ( Asus BC-1205PT ) it keeps spitting out:

Interrupt Error: 0x40000000 orgIntStatus: 0x40000001 completeSlot=0x1

Still unable to use the BD drive of mine, but under windows it works jyust fine, so I guess there are no hardware faults. It's just the driver not supporting this device... yet...

Guess I have to wait til the next version of the driver is released...

...oh! By the way... where do I download the driver? 

Marvell themselves seems to have only network card drivers and Asus have nothing but a preconfigured 2.6.12 kernel.

----------

## emerald

 *SysGhost wrote:*   

> Update on my progress here:
> 
> [...]
> 
> As the driver tries to detect my SATA Bluray reader ( Asus BC-1205PT ) it keeps spitting out:
> ...

 

Why don't you just connect the BD drive to the Intel sata ports and put move a harddisk, which seems to be working fine, to the marvell chip (the harddrive might be a bit slower but you got a working BD drive instead, for me there'd be no more question)?

 *SysGhost wrote:*   

> 
> 
> ...oh! By the way... where do I download the driver? 
> 
> Marvell themselves seems to have only network card drivers and Asus have nothing but a preconfigured 2.6.12 kernel.

 

The drivers i found at the Asus support webpage for my mainboard, those drivers were declared working at 2.6.18, so i just made them working with the newer kernels. Whether there will ever be a newer driver from Marvell i dare not guess. Marvell themselves don't support non-networking chips directly, so don't expect to find any on their webpage.

----------

## SysGhost

Good idea, but in my case it's the SB600 Chipset since I'm on one "Asus M3A32 MVP Deluxe"

Problems remains, module mv61xx still causes:

"Interrupt Error: 0x40000000 orgIntStatus: 0x40000001 completeSlot=0x1."

It doesn't matter if there's something connected or not.

I start to believe it's a hardware conflict, maybe a simple IRQ conflict... (Strange that it's works just fine under windows, but Windows maybe handle the IRQ's differently)

EDIT: letting the SATA AHCI driver take control of the Marvell 6121 chipset seems to work flawlessly, except the fact I cannot use any Optical drives on it (most SATA optical drives don't support AHCI) ... strange in my opinion...

EDIT 2:

Letting SATA AHCI control Marvell 6121 with Asus BC-1205PT Bluray reader attached causes these errors:

```
ata5.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen

ata5.00: cmd a0/00:00:00:02:00/00:00:00:00:00/a0 tag 0 pio 16388 in

         cdb 51 00 00 00 00 00 00 00  02 00 00 00 00 00 00 00

         res 40/00:03:00:00:00/00:03:00:00:00/a0 Emask 0x4 (timeout)

ata5.00: status: { DRDY }

ata5: hard resetting link

ata5: SATA link up 1.5 Gbps (SStatus 113 SControl 300)

ata5.00: qc timeout (cmd 0xa1)

ata5.00: failed to IDENTIFY (I/O error, err_mask=0x4)

ata5.00: revalidation failed (errno=-5)

ata5: failed to recover some devices, retrying in 5 secs

ata5: hard resetting link

ata5: SATA link up 1.5 Gbps (SStatus 113 SControl 300)

ata5.00: qc timeout (cmd 0xa1)

ata5.00: failed to IDENTIFY (I/O error, err_mask=0x4)

ata5.00: revalidation failed (errno=-5)

ata5: failed to recover some devices, retrying in 5 secs

ata5: hard resetting link

ata5: SATA link up 1.5 Gbps (SStatus 113 SControl 300)

ata5.00: qc timeout (cmd 0xa1)

ata5.00: failed to IDENTIFY (I/O error, err_mask=0x4)

ata5.00: revalidation failed (errno=-5)

ata5.00: disabled

ata5: hard resetting link

ata5: SATA link up 1.5 Gbps (SStatus 113 SControl 300)

ata5: EH complete
```

These errors are because the Bluray reader aren't AHCI compartible, and the controller is initiated in AHCI mode.

Any AHCI compartible device works just fine however.

----------

## blossa

I see that this thread is a few month old now... Do we still need to patch and so on or is this fixed any other way by now?

Thanks emerald for your work!  :Smile: 

----------

## Dew

Yeah, is everything fine in 2.6.27-r2? 

And, can somebody tell me, which patch do I need? And what to compile in kernel for it to work, of course.

----------

## KarlisRepsons

Nice, there is at least a patch for this thing, I used both patches, but the problem still remains about eSATA port, which simply doesn't work.

How about others' experience with it?

----------

## emerald

For me the eSata ports work without problems using the marvell driver, not ahci.

----------

## KarlisRepsons

Have you applied both patches?

Also I found, that somehow IDE becomes unusable, if tuxonice kernel is where it is patched. 

I have:

in lsmod: "mv61xx                 69288  0", 

in kernel messages: 

Marvell (S)ATA Controller is found, using IRQ 16.

scsi6 : Marvell 88SE61xx Storage Controller

It was allright with gentoo-sources, but not with tuxonice. Any idea? I think, I made no mistake...

----------

## KarlisRepsons

Well, I don't understand how can that be: I can start booting gentoo livecd (then it fails, no driver), so hardware is operational, but somehow IDE DVDrw ceased to work even with previously working kernel. Some kind of nightmare. If you have no immediate idea, you can safely neglect...

----------

## emerald

I don't use TuxOnIce since for everything I need the in-kernel suspend/hibernate support is more than adequate for me.

Since the Marvell driver is not incorporated in the live cd the ide port will only work in legacy mode if it even works at all.

So to use a ide cd/dvd drive you'll have to build your own livecd (or change the kernel of the one you wish to use) or get something else to boot off.

Wit your own kernel it should work, if ont just have a look at previous posts (possibly in different threads), there were many things explained and discussed in detail already.

If you wish to use TuxOnIce i'd still recommend to try a regular kernel first, if it works then to try TuxOnIce but there you'll probably have to try to fix most of your problems by yourself, possibly by patching the driver. If you get it to work well with patches i'll gladly incorporate those into the current patches.

----------

## KarlisRepsons

No, no, I understand about livecd.

The scary thing is: I was using this driver with gentoo-sources-2.6.25-r7 and it worked. Now, after some kernel recompiles and BIOS resetting (jumper to delete what is set in BIOS) and reconfiguring (well, I tried to get the same, but not sure) it ceased to work even with same kernel.

Hardware problem? Well, how could it partially boot CD then?

Simply... stupid. "What has happened," I can only think.

----------

## KarlisRepsons

So I apply just one of patches for marvell driver to gentoo-sources, device itself is working (could boot with), but the rest is failure.

Maybe some idea where I could ask how to debug?

Please take a look at your dmesg, what is different from this:

Marvell (S)ATA Controller is found, using IRQ 16.

success to init chip

scsi0 : Marvell 88SE61xx Storage Controller

Driver 'sd' needs updating - please use bus_type methods

Driver 'sr' needs updating - please use bus_type methods

ahci 0000:00:1f.2: version 3.0

ACPI: PCI Interrupt 0000:00:1f.2[B] -> GSI 19 (level, low) -> IRQ 19

ahci 0000:00:1f.2: AHCI 0001.0200 32 slots 6 ports 3 Gbps 0x3f impl SATA mode

ahci 0000:00:1f.2: flags: 64bit ncq sntf stag pm led clo pmp pio slum part

PCI: Setting latency timer of device 0000:00:1f.2 to 64

scsi1 : ahci

scsi2 : ahci

scsi3 : ahci

scsi4 : ahci

scsi5 : ahci

scsi6 : ahci

ata1: SATA max UDMA/133 abar m2048@0xf8ffe800 port 0xf8ffe900 irq 379

ata2: SATA max UDMA/133 abar m2048@0xf8ffe800 port 0xf8ffe980 irq 379

ata3: SATA max UDMA/133 abar m2048@0xf8ffe800 port 0xf8ffea00 irq 379

ata4: SATA max UDMA/133 abar m2048@0xf8ffe800 port 0xf8ffea80 irq 379

ata5: SATA max UDMA/133 abar m2048@0xf8ffe800 port 0xf8ffeb00 irq 379

ata6: SATA max UDMA/133 abar m2048@0xf8ffe800 port 0xf8ffeb80 irq 379

ata1: SATA link up 3.0 Gbps (SStatus 123 SControl 300)

ata1.00: ATA-8: WDC WD6401AALS-00L3B2, 01.03B01, max UDMA/133

ata1.00: 1250263728 sectors, multi 0: LBA48 NCQ (depth 31/32)

ata1.00: configured for UDMA/133

ata2: SATA link down (SStatus 0 SControl 300)

ata3: SATA link down (SStatus 0 SControl 300)

ata4: SATA link down (SStatus 0 SControl 300)

ata5: SATA link down (SStatus 0 SControl 300)

ata6: SATA link down (SStatus 0 SControl 300)

scsi 1:0:0:0: Direct-Access     ATA      WDC WD6401AALS-0 01.0 PQ: 0 ANSI: 5

sd 1:0:0:0: [sda] 1250263728 512-byte hardware sectors (640135 MB)

----------

## emerald

```

mv_thor 0000:03:00.0: setting latency timer to 64

Marvell (S)ATA Controller is found, using IRQ 16.

 for non-raid devices

success to init chip

scsi1 : Marvell 88SE61xx Storage Controller

Driver 'sd' needs updating - please use bus_type methods

scsi 1:0:20:0: CD-ROM            HL-DT-ST DVD-RAM GSA-H22L 1.02 PQ: 0 ANSI: 0

Driver 'sr' needs updating - please use bus_type methods

ahci 0000:00:1f.2: version 3.0

ahci 0000:00:1f.2: PCI INT B -> GSI 22 (level, low) -> IRQ 22

ahci 0000:00:1f.2: AHCI 0001.0200 32 slots 6 ports 3 Gbps 0x3f impl SATA mode

ahci 0000:00:1f.2: flags: 64bit ncq sntf stag pm led clo pmp pio slum part ems

ahci 0000:00:1f.2: setting latency timer to 64

scsi2 : ahci

scsi3 : ahci

scsi4 : ahci

scsi5 : ahci

scsi6 : ahci

scsi7 : ahci

```

For me it looks like that, the marvell chip is initialized in non-raid mode (which i should be correct for dvdrom drives).

----------

## KarlisRepsons

Just for fun, this is what asus support answers:

1) Could you install fresh linux?

2)The motherboard officially supports Windows XP/Vista operating systems.  

So, could you please install a XP OS so that we can figure out this issue easily?

----------

## slaterson

hi emerald.  i tried your website from a few posts above but it seems to be down.  is there a patch for kernel 2.6.29?  i'd like to upgrade but, of course, need the marvell support.  :Smile: 

thanks!

----------

## emerald

The current kernel contains all necessary drivers, the ahci driver and the marvell pata driver will support those chips now, so the marvell driver is no longer necessary.

----------

## slaterson

excellent, thanks.  i took a quick look last night but didn't see it, i'll have a closer look today.

----------

## slaterson

i went through the .29 kernel this morning but couldn't locate the mv_thor driver.  has it been combined with the mv driver?  there is something very different with the new .29 kernel, as when i first booted i got a kernel panic.  had to reboot with the old kernel and change my hard drive device names from sdb to sda.  i remember when i first used you patch after applying the patches i had to rename from sda to sdb, so it seems i am missing something or things have changed under the covers.

thanks

----------

## emerald

The mv_thor is the driver Marvell supplied. The ahci driver supports the sata ports for quite a while now, the 'Marvell PATA support via legacy mode' driver (mv ?) supports the parallel ata ports of this chip now, so the Marvell provided driver is no longer necessary but everything is  working with the in-kernel drivers now.

About renaming the harddisks it's possible it changed in some setups, so just rename it and everything should work well again.

----------

## aceistheplace

This a question for Emerald.

I’ve been wrestling with a Marvell drive controller for some time now and since it appears you have a working knowledge of these devices, I hope you can help me.

I have an Asus P5E WS motherboard.  It has a Marvell drive controller that supposedly can handle two PATA devices and four SATA drives.  The chip is a 6145.  At the moment, I have Linux installed on an IDE hard drive and also have SATA drives connected to the Marvel controller.  I am running Linux version 2.6.30.3.  

The problem is that while Linux see the PATA devices just fine, it never sees the SATA drives.  As I understand it, the current libraries should be able to show both the PATA and SATA devices.

I’m not positive that the problem doesn’t lie with the BIOS.  The regular BIOS has two options for the Marvell chip.  The first option activates/deactivates the Marvell chip.  This has to be in the activate mode for anything to work with the Marvell.  The second option sets the mode for the Marvell chip.  The choices are Disabled, Legacy, and RAID.

Setting the option to Legacy (which is where I currently have it)  allows the BIOS to see the PATA devices in the boot device section, but not the SATA devices.  At this setting, I can install Linux on the IDE drive.  Setting the option to RAID (without actually setting up a RAID array) has the BIOS seeing both the PATA and SATA devices, but with the designation “RAID” in front of their names.  However, with the option in this setting, the Linux install CD will boot, but not find any drives to install on, and then not even find itself at install time.  This is also the case if I switch the setting after installing Linux on the IDE drive.  In the Legacy mode it will boot from the IDE drive, in the RAID mode it will not.

Going into the separate Marvell BIOS, the only options are to setup a RAID array or not,  I have not attempted to setup an array there.

Do you have any insight?  Should I try installing your Marvell driver?  Or maybe the AHCI-don’t-claim  patch?  Perhaps attempt to specify some code at install time so that Linux can detect the drives if the Marvell option is set to RAID in the BIOS?

thanks

----------

## emerald

The in-kernel drivers support the marvell chip in legacy mode, so bios should be set to legacy mode. the sata ports will be handled by the ahci driver, so it's necessary to have this one too. I've built support for both, the ahci and marvell driver into the kernel and the pata and all 4 sata (2 esata) ports work as expected.

----------

## SimianRage

Emerald, I just updated from a 2.6.28 to 2.6.30 kernel and as you stated I didn't need to use the patches anymore to get my IDE DVD working. Just wanted to say thanks a bunch for providing those patches and your knowledge as they were of great value over the past year or so.

----------

## dAlexis

Question about RAID mode and kernel drivers:

Kernel 2.6.31-r3, 

CONFIG_SATA_MV=m

CONFIG_MD_RAID0=y

Dmesg says:

```

dmesg | grep ahci

ahci 0000:00:12.0: version 3.0

ahci 0000:00:12.0: PCI INT A -> GSI 22 (level, low) -> IRQ 22

ahci 0000:00:12.0: AHCI 0001.0100 32 slots 4 ports 3 Gbps 0xf impl SATA mode

ahci 0000:00:12.0: flags: 64bit ncq sntf ilck led clo pmp pio

scsi0 : ahci

scsi1 : ahci

scsi2 : ahci

scsi3 : ahci

ahci 0000:05:00.0: PCI INT A -> GSI 16 (level, low) -> IRQ 16

ahci 0000:05:00.0: controller can't do NCQ, turning off CAP_NCQ

ahci 0000:05:00.0: controller can't do PMP, turning off CAP_PMP

ahci 0000:05:00.0: MV_AHCI HACK: port_map 7 -> 3

ahci 0000:05:00.0: Disabling your PATA port. Use the boot option 'ahci.marvell_enable=0' to avoid this.

ahci: SSS flag set, parallel bus scan disabled

ahci 0000:05:00.0: AHCI 0001.0000 32 slots 3 ports 3 Gbps 0x3 impl RAID mode

ahci 0000:05:00.0: flags: 64bit stag led slum part

ahci 0000:05:00.0: setting latency timer to 64

scsi4 : ahci

scsi5 : ahci

scsi6 : ahci

ahci 0000:07:00.0: PCI INT A -> GSI 19 (level, low) -> IRQ 19

ahci 0000:07:00.0: controller can't do NCQ, turning off CAP_NCQ

ahci 0000:07:00.0: controller can't do PMP, turning off CAP_PMP

ahci 0000:07:00.0: MV_AHCI HACK: port_map 7 -> 3

ahci 0000:07:00.0: Disabling your PATA port. Use the boot option 'ahci.marvell_enable=0' to avoid this.

ahci: SSS flag set, parallel bus scan disabled

ahci 0000:07:00.0: AHCI 0001.0000 32 slots 3 ports 3 Gbps 0x3 impl RAID mode

ahci 0000:07:00.0: flags: 64bit stag led slum part

ahci 0000:07:00.0: setting latency timer to 64

scsi7 : ahci

scsi8 : ahci

scsi9 : ahci

```

Pata support not compiled (only SATA drives are attached: Asus M3A32 MVP Deluxe )

RAID drives (for me - sdc&sdd) are visible, but no raid autodetect and other raid tools dont't see the RAID, created by marvell raid bios.  Partition was created in Vista, but I think that raid bios must set right marks on drives. Any advice?

Maybe, marvell driver is (was?) better, because better raid bios handling?

----------

## emerald

I don't know if Linux supports the Marvel controller in RAID mode at all, so no guarantee given. About your Marvell bios RAID, I don't know if it can be recognized at all, dmraid should do the job for all supported software (fakeraid) raid setups. If you want to try the Marvell provided driver you can use it with an older kernel and try if it works, I won't be keeping the thing up and working for newer kernels since I don't use it at all anymore and in-kernel drivers support the controller as needed. So it would be yours to do. (I don't even know if the Marvell driver provides RAID functionality at all.)

Other than that I'd highly recommend not to to use the Marvell bios RAID at all but only plain harddisks. I for my part loathe all those fakeraid setups, they make you have alot more work and (in my experience) provide hardly any improvement in data rate or anything. And in case your mainboard dies you really have alot of work just to get your data back from those RAID thingies.

----------

## ecore

 *emerald wrote:*   

> The in-kernel drivers support the marvell chip in legacy mode, so bios should be set to legacy mode. the sata ports will be handled by the ahci driver, so it's necessary to have this one too. I've built support for both, the ahci and marvell driver into the kernel and the pata and all 4 sata (2 esata) ports work as expected.

 

Hi, emerald:

I have a Marvell 88SE6141 SATA2 controller chip on my Asus P5WD2-E Premium board, and I couldn't use it under Linux ... I've tried a lot, for example, adding the device id into ahci.c (recent kernels support 6121 and 6145, but do not support 6141, which seems strange to me), but instead of just working, it reports Failed to IDENTIFY and give err_mask 0x80 or 0x04 to me during booting, and no HDD attached could be seen; I also tried to apply the mv_thor (mv61xx) driver to my kernels (2.6.28.9, ..., 2.6.33.2), and it fails to build, then I modified some of the content of the mv61xx driver's source, such as changing the renamed scsi structure and enum with 'blk_' prefix and so on, it compiles, it loads and report successfully initialized the Marvell 6141 chip, but when I add a HDD to one of the 6141's SATA ports, nothing happens, and dmesg shows a HotPlug error with intStatus = 0x80000000, it doesn't work if I reboot the machine with the HDD attached (I think it should not be 'HotPlug'), increasing the debugging level of the mv61xx shows nothing really useful ...

Would you please give me some advice on using the Marvell 6141 chip or could I supply more information?

Thanks!

----------

## Fry-kun

Emerald,

First, thanks for maintaining the mv_thor patches for as long as you did.

Next, apparently there's a problem with the AHCI implementation -- it doesn't support port multipliers. Do you know enough about the mv_thor driver and/or AHCI driver to help me figure out what the problem is? I'm guessing it's some initialization quirk to bring the controller into PMP mode

----------

