Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp2353594ybg; Fri, 5 Jun 2020 11:41:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzCE4EORPLwaRF2LwUBawc7SdOSEeQCL1FhdJvabUwFMRH5/07AbG8RjCStyiSO7w9kWJDr X-Received: by 2002:a50:8425:: with SMTP id 34mr3945962edp.314.1591382470162; Fri, 05 Jun 2020 11:41:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591382470; cv=none; d=google.com; s=arc-20160816; b=DjaGqfJEExpciMwRFsjnv/F8EsuItiK21fKUbkKArNDJs5H9+eVvdrjlO7CQyf0M1A 4qXvQkP02drwC79cc6rxkIKPWn4mF23O2udeayvs7UGcFjwlrDTiAaROhFMEDDPjjCLP b0RbO+tE54Cp+ilIy85T5H3UleuwRdjgM44rsgVmY2SjiSg4M8TgUnQk7epWa2HOuAVj 8BRzG8E/67TiXoruqHTcoWLLt/WwxeMNngHTBYfPQRhhvUjz+47hBdGlenSr1kimfpXF 7g2OtNnkXMJydDtPeFA/BgCF8NgjYI0hoR/++uCEILt3vz1D2Y0EWVaOOcAHWXqnLpr5 haSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=zHH2e75b+EMDPfvqjK0MkYGBOFXfpbFKWqwBx4iGH84=; b=O7SIZ4ODYSXq/ve+Hps8687MTKtBw69AS9CWoVIS/T7/iGPCslFyCjOk2uJSx3ZQLS m4gdlUEWoxHPwFVbnkgJWX57CJwO9ckP4hPGXyNPVkZKYNrW+Xwv+aG/sT+e80rZj1Nm uUojA18yb9vYOm3EZs5wiLPJdWvRYdtneESYeXFHX5UhYKfuBFIiHopqiKlSwkX7nanu KHBPwDH3fgVkda2geoV+I+IScrjk09Inh6Re3wQ7ck+He6SQwUh07CnqNBSaXY2qhqV1 WTKctksSKhRU0IF9pgxy1odNVTVubn+gToxyhXGoyN15qDOyN1Z2TKYkHHkmS+R4cR6Z ShOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@lunn.ch header.s=20171124 header.b="w/YPse8Z"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id yd28si3825648ejb.580.2020.06.05.11.40.47; Fri, 05 Jun 2020 11:41:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@lunn.ch header.s=20171124 header.b="w/YPse8Z"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728031AbgFESiz (ORCPT + 99 others); Fri, 5 Jun 2020 14:38:55 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:37822 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726294AbgFESiz (ORCPT ); Fri, 5 Jun 2020 14:38:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=zHH2e75b+EMDPfvqjK0MkYGBOFXfpbFKWqwBx4iGH84=; b=w/YPse8ZXjEkuOlr5mpkD/fZOD Gh8xA2owB89CzMInPHc8JdoPrh8RBkgc8KuuRAVOMegJVq0wwtgb6auqliJ97aUR7zfSefHzqe5iw qYfDzL9y+amgCLSYnPKeIcXSySCdN9Mc9BSUHGqlBwFpXua4XDhwqhmp58zMpNoFnIVA=; Received: from andrew by vps0.lunn.ch with local (Exim 4.93) (envelope-from ) id 1jhHEp-004F0P-CI; Fri, 05 Jun 2020 20:38:43 +0200 Date: Fri, 5 Jun 2020 20:38:43 +0200 From: Andrew Lunn To: Jonathan McDowell , Russell King Cc: Vivien Didelot , Florian Fainelli , "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] net: dsa: qca8k: introduce SGMII configuration options Message-ID: <20200605183843.GB1006885@lunn.ch> References: <8ddd76e484e1bedd12c87ea0810826b60e004a65.1591380105.git.noodles@earth.li> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8ddd76e484e1bedd12c87ea0810826b60e004a65.1591380105.git.noodles@earth.li> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 05, 2020 at 07:10:58PM +0100, Jonathan McDowell wrote: > The QCA8337(N) has an SGMII port which can operate in MAC, PHY or BASE-X > mode depending on what it's connected to (e.g. CPU vs external PHY or > SFP). At present the driver does no configuration of this port even if > it is selected. > > Add support for making sure the SGMII is enabled if it's in use, and > device tree support for configuring the connection details. Hi Jonathan It is good to include Russell King in Cc: for patches like this. Also, netdev is closed at the moment, so please post patches as RFC. It sounds like the hardware has a PCS which can support SGMII or 1000BaseX. phylink will tell you what mode to configure it to. e.g. A fibre SFP module will want 1000BaseX. A copper SFP module will want SGMII. A switch is likely to want 1000BaseX. A PHY is likely to want SGMII. So remove the "sgmii-mode" property and configure it as phylink is requesting. What exactly does sgmii-delay do? > +#define QCA8K_REG_SGMII_CTRL 0x0e0 > +#define QCA8K_SGMII_EN_PLL BIT(1) > +#define QCA8K_SGMII_EN_RX BIT(2) > +#define QCA8K_SGMII_EN_TX BIT(3) > +#define QCA8K_SGMII_EN_SD BIT(4) > +#define QCA8K_SGMII_CLK125M_DELAY BIT(7) > +#define QCA8K_SGMII_MODE_CTRL_MASK (BIT(22) | BIT(23)) > +#define QCA8K_SGMII_MODE_CTRL_BASEX 0 > +#define QCA8K_SGMII_MODE_CTRL_PHY BIT(22) > +#define QCA8K_SGMII_MODE_CTRL_MAC BIT(23) I guess these are not really bits. You cannot combine QCA8K_SGMII_MODE_CTRL_MAC and QCA8K_SGMII_MODE_CTRL_PHY. So it makes more sense to have: #define QCA8K_SGMII_MODE_CTRL_BASEX (0x0 << 22) #define QCA8K_SGMII_MODE_CTRL_PHY (0x1 << 22) #define QCA8K_SGMII_MODE_CTRL_MAC (0x2 << 22) Andrew