public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
From: "Chunfeng Yun (云春峰)" <Chunfeng.Yun@mediatek.com>
To: "robh@kernel.org" <robh@kernel.org>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>
Cc: "linux-mediatek@lists.infradead.org"
	<linux-mediatek@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"mathias.nyman@intel.com" <mathias.nyman@intel.com>,
	"conor+dt@kernel.org" <conor+dt@kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
	"krzk+dt@kernel.org" <krzk+dt@kernel.org>
Subject: Re: [PATCH v2 4/4] usb: mtu3: add support remote wakeup of mt8196
Date: Sun, 9 Feb 2025 03:31:41 +0000	[thread overview]
Message-ID: <a689f7d25fb05ba83ac2de6ba879998fe2e21bcb.camel@mediatek.com> (raw)
In-Reply-To: <e63fdeba-04dd-4b88-a6d6-ca8a64e28e36@collabora.com>

On Wed, 2025-01-22 at 10:30 +0100, AngeloGioacchino Del Regno wrote:
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
> 
> 
> Il 21/01/25 15:50, Chunfeng Yun ha scritto:
> > There are three USB controllers on mt8196, each controller's wakeup
> > control is different, add some specific versions for them.
> > Here add only for dual-role controllers.
> > 
> > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> 
>  From the datasheets, I can read the following:
> 
> IP0: host -> 0x1670_0000  device(mtu3) -> 0x1670_1000
> IP1: host -> 0x1671_0000  device(mtu3) -> 0x1671_1000
> IP2: host -> 0x1672_0000  device(mtu3) -> 0x1672_1000
> 
I'll check it.

> ...this means that you're missing the IP2 here, which you did not
> miss in the
> commit adding the wakeup control in mtk-xhci instead.
> 
> So, since I see that all of the USB IPs are behind MTU3, and that
> there is no
> USB IP that does *not* support gadget mode (so, there's no USB IP
> that does NOT
> support MTU3), you shall add all three here, and you shall drop the
> commit that
> adds the wakeup control in mtk-xhci entirely.
No, I'll still add them in mtk-xhci driver as before for the cases that
only use xhci only, no need use mtu3 driver.

As I said before, event the controller supports dual-role mode, which
don't mean that it can use this upstream mtu3 driver, some SoC have
limitation and can't support the dual-role mode switch used in upstream
driver. but all SoC can use upstream xhci-mtk driver. that why I add
some SoC's wakeup control in xhci-mtk, but not in mtu3 driver.

> 
> This is because there will be no DT node declaring only XHCI.
> 
> Since after the proposed change all controllers will be MTU3 -> XHCI,
> there's
> no need to add the same in the mtk-xhci driver.
I think it's better to leave the selection to the customer, for
example, on chromebook, we only use xhci driver and do not enable mtu3.

Thanks

> 
> Cheers,
> Angelo
> 
> > ---
> > v2: add wakeup for dual-role controllers
> > ---
> >   drivers/usb/mtu3/mtu3_host.c | 17 +++++++++++++++++
> >   1 file changed, 17 insertions(+)
> > 
> > diff --git a/drivers/usb/mtu3/mtu3_host.c
> > b/drivers/usb/mtu3/mtu3_host.c
> > index 7c657ea2dabd..d65b0f318436 100644
> > --- a/drivers/usb/mtu3/mtu3_host.c
> > +++ b/drivers/usb/mtu3/mtu3_host.c
> > @@ -46,6 +46,11 @@
> >   #define WC1_IS_P_95         BIT(12)
> >   #define WC1_IS_EN_P0_95             BIT(6)
> > 
> > +/* mt8196 */
> > +#define PERI_WK_CTRL0_8196   0x08
> > +#define WC0_IS_EN_P0_96              BIT(0)
> > +#define WC0_IS_EN_P1_96              BIT(7)
> > +
> >   /* mt2712 etc */
> >   #define PERI_SSUSB_SPM_CTRL 0x0
> >   #define SSC_IP_SLEEP_EN     BIT(4)
> > @@ -59,6 +64,8 @@ enum ssusb_uwk_vers {
> >       SSUSB_UWK_V1_3,         /* mt8195 IP0 */
> >       SSUSB_UWK_V1_5 = 105,   /* mt8195 IP2 */
> >       SSUSB_UWK_V1_6,         /* mt8195 IP3 */
> > +     SSUSB_UWK_V1_7,         /* mt8196 IP0 */
> > +     SSUSB_UWK_V1_8,         /* mt8196 IP1 */
> >   };
> > 
> >   /*
> > @@ -100,6 +107,16 @@ static void ssusb_wakeup_ip_sleep_set(struct
> > ssusb_mtk *ssusb, bool enable)
> >               msk = WC0_IS_EN_P3_95 | WC0_IS_C_95(0x7) |
> > WC0_IS_P_95;
> >               val = enable ? (WC0_IS_EN_P3_95 | WC0_IS_C_95(0x1)) :
> > 0;
> >               break;
> > +     case SSUSB_UWK_V1_7:
> > +             reg = ssusb->uwk_reg_base + PERI_WK_CTRL0_8196;
> > +             msk = WC0_IS_EN_P0_96;
> > +             val = enable ? msk : 0;
> > +             break;
> > +     case SSUSB_UWK_V1_8:
> > +             reg = ssusb->uwk_reg_base + PERI_WK_CTRL0_8196;
> > +             msk = WC0_IS_EN_P1_96;
> > +             val = enable ? msk : 0;
> > +             break;
> >       case SSUSB_UWK_V2:
> >               reg = ssusb->uwk_reg_base + PERI_SSUSB_SPM_CTRL;
> >               msk = SSC_IP_SLEEP_EN | SSC_SPM_INT_EN;
> 
> 
> 

  reply	other threads:[~2025-02-09  3:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-21 14:50 [PATCH v2 1/4] dt-bindings: usb: mtk-xhci: add support mt8196 Chunfeng Yun
2025-01-21 14:50 ` [PATCH v2 2/4] dt-bindings: usb: mtu3: " Chunfeng Yun
2025-01-21 17:25   ` Conor Dooley
2025-01-21 14:50 ` [PATCH v2 3/4] usb: mtk-xhci: add support remote wakeup of mt8196 Chunfeng Yun
2025-01-21 14:50 ` [PATCH v2 4/4] usb: mtu3: " Chunfeng Yun
2025-01-22  9:30   ` AngeloGioacchino Del Regno
2025-02-09  3:31     ` Chunfeng Yun (云春峰) [this message]
2025-02-18  9:26       ` AngeloGioacchino Del Regno
2025-02-22  8:24         ` Chunfeng Yun (云春峰)
2025-01-21 17:25 ` [PATCH v2 1/4] dt-bindings: usb: mtk-xhci: add support mt8196 Conor Dooley

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=a689f7d25fb05ba83ac2de6ba879998fe2e21bcb.camel@mediatek.com \
    --to=chunfeng.yun@mediatek.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@intel.com \
    --cc=matthias.bgg@gmail.com \
    --cc=robh@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