Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1720566 > unrolled thread
| Started by | Corentin Labbe <clabbe.montjoie@gmail.com> |
|---|---|
| First post | 2017-08-26 09:40 +0200 |
| Last post | 2017-08-26 09:40 +0200 |
| Articles | 3 — 1 participant |
Back to article view | Back to linux.kernel
[PATCH v4 0/5] net: stmmac: Detect PHY location with phy-is-integrated Corentin Labbe <clabbe.montjoie@gmail.com> - 2017-08-26 09:40 +0200
[PATCH v4 5/5] net: stmmac: Register parent MDIO in case of fake mdio-mux Corentin Labbe <clabbe.montjoie@gmail.com> - 2017-08-26 09:40 +0200
[PATCH v4 1/5] net: stmmac: Handle possible fixed-link with need_mdio_ids Corentin Labbe <clabbe.montjoie@gmail.com> - 2017-08-26 09:40 +0200
| From | Corentin Labbe <clabbe.montjoie@gmail.com> |
|---|---|
| Date | 2017-08-26 09:40 +0200 |
| Subject | [PATCH v4 0/5] net: stmmac: Detect PHY location with phy-is-integrated |
| Message-ID | <uiDRf-6Ku-3@gated-at.bofh.it> |
Hello
The current way to find if the PHY is internal is to compare DT phy-mode
and emac_variant/internal_phy.
But it will negate a possible future SoC where an external PHY use the
same phy mode than the integrated one.
This patchs series adds a new way to find if the PHY is integrated, via
the phy-is-integrated DT property.
Since it exists both integrated and external ethernet-phy@1, they are merged in
the final DTB and so share all properties.
For avoiding this, and better represent the reality, we use a MDIO mux.
The first try was to create a new MDIO mux "mdio-mux-syscon".
mdio-mux-syscon working the same way than mdio-mux-mmioreg with the exception
that the register is used via syscon/regmap.
But this solution does not work for two reason:
- changing the MDIO selection need the reset of MAC which cannot be done by the
mdio-mux-syscon driver
- There were driver loading order problem:
- mdio-mux-syscon needing that stmmac register the parent MDIO
- stmmac needing that child MDIO was registered just after registering parent MDIO
So we cannot use any external MDIO-mux.
The final solution was to represent a mdio-mux but let the MAC handle all things.
The only hack that comes with this solution is that we add a patch
"net: stmmac: Register parent MDIO in case of fake mdio-mux"
because we have ino other way to know which MDIO node to register.
Note that sun8i-v3s-emac have also an integrated PHY, but since it lacks
any external PHY support it is not necessary to add MDIO mux to it.
All patchs should go via the net tree with exception of DT patchs which should
go via the sunxi tree
Note that this serie will need backporting the patch
"Documentation: net: phy: Add phy-is-integrated binding" which is in net-next
Regards
Changes since v3:
- Added a patch for handling fixed-link
- Updated documentation
Changes since v2:
- Add a MDIO mux for creating distinction between integrated and external MDIO.
- phy-is-integrated is not set in dtsi.
Changes since v1:
- Dropped phy-is-integrated documentation patch since another same patch was already merged
- Moved phy-is-integrated from SoC dtsi to final board DT.
Corentin Labbe (5):
net: stmmac: Handle possible fixed-link with need_mdio_ids
ARM: dts: sunxi: h3/h5: represent the mdio switch used by
sun8i-h3-emac
dt-bindings: net: dwmac-sun8i: update documentation about integrated
PHY
net: stmmac: dwmac-sun8i: choose internal PHY via phy-is-integrated
net: stmmac: Register parent MDIO in case of fake mdio-mux
.../devicetree/bindings/net/dwmac-sun8i.txt | 117 ++++++++++++++++++++-
arch/arm/boot/dts/sunxi-h3-h5.dtsi | 22 +++-
drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 16 +--
.../net/ethernet/stmicro/stmmac/stmmac_platform.c | 13 ++-
4 files changed, 152 insertions(+), 16 deletions(-)
--
2.13.5
[toc] | [next] | [standalone]
| From | Corentin Labbe <clabbe.montjoie@gmail.com> |
|---|---|
| Date | 2017-08-26 09:40 +0200 |
| Subject | [PATCH v4 5/5] net: stmmac: Register parent MDIO in case of fake mdio-mux |
| Message-ID | <uiDRg-6Ku-13@gated-at.bofh.it> |
| In reply to | #1720566 |
In case of a fake MDIO switch/mux (like Allwinner H3),
the registered MDIO node should be the parent of the PHY.
Otherwise of_phy_connect will fail.
Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index e1be5735365b..4d5f3cc82476 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -312,10 +312,12 @@ static int stmmac_dt_phy(struct plat_stmmacenet_data *plat,
static const struct of_device_id need_mdio_ids[] = {
{ .compatible = "snps,dwc-qos-ethernet-4.10" },
{ .compatible = "allwinner,sun8i-a83t-emac" },
- { .compatible = "allwinner,sun8i-h3-emac" },
{ .compatible = "allwinner,sun8i-v3s-emac" },
{ .compatible = "allwinner,sun50i-a64-emac" },
};
+ static const struct of_device_id register_parent_mdio_ids[] = {
+ { .compatible = "allwinner,sun8i-h3-emac" },
+ };
/* If phy-handle property is passed from DT, use it as the PHY */
plat->phy_node = of_parse_phandle(np, "phy-handle", 0);
@@ -332,7 +334,14 @@ static int stmmac_dt_phy(struct plat_stmmacenet_data *plat,
mdio = false;
}
- if (of_match_node(need_mdio_ids, np) && !of_phy_is_fixed_link(np)) {
+ /*
+ * In case of a fake MDIO switch/mux (like Allwinner H3),
+ * the registered MDIO node should be the parent of the PHY.
+ * Otherwise of_phy_connect will fail.
+ */
+ if (of_match_node(register_parent_mdio_ids, np) && !of_phy_is_fixed_link(np)) {
+ plat->mdio_node = of_get_parent(plat->phy_node);
+ } else if (of_match_node(need_mdio_ids, np) && !of_phy_is_fixed_link(np)) {
plat->mdio_node = of_get_child_by_name(np, "mdio");
} else {
/**
--
2.13.5
[toc] | [prev] | [next] | [standalone]
| From | Corentin Labbe <clabbe.montjoie@gmail.com> |
|---|---|
| Date | 2017-08-26 09:40 +0200 |
| Subject | [PATCH v4 1/5] net: stmmac: Handle possible fixed-link with need_mdio_ids |
| Message-ID | <uiDRg-6Ku-15@gated-at.bofh.it> |
| In reply to | #1720566 |
In case of fixed link, there are no mdio node.
This patch add a test for fixed-link for bypassing MDIO node register
that match need_mdio_ids.
Note that this do not change behaviour for MDIO snps,dwmac-mdio nodes.
Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index a366b3747eeb..e1be5735365b 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -332,7 +332,7 @@ static int stmmac_dt_phy(struct plat_stmmacenet_data *plat,
mdio = false;
}
- if (of_match_node(need_mdio_ids, np)) {
+ if (of_match_node(need_mdio_ids, np) && !of_phy_is_fixed_link(np)) {
plat->mdio_node = of_get_child_by_name(np, "mdio");
} else {
/**
--
2.13.5
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web