netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 0/4] net: mfd: AC200 Ethernet PHY
@ 2020-04-16 18:57 Jernej Skrabec
  2020-04-16 18:57 ` [RFC PATCH 1/4] mfd: Add support for AC200 Jernej Skrabec
                   ` (4 more replies)
  0 siblings, 5 replies; 16+ messages in thread
From: Jernej Skrabec @ 2020-04-16 18:57 UTC (permalink / raw)
  To: robh+dt, andrew, f.fainelli, hkallweit1
  Cc: mripard, wens, lee.jones, linux, davem, devicetree,
	linux-arm-kernel, linux-kernel, netdev

This is attempt to support Ethernet PHY on AC200 MFD chip. I'm sending
this as RFC because I stumbled on a problem how to properly describe it
in DT. Proper DT documentation will be added later, once DT issue is
solved.

Before Ethernet PHY can be actually used, few things must happen:
1. 24 MHz clock must be enabled and connected to input pin of this
   chip. In this case, PWM is set to generate 24 MHz signal with 50%
   duty cycle.
2. Chip must be put out of reset through I2C
3. Ethernet PHY must be enabled and configured through I2C

All above suggest that AC200 chip must be child node of I2C and Ethernet
PHY child node of AC200 node. This is done in patch 3.

However, mdio bus binding also requires that ethernet PHY is child node
of mdio bus node which can't be, because it's already child node of
AC200 MFD node.

Currently I'm using workaround to have another PHY defined in mdio bus
node as can be seen in patch 4. Then, with careful module loading order,
I make sure that ethernet controller driver is loaded last, after AC200
ethernet PHY driver is loaded. But that's fragile and not acceptable.

Suggestions how to solve that are highly appreciated.

One possible solution is that mdio bus node would contain phandle to
PHY node instead of having actual PHY child node.

Documentation of this chip can be found at
http://linux-sunxi.org/File:AC200_Datasheet_V1.1.pdf

Note that in this case, AC200 IC is copackaged with Allwinner H6 SoC and
all connections between them are internal. So, for example, PWM is the
only way to provide 24 MHz clock to this chip.

Best regards,
Jernej

Jernej Skrabec (4):
  mfd: Add support for AC200
  net: phy: Add support for AC200 EPHY
  arm64: dts: allwinner: h6: Add AC200 EPHY related nodes
  arm64: dts: allwinner: h6: tanix-tx6: Enable ethernet

 .../dts/allwinner/sun50i-h6-tanix-tx6.dts     |  32 +++
 arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi  |  63 ++++++
 drivers/mfd/Kconfig                           |   9 +
 drivers/mfd/Makefile                          |   1 +
 drivers/mfd/ac200.c                           | 188 ++++++++++++++++
 drivers/net/phy/Kconfig                       |   7 +
 drivers/net/phy/Makefile                      |   1 +
 drivers/net/phy/ac200.c                       | 206 +++++++++++++++++
 include/linux/mfd/ac200.h                     | 210 ++++++++++++++++++
 9 files changed, 717 insertions(+)
 create mode 100644 drivers/mfd/ac200.c
 create mode 100644 drivers/net/phy/ac200.c
 create mode 100644 include/linux/mfd/ac200.h

-- 
2.26.0


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2020-04-24  8:05 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-16 18:57 [RFC PATCH 0/4] net: mfd: AC200 Ethernet PHY Jernej Skrabec
2020-04-16 18:57 ` [RFC PATCH 1/4] mfd: Add support for AC200 Jernej Skrabec
2020-04-24  8:05   ` Lee Jones
2020-04-16 18:57 ` [RFC PATCH 2/4] net: phy: Add support for AC200 EPHY Jernej Skrabec
2020-04-16 19:18   ` Florian Fainelli
2020-04-17 15:01     ` Jernej Škrabec
2020-04-16 20:18   ` Heiner Kallweit
2020-04-17 16:03     ` Jernej Škrabec
2020-04-17 16:29       ` Heiner Kallweit
2020-04-17 17:15         ` Jernej Škrabec
2020-04-17 16:15     ` Jernej Škrabec
2020-04-17 16:16       ` Heiner Kallweit
2020-04-17 17:01       ` Andrew Lunn
2020-04-16 18:57 ` [RFC PATCH 3/4] arm64: dts: allwinner: h6: Add AC200 EPHY related nodes Jernej Skrabec
2020-04-16 18:57 ` [RFC PATCH 4/4] arm64: dts: allwinner: h6: tanix-tx6: Enable ethernet Jernej Skrabec
2020-04-16 21:54 ` [RFC PATCH 0/4] net: mfd: AC200 Ethernet PHY Andrew Lunn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).