{"id":2228244,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2228244/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/patch/20260425080649.75688-4-lucienzx159@gmail.com/","project":{"id":18,"url":"http://patchwork.ozlabs.org/api/1.1/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},"msgid":"<20260425080649.75688-4-lucienzx159@gmail.com>","date":"2026-04-25T08:06:49","name":"[v4,3/3] test: dm: add PHY common props unit tests and sandbox DT nodes","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"391d348ad3e6ebacd34f02ec6cb195bd000282e7","submitter":{"id":90627,"url":"http://patchwork.ozlabs.org/api/1.1/people/90627/?format=json","name":"Lucien.Jheng","email":"lucienzx159@gmail.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/uboot/patch/20260425080649.75688-4-lucienzx159@gmail.com/mbox/","series":[{"id":501470,"url":"http://patchwork.ozlabs.org/api/1.1/series/501470/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/list/?series=501470","date":"2026-04-25T08:06:49","name":"phy: add common PHY polarity properties support","version":4,"mbox":"http://patchwork.ozlabs.org/series/501470/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2228244/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2228244/checks/","tags":{},"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=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=C8yyNJH8;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de\n (client-ip=85.214.62.61; helo=phobos.denx.de;\n envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org)","phobos.denx.de;\n dmarc=pass (p=none dis=none) header.from=gmail.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=gmail.com header.i=@gmail.com header.b=\"C8yyNJH8\";\n\tdkim-atps=neutral","phobos.denx.de;\n dmarc=pass (p=none dis=none) header.from=gmail.com","phobos.denx.de;\n spf=pass smtp.mailfrom=lucienzx159@gmail.com"],"Received":["from phobos.denx.de (phobos.denx.de [85.214.62.61])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g2yNc01hSz1yHS\n\tfor <incoming@patchwork.ozlabs.org>; Sun, 26 Apr 2026 04:02:55 +1000 (AEST)","from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id 0D40484399;\n\tSat, 25 Apr 2026 20:02:45 +0200 (CEST)","by phobos.denx.de (Postfix, from userid 109)\n id 75AB384399; Sat, 25 Apr 2026 18:57:45 +0200 (CEST)","from mail-vk1-xa29.google.com (mail-vk1-xa29.google.com\n [IPv6:2607:f8b0:4864:20::a29])\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 E080C84368\n for <u-boot@lists.denx.de>; Sat, 25 Apr 2026 18:57:42 +0200 (CEST)","by mail-vk1-xa29.google.com with SMTP id\n 71dfb90a1353d-56f660d9a51so5701486e0c.2\n for <u-boot@lists.denx.de>; Sat, 25 Apr 2026 09:57:42 -0700 (PDT)","from localhost.localdomain (124-218-201-66.cm.dynamic.apol.com.tw.\n [124.218.201.66]) by smtp.gmail.com with ESMTPSA id\n d9443c01a7336-2b5fab0cbaasm250916935ad.54.2026.04.25.01.08.40\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Sat, 25 Apr 2026 01:08:44 -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=-0.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,\n DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_GMAIL_RCVD,\n FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_BLOCKED,\n SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20251104; t=1777136262; x=1777741062; darn=lists.denx.de;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=W/Ji6+fUIxG6lrpt0itctV9+ASA6Jmt96Isv9Fnp3T8=;\n b=C8yyNJH8mnbmqHMsHa65KOyMIpvO0msCsCf4HbQbdjqnxUSRmLtmNb9IDcSOZzl9j+\n OwSxr2eqMRCCNw8va+wd+7cG9zLbKD/IVwSW/LoamHlOsbfWmgDSa3yKo7IbQ/3r3/4m\n HWW71NaoB6r7VvLNUiZ4Yc6DTR50xWVJNFT3XQiEJR9hfKGbKM09ifrT93EFYmfw4vSm\n 2qBvMiczmtTR6nPMiCAkqi9JnJmPAzQ6JYRrzcB/Ugvyfszza99kcdDEEz2/spA6F5B9\n AULZYZpyt3RxADcJGQ/XT5gsk74Pp0mK7nW+9tIy9Q/TydE/Kw54hmkH/b4a3eeOWvnR\n 5HJg==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1777136262; x=1777741062;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=W/Ji6+fUIxG6lrpt0itctV9+ASA6Jmt96Isv9Fnp3T8=;\n b=lokqGZcwdAeLhN2oe771nkXJjyHCokMwK8p+qrSjC4pjEk0Z8Clk82JbJo/ASMA0LU\n i+rt0X0wuQaSOmff42oWIvrU4YEASm5AorQGfO2my2aeL6Mknve9n24gw3xJ/PIxsKsV\n FasmhGiYkbCDgTvhOZiVWnBYtfTqK4YT5BsaBnKhBuV+smrSQzwB7qhdGPzERbIDXwZV\n pXnnqhK7fHpCOhUsENpZnNQi+jVy1lKOSUsk4Eh4T70djf7gZ3Tnjy6ro45RvWMPnuNH\n PLipZBjxskdPz3RfpaMADtybsoUq1QyoLqalj4BwiruPQCsoP0VZXXKGmrPZxeREHhNK\n H6Ow==","X-Forwarded-Encrypted":"i=1;\n AFNElJ+HubFcVmZNWCQfz9l4hu7cvgSr/ywXsS2lCbvn2DqPW8aUFHTOsqAXFygDl0aWm0wO25ebabA=@lists.denx.de","X-Gm-Message-State":"AOJu0YzIaEshnALmpQovF+qsLe2rLP51WNBU3xr6pjO+xfXPMlgwv3xA\n dYWmPVGZnfVDquSvJ5H8fz/V7ONmbwmZpSGXxYeqHUjIBYppZqRxgAIutanS3A==","X-Gm-Gg":"AeBDies30UJt+CFeX7+3WaiIZyZWs05oDhek+TfvdIRQsWbTH8C4hcVx/WEajHsrRJ8\n n0G8AL2tAShlr3NHwWdKU4OtgmJKM3vxVP05JZEV7JdJ5Q8EEwscaE904pdATv26t5OR32bdd+2\n CykZxhHPAiyUdcuxoFF3lwbQWc7rGLVY7ecsq1pWdCS23TLSTWJkfqItbShkFjp2dq54oQCDx5u\n 7rh39tRXrPC1SAC62yS7yRbot8QPgnaiTTO/qwMLE3qhTI92Qfd85DeuwAm+SPvDG51ZcB8ilFL\n A5fdyzwqKXcT7Yvi5d4S0oROFRn/HY32UB//HVrQ1eNXk79S6TOdeVQNdc23mYt3jPq4WPj4l8N\n 15xrPBecWJYBraupaqqw01PU9WBEAuCOMm4t7gkpYxvcvi8BHZxBmOH3M4zP8KiWtSLMeyAY7V0\n HGZ6Mvk265TNN/TvT+ahj4lsAyV80OIaxfIy66OOh4qF0b43mNY/SklJ1+4oNuB+075B6Ct6hY/\n +tH5YxMhOkjKOftjxY2Wcagf5bv7OdR","X-Received":"by 2002:a17:903:1a45:b0:2b2:65db:8c5f with SMTP id\n d9443c01a7336-2b5f9f4f562mr374049365ad.27.1777104524951;\n Sat, 25 Apr 2026 01:08:44 -0700 (PDT)","From":"\"Lucien.Jheng\" <lucienzx159@gmail.com>","To":"trini@konsulko.com, jerome.forissier@arm.com, sumit.garg@kernel.org,\n marek.vasut+renesas@mailbox.org, vladimir.oltean@nxp.com","Cc":"ericwouds@gmail.com, kabel@kernel.org, frank-w@public-files.de,\n daniel@makrotopia.org, ansuelsmth@gmail.com, mkorpershoek@kernel.org,\n skylake.huang@mediatek.com, lucien.jheng@airoha.com, u-boot@lists.denx.de,\n \"Lucien.Jheng\" <lucienzx159@gmail.com>","Subject":"[PATCH v4 3/3] test: dm: add PHY common props unit tests and sandbox\n DT nodes","Date":"Sat, 25 Apr 2026 16:06:49 +0800","Message-Id":"<20260425080649.75688-4-lucienzx159@gmail.com>","X-Mailer":"git-send-email 2.34.1","In-Reply-To":"<20260425080649.75688-1-lucienzx159@gmail.com>","References":"<20260425080649.75688-1-lucienzx159@gmail.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-Mailman-Approved-At":"Sat, 25 Apr 2026 20:02:44 +0200","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":"Add sandbox DM unit tests for the PHY common properties library and the\ncorresponding device tree test nodes to arch/sandbox/dts/test.dts.\nAlso enable CONFIG_PHY_COMMON_PROPS in configs/sandbox_defconfig so\nthe tests are built and run in the sandbox environment.\n\nThe test file covers rx/tx polarity lookups for all relevant cases:\n\n  - missing property (defaults to PHY_POL_NORMAL)\n  - single value without names array (applies to all modes)\n  - count mismatch between values and names arrays (-EINVAL)\n  - name found by exact match\n  - name not found with no \"default\" fallback (-EINVAL)\n  - name not found with a \"default\" entry (uses fallback value)\n  - unsupported polarity value (-EOPNOTSUPP)\n\nPorted from Linux KUnit test:\n  linux/drivers/phy/phy-common-props-test.c\n\nSigned-off-by: Lucien.Jheng <lucienzx159@gmail.com>\n---\n``` execute phy common props tests in sandbox:\nBloblist at 100 not found (err=-2)\npinctrl_select_state_full() sandbox_serial serial: pinctrl_select_state_full: uclass_get_device_by_phandle_id: err=-19\n\n\nU-Boot 2026.01-rc5--gd1a76e2e4a64-dirty (Apr 25 2026 - 15:40:39 +0800)\n\nReset Status: WARM Reset Status: COLD\nModel: sandbox\nDRAM:  256 MiB\nCore:  294 devices, 105 uclasses, devicetree: board, universal payload active\nWDT:   Not starting wdt-gpio-toggle\nWDT:   Not starting wdt-gpio-level\nWDT:   Not starting wdt@0\nNAND:  4100 MiB\nMMC:   Can't map file 'mmc1.img': Invalid argument\n   sandbox_mmc_probe() mmc1: Unable to map file 'mmc1.img'\nCan't map file 'mmc1.img': Invalid argument\n   sandbox_mmc_probe() mmc1: Unable to map file 'mmc1.img'\n           mmc_probe() mmc1 - probe failed: -1\nmmc2: 2 (SD)Can't map file 'mmc1.img': Invalid argument\n   sandbox_mmc_probe() mmc1: Unable to map file 'mmc1.img'\n, mmc0: 0 (SD)\nLoading Environment from nowhere... OK\nIn:    serial\nOut:   serial,vidconsole\nErr:   serial,vidconsole\nModel: sandbox\nNet:   eth0: eth@10002000, eth5: eth@10003000, eth3: sbe5, eth6: eth@10004000, eth8: phy-test-eth, eth4: dsa-test-eth, eth2: lan0, eth7: lan1\n\nTest: phy_common_props_rx_find_by_name: phy_common_props.c\nTest: phy_common_props_rx_find_by_name: phy_common_props.c (flat tree)\nTest: phy_common_props_rx_missing: phy_common_props.c\nTest: phy_common_props_rx_missing: phy_common_props.c (flat tree)\nTest: phy_common_props_rx_more_names: phy_common_props.c\nTest: phy_common_props_rx_more_names: phy_common_props.c (flat tree)\nTest: phy_common_props_rx_more_values: phy_common_props.c\nTest: phy_common_props_rx_more_values: phy_common_props.c (flat tree)\nTest: phy_common_props_rx_no_default: phy_common_props.c\nTest: phy_common_props_rx_no_default: phy_common_props.c (flat tree)\nTest: phy_common_props_rx_single_value: phy_common_props.c\nTest: phy_common_props_rx_single_value: phy_common_props.c (flat tree)\nTest: phy_common_props_rx_unsupported: phy_common_props.c\nTest: phy_common_props_rx_unsupported: phy_common_props.c (flat tree)\nTest: phy_common_props_rx_with_default: phy_common_props.c\nTest: phy_common_props_rx_with_default: phy_common_props.c (flat tree)\nTest: phy_common_props_tx_find_by_name: phy_common_props.c\nTest: phy_common_props_tx_find_by_name: phy_common_props.c (flat tree)\nTest: phy_common_props_tx_missing: phy_common_props.c\nTest: phy_common_props_tx_missing: phy_common_props.c (flat tree)\nTest: phy_common_props_tx_more_names: phy_common_props.c\nTest: phy_common_props_tx_more_names: phy_common_props.c (flat tree)\nTest: phy_common_props_tx_more_values: phy_common_props.c\nTest: phy_common_props_tx_more_values: phy_common_props.c (flat tree)\nTest: phy_common_props_tx_no_default: phy_common_props.c\nTest: phy_common_props_tx_no_default: phy_common_props.c (flat tree)\nTest: phy_common_props_tx_single_value: phy_common_props.c\nTest: phy_common_props_tx_single_value: phy_common_props.c (flat tree)\nTest: phy_common_props_tx_unsupported: phy_common_props.c\nTest: phy_common_props_tx_unsupported: phy_common_props.c (flat tree)\nTest: phy_common_props_tx_with_default: phy_common_props.c\nTest: phy_common_props_tx_with_default: phy_common_props.c (flat tree)\nTests run: 16, 41 ms, average: 2 ms, failures: 0\n\n arch/sandbox/dts/test.dts  |  60 +++++++\n configs/sandbox_defconfig  |   1 +\n test/dm/Makefile           |   1 +\n test/dm/phy_common_props.c | 319 +++++++++++++++++++++++++++++++++++++\n 4 files changed, 381 insertions(+)\n create mode 100644 test/dm/phy_common_props.c\n\n--\n2.34.1","diff":"diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts\nindex ac92ebf1afd..0887de4333b 100644\n--- a/arch/sandbox/dts/test.dts\n+++ b/arch/sandbox/dts/test.dts\n@@ -16,6 +16,7 @@\n #include <dt-bindings/leds/common.h>\n #include <dt-bindings/pinctrl/sandbox-pinmux.h>\n #include <dt-bindings/mux/mux.h>\n+#include <dt-bindings/phy/phy.h>\n\n / {\n \tmodel = \"sandbox\";\n@@ -502,6 +503,65 @@\n \t\tphy-names = \"phy1\";\n \t};\n\n+\t/* PHY common props test nodes */\n+\tphy_common_props_missing: phy-common-props-missing {\n+\t\t/* empty: no rx-polarity or tx-polarity properties */\n+\t};\n+\n+\tphy_common_props_more_values: phy-common-props-more-values {\n+\t\t/* 3 values but only 2 names => count mismatch */\n+\t\trx-polarity = <PHY_POL_NORMAL PHY_POL_INVERT PHY_POL_NORMAL>;\n+\t\trx-polarity-names = \"sgmii\", \"2500base-x\";\n+\t\ttx-polarity = <PHY_POL_NORMAL PHY_POL_INVERT PHY_POL_NORMAL>;\n+\t\ttx-polarity-names = \"sgmii\", \"2500base-x\";\n+\t};\n+\n+\tphy_common_props_single: phy-common-props-single {\n+\t\t/* 1 value, no names array => value applies to all modes */\n+\t\trx-polarity = <PHY_POL_INVERT>;\n+\t\ttx-polarity = <PHY_POL_INVERT>;\n+\t};\n+\n+\tphy_common_props_more_names: phy-common-props-more-names {\n+\t\t/* 2 values but 3 names => count mismatch */\n+\t\trx-polarity = <PHY_POL_NORMAL PHY_POL_INVERT>;\n+\t\trx-polarity-names = \"sgmii\", \"2500base-x\", \"1000base-x\";\n+\t\ttx-polarity = <PHY_POL_NORMAL PHY_POL_INVERT>;\n+\t\ttx-polarity-names = \"sgmii\", \"2500base-x\", \"1000base-x\";\n+\t};\n+\n+\tphy_common_props_find_by_name: phy-common-props-find-by-name {\n+\t\t/* valid 3-element arrays, lookup by mode name */\n+\t\trx-polarity = <PHY_POL_NORMAL PHY_POL_INVERT PHY_POL_AUTO>;\n+\t\trx-polarity-names = \"sgmii\", \"2500base-x\", \"usb-ss\";\n+\t\ttx-polarity = <PHY_POL_NORMAL PHY_POL_INVERT PHY_POL_NORMAL>;\n+\t\ttx-polarity-names = \"sgmii\", \"2500base-x\", \"1000base-x\";\n+\t};\n+\n+\tphy_common_props_no_default: phy-common-props-no-default {\n+\t\t/* name not in array, no \"default\" entry => -EINVAL */\n+\t\trx-polarity = <PHY_POL_NORMAL PHY_POL_INVERT>;\n+\t\trx-polarity-names = \"2500base-x\", \"1000base-x\";\n+\t\ttx-polarity = <PHY_POL_NORMAL PHY_POL_INVERT>;\n+\t\ttx-polarity-names = \"2500base-x\", \"1000base-x\";\n+\t};\n+\n+\tphy_common_props_with_default: phy-common-props-with-default {\n+\t\t/* name not in array, but \"default\" entry exists */\n+\t\trx-polarity = <PHY_POL_NORMAL PHY_POL_INVERT>;\n+\t\trx-polarity-names = \"2500base-x\", \"default\";\n+\t\ttx-polarity = <PHY_POL_NORMAL PHY_POL_INVERT>;\n+\t\ttx-polarity-names = \"2500base-x\", \"default\";\n+\t};\n+\n+\tphy_common_props_unsupported: phy-common-props-unsupported {\n+\t\t/* PHY_POL_AUTO is not supported for manual-only modes */\n+\t\trx-polarity = <PHY_POL_AUTO>;\n+\t\trx-polarity-names = \"sgmii\";\n+\t\ttx-polarity = <PHY_POL_AUTO>;\n+\t\ttx-polarity-names = \"sgmii\";\n+\t};\n+\n \tsome-bus {\n \t\t#address-cells = <1>;\n \t\t#size-cells = <0>;\ndiff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig\nindex b681b91c3f9..487bb3ec03c 100644\n--- a/configs/sandbox_defconfig\n+++ b/configs/sandbox_defconfig\n@@ -284,6 +284,7 @@ CONFIG_PCI_REGION_MULTI_ENTRY=y\n CONFIG_PCI_FTPCI100=y\n CONFIG_PCI_SANDBOX=y\n CONFIG_PHY=y\n+CONFIG_PHY_COMMON_PROPS=y\n CONFIG_PHY_SANDBOX=y\n CONFIG_PINCTRL=y\n CONFIG_PINCONF=y\ndiff --git a/test/dm/Makefile b/test/dm/Makefile\nindex 771b703b737..d69b0e08d66 100644\n--- a/test/dm/Makefile\n+++ b/test/dm/Makefile\n@@ -88,6 +88,7 @@ obj-$(CONFIG_P2SB) += p2sb.o\n obj-$(CONFIG_PCI_ENDPOINT) += pci_ep.o\n obj-$(CONFIG_PCH) += pch.o\n obj-$(CONFIG_PHY) += phy.o\n+obj-$(CONFIG_PHY_COMMON_PROPS) += phy_common_props.o\n ifneq ($(CONFIG_PINMUX),)\n obj-$(CONFIG_PINCONF) += pinmux.o\n endif\ndiff --git a/test/dm/phy_common_props.c b/test/dm/phy_common_props.c\nnew file mode 100644\nindex 00000000000..21f5042b7a0\n--- /dev/null\n+++ b/test/dm/phy_common_props.c\n@@ -0,0 +1,319 @@\n+// SPDX-License-Identifier: GPL-2.0-or-later\n+/*\n+ * U-Boot sandbox DM tests for PHY common props\n+ *\n+ * Ported from Linux KUnit test:\n+ *   linux/drivers/phy/phy-common-props-test.c\n+ *\n+ * Copyright 2025-2026 NXP\n+ */\n+#include <dm.h>\n+#include <dm/ofnode.h>\n+#include <dm/test.h>\n+#include <linux/bitops.h>\n+#include <linux/phy/phy-common-props.h>\n+#include <dt-bindings/phy/phy.h>\n+#include <test/test.h>\n+#include <test/ut.h>\n+\n+/* --- RX polarity tests -------------------------------------------------- */\n+\n+/* Test: rx-polarity property is missing => default PHY_POL_NORMAL */\n+static int dm_test_phy_common_props_rx_missing(struct unit_test_state *uts)\n+{\n+\tofnode node = ofnode_path(\"/phy-common-props-missing\");\n+\tunsigned int val;\n+\tint ret;\n+\n+\tut_assert(ofnode_valid(node));\n+\n+\tret = phy_get_manual_rx_polarity(node, \"sgmii\", &val);\n+\tut_asserteq(0, ret);\n+\tut_asserteq(PHY_POL_NORMAL, val);\n+\n+\treturn 0;\n+}\n+\n+DM_TEST(dm_test_phy_common_props_rx_missing, UTF_SCAN_FDT);\n+\n+/* Test: rx-polarity has more values than rx-polarity-names => -EINVAL */\n+static int dm_test_phy_common_props_rx_more_values(struct unit_test_state *uts)\n+{\n+\tofnode node = ofnode_path(\"/phy-common-props-more-values\");\n+\tunsigned int val;\n+\tint ret;\n+\n+\tut_assert(ofnode_valid(node));\n+\n+\tret = phy_get_manual_rx_polarity(node, \"sgmii\", &val);\n+\tut_asserteq(-EINVAL, ret);\n+\n+\treturn 0;\n+}\n+\n+DM_TEST(dm_test_phy_common_props_rx_more_values, UTF_SCAN_FDT);\n+\n+/* Test: rx-polarity has 1 value and rx-polarity-names does not exist */\n+static int dm_test_phy_common_props_rx_single_value(struct unit_test_state *uts)\n+{\n+\tofnode node = ofnode_path(\"/phy-common-props-single\");\n+\tunsigned int val;\n+\tint ret;\n+\n+\tut_assert(ofnode_valid(node));\n+\n+\tret = phy_get_manual_rx_polarity(node, \"sgmii\", &val);\n+\tut_asserteq(0, ret);\n+\tut_asserteq(PHY_POL_INVERT, val);\n+\n+\treturn 0;\n+}\n+\n+DM_TEST(dm_test_phy_common_props_rx_single_value, UTF_SCAN_FDT);\n+\n+/* Test: rx-polarity-names has more values than rx-polarity => -EINVAL */\n+static int dm_test_phy_common_props_rx_more_names(struct unit_test_state *uts)\n+{\n+\tofnode node = ofnode_path(\"/phy-common-props-more-names\");\n+\tunsigned int val;\n+\tint ret;\n+\n+\tut_assert(ofnode_valid(node));\n+\n+\tret = phy_get_manual_rx_polarity(node, \"sgmii\", &val);\n+\tut_asserteq(-EINVAL, ret);\n+\n+\treturn 0;\n+}\n+\n+DM_TEST(dm_test_phy_common_props_rx_more_names, UTF_SCAN_FDT);\n+\n+/* Test: valid arrays, find polarity by mode name */\n+static int dm_test_phy_common_props_rx_find_by_name(struct unit_test_state *uts)\n+{\n+\tofnode node = ofnode_path(\"/phy-common-props-find-by-name\");\n+\tunsigned int val;\n+\tint ret;\n+\n+\tut_assert(ofnode_valid(node));\n+\n+\tret = phy_get_manual_rx_polarity(node, \"sgmii\", &val);\n+\tut_asserteq(0, ret);\n+\tut_asserteq(PHY_POL_NORMAL, val);\n+\n+\tret = phy_get_manual_rx_polarity(node, \"2500base-x\", &val);\n+\tut_asserteq(0, ret);\n+\tut_asserteq(PHY_POL_INVERT, val);\n+\n+\t/* \"usb-ss\" has PHY_POL_AUTO; auto is supported here */\n+\tret = phy_get_rx_polarity(node, \"usb-ss\", BIT(PHY_POL_AUTO),\n+\t\t\t\t  PHY_POL_AUTO, &val);\n+\tut_asserteq(0, ret);\n+\tut_asserteq(PHY_POL_AUTO, val);\n+\n+\treturn 0;\n+}\n+\n+DM_TEST(dm_test_phy_common_props_rx_find_by_name, UTF_SCAN_FDT);\n+\n+/* Test: name not found, no \"default\" entry => -EINVAL */\n+static int dm_test_phy_common_props_rx_no_default(struct unit_test_state *uts)\n+{\n+\tofnode node = ofnode_path(\"/phy-common-props-no-default\");\n+\tunsigned int val;\n+\tint ret;\n+\n+\tut_assert(ofnode_valid(node));\n+\n+\tret = phy_get_manual_rx_polarity(node, \"sgmii\", &val);\n+\tut_asserteq(-EINVAL, ret);\n+\n+\treturn 0;\n+}\n+\n+DM_TEST(dm_test_phy_common_props_rx_no_default, UTF_SCAN_FDT);\n+\n+/* Test: name not found, \"default\" entry exists => use default polarity */\n+static int dm_test_phy_common_props_rx_with_default(struct unit_test_state *uts)\n+{\n+\tofnode node = ofnode_path(\"/phy-common-props-with-default\");\n+\tunsigned int val;\n+\tint ret;\n+\n+\tut_assert(ofnode_valid(node));\n+\n+\tret = phy_get_manual_rx_polarity(node, \"sgmii\", &val);\n+\tut_asserteq(0, ret);\n+\tut_asserteq(PHY_POL_INVERT, val);\n+\n+\treturn 0;\n+}\n+\n+DM_TEST(dm_test_phy_common_props_rx_with_default, UTF_SCAN_FDT);\n+\n+/* Test: polarity value found but not in supported set => -EOPNOTSUPP */\n+static int dm_test_phy_common_props_rx_unsupported(struct unit_test_state *uts)\n+{\n+\tofnode node = ofnode_path(\"/phy-common-props-unsupported\");\n+\tunsigned int val;\n+\tint ret;\n+\n+\tut_assert(ofnode_valid(node));\n+\n+\tret = phy_get_manual_rx_polarity(node, \"sgmii\", &val);\n+\tut_asserteq(-EOPNOTSUPP, ret);\n+\n+\treturn 0;\n+}\n+\n+DM_TEST(dm_test_phy_common_props_rx_unsupported, UTF_SCAN_FDT);\n+\n+/* --- TX polarity tests -------------------------------------------------- */\n+\n+/* Test: tx-polarity property is missing => default PHY_POL_NORMAL */\n+static int dm_test_phy_common_props_tx_missing(struct unit_test_state *uts)\n+{\n+\tofnode node = ofnode_path(\"/phy-common-props-missing\");\n+\tunsigned int val;\n+\tint ret;\n+\n+\tut_assert(ofnode_valid(node));\n+\n+\tret = phy_get_manual_tx_polarity(node, \"sgmii\", &val);\n+\tut_asserteq(0, ret);\n+\tut_asserteq(PHY_POL_NORMAL, val);\n+\n+\treturn 0;\n+}\n+\n+DM_TEST(dm_test_phy_common_props_tx_missing, UTF_SCAN_FDT);\n+\n+/* Test: tx-polarity has more values than tx-polarity-names => -EINVAL */\n+static int dm_test_phy_common_props_tx_more_values(struct unit_test_state *uts)\n+{\n+\tofnode node = ofnode_path(\"/phy-common-props-more-values\");\n+\tunsigned int val;\n+\tint ret;\n+\n+\tut_assert(ofnode_valid(node));\n+\n+\tret = phy_get_manual_tx_polarity(node, \"sgmii\", &val);\n+\tut_asserteq(-EINVAL, ret);\n+\n+\treturn 0;\n+}\n+\n+DM_TEST(dm_test_phy_common_props_tx_more_values, UTF_SCAN_FDT);\n+\n+/* Test: tx-polarity has 1 value and tx-polarity-names does not exist */\n+static int dm_test_phy_common_props_tx_single_value(struct unit_test_state *uts)\n+{\n+\tofnode node = ofnode_path(\"/phy-common-props-single\");\n+\tunsigned int val;\n+\tint ret;\n+\n+\tut_assert(ofnode_valid(node));\n+\n+\tret = phy_get_manual_tx_polarity(node, \"sgmii\", &val);\n+\tut_asserteq(0, ret);\n+\tut_asserteq(PHY_POL_INVERT, val);\n+\n+\treturn 0;\n+}\n+\n+DM_TEST(dm_test_phy_common_props_tx_single_value, UTF_SCAN_FDT);\n+\n+/* Test: tx-polarity-names has more values than tx-polarity => -EINVAL */\n+static int dm_test_phy_common_props_tx_more_names(struct unit_test_state *uts)\n+{\n+\tofnode node = ofnode_path(\"/phy-common-props-more-names\");\n+\tunsigned int val;\n+\tint ret;\n+\n+\tut_assert(ofnode_valid(node));\n+\n+\tret = phy_get_manual_tx_polarity(node, \"sgmii\", &val);\n+\tut_asserteq(-EINVAL, ret);\n+\n+\treturn 0;\n+}\n+\n+DM_TEST(dm_test_phy_common_props_tx_more_names, UTF_SCAN_FDT);\n+\n+/* Test: valid arrays, find polarity by mode name */\n+static int dm_test_phy_common_props_tx_find_by_name(struct unit_test_state *uts)\n+{\n+\tofnode node = ofnode_path(\"/phy-common-props-find-by-name\");\n+\tunsigned int val;\n+\tint ret;\n+\n+\tut_assert(ofnode_valid(node));\n+\n+\tret = phy_get_manual_tx_polarity(node, \"sgmii\", &val);\n+\tut_asserteq(0, ret);\n+\tut_asserteq(PHY_POL_NORMAL, val);\n+\n+\tret = phy_get_manual_tx_polarity(node, \"2500base-x\", &val);\n+\tut_asserteq(0, ret);\n+\tut_asserteq(PHY_POL_INVERT, val);\n+\n+\tret = phy_get_manual_tx_polarity(node, \"1000base-x\", &val);\n+\tut_asserteq(0, ret);\n+\tut_asserteq(PHY_POL_NORMAL, val);\n+\n+\treturn 0;\n+}\n+\n+DM_TEST(dm_test_phy_common_props_tx_find_by_name, UTF_SCAN_FDT);\n+\n+/* Test: name not found, no \"default\" entry => -EINVAL */\n+static int dm_test_phy_common_props_tx_no_default(struct unit_test_state *uts)\n+{\n+\tofnode node = ofnode_path(\"/phy-common-props-no-default\");\n+\tunsigned int val;\n+\tint ret;\n+\n+\tut_assert(ofnode_valid(node));\n+\n+\tret = phy_get_manual_tx_polarity(node, \"sgmii\", &val);\n+\tut_asserteq(-EINVAL, ret);\n+\n+\treturn 0;\n+}\n+\n+DM_TEST(dm_test_phy_common_props_tx_no_default, UTF_SCAN_FDT);\n+\n+/* Test: name not found, \"default\" entry exists => use default polarity */\n+static int dm_test_phy_common_props_tx_with_default(struct unit_test_state *uts)\n+{\n+\tofnode node = ofnode_path(\"/phy-common-props-with-default\");\n+\tunsigned int val;\n+\tint ret;\n+\n+\tut_assert(ofnode_valid(node));\n+\n+\tret = phy_get_manual_tx_polarity(node, \"sgmii\", &val);\n+\tut_asserteq(0, ret);\n+\tut_asserteq(PHY_POL_INVERT, val);\n+\n+\treturn 0;\n+}\n+\n+DM_TEST(dm_test_phy_common_props_tx_with_default, UTF_SCAN_FDT);\n+\n+/* Test: polarity value found but not in supported set => -EOPNOTSUPP */\n+static int dm_test_phy_common_props_tx_unsupported(struct unit_test_state *uts)\n+{\n+\tofnode node = ofnode_path(\"/phy-common-props-unsupported\");\n+\tunsigned int val;\n+\tint ret;\n+\n+\tut_assert(ofnode_valid(node));\n+\n+\tret = phy_get_manual_tx_polarity(node, \"sgmii\", &val);\n+\tut_asserteq(-EOPNOTSUPP, ret);\n+\n+\treturn 0;\n+}\n+\n+DM_TEST(dm_test_phy_common_props_tx_unsupported, UTF_SCAN_FDT);\n","prefixes":["v4","3/3"]}