From: Felipe Balbi <balbi@kernel.org>
To: linux-samsung-soc@vger.kernel.org, linux-usb@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org
Cc: Andrzej Pietrasiewicz <andrzej.p@samsung.com>,
Marek Szyprowski <m.szyprowski@samsung.com>,
Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
Krzysztof Kozlowski <krzk@kernel.org>,
Kukjin Kim <kgene@kernel.org>,
Russell King <linux@armlinux.org.uk>,
Mark Rutland <mark.rutland@arm.com>,
Rob Herring <robh+dt@kernel.org>,
Kishon Vijay Abraham I <kishon@ti.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: [PATCH 2/2] phy: exynos5-usbdrd: Calibrate LOS levels for exynos5420/5800
Date: Mon, 18 Sep 2017 13:38:21 +0300 [thread overview]
Message-ID: <87y3pcmgv6.fsf@linux.intel.com> (raw)
In-Reply-To: <1505729371-6509-1-git-send-email-andrzej.p@samsung.com>
[-- Attachment #1: Type: text/plain, Size: 9167 bytes --]
Hi,
Andrzej Pietrasiewicz <andrzej.p@samsung.com> writes:
> From: Vivek Gautam <gautam.vivek@samsung.com>
>
> Adding phy calibration sequence for USB 3.0 DRD PHY present on
> Exynos5420/5800 systems.
> This calibration facilitates setting certain PHY parameters viz.
> the Loss-of-Signal (LOS) Detector Threshold Level, as well as
> Tx-Vboost-Level for Super-Speed operations.
> Additionally we also set proper time to wait for RxDetect measurement,
> for desired PHY reference clock, so as to solve issue with enumeration
> of few USB 3.0 devices, like Samsung SUM-TSB16S 3.0 USB drive
> on the controller.
>
> We are using CR_port for this purpose to send required data
> to override the LOS values.
>
> On testing with USB 3.0 devices on USB 3.0 port present on
> SMDK5420, and peach-pit boards should see following message:
> usb 2-1: new SuperSpeed USB device number 2 using xhci-hcd
>
> and without this patch, should see below shown message:
> usb 1-1: new high-speed USB device number 2 using xhci-hcd
>
> [Also removed unnecessary extra lines in the register macro definitions]
>
> Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
> [adapted to use phy_reset as entry point]
> Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
> ---
> drivers/phy/samsung/phy-exynos5-usbdrd.c | 183 +++++++++++++++++++++++++++++++
> drivers/usb/dwc3/core.c | 8 +-
> 2 files changed, 189 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/phy/samsung/phy-exynos5-usbdrd.c b/drivers/phy/samsung/phy-exynos5-usbdrd.c
> index 7c41daa..f7de067 100644
> --- a/drivers/phy/samsung/phy-exynos5-usbdrd.c
> +++ b/drivers/phy/samsung/phy-exynos5-usbdrd.c
> @@ -89,7 +89,17 @@
> #define PHYCLKRST_COMMONONN BIT(0)
>
> #define EXYNOS5_DRD_PHYREG0 0x14
> +#define PHYREG0_SSC_REF_CLK_SEL BIT(21)
> +#define PHYREG0_SSC_RANGE BIT(20)
> +#define PHYREG0_CR_WRITE BIT(19)
> +#define PHYREG0_CR_READ BIT(18)
> +#define PHYREG0_CR_DATA_IN(_x) ((_x) << 2)
> +#define PHYREG0_CR_CAP_DATA BIT(1)
> +#define PHYREG0_CR_CAP_ADDR BIT(0)
> +
> #define EXYNOS5_DRD_PHYREG1 0x18
> +#define PHYREG1_CR_DATA_OUT(_x) ((_x) << 1)
> +#define PHYREG1_CR_ACK BIT(0)
>
> #define EXYNOS5_DRD_PHYPARAM0 0x1c
>
> @@ -118,6 +128,25 @@
> #define EXYNOS5_DRD_PHYRESUME 0x34
> #define EXYNOS5_DRD_LINKPORT 0x44
>
> +/* USB 3.0 DRD PHY SS Function Control Reg; accessed by CR_PORT */
> +#define EXYNOS5_DRD_PHYSS_LOSLEVEL_OVRD_IN (0x15)
> +#define LOSLEVEL_OVRD_IN_LOS_BIAS_5420 (0x5 << 13)
> +#define LOSLEVEL_OVRD_IN_LOS_BIAS_DEFAULT (0x0 << 13)
> +#define LOSLEVEL_OVRD_IN_EN (0x1 << 10)
> +#define LOSLEVEL_OVRD_IN_LOS_LEVEL_DEFAULT (0x9 << 0)
> +
> +#define EXYNOS5_DRD_PHYSS_TX_VBOOSTLEVEL_OVRD_IN (0x12)
> +#define TX_VBOOSTLEVEL_OVRD_IN_VBOOST_5420 (0x5 << 13)
> +#define TX_VBOOSTLEVEL_OVRD_IN_VBOOST_DEFAULT (0x4 << 13)
> +
> +#define EXYNOS5_DRD_PHYSS_LANE0_TX_DEBUG (0x1010)
> +#define LANE0_TX_DEBUG_RXDET_MEAS_TIME_19M2_20M (0x4 << 4)
> +#define LANE0_TX_DEBUG_RXDET_MEAS_TIME_24M (0x8 << 4)
> +#define LANE0_TX_DEBUG_RXDET_MEAS_TIME_25M_26M (0x8 << 4)
> +#define LANE0_TX_DEBUG_RXDET_MEAS_TIME_48M_50M_52M (0x20 << 4)
> +#define LANE0_TX_DEBUG_RXDET_MEAS_TIME_62M5 (0x20 << 4)
> +#define LANE0_TX_DEBUG_RXDET_MEAS_TIME_96M_100M (0x40 << 4)
> +
> #define KHZ 1000
> #define MHZ (KHZ * KHZ)
>
> @@ -526,6 +555,151 @@ static int exynos5_usbdrd_phy_power_off(struct phy *phy)
> return 0;
> }
>
> +static int crport_handshake(struct exynos5_usbdrd_phy *phy_drd,
> + u32 val, u32 cmd)
> +{
> + u32 usec = 100;
> + unsigned int result;
> +
> + writel(val | cmd, phy_drd->reg_phy + EXYNOS5_DRD_PHYREG0);
> +
> + do {
> + result = readl(phy_drd->reg_phy + EXYNOS5_DRD_PHYREG1);
> + if (result & PHYREG1_CR_ACK)
> + break;
> +
> + udelay(1);
> + } while (usec-- > 0);
> +
> + if (!usec) {
> + dev_err(phy_drd->dev,
> + "CRPORT handshake timeout1 (0x%08x)\n", val);
> + return -ETIME;
> + }
> +
> + usec = 100;
> +
> + writel(val, phy_drd->reg_phy + EXYNOS5_DRD_PHYREG0);
> +
> + do {
> + result = readl(phy_drd->reg_phy + EXYNOS5_DRD_PHYREG1);
> + if (!(result & PHYREG1_CR_ACK))
> + break;
> +
> + udelay(1);
> + } while (usec-- > 0);
> +
> + if (!usec) {
> + dev_err(phy_drd->dev,
> + "CRPORT handshake timeout2 (0x%08x)\n", val);
> + return -ETIME;
> + }
> +
> + return 0;
> +}
> +
> +static int crport_ctrl_write(struct exynos5_usbdrd_phy *phy_drd,
> + u32 addr, u32 data)
> +{
> + int ret;
> +
> + /* Write Address */
> + writel(PHYREG0_CR_DATA_IN(addr),
> + phy_drd->reg_phy + EXYNOS5_DRD_PHYREG0);
> + ret = crport_handshake(phy_drd, PHYREG0_CR_DATA_IN(addr),
> + PHYREG0_CR_CAP_ADDR);
> + if (ret)
> + return ret;
> +
> + /* Write Data */
> + writel(PHYREG0_CR_DATA_IN(data),
> + phy_drd->reg_phy + EXYNOS5_DRD_PHYREG0);
> + ret = crport_handshake(phy_drd, PHYREG0_CR_DATA_IN(data),
> + PHYREG0_CR_CAP_DATA);
> + if (ret)
> + return ret;
> +
> + ret = crport_handshake(phy_drd, PHYREG0_CR_DATA_IN(data),
> + PHYREG0_CR_WRITE);
> +
> + return ret;
> +}
> +
> +/*
> + * Calibrate few PHY parameters using CR_PORT register to meet
> + * SuperSpeed requirements on Exynos5420 and Exynos5800 systems,
> + * which have 28nm USB 3.0 DRD PHY.
> + */
> +static int exynos5420_usbdrd_phy_calibrate(struct exynos5_usbdrd_phy *phy_drd)
> +{
> + unsigned int temp;
> + int ret = 0;
> +
> + /*
> + * Change los_bias to (0x5) for 28nm PHY from a
> + * default value (0x0); los_level is set as default
> + * (0x9) as also reflected in los_level[30:26] bits
> + * of PHYPARAM0 register.
> + */
> + temp = LOSLEVEL_OVRD_IN_LOS_BIAS_5420 |
> + LOSLEVEL_OVRD_IN_EN |
> + LOSLEVEL_OVRD_IN_LOS_LEVEL_DEFAULT;
> + ret = crport_ctrl_write(phy_drd,
> + EXYNOS5_DRD_PHYSS_LOSLEVEL_OVRD_IN,
> + temp);
> + if (ret) {
> + dev_err(phy_drd->dev,
> + "Failed setting Loss-of-Signal level for SuperSpeed\n");
> + return ret;
> + }
> +
> + /*
> + * Set tx_vboost_lvl to (0x5) for 28nm PHY Tuning,
> + * to raise Tx signal level from its default value of (0x4)
> + */
> + temp = TX_VBOOSTLEVEL_OVRD_IN_VBOOST_5420;
> + ret = crport_ctrl_write(phy_drd,
> + EXYNOS5_DRD_PHYSS_TX_VBOOSTLEVEL_OVRD_IN,
> + temp);
> + if (ret) {
> + dev_err(phy_drd->dev,
> + "Failed setting Tx-Vboost-Level for SuperSpeed\n");
> + return ret;
> + }
> +
> + /*
> + * Set proper time to wait for RxDetect measurement, for
> + * desired reference clock of PHY, by tuning the CR_PORT
> + * register LANE0.TX_DEBUG which is internal to PHY.
> + * This fixes issue with few USB 3.0 devices, which are
> + * not detected (not even generate interrupts on the bus
> + * on insertion) without this change.
> + * e.g. Samsung SUM-TSB16S 3.0 USB drive.
> + */
> + switch (phy_drd->extrefclk) {
> + case EXYNOS5_FSEL_50MHZ:
> + temp = LANE0_TX_DEBUG_RXDET_MEAS_TIME_48M_50M_52M;
> + break;
> + case EXYNOS5_FSEL_20MHZ:
> + case EXYNOS5_FSEL_19MHZ2:
> + temp = LANE0_TX_DEBUG_RXDET_MEAS_TIME_19M2_20M;
> + break;
> + case EXYNOS5_FSEL_24MHZ:
> + default:
> + temp = LANE0_TX_DEBUG_RXDET_MEAS_TIME_24M;
> + break;
> + }
> +
> + ret = crport_ctrl_write(phy_drd,
> + EXYNOS5_DRD_PHYSS_LANE0_TX_DEBUG,
> + temp);
> + if (ret)
> + dev_err(phy_drd->dev,
> + "Failed setting RxDetect measurement time for SuperSpeed\n");
> +
> + return ret;
> +}
> +
> static struct phy *exynos5_usbdrd_phy_xlate(struct device *dev,
> struct of_phandle_args *args)
> {
> @@ -537,11 +711,20 @@ static struct phy *exynos5_usbdrd_phy_xlate(struct device *dev,
> return phy_drd->phys[args->args[0]].phy;
> }
>
> +static int exynos5_usbdrd_phy_reset(struct phy *phy)
> +{
> + struct phy_usb_instance *inst = phy_get_drvdata(phy);
> + struct exynos5_usbdrd_phy *phy_drd = to_usbdrd_phy(inst);
> +
> + return exynos5420_usbdrd_phy_calibrate(phy_drd);
> +}
> +
> static const struct phy_ops exynos5_usbdrd_phy_ops = {
> .init = exynos5_usbdrd_phy_init,
> .exit = exynos5_usbdrd_phy_exit,
> .power_on = exynos5_usbdrd_phy_power_on,
> .power_off = exynos5_usbdrd_phy_power_off,
> + .reset = exynos5_usbdrd_phy_reset,
> .owner = THIS_MODULE,
> };
>
> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> index 03474d3..1d5836e 100644
> --- a/drivers/usb/dwc3/core.c
> +++ b/drivers/usb/dwc3/core.c
> @@ -156,9 +156,10 @@ static void __dwc3_set_mode(struct work_struct *work)
> } else {
> if (dwc->usb2_phy)
> otg_set_vbus(dwc->usb2_phy->otg, true);
> - if (dwc->usb2_generic_phy)
> + if (dwc->usb2_generic_phy) {
> phy_set_mode(dwc->usb2_generic_phy, PHY_MODE_USB_HOST);
> -
> + phy_reset(dwc->usb2_generic_phy);
it doesn't look like this is the best place to reset the phy. Also,
->reset() doesn't seem to match correctly with a calibration. That seems
to be more fitting to a ->power_on() or ->init() implementation.
Kishon, any comments?
--
balbi
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: balbi@kernel.org (Felipe Balbi)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] phy: exynos5-usbdrd: Calibrate LOS levels for exynos5420/5800
Date: Mon, 18 Sep 2017 13:38:21 +0300 [thread overview]
Message-ID: <87y3pcmgv6.fsf@linux.intel.com> (raw)
In-Reply-To: <1505729371-6509-1-git-send-email-andrzej.p@samsung.com>
Hi,
Andrzej Pietrasiewicz <andrzej.p@samsung.com> writes:
> From: Vivek Gautam <gautam.vivek@samsung.com>
>
> Adding phy calibration sequence for USB 3.0 DRD PHY present on
> Exynos5420/5800 systems.
> This calibration facilitates setting certain PHY parameters viz.
> the Loss-of-Signal (LOS) Detector Threshold Level, as well as
> Tx-Vboost-Level for Super-Speed operations.
> Additionally we also set proper time to wait for RxDetect measurement,
> for desired PHY reference clock, so as to solve issue with enumeration
> of few USB 3.0 devices, like Samsung SUM-TSB16S 3.0 USB drive
> on the controller.
>
> We are using CR_port for this purpose to send required data
> to override the LOS values.
>
> On testing with USB 3.0 devices on USB 3.0 port present on
> SMDK5420, and peach-pit boards should see following message:
> usb 2-1: new SuperSpeed USB device number 2 using xhci-hcd
>
> and without this patch, should see below shown message:
> usb 1-1: new high-speed USB device number 2 using xhci-hcd
>
> [Also removed unnecessary extra lines in the register macro definitions]
>
> Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
> [adapted to use phy_reset as entry point]
> Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
> ---
> drivers/phy/samsung/phy-exynos5-usbdrd.c | 183 +++++++++++++++++++++++++++++++
> drivers/usb/dwc3/core.c | 8 +-
> 2 files changed, 189 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/phy/samsung/phy-exynos5-usbdrd.c b/drivers/phy/samsung/phy-exynos5-usbdrd.c
> index 7c41daa..f7de067 100644
> --- a/drivers/phy/samsung/phy-exynos5-usbdrd.c
> +++ b/drivers/phy/samsung/phy-exynos5-usbdrd.c
> @@ -89,7 +89,17 @@
> #define PHYCLKRST_COMMONONN BIT(0)
>
> #define EXYNOS5_DRD_PHYREG0 0x14
> +#define PHYREG0_SSC_REF_CLK_SEL BIT(21)
> +#define PHYREG0_SSC_RANGE BIT(20)
> +#define PHYREG0_CR_WRITE BIT(19)
> +#define PHYREG0_CR_READ BIT(18)
> +#define PHYREG0_CR_DATA_IN(_x) ((_x) << 2)
> +#define PHYREG0_CR_CAP_DATA BIT(1)
> +#define PHYREG0_CR_CAP_ADDR BIT(0)
> +
> #define EXYNOS5_DRD_PHYREG1 0x18
> +#define PHYREG1_CR_DATA_OUT(_x) ((_x) << 1)
> +#define PHYREG1_CR_ACK BIT(0)
>
> #define EXYNOS5_DRD_PHYPARAM0 0x1c
>
> @@ -118,6 +128,25 @@
> #define EXYNOS5_DRD_PHYRESUME 0x34
> #define EXYNOS5_DRD_LINKPORT 0x44
>
> +/* USB 3.0 DRD PHY SS Function Control Reg; accessed by CR_PORT */
> +#define EXYNOS5_DRD_PHYSS_LOSLEVEL_OVRD_IN (0x15)
> +#define LOSLEVEL_OVRD_IN_LOS_BIAS_5420 (0x5 << 13)
> +#define LOSLEVEL_OVRD_IN_LOS_BIAS_DEFAULT (0x0 << 13)
> +#define LOSLEVEL_OVRD_IN_EN (0x1 << 10)
> +#define LOSLEVEL_OVRD_IN_LOS_LEVEL_DEFAULT (0x9 << 0)
> +
> +#define EXYNOS5_DRD_PHYSS_TX_VBOOSTLEVEL_OVRD_IN (0x12)
> +#define TX_VBOOSTLEVEL_OVRD_IN_VBOOST_5420 (0x5 << 13)
> +#define TX_VBOOSTLEVEL_OVRD_IN_VBOOST_DEFAULT (0x4 << 13)
> +
> +#define EXYNOS5_DRD_PHYSS_LANE0_TX_DEBUG (0x1010)
> +#define LANE0_TX_DEBUG_RXDET_MEAS_TIME_19M2_20M (0x4 << 4)
> +#define LANE0_TX_DEBUG_RXDET_MEAS_TIME_24M (0x8 << 4)
> +#define LANE0_TX_DEBUG_RXDET_MEAS_TIME_25M_26M (0x8 << 4)
> +#define LANE0_TX_DEBUG_RXDET_MEAS_TIME_48M_50M_52M (0x20 << 4)
> +#define LANE0_TX_DEBUG_RXDET_MEAS_TIME_62M5 (0x20 << 4)
> +#define LANE0_TX_DEBUG_RXDET_MEAS_TIME_96M_100M (0x40 << 4)
> +
> #define KHZ 1000
> #define MHZ (KHZ * KHZ)
>
> @@ -526,6 +555,151 @@ static int exynos5_usbdrd_phy_power_off(struct phy *phy)
> return 0;
> }
>
> +static int crport_handshake(struct exynos5_usbdrd_phy *phy_drd,
> + u32 val, u32 cmd)
> +{
> + u32 usec = 100;
> + unsigned int result;
> +
> + writel(val | cmd, phy_drd->reg_phy + EXYNOS5_DRD_PHYREG0);
> +
> + do {
> + result = readl(phy_drd->reg_phy + EXYNOS5_DRD_PHYREG1);
> + if (result & PHYREG1_CR_ACK)
> + break;
> +
> + udelay(1);
> + } while (usec-- > 0);
> +
> + if (!usec) {
> + dev_err(phy_drd->dev,
> + "CRPORT handshake timeout1 (0x%08x)\n", val);
> + return -ETIME;
> + }
> +
> + usec = 100;
> +
> + writel(val, phy_drd->reg_phy + EXYNOS5_DRD_PHYREG0);
> +
> + do {
> + result = readl(phy_drd->reg_phy + EXYNOS5_DRD_PHYREG1);
> + if (!(result & PHYREG1_CR_ACK))
> + break;
> +
> + udelay(1);
> + } while (usec-- > 0);
> +
> + if (!usec) {
> + dev_err(phy_drd->dev,
> + "CRPORT handshake timeout2 (0x%08x)\n", val);
> + return -ETIME;
> + }
> +
> + return 0;
> +}
> +
> +static int crport_ctrl_write(struct exynos5_usbdrd_phy *phy_drd,
> + u32 addr, u32 data)
> +{
> + int ret;
> +
> + /* Write Address */
> + writel(PHYREG0_CR_DATA_IN(addr),
> + phy_drd->reg_phy + EXYNOS5_DRD_PHYREG0);
> + ret = crport_handshake(phy_drd, PHYREG0_CR_DATA_IN(addr),
> + PHYREG0_CR_CAP_ADDR);
> + if (ret)
> + return ret;
> +
> + /* Write Data */
> + writel(PHYREG0_CR_DATA_IN(data),
> + phy_drd->reg_phy + EXYNOS5_DRD_PHYREG0);
> + ret = crport_handshake(phy_drd, PHYREG0_CR_DATA_IN(data),
> + PHYREG0_CR_CAP_DATA);
> + if (ret)
> + return ret;
> +
> + ret = crport_handshake(phy_drd, PHYREG0_CR_DATA_IN(data),
> + PHYREG0_CR_WRITE);
> +
> + return ret;
> +}
> +
> +/*
> + * Calibrate few PHY parameters using CR_PORT register to meet
> + * SuperSpeed requirements on Exynos5420 and Exynos5800 systems,
> + * which have 28nm USB 3.0 DRD PHY.
> + */
> +static int exynos5420_usbdrd_phy_calibrate(struct exynos5_usbdrd_phy *phy_drd)
> +{
> + unsigned int temp;
> + int ret = 0;
> +
> + /*
> + * Change los_bias to (0x5) for 28nm PHY from a
> + * default value (0x0); los_level is set as default
> + * (0x9) as also reflected in los_level[30:26] bits
> + * of PHYPARAM0 register.
> + */
> + temp = LOSLEVEL_OVRD_IN_LOS_BIAS_5420 |
> + LOSLEVEL_OVRD_IN_EN |
> + LOSLEVEL_OVRD_IN_LOS_LEVEL_DEFAULT;
> + ret = crport_ctrl_write(phy_drd,
> + EXYNOS5_DRD_PHYSS_LOSLEVEL_OVRD_IN,
> + temp);
> + if (ret) {
> + dev_err(phy_drd->dev,
> + "Failed setting Loss-of-Signal level for SuperSpeed\n");
> + return ret;
> + }
> +
> + /*
> + * Set tx_vboost_lvl to (0x5) for 28nm PHY Tuning,
> + * to raise Tx signal level from its default value of (0x4)
> + */
> + temp = TX_VBOOSTLEVEL_OVRD_IN_VBOOST_5420;
> + ret = crport_ctrl_write(phy_drd,
> + EXYNOS5_DRD_PHYSS_TX_VBOOSTLEVEL_OVRD_IN,
> + temp);
> + if (ret) {
> + dev_err(phy_drd->dev,
> + "Failed setting Tx-Vboost-Level for SuperSpeed\n");
> + return ret;
> + }
> +
> + /*
> + * Set proper time to wait for RxDetect measurement, for
> + * desired reference clock of PHY, by tuning the CR_PORT
> + * register LANE0.TX_DEBUG which is internal to PHY.
> + * This fixes issue with few USB 3.0 devices, which are
> + * not detected (not even generate interrupts on the bus
> + * on insertion) without this change.
> + * e.g. Samsung SUM-TSB16S 3.0 USB drive.
> + */
> + switch (phy_drd->extrefclk) {
> + case EXYNOS5_FSEL_50MHZ:
> + temp = LANE0_TX_DEBUG_RXDET_MEAS_TIME_48M_50M_52M;
> + break;
> + case EXYNOS5_FSEL_20MHZ:
> + case EXYNOS5_FSEL_19MHZ2:
> + temp = LANE0_TX_DEBUG_RXDET_MEAS_TIME_19M2_20M;
> + break;
> + case EXYNOS5_FSEL_24MHZ:
> + default:
> + temp = LANE0_TX_DEBUG_RXDET_MEAS_TIME_24M;
> + break;
> + }
> +
> + ret = crport_ctrl_write(phy_drd,
> + EXYNOS5_DRD_PHYSS_LANE0_TX_DEBUG,
> + temp);
> + if (ret)
> + dev_err(phy_drd->dev,
> + "Failed setting RxDetect measurement time for SuperSpeed\n");
> +
> + return ret;
> +}
> +
> static struct phy *exynos5_usbdrd_phy_xlate(struct device *dev,
> struct of_phandle_args *args)
> {
> @@ -537,11 +711,20 @@ static struct phy *exynos5_usbdrd_phy_xlate(struct device *dev,
> return phy_drd->phys[args->args[0]].phy;
> }
>
> +static int exynos5_usbdrd_phy_reset(struct phy *phy)
> +{
> + struct phy_usb_instance *inst = phy_get_drvdata(phy);
> + struct exynos5_usbdrd_phy *phy_drd = to_usbdrd_phy(inst);
> +
> + return exynos5420_usbdrd_phy_calibrate(phy_drd);
> +}
> +
> static const struct phy_ops exynos5_usbdrd_phy_ops = {
> .init = exynos5_usbdrd_phy_init,
> .exit = exynos5_usbdrd_phy_exit,
> .power_on = exynos5_usbdrd_phy_power_on,
> .power_off = exynos5_usbdrd_phy_power_off,
> + .reset = exynos5_usbdrd_phy_reset,
> .owner = THIS_MODULE,
> };
>
> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> index 03474d3..1d5836e 100644
> --- a/drivers/usb/dwc3/core.c
> +++ b/drivers/usb/dwc3/core.c
> @@ -156,9 +156,10 @@ static void __dwc3_set_mode(struct work_struct *work)
> } else {
> if (dwc->usb2_phy)
> otg_set_vbus(dwc->usb2_phy->otg, true);
> - if (dwc->usb2_generic_phy)
> + if (dwc->usb2_generic_phy) {
> phy_set_mode(dwc->usb2_generic_phy, PHY_MODE_USB_HOST);
> -
> + phy_reset(dwc->usb2_generic_phy);
it doesn't look like this is the best place to reset the phy. Also,
->reset() doesn't seem to match correctly with a calibration. That seems
to be more fitting to a ->power_on() or ->init() implementation.
Kishon, any comments?
--
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170918/bea0884f/attachment-0001.sig>
next prev parent reply other threads:[~2017-09-18 10:38 UTC|newest]
Thread overview: 66+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20170918100229eucas1p24733d7108dfbcf16a59476c1efd7d56a@eucas1p2.samsung.com>
2017-09-18 10:02 ` [PATCH 0/2] dwc3 on XU3 and XU4 Andrzej Pietrasiewicz
2017-09-18 10:02 ` Andrzej Pietrasiewicz
[not found] ` <CGME20170918100230eucas1p29fae00c53f1106af1961a6e269740b2f@eucas1p2.samsung.com>
[not found] ` <1505728934-6200-1-git-send-email-andrzej.p-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2017-09-18 10:02 ` [PATCH 1/2] ARM: dts: exynos: Add dwc3 SUSPHY quirk Andrzej Pietrasiewicz
2017-09-18 10:02 ` Andrzej Pietrasiewicz
2017-09-19 17:40 ` Krzysztof Kozlowski
2017-09-19 17:40 ` Krzysztof Kozlowski
2017-09-19 18:10 ` Robin Murphy
2017-09-19 18:10 ` Robin Murphy
2017-09-22 8:18 ` Andrzej Pietrasiewicz
2017-09-22 8:18 ` Andrzej Pietrasiewicz
2017-09-25 18:49 ` Krzysztof Kozlowski
2017-09-25 18:49 ` Krzysztof Kozlowski
2017-09-18 10:09 ` [PATCH 2/2] phy: exynos5-usbdrd: Calibrate LOS levels for exynos5420/5800 Andrzej Pietrasiewicz
2017-09-18 10:09 ` Andrzej Pietrasiewicz
2017-09-18 10:38 ` Felipe Balbi [this message]
2017-09-18 10:38 ` Felipe Balbi
[not found] ` <87y3pcmgv6.fsf-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-09-18 11:06 ` Kishon Vijay Abraham I
2017-09-18 11:06 ` Kishon Vijay Abraham I
2017-09-18 11:27 ` Andrzej Pietrasiewicz
2017-09-18 11:27 ` Andrzej Pietrasiewicz
2017-09-18 11:41 ` Andrzej Pietrasiewicz
2017-09-18 11:41 ` Andrzej Pietrasiewicz
[not found] ` <5c90f022-5cb1-c746-6015-c93a58805cfe-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2017-09-18 12:43 ` Felipe Balbi
2017-09-18 12:43 ` Felipe Balbi
[not found] ` <87vakgmb24.fsf-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-09-18 14:20 ` Andrzej Pietrasiewicz
2017-09-18 14:20 ` Andrzej Pietrasiewicz
[not found] ` <7d87727a-e65e-f25b-0cdc-fe6ff0b7bb90-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2017-09-21 11:07 ` Kishon Vijay Abraham I
2017-09-21 11:07 ` Kishon Vijay Abraham I
[not found] ` <CGME20171003125944eucas1p1fad23e6171786fda69ccd9419354911b@eucas1p1.samsung.com>
[not found] ` <ba580a0c-36c3-b227-61ee-97637532823e-l0cyMroinI0@public.gmane.org>
2017-10-03 12:59 ` [PATCHv2 0/2] Andrzej Pietrasiewicz
2017-10-03 12:59 ` Andrzej Pietrasiewicz
[not found] ` <CGME20171003125945eucas1p24d49f5c51ea9acd59a76314158b69352@eucas1p2.samsung.com>
[not found] ` <1507035578-24945-1-git-send-email-andrzej.p-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2017-10-03 12:59 ` [PATCHv2 1/2] drivers: phy: add calibrate method Andrzej Pietrasiewicz
2017-10-03 12:59 ` Andrzej Pietrasiewicz
2017-10-03 12:59 ` [PATCHv2 2/2] phy: exynos5-usbdrd: Calibrate LOS levels for exynos5420/5800 Andrzej Pietrasiewicz
2017-10-03 12:59 ` Andrzej Pietrasiewicz
[not found] ` <1507035578-24945-3-git-send-email-andrzej.p-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2017-10-05 8:00 ` kbuild test robot
2017-10-05 8:00 ` kbuild test robot
2017-10-03 13:19 ` [PATCHv2 0/2] Andrzej Pietrasiewicz
2017-10-03 13:19 ` Andrzej Pietrasiewicz
2017-10-04 4:22 ` Kishon Vijay Abraham I
2017-10-04 4:22 ` Kishon Vijay Abraham I
[not found] ` <b9aad201-78b9-f04b-238d-5297e6096ee7-l0cyMroinI0@public.gmane.org>
2017-10-04 7:05 ` [PATCHv2 0/2] dwc3 on XU3 Andrzej Pietrasiewicz
2017-10-04 7:05 ` Andrzej Pietrasiewicz
[not found] ` <CGME20171005121201eucas1p2d8e7c3bf18b24ffaa0bf9593dcffe37e@eucas1p2.samsung.com>
[not found] ` <6935498c-9788-14e6-844f-f9e8288026dc-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2017-10-05 12:11 ` [PATCHv3 " Andrzej Pietrasiewicz
2017-10-05 12:11 ` Andrzej Pietrasiewicz
[not found] ` <CGME20171005121201eucas1p269da2155c4257777b0c3a5b210c651f8@eucas1p2.samsung.com>
[not found] ` <1507205511-23048-1-git-send-email-andrzej.p-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2017-10-05 12:11 ` [PATCHv3 1/2] drivers: phy: add calibrate method Andrzej Pietrasiewicz
2017-10-05 12:11 ` Andrzej Pietrasiewicz
[not found] ` <1507205511-23048-2-git-send-email-andrzej.p-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2017-10-09 10:15 ` Kishon Vijay Abraham I
2017-10-09 10:15 ` Kishon Vijay Abraham I
[not found] ` <CGME20171009120100eucas1p2400a1ee4a7c70eed37c653de780b715d@eucas1p2.samsung.com>
[not found] ` <6de8a17a-745b-0fa2-c39d-cdeb28fc9489-l0cyMroinI0@public.gmane.org>
2017-10-09 12:00 ` [PATCHv4 0/2] dwc3 on XU3 Andrzej Pietrasiewicz
2017-10-09 12:00 ` Andrzej Pietrasiewicz
2017-10-09 12:00 ` [PATCHv4 1/2] drivers: phy: add calibrate method Andrzej Pietrasiewicz
2017-10-09 12:00 ` Andrzej Pietrasiewicz
2017-10-09 12:00 ` [PATCHv4 2/2] phy: exynos5-usbdrd: Calibrate LOS levels for exynos5420/5800 Andrzej Pietrasiewicz
2017-10-09 12:00 ` Andrzej Pietrasiewicz
2017-10-25 11:20 ` Kishon Vijay Abraham I
2017-10-25 11:20 ` Kishon Vijay Abraham I
[not found] ` <fca01b97-eea1-cc6f-9c12-fa8d9e55d980-l0cyMroinI0@public.gmane.org>
2017-10-25 12:46 ` Felipe Balbi
2017-10-25 12:46 ` Felipe Balbi
2017-10-18 12:47 ` [PATCHv4 0/2] dwc3 on XU3 Kishon Vijay Abraham I
2017-10-18 12:47 ` Kishon Vijay Abraham I
2017-10-05 12:11 ` [PATCHv3 2/2] phy: exynos5-usbdrd: Calibrate LOS levels for exynos5420/5800 Andrzej Pietrasiewicz
2017-10-05 12:11 ` Andrzej Pietrasiewicz
[not found] ` <1507205511-23048-3-git-send-email-andrzej.p-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2017-10-05 12:28 ` Sylwester Nawrocki
2017-10-05 12:28 ` Sylwester Nawrocki
2017-09-18 11:19 ` [PATCH 0/2] dwc3 on XU3 and XU4 Anand Moon
2017-09-18 11:19 ` 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=87y3pcmgv6.fsf@linux.intel.com \
--to=balbi@kernel.org \
--cc=andrzej.p@samsung.com \
--cc=b.zolnierkie@samsung.com \
--cc=devicetree@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=kgene@kernel.org \
--cc=kishon@ti.com \
--cc=krzk@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=m.szyprowski@samsung.com \
--cc=mark.rutland@arm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.