* [PATCH 0/2] ARM & NET: add fixed phy support on stmmac @ 2015-01-23 2:41 Ming Lei 2015-01-23 2:41 ` [PATCH 1/2] ARM: EXYNOS: add fixed phy support for EXYNOS5440 Ming Lei 2015-01-23 2:41 ` [PATCH 2/2] net: stmmac: add fixed_phy and phy_addr support using DT file Ming Lei 0 siblings, 2 replies; 6+ messages in thread From: Ming Lei @ 2015-01-23 2:41 UTC (permalink / raw) To: linux-arm-kernel The EXYNOS5440 sd5v1(arch/arm/boot/dts/exynos5440-sd5v1.dts) has one stmmc gmac which uses fixed phy, so add fixed phy support for both EXYNOS5440 and stmmac. Thanks, Ming Lei ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] ARM: EXYNOS: add fixed phy support for EXYNOS5440 2015-01-23 2:41 [PATCH 0/2] ARM & NET: add fixed phy support on stmmac Ming Lei @ 2015-01-23 2:41 ` Ming Lei 2015-01-23 4:12 ` Florian Fainelli 2015-01-23 2:41 ` [PATCH 2/2] net: stmmac: add fixed_phy and phy_addr support using DT file Ming Lei 1 sibling, 1 reply; 6+ messages in thread From: Ming Lei @ 2015-01-23 2:41 UTC (permalink / raw) To: linux-arm-kernel From: Byungho An <bh74.an@samsung.com> This patch adds fixed phy codes for Exynos5440. This patch can support fixed_phy. Signed-off-by: Byungho An <bh74.an@samsung.com> Signed-off-by: Ike Panhc <ike.pan@canonical.com> Signed-off-by: Ming Lei <ming.lei@canoncial.com> --- arch/arm/mach-exynos/exynos.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c index 78eca99b..dfd5699 100644 --- a/arch/arm/mach-exynos/exynos.c +++ b/arch/arm/mach-exynos/exynos.c @@ -20,6 +20,8 @@ #include <linux/platform_device.h> #include <linux/pm_domain.h> #include <linux/irqchip.h> +#include <linux/phy.h> +#include <linux/phy_fixed.h> #include <asm/cacheflush.h> #include <asm/hardware/cache-l2x0.h> @@ -202,8 +204,21 @@ static void __init exynos_init_irq(void) exynos_map_pmu(); } +static struct fixed_phy_status fixed_phy_status __initdata = { + .link = 1, + .speed = 1000, + .duplex = 1, +}; + static void __init exynos_dt_machine_init(void) { + struct device_node *gmac_np; + unsigned int tmp; + + /* add fixed phy in need */ + gmac_np = of_find_compatible_node(NULL, NULL, "snps,dwmac-3.70a"); + if (of_find_property(gmac_np, "fixed_phy", NULL)) + tmp = fixed_phy_add(PHY_POLL, 1, &fixed_phy_status); /* * This is called from smp_prepare_cpus if we've built for SMP, but * we still need to set it up for PM and firmware ops if not. -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 1/2] ARM: EXYNOS: add fixed phy support for EXYNOS5440 2015-01-23 2:41 ` [PATCH 1/2] ARM: EXYNOS: add fixed phy support for EXYNOS5440 Ming Lei @ 2015-01-23 4:12 ` Florian Fainelli 0 siblings, 0 replies; 6+ messages in thread From: Florian Fainelli @ 2015-01-23 4:12 UTC (permalink / raw) To: linux-arm-kernel Le 22/01/2015 18:41, Ming Lei a ?crit : > From: Byungho An <bh74.an@samsung.com> > > This patch adds fixed phy codes for Exynos5440. This patch can > support fixed_phy. > > Signed-off-by: Byungho An <bh74.an@samsung.com> Signed-off-by: Ike > Panhc <ike.pan@canonical.com> Signed-off-by: Ming Lei > <ming.lei@canoncial.com> --- arch/arm/mach-exynos/exynos.c | 15 > +++++++++++++++ 1 file changed, 15 insertions(+) > > diff --git a/arch/arm/mach-exynos/exynos.c > b/arch/arm/mach-exynos/exynos.c index 78eca99b..dfd5699 100644 --- > a/arch/arm/mach-exynos/exynos.c +++ > b/arch/arm/mach-exynos/exynos.c @@ -20,6 +20,8 @@ #include > <linux/platform_device.h> #include <linux/pm_domain.h> #include > <linux/irqchip.h> +#include <linux/phy.h> +#include > <linux/phy_fixed.h> > > #include <asm/cacheflush.h> #include <asm/hardware/cache-l2x0.h> @@ > -202,8 +204,21 @@ static void __init exynos_init_irq(void) > exynos_map_pmu(); } > > +static struct fixed_phy_status fixed_phy_status __initdata = { + > .link = 1, + .speed = 1000, + > .duplex = 1, +}; + static void __init > exynos_dt_machine_init(void) { + struct device_node *gmac_np; + > unsigned int tmp; + + /* add fixed phy in need */ + gmac_np = > of_find_compatible_node(NULL, NULL, "snps,dwmac-3.70a"); + if > (of_find_property(gmac_np, "fixed_phy", NULL)) + tmp = > fixed_phy_add(PHY_POLL, 1, &fixed_phy_status); Is there a particular reason you are doing this and not using of_phy_is_fixed_link() and of_phy_register_fixed_link()? See the gianfar and bcmsysport for examples on how to use it in a driver along with the relevant Device Tree binding in Documentation/devicetree/bindings/net/fixed-link.txt for examples. > /* * This is called from smp_prepare_cpus if we've built for SMP, > but * we still need to set it up for PM and firmware ops if not. > -- Florian ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/2] net: stmmac: add fixed_phy and phy_addr support using DT file 2015-01-23 2:41 [PATCH 0/2] ARM & NET: add fixed phy support on stmmac Ming Lei 2015-01-23 2:41 ` [PATCH 1/2] ARM: EXYNOS: add fixed phy support for EXYNOS5440 Ming Lei @ 2015-01-23 2:41 ` Ming Lei 2015-01-23 4:15 ` Florian Fainelli 1 sibling, 1 reply; 6+ messages in thread From: Ming Lei @ 2015-01-23 2:41 UTC (permalink / raw) To: linux-arm-kernel From: Byungho An <bh74.an@samsung.com> This patch adds codes for DT file support, fixed_phy and phy_addr can be set in DT file. Signed-off-by: Byungho An <bh74.an@samsung.com> (bypass check for fixed phy) Signed-off-by: Ming Lei<ming.lei@canonical.com> --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 5 ++++- .../net/ethernet/stmicro/stmmac/stmmac_platform.c | 7 +++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 8c6b7c16..ddb4351 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -847,8 +847,11 @@ static int stmmac_init_phy(struct net_device *dev) * 0 rather than 0xffff. Catch this here and treat 0 as a non-existent * device as well. * Note: phydev->phy_id is the result of reading the UID PHY registers. + * But phy_id returned from fixed phy is always zero, so bypass the + * check for fixed phy. */ - if (phydev->phy_id == 0) { + if (phydev->phy_id == 0 && (!priv->plat->phy_bus_name || + strcmp(priv->plat->phy_bus_name,"fixed"))) { phy_disconnect(phydev); return -ENODEV; } diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index 879e29f..4f11491 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c @@ -128,6 +128,7 @@ static int stmmac_probe_config_dt(struct platform_device *pdev, struct device_node *np = pdev->dev.of_node; struct stmmac_dma_cfg *dma_cfg; const struct of_device_id *device; + u32 phy_addr; if (!np) return -ENODEV; @@ -217,6 +218,12 @@ static int stmmac_probe_config_dt(struct platform_device *pdev, plat->pmt = 1; } + if (of_find_property(np, "fixed_phy", NULL)) { + plat->phy_bus_name = "fixed"; + of_property_read_u32(np, "phy_addr", &phy_addr); + plat->phy_addr = phy_addr; + } + if (of_device_is_compatible(np, "snps,dwmac-3.610") || of_device_is_compatible(np, "snps,dwmac-3.710")) { plat->enh_desc = 1; -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] net: stmmac: add fixed_phy and phy_addr support using DT file 2015-01-23 2:41 ` [PATCH 2/2] net: stmmac: add fixed_phy and phy_addr support using DT file Ming Lei @ 2015-01-23 4:15 ` Florian Fainelli 2015-01-23 4:57 ` Ming Lei 0 siblings, 1 reply; 6+ messages in thread From: Florian Fainelli @ 2015-01-23 4:15 UTC (permalink / raw) To: linux-arm-kernel Le 22/01/2015 18:41, Ming Lei a ?crit : > From: Byungho An <bh74.an@samsung.com> > > This patch adds codes for DT file support, fixed_phy and phy_addr > can be set in DT file. > > Signed-off-by: Byungho An <bh74.an@samsung.com> (bypass check for > fixed phy) Signed-off-by: Ming Lei<ming.lei@canonical.com> --- > drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 5 ++++- > .../net/ethernet/stmicro/stmmac/stmmac_platform.c | 7 +++++++ 2 > files changed, 11 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index > 8c6b7c16..ddb4351 100644 --- > a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ > b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -847,8 > +847,11 @@ static int stmmac_init_phy(struct net_device *dev) * 0 > rather than 0xffff. Catch this here and treat 0 as a non-existent * > device as well. * Note: phydev->phy_id is the result of reading the > UID PHY registers. + * But phy_id returned from fixed phy is > always zero, so bypass the + * check for fixed phy. */ - if > (phydev->phy_id == 0) { + if (phydev->phy_id == 0 && > (!priv->plat->phy_bus_name || + > strcmp(priv->plat->phy_bus_name,"fixed"))) { > phy_disconnect(phydev); return -ENODEV; } diff --git > a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c > b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index > 879e29f..4f11491 100644 --- > a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ > b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c @@ -128,6 > +128,7 @@ static int stmmac_probe_config_dt(struct platform_device > *pdev, struct device_node *np = pdev->dev.of_node; struct > stmmac_dma_cfg *dma_cfg; const struct of_device_id *device; + u32 > phy_addr; > > if (!np) return -ENODEV; @@ -217,6 +218,12 @@ static int > stmmac_probe_config_dt(struct platform_device *pdev, plat->pmt = > 1; } > > + if (of_find_property(np, "fixed_phy", NULL)) { + > plat->phy_bus_name = "fixed"; + of_property_read_u32(np, > "phy_addr", &phy_addr); + plat->phy_addr = phy_addr; + } Humm, same here, it would look like you could use the existing Device Tree helpers for parsing and registering a fixed PHY here, provided that you use the proper binding though. BTW, Ming Lei's email is bouncing, do we have an updated email he could be contacted with? > + if (of_device_is_compatible(np, "snps,dwmac-3.610") || > of_device_is_compatible(np, "snps,dwmac-3.710")) { plat->enh_desc = > 1; > -- Florian ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/2] net: stmmac: add fixed_phy and phy_addr support using DT file 2015-01-23 4:15 ` Florian Fainelli @ 2015-01-23 4:57 ` Ming Lei 0 siblings, 0 replies; 6+ messages in thread From: Ming Lei @ 2015-01-23 4:57 UTC (permalink / raw) To: linux-arm-kernel On Fri, Jan 23, 2015 at 12:15 PM, Florian Fainelli <f.fainelli@gmail.com> wrote: > Le 22/01/2015 18:41, Ming Lei a ?crit : >> From: Byungho An <bh74.an@samsung.com> >> >> This patch adds codes for DT file support, fixed_phy and phy_addr >> can be set in DT file. >> >> Signed-off-by: Byungho An <bh74.an@samsung.com> (bypass check for >> fixed phy) Signed-off-by: Ming Lei<ming.lei@canonical.com> --- >> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 5 ++++- >> .../net/ethernet/stmicro/stmmac/stmmac_platform.c | 7 +++++++ 2 >> files changed, 11 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c >> b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index >> 8c6b7c16..ddb4351 100644 --- >> a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ >> b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -847,8 >> +847,11 @@ static int stmmac_init_phy(struct net_device *dev) * 0 >> rather than 0xffff. Catch this here and treat 0 as a non-existent * >> device as well. * Note: phydev->phy_id is the result of reading the >> UID PHY registers. + * But phy_id returned from fixed phy is >> always zero, so bypass the + * check for fixed phy. */ - if >> (phydev->phy_id == 0) { + if (phydev->phy_id == 0 && >> (!priv->plat->phy_bus_name || + >> strcmp(priv->plat->phy_bus_name,"fixed"))) { >> phy_disconnect(phydev); return -ENODEV; } diff --git >> a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c >> b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index >> 879e29f..4f11491 100644 --- >> a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ >> b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c @@ -128,6 >> +128,7 @@ static int stmmac_probe_config_dt(struct platform_device >> *pdev, struct device_node *np = pdev->dev.of_node; struct >> stmmac_dma_cfg *dma_cfg; const struct of_device_id *device; + u32 >> phy_addr; >> >> if (!np) return -ENODEV; @@ -217,6 +218,12 @@ static int >> stmmac_probe_config_dt(struct platform_device *pdev, plat->pmt = >> 1; } >> >> + if (of_find_property(np, "fixed_phy", NULL)) { + >> plat->phy_bus_name = "fixed"; + of_property_read_u32(np, >> "phy_addr", &phy_addr); + plat->phy_addr = phy_addr; + } > > Humm, same here, it would look like you could use the existing Device > Tree helpers for parsing and registering a fixed PHY here, provided > that you use the proper binding though. OK, I will try to use the existing DT helpers in v1. > > BTW, Ming Lei's email is bouncing, do we have an updated email he > could be contacted with? Sorry, my signed-off-by email in the 1st patch is wrong(typo), and the address in this email and patch is correct. Thanks, Ming Lei ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-01-23 4:57 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-01-23 2:41 [PATCH 0/2] ARM & NET: add fixed phy support on stmmac Ming Lei 2015-01-23 2:41 ` [PATCH 1/2] ARM: EXYNOS: add fixed phy support for EXYNOS5440 Ming Lei 2015-01-23 4:12 ` Florian Fainelli 2015-01-23 2:41 ` [PATCH 2/2] net: stmmac: add fixed_phy and phy_addr support using DT file Ming Lei 2015-01-23 4:15 ` Florian Fainelli 2015-01-23 4:57 ` Ming Lei
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).