From patchwork Thu Apr 20 10:04:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 675608 Delivered-To: patch@linaro.org Received: by 2002:a5d:4a41:0:0:0:0:0 with SMTP id v1csp221842wrs; Thu, 20 Apr 2023 03:08:44 -0700 (PDT) X-Google-Smtp-Source: AKy350Z8kMdZVWWd3aUtAJUpv/c3H9Lp/IddHmUXTavgEuS4cdctDiMakWBJvUE5K5AbhWg+9m1M X-Received: by 2002:ad4:5d66:0:b0:5aa:8e3e:496e with SMTP id fn6-20020ad45d66000000b005aa8e3e496emr1017883qvb.34.1681985324181; Thu, 20 Apr 2023 03:08:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681985324; cv=none; d=google.com; s=arc-20160816; b=nyPJHNNqmRGdB/g/NVVsZnTFrcKSdXKm4VKER9xo3ODwstYdhnSVS3/oyCArxbTvb9 4/55L7RvWO8M8Vo62xDQTZbsZALrkr5AccR+uvBc0zFVtZCNb2uL6d0M8pum0uAZCqtd RzRXy+zICFNqVu+U4pQaEA+xNJOMRhFsiPcEr+IeQRMyVChBC3A8UD8LJKJOFaMFq/dI Lr7EuCOkZ3af8opB4534r0lx+YAQ5/3dTyzYbWO/8fUoEFQQiYM0Q26RMCX66ofPQFR3 2BNrOvSmYE1HUhhB+v0kH2oCVpH2EgAuf5HrCAyx5usUIzzJf1yh7UlcmjMdS9NCKP5H YY1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=Pzbn4cqrDD/rPP1zQmiL6uq/uryn5Rqdl4z0KRkcO9U=; b=u96vOftW5CCZ7++/8FazNrNmtuZzzeKcQwa3f8xGRON6H1sE5pHmkRbGJNyzN7vP9K 8rLpJjAYNO/kyY/ZvB24w7nmUjoZZCQWu3h63U8zMZ8qPchlrSD0GVn+AjBh4lAWJsfc cGBLdtaiOYAgTUguLjNPYA3aT+jC4ejkF3eLrwErSqfTXiZmEYUkrPaNRy7W+fJcNoJv ddipQyIEEu+q5P59hSjJ5bTuamdxl/fO24v37H/Ab9xEKn6Wx9GDpQbxZfwKOpaD5i2w nxtpMKuxK5DKhoWv5cCiM0n3ln/YfrM04BE4L102rbrrUBoc9zK1vzMrtIL+s23ylwST J+Rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=C0sRrYoJ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 3-20020a0562140cc300b005ef60ce047esi1067106qvx.442.2023.04.20.03.08.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Apr 2023 03:08:44 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=C0sRrYoJ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppRAE-0000cz-KK; Thu, 20 Apr 2023 06:05:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppRAC-0000bX-NE for qemu-devel@nongnu.org; Thu, 20 Apr 2023 06:05:16 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ppRA6-0003tD-F6 for qemu-devel@nongnu.org; Thu, 20 Apr 2023 06:05:16 -0400 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-3f176a16c03so3356575e9.2 for ; Thu, 20 Apr 2023 03:05:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1681985109; x=1684577109; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=Pzbn4cqrDD/rPP1zQmiL6uq/uryn5Rqdl4z0KRkcO9U=; b=C0sRrYoJ5EC3NTt7mh+98jfcPWpoFUP+ZDHWuUbUUH2R14MmU+fwqPQVH15DmC3Ka2 m4hDGGa0gnzs6Xw4/CrkIbvtopQAhGDBC4IAoU4uExrwQmHx0yBD1boAZruJ3R37mVQT 5Dw0bhGcWu3WUhLEehP715RzrbzPOaYaEDBDnCzD5nzXzNw10Gz3ZtT9+SNSHjtIpC17 /0rVz+xy15tULVgsDT2S+pYa8TCbjX2lutjHAFJd3ptOpAXolwMwSPJ8S0QnN74MjZUs Ir/1ihP+r4hMkR4qeWd2HlXOy/R5/oYTQoGe2IUq8AlT9UyHHQ+IAEoXSfg8euDQtW+A uLFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681985109; x=1684577109; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Pzbn4cqrDD/rPP1zQmiL6uq/uryn5Rqdl4z0KRkcO9U=; b=G5SNjWb76YCqdWVGniEHqs7nTqaSiV5t/0q2J7fXM/JKYSJMKfMhHg1K47yT6c8NPE KX6wQeSE+g94So6MLCDR2JBRhNEMDMvoKax5FXB2NINtuHY7ZvQOLPNv8+3FoyX6q37/ dijwUXqpsfe6xLbamLco75qhAvyOCMWjJnMg+/wu/lwX42o45tzfub7TqNVQLPziGvnk 4V6P+2Pr+VQeQGHnetc6HBE8se/+t30xWGPrNFxg/yUozQtMrbFUh2HpbxvSoMZoLW9g UuSdRQjAyxFKX2v0mugO4lc7mRF8XNLZLlFfGMXm7F6go9giir7rHpaFZSTavJHyWPba wWXA== X-Gm-Message-State: AAQBX9ekF8Da80mWa6Of3zZBOMOsG3jwCqFNtBuMxBwLZE9aCCdMxVcr joODjFqWLZPYdmvhbArWyZOwvX8iANR4F3m+RGI= X-Received: by 2002:adf:d4c6:0:b0:2f5:a598:33e5 with SMTP id w6-20020adfd4c6000000b002f5a59833e5mr821202wrk.58.1681985108762; Thu, 20 Apr 2023 03:05:08 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id o2-20020a5d58c2000000b002fe522117fdsm1556388wrf.36.2023.04.20.03.05.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Apr 2023 03:05:08 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 18/21] fsl-imx6ul: Add fec[12]-phy-connected properties Date: Thu, 20 Apr 2023 11:04:53 +0100 Message-Id: <20230420100456.944969-19-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230420100456.944969-1-peter.maydell@linaro.org> References: <20230420100456.944969-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Guenter Roeck Add fec[12]-phy-connected properties and use it to set phy-connected and phy-consumer properties for imx_fec. Signed-off-by: Guenter Roeck Message-id: 20230315145248.1639364-3-linux@roeck-us.net Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- include/hw/arm/fsl-imx6ul.h | 1 + hw/arm/fsl-imx6ul.c | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/include/hw/arm/fsl-imx6ul.h b/include/hw/arm/fsl-imx6ul.h index 1952cb984d6..9ee15ae38d6 100644 --- a/include/hw/arm/fsl-imx6ul.h +++ b/include/hw/arm/fsl-imx6ul.h @@ -89,6 +89,7 @@ struct FslIMX6ULState { MemoryRegion ocram_alias; uint32_t phy_num[FSL_IMX6UL_NUM_ETHS]; + bool phy_connected[FSL_IMX6UL_NUM_ETHS]; }; enum FslIMX6ULMemoryMap { diff --git a/hw/arm/fsl-imx6ul.c b/hw/arm/fsl-imx6ul.c index d88d6cc1c5f..2189dcbb72c 100644 --- a/hw/arm/fsl-imx6ul.c +++ b/hw/arm/fsl-imx6ul.c @@ -407,7 +407,23 @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp) /* * Ethernet + * + * We must use two loops since phy_connected affects the other interface + * and we have to set all properties before calling sysbus_realize(). */ + for (i = 0; i < FSL_IMX6UL_NUM_ETHS; i++) { + object_property_set_bool(OBJECT(&s->eth[i]), "phy-connected", + s->phy_connected[i], &error_abort); + /* + * If the MDIO bus on this controller is not connected, assume the + * other controller provides support for it. + */ + if (!s->phy_connected[i]) { + object_property_set_link(OBJECT(&s->eth[1 - i]), "phy-consumer", + OBJECT(&s->eth[i]), &error_abort); + } + } + for (i = 0; i < FSL_IMX6UL_NUM_ETHS; i++) { static const hwaddr FSL_IMX6UL_ENETn_ADDR[FSL_IMX6UL_NUM_ETHS] = { FSL_IMX6UL_ENET1_ADDR, @@ -620,6 +636,10 @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp) static Property fsl_imx6ul_properties[] = { DEFINE_PROP_UINT32("fec1-phy-num", FslIMX6ULState, phy_num[0], 0), DEFINE_PROP_UINT32("fec2-phy-num", FslIMX6ULState, phy_num[1], 1), + DEFINE_PROP_BOOL("fec1-phy-connected", FslIMX6ULState, phy_connected[0], + true), + DEFINE_PROP_BOOL("fec2-phy-connected", FslIMX6ULState, phy_connected[1], + true), DEFINE_PROP_END_OF_LIST(), };