All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mason <slash.tmp@free.fr>
To: Florian Fainelli <f.fainelli@gmail.com>, netdev@vger.kernel.org
Cc: Mugunthan <mugunthanvnm@ti.com>, "David S. Miller" <davem@davemloft.net>
Subject: Re: Atheros 8035 PHY only works when at803x_config_init() is commented out
Date: Wed, 08 Apr 2015 23:37:57 +0200	[thread overview]
Message-ID: <55259FB5.50109@free.fr> (raw)
In-Reply-To: <5525658D.7000709@gmail.com>

On 08/04/2015 19:29, Florian Fainelli wrote:
> On 08/04/15 09:28, Mason wrote:
>> Hello everyone,
>>
>> I have a weird problem, that I've only started investigating, and I'd be
>> grateful if anyone can help me along.
>>
>> I have an ARM-based SoC that provides (AFAIU) an Atheros 8035 PHY.
>>
>> If I enable the driver in my kernel (CONFIG_AT803X_PHY) then something
>> goes wrong, and the system cannot load the nfsroot. Bizarrely, DHCP
>> seems to work (so there is limited connectivity) but then the NFS
>> server just times out.
>>
>> However, if I just comment this line:
>>     //.config_init = at803x_config_init,
>> in at803x_driver[0]
>> then everything seems to work. (At least, the system sets the PHY
>> to Gbit, and manages to download the nfsroot.)
>>
>> If I'm reading the code right (big "if"), when config_init is NULL,
>> then phy_init_hw() turns into a NOP?
>>
>> So either at803x_config_init() or something called from phy_init_hw()
>> seems to be hosing this system's networking?
>>
>> Sprinkling printk over phy_init_hw shows no errors (no premature exit)
>> and phydev->drv->config_init(phydev) returns 0.
>>
>> Maybe I didn't set something up correctly, and phy_write() is scribbling
>> over the wrong register?
>>
>> Does anyone see something I missed?
> 
> So one possibility could be that the bootloader initializes the PHY in a
> certain way, typically by applying workarounds, and your config_init()
> callback is not restoring any of theses, which is why, after
> phy_init_hw(), which does a software reset of the PHY, all of these
> workarounds are wiped out, and your PHY behaves funky.
> 
> The reason why config_init() needs to put the PHY back into a fully
> functional state is because the PHY library should be able to software
> reset the PHY when it needs to, but also be able to deal with deep sleep
> modes etc.. where the PHY could loose its settings, yet the kernel
> should be able to bring you back in a good state.
> 
> An easy way to bypass that is to provide a soft_reset calback which does
> nothing, and see if calling either at803x_config_init(), or
> genphy_config_init() is sufficient to preserve the PHY settings.
> Although the real solution is to look at what the bootloader does on
> that front and replicate it in the config_init() callback.
> 
> Hope this helps.

Thanks for the insight. I hadn't considered the bootloader's role.

One thing I forgot to mention is that I'm using an old kernel 3.14
and it doesn't seem to have the soft_reset function pointer.

http://lxr.free-electrons.com/source/drivers/net/phy/phy_device.c?v=3.14#L535

phy_init_hw() just calls phy_write(phydev, MII_BMCR, BMCR_RESET)
and then phy_poll_reset(phydev) -- the equivalent of today's
genphy_soft_reset().

Anyway, I will look more closely at the points you mentioned.

Thanks again.

Regards.

  reply	other threads:[~2015-04-08 21:38 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-08 16:28 Atheros 8035 PHY only works when at803x_config_init() is commented out Mason
2015-04-08 17:29 ` Florian Fainelli
2015-04-08 21:37   ` Mason [this message]
2015-04-09 11:44   ` Mason
2015-04-09 13:15     ` Mason
2015-04-09 13:36     ` Daniel Mack
2015-04-09 14:38       ` Mason
2015-04-09 15:22         ` Mason
2015-04-09 15:32           ` Daniel Mack
2015-04-09 15:58             ` Mason
2015-04-09 17:25           ` Florian Fainelli
2015-04-09 18:52             ` Mason
2015-04-09 19:00               ` Florian Fainelli
2015-04-09 19:30                 ` Mason
2015-04-09 20:26                   ` Florian Fainelli
2015-04-09 22:10                     ` Mason
2015-04-09 22:30                       ` Florian Fainelli
2015-04-09 22:31                   ` Fabio Estevam
2015-04-10 10:27                     ` Fabio Estevam
2015-04-10 15:04                       ` Mason
2015-04-10  9:33                   ` Daniel Mack
2015-04-10 10:01                     ` Mason
2015-04-10 10:21                       ` Daniel Mack
2015-04-09 19:05       ` Mason

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=55259FB5.50109@free.fr \
    --to=slash.tmp@free.fr \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=mugunthanvnm@ti.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.