netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: Angelo Dureghello <angelo70@gmail.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: Fwd: micrel: ksz8051 badly detected as ksz8031
Date: Tue, 14 Oct 2014 13:56:28 -0700	[thread overview]
Message-ID: <543D8DFC.7010308@gmail.com> (raw)
In-Reply-To: <543D7A84.4030202@gmail.com>

On 10/14/2014 12:33 PM, Angelo Dureghello wrote:
> Hi Florian,
> 
>> On 10/14/2014 10:24 AM, Angelo Dureghello wrote:
>>> Dear,
>>>
>>> have to apologize for the confusion, previous patch is not the proper
>>> fix,
>>> since it is not solving completely the issue.
>>>
>>> And also, i mainly misunderstood the issue.
>>>
>>> The issue i am experiencing is :
>>>
>>> https://lkml.org/lkml/2013/9/18/259
>>>
>>> Mainly, i have Micrel chip marked KSZ8051(RNL), but the product Id in
>>> the
>>> silicon is KSZ8031 and linux detects it as KSZ8031.
>>> The attmept to mdio boot override register kill the Micrel
>>> functionality.
>> Ok, so basically your bootloader does something that Linux does, and
>> once Linux boots, it will reset the PHY to put it in a known state. If
>> you can snoop the MDIO read/writes done in your bootloader environment,
>> that might help narrow down the issue.
>>
> Bootloader is u-boot and seems it uses generic PHY setup, and so it works.
> 
> Linux at boot detects the phy and does a soft_reset. If the detection
> sets the
> driver as for KSZ8031, ethernet/link will not work, becouse micrel.c uses
> the incorrect config_init function, attempts to write to the bootstrap
> override register, that can't be written for KSZ8051, and so puts the
> micrel
> chip in a broken state.
> 
> The guy in this link (https://lkml.org/lkml/2013/9/18/259) seems are
> discussing a
> better solution.
> 
> I patched my linux as below, but this is a fast fixup for me:

You could register a PHY fixup in your board code that does exactly what
you are you doing here, except that you would match 0x00221556,
something along those lines:

static int micrel_ipam390_phy_fixup(struct phy_device *dev)
{
       if (dev->phy_id == 0x00221556)
		dev->phy_id = 0x00221550;

        return 0;
}

int __init micrel_ipam390_phy_fixup_register(void)
{
        return phy_register_fixup_for_id(PHY_ANY_ID, micrel_ipam390);
}

> 
> diff -rupN drivers/net/phy/phy_device.c
> ../linux-3.17/drivers/net/phy/phy_device.c
> --- drivers/net/phy/phy_device.c        2014-10-14 21:05:56.191117190 +0200
> +++ ../linux-3.17/drivers/net/phy/phy_device.c  2014-10-05
> 21:23:04.000000000 +0200
> @@ -310,19 +310,6 @@ static int get_phy_id(struct mii_bus *bu
> 
>         *phy_id |= (phy_reg & 0xffff);
> 
> -       /*
> -        * Angelo - Barix
> -        * Micrel produced chips marked KSZ8051 but with KSZ8031 id code
> -        * in the silicon. After getting crazy to understand why in
> recent kernel
> -        * the ethenret was not workeing, i find it out.
> -        *
> -        * From the schematic, we assume to use KSZ8051
> -        * I hardcode the fix here for ipam390.
> -        */
> -#if CONFIG_MACH_BARIX_IPAM390
> -       if (*phy_id == 0x00221556) *phy_id = 0x00221550;
> -#endif
> -
>         return 0;
>  }
> 
> Regards
> angelo
> 

      reply	other threads:[~2014-10-14 20:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-12 12:55 micrel: ksz8051 badly detected as ksz8031 Angelo Dureghello
2014-10-13 11:23 ` Fwd: " Angelo Dureghello
2014-10-13 19:34   ` Angelo Dureghello
2014-10-14 17:24     ` Angelo Dureghello
2014-10-14 19:09       ` Florian Fainelli
2014-10-14 19:33         ` Angelo Dureghello
2014-10-14 20:56           ` Florian Fainelli [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=543D8DFC.7010308@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=angelo70@gmail.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).