From: Chunfeng Yun <chunfeng.yun-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
To: Peter Geis <pgwipeout-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: katsuhiro-WKCMddiH/C4xsqv6Oivclw@public.gmane.org,
linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Robin Murphy <robin.murphy-5wv7dgnIgG8@public.gmane.org>,
Heiko Stuebner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
Subject: Re: [PATCH 1/5] phy: rockchip: add inno-usb3 phy driver
Date: Wed, 30 Oct 2019 10:59:21 +0800 [thread overview]
Message-ID: <1572404361.18464.24.camel@mhfsdcap03> (raw)
In-Reply-To: <CAMdYzYoOQ_C_f2v-3XBid8X0fc6z3Bw0XqRi3CQiwCzRLT-_0g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
On Tue, 2019-10-29 at 11:26 -0400, Peter Geis wrote:
> On Mon, Oct 28, 2019 at 10:12 PM Chunfeng Yun <chunfeng.yun-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> wrote:
> >
> > On Mon, 2019-10-28 at 18:22 +0000, Peter Geis wrote:
> > > Add the rockchip innosilicon usb3 phy driver, supporting devices such as the rk3328.
> > > Pulled from:
> > > https://github.com/FireflyTeam/kernel/blob/roc-rk3328-cc/drivers/phy/rockchip/phy-rockchip-inno-usb3.c
> > >
> > > Signed-off-by: Peter Geis <pgwipeout-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> > > ---
> > > drivers/phy/rockchip/Kconfig | 9 +
> > > drivers/phy/rockchip/Makefile | 1 +
> > > drivers/phy/rockchip/phy-rockchip-inno-usb3.c | 1107 +++++++++++++++++
> > > 3 files changed, 1117 insertions(+)
> > > create mode 100644 drivers/phy/rockchip/phy-rockchip-inno-usb3.c
> > >
...
> > > +static int rk3328_u3phy_pipe_power(struct rockchip_u3phy *u3phy,
> > > + struct rockchip_u3phy_port *u3phy_port,
> > > + bool on)
> > > +{
> > > + unsigned int reg;
> > > +
> > > + if (on) {
> > > + reg = readl(u3phy_port->base + 0x1a8);
> > > + reg &= ~BIT(4); /* ldo power up */
> > > + writel(reg, u3phy_port->base + 0x1a8);
> > > +
> > > + reg = readl(u3phy_port->base + 0x044);
> > > + reg &= ~BIT(4); /* bg power on */
> > > + writel(reg, u3phy_port->base + 0x044);
> > > +
> > > + reg = readl(u3phy_port->base + 0x150);
> > > + reg |= BIT(6); /* tx bias enable */
> > > + writel(reg, u3phy_port->base + 0x150);
> > > +
> > > + reg = readl(u3phy_port->base + 0x080);
> > > + reg &= ~BIT(2); /* tx cm power up */
> > > + writel(reg, u3phy_port->base + 0x080);
> > > +
> > > + reg = readl(u3phy_port->base + 0x0c0);
> > > + /* tx obs enable and rx cm enable */
> > > + reg |= (BIT(3) | BIT(4));
> > > + writel(reg, u3phy_port->base + 0x0c0);
> > > +
> > > + udelay(1);
> > > + } else {
> > > + reg = readl(u3phy_port->base + 0x1a8);
> > > + reg |= BIT(4); /* ldo power down */
> > > + writel(reg, u3phy_port->base + 0x1a8);
> > > +
> > > + reg = readl(u3phy_port->base + 0x044);
> > > + reg |= BIT(4); /* bg power down */
> > > + writel(reg, u3phy_port->base + 0x044);
> > > +
> > > + reg = readl(u3phy_port->base + 0x150);
> > > + reg &= ~BIT(6); /* tx bias disable */
> > > + writel(reg, u3phy_port->base + 0x150);
> > > +
> > > + reg = readl(u3phy_port->base + 0x080);
> > > + reg |= BIT(2); /* tx cm power down */
> > > + writel(reg, u3phy_port->base + 0x080);
> > > +
> > > + reg = readl(u3phy_port->base + 0x0c0);
> > > + /* tx obs disable and rx cm disable */
> > > + reg &= ~(BIT(3) | BIT(4));
> > > + writel(reg, u3phy_port->base + 0x0c0);
> > > + }
> > Try to avoid magic number
>
> Since this was not my driver, I only pulled it in and made the
> necessary changes to get it working, I tried to refrain from
> modifications as much as possible.
> Do you want me to convert these addresses to definitions based on the
> comments in the code?
It's better to follow register names defined in register map doc if you
have
>
> >
> > > +
> > > + return 0;
> > > +}
> > > +
next prev parent reply other threads:[~2019-10-30 2:59 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-28 18:22 [PATCH 0/5] add rk3328 usb3 phy driver Peter Geis
[not found] ` <20191028182254.30739-1-pgwipeout-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-10-28 18:22 ` [PATCH 1/5] phy: rockchip: add inno-usb3 " Peter Geis
[not found] ` <20191028182254.30739-2-pgwipeout-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-10-29 2:11 ` Chunfeng Yun
2019-10-29 15:26 ` Peter Geis
[not found] ` <CAMdYzYoOQ_C_f2v-3XBid8X0fc6z3Bw0XqRi3CQiwCzRLT-_0g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-10-30 2:59 ` Chunfeng Yun [this message]
2019-10-30 17:50 ` Peter Geis
2019-10-30 8:15 ` Heiko Stuebner
2019-10-30 17:46 ` Peter Geis
[not found] ` <CAMdYzYqex=xoXR+Xhg=LNwEa0hobbSghRzj8AkmVOSNhp7x1-A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-10-31 14:02 ` Peter Geis
2019-10-28 18:22 ` [PATCH 2/5] dt-bindings: clean up rockchip grf binding document Peter Geis
[not found] ` <20191028182254.30739-3-pgwipeout-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-10-31 14:25 ` Heiko Stuebner
2019-10-28 18:22 ` [PATCH 3/5] Documentation: bindings: add dt documentation for rockchip usb3 phy Peter Geis
2019-10-28 18:22 ` [PATCH 4/5] arm64: dts: rockchip: add usb3 to rk3328 devicetree Peter Geis
[not found] ` <20191028182254.30739-5-pgwipeout-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-10-29 1:58 ` Chunfeng Yun
2019-10-29 15:31 ` Peter Geis
[not found] ` <CAMdYzYrn+KGH3LSrRXxfessQyzv_319RO+skotTkS7H0VDFC0A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-10-30 2:28 ` Chunfeng Yun
2019-10-30 17:54 ` Peter Geis
2019-10-28 18:22 ` [PATCH 5/5] arm64: dts: rockchip: enable usb3 on rk3328-roc-cc Peter Geis
2019-10-28 18:41 ` [PATCH 0/5] add rk3328 usb3 phy driver Robin Murphy
[not found] ` <5230f80c-9684-72e0-8f96-602428a9e655-5wv7dgnIgG8@public.gmane.org>
2019-10-30 0:17 ` Robin Murphy
[not found] ` <9e5546de-f5b6-7f60-96d0-612249e832ce-5wv7dgnIgG8@public.gmane.org>
2019-10-30 1:15 ` Peter Geis
[not found] ` <CAMdYzYrZhof2DtrNH4+Amu1ZN-6sWw57rC+2joqXSyWVn99wWw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2020-04-23 20:20 ` Peter Geis
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=1572404361.18464.24.camel@mhfsdcap03 \
--to=chunfeng.yun-nus5lvnupcjwk0htik3j/w@public.gmane.org \
--cc=heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org \
--cc=katsuhiro-WKCMddiH/C4xsqv6Oivclw@public.gmane.org \
--cc=linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=pgwipeout-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=robin.murphy-5wv7dgnIgG8@public.gmane.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).