* [PATCH 1/3] EP93xx eth: allow passing of phy config via platform data @ 2016-02-21 18:06 Alexander Kurz 2016-02-21 18:06 ` [PATCH 2/3] edb9302 eth: privide proper phy config Alexander Kurz ` (3 more replies) 0 siblings, 4 replies; 7+ messages in thread From: Alexander Kurz @ 2016-02-21 18:06 UTC (permalink / raw) To: barebox; +Cc: Alexander Kurz Passing phy configuration to the ep93xx_eth driver was not supported yet and will be added with this patch. When no pdata is passed, the probably broken default of phy_addr = 0 will be used to maintain compatibility with the previous implementation. Signed-off-by: Alexander Kurz <akurz@blala.de> --- drivers/net/ep93xx.c | 14 ++++++++++++-- drivers/net/ep93xx.h | 2 ++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/net/ep93xx.c b/drivers/net/ep93xx.c index 90c12fc..d2458eb 100644 --- a/drivers/net/ep93xx.c +++ b/drivers/net/ep93xx.c @@ -38,6 +38,7 @@ #include <linux/types.h> #include <mach/ep93xx-regs.h> #include <linux/phy.h> +#include <ep93xx_eth.h> #include "ep93xx.h" #define EP93XX_MAX_PKT_SIZE 1536 @@ -203,8 +204,8 @@ static int ep93xx_eth_open(struct eth_device *edev) pr_debug("+ep93xx_eth_open\n"); - ret = phy_device_connect(edev, &priv->miibus, 0, NULL, - 0, PHY_INTERFACE_MODE_NA); + ret = phy_device_connect(edev, &priv->miibus, priv->phy_addr, NULL, + 0, priv->interface); if (ret) return ret; @@ -482,6 +483,7 @@ static int ep93xx_eth_set_ethaddr(struct eth_device *edev, static int ep93xx_eth_probe(struct device_d *dev) { + struct ep93xx_eth_platform_data *pdata = (struct ep93xx_eth_platform_data *)dev->platform_data; struct eth_device *edev; struct ep93xx_eth_priv *priv; int ret = -1; @@ -504,6 +506,14 @@ static int ep93xx_eth_probe(struct device_d *dev) edev->set_ethaddr = ep93xx_eth_set_ethaddr; edev->parent = dev; + if (pdata) { + priv->interface = pdata->xcv_type; + priv->phy_addr = pdata->phy_addr; + } else { + priv->interface = PHY_INTERFACE_MODE_NA; + priv->phy_addr = 0; + } + priv->miibus.read = ep93xx_phy_read; priv->miibus.write = ep93xx_phy_write; priv->miibus.parent = dev; diff --git a/drivers/net/ep93xx.h b/drivers/net/ep93xx.h index 89451b8..32ae57f 100644 --- a/drivers/net/ep93xx.h +++ b/drivers/net/ep93xx.h @@ -137,6 +137,8 @@ struct ep93xx_eth_priv { struct tx_descriptor_queue tx_dq; struct tx_status_queue tx_sq; + int phy_addr; + phy_interface_t interface; struct mii_bus miibus; }; -- 2.1.4 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/3] edb9302 eth: privide proper phy config 2016-02-21 18:06 [PATCH 1/3] EP93xx eth: allow passing of phy config via platform data Alexander Kurz @ 2016-02-21 18:06 ` Alexander Kurz 2016-02-21 18:06 ` [PATCH 3/3] net ep93xx mii: do not supress MII preamble transmission Alexander Kurz ` (2 subsequent siblings) 3 siblings, 0 replies; 7+ messages in thread From: Alexander Kurz @ 2016-02-21 18:06 UTC (permalink / raw) To: barebox; +Cc: Alexander Kurz The evaluation boards EDB9302 and Olimex-CS-E9302 both use a KS8721BL transciever in default strapping which is phy_addr=1 Signed-off-by: Alexander Kurz <akurz@blala.de> --- arch/arm/boards/edb93xx/edb93xx.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/arch/arm/boards/edb93xx/edb93xx.c b/arch/arm/boards/edb93xx/edb93xx.c index c314320..4146abf 100644 --- a/arch/arm/boards/edb93xx/edb93xx.c +++ b/arch/arm/boards/edb93xx/edb93xx.c @@ -27,10 +27,16 @@ #include <malloc.h> #include <generated/mach-types.h> #include <mach/ep93xx-regs.h> +#include <ep93xx_eth.h> #include "edb93xx.h" #define DEVCFG_U1EN (1 << 18) +static struct ep93xx_eth_platform_data ep93xx_eth_info = { + .xcv_type = PHY_INTERFACE_MODE_MII, + .phy_addr = 1, +}; + static int ep93xx_mem_init(void) { arm_add_mem_device("ram0", CONFIG_EP93XX_SDRAM_BANK0_BASE, @@ -70,7 +76,7 @@ static int ep93xx_devices_init(void) * CS line 6, data width is 16 bit */ add_generic_device("ep93xx_eth", DEVICE_ID_DYNAMIC, NULL, 0, 0, IORESOURCE_MEM, - NULL); + &ep93xx_eth_info); armlinux_set_architecture(MACH_TYPE); -- 2.1.4 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 3/3] net ep93xx mii: do not supress MII preamble transmission 2016-02-21 18:06 [PATCH 1/3] EP93xx eth: allow passing of phy config via platform data Alexander Kurz 2016-02-21 18:06 ` [PATCH 2/3] edb9302 eth: privide proper phy config Alexander Kurz @ 2016-02-21 18:06 ` Alexander Kurz 2016-02-23 8:03 ` [PATCH 1/3] EP93xx eth: allow passing of phy config via platform data Sascha Hauer 2016-02-24 8:04 ` Sascha Hauer 3 siblings, 0 replies; 7+ messages in thread From: Alexander Kurz @ 2016-02-21 18:06 UTC (permalink / raw) To: barebox; +Cc: Alexander Kurz PHY like the ks8721bl used on the edb9302 and similare evaluation boards will initially not respond to the ep93xx_phy_read/write functions when the MII-preamble is supressed. The supression is switched on by default and must be switched off by clearing bit 8, see also EP93xx Users guide. Removing the orphaned MII_SUPPRESS_PREAMBLE config option, note: setting MII_SUPPRESS_PREAMBLE would actually enable the preamble transmission. Signed-off-by: Alexander Kurz <akurz@blala.de> --- drivers/net/ep93xx.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/net/ep93xx.c b/drivers/net/ep93xx.c index d2458eb..226a3c6 100644 --- a/drivers/net/ep93xx.c +++ b/drivers/net/ep93xx.c @@ -599,14 +599,12 @@ static int ep93xx_phy_read(struct mii_bus *bus, int phy_addr, int phy_reg) pr_debug("+ep93xx_phy_read\n"); /* - * Save the current SelfCTL register value. Set MAC to suppress + * Save the current SelfCTL register value. Set MAC to send * preamble bits. Wait for any previous MII command to complete * before issuing the new command. */ self_ctl = readl(®s->selfctl); -#if defined(CONFIG_MII_SUPPRESS_PREAMBLE) /* TODO */ writel(self_ctl & ~(1 << 8), ®s->selfctl); -#endif /* defined(CONFIG_MII_SUPPRESS_PREAMBLE) */ while (readl(®s->miists) & MIISTS_BUSY) ; /* noop */ @@ -642,14 +640,12 @@ static int ep93xx_phy_write(struct mii_bus *bus, int phy_addr, pr_debug("+ep93xx_phy_write\n"); /* - * Save the current SelfCTL register value. Set MAC to suppress + * Save the current SelfCTL register value. Set MAC to send * preamble bits. Wait for any previous MII command to complete * before issuing the new command. */ self_ctl = readl(®s->selfctl); -#if defined(CONFIG_MII_SUPPRESS_PREAMBLE) /* TODO */ writel(self_ctl & ~(1 << 8), ®s->selfctl); -#endif /* defined(CONFIG_MII_SUPPRESS_PREAMBLE) */ while (readl(®s->miists) & MIISTS_BUSY) ; /* noop */ -- 2.1.4 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/3] EP93xx eth: allow passing of phy config via platform data 2016-02-21 18:06 [PATCH 1/3] EP93xx eth: allow passing of phy config via platform data Alexander Kurz 2016-02-21 18:06 ` [PATCH 2/3] edb9302 eth: privide proper phy config Alexander Kurz 2016-02-21 18:06 ` [PATCH 3/3] net ep93xx mii: do not supress MII preamble transmission Alexander Kurz @ 2016-02-23 8:03 ` Sascha Hauer 2016-02-24 8:04 ` Sascha Hauer 3 siblings, 0 replies; 7+ messages in thread From: Sascha Hauer @ 2016-02-23 8:03 UTC (permalink / raw) To: Alexander Kurz; +Cc: barebox On Sun, Feb 21, 2016 at 07:06:28PM +0100, Alexander Kurz wrote: > Passing phy configuration to the ep93xx_eth driver was not supported yet > and will be added with this patch. When no pdata is passed, the probably > broken default of phy_addr = 0 will be used to maintain compatibility > with the previous implementation. > > Signed-off-by: Alexander Kurz <akurz@blala.de> > --- > drivers/net/ep93xx.c | 14 ++++++++++++-- > drivers/net/ep93xx.h | 2 ++ > 2 files changed, 14 insertions(+), 2 deletions(-) Applied all, thanks. I wouldn't have thought EP93xx is still actively used :) Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/3] EP93xx eth: allow passing of phy config via platform data 2016-02-21 18:06 [PATCH 1/3] EP93xx eth: allow passing of phy config via platform data Alexander Kurz ` (2 preceding siblings ...) 2016-02-23 8:03 ` [PATCH 1/3] EP93xx eth: allow passing of phy config via platform data Sascha Hauer @ 2016-02-24 8:04 ` Sascha Hauer 2016-02-24 20:07 ` Alexander Kurz 3 siblings, 1 reply; 7+ messages in thread From: Sascha Hauer @ 2016-02-24 8:04 UTC (permalink / raw) To: Alexander Kurz; +Cc: barebox Hi Alexander, On Sun, Feb 21, 2016 at 07:06:28PM +0100, Alexander Kurz wrote: > Passing phy configuration to the ep93xx_eth driver was not supported yet > and will be added with this patch. When no pdata is passed, the probably > broken default of phy_addr = 0 will be used to maintain compatibility > with the previous implementation. > > Signed-off-by: Alexander Kurz <akurz@blala.de> > --- > drivers/net/ep93xx.c | 14 ++++++++++++-- > drivers/net/ep93xx.h | 2 ++ > 2 files changed, 14 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/ep93xx.c b/drivers/net/ep93xx.c > index 90c12fc..d2458eb 100644 > --- a/drivers/net/ep93xx.c > +++ b/drivers/net/ep93xx.c > @@ -38,6 +38,7 @@ > #include <linux/types.h> > #include <mach/ep93xx-regs.h> > #include <linux/phy.h> > +#include <ep93xx_eth.h> This file is missing. Forgot to git add it? While at it, could you move it to include/net/ please? Thanks Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/3] EP93xx eth: allow passing of phy config via platform data 2016-02-24 8:04 ` Sascha Hauer @ 2016-02-24 20:07 ` Alexander Kurz 2016-02-25 8:43 ` Sascha Hauer 0 siblings, 1 reply; 7+ messages in thread From: Alexander Kurz @ 2016-02-24 20:07 UTC (permalink / raw) To: Sascha Hauer; +Cc: barebox [-- Attachment #1: Type: TEXT/PLAIN, Size: 1628 bytes --] Hi Sascha, I have attached a fixed version of Patch 1 and 2. Sorry for sending an incomplete patch, thanks, Alexander On Wed, 24 Feb 2016, Sascha Hauer wrote: > Hi Alexander, > > On Sun, Feb 21, 2016 at 07:06:28PM +0100, Alexander Kurz wrote: > > Passing phy configuration to the ep93xx_eth driver was not supported yet > > and will be added with this patch. When no pdata is passed, the probably > > broken default of phy_addr = 0 will be used to maintain compatibility > > with the previous implementation. > > > > Signed-off-by: Alexander Kurz <akurz@blala.de> > > --- > > drivers/net/ep93xx.c | 14 ++++++++++++-- > > drivers/net/ep93xx.h | 2 ++ > > 2 files changed, 14 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/net/ep93xx.c b/drivers/net/ep93xx.c > > index 90c12fc..d2458eb 100644 > > --- a/drivers/net/ep93xx.c > > +++ b/drivers/net/ep93xx.c > > @@ -38,6 +38,7 @@ > > #include <linux/types.h> > > #include <mach/ep93xx-regs.h> > > #include <linux/phy.h> > > +#include <ep93xx_eth.h> > > This file is missing. Forgot to git add it? > While at it, could you move it to include/net/ please? > > Thanks > Sascha > > -- > Pengutronix e.K. | | > Industrial Linux Solutions | http://www.pengutronix.de/ | > Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | > Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | > > _______________________________________________ > barebox mailing list > barebox@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/barebox > [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: Type: TEXT/x-diff; name=0001-EP93xx-eth-allow-passing-of-phy-config-via-platform-.patch, Size: 3569 bytes --] From df439a5ef8af4d04a6f92df6b50bef5bb7f8d383 Mon Sep 17 00:00:00 2001 From: Alexander Kurz <akurz@blala.de> Date: Sun, 21 Feb 2016 18:03:30 +0100 Subject: [PATCH 1/4] EP93xx eth: allow passing of phy config via platform data Passing phy configuration to the ep93xx_eth driver was not supported yet and will be added with this patch. When no pdata is passed, the probably broken default of phy_addr = 0 will be used to maintain compatibility with the previous implementation. Signed-off-by: Alexander Kurz <akurz@blala.de> --- drivers/net/ep93xx.c | 14 ++++++++++++-- drivers/net/ep93xx.h | 2 ++ include/net/ep93xx_eth.h | 26 ++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 include/net/ep93xx_eth.h diff --git a/drivers/net/ep93xx.c b/drivers/net/ep93xx.c index 90c12fc..ef534c0 100644 --- a/drivers/net/ep93xx.c +++ b/drivers/net/ep93xx.c @@ -38,6 +38,7 @@ #include <linux/types.h> #include <mach/ep93xx-regs.h> #include <linux/phy.h> +#include <net/ep93xx_eth.h> #include "ep93xx.h" #define EP93XX_MAX_PKT_SIZE 1536 @@ -203,8 +204,8 @@ static int ep93xx_eth_open(struct eth_device *edev) pr_debug("+ep93xx_eth_open\n"); - ret = phy_device_connect(edev, &priv->miibus, 0, NULL, - 0, PHY_INTERFACE_MODE_NA); + ret = phy_device_connect(edev, &priv->miibus, priv->phy_addr, NULL, + 0, priv->interface); if (ret) return ret; @@ -482,6 +483,7 @@ static int ep93xx_eth_set_ethaddr(struct eth_device *edev, static int ep93xx_eth_probe(struct device_d *dev) { + struct ep93xx_eth_platform_data *pdata = (struct ep93xx_eth_platform_data *)dev->platform_data; struct eth_device *edev; struct ep93xx_eth_priv *priv; int ret = -1; @@ -504,6 +506,14 @@ static int ep93xx_eth_probe(struct device_d *dev) edev->set_ethaddr = ep93xx_eth_set_ethaddr; edev->parent = dev; + if (pdata) { + priv->interface = pdata->xcv_type; + priv->phy_addr = pdata->phy_addr; + } else { + priv->interface = PHY_INTERFACE_MODE_NA; + priv->phy_addr = 0; + } + priv->miibus.read = ep93xx_phy_read; priv->miibus.write = ep93xx_phy_write; priv->miibus.parent = dev; diff --git a/drivers/net/ep93xx.h b/drivers/net/ep93xx.h index 89451b8..32ae57f 100644 --- a/drivers/net/ep93xx.h +++ b/drivers/net/ep93xx.h @@ -137,6 +137,8 @@ struct ep93xx_eth_priv { struct tx_descriptor_queue tx_dq; struct tx_status_queue tx_sq; + int phy_addr; + phy_interface_t interface; struct mii_bus miibus; }; diff --git a/include/net/ep93xx_eth.h b/include/net/ep93xx_eth.h new file mode 100644 index 0000000..0fb11d0 --- /dev/null +++ b/include/net/ep93xx_eth.h @@ -0,0 +1,26 @@ +/* + * (C) Copyright 2016 Alexander Kurz <akurz@blala.de> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#ifndef __NET_EP93XX_ETH_H +#define __NET_EP93XX_ETH_H + +#include <linux/phy.h> + +struct ep93xx_eth_platform_data { + phy_interface_t xcv_type; + int phy_addr; +}; + +#endif /* __NET_EP93XX_ETH_H */ -- 2.1.4 [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #3: Type: TEXT/x-diff; name=0002-edb9302-eth-privide-proper-phy-config.patch, Size: 1415 bytes --] From 69d1cdd4cf512a11f2446a03151c9afbd84020bc Mon Sep 17 00:00:00 2001 From: Alexander Kurz <akurz@blala.de> Date: Sun, 21 Feb 2016 18:17:33 +0100 Subject: [PATCH 2/4] edb9302 eth: privide proper phy config The evaluation boards EDB9302 and Olimex-CS-E9302 both use a KS8721BL transciever in default strapping which is phy_addr=1 Signed-off-by: Alexander Kurz <akurz@blala.de> --- arch/arm/boards/edb93xx/edb93xx.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/arch/arm/boards/edb93xx/edb93xx.c b/arch/arm/boards/edb93xx/edb93xx.c index c314320..0fb93d2 100644 --- a/arch/arm/boards/edb93xx/edb93xx.c +++ b/arch/arm/boards/edb93xx/edb93xx.c @@ -27,10 +27,16 @@ #include <malloc.h> #include <generated/mach-types.h> #include <mach/ep93xx-regs.h> +#include <net/ep93xx_eth.h> #include "edb93xx.h" #define DEVCFG_U1EN (1 << 18) +static struct ep93xx_eth_platform_data ep93xx_eth_info = { + .xcv_type = PHY_INTERFACE_MODE_MII, + .phy_addr = 1, +}; + static int ep93xx_mem_init(void) { arm_add_mem_device("ram0", CONFIG_EP93XX_SDRAM_BANK0_BASE, @@ -70,7 +76,7 @@ static int ep93xx_devices_init(void) * CS line 6, data width is 16 bit */ add_generic_device("ep93xx_eth", DEVICE_ID_DYNAMIC, NULL, 0, 0, IORESOURCE_MEM, - NULL); + &ep93xx_eth_info); armlinux_set_architecture(MACH_TYPE); -- 2.1.4 [-- Attachment #4: Type: text/plain, Size: 149 bytes --] _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/3] EP93xx eth: allow passing of phy config via platform data 2016-02-24 20:07 ` Alexander Kurz @ 2016-02-25 8:43 ` Sascha Hauer 0 siblings, 0 replies; 7+ messages in thread From: Sascha Hauer @ 2016-02-25 8:43 UTC (permalink / raw) To: Alexander Kurz; +Cc: barebox On Wed, Feb 24, 2016 at 09:07:17PM +0100, Alexander Kurz wrote: > Hi Sascha, > I have attached a fixed version of Patch 1 and 2. > > Sorry for sending an incomplete patch, > thanks, Alexander Updated the patches, thanks Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2016-02-25 8:44 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2016-02-21 18:06 [PATCH 1/3] EP93xx eth: allow passing of phy config via platform data Alexander Kurz 2016-02-21 18:06 ` [PATCH 2/3] edb9302 eth: privide proper phy config Alexander Kurz 2016-02-21 18:06 ` [PATCH 3/3] net ep93xx mii: do not supress MII preamble transmission Alexander Kurz 2016-02-23 8:03 ` [PATCH 1/3] EP93xx eth: allow passing of phy config via platform data Sascha Hauer 2016-02-24 8:04 ` Sascha Hauer 2016-02-24 20:07 ` Alexander Kurz 2016-02-25 8:43 ` Sascha Hauer
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox