Enabling SATA via SATA_DWC on Meraki MX60W / APM82181

Christian Lamparter chunkeey at gmail.com
Thu Feb 25 09:34:15 EST 2021

Hello Martin,

On 22/02/2021 22:54, Martin Kennedy wrote:
> I did make a post a good while ago to gauge interest (there was none).
> It is here: https://forum.openwrt.org/t/mx60w-any-interest-in-a-diy-nas-guide-need-some-advice-for-sata-pads-and-msata-slot-compatibility/65718

Yeah, this is your personal hobby project, isn't it? There are basically no hardware
mods for the APM82181 as compared to the ath79/ramips/mediatek. For engagement, one
has to really invest there to make it popular.... Honestly, the APM82181 seems to
stagnate at the "working as intended" level.

> I have actually tried kmod-ata-ahci out, but with a potentially
> less-suitable ASM1061. Sadly, once the kmod-ata-ahci module has been
> kmodloaded, the drives will `ata\d.00: failed to IDENTIFY` -- I
> ascribed this to an issue with PCIe init on the platform as you
> described on the linuxppc-dev mailing list, though I had not properly
> poked the device tree to inform the device of this change. The ASM1061
> chipset is known-working on other platforms using OpenWrt (I used two
> ASM1061s in an Aerohive AP330 as my NAS for a while).

I found my minipcie<->sata 2-port thingy.  It's an ASMedia Technology Inc. ASM1062 Serial ATA Controller [1b21:0612]
I don't have a MX60(W) so I used a Netgear WNDAP660. Hope this still counts...

And would you look at that: :)

[   41.780183] IPv6: ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready
[  114.081146] kmodloader: loading kernel modules from /etc/modules.d/*
[  114.165797] ahci 0000:43:00.0: version 3.0
[  114.165836] ahci 0000:43:00.0: enabling device (0006 -> 0007)
[  114.234964] ahci 0000:43:00.0: SSS flag set, parallel bus scan disabled
[  114.314662] ahci 0000:43:00.0: AHCI 0001.0200 32 slots 2 ports 6 Gbps 0x3 impl SATA mode
[  114.411770] ahci 0000:43:00.0: flags: 64bit ncq sntf stag led clo pmp pio slum part ccc sxs
[  114.519719] scsi host0: ahci
[  114.556879] scsi host1: ahci
[  114.592747] ata1: SATA max UDMA/133 abar m512 at 0xe00010000 port 0xe00010100 irq 19
[  114.682614] ata2: SATA max UDMA/133 abar m512 at 0xe00010000 port 0xe00010180 irq 19
[  115.247864] ata1: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
[  115.322963] ata1.00: HPA detected: current 1953523055, native 1953525168
[  115.403754] ata1.00: ATA-8: Hitachi HDT721010SLA360, ST6OA3AA, max UDMA/133
[  115.487348] ata1.00: 1953523055 sectors, multi 0: LBA48 NCQ (depth 32), AA
[  115.661382] ata1.00: configured for UDMA/133
[  115.713002] scsi 0:0:0:0: Direct-Access     ATA      Hitachi HDT72101 A3AA PQ: 0 ANSI: 5
[  115.817054] sd 0:0:0:0: [sda] 1953523055 512-byte logical blocks: (1.00 TB/932 GiB)
[  115.909977] sd 0:0:0:0: [sda] Write Protect is off
[  115.967536] sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00
[  115.968179] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[  116.134055]  sda: sda1
[  116.164790] sd 0:0:0:0: [sda] Attached SCSI disk
[  116.240626] ata2: SATA link down (SStatus 0 SControl 300)
[  116.308487] sd 0:0:0:0: Attached scsi generic sg0 type 0
[  116.375543] kmodloader: done loading kernel modules from /etc/modules.d/*
[  116.543762] kmodloader: loading kernel modules from /etc/modules.d/*
[  116.624340] kmodloader: done loading kernel modules from /etc/modules.d/*
[  116.792215] kmodloader: loading kernel modules from /etc/modules.d/*
[  116.872711] kmodloader: done loading kernel modules from /etc/modules.d/*

root at wndap660:/tmp# hdparm -t /dev/sda

  Timing buffered disk reads: 308 MB in  3.02 seconds = 101.87 MB/sec
(This 100 MB/sec is OK for a 1 GiB 3,5" Hitachi HDD Drive from 2009 I think).

I have the suspecion that your problem is caused by lack of proper to MSI(-X) there.
While the PCIE Hardware in the SoC has support for MSI (it's pcie) and the linux and
DTS has some MSI bits. The linux driver for it needs to be brought into 2021.
What I did was just editing the ahci.c driver in the linux kernel.

I swapped out the existing:

{ PCI_VDEVICE(ASMEDIA, 0x0612), board_ahci },     /* ASM1062 */


{ PCI_VDEVICE(ASMEDIA, 0x0612), board_ahci_nomsi },     /* ASM1062 */

and it then loaded (before it was failing at the same NO_IDENTIFY).

/proc/interrupts also looks "healthy" (for a no-msi setup)

  19:        344       UIC  14 Level     ahci[0000:43:00.0]

(Maybe the pci=nomsi kernel parameter would do the trick as well. Could you
adding this to the bootargs in uboot and check if the ahci.c code now works?)


More information about the openwrt-devel mailing list