All of lore.kernel.org
 help / color / mirror / Atom feed
From: Antoine Tenart <antoine.tenart@free-electrons.com>
To: Kishon Vijay Abraham I <kishon@ti.com>
Cc: Antoine Tenart <antoine.tenart@free-electrons.com>,
	davem@davemloft.net, andrew@lunn.ch, jason@lakedaemon.net,
	sebastian.hesselbarth@gmail.com,
	gregory.clement@free-electrons.com,
	thomas.petazzoni@free-electrons.com, nadavh@marvell.com,
	linux@armlinux.org.uk, linux-kernel@vger.kernel.org,
	mw@semihalf.com, stefanc@marvell.com,
	miquel.raynal@free-electrons.com, netdev@vger.kernel.org
Subject: Re: [PATCH net-next v3 02/13] phy: add the mvebu cp110 comphy driver
Date: Tue, 29 Aug 2017 15:12:31 +0200	[thread overview]
Message-ID: <20170829131231.GD31552@kwain> (raw)
In-Reply-To: <d1d5212d-aa39-0b49-afb8-cc45d57717c0@ti.com>

[-- Attachment #1: Type: text/plain, Size: 4410 bytes --]

Hi Kishon,

On Tue, Aug 29, 2017 at 05:55:06PM +0530, Kishon Vijay Abraham I wrote:
> On Tuesday 29 August 2017 04:53 PM, Antoine Tenart wrote:
> > On Tue, Aug 29, 2017 at 04:34:17PM +0530, Kishon Vijay Abraham I wrote:
> >> On Monday 28 August 2017 08:27 PM, Antoine Tenart wrote:
> >>> +static const struct mvebu_comhy_conf mvebu_comphy_cp110_modes[] = {
> >>> +	/* lane 0 */
> >>> +	MVEBU_COMPHY_CONF(0, 1, PHY_MODE_SGMII, 0x1),
> >>> +	/* lane 1 */
> >>> +	MVEBU_COMPHY_CONF(1, 2, PHY_MODE_SGMII, 0x1),
> >>> +	/* lane 2 */
> >>> +	MVEBU_COMPHY_CONF(2, 0, PHY_MODE_SGMII, 0x1),
> >>> +	MVEBU_COMPHY_CONF(2, 0, PHY_MODE_10GKR, 0x1),
> >>> +	/* lane 3 */
> >>> +	MVEBU_COMPHY_CONF(3, 1, PHY_MODE_SGMII, 0x2),
> >>> +	/* lane 4 */
> >>> +	MVEBU_COMPHY_CONF(4, 0, PHY_MODE_SGMII, 0x2),
> >>> +	MVEBU_COMPHY_CONF(4, 0, PHY_MODE_10GKR, 0x2),
> >>> +	MVEBU_COMPHY_CONF(4, 1, PHY_MODE_SGMII, 0x1),
> >>> +	/* lane 5 */
> >>> +	MVEBU_COMPHY_CONF(5, 2, PHY_MODE_SGMII, 0x1),
> >>> +};
> >>
> >> IMHO all the lane and mode configuration should come from dt. That would make
> >> it more reusable when comphy is configured differently.
> > 
> > These connexions between engines and the comphy lanes are inside the
> > SoC. They won't change for a given SoC, and the actual configuration is
> > at the board level to know what is connected to the output of a given
> > lane, which is already described into the dt (the lane phandle).
> > 
> > So I think we can keep this inside the driver, and we'll had other
> > tables if the same comphy is ever used in another SoC.
> > 
> > What do you think?
> 
> I'd like to avoid adding tables for every SoC. These are configuration details
> and can come from dt.

Actually this is per CP design, not SoC (this one is used in both 7k and
8k SoCs from Marvell, and probably others). I'm still not convinced this
is a good idea to put this into the dt. First of all we would end up with
something like (and this is only for a single lane, out of *6*):

cpm_comphy: phy@phy@120000 {
	compatible = "marvell,comphy-cp110";
	reg = <0x120000 0x6000>;
	marvell,system-controller = <&cpm_syscon0>;
	#address-cells = <1>;
	#size-cells = <0>;

	cpm_comphy0: phy@0 {
		reg = <0>;
		#phy-cells = <1>;

		mode@0 {
			phy-mode = PHY_MODE_SGMII;
			selector = <0x1>;
			pipe-selector = <0x0>;
			port = <0>;
		};

		mode@1 {
			phy-mode = PHY_MODE_HS_SGMII;
			selector = <0x1>;
			pipe-selector = <0x0>;
			port = <0>;
		};

		mode@2 {
			phy-mode = PHY_MODE_RXAUI;
			selector = <0x2>;
			pipe-selector = <0x0>;
			port = <0>;
		};

		mode@3 {
			phy-mode = PHY_MODE_10GKR;
			selector = <0x2>;
			pipe-selector = <0x0>;
			port = <0>;
		};

		mode@4 {
			phy-mode = PHY_MODE_SATA;
			selector = <0x4>;
			pipe-selector = <0x0>;
			port = <1>;
		};

		mode@5 {
			phy-mode = PHY_MODE_USB;
			selector = <0x0>;
			pipe-selector = <0x1>;
			port = <2>;
		};

		mode@6 {
			phy-mode = PHY_MODE_USB;
			selector = <0x0>;
			pipe-selector = <0x2>;
			port = <0>;
		};

		... + PCIe, other ports ...
	};

	cpm_comphy1: phy@1 {
		...
	};

	...
};

And this "configuration" makes us think the comphy driver would be
somehow generic with only these parameters to update when using a
different CP. In reality we do have one other comphy in another CP, and
it requires more than just updating the above parameters: the init
functions also are SoC specific. So the table used in the patch proposed
only is a small part of this "configuration". In fact it's not a
configuration at all, but only a mode-to-bit indirection, used in the
comphy init functions.

What is proposed instead, is very close to what actually changes a lot,
and what a designer can change: the CP internals are described in the
driver as these won't change (and if they do in a future CP design, a
lot more effort would be needed than just updating the table), and the
actual lane connexions on the board are configured through the dt, which
is board specific.

