public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Johan Jonker <jbx6244@gmail.com>
To: Kever Yang <kever.yang@rock-chips.com>, frank.wang@rock-chips.com
Cc: Simon Glass <sjg@chromium.org>,
	Philipp Tomsich <philipp.tomsich@vrull.eu>,
	Heiko Stuebner <heiko@sntech.de>,
	mail@david-bauer.net, ldevulder@suse.com,
	Chen-Yu Tsai <wens@csie.org>,
	banglang.huang@foxmail.com,
	"Matwey V. Kornilov" <matwey.kornilov@gmail.com>,
	U-Boot-Denx <u-boot@lists.denx.de>
Subject: Re: [RFC PATCH v1] phy: rockchip: add basic rk3328 support to phy-rockchip-inno-usb2.c
Date: Wed, 11 Aug 2021 13:24:41 +0200	[thread overview]
Message-ID: <e8b2cb94-3644-1ba8-e996-7ee1627da46c@gmail.com> (raw)
In-Reply-To: <CAKUh=Rx0Vu2XpdvckYtFPVQ4N4pC22hoRs0KEGsEhm31t3KW2w@mail.gmail.com>

Hi Kever,

Thank you for your comment.
On 8/11/21 12:01 PM, Kever Yang wrote:
> Hi Johan,
>      Thanks for your patch, where does this source code come from?

Copied it from here:
https://github.com/rockchip-linux/u-boot/blame/next-dev/drivers/phy/phy-rockchip-inno-usb2.c

phy: add a new driver for rockchip usb2 phy
https://github.com/rockchip-linux/u-boot/commit/f0c40dcdc2ca7d6522efeee4bd2e42dc8e3e8ab2

Adjusted it for current u-boot driver.
Mainline u-boot has no chg_det.

 Is
> there any code change other than the structure for rk3328?
>     Please remove the RFC tag once the patch is ready.

Anyone with a tested-by tag?
Do I have to resend only to remove a RFC tag or can a maintainer do that
when he/she applies?

> 
> Thanks,
> - Kever

Note:
In the rk3328.dtsi sync from Linux phy dr_mode is standard otg,
but that doesn't work, so all are set to host in a dts.

In rk3318-a95x-z2.dts

+&usb20_otg {
+	dr_mode = "host";
+	status = "okay";
+};

In u-boot to work we must set it back to otg because of:
port_cfg = &rphy->phy_cfg->port_cfgs[USB2PHY_PORT_OTG];

In rk3318-a95x-z2-u-boot.dtsi
+&usb20_otg {
+	dr_mode = "otg";
+};

> 
> Johan Jonker <jbx6244@gmail.com> 于2021年7月1日周四 上午2:50写道:
>>
>> The rk3328 uses a usb phy simulair to rk3399 with only
>> 1 instead of 2 usb ports. Reuse existing U-boot driver and
>> add basic rk3328 support to phy-rockchip-inno-usb2.c
>>
>> Signed-off-by: Johan Jonker <jbx6244@gmail.com>
>> ---
>>  drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 29 +++++++++++++++++++++++++++
>>  1 file changed, 29 insertions(+)
>>
>> diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
>> index 62b8ba3a4a..bfb531d3cd 100644
>> --- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
>> +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
>> @@ -243,6 +243,31 @@ static int rockchip_usb2phy_bind(struct udevice *dev)
>>         return ret;
>>  }
>>
>> +static const struct rockchip_usb2phy_cfg rk3328_usb2phy_cfgs[] = {
>> +       {
>> +               .reg            = 0x100,
>> +               .port_cfgs      = {
>> +                       [USB2PHY_PORT_OTG] = {

U-boot:
>> +                               .phy_sus        = { 0x0100, 8, 0, 0, 0x1d1 },

Linux:
				.phy_sus	= { 0x0100, 15, 0, 0, 0x1d1 },

Which is correct?

>> +                               .bvalid_det_en  = { 0x0110, 2, 2, 0, 1 },
>> +                               .bvalid_det_st  = { 0x0114, 2, 2, 0, 1 },
>> +                               .bvalid_det_clr = { 0x0118, 2, 2, 0, 1 },
>> +                               .utmi_avalid    = { 0x0120, 10, 10, 0, 1 },
>> +                               .utmi_bvalid    = { 0x0120, 9, 9, 0, 1 },
>> +                       },
>> +                       [USB2PHY_PORT_HOST] = {

U-boot:
>> +                               .phy_sus        = { 0x104, 8, 0, 0, 0x1d1 },

Linux:
				.phy_sus	= { 0x104, 15, 0, 0, 0x1d1 },

Which is correct?

>> +                               .ls_det_en      = { 0x110, 1, 1, 0, 1 },
>> +                               .ls_det_st      = { 0x114, 1, 1, 0, 1 },
>> +                               .ls_det_clr     = { 0x118, 1, 1, 0, 1 },
>> +                               .utmi_ls        = { 0x120, 17, 16, 0, 1 },
>> +                               .utmi_hstdet    = { 0x120, 19, 19, 0, 1 }
>> +                       }
>> +               },
>> +       },
>> +       { /* sentinel */ }
>> +};
>> +
>>  static const struct rockchip_usb2phy_cfg rk3399_usb2phy_cfgs[] = {
>>         {
>>                 .reg            = 0xe450,
>> @@ -291,6 +316,10 @@ static const struct rockchip_usb2phy_cfg rk3399_usb2phy_cfgs[] = {
>>
>>  static const struct udevice_id rockchip_usb2phy_ids[] = {
>>         {
>> +               .compatible = "rockchip,rk3328-usb2phy",
>> +               .data = (ulong)&rk3328_usb2phy_cfgs
>> +       },
>> +       {
>>                 .compatible = "rockchip,rk3399-usb2phy",
>>                 .data = (ulong)&rk3399_usb2phy_cfgs,
>>         },
>> --
>> 2.11.0
>>

      reply	other threads:[~2021-08-11 12:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-30 16:40 [RFC PATCH v1] phy: rockchip: add basic rk3328 support to phy-rockchip-inno-usb2.c Johan Jonker
2021-08-11 10:01 ` Kever Yang
2021-08-11 11:24   ` Johan Jonker [this message]

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=e8b2cb94-3644-1ba8-e996-7ee1627da46c@gmail.com \
    --to=jbx6244@gmail.com \
    --cc=banglang.huang@foxmail.com \
    --cc=frank.wang@rock-chips.com \
    --cc=heiko@sntech.de \
    --cc=kever.yang@rock-chips.com \
    --cc=ldevulder@suse.com \
    --cc=mail@david-bauer.net \
    --cc=matwey.kornilov@gmail.com \
    --cc=philipp.tomsich@vrull.eu \
    --cc=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    --cc=wens@csie.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