Linux-PHY Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali@kernel.org>
To: Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Cc: "linux-phy@lists.infradead.org" <linux-phy@lists.infradead.org>,
	"kabel@kernel.org" <kabel@kernel.org>,
	Damien Le Moal <Damien.LeMoal@wdc.com>
Subject: Re: ARMADA espressobin SATA drive detection failure
Date: Fri, 12 Aug 2022 15:55:05 +0200	[thread overview]
Message-ID: <20220812135505.vukoik6moxzedlq6@pali> (raw)
In-Reply-To: <20220812124407.pdjjxpsf6pddsmsr@pali>

On Friday 12 August 2022 14:44:07 Pali Rohár wrote:
> On Friday 12 August 2022 12:00:28 Shinichiro Kawasaki wrote:
> > On Aug 12, 2022 / 10:20, Pali Rohár wrote:
> > > On Friday 12 August 2022 04:56:50 Shinichiro Kawasaki wrote:
> > 
> > [...]
> > 
> > > > 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 Kawasaki
> > > 
> > > Yes, 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/+/16198
> > 
> > Thanks 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 Kawasaki
> 
> Probably 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

  reply	other threads:[~2022-08-12 13:55 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-31 12:41 ARMADA espressobin SATA drive detection failure Shinichiro Kawasaki
2022-05-31 14:00 ` Marek Behún
2022-06-06  1:57   ` Shinichiro Kawasaki
2022-08-09  9:42 ` Pali Rohár
2022-08-10 10:36   ` Shinichiro Kawasaki
2022-08-12  4:56     ` Shinichiro Kawasaki
2022-08-12  8:20       ` Pali Rohár
2022-08-12 12:00         ` Shinichiro Kawasaki
2022-08-12 12:44           ` Pali Rohár
2022-08-12 13:55             ` Pali Rohár [this message]
2022-08-13  0:02               ` Shinichiro Kawasaki
2022-08-13  0:15                 ` Pali Rohár
2022-08-13  1:00                   ` Shinichiro Kawasaki
2022-08-13  1:03                     ` Pali Rohár
2022-08-13  1:35                       ` Shinichiro Kawasaki
2022-08-13  9:32                         ` Pali Rohár
2022-08-13 11:53                           ` Shinichiro Kawasaki
2022-08-13 12:01                             ` Pali Rohár
2022-08-13 12:47                               ` Shinichiro Kawasaki
2022-08-13 12:50                                 ` Pali Rohár
2022-08-13 23:02                                   ` Shinichiro Kawasaki
2022-08-13 23:10                                     ` Pali Rohár
2022-08-25 13:00                                       ` Pali Rohár
2022-08-25 22:15                                         ` Marek Behún
2022-08-26  5:00                                           ` Shinichiro Kawasaki
2022-08-26 12:05                                             ` Marek Behún
2022-08-29  0:20                                               ` Shinichiro Kawasaki
2022-08-29  8:33                                                 ` Pali Rohár
2022-08-26  7:28                                           ` Pali Rohár
2022-08-25 13:04                                       ` Pali Rohár
2022-08-26  4:57                                         ` Shinichiro Kawasaki
2022-08-26  7:34                                           ` Pali Rohár

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220812135505.vukoik6moxzedlq6@pali \
    --to=pali@kernel.org \
    --cc=Damien.LeMoal@wdc.com \
    --cc=kabel@kernel.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=shinichiro.kawasaki@wdc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox