From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8C303C2B9F7 for ; Tue, 25 May 2021 02:23:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5D2F66141E for ; Tue, 25 May 2021 02:23:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230103AbhEYCYs (ORCPT ); Mon, 24 May 2021 22:24:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230026AbhEYCYs (ORCPT ); Mon, 24 May 2021 22:24:48 -0400 Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BAB7C061574 for ; Mon, 24 May 2021 19:23:18 -0700 (PDT) Received: by mail-pf1-x42c.google.com with SMTP id g18so20742976pfr.2 for ; Mon, 24 May 2021 19:23:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=YNwxStsD+A4s3Y5YPD+y/yzjouBFbGraopsBtlg56ZE=; b=NSy9fOXI9c1ltnW1iqS2aDY0CjYdTLrxZPmU5nUiplUVxvp8/CCRd8pH5tgxLeGA2n fGQK1gUpwE7feIrfwJvsXmzw7hQPLoKhjHUKIUoKjs+dWqpZN/uZOXQx8ei4h7KYnlZH /NUsTT1vXhXgKjRUY1e84kaYRMHUfj9QS9fxU+noUadFygmlT0Nx5PClsJA76m8dRC9x yUVzD0nuHRx2NhHhc3gGaLH1PNzeG0y4z51VF78pbQNnremwBdbPLLWopXWQ/9uaUXzF PHwfx+ugwmKO76SCUtCBMcIqiXay+7aHYE8KLFG9V+qHnz8AexPfUIC7nNcHFLPMA37B E42w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=YNwxStsD+A4s3Y5YPD+y/yzjouBFbGraopsBtlg56ZE=; b=QuUrfbI2J63ZrWwey5Ykg1qII47OiR00EHTC4krqGwRiCdpM8RZto9EcwEVOUn+jv2 sL8bytQZJYqGIO3H6mlMCrkPseZ0LcwyshMvlC9LPlWv73rHW0tb/jgD6UdMBTxgCitD gJAi+DbsV+pJAaVEVi4c2HOfydBMtzU181KxhnIAXj5QFvQq8Hsypi/BPf2h3tN/Gk8x XkBjtblDdyHh0eLSqdAe8r4SyNB5A4WPd+3nRY88I0PcC6a7qek85iJ2/AOAu4nTcIyU hWCGOBaWK1fV4PhEx99gE1cHcv5bn+967g8X1uCQcklleiLDwAIFY0t8GPtrBl5rgj6j QilA== X-Gm-Message-State: AOAM530hlAveC2rdCDBNOu7o7wnazUQV2JLeqhddBSnBjr3M75FhM+M9 IMbqx9xFkhBmbdqEjiGEF4Q= X-Google-Smtp-Source: ABdhPJxutDzBIztARiDViD2PivV74OGN4LmkZBwB9mzuMYFcVz0btZdVhm6MRm9uNxRNna7bnvKFrw== X-Received: by 2002:a63:1d42:: with SMTP id d2mr16401998pgm.21.1621909397578; Mon, 24 May 2021 19:23:17 -0700 (PDT) Received: from [10.230.29.202] ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id mt24sm11071808pjb.18.2021.05.24.19.23.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 24 May 2021 19:23:17 -0700 (PDT) Subject: Re: [PATCH net-next 05/13] net: dsa: sja1105: add a PHY interface type compatibility matrix To: Vladimir Oltean , Jakub Kicinski , "David S. Miller" , netdev@vger.kernel.org Cc: Andrew Lunn , Vivien Didelot , Vladimir Oltean References: <20210524232214.1378937-1-olteanv@gmail.com> <20210524232214.1378937-6-olteanv@gmail.com> From: Florian Fainelli Message-ID: Date: Mon, 24 May 2021 19:23:09 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0 Thunderbird/78.10.2 MIME-Version: 1.0 In-Reply-To: <20210524232214.1378937-6-olteanv@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 5/24/2021 4:22 PM, Vladimir Oltean wrote: > From: Vladimir Oltean > > On the SJA1105, all ports support the parallel "xMII" protocols (MII, > RMII, RGMII) except for port 4 on SJA1105R/S which supports only SGMII. > This was relatively easy to model, by special-casing the SGMII port. > > On the SJA1110, certain ports can be pinmuxed between SGMII and xMII, or > between SGMII and an internal 100base-TX PHY. This creates problems, > because the driver's assumption so far was that if a port supports > SGMII, it uses SGMII. > > We allow the device tree to tell us how the port pinmuxing is done, and > check that against a PHY interface type compatibility matrix for > plausibility. > > The other big change is that instead of doing SGMII configuration based > on what the port supports, we do it based on what is the configured > phy_mode of the port. > > The 2500base-x support added in this patch is not complete. > > Signed-off-by: Vladimir Oltean > --- > drivers/net/dsa/sja1105/sja1105.h | 5 +++ > drivers/net/dsa/sja1105/sja1105_main.c | 59 +++++++++++++------------- > drivers/net/dsa/sja1105/sja1105_spi.c | 20 +++++++++ > 3 files changed, 55 insertions(+), 29 deletions(-) > > diff --git a/drivers/net/dsa/sja1105/sja1105.h b/drivers/net/dsa/sja1105/sja1105.h > index d5c0217b1f65..a27841642693 100644 > --- a/drivers/net/dsa/sja1105/sja1105.h > +++ b/drivers/net/dsa/sja1105/sja1105.h > @@ -111,6 +111,11 @@ struct sja1105_info { > enum packing_op op); > int (*clocking_setup)(struct sja1105_private *priv); > const char *name; > + bool supports_mii[SJA1105_MAX_NUM_PORTS]; > + bool supports_rmii[SJA1105_MAX_NUM_PORTS]; > + bool supports_rgmii[SJA1105_MAX_NUM_PORTS]; > + bool supports_sgmii[SJA1105_MAX_NUM_PORTS]; > + bool supports_2500basex[SJA1105_MAX_NUM_PORTS]; If you used a bitmap you may be able to play some nice tricks with ordering them in PHY_INTERFACE_MODE_* order and just increment a pointer to the bitmap. Since it looks like all of the chips support MII, RMII, and RGMII on all ports, maybe you can specify only those that don't? Still: Reviewed-by: Florian Fainelli -- Florian