2022-08-01 10:40:36

by Gene Chen

[permalink] [raw]
Subject: [PATCH v3 4/7] usb: typec: tcpci_rt1711h: Add initial phy setting

From: Gene Chen <[email protected]>

Add initial phy setting about phy dicard retry,
rx filter deglitech time and BMC-encoded wait time

Signed-off-by: Gene Chen <[email protected]>
Reviewed-by: Guenter Roeck <[email protected]>
---
drivers/usb/typec/tcpm/tcpci_rt1711h.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/typec/tcpm/tcpci_rt1711h.c b/drivers/usb/typec/tcpm/tcpci_rt1711h.c
index df7bfe299987..33d8ea95b7c1 100644
--- a/drivers/usb/typec/tcpm/tcpci_rt1711h.c
+++ b/drivers/usb/typec/tcpm/tcpci_rt1711h.c
@@ -20,6 +20,9 @@
#define RT1711H_VID 0x29CF
#define RT1711H_PID 0x1711

+#define RT1711H_PHYCTRL1 0x80
+#define RT1711H_PHYCTRL2 0x81
+
#define RT1711H_RTCTRL8 0x9B

/* Autoidle timeout = (tout * 2 + 1) * 6.4ms */
@@ -107,8 +110,18 @@ static int rt1711h_init(struct tcpci *tcpci, struct tcpci_data *tdata)
return ret;

/* dcSRC.DRP : 33% */
- return rt1711h_write16(chip, RT1711H_RTCTRL16, 330);
+ ret = rt1711h_write16(chip, RT1711H_RTCTRL16, 330);
+ if (ret < 0)
+ return ret;
+
+ /* Enable phy discard retry, retry count 7, rx filter deglitech 100 us */
+ ret = rt1711h_write8(chip, RT1711H_PHYCTRL1, 0xF1);
+ if (ret < 0)
+ return ret;

+ /* Decrease wait time of BMC-encoded 1 bit from 2.67us to 2.55us */
+ /* wait time : (val * .4167) us */
+ return rt1711h_write8(chip, RT1711H_PHYCTRL2, 62);
}

