Enabling SATA via SATA_DWC on Meraki MX60W / APM82181

Martin Kennedy hurricos at gmail.com
Sun Feb 21 14:54:26 EST 2021


I would like to get the HDD port on the MX60 / MX60W working.

Knowing that the APM82181 muxes PCIe and SATA, I tried replacing the
PCIe WLAN module with an mSATA one, and disabling PCIe in the MX60
device tree, but enabling SATA0/1:

--- a/target/linux/apm821xx/dts/meraki-mx60.dts
+++ b/target/linux/apm821xx/dts/meraki-mx60.dts
@@ -169,31 +169,46 @@
     };
 };

-&PCIE0 {
-    /* Leave this enabled as u-boot on the MX60 will disable it for us */
+&SATA0 {
     status = "okay";
+    drive0: sata-port at 0 {
+        reg = <0>;
+    };
+};

-    /*
-     * relevant lspci topology:
-     *
-     *    -+-[0000:40]---00.0-[41-7f]----00.0
-     */
-
-    bridge at 64,0 {
-        reg = <0x00400000 0 0 0 0>;
-        #address-cells = <3>;
-        #size-cells = <2>;
-        ranges;
-
-        wifi0: wifi at 65,0 {
-            /* Atheros AR9380 2.4/5GHz */
-            compatible = "pci168c,0030";
-            reg = <0x00410000 0 0 0 0>;
-            interrupts = <1>; /* INTA */
-        };
+&SATA1 {
+    status = "okay";
+    drive1: sata-port at 0 {
+        reg = <0>;
     };
 };

+
+/* &PCIE0 { */
+/*     /\* Leave this enabled as u-boot on the MX60 will disable it
for us *\/ */
+/*     status = "okay"; */
+
+/*     /\* */
+/*      * relevant lspci topology: */
+/*      * */
+/*      *    -+-[0000:40]---00.0-[41-7f]----00.0 */
+/*      *\/ */
+
+/*     bridge at 64,0 { */
+/*         reg = <0x00400000 0 0 0 0>; */
+/*         #address-cells = <3>; */
+/*         #size-cells = <2>; */
+/*         ranges; */
+
+/*         wifi0: wifi at 65,0 { */
+/*             /\* Atheros AR9380 2.4/5GHz *\/ */
+/*             compatible = "pci168c,0030"; */
+/*             reg = <0x00410000 0 0 0 0>; */
+/*             interrupts = <1>; /\* INTA *\/ */
+/*         }; */
+/*     }; */
+/* }; */
+
 &MSI {
     status = "okay";
 };

I also enabled CONFIG_SATA_DWC_DEBUG=y for all nand-boards before recompiling:

--- a/target/linux/apm821xx/nand/config-default
+++ b/target/linux/apm821xx/nand/config-default
@@ -14,7 +14,7 @@ CONFIG_ATA_BMDMA=y
 CONFIG_SATA_PMP=y
 CONFIG_GENERIC_PHY=y
 CONFIG_SATA_DWC=y
-# CONFIG_SATA_DWC_DEBUG is not set
+CONFIG_SATA_DWC_DEBUG=y
 CONFIG_SCSI=y
 CONFIG_BLK_DEV_SD=y
 CONFIG_GPIOLIB=y

I received repeated errors similar to those from a previous mailing list entry
on the AmigaOne (this line is approximate) : https://lkml.org/lkml/2016/4/23/116

sata-dwc 4bffd1000.sata: sata_dwc_error_intr SCR_ERROR=0x00020000
intpr=0x00000088 status=0x000000d0 dma_intp=187 pending=0 issued=0

These errors eventually triggered a kernel oops the first time
around. On the second boot, I removed the mSATA card after the
repeated errors began - they stopped temporarily, but restarted upon
reapplication of the drive.  They went away entirely after disabling
USB in the device tree, though still no drive appears.

--- a/target/linux/apm821xx/dts/meraki-mx60.dts
+++ b/target/linux/apm821xx/dts/meraki-mx60.dts
@@ -40,10 +40,10 @@
     status = "okay";
 };

-&USBOTG0 {
-    status = "okay";
-    dr_mode = "host";
-};
+/* &USBOTG0 { */
+/*     status = "okay"; */
+/*     dr_mode = "host"; */
+/* }; */

 &EBC0 {
     /* Buckminster has 1GiB of NAND */

I have soldered a SATA power+data header onto an MX60W's pads; I have
bridged solder on four points where 1nF 0102 SMD capacitor should have
been placed to avoid DC bias. Still, despite a WG Green 3.5" drive,
Sandisk U100 8GB 2.5" drive and Toshiba 250GB 2.5" HDD all certainly
powering on on boot, none of these were recognized; instead, I only
got a 'SATA link down' once the port had been probed and IRQs set up.

Does DesignWare SATA on the APM82181 require U-boot's involvement to
initialize? Or am I missing something from the OpenWrt side? Would
attempting to boot Debian instead be a good idea?



More information about the openwrt-devel mailing list