From patchwork Mon Feb 7 09:36:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 1589225 X-Patchwork-Delegate: monstr@monstr.eu Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=monstr-eu.20210112.gappssmtp.com header.i=@monstr-eu.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=L9PAwoxn; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4Jsgyb0klHz9s9c for ; Mon, 7 Feb 2022 20:36:55 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7A3C583C9B; Mon, 7 Feb 2022 10:36:44 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=monstr-eu.20210112.gappssmtp.com header.i=@monstr-eu.20210112.gappssmtp.com header.b="L9PAwoxn"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 701F383C9B; Mon, 7 Feb 2022 10:36:41 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id DD13F8354B for ; Mon, 7 Feb 2022 10:36:36 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=monstr@monstr.eu Received: by mail-ej1-x62c.google.com with SMTP id o12so40180010eju.13 for ; Mon, 07 Feb 2022 01:36:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20210112.gappssmtp.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rneBILmigwWQEv7mTY5nh2kTuo0Fh3WkA1en2Sy02/k=; b=L9PAwoxnGqoLRVh1vigoAG6jWp3utBBmCYI8U+cY/z0JHO64yOKBlsE1yaZGUanzNU 3pzXgDCfgbrmEEEr5slMF39B+NuMLZ+JmT51ZrjpLbyEWsDrayHRKVdjCdKQh8LoxLfh C45a8lhIQ0d1yjsj4GALBxja4z/7m/AoUjo4dcPtvU9ID22hredC61Di+Hnl0yKrmo44 sI3Pqmsayr1f8a6fnaUpMFyRyUsTSx2JY4uBDMA21DyMjWs9rmBlIL2GmCUoWLVpUDk5 6BbgZFYgwNDrm5qLHA+A3Gg/qYeQI3HH5gShmOzi1LvnEVSH33RD3G8NyGmNrBTiuHwX yOyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=rneBILmigwWQEv7mTY5nh2kTuo0Fh3WkA1en2Sy02/k=; b=33sdNgt2uf3UCf3ouNGScamoB3sc2ZL2smCGs1T8CCX1MsX7oQeaAI9AU5NeuMKW29 5B5RlvR7IqdjAyQBufPRd12v8LZnz+7eASpAL4LSnMh959AKnE0f3jjEFMbeoThV9DZz WHki2xL/X4urTup0NAE4g1CllRVHrVF6nc022IGAN2ZtjcabTmyYnQPoBgjFaIi4MrhD pYNqcQS7dhc5z5wjEShopFQu0tfY38yT42yLq63fopmqAQP3V7+d9MUtTDkpuwqZ+wDX bgvQn3acALQqOswU85Ufn/2fBu49vG57hoqb5R+btPLM5gTQSkXwirch0xCUwEf2eETE WA0w== X-Gm-Message-State: AOAM5317csWPyd5xOFRaAe0UXWzH3tV1G2gmxILYizAUWEurJ2hARGcq GIZh0BUzp5cKfjuDO7cc5jbjjhk61esyXA== X-Google-Smtp-Source: ABdhPJyhYFzrbjylYrHfPat1iYGmu6gmZSYbzoELx8qWUekeKE86OkiCuyh7FDyHA0fKNmTECEbG+g== X-Received: by 2002:a17:906:7712:: with SMTP id q18mr9121558ejm.434.1644226596374; Mon, 07 Feb 2022 01:36:36 -0800 (PST) Received: from localhost ([2a02:768:2307:40d6::f9e]) by smtp.gmail.com with ESMTPSA id w22sm3498752ejc.137.2022.02.07.01.36.35 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 07 Feb 2022 01:36:35 -0800 (PST) From: Michal Simek To: u-boot@lists.denx.de, git@xilinx.com Cc: Vladimir Oltean , Michael Walle , Priyanka Jain Subject: [PATCH v2 2/2] scsi: ceva: Enable PHY and reset support Date: Mon, 7 Feb 2022 10:36:33 +0100 Message-Id: X-Mailer: git-send-email 2.35.0 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.103.5 at phobos.denx.de X-Virus-Status: Clean Add phy and reset support for ceva sata IP. Phy and reset are optional properties that's why detect if description is available. If not just continue with operation. This code was tested on Xilinx Kria SOM kv260-revA with sata connector populated. Signed-off-by: Michal Simek Reviewed-by: Vladimir Oltean --- Changes in v2: - Add Vladimir's tag drivers/ata/sata_ceva.c | 44 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/drivers/ata/sata_ceva.c b/drivers/ata/sata_ceva.c index b71f10223da8..43bcc59cd282 100644 --- a/drivers/ata/sata_ceva.c +++ b/drivers/ata/sata_ceva.c @@ -6,9 +6,12 @@ #include #include #include +#include #include +#include #include #include +#include #include /* Vendor Specific Register Offsets */ @@ -181,6 +184,47 @@ static int sata_ceva_bind(struct udevice *dev) static int sata_ceva_probe(struct udevice *dev) { struct ceva_sata_priv *priv = dev_get_priv(dev); + struct phy phy; + int ret; + struct reset_ctl_bulk resets; + + ret = generic_phy_get_by_index(dev, 0, &phy); + if (!ret) { + dev_dbg(dev, "Perform PHY initialization\n"); + ret = generic_phy_init(&phy); + if (ret) + return ret; + } else if (ret != -ENOENT) { + dev_dbg(dev, "could not get phy (err %d)\n", ret); + return ret; + } + + /* reset is optional */ + ret = reset_get_bulk(dev, &resets); + if (ret && ret != -ENOTSUPP && ret != -ENOENT) { + dev_dbg(dev, "Getting reset fails (err %d)\n", ret); + return ret; + } + + /* Just trigger reset when reset is specified */ + if (!ret) { + dev_dbg(dev, "Perform IP reset\n"); + ret = reset_deassert_bulk(&resets); + if (ret) { + dev_dbg(dev, "Reset fails (err %d)\n", ret); + reset_release_bulk(&resets); + return ret; + } + } + + if (phy.dev) { + dev_dbg(dev, "Perform PHY power on\n"); + ret = generic_phy_power_on(&phy); + if (ret) { + dev_dbg(dev, "PHY power on failed (err %d)\n", ret); + return ret; + } + } ceva_init_sata(priv);