From: Chunfeng Yun <chunfeng.yun@mediatek.com>
To: Macpaul Lin <macpaul.lin@mediatek.com>
Cc: devicetree@vger.kernel.org,
Mediatek WSD Upstream <wsd_upstream@mediatek.com>,
linux-kernel@vger.kernel.org,
Kishon Vijay Abraham I <kishon@ti.com>,
Rob Herring <robh+dt@kernel.org>,
linux-mediatek@lists.infradead.org,
Min Guo <min.Guo@mediatek.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
Macpaul Lin <macpaul.lin@gmail.com>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 2/2] phy: phy-mtk-tphy: introduce force_vbus for u2 phy
Date: Fri, 17 Apr 2020 13:34:21 +0800 [thread overview]
Message-ID: <1587101661.28772.40.camel@mhfsdcap03> (raw)
In-Reply-To: <1587100986-3104-2-git-send-email-macpaul.lin@mediatek.com>
Hi Macpaul,
On Fri, 2020-04-17 at 13:23 +0800, Macpaul Lin wrote:
> For some platforms, they don't have vbus pin connection between usb phy and
> mac. Hence we need to control force_vbus related registers to keep hardware
> works normal.
> This patch add corresponding behavior of force vbus in u2 phy related
> functions.
>
> Signed-off-by: Macpaul Lin <macpaul.lin@mediatek.com>
NACK, I tried to support it early, but found this will cause some issue
for SS/SSP device only mode, so please abandon this patch, thanks
> ---
> drivers/phy/mediatek/phy-mtk-tphy.c | 16 +++++++++++++++-
> 1 file changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/phy/mediatek/phy-mtk-tphy.c b/drivers/phy/mediatek/phy-mtk-tphy.c
> index cdbcc49f7115..46f0fea175e5 100644
> --- a/drivers/phy/mediatek/phy-mtk-tphy.c
> +++ b/drivers/phy/mediatek/phy-mtk-tphy.c
> @@ -99,6 +99,7 @@
>
> #define U3P_U2PHYDTM1 0x06C
> #define P2C_RG_UART_EN BIT(16)
> +#define P2C_FORCE_VBUSVALID BIT(13)
> #define P2C_FORCE_IDDIG BIT(9)
> #define P2C_RG_VBUSVALID BIT(5)
> #define P2C_RG_SESSEND BIT(4)
> @@ -318,6 +319,7 @@ struct mtk_tphy {
> int nphys;
> int src_ref_clk; /* MHZ, reference clock for slew rate calibrate */
> int src_coef; /* coefficient for slew rate calibrate */
> + bool force_vbus;
> };
>
> static void hs_slew_rate_calibrate(struct mtk_tphy *tphy,
> @@ -611,13 +613,20 @@ static void u2_phy_instance_set_mode(struct mtk_tphy *tphy,
> switch (mode) {
> case PHY_MODE_USB_DEVICE:
> tmp |= P2C_FORCE_IDDIG | P2C_RG_IDDIG;
> + if (tphy->force_vbus)
> + tmp |= P2C_RG_VBUSVALID | P2C_FORCE_VBUSVALID;
> break;
> case PHY_MODE_USB_HOST:
> tmp |= P2C_FORCE_IDDIG;
> - tmp &= ~P2C_RG_IDDIG;
> + if (tphy->force_vbus)
> + tmp &= ~(P2C_RG_VBUSVALID | P2C_FORCE_VBUSVALID);
> + else
> + tmp &= ~P2C_RG_IDDIG;
> break;
> case PHY_MODE_USB_OTG:
> tmp &= ~(P2C_FORCE_IDDIG | P2C_RG_IDDIG);
> + if (tphy->force_vbus)
> + tmp &= ~(P2C_RG_VBUSVALID | P2C_FORCE_VBUSVALID);
> break;
> default:
> return;
> @@ -1187,6 +1196,11 @@ static int mtk_tphy_probe(struct platform_device *pdev)
> retval = PTR_ERR(instance->da_ref_clk);
> goto put_child;
> }
> +
> + /*
> + * On some platform, vbus is dis-connected between PHY and MAC.
> + */
> + tphy->force_vbus = device_property_read_bool(dev, "force_vbus");
> }
>
> provider = devm_of_phy_provider_register(dev, mtk_phy_xlate);
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
next prev parent reply other threads:[~2020-04-17 5:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-17 5:23 [PATCH 1/2] dt-bindings: phy-mtk-tphy: add the property about force_vbus Macpaul Lin
2020-04-17 5:23 ` [PATCH 2/2] phy: phy-mtk-tphy: introduce force_vbus for u2 phy Macpaul Lin
2020-04-17 5:34 ` Chunfeng Yun [this message]
2020-04-29 21:30 ` [PATCH 1/2] dt-bindings: phy-mtk-tphy: add the property about force_vbus Rob Herring
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=1587101661.28772.40.camel@mhfsdcap03 \
--to=chunfeng.yun@mediatek.com \
--cc=devicetree@vger.kernel.org \
--cc=kishon@ti.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=macpaul.lin@gmail.com \
--cc=macpaul.lin@mediatek.com \
--cc=matthias.bgg@gmail.com \
--cc=min.Guo@mediatek.com \
--cc=robh+dt@kernel.org \
--cc=wsd_upstream@mediatek.com \
/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).