lkml.org 
[lkml]   [2017]   [Dec]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH net-next] net: phy: meson-gxl: cleanup by defining the control registers
From
Date
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.



\
 
 \ /
  Last update: 2017-12-05 16:58    [W:0.932 / U:0.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site