linux-amlogic.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
To: Anand Moon <linux.amoon@gmail.com>
Cc: devicetree@vger.kernel.org,
	Neil Armstrong <narmstrong@baylibre.com>,
	Kevin Hilman <khilman@baylibre.com>,
	Kishon Vijay Abraham I <kishon@ti.com>,
	Rob Herring <robh+dt@kernel.org>,
	linux-amlogic@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	Jerome Brunet <jbrunet@baylibre.com>
Subject: Re: [RFCv1 1/3] phy: meson8b-usb2: Enable otg phy controller on Meson8b SoCs
Date: Mon, 4 Feb 2019 14:20:59 +0100	[thread overview]
Message-ID: <CAFBinCCOQ_GqHZuYf6n8ba_ZMbOwKmUzc4EJAuXRpn4tTTCUKA@mail.gmail.com> (raw)
In-Reply-To: <20190123151209.2080-2-linux.amoon@gmail.com>

Hi Anand,

On Wed, Jan 23, 2019 at 4:12 PM Anand Moon <linux.amoon@gmail.com> wrote:
>
> Meson8b support two USB phy controller, one with otg port and
> other usb host controller. USB OTG controller ie. otg port can
> be used to power on board or host port for usb device.
> Changes enable usb otg host controller when dr_mode is set to otg.
can you please add a sentence explaining *why* this allows enabling USB OTG?

> Currenly otg port can be used to power on the board.
typo, should be "Currently"

> Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
> Cc: Jerome Brunet <jbrunet@baylibre.com>
> Cc: Neil Armstrong <narmstrong@baylibre.com>
> Cc: Kevin Hilman <khilman@baylibre.com>
> Signed-off-by: Anand Moon <linux.amoon@gmail.com>
> ---
> New patch in this series.
> --TOTO enable OTG port to work as host.
> --Currently we can power on the board from this OTG port.
>
> /:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=dwc2/1p, 480M
>     |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M
>         |__ Port 1: Dev 4, If 0, Class=Mass Storage, Driver=usb-storage, 480M
>         |__ Port 3: Dev 3, If 0, Class=Video, Driver=uvcvideo, 480M
>         |__ Port 3: Dev 3, If 1, Class=Video, Driver=uvcvideo, 480M
>         |__ Port 3: Dev 3, If 2, Class=Audio, Driver=snd-usb-audio, 480M
>         |__ Port 3: Dev 3, If 3, Class=Audio, Driver=snd-usb-audio, 480M
> /:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=dwc2/1p, 480M
> ---
>  drivers/phy/amlogic/phy-meson8b-usb2.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
>
> diff --git a/drivers/phy/amlogic/phy-meson8b-usb2.c b/drivers/phy/amlogic/phy-meson8b-usb2.c
> index 9c01b7e19b06..1333c77e9172 100644
> --- a/drivers/phy/amlogic/phy-meson8b-usb2.c
> +++ b/drivers/phy/amlogic/phy-meson8b-usb2.c
> @@ -109,6 +109,7 @@
>
>  #define RESET_COMPLETE_TIME                            500
>  #define ACA_ENABLE_COMPLETE_TIME                       50
> +#define DCD_ENABLE_COMPLETE_TIME                       10
>
>  struct phy_meson8b_usb2_priv {
>         void __iomem            *regs;
> @@ -188,6 +189,20 @@ static int phy_meson8b_usb2_power_on(struct phy *phy)
>
>                 udelay(ACA_ENABLE_COMPLETE_TIME);
>
> +               if (phy_meson8b_usb2_read(priv, REG_ADP_BC) &
> +                       REG_ADP_BC_ACA_PIN_FLOAT) {
> +                       dev_warn(&phy->dev, "USB ID detect failed!\n");
> +                       clk_disable_unprepare(priv->clk_usb);
> +                       clk_disable_unprepare(priv->clk_usb_general);
> +                       return -EINVAL;
> +               }
> +       } else if (priv->dr_mode == USB_DR_MODE_OTG) {
> +               phy_meson8b_usb2_mask_bits(priv, REG_ADP_BC,
> +                                          REG_ADP_BC_DCD_ENABLE,
> +                                          REG_ADP_BC_DCD_ENABLE);
where did you take this from?
$ grep -iR DCD arm-src-kernel-2015-01-15-321cfb5a46/drivers/amlogic/usb/dwc_otg/310/
-> I only find code which clears REG_ADP_BC_DCD_ENABLE (your patch sets it):
  adp_bc.b.dcd_enable = 0;

> +               udelay(DCD_ENABLE_COMPLETE_TIME);
from Amlogic's code: DWC_MDELAY(T_DCD_TIMEOUT);
while you are also using a delay of "10" the unit is different (your
patch: us, Amlogic: ms)


Regards
Martin

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

  reply	other threads:[~2019-02-04 13:21 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-23 15:12 [RFCv1 0/3] Odroid c1+ usb fixs Anand Moon
2019-01-23 15:12 ` [RFCv1 1/3] phy: meson8b-usb2: Enable otg phy controller on Meson8b SoCs Anand Moon
2019-02-04 13:20   ` Martin Blumenstingl [this message]
2019-02-04 20:02     ` Anand Moon
2019-02-04 20:26       ` Martin Blumenstingl
2019-02-05 19:52         ` Anand Moon
2019-02-06 11:48           ` Martin Blumenstingl
2019-02-07  6:41             ` Anand Moon
2019-01-23 15:12 ` [RFCv1 2/3] ARM: dts: meson8b: odroidc1: fix USB power supplies for phy Anand Moon
2019-02-04 13:29   ` Martin Blumenstingl
2019-02-04 20:03     ` Anand Moon
2019-02-04 20:35       ` Martin Blumenstingl
2019-02-05 19:52         ` Anand Moon
2019-02-06 11:28           ` Martin Blumenstingl
2019-02-07  6:32             ` Anand Moon
2019-02-09  0:36               ` Martin Blumenstingl
2019-02-09 17:55                 ` Anand Moon
2019-02-10 22:21                   ` Martin Blumenstingl
2019-02-11 15:08                     ` Anand Moon
2019-02-17 14:26                       ` Martin Blumenstingl
2019-01-23 15:12 ` [RFCv1 3/3] ARM: dts: meson8b: odroidc1: enable the OTG capable USB controller Anand Moon
2019-02-04 13:51 ` [RFCv1 0/3] Odroid c1+ usb fixs Martin Blumenstingl
2019-02-04 20:04   ` Anand Moon
2019-02-04 20:38     ` Martin Blumenstingl
2019-02-05 19:53       ` Anand Moon

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=CAFBinCCOQ_GqHZuYf6n8ba_ZMbOwKmUzc4EJAuXRpn4tTTCUKA@mail.gmail.com \
    --to=martin.blumenstingl@googlemail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=jbrunet@baylibre.com \
    --cc=khilman@baylibre.com \
    --cc=kishon@ti.com \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux.amoon@gmail.com \
    --cc=narmstrong@baylibre.com \
    --cc=robh+dt@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).