From patchwork Wed Jan 19 14:18:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 1581795 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=ZTjYB4uQ; 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 4Jf7762qxKz9t6g for ; Thu, 20 Jan 2022 01:19:14 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 97778811BB; Wed, 19 Jan 2022 15:19:08 +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="ZTjYB4uQ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 31D62834E5; Wed, 19 Jan 2022 15:19:07 +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.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) (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 AA6AB80FE7 for ; Wed, 19 Jan 2022 15:19:03 +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-x531.google.com with SMTP id j23so7481719edp.5 for ; Wed, 19 Jan 2022 06:19:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20210112.gappssmtp.com; s=20210112; h=sender:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=p2sVikRJ09QsJyWURvVfqB5SlwDj1UgYnW5W/6o7rtw=; b=ZTjYB4uQhvKxH8k4CjQQvF87m5NKWyDbBs4GXoeEqRl90lXoBzrTp0eFaGl8/Hbyae 0v5NE4R4duApZ6oq3vp7ycYK46b46UKiPYuJoqjJOZoe1J5U9y/MQOkoX5rJsZC/D7at mD3u15MGDDSmAEyPcLcqpe5Exax++WsyvDRkl05+xEoMvMlT0gQOJYhu88nasDXUICay 6nn3qBfywcinlY5Us/hWOW+GkjVK7J7goYhf145LYLftnpnjK3kPedvoPaskVgIHWZLd DbLi9i3zsxcRUh6HEcIW13b6R3/5xkGbznd/0eMUyOcUcy/hAgW1lxs0d2+XvP1B87Sy HQTA== 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:subject:date:message-id :mime-version:content-transfer-encoding; bh=p2sVikRJ09QsJyWURvVfqB5SlwDj1UgYnW5W/6o7rtw=; b=YGGN0tzJZbE0sF3X8ch1R0HIs7hDplpexMY6qnxiyX2znu7QZAN/Ajxj86/JOZt2su gQdiXifgKfgJbunerk2cVOHOokbFHW+Ht2nMacYFBNDdlB9mj3CpuyuVDSjp1QLWf8ih ko1uPklOwxdJIJalTopGhTKiiZerVRWuQH9wbC8kjSpPDZmWHjRYC7sKYaKonz9fLeN9 nmIsW2UZW3K9aadACWx3zFBGY9fmusnH2j0t/EvTKsD9+W5NZOeY6XoVzsExDfuHUvl4 NgpDhXT+aHztw2F/URskUhcTgyYaqyBDC2qujcNMtVoEiN1F4H8gFefWTo0NZ4QhaibO NdYg== X-Gm-Message-State: AOAM531mWGsJL8TkNynGOhuF/9A37mTXKLiJx3X1NiUBA0eZpxeQbHU6 ulMR0Ez3q9TjGJ96Csw/tWgnH9C4IReh00wU X-Google-Smtp-Source: ABdhPJw/kMSTjy9rxXi2PlwhA5prGIPtWS+KWfAHT3ge0jikyaGt8SszeqfGWyJCgnxe6pE+otJEzA== X-Received: by 2002:a05:6402:2204:: with SMTP id cq4mr3277315edb.383.1642601942313; Wed, 19 Jan 2022 06:19:02 -0800 (PST) Received: from localhost ([2a02:768:2307:40d6::f9e]) by smtp.gmail.com with ESMTPSA id la13sm626109ejb.109.2022.01.19.06.19.01 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 19 Jan 2022 06:19:01 -0800 (PST) From: Michal Simek To: u-boot@lists.denx.de, git@xilinx.com Subject: [PATCH 1/2] phy: zynqmp: Add support for sata and DP phy initialization Date: Wed, 19 Jan 2022 15:18:53 +0100 Message-Id: <813b8a08a02be1c7cd7f0a0810032db6d3ad52e3.1642601930.git.michal.simek@xilinx.com> X-Mailer: git-send-email 2.34.1 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.2 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 --- drivers/phy/phy-zynqmp.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/drivers/phy/phy-zynqmp.c b/drivers/phy/phy-zynqmp.c index 9dc3d426a3d3..c5c7d3a2982c 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,8 +450,13 @@ 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: + xpsgtr_phy_init_sata(gtr_phy); + break; + case ICM_PROTOCOL_DP: + xpsgtr_phy_init_dp(gtr_phy); + break; + default: return -EINVAL; }