From patchwork Mon Feb 7 09:36:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 1589224 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=rWP2djdv; dkim-atps=neutral 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=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4JsgyS0n0Xz9s9c for ; Mon, 7 Feb 2022 20:36:48 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id ED277834E4; Mon, 7 Feb 2022 10:36:38 +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="rWP2djdv"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1365E83C6F; Mon, 7 Feb 2022 10:36:38 +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-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) (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 3ECC3834D2 for ; Mon, 7 Feb 2022 10:36:35 +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-ed1-x534.google.com with SMTP id cn6so5993102edb.5 for ; Mon, 07 Feb 2022 01:36:35 -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:mime-version :content-transfer-encoding; bh=Ts3HIyftRTu+3S1Zf234QZuc17cFuaEkej7qdhq/v1k=; b=rWP2djdv7+Xh3BkUsZM453M7YX56rNrK5g18wzseOOgerQlR1IZTrujNYjPzYKLGyg +p89+VtPYDUjpCVpZa6Dy/ywPYv+9htT34oammqgXT/JybiN07M/fKt0cXE8BzXcfpIl RN016gWPZOrYLzzSoXvt3FUcpyu6J8E+vpoiLp7dZU2CtGY18OV2AREXWj3Pey+9ygjX 8cX7klHD0Ejc491bBLiBsk+23TySVR5fbkBZBbAiOYfZcMhS4uMSsntVIcsnJP7/5Vt6 bcWHcw5Sz7+n6Az5CTavCUUMbRQFINHkg54x6bzzvTfuzCz7PZCyENn4WZ+Qquhy9/ui jLEA== 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 :mime-version:content-transfer-encoding; bh=Ts3HIyftRTu+3S1Zf234QZuc17cFuaEkej7qdhq/v1k=; b=67ffmxSPA5H6YLC3ELADPLSQ66/d074PUdbH+qaEhoFjP8/PGmySCOAkA4jIcz+ntj bxDAYOffObiPOqCQ4b4XzAixXyorpiXflfwcXyBNp/9iNuSmxfO1NhGgDji9jEeCrWsH RmRrZoyA2+amwfaBWnSvga2FFRTAnfBb6c3qp+xhNzz/tRE3OOHwmhdex3RUWYMz49pe o78JVDo0/8jle5AfMyfPwf2qMIYxqPzBd6YEUrt+HJnYAUnt2HxSD+Jx+I3UIMxRgppY C8TCj0lo//LL+8MreO7YzTfasnds4z5nFaWLfGwZyMWMe1cPHqo5v3Ya3oBj5M3iqBen DIAg== X-Gm-Message-State: AOAM530Jqrb2sj6GASoajaeiNACXxXiC59xN1OttSwx8bFe47wcPVCkr aCpoDDwHrw79Nb2rELzS32ic+0DqYry2Ng== X-Google-Smtp-Source: ABdhPJyMaz+CvR5GsafjYr6e4oaR+g6gCQcH+bQYw4GUTEHxTiXZXM3d/a4xBgU2ezUl+1JXSK/4fQ== X-Received: by 2002:a05:6402:5110:: with SMTP id m16mr12963438edd.325.1644226594678; Mon, 07 Feb 2022 01:36:34 -0800 (PST) Received: from localhost ([2a02:768:2307:40d6::f9e]) by smtp.gmail.com with ESMTPSA id q10sm3513331ejn.3.2022.02.07.01.36.34 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 07 Feb 2022 01:36:34 -0800 (PST) From: Michal Simek To: u-boot@lists.denx.de, git@xilinx.com Cc: Joe Hershberger , Michal Simek Subject: [PATCH v2 1/2] phy: zynqmp: Add support for sata and DP phy initialization Date: Mon, 7 Feb 2022 10:36:32 +0100 Message-Id: X-Mailer: git-send-email 2.35.0 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 DP is untested but just c&p from Linux driver. Sata is tested on kv260-revA board which has SATA connector populated. Signed-off-by: Michal Simek --- Changes in v2: Revoke default case - reported by T Karthik Reddy drivers/phy/phy-zynqmp.c | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/drivers/phy/phy-zynqmp.c b/drivers/phy/phy-zynqmp.c index 9dc3d426a3d3..08c1b6efcfdc 100644 --- a/drivers/phy/phy-zynqmp.c +++ b/drivers/phy/phy-zynqmp.c @@ -373,6 +373,29 @@ static void xpsgtr_bypass_scrambler_8b10b(struct xpsgtr_phy *gtr_phy) xpsgtr_write_phy(gtr_phy, L0_TX_DIG_61, L0_TM_DISABLE_SCRAMBLE_ENCODER); } +/* DP-specific initialization. */ +static void xpsgtr_phy_init_dp(struct xpsgtr_phy *gtr_phy) +{ + xpsgtr_write_phy(gtr_phy, L0_TXPMD_TM_45, + L0_TXPMD_TM_45_OVER_DP_MAIN | + L0_TXPMD_TM_45_ENABLE_DP_MAIN | + L0_TXPMD_TM_45_OVER_DP_POST1 | + L0_TXPMD_TM_45_OVER_DP_POST2 | + L0_TXPMD_TM_45_ENABLE_DP_POST2); + xpsgtr_write_phy(gtr_phy, L0_TX_ANA_TM_118, + L0_TX_ANA_TM_118_FORCE_17_0); +} + +/* SATA-specific initialization. */ +static void xpsgtr_phy_init_sata(struct xpsgtr_phy *gtr_phy) +{ + struct xpsgtr_dev *gtr_dev = gtr_phy->dev; + + xpsgtr_bypass_scrambler_8b10b(gtr_phy); + + writel(gtr_phy->lane, gtr_dev->siou + SATA_CONTROL_OFFSET); +} + /* SGMII-specific initialization. */ static void xpsgtr_phy_init_sgmii(struct xpsgtr_phy *gtr_phy) { @@ -427,9 +450,12 @@ static int xpsgtr_init(struct phy *x) case ICM_PROTOCOL_SGMII: xpsgtr_phy_init_sgmii(gtr_phy); break; - case ICM_PROTOCOL_DP: case ICM_PROTOCOL_SATA: - return -EINVAL; + xpsgtr_phy_init_sata(gtr_phy); + break; + case ICM_PROTOCOL_DP: + xpsgtr_phy_init_dp(gtr_phy); + break; } dev_dbg(gtr_dev->dev, "lane %u (type %u, protocol %u): init done\n", 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);