From patchwork Sun Apr 19 15:48:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 1272951 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=nic.cz Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=nic.cz header.i=@nic.cz header.a=rsa-sha256 header.s=default header.b=b7jPsKzo; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 494vSM2vsXz9s71 for ; Mon, 20 Apr 2020 01:50:59 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 84C2F81C4D; Sun, 19 Apr 2020 17:49:47 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=nic.cz Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; secure) header.d=nic.cz header.i=@nic.cz header.b="b7jPsKzo"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2135A8082B; Sun, 19 Apr 2020 17:49:24 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail.nic.cz (lists.nic.cz [217.31.204.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id D37BE81A07 for ; Sun, 19 Apr 2020 17:48:56 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=nic.cz Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=marek.behun@nic.cz Received: from dellmb.labs.office.nic.cz (unknown [IPv6:2001:1488:fffe:6:cac7:3539:7f1f:463]) by mail.nic.cz (Postfix) with ESMTP id 81911140F05; Sun, 19 Apr 2020 17:48:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nic.cz; s=default; t=1587311336; bh=/4/gxXbYv5sO2EixMWhk4nQiCVroAEoytR5yJez4BOk=; h=From:To:Date; b=b7jPsKzoIep38F4RBvWLpzvg/sSe2/bDgpG646I26gS1kijFv1/rMGcWS9uKeA8FC rl+pI0iARI897bD5DVRsGrNf6iWH5bqsM2vuvKTM9vhITXW3xHSHZwSWRcc5548DgE GlOuWh4k3UyLhtFkveBftzZzoAYnvV4UV6Z2F+Bw= From: =?utf-8?q?Marek_Beh=C3=BAn?= To: Stefan Roese Cc: u-boot@lists.denx.de, Konstantin Porotchkin , make@marvell.com, Vladimir Vid , "Matwey V . Kornilov" , Miquel Raynal , Gregory CLEMENT , Andrew Lunn , Thomas Petazzoni , Tomasz Maciej Nowak , Ellie Reeves , Vladimir Oltean , Marek Vasut , =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH u-boot-marvell 08/11] ata: ahci_mvebu: add PHY support Date: Sun, 19 Apr 2020 17:48:47 +0200 Message-Id: <20200419154850.25868-9-marek.behun@nic.cz> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200419154850.25868-1-marek.behun@nic.cz> References: <20200419154850.25868-1-marek.behun@nic.cz> MIME-Version: 1.0 X-Spamd-Bar: / X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.2 at phobos.denx.de X-Virus-Status: Clean Use generic-phy API to power on SATA PHY. Signed-off-by: Marek BehĂșn --- drivers/ata/ahci_mvebu.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/drivers/ata/ahci_mvebu.c b/drivers/ata/ahci_mvebu.c index 48a9d00d14..d229ab84ed 100644 --- a/drivers/ata/ahci_mvebu.c +++ b/drivers/ata/ahci_mvebu.c @@ -6,6 +6,7 @@ #include #include #include +#include /* * Dummy implementation that can be overwritten by a board @@ -30,14 +31,48 @@ static int mvebu_ahci_bind(struct udevice *dev) return 0; } +static int mvebu_ahci_phy_power_on(struct udevice *dev) +{ + struct phy phy; + int ret; + + ret = generic_phy_get_by_index(dev, 0, &phy); + if (ret == -ENOENT) + return 0; + + ret = generic_phy_init(&phy); + if (ret) + return ret; + + ret = generic_phy_set_mode(&phy, PHY_MODE_SATA, 0); + if (ret) + goto err; + + ret = generic_phy_power_on(&phy); + if (ret) + goto err; + + return 0; + +err: + generic_phy_exit(&phy); + return ret; +} + static int mvebu_ahci_probe(struct udevice *dev) { + int ret; + /* * Board specific SATA / AHCI enable code, e.g. enable the * AHCI power or deassert reset */ board_ahci_enable(); + ret = mvebu_ahci_phy_power_on(dev); + if (ret) + return ret; + ahci_probe_scsi(dev, (ulong)devfdt_get_addr_ptr(dev)); return 0;