Re: ARMADA espressobin SATA drive detection failure
From: Pali Rohár <pali@kernel.org>
Date: 2022-08-12 13:55:14
Subsystem:
generic phy framework, marvell armada 3700 phy drivers, the rest · Maintainers:
Vinod Koul, Miquel Raynal, Linus Torvalds
On Friday 12 August 2022 14:44:07 Pali Rohár wrote:
On Friday 12 August 2022 12:00:28 Shinichiro Kawasaki wrote:quoted
On Aug 12, 2022 / 10:20, Pali Rohár wrote:quoted
On Friday 12 August 2022 04:56:50 Shinichiro Kawasaki wrote:[...]quoted
quoted
I noticed one difference between your system and mine: U-Boot version. On my system, it has rather old version now: Marvell>> version U-Boot 2017.03-armada-17.10.2-g14aeedc (Jun 01 2018 - 15:39:10 +0800) aarch64-linux-gnu-gcc (Linaro GCC 5.2-2015.11-2) 5.2.1 20151005 GNU ld (GNU Binutils) 2.25.0 Linaro 2015_10 Do you think it's worth trying the latest U-boot? -- Shin'ichiro KawasakiYes, please update firmwares to the latests versions. Or at least try to boot new U-Boot via UART (without replacing existing version) and check for differences. Building documentations: https://trustedfirmware-a.readthedocs.io/en/latest/plat/marvell/armada/build.html https://source.denx.de/u-boot/u-boot/-/blob/v2022.07/doc/README.marvell UART booting documentation is currently waiting for review: https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/16198Thanks for the good references. I've managed to build U-Boot for UART booting (I use fedora, then needed to identify Fedora packages corresponding to guided apt packages. I also needed to fix a build failure in A3700-utils-marvell.) I modified board jumper pins to UART mode and downloaded the built U-Boot using mox-imager. The downloaded U-Boot showed the new version and detected my SSD: => version U-Boot 2022.10-rc2-00049-g157861e6af (Aug 12 2022 - 18:10:21 +0900) aarch64-linux-gnu-gcc (GCC) 12.1.1 20220507 (Red Hat Cross 12.1.1-1) GNU ld version 2.37-7.fc36 => scsi scan scanning bus for devices... Device 0: (0:0) Vendor: ATA Prod.: SanDisk SDSSDA24 Rev: U210 Type: Hard Disk Capacity: 228936.5 MB = 223.5 GB (468862128 x 512) However, after booting Linux kernel v5.18.16 from the U-Boot, still the error message "ata1: SATA link down (SStatus 0 SControl 300)" is printed. This may indicate that the error is not related U-Boot. Now I'm not sure what's the key difference between your system and mine. If there is anything I can do next, please let me know. -- Shin'ichiro KawasakiProbably this is SSD disk specific. I will try to prepare some kernel changes to test if it changes something.
Could you please try following change and provide full dmesg log? First I need to know if issue is in SATA power on code or somewhere else.
diff --git a/drivers/phy/marvell/phy-mvebu-a3700-comphy.c b/drivers/phy/marvell/phy-mvebu-a3700-comphy.c
index a4d7d9bd100d..845df563a399 100644
--- a/drivers/phy/marvell/phy-mvebu-a3700-comphy.c
+++ b/drivers/phy/marvell/phy-mvebu-a3700-comphy.c@@ -528,12 +528,49 @@ mvebu_a3700_comphy_set_phy_selector(struct mvebu_a3700_comphy_lane *lane) return -EINVAL; } +#include <linux/arm-smccc.h> + +#define COMPHY_SIP_POWER_ON 0x82000001 +#define COMPHY_FW_MODE_SATA 0x1 +#define COMPHY_FW_MODE(mode) ((mode) << 12) + +static int mvebu_a3700_comphy_smc(unsigned long function, unsigned long lane, + unsigned long mode) +{ + struct arm_smccc_res res; + s32 ret; + + arm_smccc_smc(function, lane, mode, 0, 0, 0, 0, 0, &res); + ret = res.a0; + + switch (ret) { + case SMCCC_RET_SUCCESS: + return 0; + case SMCCC_RET_NOT_SUPPORTED: + return -EOPNOTSUPP; + default: + return -EINVAL; + } +} + static int mvebu_a3700_comphy_sata_power_on(struct mvebu_a3700_comphy_lane *lane) { u32 mask, data, ref_clk; int ret; + u32 fw_param = COMPHY_FW_MODE(COMPHY_FW_MODE_SATA); + + ret = mvebu_a3700_comphy_smc(COMPHY_SIP_POWER_ON, lane->id, fw_param); + if (ret == -EOPNOTSUPP) + dev_err(lane->dev, + "unsupported SMC call, try updating your firmware\n"); + else if (ret) + dev_err(lane->dev, "FAILED mvebu_a3700_comphy_sata_power_on() call\n"); + else + dev_err(lane->dev, "OK mvebu_a3700_comphy_sata_power_on() call\n"); + return ret; + /* Configure phy selector for SATA */ ret = mvebu_a3700_comphy_set_phy_selector(lane); if (ret)
@@ -1069,6 +1106,9 @@ mvebu_a3700_comphy_pcie_power_on(struct mvebu_a3700_comphy_lane *lane) static void mvebu_a3700_comphy_sata_power_off(struct mvebu_a3700_comphy_lane *lane) { + dev_err(lane->dev, "IGNORING mvebu_a3700_comphy_sata_power_off() call\n"); + return; + /* Set phy isolation mode */ comphy_lane_reg_set(lane, COMPHY_ISOLATION_CTRL, PHY_ISOLATE_MODE, PHY_ISOLATE_MODE);
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy