Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id ACB5CC77B76 for ; Mon, 17 Apr 2023 09:20:24 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5048585F46; Mon, 17 Apr 2023 11:20:15 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=collabora.com header.i=@collabora.com header.b="YpV4l2h4"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7ACDA85F70; Mon, 17 Apr 2023 11:20:10 +0200 (CEST) Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 4DF4985EC9 for ; Mon, 17 Apr 2023 11:20:05 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=eugen.hristev@collabora.com Received: from eugen-station.. (unknown [86.122.159.151]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: ehristev) by madras.collabora.co.uk (Postfix) with ESMTPSA id 7E5DB660309E; Mon, 17 Apr 2023 10:20:04 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1681723204; bh=tWSrFO6ihjDM1c5Xb769F/EUzv00B7CeeGfzANlwkS4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YpV4l2h4F+z+4R45A21HbAkvyKD/WD6jLMf2ZMrhhHx0oVk1BXtbo0+fuOc1TWIc/ MBn5i/ArGQi1ZDtXt4AboJwzO2S0cmeS6jQhW//ljPu3QME5oLWD0jI2Iy1SU164L+ WGcZ9VENIknJCMVV19Sl1iOUME6e0XXY37Pex9/RdIJ4DSE2VEyR/XUWOiAY4q9h3d lsKymAetqic5jJXg4WnbAzkVY1YGMpxt/nFxvW2MG/Nr/Gmy6FQPcIl9Fj2+NxHB4z MBlce64yDleaQ1Xvqhcl6Gwa9HUiz2XkwEU3UlKH8xvSt29VoWW3C6YiX//yVF+h/b u18hdWuWrq8yg== From: Eugen Hristev To: u-boot@lists.denx.de, kever.yang@rock-chips.com, jonas@kwiboo.se Cc: jagan@edgeble.ai, eugen.hristev@collabora.com, Jon Lin Subject: [PATCH 2/7] pci: pcie_dw_rockchip: Support max_link_speed dts property Date: Mon, 17 Apr 2023 12:19:46 +0300 Message-Id: <20230417091951.4640-2-eugen.hristev@collabora.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230417091951.4640-1-eugen.hristev@collabora.com> References: <20230417091951.4640-1-eugen.hristev@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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.8 at phobos.denx.de X-Virus-Status: Clean From: Jon Lin Add support for max_link_speed specified in the PCI DT binding. Signed-off-by: Jon Lin [eugen.hristev@collabora.com: port to latest API, set default correctly, align to 80 chars] Signed-off-by: Eugen Hristev --- drivers/pci/pcie_dw_rockchip.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/pci/pcie_dw_rockchip.c b/drivers/pci/pcie_dw_rockchip.c index ff121046604a..6a2a5e15646e 100644 --- a/drivers/pci/pcie_dw_rockchip.c +++ b/drivers/pci/pcie_dw_rockchip.c @@ -42,6 +42,7 @@ struct rk_pcie { struct clk_bulk clks; struct reset_ctl_bulk rsts; struct gpio_desc rst_gpio; + u32 gen; }; /* Parameters for the waiting for iATU enabled routine */ @@ -331,7 +332,7 @@ static int rockchip_pcie_init_port(struct udevice *dev) rk_pcie_writel_apb(priv, 0x0, 0xf00040); pcie_dw_setup_host(&priv->dw); - ret = rk_pcie_link_up(priv, LINK_SPEED_GEN_3); + ret = rk_pcie_link_up(priv, priv->gen); if (ret < 0) goto err_link_up; @@ -351,6 +352,7 @@ err_exit_phy: static int rockchip_pcie_parse_dt(struct udevice *dev) { struct rk_pcie *priv = dev_get_priv(dev); + u32 max_link_speed; int ret; priv->dw.dbi_base = (void *)dev_read_addr_index(dev, 0); @@ -397,6 +399,13 @@ static int rockchip_pcie_parse_dt(struct udevice *dev) goto rockchip_pcie_parse_dt_err_phy_get_by_index; } + ret = ofnode_read_u32(dev_ofnode(dev), "max-link-speed", + &max_link_speed); + if (ret < 0 || max_link_speed > 4) + priv->gen = LINK_SPEED_GEN_3; + else + priv->gen = max_link_speed; + return 0; rockchip_pcie_parse_dt_err_phy_get_by_index: -- 2.34.1