Finally we do not have (yet) any example of this IP being reused as-is.
So we have no idea what other changes than the ones described above will
be needed. But for sure not only the mode and lane configurations.

Thanks,
Antoine

-- 
Antoine Ténart, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2017-08-29 13:12 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-28 14:57 [PATCH net-next v3 00/13] net: mvpp2: comphy configuration Antoine Tenart
2017-08-28 14:57 ` [PATCH net-next v3 01/13] phy: add sgmii and 10gkr modes to the phy_mode enum Antoine Tenart
2017-08-29 10:38   ` Kishon Vijay Abraham I
2017-08-29 11:27     ` Antoine Tenart
2017-08-29 12:21       ` Kishon Vijay Abraham I
2017-08-28 14:57 ` [PATCH net-next v3 02/13] phy: add the mvebu cp110 comphy driver Antoine Tenart
2017-08-29 11:04   ` Kishon Vijay Abraham I
2017-08-29 11:23     ` Antoine Tenart
2017-08-29 12:25       ` Kishon Vijay Abraham I
2017-08-29 13:12         ` Antoine Tenart [this message]
2017-08-30  5:31           ` Kishon Vijay Abraham I
2017-08-30  6:43             ` Antoine Tenart
2017-08-30  5:19   ` Kishon Vijay Abraham I
2017-08-30  6:36     ` Antoine Tenart
2017-08-28 14:57 ` [PATCH net-next v3 03/13] Documentation/bindings: phy: document the Marvell " Antoine Tenart
2017-08-28 14:57 ` [PATCH net-next v3 04/13] net: mvpp2: initialize the comphy Antoine Tenart
2017-08-28 14:57 ` [PATCH net-next v3 05/13] net: mvpp2: simplify the link_event function Antoine Tenart
2017-08-28 14:57 ` [PATCH net-next v3 06/13] net: mvpp2: improve the link management function Antoine Tenart
2017-08-28 14:57 ` [PATCH net-next v3 07/13] net: mvpp2: do not set GMAC autoneg when using XLG MAC Antoine Tenart
2017-08-28 14:57 ` [PATCH net-next v3 08/13] net: mvpp2: dynamic reconfiguration of the comphy/GoP/MAC Antoine Tenart
2017-08-28 14:57 ` [PATCH net-next v3 09/13] arm64: dts: marvell: extend the cp110 syscon register area length Antoine Tenart
2017-08-28 14:57 ` [PATCH net-next v3 10/13] arm64: dts: marvell: add comphy nodes on cp110 master and slave Antoine Tenart
2017-08-28 14:57 ` [PATCH net-next v3 11/13] arm64: dts: marvell: mcbin: add comphy references to Ethernet ports Antoine Tenart
2017-08-28 14:57 ` [PATCH net-next v3 12/13] arm64: dts: marvell: 7040-db: " Antoine Tenart
2017-08-28 14:57 ` [PATCH net-next v3 13/13] arm64: defconfig: enable Marvell CP110 comphy Antoine Tenart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170829131231.GD31552@kwain \
    --to=antoine.tenart@free-electrons.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=gregory.clement@free-electrons.com \
    --cc=jason@lakedaemon.net \
    --cc=kishon@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=miquel.raynal@free-electrons.com \
    --cc=mw@semihalf.com \
    --cc=nadavh@marvell.com \
    --cc=netdev@vger.kernel.org \
    --cc=sebastian.hesselbarth@gmail.com \
    --cc=stefanc@marvell.com \
    --cc=thomas.petazzoni@free-electrons.com \
    --subject='Re: [PATCH net-next v3 02/13] phy: add the mvebu cp110 comphy driver' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.