* [PATCH] usb: phy: mxs: Disable external charger detect in mxs_phy_hw_init()
@ 2019-05-29 6:59 Andrey Smirnov
0 siblings, 0 replies; 4+ messages in thread
From: Andrey Smirnov @ 2019-05-29 6:59 UTC (permalink / raw)
Cc: Andrey Smirnov, Chris Healy, Felipe Balbi, Shawn Guo,
Fabio Estevam, NXP Linux Team, linux-usb, linux-arm-kernel,
linux-kernel
Since this driver already handles changer detction state, copy the
workaround code currently residing in arch/arm/mach-imx/anatop.c into
this drier to consolidate the places modifying it.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Cc: Chris Healy <cphealy@gmail.com>
Cc: Felipe Balbi <balbi@kernel.org>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: NXP Linux Team <linux-imx@nxp.com>
Cc: linux-usb@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
The intent of this patch is to consolidate all of the code maipulating
charge detection state to a signle place and if this patch is agreed
upon I plan to follow it up with this change:
https://github.com/ndreys/linux/commit/7248f2b85b4706760fd33d2ff970e2ea12d3bea7
Thanks,
Andrey Smirnov
drivers/usb/phy/phy-mxs-usb.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c
index 1b1bb0ad40c3..6fa16ab31e2e 100644
--- a/drivers/usb/phy/phy-mxs-usb.c
+++ b/drivers/usb/phy/phy-mxs-usb.c
@@ -63,6 +63,7 @@
#define ANADIG_USB1_CHRG_DETECT_SET 0x1b4
#define ANADIG_USB1_CHRG_DETECT_CLR 0x1b8
+#define ANADIG_USB2_CHRG_DETECT_SET 0x214
#define ANADIG_USB1_CHRG_DETECT_EN_B BIT(20)
#define ANADIG_USB1_CHRG_DETECT_CHK_CHRG_B BIT(19)
#define ANADIG_USB1_CHRG_DETECT_CHK_CONTACT BIT(18)
@@ -250,6 +251,19 @@ static int mxs_phy_hw_init(struct mxs_phy *mxs_phy)
if (mxs_phy->data->flags & MXS_PHY_NEED_IP_FIX)
writel(BM_USBPHY_IP_FIX, base + HW_USBPHY_IP_SET);
+ if (mxs_phy->regmap_anatop) {
+ unsigned int reg = mxs_phy->port_id ?
+ ANADIG_USB1_CHRG_DETECT_SET :
+ ANADIG_USB2_CHRG_DETECT_SET;
+ /*
+ * The external charger detector needs to be disabled,
+ * or the signal at DP will be poor
+ */
+ regmap_write(mxs_phy->regmap_anatop, reg,
+ ANADIG_USB1_CHRG_DETECT_EN_B |
+ ANADIG_USB1_CHRG_DETECT_CHK_CHRG_B);
+ }
+
mxs_phy_tx_init(mxs_phy);
return 0;
--
2.21.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] usb: phy: mxs: Disable external charger detect in mxs_phy_hw_init()
2019-05-29 6:59 Andrey Smirnov
2019-05-29 8:01 ` Peter Chen
@ 2019-06-05 9:19 ` Shawn Guo
1 sibling, 0 replies; 4+ messages in thread
From: Shawn Guo @ 2019-06-05 9:19 UTC (permalink / raw)
To: Andrey Smirnov
Cc: linux-usb, Chris Healy, Felipe Balbi, Fabio Estevam,
NXP Linux Team, linux-arm-kernel, linux-kernel
On Tue, May 28, 2019 at 11:59:48PM -0700, Andrey Smirnov wrote:
> Since this driver already handles changer detction state, copy the
> workaround code currently residing in arch/arm/mach-imx/anatop.c into
> this drier to consolidate the places modifying it.
>
> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
> Cc: Chris Healy <cphealy@gmail.com>
> Cc: Felipe Balbi <balbi@kernel.org>
> Cc: Shawn Guo <shawnguo@kernel.org>
> Cc: Fabio Estevam <festevam@gmail.com>
> Cc: NXP Linux Team <linux-imx@nxp.com>
> Cc: linux-usb@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-kernel@vger.kernel.org
Acked-by: Shawn Guo <shawnguo@kernel.org>
> ---
>
> The intent of this patch is to consolidate all of the code maipulating
> charge detection state to a signle place and if this patch is agreed
> upon I plan to follow it up with this change:
>
> https://github.com/ndreys/linux/commit/7248f2b85b4706760fd33d2ff970e2ea12d3bea7
>
> Thanks,
> Andrey Smirnov
>
> drivers/usb/phy/phy-mxs-usb.c | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c
> index 1b1bb0ad40c3..6fa16ab31e2e 100644
> --- a/drivers/usb/phy/phy-mxs-usb.c
> +++ b/drivers/usb/phy/phy-mxs-usb.c
> @@ -63,6 +63,7 @@
>
> #define ANADIG_USB1_CHRG_DETECT_SET 0x1b4
> #define ANADIG_USB1_CHRG_DETECT_CLR 0x1b8
> +#define ANADIG_USB2_CHRG_DETECT_SET 0x214
> #define ANADIG_USB1_CHRG_DETECT_EN_B BIT(20)
> #define ANADIG_USB1_CHRG_DETECT_CHK_CHRG_B BIT(19)
> #define ANADIG_USB1_CHRG_DETECT_CHK_CONTACT BIT(18)
> @@ -250,6 +251,19 @@ static int mxs_phy_hw_init(struct mxs_phy *mxs_phy)
> if (mxs_phy->data->flags & MXS_PHY_NEED_IP_FIX)
> writel(BM_USBPHY_IP_FIX, base + HW_USBPHY_IP_SET);
>
> + if (mxs_phy->regmap_anatop) {
> + unsigned int reg = mxs_phy->port_id ?
> + ANADIG_USB1_CHRG_DETECT_SET :
> + ANADIG_USB2_CHRG_DETECT_SET;
> + /*
> + * The external charger detector needs to be disabled,
> + * or the signal at DP will be poor
> + */
> + regmap_write(mxs_phy->regmap_anatop, reg,
> + ANADIG_USB1_CHRG_DETECT_EN_B |
> + ANADIG_USB1_CHRG_DETECT_CHK_CHRG_B);
> + }
> +
> mxs_phy_tx_init(mxs_phy);
>
> return 0;
> --
> 2.21.0
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] usb: phy: mxs: Disable external charger detect in mxs_phy_hw_init()
2019-05-29 6:59 Andrey Smirnov
@ 2019-05-29 8:01 ` Peter Chen
2019-06-05 9:19 ` Shawn Guo
1 sibling, 0 replies; 4+ messages in thread
From: Peter Chen @ 2019-05-29 8:01 UTC (permalink / raw)
To: Andrey Smirnov
Cc: linux-usb, Chris Healy, Felipe Balbi, Shawn Guo, Fabio Estevam,
NXP Linux Team, linux-arm-kernel, lkml
On Wed, May 29, 2019 at 3:01 PM Andrey Smirnov <andrew.smirnov@gmail.com> wrote:
>
> Since this driver already handles changer detction state, copy the
> workaround code currently residing in arch/arm/mach-imx/anatop.c into
> this drier to consolidate the places modifying it.
>
> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
> Cc: Chris Healy <cphealy@gmail.com>
> Cc: Felipe Balbi <balbi@kernel.org>
> Cc: Shawn Guo <shawnguo@kernel.org>
> Cc: Fabio Estevam <festevam@gmail.com>
> Cc: NXP Linux Team <linux-imx@nxp.com>
> Cc: linux-usb@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-kernel@vger.kernel.org
> ---
>
> The intent of this patch is to consolidate all of the code maipulating
> charge detection state to a signle place and if this patch is agreed
> upon I plan to follow it up with this change:
>
> https://github.com/ndreys/linux/commit/7248f2b85b4706760fd33d2ff970e2ea12d3bea7
>
> Thanks,
> Andrey Smirnov
>
> drivers/usb/phy/phy-mxs-usb.c | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c
> index 1b1bb0ad40c3..6fa16ab31e2e 100644
> --- a/drivers/usb/phy/phy-mxs-usb.c
> +++ b/drivers/usb/phy/phy-mxs-usb.c
> @@ -63,6 +63,7 @@
>
> #define ANADIG_USB1_CHRG_DETECT_SET 0x1b4
> #define ANADIG_USB1_CHRG_DETECT_CLR 0x1b8
> +#define ANADIG_USB2_CHRG_DETECT_SET 0x214
> #define ANADIG_USB1_CHRG_DETECT_EN_B BIT(20)
> #define ANADIG_USB1_CHRG_DETECT_CHK_CHRG_B BIT(19)
> #define ANADIG_USB1_CHRG_DETECT_CHK_CONTACT BIT(18)
> @@ -250,6 +251,19 @@ static int mxs_phy_hw_init(struct mxs_phy *mxs_phy)
> if (mxs_phy->data->flags & MXS_PHY_NEED_IP_FIX)
> writel(BM_USBPHY_IP_FIX, base + HW_USBPHY_IP_SET);
>
> + if (mxs_phy->regmap_anatop) {
> + unsigned int reg = mxs_phy->port_id ?
> + ANADIG_USB1_CHRG_DETECT_SET :
> + ANADIG_USB2_CHRG_DETECT_SET;
> + /*
> + * The external charger detector needs to be disabled,
> + * or the signal at DP will be poor
> + */
> + regmap_write(mxs_phy->regmap_anatop, reg,
> + ANADIG_USB1_CHRG_DETECT_EN_B |
> + ANADIG_USB1_CHRG_DETECT_CHK_CHRG_B);
> + }
> +
> mxs_phy_tx_init(mxs_phy);
>
> return 0;
> --
> 2.21.0
>
Reviewed-by: Peter Chen <peter.chen@nxp.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] usb: phy: mxs: Disable external charger detect in mxs_phy_hw_init()
@ 2019-05-29 6:59 Andrey Smirnov
2019-05-29 8:01 ` Peter Chen
2019-06-05 9:19 ` Shawn Guo
0 siblings, 2 replies; 4+ messages in thread
From: Andrey Smirnov @ 2019-05-29 6:59 UTC (permalink / raw)
To: linux-usb
Cc: Andrey Smirnov, Chris Healy, Felipe Balbi, Shawn Guo,
Fabio Estevam, NXP Linux Team, linux-arm-kernel, linux-kernel
Since this driver already handles changer detction state, copy the
workaround code currently residing in arch/arm/mach-imx/anatop.c into
this drier to consolidate the places modifying it.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Cc: Chris Healy <cphealy@gmail.com>
Cc: Felipe Balbi <balbi@kernel.org>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: NXP Linux Team <linux-imx@nxp.com>
Cc: linux-usb@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
The intent of this patch is to consolidate all of the code maipulating
charge detection state to a signle place and if this patch is agreed
upon I plan to follow it up with this change:
https://github.com/ndreys/linux/commit/7248f2b85b4706760fd33d2ff970e2ea12d3bea7
Thanks,
Andrey Smirnov
drivers/usb/phy/phy-mxs-usb.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c
index 1b1bb0ad40c3..6fa16ab31e2e 100644
--- a/drivers/usb/phy/phy-mxs-usb.c
+++ b/drivers/usb/phy/phy-mxs-usb.c
@@ -63,6 +63,7 @@
#define ANADIG_USB1_CHRG_DETECT_SET 0x1b4
#define ANADIG_USB1_CHRG_DETECT_CLR 0x1b8
+#define ANADIG_USB2_CHRG_DETECT_SET 0x214
#define ANADIG_USB1_CHRG_DETECT_EN_B BIT(20)
#define ANADIG_USB1_CHRG_DETECT_CHK_CHRG_B BIT(19)
#define ANADIG_USB1_CHRG_DETECT_CHK_CONTACT BIT(18)
@@ -250,6 +251,19 @@ static int mxs_phy_hw_init(struct mxs_phy *mxs_phy)
if (mxs_phy->data->flags & MXS_PHY_NEED_IP_FIX)
writel(BM_USBPHY_IP_FIX, base + HW_USBPHY_IP_SET);
+ if (mxs_phy->regmap_anatop) {
+ unsigned int reg = mxs_phy->port_id ?
+ ANADIG_USB1_CHRG_DETECT_SET :
+ ANADIG_USB2_CHRG_DETECT_SET;
+ /*
+ * The external charger detector needs to be disabled,
+ * or the signal at DP will be poor
+ */
+ regmap_write(mxs_phy->regmap_anatop, reg,
+ ANADIG_USB1_CHRG_DETECT_EN_B |
+ ANADIG_USB1_CHRG_DETECT_CHK_CHRG_B);
+ }
+
mxs_phy_tx_init(mxs_phy);
return 0;
--
2.21.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-06-05 9:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-29 6:59 [PATCH] usb: phy: mxs: Disable external charger detect in mxs_phy_hw_init() Andrey Smirnov
2019-05-29 6:59 Andrey Smirnov
2019-05-29 8:01 ` Peter Chen
2019-06-05 9:19 ` Shawn Guo
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).