* [for master PATCH 2/2] calao: at91 qil/tny/usb auto detect the phy addr
2012-08-14 15:48 [for master PATCH 1/2] miidev: add phy_addr detection support Jean-Christophe PLAGNIOL-VILLARD
@ 2012-08-14 15:48 ` Jean-Christophe PLAGNIOL-VILLARD
2012-09-15 14:23 ` Jean-Christophe PLAGNIOL-VILLARD
2012-08-14 19:58 ` [for master PATCH 1/2] miidev: add phy_addr detection support Sascha Hauer
` (2 subsequent siblings)
3 siblings, 1 reply; 14+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-08-14 15:48 UTC (permalink / raw)
To: barebox
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
arch/arm/boards/qil-a9260/init.c | 2 +-
arch/arm/boards/tny-a926x/init.c | 2 +-
arch/arm/boards/usb-a926x/init.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/arm/boards/qil-a9260/init.c b/arch/arm/boards/qil-a9260/init.c
index ee204fb..92aea97 100644
--- a/arch/arm/boards/qil-a9260/init.c
+++ b/arch/arm/boards/qil-a9260/init.c
@@ -80,7 +80,7 @@ static void qil_a9260_add_device_mci(void) {}
#ifdef CONFIG_CALAO_MB_QIL_A9260
static struct at91_ether_platform_data macb_pdata = {
.flags = AT91SAM_ETHER_RMII,
- .phy_addr = 0,
+ .phy_addr = -1,
};
static void qil_a9260_phy_reset(void)
diff --git a/arch/arm/boards/tny-a926x/init.c b/arch/arm/boards/tny-a926x/init.c
index d58132a..556e633 100644
--- a/arch/arm/boards/tny-a926x/init.c
+++ b/arch/arm/boards/tny-a926x/init.c
@@ -118,7 +118,7 @@ static void tny_a9260_add_device_nand(void)
#ifdef CONFIG_DRIVER_NET_MACB
static struct at91_ether_platform_data macb_pdata = {
.flags = AT91SAM_ETHER_RMII,
- .phy_addr = 0,
+ .phy_addr = -1,
};
static void __init ek_add_device_macb(void)
diff --git a/arch/arm/boards/usb-a926x/init.c b/arch/arm/boards/usb-a926x/init.c
index 52444e1..7b19fa4 100644
--- a/arch/arm/boards/usb-a926x/init.c
+++ b/arch/arm/boards/usb-a926x/init.c
@@ -122,7 +122,7 @@ static void usb_a9260_add_device_nand(void) {}
#if defined(CONFIG_DRIVER_NET_MACB)
static struct at91_ether_platform_data macb_pdata = {
.flags = AT91SAM_ETHER_RMII,
- .phy_addr = 0,
+ .phy_addr = -1,
};
static void usb_a9260_phy_reset(void)
--
1.7.10.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [for master PATCH 2/2] calao: at91 qil/tny/usb auto detect the phy addr
2012-08-14 15:48 ` [for master PATCH 2/2] calao: at91 qil/tny/usb auto detect the phy addr Jean-Christophe PLAGNIOL-VILLARD
@ 2012-09-15 14:23 ` Jean-Christophe PLAGNIOL-VILLARD
2012-10-02 14:25 ` Jean-Christophe PLAGNIOL-VILLARD
0 siblings, 1 reply; 14+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-09-15 14:23 UTC (permalink / raw)
To: barebox
Hi Sacha,
after applying the phylib we need this path on calao hw
Best Regards,
J.
On 17:48 Tue 14 Aug , Jean-Christophe PLAGNIOL-VILLARD wrote:
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
> arch/arm/boards/qil-a9260/init.c | 2 +-
> arch/arm/boards/tny-a926x/init.c | 2 +-
> arch/arm/boards/usb-a926x/init.c | 2 +-
> 3 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm/boards/qil-a9260/init.c b/arch/arm/boards/qil-a9260/init.c
> index ee204fb..92aea97 100644
> --- a/arch/arm/boards/qil-a9260/init.c
> +++ b/arch/arm/boards/qil-a9260/init.c
> @@ -80,7 +80,7 @@ static void qil_a9260_add_device_mci(void) {}
> #ifdef CONFIG_CALAO_MB_QIL_A9260
> static struct at91_ether_platform_data macb_pdata = {
> .flags = AT91SAM_ETHER_RMII,
> - .phy_addr = 0,
> + .phy_addr = -1,
> };
>
> static void qil_a9260_phy_reset(void)
> diff --git a/arch/arm/boards/tny-a926x/init.c b/arch/arm/boards/tny-a926x/init.c
> index d58132a..556e633 100644
> --- a/arch/arm/boards/tny-a926x/init.c
> +++ b/arch/arm/boards/tny-a926x/init.c
> @@ -118,7 +118,7 @@ static void tny_a9260_add_device_nand(void)
> #ifdef CONFIG_DRIVER_NET_MACB
> static struct at91_ether_platform_data macb_pdata = {
> .flags = AT91SAM_ETHER_RMII,
> - .phy_addr = 0,
> + .phy_addr = -1,
> };
>
> static void __init ek_add_device_macb(void)
> diff --git a/arch/arm/boards/usb-a926x/init.c b/arch/arm/boards/usb-a926x/init.c
> index 52444e1..7b19fa4 100644
> --- a/arch/arm/boards/usb-a926x/init.c
> +++ b/arch/arm/boards/usb-a926x/init.c
> @@ -122,7 +122,7 @@ static void usb_a9260_add_device_nand(void) {}
> #if defined(CONFIG_DRIVER_NET_MACB)
> static struct at91_ether_platform_data macb_pdata = {
> .flags = AT91SAM_ETHER_RMII,
> - .phy_addr = 0,
> + .phy_addr = -1,
> };
>
> static void usb_a9260_phy_reset(void)
> --
> 1.7.10.4
>
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [for master PATCH 2/2] calao: at91 qil/tny/usb auto detect the phy addr
2012-09-15 14:23 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2012-10-02 14:25 ` Jean-Christophe PLAGNIOL-VILLARD
0 siblings, 0 replies; 14+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-10-02 14:25 UTC (permalink / raw)
To: barebox
HI,
this patch is mandatory on the next as we now fail on phy not found
Best Regards,
J.
On 16:23 Sat 15 Sep , Jean-Christophe PLAGNIOL-VILLARD wrote:
> Hi Sacha,
>
> after applying the phylib we need this path on calao hw
>
> Best Regards,
> J.
> On 17:48 Tue 14 Aug , Jean-Christophe PLAGNIOL-VILLARD wrote:
> > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > ---
> > arch/arm/boards/qil-a9260/init.c | 2 +-
> > arch/arm/boards/tny-a926x/init.c | 2 +-
> > arch/arm/boards/usb-a926x/init.c | 2 +-
> > 3 files changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/arch/arm/boards/qil-a9260/init.c b/arch/arm/boards/qil-a9260/init.c
> > index ee204fb..92aea97 100644
> > --- a/arch/arm/boards/qil-a9260/init.c
> > +++ b/arch/arm/boards/qil-a9260/init.c
> > @@ -80,7 +80,7 @@ static void qil_a9260_add_device_mci(void) {}
> > #ifdef CONFIG_CALAO_MB_QIL_A9260
> > static struct at91_ether_platform_data macb_pdata = {
> > .flags = AT91SAM_ETHER_RMII,
> > - .phy_addr = 0,
> > + .phy_addr = -1,
> > };
> >
> > static void qil_a9260_phy_reset(void)
> > diff --git a/arch/arm/boards/tny-a926x/init.c b/arch/arm/boards/tny-a926x/init.c
> > index d58132a..556e633 100644
> > --- a/arch/arm/boards/tny-a926x/init.c
> > +++ b/arch/arm/boards/tny-a926x/init.c
> > @@ -118,7 +118,7 @@ static void tny_a9260_add_device_nand(void)
> > #ifdef CONFIG_DRIVER_NET_MACB
> > static struct at91_ether_platform_data macb_pdata = {
> > .flags = AT91SAM_ETHER_RMII,
> > - .phy_addr = 0,
> > + .phy_addr = -1,
> > };
> >
> > static void __init ek_add_device_macb(void)
> > diff --git a/arch/arm/boards/usb-a926x/init.c b/arch/arm/boards/usb-a926x/init.c
> > index 52444e1..7b19fa4 100644
> > --- a/arch/arm/boards/usb-a926x/init.c
> > +++ b/arch/arm/boards/usb-a926x/init.c
> > @@ -122,7 +122,7 @@ static void usb_a9260_add_device_nand(void) {}
> > #if defined(CONFIG_DRIVER_NET_MACB)
> > static struct at91_ether_platform_data macb_pdata = {
> > .flags = AT91SAM_ETHER_RMII,
> > - .phy_addr = 0,
> > + .phy_addr = -1,
> > };
> >
> > static void usb_a9260_phy_reset(void)
> > --
> > 1.7.10.4
> >
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [for master PATCH 1/2] miidev: add phy_addr detection support
2012-08-14 15:48 [for master PATCH 1/2] miidev: add phy_addr detection support Jean-Christophe PLAGNIOL-VILLARD
2012-08-14 15:48 ` [for master PATCH 2/2] calao: at91 qil/tny/usb auto detect the phy addr Jean-Christophe PLAGNIOL-VILLARD
@ 2012-08-14 19:58 ` Sascha Hauer
2012-08-15 4:32 ` Jean-Christophe PLAGNIOL-VILLARD
2012-09-10 15:19 ` Jean-Christophe PLAGNIOL-VILLARD
2012-10-02 13:23 ` Sascha Hauer
3 siblings, 1 reply; 14+ messages in thread
From: Sascha Hauer @ 2012-08-14 19:58 UTC (permalink / raw)
To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox
On Tue, Aug 14, 2012 at 05:48:55PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> export via param the phy_addr and the phy_id detected
>
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
> Hi,
>
> this is need to fix the calao board support since the introduction of
> the gigabit phy detection support
Can you explain what this has to do with gigabit support?
Sascha
>
> Best Regards,
> J.
> drivers/net/miidev.c | 76 ++++++++++++++++++++++++++++++++++++++++++++++----
> include/miidev.h | 2 ++
> 2 files changed, 72 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/miidev.c b/drivers/net/miidev.c
> index b49944b..ab1811d 100644
> --- a/drivers/net/miidev.c
> +++ b/drivers/net/miidev.c
> @@ -236,18 +236,82 @@ static struct file_operations miidev_ops = {
> .lseek = dev_lseek_default,
> };
>
> +static int get_phy_id(struct mii_device *mdev, int phy_addr,
> + uint32_t *phy_id)
> +{
> + int val;
> +
> + val = mii_read(mdev, phy_addr, MII_PHYSID1);
> + if (val < 0)
> + return -EIO;
> + *phy_id = (val & 0xffff) << 16;
> + val = mii_read(mdev, phy_addr, MII_PHYSID2);
> + if (val < 0)
> + return -EIO;
> + *phy_id |= (val & 0xffff);
> +
> + return 0;
> +}
> +
> +static int phy_detect_one(struct mii_device *mdev, int phy_addr,
> + uint32_t *phy_id)
> +{
> + uint32_t _phy_id;
> + int ret;
> +
> + ret = get_phy_id(mdev, phy_addr, &_phy_id);
> +
> + if (ret)
> + return ret;
> +
> + /* If the phy_id is mostly Fs, there is no device there */
> + if ((_phy_id & 0x1fffffff) == 0x1fffffff)
> + return -EIO;
> +
> + *phy_id = _phy_id;
> +
> + return 0;
> +}
> +
> +static int phy_detect(struct mii_device *mdev)
> +{
> + int phy_addr;
> +
> + for (phy_addr = 0; phy_addr <= 0x1f; phy_addr++) {
> + if (!phy_detect_one(mdev, phy_addr, &mdev->phy_id))
> + return phy_addr;
> + }
> +
> + return -EIO;
> +}
> +
> static int miidev_probe(struct device_d *dev)
> {
> struct mii_device *mdev = dev->priv;
> int val;
> int caps = 0;
> + char str[11];
> +
> + if (mdev->address < 0) {
> + int phy_addr;
> +
> + phy_addr = phy_detect(mdev);
> +
> + if (phy_addr < 0) {
> + dev_err(dev, "cannot detect PHY\n");
> + return -ENODEV;
> + }
> + mdev->address = phy_addr;
> + } else {
> + if (phy_detect_one(mdev, mdev->address, &mdev->phy_id) < 0)
> + goto err_out;
> + }
> +
> + sprintf(str, "%u", mdev->address);
> + dev_add_param_fixed(dev, "phy_addr", str);
> + sprintf(str, "0x%08x", mdev->phy_id);
> + dev_add_param_fixed(dev, "phy_id", str);
>
> - val = mii_read(mdev, mdev->address, MII_PHYSID1);
> - if (val < 0 || val == 0xffff)
> - goto err_out;
> - val = mii_read(mdev, mdev->address, MII_PHYSID2);
> - if (val < 0 || val == 0xffff)
> - goto err_out;
> val = mii_read(mdev, mdev->address, MII_BMSR);
> if (val < 0)
> goto err_out;
> diff --git a/include/miidev.h b/include/miidev.h
> index 4bbf94c..2f39234 100644
> --- a/include/miidev.h
> +++ b/include/miidev.h
> @@ -38,6 +38,8 @@ struct mii_device {
> struct device_d *parent;
>
> int address; /* The address the phy has on the bus */
> + uint32_t phy_id; /* The phy id */
> +
> int (*read) (struct mii_device *dev, int addr, int reg);
> int (*write) (struct mii_device *dev, int addr, int reg, int value);
>
> --
> 1.7.10.4
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
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] 14+ messages in thread
* Re: [for master PATCH 1/2] miidev: add phy_addr detection support
2012-08-14 19:58 ` [for master PATCH 1/2] miidev: add phy_addr detection support Sascha Hauer
@ 2012-08-15 4:32 ` Jean-Christophe PLAGNIOL-VILLARD
2012-08-29 7:09 ` Sascha Hauer
0 siblings, 1 reply; 14+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-08-15 4:32 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox
On 21:58 Tue 14 Aug , Sascha Hauer wrote:
> On Tue, Aug 14, 2012 at 05:48:55PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > export via param the phy_addr and the phy_id detected
> >
> > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > ---
> > Hi,
> >
> > this is need to fix the calao board support since the introduction of
> > the gigabit phy detection support
>
> Can you explain what this has to do with gigabit support?
before we do not check the error on the phy detection
now we do and do not register the miidev if we can not detect it
Best Regards,
J.
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [for master PATCH 1/2] miidev: add phy_addr detection support
2012-08-15 4:32 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2012-08-29 7:09 ` Sascha Hauer
0 siblings, 0 replies; 14+ messages in thread
From: Sascha Hauer @ 2012-08-29 7:09 UTC (permalink / raw)
To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox
On Wed, Aug 15, 2012 at 06:32:49AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 21:58 Tue 14 Aug , Sascha Hauer wrote:
> > On Tue, Aug 14, 2012 at 05:48:55PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > export via param the phy_addr and the phy_id detected
> > >
> > > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > > ---
> > > Hi,
> > >
> > > this is need to fix the calao board support since the introduction of
> > > the gigabit phy detection support
> >
> > Can you explain what this has to do with gigabit support?
> before we do not check the error on the phy detection
>
> now we do and do not register the miidev if we can not detect it
Anyway, I won't introduce a new feature into master. If you want to have
it there, find another solution.
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] 14+ messages in thread
* Re: [for master PATCH 1/2] miidev: add phy_addr detection support
2012-08-14 15:48 [for master PATCH 1/2] miidev: add phy_addr detection support Jean-Christophe PLAGNIOL-VILLARD
2012-08-14 15:48 ` [for master PATCH 2/2] calao: at91 qil/tny/usb auto detect the phy addr Jean-Christophe PLAGNIOL-VILLARD
2012-08-14 19:58 ` [for master PATCH 1/2] miidev: add phy_addr detection support Sascha Hauer
@ 2012-09-10 15:19 ` Jean-Christophe PLAGNIOL-VILLARD
2012-09-11 7:53 ` Sascha Hauer
2012-10-02 13:23 ` Sascha Hauer
3 siblings, 1 reply; 14+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-09-10 15:19 UTC (permalink / raw)
To: barebox
On 17:48 Tue 14 Aug , Jean-Christophe PLAGNIOL-VILLARD wrote:
> export via param the phy_addr and the phy_id detected
>
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
> Hi,
>
> this is need to fix the calao board support since the introduction of
> the gigabit phy detection support
can we have this as the phylib will not make it for this release
Best Regards,
J.
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [for master PATCH 1/2] miidev: add phy_addr detection support
2012-09-10 15:19 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2012-09-11 7:53 ` Sascha Hauer
2012-09-11 8:57 ` Jean-Christophe PLAGNIOL-VILLARD
0 siblings, 1 reply; 14+ messages in thread
From: Sascha Hauer @ 2012-09-11 7:53 UTC (permalink / raw)
To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox
On Mon, Sep 10, 2012 at 05:19:00PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 17:48 Tue 14 Aug , Jean-Christophe PLAGNIOL-VILLARD wrote:
> > export via param the phy_addr and the phy_id detected
> >
> > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > ---
> > Hi,
> >
> > this is need to fix the calao board support since the introduction of
> > the gigabit phy detection support
>
> can we have this as the phylib will not make it for this release
As said to Eric in the other thread, I intend to apply:
[PATCH 3/3] miidev: fix 1G wrong detection
This should fix your problem here aswell, right?
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] 14+ messages in thread
* Re: [for master PATCH 1/2] miidev: add phy_addr detection support
2012-09-11 7:53 ` Sascha Hauer
@ 2012-09-11 8:57 ` Jean-Christophe PLAGNIOL-VILLARD
2012-09-11 9:14 ` Sascha Hauer
0 siblings, 1 reply; 14+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-09-11 8:57 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox
On 09:53 Tue 11 Sep , Sascha Hauer wrote:
> On Mon, Sep 10, 2012 at 05:19:00PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > On 17:48 Tue 14 Aug , Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > export via param the phy_addr and the phy_id detected
> > >
> > > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > > ---
> > > Hi,
> > >
> > > this is need to fix the calao board support since the introduction of
> > > the gigabit phy detection support
> >
> > can we have this as the phylib will not make it for this release
>
> As said to Eric in the other thread, I intend to apply:
>
> [PATCH 3/3] miidev: fix 1G wrong detection
>
> This should fix your problem here aswell, right?
no I need the phy_addr auto detected
Best Regards,
J.
>
> 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] 14+ messages in thread
* Re: [for master PATCH 1/2] miidev: add phy_addr detection support
2012-09-11 8:57 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2012-09-11 9:14 ` Sascha Hauer
2012-09-11 9:25 ` Jean-Christophe PLAGNIOL-VILLARD
0 siblings, 1 reply; 14+ messages in thread
From: Sascha Hauer @ 2012-09-11 9:14 UTC (permalink / raw)
To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox
On Tue, Sep 11, 2012 at 10:57:21AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 09:53 Tue 11 Sep , Sascha Hauer wrote:
> > On Mon, Sep 10, 2012 at 05:19:00PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > On 17:48 Tue 14 Aug , Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > > export via param the phy_addr and the phy_id detected
> > > >
> > > > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > > > ---
> > > > Hi,
> > > >
> > > > this is need to fix the calao board support since the introduction of
> > > > the gigabit phy detection support
> > >
> > > can we have this as the phylib will not make it for this release
> >
> > As said to Eric in the other thread, I intend to apply:
> >
> > [PATCH 3/3] miidev: fix 1G wrong detection
> >
> > This should fix your problem here aswell, right?
> no I need the phy_addr auto detected
Ok, but I still do not understand the following sentence from the commit
message:
this is need to fix the calao board support since the introduction of
the gigabit phy detection support
Hey, wait, you probably do not mean gigabit support, but the following
patch:
| commit 1b725b9c443cd80ab4f5876a1e2c8443a24472ef
| Author: Johannes Stezenbach <js@sig21.net>
| Date: Mon Jun 18 16:47:56 2012 +0200
|
| miidev: actually probe the PHY
|
| Check if the PHY is really accessible (e.g. the
| PHY address is correct) during probe.
|
| Signed-off-by: Johannes Stezenbach <js@sig21.net>
| Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
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] 14+ messages in thread
* Re: [for master PATCH 1/2] miidev: add phy_addr detection support
2012-09-11 9:14 ` Sascha Hauer
@ 2012-09-11 9:25 ` Jean-Christophe PLAGNIOL-VILLARD
0 siblings, 0 replies; 14+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-09-11 9:25 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox
On 11:14 Tue 11 Sep , Sascha Hauer wrote:
> On Tue, Sep 11, 2012 at 10:57:21AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > On 09:53 Tue 11 Sep , Sascha Hauer wrote:
> > > On Mon, Sep 10, 2012 at 05:19:00PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > > On 17:48 Tue 14 Aug , Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > > > export via param the phy_addr and the phy_id detected
> > > > >
> > > > > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > > > > ---
> > > > > Hi,
> > > > >
> > > > > this is need to fix the calao board support since the introduction of
> > > > > the gigabit phy detection support
> > > >
> > > > can we have this as the phylib will not make it for this release
> > >
> > > As said to Eric in the other thread, I intend to apply:
> > >
> > > [PATCH 3/3] miidev: fix 1G wrong detection
> > >
> > > This should fix your problem here aswell, right?
> > no I need the phy_addr auto detected
>
> Ok, but I still do not understand the following sentence from the commit
> message:
>
> this is need to fix the calao board support since the introduction of
> the gigabit phy detection support
>
> Hey, wait, you probably do not mean gigabit support, but the following
> patch:
>
> | commit 1b725b9c443cd80ab4f5876a1e2c8443a24472ef
> | Author: Johannes Stezenbach <js@sig21.net>
> | Date: Mon Jun 18 16:47:56 2012 +0200
> |
> | miidev: actually probe the PHY
> |
> | Check if the PHY is really accessible (e.g. the
> | PHY address is correct) during probe.
> |
> | Signed-off-by: Johannes Stezenbach <js@sig21.net>
> | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
>
yes
Best Regards,
J.
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [for master PATCH 1/2] miidev: add phy_addr detection support
2012-08-14 15:48 [for master PATCH 1/2] miidev: add phy_addr detection support Jean-Christophe PLAGNIOL-VILLARD
` (2 preceding siblings ...)
2012-09-10 15:19 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2012-10-02 13:23 ` Sascha Hauer
2012-10-02 14:25 ` Jean-Christophe PLAGNIOL-VILLARD
3 siblings, 1 reply; 14+ messages in thread
From: Sascha Hauer @ 2012-10-02 13:23 UTC (permalink / raw)
To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox
Hi J,
Can you revamp this on current master? Without the detection part if a
phy address is given, thus introducing no change when phy address is > 0.
Thanks
Sascha
On Tue, Aug 14, 2012 at 05:48:55PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> export via param the phy_addr and the phy_id detected
>
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
> Hi,
>
> this is need to fix the calao board support since the introduction of
> the gigabit phy detection support
>
> Best Regards,
> J.
> drivers/net/miidev.c | 76 ++++++++++++++++++++++++++++++++++++++++++++++----
> include/miidev.h | 2 ++
> 2 files changed, 72 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/miidev.c b/drivers/net/miidev.c
> index b49944b..ab1811d 100644
> --- a/drivers/net/miidev.c
> +++ b/drivers/net/miidev.c
> @@ -236,18 +236,82 @@ static struct file_operations miidev_ops = {
> .lseek = dev_lseek_default,
> };
>
> +static int get_phy_id(struct mii_device *mdev, int phy_addr,
> + uint32_t *phy_id)
> +{
> + int val;
> +
> + val = mii_read(mdev, phy_addr, MII_PHYSID1);
> + if (val < 0)
> + return -EIO;
> + *phy_id = (val & 0xffff) << 16;
> + val = mii_read(mdev, phy_addr, MII_PHYSID2);
> + if (val < 0)
> + return -EIO;
> + *phy_id |= (val & 0xffff);
> +
> + return 0;
> +}
> +
> +static int phy_detect_one(struct mii_device *mdev, int phy_addr,
> + uint32_t *phy_id)
> +{
> + uint32_t _phy_id;
> + int ret;
> +
> + ret = get_phy_id(mdev, phy_addr, &_phy_id);
> +
> + if (ret)
> + return ret;
> +
> + /* If the phy_id is mostly Fs, there is no device there */
> + if ((_phy_id & 0x1fffffff) == 0x1fffffff)
> + return -EIO;
> +
> + *phy_id = _phy_id;
> +
> + return 0;
> +}
> +
> +static int phy_detect(struct mii_device *mdev)
> +{
> + int phy_addr;
> +
> + for (phy_addr = 0; phy_addr <= 0x1f; phy_addr++) {
> + if (!phy_detect_one(mdev, phy_addr, &mdev->phy_id))
> + return phy_addr;
> + }
> +
> + return -EIO;
> +}
> +
> static int miidev_probe(struct device_d *dev)
> {
> struct mii_device *mdev = dev->priv;
> int val;
> int caps = 0;
> + char str[11];
> +
> + if (mdev->address < 0) {
> + int phy_addr;
> +
> + phy_addr = phy_detect(mdev);
> +
> + if (phy_addr < 0) {
> + dev_err(dev, "cannot detect PHY\n");
> + return -ENODEV;
> + }
> + mdev->address = phy_addr;
> + } else {
> + if (phy_detect_one(mdev, mdev->address, &mdev->phy_id) < 0)
> + goto err_out;
> + }
> +
> + sprintf(str, "%u", mdev->address);
> + dev_add_param_fixed(dev, "phy_addr", str);
> + sprintf(str, "0x%08x", mdev->phy_id);
> + dev_add_param_fixed(dev, "phy_id", str);
>
> - val = mii_read(mdev, mdev->address, MII_PHYSID1);
> - if (val < 0 || val == 0xffff)
> - goto err_out;
> - val = mii_read(mdev, mdev->address, MII_PHYSID2);
> - if (val < 0 || val == 0xffff)
> - goto err_out;
> val = mii_read(mdev, mdev->address, MII_BMSR);
> if (val < 0)
> goto err_out;
> diff --git a/include/miidev.h b/include/miidev.h
> index 4bbf94c..2f39234 100644
> --- a/include/miidev.h
> +++ b/include/miidev.h
> @@ -38,6 +38,8 @@ struct mii_device {
> struct device_d *parent;
>
> int address; /* The address the phy has on the bus */
> + uint32_t phy_id; /* The phy id */
> +
> int (*read) (struct mii_device *dev, int addr, int reg);
> int (*write) (struct mii_device *dev, int addr, int reg, int value);
>
> --
> 1.7.10.4
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
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] 14+ messages in thread
* Re: [for master PATCH 1/2] miidev: add phy_addr detection support
2012-10-02 13:23 ` Sascha Hauer
@ 2012-10-02 14:25 ` Jean-Christophe PLAGNIOL-VILLARD
0 siblings, 0 replies; 14+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-10-02 14:25 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox
On 15:23 Tue 02 Oct , Sascha Hauer wrote:
> Hi J,
>
> Can you revamp this on current master? Without the detection part if a
> phy address is given, thus introducing no change when phy address is > 0.
on the master this patch is not usefull as you apply Eric fix
Best Regards,
J.
> Thanks
> Sascha
>
> On Tue, Aug 14, 2012 at 05:48:55PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > export via param the phy_addr and the phy_id detected
> >
> > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > ---
> > Hi,
> >
> > this is need to fix the calao board support since the introduction of
> > the gigabit phy detection support
> >
> > Best Regards,
> > J.
> > drivers/net/miidev.c | 76 ++++++++++++++++++++++++++++++++++++++++++++++----
> > include/miidev.h | 2 ++
> > 2 files changed, 72 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/net/miidev.c b/drivers/net/miidev.c
> > index b49944b..ab1811d 100644
> > --- a/drivers/net/miidev.c
> > +++ b/drivers/net/miidev.c
> > @@ -236,18 +236,82 @@ static struct file_operations miidev_ops = {
> > .lseek = dev_lseek_default,
> > };
> >
> > +static int get_phy_id(struct mii_device *mdev, int phy_addr,
> > + uint32_t *phy_id)
> > +{
> > + int val;
> > +
> > + val = mii_read(mdev, phy_addr, MII_PHYSID1);
> > + if (val < 0)
> > + return -EIO;
> > + *phy_id = (val & 0xffff) << 16;
> > + val = mii_read(mdev, phy_addr, MII_PHYSID2);
> > + if (val < 0)
> > + return -EIO;
> > + *phy_id |= (val & 0xffff);
> > +
> > + return 0;
> > +}
> > +
> > +static int phy_detect_one(struct mii_device *mdev, int phy_addr,
> > + uint32_t *phy_id)
> > +{
> > + uint32_t _phy_id;
> > + int ret;
> > +
> > + ret = get_phy_id(mdev, phy_addr, &_phy_id);
> > +
> > + if (ret)
> > + return ret;
> > +
> > + /* If the phy_id is mostly Fs, there is no device there */
> > + if ((_phy_id & 0x1fffffff) == 0x1fffffff)
> > + return -EIO;
> > +
> > + *phy_id = _phy_id;
> > +
> > + return 0;
> > +}
> > +
> > +static int phy_detect(struct mii_device *mdev)
> > +{
> > + int phy_addr;
> > +
> > + for (phy_addr = 0; phy_addr <= 0x1f; phy_addr++) {
> > + if (!phy_detect_one(mdev, phy_addr, &mdev->phy_id))
> > + return phy_addr;
> > + }
> > +
> > + return -EIO;
> > +}
> > +
> > static int miidev_probe(struct device_d *dev)
> > {
> > struct mii_device *mdev = dev->priv;
> > int val;
> > int caps = 0;
> > + char str[11];
> > +
> > + if (mdev->address < 0) {
> > + int phy_addr;
> > +
> > + phy_addr = phy_detect(mdev);
> > +
> > + if (phy_addr < 0) {
> > + dev_err(dev, "cannot detect PHY\n");
> > + return -ENODEV;
> > + }
> > + mdev->address = phy_addr;
> > + } else {
> > + if (phy_detect_one(mdev, mdev->address, &mdev->phy_id) < 0)
> > + goto err_out;
> > + }
> > +
> > + sprintf(str, "%u", mdev->address);
> > + dev_add_param_fixed(dev, "phy_addr", str);
> > + sprintf(str, "0x%08x", mdev->phy_id);
> > + dev_add_param_fixed(dev, "phy_id", str);
> >
> > - val = mii_read(mdev, mdev->address, MII_PHYSID1);
> > - if (val < 0 || val == 0xffff)
> > - goto err_out;
> > - val = mii_read(mdev, mdev->address, MII_PHYSID2);
> > - if (val < 0 || val == 0xffff)
> > - goto err_out;
> > val = mii_read(mdev, mdev->address, MII_BMSR);
> > if (val < 0)
> > goto err_out;
> > diff --git a/include/miidev.h b/include/miidev.h
> > index 4bbf94c..2f39234 100644
> > --- a/include/miidev.h
> > +++ b/include/miidev.h
> > @@ -38,6 +38,8 @@ struct mii_device {
> > struct device_d *parent;
> >
> > int address; /* The address the phy has on the bus */
> > + uint32_t phy_id; /* The phy id */
> > +
> > int (*read) (struct mii_device *dev, int addr, int reg);
> > int (*write) (struct mii_device *dev, int addr, int reg, int value);
> >
> > --
> > 1.7.10.4
> >
> >
> > _______________________________________________
> > barebox mailing list
> > barebox@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/barebox
> >
>
> --
> 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] 14+ messages in thread