static int rt1711h_set_vbus(struct tcpci *tcpci, struct tcpci_data *tdata,
--
2.25.1



2022-08-02 08:43:50

by Heikki Krogerus

[permalink] [raw]
Subject: Re: [PATCH v3 4/7] usb: typec: tcpci_rt1711h: Add initial phy setting

Hi Gene,

On Mon, Aug 01, 2022 at 06:14:44PM +0800, Gene Chen wrote:
> From: Gene Chen <[email protected]>
>
> Add initial phy setting about phy dicard retry,
> rx filter deglitech time and BMC-encoded wait time

I'm sorry, but what does "deglitech" mean? Is it just a typo?

> Signed-off-by: Gene Chen <[email protected]>
> Reviewed-by: Guenter Roeck <[email protected]>
> ---
> drivers/usb/typec/tcpm/tcpci_rt1711h.c | 15 ++++++++++++++-
> 1 file changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/typec/tcpm/tcpci_rt1711h.c b/drivers/usb/typec/tcpm/tcpci_rt1711h.c
> index df7bfe299987..33d8ea95b7c1 100644
> --- a/drivers/usb/typec/tcpm/tcpci_rt1711h.c
> +++ b/drivers/usb/typec/tcpm/tcpci_rt1711h.c
> @@ -20,6 +20,9 @@
> #define RT1711H_VID 0x29CF
> #define RT1711H_PID 0x1711
>
> +#define RT1711H_PHYCTRL1 0x80
> +#define RT1711H_PHYCTRL2 0x81
> +
> #define RT1711H_RTCTRL8 0x9B
>
> /* Autoidle timeout = (tout * 2 + 1) * 6.4ms */
> @@ -107,8 +110,18 @@ static int rt1711h_init(struct tcpci *tcpci, struct tcpci_data *tdata)
> return ret;
>
> /* dcSRC.DRP : 33% */
> - return rt1711h_write16(chip, RT1711H_RTCTRL16, 330);
> + ret = rt1711h_write16(chip, RT1711H_RTCTRL16, 330);
> + if (ret < 0)
> + return ret;
> +
> + /* Enable phy discard retry, retry count 7, rx filter deglitech 100 us */
> + ret = rt1711h_write8(chip, RT1711H_PHYCTRL1, 0xF1);
> + if (ret < 0)
> + return ret;
>
> + /* Decrease wait time of BMC-encoded 1 bit from 2.67us to 2.55us */
> + /* wait time : (val * .4167) us */
> + return rt1711h_write8(chip, RT1711H_PHYCTRL2, 62);
> }
>
> static int rt1711h_set_vbus(struct tcpci *tcpci, struct tcpci_data *tdata,
> --
> 2.25.1

thanks,

--
heikki

2022-08-02 09:13:46

by Guenter Roeck

[permalink] [raw]
Subject: Re: [PATCH v3 4/7] usb: typec: tcpci_rt1711h: Add initial phy setting

On Tue, Aug 02, 2022 at 11:19:15AM +0300, Heikki Krogerus wrote:
> Hi Gene,
>
> On Mon, Aug 01, 2022 at 06:14:44PM +0800, Gene Chen wrote:
> > From: Gene Chen <[email protected]>
> >
> > Add initial phy setting about phy dicard retry,
> > rx filter deglitech time and BMC-encoded wait time
>
> I'm sorry, but what does "deglitech" mean? Is it just a typo?
>

deglitch ?

> > Signed-off-by: Gene Chen <[email protected]>
> > Reviewed-by: Guenter Roeck <[email protected]>
> > ---
> > drivers/usb/typec/tcpm/tcpci_rt1711h.c | 15 ++++++++++++++-
> > 1 file changed, 14 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/usb/typec/tcpm/tcpci_rt1711h.c b/drivers/usb/typec/tcpm/tcpci_rt1711h.c
> > index df7bfe299987..33d8ea95b7c1 100644
> > --- a/drivers/usb/typec/tcpm/tcpci_rt1711h.c
> > +++ b/drivers/usb/typec/tcpm/tcpci_rt1711h.c
> > @@ -20,6 +20,9 @@
> > #define RT1711H_VID 0x29CF
> > #define RT1711H_PID 0x1711
> >
> > +#define RT1711H_PHYCTRL1 0x80
> > +#define RT1711H_PHYCTRL2 0x81
> > +
> > #define RT1711H_RTCTRL8 0x9B
> >
> > /* Autoidle timeout = (tout * 2 + 1) * 6.4ms */
> > @@ -107,8 +110,18 @@ static int rt1711h_init(struct tcpci *tcpci, struct tcpci_data *tdata)
> > return ret;
> >
> > /* dcSRC.DRP : 33% */
> > - return rt1711h_write16(chip, RT1711H_RTCTRL16, 330);
> > + ret = rt1711h_write16(chip, RT1711H_RTCTRL16, 330);
> > + if (ret < 0)
> > + return ret;
> > +
> > + /* Enable phy discard retry, retry count 7, rx filter deglitech 100 us */
> > + ret = rt1711h_write8(chip, RT1711H_PHYCTRL1, 0xF1);
> > + if (ret < 0)
> > + return ret;
> >
> > + /* Decrease wait time of BMC-encoded 1 bit from 2.67us to 2.55us */
> > + /* wait time : (val * .4167) us */
> > + return rt1711h_write8(chip, RT1711H_PHYCTRL2, 62);
> > }
> >
> > static int rt1711h_set_vbus(struct tcpci *tcpci, struct tcpci_data *tdata,
> > --
> > 2.25.1
>
> thanks,
>
> --
> heikki

2022-08-03 06:28:02

by Gene Chen

[permalink] [raw]
Subject: Re: [PATCH v3 4/7] usb: typec: tcpci_rt1711h: Add initial phy setting

Guenter Roeck <[email protected]> 於 2022年8月2日 週二 下午4:58寫道:
>
> On Tue, Aug 02, 2022 at 11:19:15AM +0300, Heikki Krogerus wrote:
> > Hi Gene,
> >
> > On Mon, Aug 01, 2022 at 06:14:44PM +0800, Gene Chen wrote:
> > > From: Gene Chen <[email protected]>
> > >
> > > Add initial phy setting about phy dicard retry,
> > > rx filter deglitech time and BMC-encoded wait time
> >
> > I'm sorry, but what does "deglitech" mean? Is it just a typo?
> >
>
> deglitch ?
>

Yes, typo, I will fix it.

> > > Signed-off-by: Gene Chen <[email protected]>
> > > Reviewed-by: Guenter Roeck <[email protected]>
> > > ---
> > > drivers/usb/typec/tcpm/tcpci_rt1711h.c | 15 ++++++++++++++-
> > > 1 file changed, 14 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/usb/typec/tcpm/tcpci_rt1711h.c b/drivers/usb/typec/tcpm/tcpci_rt1711h.c
> > > index df7bfe299987..33d8ea95b7c1 100644
> > > --- a/drivers/usb/typec/tcpm/tcpci_rt1711h.c
> > > +++ b/drivers/usb/typec/tcpm/tcpci_rt1711h.c
> > > @@ -20,6 +20,9 @@
> > > #define RT1711H_VID 0x29CF
> > > #define RT1711H_PID 0x1711
> > >
> > > +#define RT1711H_PHYCTRL1 0x80
> > > +#define RT1711H_PHYCTRL2 0x81
> > > +
> > > #define RT1711H_RTCTRL8 0x9B
> > >
> > > /* Autoidle timeout = (tout * 2 + 1) * 6.4ms */
> > > @@ -107,8 +110,18 @@ static int rt1711h_init(struct tcpci *tcpci, struct tcpci_data *tdata)
> > > return ret;
> > >
> > > /* dcSRC.DRP : 33% */
> > > - return rt1711h_write16(chip, RT1711H_RTCTRL16, 330);
> > > + ret = rt1711h_write16(chip, RT1711H_RTCTRL16, 330);
> > > + if (ret < 0)
> > > + return ret;
> > > +
> > > + /* Enable phy discard retry, retry count 7, rx filter deglitech 100 us */
> > > + ret = rt1711h_write8(chip, RT1711H_PHYCTRL1, 0xF1);
> > > + if (ret < 0)
> > > + return ret;
> > >
> > > + /* Decrease wait time of BMC-encoded 1 bit from 2.67us to 2.55us */
> > > + /* wait time : (val * .4167) us */
> > > + return rt1711h_write8(chip, RT1711H_PHYCTRL2, 62);
> > > }
> > >
> > > static int rt1711h_set_vbus(struct tcpci *tcpci, struct tcpci_data *tdata,
> > > --
> > > 2.25.1
> >
> > thanks,
> >
> > --
> > heikki