Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.2/patches/2220021/?format=api
{ "id": 2220021, "url": "http://patchwork.ozlabs.org/api/1.2/patches/2220021/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/20260405144944.41074-4-lucienzx159@gmail.com/", "project": { "id": 18, "url": "http://patchwork.ozlabs.org/api/1.2/projects/18/?format=api", "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": "<20260405144944.41074-4-lucienzx159@gmail.com>", "list_archive_url": null, "date": "2026-04-05T14:49:43", "name": "[v3,3/4] test: dm: add PHY common props unit tests", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "4d2e405db871b827baca93eecc6044c9f011e096", "submitter": { "id": 90627, "url": "http://patchwork.ozlabs.org/api/1.2/people/90627/?format=api", "name": "Lucien.Jheng", "email": "lucienzx159@gmail.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/uboot/patch/20260405144944.41074-4-lucienzx159@gmail.com/mbox/", "series": [ { "id": 498806, "url": "http://patchwork.ozlabs.org/api/1.2/series/498806/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/list/?series=498806", "date": "2026-04-05T14:49:40", "name": "phy: add common PHY polarity properties support", "version": 3, "mbox": "http://patchwork.ozlabs.org/series/498806/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2220021/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2220021/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=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=KwI6sQo0;\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=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=\"KwI6sQo0\";\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\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 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fpkKN3Kngz1xtJ\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 06 Apr 2026 06:17:44 +1000 (AEST)", "from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id 59E04840BE;\n\tSun, 5 Apr 2026 22:17:14 +0200 (CEST)", "by phobos.denx.de (Postfix, from userid 109)\n id 911628352B; Sun, 5 Apr 2026 16:51:08 +0200 (CEST)", "from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com\n [IPv6:2607:f8b0:4864:20::102c])\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 0AC368341A\n for <u-boot@lists.denx.de>; Sun, 5 Apr 2026 16:51:06 +0200 (CEST)", "by mail-pj1-x102c.google.com with SMTP id\n 98e67ed59e1d1-35d9827661bso1551963a91.3\n for <u-boot@lists.denx.de>; Sun, 05 Apr 2026 07:51:05 -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 98e67ed59e1d1-35dbe959358sm15333261a91.13.2026.04.05.07.51.00\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Sun, 05 Apr 2026 07:51:04 -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=1775400664; x=1776005464; 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=0xYHCR7KKs1F3PTp/+hbSZtkNbzPHb+6RNFweXTPGT4=;\n b=KwI6sQo0h0CNEqRwbXL5ScrcxWyKwmxBD177D3b3/xHnKnQIbKHKn9Y0pjZEoPL/80\n GsFmXsVqge26diRf/OjP+KzCc/avIV5lcOeVLwJOjVp6TmHsowCl9MQHyU/13JmeYAss\n vZ7N7fQZCvUSRlP5CVCaguWVhrYyf4CUORhwUdMSIchNwwJRjjx56f6lnzOL0lLSnJtj\n jIvW9fx87kuchbfVfrLAh+AlntJHEO7ykk79WibYi9u57iw3+MtJ7dY5A8TmRPc4Oda5\n 7jRLbU8Cgph8cayOvY8XZVZl+cE0n3FDLPeuvxksye7PKNxabfEhlnauTuIbAkwO2hoQ\n EzUQ==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1775400664; x=1776005464;\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=0xYHCR7KKs1F3PTp/+hbSZtkNbzPHb+6RNFweXTPGT4=;\n b=nO9sSQfQZlF0dg5+LOmnyMrm4mUtjo5TKQz22f/+VY6ADyzV65Jv6F+NHGiiQAttBu\n b9XH9vd6PdKO6I2cUYs5/cpxCQtX4u30c6UO+jz5gu4XIgJTvQbJEU2QmmSpY+K2M03K\n LlwwBQYCuRHhlHa+Jz+HMfGT1uOMvV1wSAR8YWxkxw6uaL6RpO+89Vt/MY7Xc7+ubfP7\n H9qDMvN6sSok1CwTErxCyxbg4HyKyNqRxPLAhuvQhE0KGhSOAbJ2BNBCcWWML3JpG7TY\n 4YxdmExWNKp4b4HXett8ex1QMqSdsQ8Ey72uiNlsdIelAWeYkLEEPKE48ldhyhr7l9x3\n RFDg==", "X-Forwarded-Encrypted": "i=1;\n AJvYcCWJbmqEomnS005hl4V3F6InKH1FKtm98spEnNzAvjuCI/vy60RaVdr7RBjWgmitnxMvgS++eH0=@lists.denx.de", "X-Gm-Message-State": "AOJu0YwR1ADvpw+JMMdLNkkdF7TbmUbA10pb4Qb6BP6cGikgnkJ6A9Mp\n 2FlrYird1fmuFvwUcye26WHLblgWM92HqTTLZGNoXhz/HXYY3gQltJJY", "X-Gm-Gg": "AeBDieuCtjqV9kHViL2GGZCD6G6uNiQ+7q6D1dL3GgGMQs83wmmqu8G40EIDcgrTfQc\n gkeeXw1Oz3ixNQH2b9+bPHaFSMQ9PIX8/nrW9KRqbfumMI0LId26WAXy4Zkwb5oG5Wx7L4KxjQV\n phB1x3GMTx7Kt5sxC7dIyDN55WyvWDBaS9pvwGxCQEWliSbQoD6YOoqVdvETnCB42ri9T6RS198\n lKI1uWKC4JIzEF8ZHOlTTaPqOXVV16pvQsXV9g+oaIeCemrX65k1XYjDWqvfP/BqjPunrEID7DV\n 2FiDFbXUT2YzY3dwEVhyV17muImNuS9g7l9WOQ2QGKCDd4z02wr3RwcVZvzCfvyAxd5meAEAxNa\n Plg2Y9lyPWKbgRvE2e97vH2Khfvqda6Vu4lYokxnUbTo0a9qQnyzoDsJp0kp7K224anB1cWICx7\n DzAccCZ5w4gIu5wTAOwUO/Z6MHEK004QzvU7SkDN5GiN0CjSaONebWopYJ2gNRCF4VbozKwiXTc\n FZgBakALwEMrR0zzUAn5w==", "X-Received": "by 2002:a17:90b:1e44:b0:35b:e56e:b58b with SMTP id\n 98e67ed59e1d1-35de6940d3bmr9558488a91.15.1775400664459;\n Sun, 05 Apr 2026 07:51:04 -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 v3 3/4] test: dm: add PHY common props unit tests", "Date": "Sun, 5 Apr 2026 22:49:43 +0800", "Message-Id": "<20260405144944.41074-4-lucienzx159@gmail.com>", "X-Mailer": "git-send-email 2.34.1", "In-Reply-To": "<20260405144944.41074-1-lucienzx159@gmail.com>", "References": "<20260405144944.41074-1-lucienzx159@gmail.com>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "X-Mailman-Approved-At": "Sun, 05 Apr 2026 22:17:12 +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 obj-$(CONFIG_PHY_COMMON_PROPS) build entry in test/dm/Makefile and\nsandbox DM unit tests for the PHY common properties library, covering\nrx/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\n```test log```\n執行 phy common props 測試...\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--g11ad53c5213e-dirty (Mar 22 2026 - 22:31:17 +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, 37 ms, average: 2 ms, failures: 0\n\n test/dm/Makefile | 1 +\n test/dm/phy_common_props.c | 319 +++++++++++++++++++++++++++++++++++++\n 2 files changed, 320 insertions(+)\n create mode 100644 test/dm/phy_common_props.c\n\n--\n2.34.1", "diff": "diff --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": [ "v3", "3/4" ] }