From patchwork Thu Apr 30 21:45:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1146 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pg1-f200.google.com (mail-pg1-f200.google.com [209.85.215.200]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id B6DCD3F077 for ; Thu, 30 Apr 2020 23:46:18 +0200 (CEST) Received: by mail-pg1-f200.google.com with SMTP id v6sf6671533pgh.16 for ; Thu, 30 Apr 2020 14:46:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1588283177; cv=pass; d=google.com; s=arc-20160816; b=spAa1FQ6wwf6A5tqG9PuNSBZJSqCSMMmtaoP5C/8R4/aX8CuWjkST3kdZ2s/5e1mAr MJx9Pzco8eC8gRunE4imWLI0lkWzo4rCLAoDpquNaD6OKn+PAYliSR5X4Ro58J34krHi yV2xbvrRiOXX2SSoHGddCvooAT+pzZCtPq+z5W3ljbr6Cy/6RE9VU+hmObeNXiMs+ktx XDjRd5AnisnJVTDhmIJym6DBX28jHVsbymV6jJTvpV3f7fHV1iXJxw4djCiuFh8BBiHU t5qoJC9CoU7HitRd5gsOgZCfwmC1p5Rx9XWMtJMPucRwU3OFM78MgfrEt0aExt3Wrxtx 1O6g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:references:in-reply-to:message-id:date :subject:cc:to:from:mime-version:dkim-signature; bh=Etan7yew2suL62LHucqSABOAvp8wmcLLyYfo1hqLlzs=; b=UPPQxj6jQC3raZ1wQj4lX2KT+eVWGAo+L1LsZl1ClmNEXzIHcRBYmvswZizNylmeNy eNRDGZ73RpPV1Iz1OhF/tBAhWLEnGX+MpxDVeB79uj1WYU4kJI5JHo5ojIT97wwivXur +zOZ0S/zik6en5kKlBEDXl/8UHNNZDq5Qoxy+4mJ9/FLfkid8kT6rFBSVFWD2sgZT980 UHw68xInHrFNj3dZezhBFfh6r30PeSdkky4qzyUHajKq8KUW/hN+rsikmL7mXcdP2Hdw SPcc/B/QcBraueH83SFYpVBmdIFSyHWG6h6JD8q9FTaryZW5jaMCoXOGU6V8ZZz0wL/o HaMA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Amp9dCYN; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=mime-version:from:to:cc:subject:date:message-id:in-reply-to :references:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=Etan7yew2suL62LHucqSABOAvp8wmcLLyYfo1hqLlzs=; b=rHSsL+k9M3gcqX0Lpzho0FXAbVjsSxto2BhZ9eL7uvuAk+2szktRetfpLXdGpxleEk 9ijOt4G3zDH93QHYb0sIyog+7A7FaFtmFz0NHc1K8NzVgOdJ72dqXTZTS6aqAjXmbENY n140XIotLsGulUIvt7cl9tQnYO0+4zn7oaO74= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:to:cc:subject:date:message-id :in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=Etan7yew2suL62LHucqSABOAvp8wmcLLyYfo1hqLlzs=; b=dF79EMBu1KnH8TVs27kp2E4OG6L9Zxv3+ZFu/Kapm2E5QXpLVwu5stOrkA8wMQkUMZ vtGNfc3klhs0gsB0+ttuYyyFk6L6+oXcHd+Q053VQRvUVHAMgnvMfdGGMifoG6V2sE4F i6cB0CP3p2ULm/6glyuAwTLMpu8RVHRblRQlx2YkPgp/fGClhDB0TxVV9liHxSev55Uz Kpie4OEbLbFRfQ+mushRrpRjo5zhEN4XJwHExmQ8fJhbvqBL8BO5dQhQkinE+tTTC75l baY8nOCDX9ChXoOVu0ih7Oudm0ZqcWbFn0ZTZkVCkUdQsplhIxEdRVsFrSjXJRgmdN16 AyYw== X-Gm-Message-State: AGi0PuZP2NIhXFG2wxcIiQTyBAt2fFOK+jJoJGvjmMCLRSX+BhR0uX+C z3CfQHsP9opBd/o5QGJp/N4kZTwC X-Google-Smtp-Source: APiQypJre+p7tYpetzTZIfrVn4t2xNJMFu8ZFqEG4jD3HF0nsHIlaOKRMGtvoqGTxk1ACwYtI7Dccg== X-Received: by 2002:a63:b606:: with SMTP id j6mr1098199pgf.334.1588283177557; Thu, 30 Apr 2020 14:46:17 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a63:4b5c:: with SMTP id k28ls4115109pgl.0.gmail; Thu, 30 Apr 2020 14:46:17 -0700 (PDT) X-Received: by 2002:a63:ce53:: with SMTP id r19mr941052pgi.395.1588283176611; Thu, 30 Apr 2020 14:46:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588283176; cv=none; d=google.com; s=arc-20160816; b=Of/rTREuuD3K+xnT1SC+MyzgUUIr/jDd6VIZGnh5QA3Xefm3YBAxZDSltoApLxu1He AcWg3vMqLBkUwn+zJcOmvCu8vCcbioBZDbASpraJE2e0S36WOwTzS0/FyaHyZe7je9+T DZjfz+ZUZGTToMPj40mP0Ln/ShipiDOMs3iOzHk/QVV+YbqwpFBygTvKfyZO73QAOzMC +31eyRHPdH8d/rzaxxAc/JQ9tDd5FwllbJ3jsnmFmCrZqLj4j45uMKkMQzPd3mkp7YDc L7Y869epkaQ/ufg6DN6NL0qzRNgUPCM8cTdbO9e7WwKSfiNY8FTfPcGHASQZRZMYkNGC hHoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=GHqGyS+RUNZNqKAv2qm8I0WbTjNQhsUbrp1rtNyYubk=; b=Ce9aJml3MeSS58GHbVl0PDQHOz6t2q8sNmMnF6ojKqKZTJ87qWiX3JwZ/42MtNwhyr 9yjwC/QQUyeW0FwJSeKABmRk6f0fQXE8B98hDguXD39M1dqljHuZMNV9p4M0MVssjS0D +apJNtiEKfKtjVP0hZe5BEMQSg6rpmubxPk1EcNzGyBy1yziBtgoVLKsZfLTOODqAPHR joIuDO4NcAliJ5pXIqr/btIJtKgZXiQBXBVP4GpCi0oGq0urLdCP6ogaPh3ztsJduvBZ ePmEqAdhBkROKETnETQOmKb5Lg0sQnCPv3br3ZyNM0nJPRf/UCuebFgjX7l3SaYnMZPy TAxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Amp9dCYN; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id c8sor1109218pjs.19.2020.04.30.14.46.16 for (Google Transport Security); Thu, 30 Apr 2020 14:46:16 -0700 (PDT) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; X-Received: by 2002:a17:90a:8c3:: with SMTP id 3mr946549pjn.147.1588283176252; Thu, 30 Apr 2020 14:46:16 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c809:c7d5:a9f2:11c6:8c6c:2861]) by smtp.gmail.com with ESMTPSA id p64sm615243pjp.7.2020.04.30.14.46.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2020 14:46:15 -0700 (PDT) From: Jagan Teki To: Kever Yang , Simon Glass , Philipp Tomsich , Tom Rini , Frank Wang , William Wu , Shawn Lin , Heiko Stuebner , Patrice Chotard Cc: u-boot@lists.denx.de, linux-rockchip@lists.infradead.org, linux-amarula@amarulasolutions.com, Jagan Teki Subject: [RFC 6/7] pci: rockchip: Switch to generic-phy Date: Fri, 1 May 2020 03:15:28 +0530 Message-Id: <20200430214529.18887-7-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200430214529.18887-1-jagan@amarulasolutions.com> References: <20200430214529.18887-1-jagan@amarulasolutions.com> X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Amp9dCYN; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Now, we have a PCIe PHY driver as part of the Generic PHY framework. Let's use it instead of legacy PHY driver. Signed-off-by: Jagan Teki --- drivers/pci/pcie_rockchip.c | 20 ++++++++++---------- drivers/pci/pcie_rockchip.h | 5 +++++ 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/drivers/pci/pcie_rockchip.c b/drivers/pci/pcie_rockchip.c index 82a8396e42..3e4ba9635f 100644 --- a/drivers/pci/pcie_rockchip.c +++ b/drivers/pci/pcie_rockchip.c @@ -159,8 +159,6 @@ static int rockchip_pcie_atr_init(struct rockchip_pcie *priv) static int rockchip_pcie_init_port(struct udevice *dev) { struct rockchip_pcie *priv = dev_get_priv(dev); - struct rockchip_pcie_phy *phy = pcie_get_phy(priv); - struct rockchip_pcie_phy_ops *ops = phy_get_ops(phy); u32 cr, val, status; int ret; @@ -185,7 +183,7 @@ static int rockchip_pcie_init_port(struct udevice *dev) return ret; } - ret = ops->init(phy); + ret = generic_phy_init(&priv->pcie_phy); if (ret) { dev_err(dev, "failed to init phy (ret=%d)\n", ret); goto err_exit_phy; @@ -242,7 +240,7 @@ static int rockchip_pcie_init_port(struct udevice *dev) cr |= PCIE_CLIENT_CONF_ENABLE | PCIE_CLIENT_MODE_RC; writel(cr, priv->apb_base + PCIE_CLIENT_CONFIG); - ret = ops->power_on(phy); + ret = generic_phy_power_on(&priv->pcie_phy); if (ret) { dev_err(dev, "failed to power on phy (ret=%d)\n", ret); goto err_power_off_phy; @@ -311,9 +309,9 @@ static int rockchip_pcie_init_port(struct udevice *dev) return 0; err_power_off_phy: - ops->power_off(phy); + generic_phy_power_off(&priv->pcie_phy); err_exit_phy: - ops->exit(phy); + generic_phy_exit(&priv->pcie_phy); return ret; } @@ -436,6 +434,12 @@ static int rockchip_pcie_parse_dt(struct udevice *dev) return ret; } + ret = generic_phy_get_by_index(dev, 0, &priv->pcie_phy); + if (ret) { + dev_err(dev, "failed to get pcie-phy (ret=%d)\n", ret); + return ret; + } + return 0; } @@ -453,10 +457,6 @@ static int rockchip_pcie_probe(struct udevice *dev) if (ret) return ret; - ret = rockchip_pcie_phy_get(dev); - if (ret) - return ret; - ret = rockchip_pcie_set_vpcie(dev); if (ret) return ret; diff --git a/drivers/pci/pcie_rockchip.h b/drivers/pci/pcie_rockchip.h index c3a0a2846d..4b06110bfe 100644 --- a/drivers/pci/pcie_rockchip.h +++ b/drivers/pci/pcie_rockchip.h @@ -9,6 +9,8 @@ * */ +#include + #define HIWORD_UPDATE(mask, val) (((mask) << 16) | (val)) #define HIWORD_UPDATE_BIT(val) HIWORD_UPDATE(val, val) @@ -126,6 +128,9 @@ struct rockchip_pcie { struct udevice *vpcie3v3; struct udevice *vpcie1v8; struct udevice *vpcie0v9; + + /* phy */ + struct phy pcie_phy; }; int rockchip_pcie_phy_get(struct udevice *dev);