From: Michael Walle <michael@walle.cc>
To: Andrew Lunn <andrew@lunn.ch>
Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org,
netdev@vger.kernel.org, Jean Delvare <jdelvare@suse.com>,
Guenter Roeck <linux@roeck-us.net>,
Florian Fainelli <f.fainelli@gmail.com>,
Heiner Kallweit <hkallweit1@gmail.com>,
Russell King <linux@armlinux.org.uk>,
"David S . Miller" <davem@davemloft.net>
Subject: Re: [PATCH net-next v2 2/3] net: phy: add Broadcom BCM54140 support
Date: Sun, 19 Apr 2020 18:33:40 +0200 [thread overview]
Message-ID: <d40eafc5ed95b62886e10159dcb7a509@walle.cc> (raw)
In-Reply-To: <20200419154943.GJ836632@lunn.ch>
Am 2020-04-19 17:49, schrieb Andrew Lunn:
> On Sun, Apr 19, 2020 at 12:12:48PM +0200, Michael Walle wrote:
>
> Hi Michael
>
>> +static int bcm54140_b0_workaround(struct phy_device *phydev)
>> +{
>> + int spare3;
>> + int ret;
>
> Could you add a comment about what this is working around?
sure
>
>> +static int bcm54140_phy_probe(struct phy_device *phydev)
>> +{
>> + struct bcm54140_phy_priv *priv;
>> + int ret;
>> +
>> + priv = devm_kzalloc(&phydev->mdio.dev, sizeof(*priv), GFP_KERNEL);
>> + if (!priv)
>> + return -ENOMEM;
>> +
>> + phydev->priv = priv;
>> +
>> + ret = bcm54140_get_base_addr_and_port(phydev);
>> + if (ret)
>> + return ret;
>> +
>> + dev_info(&phydev->mdio.dev,
>> + "probed (port %d, base PHY address %d)\n",
>> + priv->port, priv->base_addr);
>
> phydev_dbg() ? Do we need to see this message four times?
ok. every phy will have a different port. And keep in mind,
that you might have less than four ports/PHYs here. So I'd
like to keep that as a phydev_dbg() if you agree.
>
>> +
>> + return 0;
>> +}
>> +
>> +static int bcm54140_config_init(struct phy_device *phydev)
>> +{
>> + u16 reg = 0xffff;
>> + int ret;
>> +
>> + /* Apply hardware errata */
>> + ret = bcm54140_b0_workaround(phydev);
>> + if (ret)
>> + return ret;
>> +
>> + /* Unmask events we are interested in. */
>> + reg &= ~(BCM54140_RDB_INT_DUPLEX |
>> + BCM54140_RDB_INT_SPEED |
>> + BCM54140_RDB_INT_LINK);
>> + ret = bcm_phy_write_rdb(phydev, BCM54140_RDB_IMR, reg);
>> + if (ret)
>> + return ret;
>> +
>> + /* LED1=LINKSPD[1], LED2=LINKSPD[2], LED3=ACTIVITY */
>> + ret = bcm_phy_modify_rdb(phydev, BCM54140_RDB_SPARE1,
>> + 0, BCM54140_RDB_SPARE1_LSLM);
>> + if (ret)
>> + return ret;
>
> What are the reset default for LEDs? Can the LEDs be configured via
> strapping pins? There is currently no good solution for this. Whatever
> you pick will be wrong for somebody else. At minimum, strapping pins,
> if they exist, should not be overridden.
Fair enough. There are no strapping options, just the "default
behaviour",
where LED1/2 indicates the speed, and LED3 just activity (no link
indication). And I just noticed that in this case the comment above is
wrong, because it is actually link/activity. Further, there are myriad
configuration options which I didn't want to encode altogether. So I've
just chosen the typical one (which actually matches our hardware), ie.
to have the "activity/led mode". The application note mentions some
other
concrete modes, but I don't know if its worth implementing them. Maybe
we
can have a enumeration of some distinct modes? Ie.
broadcom,led-mode = <BCM54140_NO_CHANGE>;
broadcom,led-mode = <BCM54140_ACT_LINK_MODE>;
-michael
next prev parent reply other threads:[~2020-04-19 16:33 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-19 10:12 [PATCH net-next v2 1/3] net: phy: broadcom: add helper to write/read RDB registers Michael Walle
2020-04-19 10:12 ` [PATCH net-next v2 2/3] net: phy: add Broadcom BCM54140 support Michael Walle
2020-04-19 15:49 ` Andrew Lunn
2020-04-19 16:33 ` Michael Walle [this message]
2020-04-19 16:49 ` Andrew Lunn
2020-04-19 16:56 ` Michael Walle
2020-04-19 10:12 ` [PATCH net-next v2 3/3] net: phy: bcm54140: add hwmon support Michael Walle
2020-04-19 15:56 ` Andrew Lunn
2020-04-19 16:51 ` Michael Walle
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=d40eafc5ed95b62886e10159dcb7a509@walle.cc \
--to=michael@walle.cc \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=hkallweit1@gmail.com \
--cc=jdelvare@suse.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=linux@roeck-us.net \
--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).