From mboxrd@z Thu Jan 1 00:00:00 1970 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 7A685C433EF for ; Fri, 21 Jan 2022 04:19:09 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 29EE183818; Fri, 21 Jan 2022 05:19:07 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=ti.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=ti.com header.i=@ti.com header.b="qa+5Z4GH"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2820C838B0; Fri, 21 Jan 2022 05:19:06 +0100 (CET) Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) (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 DDF51837E4 for ; Fri, 21 Jan 2022 05:19:02 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=vigneshr@ti.com Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 20L4IuiM010991; Thu, 20 Jan 2022 22:18:56 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1642738736; bh=mms6t/HFt0XSm9y2vzgCew1EMoxRt9emRNeuW1y+N3c=; h=Date:Subject:To:CC:References:From:In-Reply-To; b=qa+5Z4GHSsKXVVAMedw6STqigqiOc/E4k4FWdQa0umzVd8zW0ri1lfw6JIxbd0vPP sXeoSCDoeK3aAjKcxsx+IvPS8VaWc6dCfxQ2OIOPyawFqm5I/s5yjSvBeR7joIopQx K8auvwtWZACC+lsK84y7pOiG5aymBKBk9e1Ct314= Received: from DFLE100.ent.ti.com (dfle100.ent.ti.com [10.64.6.21]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 20L4Iutj123827 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 20 Jan 2022 22:18:56 -0600 Received: from DFLE106.ent.ti.com (10.64.6.27) by DFLE100.ent.ti.com (10.64.6.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14; Thu, 20 Jan 2022 22:18:56 -0600 Received: from fllv0040.itg.ti.com (10.64.41.20) by DFLE106.ent.ti.com (10.64.6.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14 via Frontend Transport; Thu, 20 Jan 2022 22:18:56 -0600 Received: from [10.250.235.90] (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id 20L4Irh9015860; Thu, 20 Jan 2022 22:18:54 -0600 Message-ID: <55a8b3ea-0840-e471-26ad-f1903fcafe4a@ti.com> Date: Fri, 21 Jan 2022 09:48:53 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH 2/8] net: ti: am65-cpsw: Add support for multi port independent MAC mode Content-Language: en-US To: Ramon Fried CC: Dave Gerlach , Joe Hershberger , Tom Rini , U-Boot Mailing List , Grygorii Strashko References: <20211224072536.270251-1-vigneshr@ti.com> <20211224072536.270251-3-vigneshr@ti.com> From: Vignesh Raghavendra In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 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 On 30/12/21 1:01 am, Ramon Fried wrote: > On Fri, Dec 24, 2021 at 9:25 AM Vignesh Raghavendra wrote: >> >> On certain TI SoC, like AM64x there is a CPSW3G which supports 2 >> external independent MAC ports for single CPSW instance. >> It is not possible for Ethernet driver to register more than one port >> for given instance. >> >> This patch modifies top level CPSW NUSS as UCLASS_MISC and binds >> UCLASS_ETH to individual ports so as to support bring up more than one >> Ethernet interface in U-Boot. >> >> Note that there is no isolation in the since, CPSW NUSS is in promisc >> mode and forwards all packets to host. > So both ports are working in parallel, how do I choose from which port to exit ? One would have to chose active port with ethact. Packet from non active port is dropped by the driver. >> >> Since top level driver is now UCLASS_MISC, board files would need to >> instantiate this driver explicitly. >> >> Signed-off-by: Vignesh Raghavendra >> --- [...] >> -static int am65_cpsw_probe_cpsw(struct udevice *dev) >> +static int am65_cpsw_port_probe(struct udevice *dev) >> { >> struct am65_cpsw_priv *priv = dev_get_priv(dev); >> struct eth_pdata *pdata = dev_get_plat(dev); >> struct am65_cpsw_common *cpsw_common; >> - ofnode ports_np, node; >> - int ret, i; >> + char portname[15]; >> + int ret; >> >> priv->dev = dev; >> >> - cpsw_common = calloc(1, sizeof(*priv->cpsw_common)); >> - if (!cpsw_common) >> - return -ENOMEM; >> + cpsw_common = dev_get_priv(dev->parent); >> priv->cpsw_common = cpsw_common; >> >> + sprintf(portname, "%s%s", dev->parent->name, dev->name); >> + device_set_name(dev, portname); >> + >> + ret = am65_cpsw_ofdata_parse_phy(dev); >> + if (ret) >> + goto out; >> + >> + am65_cpsw_gmii_sel_k3(priv, pdata->phy_interface, priv->port_id); >> + >> + ret = am65_cpsw_mdio_init(dev); >> + if (ret) >> + goto out; >> + >> + ret = am65_cpsw_phy_init(dev); >> + if (ret) >> + goto out; >> +out: >> + return ret; >> +} >> + >> +static int am65_cpsw_probe_nuss(struct udevice *dev) >> +{ >> + struct am65_cpsw_common *cpsw_common = dev_get_priv(dev); >> + ofnode ports_np, node; >> + int ret, i; >> + struct udevice *port_dev; >> + >> cpsw_common->dev = dev; >> cpsw_common->ss_base = dev_read_addr(dev); >> if (cpsw_common->ss_base == FDT_ADDR_T_NONE) >> @@ -723,10 +750,9 @@ static int am65_cpsw_probe_cpsw(struct udevice *dev) >> if (disabled) >> continue; >> >> - priv->port_id = port_id; >> - ret = am65_cpsw_ofdata_parse_phy(dev, node); >> + ret = device_bind_driver_to_node(dev, "am65_cpsw_nuss_port", ofnode_get_name(node), node, &port_dev); >> if (ret) >> - goto out; >> + printf("SCREEEM\n"); > Please handle reasonably. Oops, sorry, I missed to clean this up before posting... Since the patch is merged, will send a followup patch addressing the same. [...] Regards Vignesh