{"id":2221769,"url":"http://patchwork.ozlabs.org/api/1.2/patches/2221769/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/patch/20260410-topic-cpsw-switch-v2026-07-next-v1-3-c914724b13e4@baylibre.com/","project":{"id":18,"url":"http://patchwork.ozlabs.org/api/1.2/projects/18/?format=json","name":"U-Boot","link_name":"uboot","list_id":"u-boot.lists.denx.de","list_email":"u-boot@lists.denx.de","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20260410-topic-cpsw-switch-v2026-07-next-v1-3-c914724b13e4@baylibre.com>","list_archive_url":null,"date":"2026-04-10T11:04:05","name":"[3/4] net: cpsw: Use driver data for phy_sel","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"8317fba8168d23efbb5a95889067c2631dd73b86","submitter":{"id":82333,"url":"http://patchwork.ozlabs.org/api/1.2/people/82333/?format=json","name":"Markus Schneider-Pargmann (TI)","email":"msp@baylibre.com"},"delegate":{"id":157425,"url":"http://patchwork.ozlabs.org/api/1.2/users/157425/?format=json","username":"jforissier","first_name":"Jerome","last_name":"Forissier","email":"jerome.forissier@linaro.org"},"mbox":"http://patchwork.ozlabs.org/project/uboot/patch/20260410-topic-cpsw-switch-v2026-07-next-v1-3-c914724b13e4@baylibre.com/mbox/","series":[{"id":499440,"url":"http://patchwork.ozlabs.org/api/1.2/series/499440/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/list/?series=499440","date":"2026-04-10T11:04:02","name":"net: cpsw: Add cpsw-switch DT binding support","version":1,"mbox":"http://patchwork.ozlabs.org/series/499440/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2221769/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2221769/checks/","tags":{},"related":[],"headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=baylibre-com.20251104.gappssmtp.com\n header.i=@baylibre-com.20251104.gappssmtp.com header.a=rsa-sha256\n header.s=20251104 header.b=o+lR6fD9;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de\n (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de;\n envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org)","phobos.denx.de;\n dmarc=none (p=none dis=none) header.from=baylibre.com","phobos.denx.de;\n spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de","phobos.denx.de;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=baylibre-com.20251104.gappssmtp.com\n header.i=@baylibre-com.20251104.gappssmtp.com header.b=\"o+lR6fD9\";\n\tdkim-atps=neutral","phobos.denx.de;\n dmarc=none (p=none dis=none) header.from=baylibre.com","phobos.denx.de;\n spf=pass smtp.mailfrom=msp@baylibre.com"],"Received":["from phobos.denx.de (phobos.denx.de\n [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fsYqS2PbZz1y2d\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 10 Apr 2026 21:05:08 +1000 (AEST)","from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id 13F6B84199;\n\tFri, 10 Apr 2026 13:04:50 +0200 (CEST)","by phobos.denx.de (Postfix, from userid 109)\n id B401B8419C; Fri, 10 Apr 2026 13:04:41 +0200 (CEST)","from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com\n [IPv6:2a00:1450:4864:20::32a])\n (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits))\n (No client certificate requested)\n by phobos.denx.de (Postfix) with ESMTPS id 5BBF284105\n for <u-boot@lists.denx.de>; Fri, 10 Apr 2026 13:04:37 +0200 (CEST)","by mail-wm1-x32a.google.com with SMTP id\n 5b1f17b1804b1-488a29e6110so21890885e9.3\n for <u-boot@lists.denx.de>; Fri, 10 Apr 2026 04:04:37 -0700 (PDT)","from localhost ([2001:4091:a246:8598:4c79:7b44:ca74:c5de])\n by smtp.gmail.com with ESMTPSA id\n 5b1f17b1804b1-488d681ecd5sm17588125e9.19.2026.04.10.04.04.36\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Fri, 10 Apr 2026 04:04:36 -0700 (PDT)"],"X-Spam-Checker-Version":"SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,\n DKIM_VALID,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham\n autolearn_force=no version=3.4.2","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=baylibre-com.20251104.gappssmtp.com; s=20251104; t=1775819077;\n x=1776423877;\n darn=lists.denx.de;\n h=cc:to:in-reply-to:references:message-id:content-transfer-encoding\n :mime-version:subject:date:from:from:to:cc:subject:date:message-id\n :reply-to; bh=vBVWWARiE/U5RerqrTVYs5Kew8r11V7W6NHM5GIr89o=;\n b=o+lR6fD9ubkKAHTZsu7GJssocJOUNNp3unlkpz6y6vRtnqWP0IZBTI7ds4gCf/2rUJ\n I3OWBLIvtgbIPxMQRo2GUBzTmXxhK76sNo0yd4yjoXSBYXvcL6Dm9VP6/9SrA8b67YsH\n NFUOo+VCcyFq/rzelY82HPXEJw9TbTlm/5kvSqemU13sDKBszynKCMlRNAA3TzcYr7Fc\n G5j29xwzSRaZBucCdDMon4MvZtw6S9NDZt/BZvrf4D9+QwzUxSqyl8jXWLHj5wAsB70N\n RDC9jmlt70t2Pn0oqUlMMxN82mvs41MFwIlZGKvjUB+PQBTI3rH0rGdLbJ6vmYgNUFZj\n J+VQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1775819077; x=1776423877;\n h=cc:to:in-reply-to:references:message-id:content-transfer-encoding\n :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to\n :cc:subject:date:message-id:reply-to;\n bh=vBVWWARiE/U5RerqrTVYs5Kew8r11V7W6NHM5GIr89o=;\n b=RhWLyYcxp+vx9Ldxyc/LFaqqRg0uWtHQS+tOb72v2IBr1tl02KJuDgpqA1JM9gVF31\n MYWHQ4pGWir9BIXrQ7WpEZNsYL17RWyv7HDhnO2jpUx+3OCv3uwUqV+b0q+92VpRfTpo\n nhSA+/EzOzGu1RX8B++rOXcOrrHvnM77i0XsUIW5JWqcx45Kntovw1Iwwm4+bOcphkKE\n 8fyn7T7tGZiHtMR2OKLRwcrJe3lIiNpyaoQ41U/GyoWO/IvReCZd9PgK3qGTBllnYbwf\n pHRBe9QalZSMmhnSRZY35Cx9KGevMAkjICOQyeg9RN3u0ljlsQuALEVVl2vHvPtIvopd\n /nkA==","X-Gm-Message-State":"AOJu0YzV8eFZ7mA0tG0pCQ279gjE07fMLPwXx71v155cSb5IkVYXxaMQ\n ktfDNOTPTb4YFnSwf9uqubjIPOmlcHoJWMBMOgyTFA+4iS9DZI4vY+1XtvgSPbEHXdc=","X-Gm-Gg":"AeBDieuEqDQrxl57vAMKW8EefcHXS/jRsTeSc1I/IE/ivyPYNfx1wmzUdrv4ExVJ58l\n M9Jlpl5qwSqxKERBfioM1eiNfeufCVEuCeU7jnCUT/BwBl4g0jOtCjCWrFJOL1/JjqcBVQZYZdp\n WHgHlLEwc4ufmdKWT2g6Ket/Ybjod5uYhWmJMIVUJ2TsA8ubl5nMYEQyBKHiXMmEibCnmitztuz\n 7uYNHAyx+OebrWkHMKKHbThjvDfbHGOgt4hZbCl559qF4OP8PGgHp6NnkfHwf5NGmndqXW05a9/\n cPzA4fcOamL1Fo8S49/pDpzDlpt7ZKAtyfbSbDaNUe/iSFrAw6DvwpDUaZ3Q5pM9uxAgpNWHgBT\n MjZQGFoIdqp/J6LGfBD+AqkGOpIJf3rGSbnBz5j1/gSVuQOUvv8/K3m6UoQhHlPfXZEaT1OML76\n vO4O4sY2m9Fu8qIBNshHdkSFStuxHbj4w=","X-Received":"by 2002:a05:600c:8595:b0:485:3b00:f93b with SMTP id\n 5b1f17b1804b1-488d6ab8082mr25731875e9.31.1775819076669;\n Fri, 10 Apr 2026 04:04:36 -0700 (PDT)","From":"\"Markus Schneider-Pargmann (TI)\" <msp@baylibre.com>","Date":"Fri, 10 Apr 2026 13:04:05 +0200","Subject":"[PATCH 3/4] net: cpsw: Use driver data for phy_sel","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"7bit","Message-Id":"\n <20260410-topic-cpsw-switch-v2026-07-next-v1-3-c914724b13e4@baylibre.com>","References":"\n <20260410-topic-cpsw-switch-v2026-07-next-v1-0-c914724b13e4@baylibre.com>","In-Reply-To":"\n <20260410-topic-cpsw-switch-v2026-07-next-v1-0-c914724b13e4@baylibre.com>","To":"u-boot@lists.denx.de","Cc":"Jerome Forissier <jerome.forissier@arm.com>,\n Tom Rini <trini@konsulko.com>,\n \"Markus Schneider-Pargmann (TI)\" <msp@baylibre.com>","X-Mailer":"b4 0.14.2","X-Developer-Signature":"v=1; a=openpgp-sha256; l=2491; i=msp@baylibre.com;\n h=from:subject:message-id; bh=ciu1GP6BGxcvj1E+kKXDkvBl+hBgQYNeE1oUeiZKczs=;\n b=owGbwMvMwCXWejAsc4KoVzDjabUkhswbN81DdW+0m5x9Glx2eJ2Qa1FgRXWB6iynxf4eR+ezc\n e8Jnbumo5SFQYyLQVZMkaUzMTTtv/zOY8mLlm2GmcPKBDKEgYtTACaSoMLIcPhzxLLbujd2sHKG\n 35v+VrFT7PpmrlNdfJuClVIkZ5m7qTD8dxCTnV23jmfXN/t9qwrrb0YVn56zZvueiyw5Ao8infp\n z+AA=","X-Developer-Key":"i=msp@baylibre.com; a=openpgp;\n fpr=BADD88DB889FDC3E8A3D5FE612FA6A01E0A45B41","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.39","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<https://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=subscribe>","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>","X-Virus-Scanned":"clamav-milter 0.103.8 at phobos.denx.de","X-Virus-Status":"Clean"},"content":"Use driver data to pass the correct gmii_sel function. This way new\ncompatibles don't need manual compatible matching as is done in\ncpsw_phy_sel().\n\nSigned-off-by: Markus Schneider-Pargmann (TI) <msp@baylibre.com>\n---\n drivers/net/ti/cpsw.c | 32 +++++++++++++++++++++++---------\n 1 file changed, 23 insertions(+), 9 deletions(-)","diff":"diff --git a/drivers/net/ti/cpsw.c b/drivers/net/ti/cpsw.c\nindex c844416d50ca3db9bb0d9ffe56cd9c352b8c58b0..b1fb009822e9586886e5487e4fbeee115eec9a59 100644\n--- a/drivers/net/ti/cpsw.c\n+++ b/drivers/net/ti/cpsw.c\n@@ -216,6 +216,10 @@ struct cpsw_priv {\n \tu32\t\t\t\tphy_mask;\n };\n \n+struct cpsw_driver_data {\n+\tvoid (*gmii_sel)(struct cpsw_priv *priv, phy_interface_t phy_mode);\n+};\n+\n static inline int cpsw_ale_get_field(u32 *ale_entry, u32 start, u32 bits)\n {\n \tint idx;\n@@ -1067,6 +1071,13 @@ static void cpsw_gmii_sel_dra7xx(struct cpsw_priv *priv,\n static void cpsw_phy_sel(struct cpsw_priv *priv, phy_interface_t phy_mode)\n {\n \tconst char *compat = priv->data->phy_sel_compat;\n+\tconst struct cpsw_driver_data *drv_data =\n+\t\t(const struct cpsw_driver_data *)dev_get_driver_data(priv->dev);\n+\n+\tif (drv_data && drv_data->gmii_sel) {\n+\t\tdrv_data->gmii_sel(priv, phy_mode);\n+\t\treturn;\n+\t}\n \n \tif (!strcmp(compat, \"ti,am3352-cpsw-phy-sel\"))\n \t\tcpsw_gmii_sel_am3352(priv, phy_mode);\n@@ -1222,13 +1233,6 @@ static int cpsw_eth_of_to_plat(struct udevice *dev)\n \n \t\t\tif (ofnode_read_bool(subnode, \"rmii-clock-ext\"))\n \t\t\t\tdata->rmii_clock_external = true;\n-\n-\t\t\tdata->phy_sel_compat = ofnode_read_string(subnode,\n-\t\t\t\t\t\t\t\t  \"compatible\");\n-\t\t\tif (!data->phy_sel_compat) {\n-\t\t\t\tpr_err(\"Not able to get gmii_sel compatible\\n\");\n-\t\t\t\treturn -ENOENT;\n-\t\t\t}\n \t\t}\n \t}\n \n@@ -1253,9 +1257,19 @@ static int cpsw_eth_of_to_plat(struct udevice *dev)\n \treturn 0;\n }\n \n+static const struct cpsw_driver_data cpsw_data_am3352 = {\n+\t.gmii_sel = cpsw_gmii_sel_am3352,\n+};\n+\n+static const struct cpsw_driver_data cpsw_data_dra7xx = {\n+\t.gmii_sel = cpsw_gmii_sel_dra7xx,\n+};\n+\n static const struct udevice_id cpsw_eth_ids[] = {\n-\t{ .compatible = \"ti,cpsw\" },\n-\t{ .compatible = \"ti,am335x-cpsw\" },\n+\t{ .compatible = \"ti,cpsw\",\t\t\t.data = (ulong)&cpsw_data_am3352 },\n+\t{ .compatible = \"ti,am335x-cpsw\",\t\t.data = (ulong)&cpsw_data_am3352 },\n+\t{ .compatible = \"ti,am4372-cpsw\",\t\t.data = (ulong)&cpsw_data_am3352 },\n+\t{ .compatible = \"ti,dra7-cpsw\",\t\t\t.data = (ulong)&cpsw_data_dra7xx },\n \t{ }\n };\n #endif\n","prefixes":["3/4"]}