From: jbrunet@baylibre.com (Jerome Brunet)
To: linus-amlogic@lists.infradead.org
Subject: [PATCH net-next] net: phy: meson-gxl: cleanup by defining the control registers
Date: Tue, 05 Dec 2017 16:57:10 +0100 [thread overview]
Message-ID: <1512489430.21892.3.camel@baylibre.com> (raw)
In-Reply-To: <970919cd-cf0f-1782-22b8-46746a92fc43@amlogic.com>
On Tue, 2017-12-05 at 23:23 +0800, Yixun Lan wrote:
> > +static inline int meson_gxl_write_reg(struct phy_device *phydev,
> > + unsigned int bank, unsigned int reg,
> > + uint16_t value)
> > +{
> > + int ret;
> > +
> > + /* Enable Analog and DSP register Bank access by
> > + * toggling TSTCNTL_TEST_MODE bit in the TSTCNTL register
> > + */
> > + ret = phy_write(phydev, TSTCNTL, 0);
> > + if (ret)
> > + goto out;
> > + ret = phy_write(phydev, TSTCNTL, TSTCNTL_TEST_MODE);
> > + if (ret)
> > + goto out;
> > + ret = phy_write(phydev, TSTCNTL, 0);
> > + if (ret)
> > + goto out;
> > + ret = phy_write(phydev, TSTCNTL, TSTCNTL_TEST_MODE);
> > + if (ret)
> > + goto out;
> > +
>
> how about just do the above enable procedure once?
> from the datasheet, the access won't be disabled if don't reset, or
> write to register TSTCNTL with TEST_MODE=0
It just seems more clean. This is way, the write function is self sufficient and
we can use it w/o making assumption about what happened out of it.
next prev parent reply other threads:[~2017-12-05 15:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-05 9:33 [PATCH net-next] net: phy: meson-gxl: cleanup by defining the control registers Jerome Brunet
2017-12-05 15:23 ` Yixun Lan
2017-12-05 15:57 ` Jerome Brunet [this message]
2017-12-05 18:01 ` Andrew Lunn
2017-12-05 18:47 ` Jerome Brunet
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=1512489430.21892.3.camel@baylibre.com \
--to=jbrunet@baylibre.com \
--cc=linus-amlogic@lists.infradead.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).