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 7B964C04A95 for ; Tue, 25 Oct 2022 09:57:48 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E7F8E84D6D; Tue, 25 Oct 2022 11:57:45 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.b="Wr2KA85z"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id ED94C84DE5; Tue, 25 Oct 2022 11:57:41 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2068.outbound.protection.outlook.com [40.107.220.68]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id B74FB84D24 for ; Tue, 25 Oct 2022 11:57:34 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=michal.simek@amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=F42dajLhgyV5EpYGyAKe1G4hAVzNf7RKexxb0kEnOAzHIWArUyyRQ8rKAycJ3RK3O9cE5uIehcJLm9THchEbHKc3GYxwCGM5N8OtmhmSEmzNHtHej3Kef5Gkity89cBArS3+Yt/Jmz7YpJlDsrfMdBPSpcmp8HHCTw9e7H5KOGwSy/4DPZ5EXm73TEv99DUq2kE82N1ciIpP4CRoH62CR9OCSVeIEHP0/WqrKNo+cX0TTUn75QqHcUDAqX/q4Vz4wh9C0PLroipPNW3sKQmABaOs9ZQLfKPz/VJA1Yskg1+TULYhCCc9hQE29d0apOU3+kHji9ya41D5gFn5ZuzCaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=80/N5I616DbMXVSmt/ngcZN0CeRKQqgsCSNUECfITn4=; b=N8Vo+acHhT6J03c6n4AErvqLIQ3GEKERykceyWHHbbqVAE5inMTkAUHnFLxwaBHgUQ87B2BAT6a9c2M5y8c49MDHvu3Uvo3kxAL+w8mqEAs/tTP3oPAjpxuYGX/OBbgbR0YW4lVQeSEAoHSMYHFjMgyTBFMSZ9y4SAw5R9ReRUTkkZ5MqX8vcW+IhmRzAcMcCWMnlbU6k1/nYYaMCNbj7a40Tbi+Vw/E/aPMzExj9D1Ape9MMLYRnCHd3o3XPFIvfpEW6ZdC5CZNn52YHZjhnjdTQEX/gnxvoIYvOI2nMI3MUTpYFUDrJG1+RLTyCbgJFz660o3k78dd3vSew1FZbw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=sifive.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=80/N5I616DbMXVSmt/ngcZN0CeRKQqgsCSNUECfITn4=; b=Wr2KA85zq29xxeZSj88SMau6k75xWxww1n/9qIDnq17AcEnoozTKSNpgEsz32Yq1RgW7+9/zDEYE2NPKsu1cIewGNGkugQVYjarEBJlwnSqRwrwOGbDELdxCq68e9HKt6UqgoGFKOoxjVv3AmhVTdBzbUdBfH9ClziF18ScsPns= Received: from BN0PR02CA0010.namprd02.prod.outlook.com (2603:10b6:408:e4::15) by MW5PR12MB5650.namprd12.prod.outlook.com (2603:10b6:303:19e::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.29; Tue, 25 Oct 2022 09:57:31 +0000 Received: from BN8NAM11FT094.eop-nam11.prod.protection.outlook.com (2603:10b6:408:e4:cafe::b3) by BN0PR02CA0010.outlook.office365.com (2603:10b6:408:e4::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.27 via Frontend Transport; Tue, 25 Oct 2022 09:57:31 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT094.mail.protection.outlook.com (10.13.176.131) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5746.16 via Frontend Transport; Tue, 25 Oct 2022 09:57:31 +0000 Received: from [10.254.241.52] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 25 Oct 2022 04:57:28 -0500 Message-ID: <29f3f4ab-6a06-3d9a-ffb9-d95c500f4936@amd.com> Date: Tue, 25 Oct 2022 11:57:23 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 Subject: Re: [PATCH 1/2] net:xilinx_axi: add PCS/PMA PHY Content-Language: en-US To: Andy Chiu , "Katakam, Harini" CC: , , , References: <20221017111928.462866-1-andy.chiu@sifive.com> <20221017111928.462866-2-andy.chiu@sifive.com> From: Michal Simek In-Reply-To: <20221017111928.462866-2-andy.chiu@sifive.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT094:EE_|MW5PR12MB5650:EE_ X-MS-Office365-Filtering-Correlation-Id: ad542db1-bcf6-44c5-9b6e-08dab66f5518 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gsubJmCtUzV81TZ5Kogh++dhmkyuZhCYTXVpreQwWDNhosR56vBQ9aYOJd72IucBKrUl6RJuDEhvjeu2umHTozVsQtZy17AOMFweO9q2XXj8B/BYVbCuT6QRwmpbGVLDpCamnaYmj8xsn45SgyTJfKzjK/nLqM8adUAdfRDT17oSeXl/1zztk3U8nBw7RUn+kD7jtQhmSW/baYQADdV5ZTA0xIxTHD9s2lSpucym/L5c/7ymH8ne/qGuvH3Lc0AUFUs7eWsr53Fj38zpjyiZfPL1BYCz6hilX9F89nCSuIdjmVK9Lxhwec5MD14pzhrEdgTPBuNVD6CRTd3A9mw5jDT96kQo+pxW3lKYOtw+MxXeheoAswsvZLWZIfr1d1T3INdBOT3nl8FE8L4aAnOebTQztAvOfakep+iXNXrRQO0StucLqsvEI0fzug7XWsl3pH6mYk0lWw3yeaPn6BKTjYtrGDD7aBOkx7Ge+177hplhkV1BIcLH9puk+CPRdATL4Bbak81ga1bdO2iWMTBL/xlZMOHmfIFetxwJwtnzCdt0owMtwvbt/I66wbT9XjL+UjPK+SNfjWy+O/xGr2jH/0h5Q79GC+4E6ltaMJHn8ygt0Hpy4l2ArFF0eUl0LZ/kL4tfOGZlu7dsOnkEFvRAssW0H+dPGn50OBPizaa+waaRoVsUJgatwhlE5JwdZIPlyoTo2zVHqzbz2pmzJsoFJ/5zAKb4EaaxtFoWynpvTMJp77po9gpDyY978zqLat23A/Rgaffg6n4jdiW3MBRNs3tfib3KUMYpQNpVvh0Ojeljm46MlR3jyaM78aNovSqv6nx+k/DQ4z4AQnx02ejtFYCMRzi5RAdQHx6ndEbkbQ4= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(136003)(346002)(396003)(376002)(39860400002)(451199015)(40470700004)(46966006)(36840700001)(4326008)(6666004)(54906003)(5660300002)(966005)(356005)(8936002)(41300700001)(83380400001)(36756003)(8676002)(36860700001)(82310400005)(44832011)(40460700003)(110136005)(16526019)(478600001)(70586007)(16576012)(6636002)(40480700001)(82740400003)(26005)(47076005)(31696002)(316002)(81166007)(2616005)(426003)(336012)(53546011)(31686004)(2906002)(186003)(86362001)(70206006)(43740500002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2022 09:57:31.1178 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ad542db1-bcf6-44c5-9b6e-08dab66f5518 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT094.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW5PR12MB5650 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.6 at phobos.denx.de X-Virus-Status: Clean Please add one more space in subject. net:xilinx_axi: add PCS/PMA PHY On 10/17/22 13:19, Andy Chiu wrote: > If we bridge an external PHY to Xilinx's PCS/PMA PHY and would like to > get and set the real status of the PHY facing the external world. Then > we should phy_connect() to the external PHY instead of the PCS/PMA one. > Thus, we add a pcs-phy DT entry, which have been merged in Linux, and > leave the configuration of it to the driver itself. > > Unlike Linux, where the PCS/PMA PHY is managed by phylink, managing the > PCS/PMA PHY is only internal to the driver in U-Boot. The PCS/PMA PHY > pressents only when the phy-mode is configured as SGMII or 1000Base-X, > so it is always 1 Gbps and full-duplex and we may skip passing link > information out. > > Signed-off-by: Andy Chiu > Reviewed-by: Greentime Hu > --- > drivers/net/xilinx_axi_emac.c | 26 ++++++++++++++++++++++++-- > 1 file changed, 24 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/xilinx_axi_emac.c b/drivers/net/xilinx_axi_emac.c > index 04277b1269..447e1d4c9c 100644 > --- a/drivers/net/xilinx_axi_emac.c > +++ b/drivers/net/xilinx_axi_emac.c > @@ -107,6 +107,7 @@ struct axidma_plat { > struct eth_pdata eth_pdata; > struct axidma_reg *dmatx; > struct axidma_reg *dmarx; > + int pcsaddr; > int phyaddr; > u8 eth_hasnobuf; > int phy_of_handle; > @@ -117,6 +118,7 @@ struct axidma_plat { > struct axidma_priv { > struct axidma_reg *dmatx; > struct axidma_reg *dmarx; > + int pcsaddr; > int phyaddr; > struct axi_regs *iobase; > phy_interface_t interface; > @@ -299,6 +301,13 @@ static int axiemac_phy_init(struct udevice *dev) > if (IS_ENABLED(CONFIG_DM_ETH_PHY)) > priv->phyaddr = eth_phy_get_addr(dev); > > + /* > + * Set address of PCS/PMA PHY to the one pointed by phy-handle for > + * backward compatibility. > + */ > + if (priv->phyaddr != -1 && priv->pcsaddr == 0) > + priv->pcsaddr = priv->phyaddr; > + > if (priv->phyaddr == -1) { > /* Detect the PHY address */ > for (i = 31; i >= 0; i--) { > @@ -342,12 +351,12 @@ static int setup_phy(struct udevice *dev) > * after DMA and ethernet resets and hence > * check and clear if set. > */ > - ret = phyread(priv, priv->phyaddr, MII_BMCR, &temp); > + ret = phyread(priv, priv->pcsaddr, MII_BMCR, &temp); > if (ret) > return 0; > if (temp & BMCR_ISOLATE) { > temp &= ~BMCR_ISOLATE; > - ret = phywrite(priv, priv->phyaddr, MII_BMCR, temp); > + ret = phywrite(priv, priv->pcsaddr, MII_BMCR, temp); > if (ret) > return 0; > } > @@ -778,6 +787,7 @@ static int axi_emac_probe(struct udevice *dev) > > if (priv->mactype == EMAC_1G) { > priv->eth_hasnobuf = plat->eth_hasnobuf; > + priv->pcsaddr = plat->pcsaddr; > priv->phyaddr = plat->phyaddr; > priv->phy_of_handle = plat->phy_of_handle; > priv->interface = pdata->phy_interface; > @@ -855,6 +865,8 @@ static int axi_emac_of_to_plat(struct udevice *dev) > > if (plat->mactype == EMAC_1G) { > plat->phyaddr = -1; > + /* PHYAD 0 always redirects to the PCS/PMA PHY */ > + plat->pcsaddr = 0; > > offset = fdtdec_lookup_phandle(gd->fdt_blob, node, > "phy-handle"); > @@ -872,6 +884,16 @@ static int axi_emac_of_to_plat(struct udevice *dev) > > plat->eth_hasnobuf = fdtdec_get_bool(gd->fdt_blob, node, > "xlnx,eth-hasnobuf"); > + > + if (pdata->phy_interface == PHY_INTERFACE_MODE_SGMII || > + pdata->phy_interface == PHY_INTERFACE_MODE_1000BASEX) { > + offset = fdtdec_lookup_phandle(gd->fdt_blob, node, > + "pcs-phy"); Based on https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/net/xilinx_axienet.txt?h=v6.1-rc2#n72 you should be using pcs-handle instead of pcs-phy. Thanks, Michal