[PATCH 2/8] net: ti: am65-cpsw: Add support for multi port independent MAC mode
Vignesh Raghavendra
vigneshr at ti.com
Fri Jan 21 05:18:53 CET 2022
On 30/12/21 1:01 am, Ramon Fried wrote:
> On Fri, Dec 24, 2021 at 9:25 AM Vignesh Raghavendra <vigneshr at ti.com> 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 <vigneshr at ti.com>
>> ---
[...]
>> -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
More information about the U-Boot
mailing list