From patchwork Fri Sep 6 12:52:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Machon X-Patchwork-Id: 13794130 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5B4DCCE7AA3 for ; Fri, 6 Sep 2024 12:57:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:CC:To:In-Reply-To:References :Message-ID:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=LdWUWuFFe5prNakTwXoGDjR7GK6p1Wf9L92o5IRMZuE=; b=p2OeENq93qEUBWdiIMdtnveXKR b2PSGtljppl5eSxAHDHrfVO2sLJsInsCDJkOdi1SCclvnclp5IcNRN+W8Z2a3gKEfNbpa2dgZeX2j wq92/j07+WyzBU279LjPL6CW2qwrrC79aLOLBZWaWmHeFRvTpt9jmHqJP2cGpwv675CwTxK+He160 kJanOCxJkt2htgYse2XJbdjZglYMpIWzBKlthpi9tP0BGgKiL7hHfoYh+26AgZMEZonILKTG3NanT g7+ElVMvf33s9Zn2/Fy44URSif910EDbqp78Mmi9f26bPWb0iBGdNzBNQf/zd+PMzDSMOAZl7BRSg MIa+O9tQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1smYWV-0000000CG28-1M6d; Fri, 06 Sep 2024 12:57:11 +0000 Received: from esa.microchip.iphmx.com ([68.232.153.233]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1smYSs-0000000CEtq-1q5W; Fri, 06 Sep 2024 12:53:27 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1725627206; x=1757163206; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=1AJHRHcGfmD/9YGKz72ENNmKG33hLzSx1mSxJxpOXls=; b=E1r6V57ULtBqG7A8QT9zu79UEdSh6HnMI/CVKXhj3Ou6/PKrIkjqrAVt CS3yrJbbB+smYN9SVfOW4rtapKL7xDAIuN1GuC12kZuHTuGO9SiTHnT91 Gsti2KhL1pTmHrzTXZ8ChE/dwCiCPobBpU5rMksiZd40u2QAEsL/KA6mf D9adz0E95GMXbUqkZ0gQK3tBvYmwmU4bgzw9Jchk7+PjU2Uk9RdVQdLaX H1Gts83c/SjRi5h/RmH22t8MZyJu4aXRStGVy4Q3hMpaeUg4+mgoW6/ua OXY6svWTwsVWSXxdtSmMJy7xMURmATiSS97SwR9LcwPEXV71mhBoLgUXK w==; X-CSE-ConnectionGUID: aks78ZCLRxOyTJZTZgJsDQ== X-CSE-MsgGUID: 2DeEyVSsTsyPQ8Fks5jYjw== X-IronPort-AV: E=Sophos;i="6.10,207,1719903600"; d="scan'208";a="34534554" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 06 Sep 2024 05:53:23 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Fri, 6 Sep 2024 05:53:17 -0700 Received: from DEN-DL-M70577.microchip.com (10.10.85.11) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Fri, 6 Sep 2024 05:53:15 -0700 From: Daniel Machon Date: Fri, 6 Sep 2024 14:52:39 +0200 Subject: [PATCH 2/9] phy: sparx5-serdes: add constants to match data MIME-Version: 1.0 Message-ID: <20240906-sparx5-lan969x-serdes-driver-v1-2-8d630614c58a@microchip.com> References: <20240906-sparx5-lan969x-serdes-driver-v1-0-8d630614c58a@microchip.com> In-Reply-To: <20240906-sparx5-lan969x-serdes-driver-v1-0-8d630614c58a@microchip.com> To: Vinod Koul , Kishon Vijay Abraham I , Lars Povlsen , Steen Hegelund , , Rob Herring , Krzysztof Kozlowski , Conor Dooley CC: , , , X-Mailer: b4 0.14-dev X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240906_055326_573383_4ABB7A61 X-CRM114-Status: GOOD ( 13.31 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org We need to handle a few different constants that differ for Sparx5 and lan969x. Add a new struct: sparx5_serdes_consts for this purpose. We populate it with an initial field for the number of SERDES'es: sd_max. Signed-off-by: Daniel Machon Reviewed-by: Steen Hegelund --- drivers/phy/microchip/sparx5_serdes.c | 7 +++++-- drivers/phy/microchip/sparx5_serdes.h | 5 +++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/phy/microchip/sparx5_serdes.c b/drivers/phy/microchip/sparx5_serdes.c index 5427e8627a78..c3ed028fc74e 100644 --- a/drivers/phy/microchip/sparx5_serdes.c +++ b/drivers/phy/microchip/sparx5_serdes.c @@ -2510,6 +2510,9 @@ static struct sparx5_serdes_io_resource sparx5_serdes_iomap[] = { static const struct sparx5_serdes_match_data sparx5_desc = { .iomap = sparx5_serdes_iomap, .iomap_size = ARRAY_SIZE(sparx5_serdes_iomap), + .consts = { + .sd_max = 33, + }, }; /* Client lookup function, uses serdes index */ @@ -2526,7 +2529,7 @@ static struct phy *sparx5_serdes_xlate(struct device *dev, sidx = args->args[0]; /* Check validity: ERR_PTR(-ENODEV) if not valid */ - for (idx = 0; idx < SPX5_SERDES_MAX; idx++) { + for (idx = 0; idx < priv->data->consts.sd_max; idx++) { struct sparx5_serdes_macro *macro = phy_get_drvdata(priv->phys[idx]); @@ -2594,7 +2597,7 @@ static int sparx5_serdes_probe(struct platform_device *pdev) priv->regs[iomap->id] = iomem + iomap->offset; } - for (idx = 0; idx < SPX5_SERDES_MAX; idx++) { + for (idx = 0; idx < priv->data->consts.sd_max; idx++) { err = sparx5_phy_create(priv, idx, &priv->phys[idx]); if (err) return err; diff --git a/drivers/phy/microchip/sparx5_serdes.h b/drivers/phy/microchip/sparx5_serdes.h index 128f8c53172f..8c27cfde4938 100644 --- a/drivers/phy/microchip/sparx5_serdes.h +++ b/drivers/phy/microchip/sparx5_serdes.h @@ -26,7 +26,12 @@ enum sparx5_serdes_mode { SPX5_SD_MODE_SFI, }; +struct sparx5_serdes_consts { + int sd_max; +}; + struct sparx5_serdes_match_data { + const struct sparx5_serdes_consts consts; const struct sparx5_serdes_io_resource *iomap; int iomap_size; };