usb: phy: msm: Fixes, cleanups and DT support
Subsystems (5)
v4 cover usb: phy: msm: Fixes, cleanups and DT support
From: "Ivan T. Ivanov" <[email protected]>
Hi,
Patches have been tested on top of Stephen's clock controller patches[1] and recent fixes for chipidea msm glue layer driver posted here[2]. Hardware platform AP8074 DragonBoard. Only gadget mode utilized for now.
CV Test Suite engine "Chapter 9 tests" are passing except "Halt Endpoint Test".
usbtest driver report following failure:
test 13 --> 32 (Broken pipe) ep 81 couldn't set halt, -32
This will be investigated further.
Patches could be applied cleanly on top of the usb-3.13-rc1.
Regards,
Ivan
[1] http://comments.gmane.org/gmane.linux.ports.arm.msm/5375
[2] https://lkml.org/lkml/2013/11/11/310
v4
Signature · 63 lines
* Squashed checkpatch.pl warning fixes patches
* Squashed dr_mode refactoring with default mode removal
* Dropped patch 10 - usb: phy: msm: Switch clock consumer strings
* Fixed comments from review.
* Utilize reset-framework for LINK and PHY resets if DT is used.
* Added support from second PHY device control.
* Ported reset procedure from codeaurora tree for new chipsets
v3
--
* In patch 1 - functions for reseting PHY and LINK controller just
call platform code if available.
* New stuff is: cleaning up unneeded/unused driver state variables
* Simplified regulator names. There is no references to these names
in tree, so there should not be a problem with this.
* Replace the USB specific clock names with the more standard 'core'
and 'iface' ... names.
* Added devicetree support
v2
--
* Fix compilation issue in patch 1
* Separate regulator changes
* Merge devm_ related changes to one commit
* Drop Lindent patch
v1
--
Following patches make initial cleanup of usb phy found in the Qualcomm
chipsets. Changes include:
* Build time error fix.
* Move driver to Managed Device Resource allocation.
* Checkpatch warnings and error fixes
* Removed usage of global regulators variables.
Ivan T. Ivanov (15):
usb: phy: msm: Move mach dependent code to platform data
usb: phy: msm: Move global regulators variables to driver state
usb: phy: msm: Migrate to Managed Device Resource allocation
usb: phy: msm: Remove unnecessarily check for valid regulators.
usb: phy: msm: Fix checkpatch.pl warnings
usb: phy: msm: Replace custom enum usb_mode_type with enum
usb_dr_mode
usb: phy: msm: Remove unused pclk_src_name
usb: phy: msm: Remove HSUSB prefix from regulator names
usb: phy: msm: Properly check result from platform_get_irq()
usb: phy: msm: Add device tree support and binding information
usb: phy: msm: Use reset framework for LINK and PHY resets
usb: phy: msm: Add support for secondary PHY control
usb: phy: msm: Correct USB PHY Reset sequence for newer platform
usb: phy: msm: Handle disconnect events
usb: phy: msm: Vote for corner of VDD CX instead of voltage of VDD CX
.../devicetree/bindings/usb/msm-hsusb.txt | 78 ++-
arch/arm/mach-msm/board-msm7x30.c | 37 +-
arch/arm/mach-msm/board-qsd8x50.c | 37 +-
drivers/usb/phy/phy-msm-usb.c | 664 +++++++++++---------
include/linux/usb/msm_hsusb.h | 36 +-
include/linux/usb/msm_hsusb_hw.h | 6 +
6 files changed, 529 insertions(+), 329 deletions(-)
--
1.7.9.5PATCH v4 1/15 usb: phy: msm: Move mach dependent code to platform data
From: "Ivan T. Ivanov" <[email protected]>
This patch fix compilation error when driver is compiled in multi-platform builds.
drivers/built-in.o: In function `msm_otg_link_clk_reset':./drivers/usb/phy/phy-msm-usb.c:314: undefined reference to clk_reset' ./drivers/usb/phy/phy-msm-usb.c:318: undefined reference to clk_reset'
Use platform data supplied reset handlers and adjust error messages reported when reset sequence fail.
This is an intermediate step before adding support for reset framework and newer targets.
--- arch/arm/mach-msm/board-msm7x30.c | 35 +++++++++++++++++++++++++++++++++++ arch/arm/mach-msm/board-qsd8x50.c | 35 +++++++++++++++++++++++++++++++++++ drivers/usb/phy/phy-msm-usb.c | 35 +++++++++++++++-------------------- include/linux/usb/msm_hsusb.h | 3 +++ 4 files changed, 88 insertions(+), 20 deletions(-)
arch/arm/mach-msm/board-msm7x30.c +35 -0
@@ -30,6 +30,7 @@#include <asm/memory.h> #include <asm/setup.h> +#include <mach/clk.h> #include <mach/msm_iomap.h> #include <mach/dma.h>
@@ -60,10 +61,44 @@ static int hsusb_phy_init_seq[] = {-1 }; +static int hsusb_link_clk_reset (struct clk *link_clk,bool assert) +{ +int ret; + +if (assert) { + ret =clk_reset (link_clk,CLK_RESET_ASSERT ); +if (ret) +pr_err ("usb hs_clk assert failed\n" ); + }else { + ret =clk_reset (link_clk,CLK_RESET_DEASSERT ); +if (ret) +pr_err ("usb hs_clk deassert failed\n" ); + } +return ret; +} + +static int hsusb_phy_clk_reset (struct clk *phy_clk) +{ +int ret; + + ret =clk_reset (phy_clk,CLK_RESET_ASSERT ); +if (ret) { +pr_err ("usb phy clk assert failed\n" ); +return ret; + } +usleep_range (10000 ,12000 ); + ret =clk_reset (phy_clk,CLK_RESET_DEASSERT ); +if (ret) +pr_err ("usb phy clk deassert failed\n" ); +return ret; +} +static struct msm_otg_platform_data msm_otg_pdata = { .phy_init_seq = hsusb_phy_init_seq, .mode =USB_PERIPHERAL , .otg_control =OTG_PHY_CONTROL , + .link_clk_reset = hsusb_link_clk_reset, + .phy_clk_reset = hsusb_phy_clk_reset, };struct msm_gpiomux_config msm_gpiomux_configs[GPIOMUX_NGPIOS ] = {
arch/arm/mach-msm/board-qsd8x50.c +35 -0
@@ -31,6 +31,7 @@#include <mach/irqs.h> #include <mach/sirc.h> #include <mach/vreg.h> +#include <mach/clk.h> #include <linux/platform_data/mmc-msm_sdcc.h> #include "devices.h"
@@ -81,10 +82,44 @@ static int hsusb_phy_init_seq[] = {-1 }; +static int hsusb_link_clk_reset (struct clk *link_clk,bool assert) +{ +int ret; + +if (assert) { + ret =clk_reset (link_clk,CLK_RESET_ASSERT ); +if (ret) +pr_err ("usb hs_clk assert failed\n" ); + }else { + ret =clk_reset (link_clk,CLK_RESET_DEASSERT ); +if (ret) +pr_err ("usb hs_clk deassert failed\n" ); + } +return ret; +} + +static int hsusb_phy_clk_reset (struct clk *phy_clk) +{ +int ret; + + ret =clk_reset (phy_clk,CLK_RESET_ASSERT ); +if (ret) { +pr_err ("usb phy clk assert failed\n" ); +return ret; + } +usleep_range (10000 ,12000 ); + ret =clk_reset (phy_clk,CLK_RESET_DEASSERT ); +if (ret) +pr_err ("usb phy clk deassert failed\n" ); +return ret; +} +static struct msm_otg_platform_data msm_otg_pdata = { .phy_init_seq = hsusb_phy_init_seq, .mode =USB_PERIPHERAL , .otg_control =OTG_PHY_CONTROL , + .link_clk_reset = hsusb_link_clk_reset, + .phy_clk_reset = hsusb_phy_clk_reset, };static struct platform_device *devices[]__initdata = {
drivers/usb/phy/phy-msm-usb.c +15 -20
@@ -40,8 +40,6 @@#include <linux/usb/msm_hsusb_hw.h> #include <linux/regulator/consumer.h> -#include <mach/clk.h> -#define MSM_USB_BASE (motg->regs)#define DRIVER_NAME "msm_otg"
@@ -308,33 +306,30 @@ static void ulpi_init(struct msm_otg *motg)static int msm_otg_link_clk_reset (struct msm_otg *motg,bool assert) { -int ret; +int ret =0 ; + +if (!motg->pdata->link_clk_reset) +return ret; + + ret = motg->pdata->link_clk_reset (motg->clk, assert); +if (ret) +dev_err (motg->phy.dev,"usb link clk reset %s failed\n" , + assert ?"assert" :"deassert" ); -if (assert) { - ret =clk_reset (motg->clk,CLK_RESET_ASSERT ); -if (ret) -dev_err (motg->phy.dev,"usb hs_clk assert failed\n" ); - }else { - ret =clk_reset (motg->clk,CLK_RESET_DEASSERT ); -if (ret) -dev_err (motg->phy.dev,"usb hs_clk deassert failed\n" ); - }return ret; }static int msm_otg_phy_clk_reset (struct msm_otg *motg) { -int ret; +int ret =0 ; - ret =clk_reset (motg->phy_reset_clk,CLK_RESET_ASSERT ); -if (ret) { -dev_err (motg->phy.dev,"usb phy clk assert failed\n" ); +if (!motg->pdata->phy_clk_reset)return ret; - } -usleep_range (10000 ,12000 ); - ret =clk_reset (motg->phy_reset_clk,CLK_RESET_DEASSERT ); + + ret = motg->pdata->phy_clk_reset (motg->phy_reset_clk);if (ret) -dev_err (motg->phy.dev,"usb phy clk deassert failed\n" ); +dev_err (motg->phy.dev,"usb phy clk reset failed\n" ); +return ret; }
include/linux/usb/msm_hsusb.h +3 -0
@@ -20,6 +20,7 @@#include <linux/types.h> #include <linux/usb/otg.h> +#include <linux/clk.h> /** * Supported USB modes
@@ -135,6 +136,8 @@ struct msm_otg_platform_data {enum msm_usb_phy_type phy_type;void (*setup_gpio)(enum usb_otg_state state);char *pclk_src_name; +int (*link_clk_reset)(struct clk *link_clk,bool assert); +int (*phy_clk_reset)(struct clk *phy_clk); };/**
Signature · 1 line
1.7.9.5
Re: [PATCH v4 01/15] usb: phy: msm: Move mach dependent code to platform data
Hi Ivan,
Quoted 121 lines · Ivan T. Ivanov
From: "Ivan T. Ivanov" <[email protected]>
This patch fix compilation error when driver is compiled in multi-platform builds.
drivers/built-in.o: In function `msm_otg_link_clk_reset':./drivers/usb/phy/phy-msm-usb.c:314: undefined reference toclk_reset' ./drivers/usb/phy/phy-msm-usb.c:318: undefined reference toclk_reset'Use platform data supplied reset handlers and adjust error messages reported when reset sequence fail.
This is an intermediate step before adding support for reset framework and newer targets.
Signed-off-by Ivan T. Ivanov <[email protected]>Acked-by David Brown <[email protected]>Cc Daniel Walker <[email protected]>Cc Felipe Balbi <[email protected]>Cc Greg Kroah-Hartman <[email protected]>--- arch/arm/mach-msm/board-msm7x30.c | 35 +++++++++++++++++++++++++++++++++++ arch/arm/mach-msm/board-qsd8x50.c | 35 +++++++++++++++++++++++++++++++++++ drivers/usb/phy/phy-msm-usb.c | 35 +++++++++++++++-------------------- include/linux/usb/msm_hsusb.h | 3 +++ 4 files changed, 88 insertions(+), 20 deletions(-)arch/arm/mach-msm/board-msm7x30.c +35
-0@@ -30,6 +30,7 @@#include <asm/memory.h> #include <asm/setup.h> +#include <mach/clk.h> #include <mach/msm_iomap.h> #include <mach/dma.h> @@ -60,10 +61,44 @@ static int hsusb_phy_init_seq[] = {-1 }; +static int hsusb_link_clk_reset (struct clk *link_clk,bool assert) +{ +int ret; + +if (assert) { + ret =clk_reset (link_clk,CLK_RESET_ASSERT ); +if (ret) +pr_err ("usb hs_clk assert failed\n" ); + }else { + ret =clk_reset (link_clk,CLK_RESET_DEASSERT ); +if (ret) +pr_err ("usb hs_clk deassert failed\n" ); + } +return ret; +} + +static int hsusb_phy_clk_reset (struct clk *phy_clk) +{ +int ret; + + ret =clk_reset (phy_clk,CLK_RESET_ASSERT ); +if (ret) { +pr_err ("usb phy clk assert failed\n" ); +return ret; + } +usleep_range (10000 ,12000 ); + ret =clk_reset (phy_clk,CLK_RESET_DEASSERT ); +if (ret) +pr_err ("usb phy clk deassert failed\n" ); +return ret; +} +static struct msm_otg_platform_data msm_otg_pdata = { .phy_init_seq = hsusb_phy_init_seq, .mode =USB_PERIPHERAL , .otg_control =OTG_PHY_CONTROL , + .link_clk_reset = hsusb_link_clk_reset, + .phy_clk_reset = hsusb_phy_clk_reset, };struct msm_gpiomux_config msm_gpiomux_configs[GPIOMUX_NGPIOS ] = {arch/arm/mach-msm/board-qsd8x50.c +22
-0@@ -31,6 +31,7 @@#include <mach/irqs.h> #include <mach/sirc.h> #include <mach/vreg.h> +#include <mach/clk.h> #include <linux/platform_data/mmc-msm_sdcc.h> #include "devices.h" @@ -81,10 +82,44 @@ static int hsusb_phy_init_seq[] = { -1 }; +static int hsusb_link_clk_reset (struct clk *link_clk,bool assert) +{ +int ret; + +if (assert) { + ret =clk_reset (link_clk,CLK_RESET_ASSERT ); +if (ret) +pr_err ("usb hs_clk assert failed\n" ); + }else { + ret =clk_reset (link_clk,CLK_RESET_DEASSERT ); +if (ret) +pr_err ("usb hs_clk deassert failed\n" ); + } +return ret; +} + +static int hsusb_phy_clk_reset (struct clk *phy_clk) +{ +int ret; + + ret =clk_reset (phy_clk,CLK_RESET_ASSERT );
arch/arm/mach-msm/board-qsd8x50.c static int hsusb_phy_init_seq[] = { · line 115
Quoted 10 lines
arch/arm/mach-msm/board-qsd8x50.c +10
-0+if (ret) { +pr_err ("usb phy clk assert failed\n" ); +return ret; + } +usleep_range (10000 ,12000 ); + ret =clk_reset (phy_clk,CLK_RESET_DEASSERT ); +if (ret) +pr_err ("usb phy clk deassert failed\n" ); +return ret; +}
Why are there identical, static definitions of hsusb_link_clk_reset and hsusb_phy_clk_reset across the two board files? Why not share a single non-static set of definitions?
Thanks,
Christopher
Signature · 7 lines
Employee of Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by the Linux Foundation. -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v4 01/15] usb: phy: msm: Move mach dependent code to platform data
Hi Christopher,
Quoted 130 lines · Christopher Covington
Hi Ivan,
Quoted 127 lines · Ivan T. Ivanov
From: "Ivan T. Ivanov" <[email protected]>
This patch fix compilation error when driver is compiled in multi-platform builds.
drivers/built-in.o: In function `msm_otg_link_clk_reset':./drivers/usb/phy/phy-msm-usb.c:314: undefined reference toclk_reset' ./drivers/usb/phy/phy-msm-usb.c:318: undefined reference toclk_reset'Use platform data supplied reset handlers and adjust error messages reported when reset sequence fail.
This is an intermediate step before adding support for reset framework and newer targets.
Signed-off-by Ivan T. Ivanov <[email protected]>Acked-by David Brown <[email protected]>Cc Daniel Walker <[email protected]>Cc Felipe Balbi <[email protected]>Cc Greg Kroah-Hartman <[email protected]>--- arch/arm/mach-msm/board-msm7x30.c | 35 +++++++++++++++++++++++++++++++++++ arch/arm/mach-msm/board-qsd8x50.c | 35 +++++++++++++++++++++++++++++++++++ drivers/usb/phy/phy-msm-usb.c | 35 +++++++++++++++-------------------- include/linux/usb/msm_hsusb.h | 3 +++ 4 files changed, 88 insertions(+), 20 deletions(-)arch/arm/mach-msm/board-msm7x30.c +35
-0@@ -30,6 +30,7 @@#include <asm/memory.h> #include <asm/setup.h> +#include <mach/clk.h> #include <mach/msm_iomap.h> #include <mach/dma.h> @@ -60,10 +61,44 @@ static int hsusb_phy_init_seq[] = {-1 }; +static int hsusb_link_clk_reset (struct clk *link_clk,bool assert) +{ +int ret; + +if (assert) { + ret =clk_reset (link_clk,CLK_RESET_ASSERT ); +if (ret) +pr_err ("usb hs_clk assert failed\n" ); + }else { + ret =clk_reset (link_clk,CLK_RESET_DEASSERT ); +if (ret) +pr_err ("usb hs_clk deassert failed\n" ); + } +return ret; +} + +static int hsusb_phy_clk_reset (struct clk *phy_clk) +{ +int ret; + + ret =clk_reset (phy_clk,CLK_RESET_ASSERT ); +if (ret) { +pr_err ("usb phy clk assert failed\n" ); +return ret; + } +usleep_range (10000 ,12000 ); + ret =clk_reset (phy_clk,CLK_RESET_DEASSERT ); +if (ret) +pr_err ("usb phy clk deassert failed\n" ); +return ret; +} +static struct msm_otg_platform_data msm_otg_pdata = { .phy_init_seq = hsusb_phy_init_seq, .mode =USB_PERIPHERAL , .otg_control =OTG_PHY_CONTROL , + .link_clk_reset = hsusb_link_clk_reset, + .phy_clk_reset = hsusb_phy_clk_reset, };struct msm_gpiomux_config msm_gpiomux_configs[GPIOMUX_NGPIOS ] = {arch/arm/mach-msm/board-qsd8x50.c +28
-0@@ -31,6 +31,7 @@#include <mach/irqs.h> #include <mach/sirc.h> #include <mach/vreg.h> +#include <mach/clk.h> #include <linux/platform_data/mmc-msm_sdcc.h> #include "devices.h" @@ -81,10 +82,44 @@ static int hsusb_phy_init_seq[] = { -1 }; +static int hsusb_link_clk_reset (struct clk *link_clk,bool assert) +{ +int ret; + +if (assert) { + ret =clk_reset (link_clk,CLK_RESET_ASSERT ); +if (ret) +pr_err ("usb hs_clk assert failed\n" ); + }else { + ret =clk_reset (link_clk,CLK_RESET_DEASSERT ); +if (ret) +pr_err ("usb hs_clk deassert failed\n" ); + } +return ret; +} + +static int hsusb_phy_clk_reset (struct clk *phy_clk) +{ +int ret; + + ret =clk_reset (phy_clk,CLK_RESET_ASSERT ); +if (ret) { +pr_err ("usb phy clk assert failed\n" ); +return ret; + } +usleep_range (10000 ,12000 ); + ret =clk_reset (phy_clk,CLK_RESET_DEASSERT );
Quoted 8 lines
arch/arm/mach-msm/board-qsd8x50.c static int hsusb_phy_init_seq[] = { · line 115
Quoted 4 lines
arch/arm/mach-msm/board-qsd8x50.c +4
-0+if (ret) +pr_err ("usb phy clk deassert failed\n" ); +return ret; +}Why are there identical, static definitions of
hsusb_link_clk_resetandhsusb_phy_clk_resetacross the two board files? Why not share a single non-static set of definitions?
One file which is used by both boards and is compiled unconditionally is clock.c, but I don't think that it will be appropriate to put USB specific functions there. Creating new file for just these functions also do not sound good to me.
Regards,
Ivan
Quoted 4 lines
Thanks,
Christopher
Re: [PATCH v4 01/15] usb: phy: msm: Move mach dependent code to platform data
In reply to Ivan T. IvanovQuoted 9 lines · Ivan T. Ivanov
From: "Ivan T. Ivanov" <[email protected]>
This patch fix compilation error when driver is compiled in multi-platform builds.
drivers/built-in.o: In function `msm_otg_link_clk_reset':./drivers/usb/phy/phy-msm-usb.c:314: undefined reference toclk_reset' ./drivers/usb/phy/phy-msm-usb.c:318: undefined reference toclk_reset'
Quoted 8 lines
Use platform data supplied reset handlers and adjust error messages reported when reset sequence fail.
This is an intermediate step before adding support for reset framework and newer targets.
Signed-off-by Ivan T. Ivanov <[email protected]>Acked-by David Brown <[email protected]>
David, could you take this change trough your tree?
Thanks, Ivan
Quoted 9 lines
Cc Daniel Walker <[email protected]>Cc Felipe Balbi <[email protected]>Cc Greg Kroah-Hartman <[email protected]>--- arch/arm/mach-msm/board-msm7x30.c | 35 +++++++++++++++++++++++++++++++++++ arch/arm/mach-msm/board-qsd8x50.c | 35 +++++++++++++++++++++++++++++++++++ drivers/usb/phy/phy-msm-usb.c | 35 +++++++++++++++-------------------- include/linux/usb/msm_hsusb.h | 3 +++ 4 files changed, 88 insertions(+), 20 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v4 01/15] usb: phy: msm: Move mach dependent code to platform data
In reply to Ivan T. IvanovHi,
Quoted 12 lines · Ivan T. Ivanov
From: "Ivan T. Ivanov" <[email protected]>
This patch fix compilation error when driver is compiled in multi-platform builds.
drivers/built-in.o: In function `msm_otg_link_clk_reset':./drivers/usb/phy/phy-msm-usb.c:314: undefined reference toclk_reset' ./drivers/usb/phy/phy-msm-usb.c:318: undefined reference toclk_reset'Use platform data supplied reset handlers and adjust error messages reported when reset sequence fail.
Quoted 8 lines
This is an intermediate step before adding support for reset framework and newer targets.
Signed-off-by Ivan T. Ivanov <[email protected]>Acked-by David Brown <[email protected]>Cc Daniel Walker <[email protected]>Cc Felipe Balbi <[email protected]>Cc Greg Kroah-Hartman <[email protected]>
this really looks like you should be using reset framework (drivers/reset/), then your phy driver would simply reset_assert() and reset_deassert().
Signature · 1 line
balbi
Re: [PATCH v4 01/15] usb: phy: msm: Move mach dependent code to platform data
Quoted 18 lines · Felipe Balbi
Hi,
Quoted 15 lines · Ivan T. Ivanov
From: "Ivan T. Ivanov" <[email protected]>
This patch fix compilation error when driver is compiled in multi-platform builds.
drivers/built-in.o: In function `msm_otg_link_clk_reset':./drivers/usb/phy/phy-msm-usb.c:314: undefined reference toclk_reset' ./drivers/usb/phy/phy-msm-usb.c:318: undefined reference toclk_reset'Use platform data supplied reset handlers and adjust error messages reported when reset sequence fail.
This is an intermediate step before adding support for reset framework and newer targets.
Quoted 9 lines
Quoted 5 lines
Signed-off-by Ivan T. Ivanov <[email protected]>Acked-by David Brown <[email protected]>Cc Daniel Walker <[email protected]>Cc Felipe Balbi <[email protected]>Cc Greg Kroah-Hartman <[email protected]>this really looks like you should be using reset framework (
drivers/reset/), then your phy driver would simplyreset_assert()andreset_deassert().
Unfortunately the reset framework is a DT only framework and there are still non-DT platforms within mach-msm. Arnd suggested we push the non-DT reset code down into the mach directory in the meantime. We're in the process of adding the reset framework to DT enabled MSM platforms, hopefully those get merged in 3.14.
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Felipe Balbi
Acked-byRe: [PATCH v4 01/15] usb: phy: msm: Move mach dependent code to platform data
Quoted 29 lines · Stephen Boyd
Quoted 18 lines · Felipe Balbi
Hi,
Quoted 15 lines · Ivan T. Ivanov
From: "Ivan T. Ivanov" <[email protected]>
This patch fix compilation error when driver is compiled in multi-platform builds.
drivers/built-in.o: In function `msm_otg_link_clk_reset':./drivers/usb/phy/phy-msm-usb.c:314: undefined reference toclk_reset' ./drivers/usb/phy/phy-msm-usb.c:318: undefined reference toclk_reset'Use platform data supplied reset handlers and adjust error messages reported when reset sequence fail.
This is an intermediate step before adding support for reset framework and newer targets.
Quoted 9 lines
Quoted 5 lines
Signed-off-by Ivan T. Ivanov <[email protected]>Acked-by David Brown <[email protected]>Cc Daniel Walker <[email protected]>Cc Felipe Balbi <[email protected]>Cc Greg Kroah-Hartman <[email protected]>this really looks like you should be using reset framework (
drivers/reset/), then your phy driver would simplyreset_assert()andreset_deassert().
Quoted 5 lines
Unfortunately the reset framework is a DT only framework and there are still non-DT platforms within mach-msm. Arnd suggested we push the non-DT reset code down into the mach directory in the meantime. We're in the process of adding the reset framework to DT enabled MSM platforms, hopefully those get merged in 3.14.
And this is why the ARM port is in such a messy situation. It's always better to "push things into the mach- directory" than improving existing frameworks to cope with wild ARM SoCs.
fell free to push this through your tree. It _does_ make the PHY driver slightly better and probably buildable on other arches with COMPILE_TEST.
Still, I *really* want to see this switching over to reset framework on v3.16.
cheers
ps: for this patch only you can have my
Signature · 1 line
balbi
PATCH v4 2/15 usb: phy: msm: Move global regulators variables to driver state
In reply to Ivan T. IvanovFrom: "Ivan T. Ivanov" <[email protected]>
--- drivers/usb/phy/phy-msm-usb.c | 82 ++++++++++++++++++++--------------------- include/linux/usb/msm_hsusb.h | 3 ++ 2 files changed, 42 insertions(+), 43 deletions(-)
drivers/usb/phy/phy-msm-usb.c +39 -43
@@ -58,47 +58,43 @@#define USB_PHY_VDD_DIG_VOL_MIN 1000000/* uV */ #define USB_PHY_VDD_DIG_VOL_MAX 1320000/* uV */ -static struct regulator *hsusb_3p3; -static struct regulator *hsusb_1p8; -static struct regulator *hsusb_vddcx; -static int msm_hsusb_init_vddcx (struct msm_otg *motg,int init) {int ret =0 ;if (init) { - hsusb_vddcx =regulator_get (motg->phy.dev,"HSUSB_VDDCX" ); -if (IS_ERR (hsusb_vddcx)) { + motg->vddcx =regulator_get (motg->phy.dev,"HSUSB_VDDCX" ); +if (IS_ERR (motg->vddcx)) {dev_err (motg->phy.dev,"unable to get hsusb vddcx\n" ); -return PTR_ERR (hsusb_vddcx); +return PTR_ERR (motg->vddcx); } - ret =regulator_set_voltage (hsusb_vddcx, + ret =regulator_set_voltage (motg->vddcx,USB_PHY_VDD_DIG_VOL_MIN ,USB_PHY_VDD_DIG_VOL_MAX );if (ret) {dev_err (motg->phy.dev,"unable to set the voltage " "for hsusb vddcx\n" ); -regulator_put (hsusb_vddcx); +regulator_put (motg->vddcx);return ret; } - ret =regulator_enable (hsusb_vddcx); + ret =regulator_enable (motg->vddcx);if (ret) {dev_err (motg->phy.dev,"unable to enable hsusb vddcx\n" ); -regulator_put (hsusb_vddcx); +regulator_put (motg->vddcx); } }else { - ret =regulator_set_voltage (hsusb_vddcx,0 , + ret =regulator_set_voltage (motg->vddcx,0 ,USB_PHY_VDD_DIG_VOL_MAX );if (ret)dev_err (motg->phy.dev,"unable to set the voltage " "for hsusb vddcx\n" ); - ret =regulator_disable (hsusb_vddcx); + ret =regulator_disable (motg->vddcx);if (ret)dev_err (motg->phy.dev,"unable to disable hsusb vddcx\n" ); -regulator_put (hsusb_vddcx); +regulator_put (motg->vddcx); }return ret;
@@ -109,38 +105,38 @@ static int msm_hsusb_ldo_init(struct msm_otg *motg, int init)int rc =0 ;if (init) { - hsusb_3p3 =regulator_get (motg->phy.dev,"HSUSB_3p3" ); -if (IS_ERR (hsusb_3p3)) { + motg->v3p3 =regulator_get (motg->phy.dev,"HSUSB_3p3" ); +if (IS_ERR (motg->v3p3)) {dev_err (motg->phy.dev,"unable to get hsusb 3p3\n" ); -return PTR_ERR (hsusb_3p3); +return PTR_ERR (motg->v3p3); } - rc =regulator_set_voltage (hsusb_3p3,USB_PHY_3P3_VOL_MIN , + rc =regulator_set_voltage (motg->v3p3,USB_PHY_3P3_VOL_MIN ,USB_PHY_3P3_VOL_MAX );if (rc) {dev_err (motg->phy.dev,"unable to set voltage level " "for hsusb 3p3\n" ); goto put_3p3; } - rc =regulator_enable (hsusb_3p3); + rc =regulator_enable (motg->v3p3);if (rc) {dev_err (motg->phy.dev,"unable to enable the hsusb 3p3\n" ); goto put_3p3; } - hsusb_1p8 =regulator_get (motg->phy.dev,"HSUSB_1p8" ); -if (IS_ERR (hsusb_1p8)) { + motg->v1p8 =regulator_get (motg->phy.dev,"HSUSB_1p8" ); +if (IS_ERR (motg->v1p8)) {dev_err (motg->phy.dev,"unable to get hsusb 1p8\n" ); - rc =PTR_ERR (hsusb_1p8); + rc =PTR_ERR (motg->v1p8); goto disable_3p3; } - rc =regulator_set_voltage (hsusb_1p8,USB_PHY_1P8_VOL_MIN , + rc =regulator_set_voltage (motg->v1p8,USB_PHY_1P8_VOL_MIN ,USB_PHY_1P8_VOL_MAX );if (rc) {dev_err (motg->phy.dev,"unable to set voltage level " "for hsusb 1p8\n" ); goto put_1p8; } - rc =regulator_enable (hsusb_1p8); + rc =regulator_enable (motg->v1p8);if (rc) {dev_err (motg->phy.dev,"unable to enable the hsusb 1p8\n" ); goto put_1p8;
@@ -149,19 +145,19 @@ static int msm_hsusb_ldo_init(struct msm_otg *motg, int init)return 0 ; } -regulator_disable (hsusb_1p8); +regulator_disable (motg->v1p8); put_1p8: -regulator_put (hsusb_1p8); +regulator_put (motg->v1p8); disable_3p3: -regulator_disable (hsusb_3p3); +regulator_disable (motg->v3p3); put_3p3: -regulator_put (hsusb_3p3); +regulator_put (motg->v3p3);return rc; }#ifdef CONFIG_PM_SLEEP #define USB_PHY_SUSP_DIG_VOL 500000 -static int msm_hsusb_config_vddcx (int high) +static int msm_hsusb_config_vddcx (struct msm_otg *motg,int high) {int max_vol =USB_PHY_VDD_DIG_VOL_MAX ;int min_vol;
@@ -172,7 +168,7 @@ static int msm_hsusb_config_vddcx(int high)else min_vol =USB_PHY_SUSP_DIG_VOL ; - ret =regulator_set_voltage (hsusb_vddcx, min_vol, max_vol); + ret =regulator_set_voltage (motg->vddcx, min_vol, max_vol);if (ret) {pr_err ("%s: unable to set the voltage for regulator " "HSUSB_VDDCX\n" , __func__);
@@ -185,44 +181,44 @@ static int msm_hsusb_config_vddcx(int high) }#endif -static int msm_hsusb_ldo_set_mode (int on) +static int msm_hsusb_ldo_set_mode (struct msm_otg *motg,int on) {int ret =0 ; -if (!hsusb_1p8 ||IS_ERR (hsusb_1p8)) { +if (!motg->v1p8 ||IS_ERR (motg->v1p8)) {pr_err ("%s: HSUSB_1p8 is not initialized\n" , __func__);return -ENODEV ; } -if (!hsusb_3p3 ||IS_ERR (hsusb_3p3)) { +if (!motg->v3p3 ||IS_ERR (motg->v3p3)) {pr_err ("%s: HSUSB_3p3 is not initialized\n" , __func__);return -ENODEV ; }if (on) { - ret =regulator_set_optimum_mode (hsusb_1p8, + ret =regulator_set_optimum_mode (motg->v1p8,USB_PHY_1P8_HPM_LOAD );if (ret <0 ) {pr_err ("%s: Unable to set HPM of the regulator " "HSUSB_1p8\n" , __func__);return ret; } - ret =regulator_set_optimum_mode (hsusb_3p3, + ret =regulator_set_optimum_mode (motg->v3p3,USB_PHY_3P3_HPM_LOAD );if (ret <0 ) {pr_err ("%s: Unable to set HPM of the regulator " "HSUSB_3p3\n" , __func__); -regulator_set_optimum_mode (hsusb_1p8, +regulator_set_optimum_mode (motg->v1p8,USB_PHY_1P8_LPM_LOAD );return ret; } }else { - ret =regulator_set_optimum_mode (hsusb_1p8, + ret =regulator_set_optimum_mode (motg->v1p8,USB_PHY_1P8_LPM_LOAD );if (ret <0 )pr_err ("%s: Unable to set LPM of the regulator " "HSUSB_1p8\n" , __func__); - ret =regulator_set_optimum_mode (hsusb_3p3, + ret =regulator_set_optimum_mode (motg->v3p3,USB_PHY_3P3_LPM_LOAD );if (ret <0 ) pr_err("%s: Unable to set LPM of the regulator "
@@ -519,8 +515,8 @@ static int msm_otg_suspend(struct msm_otg *motg)if (motg->pdata->phy_type ==SNPS_28NM_INTEGRATED_PHY && motg->pdata->otg_control ==OTG_PMIC_CONTROL ) { -msm_hsusb_ldo_set_mode (0 ); -msm_hsusb_config_vddcx (0 ); +msm_hsusb_ldo_set_mode (motg,0 ); +msm_hsusb_config_vddcx (motg,0 ); }if (device_may_wakeup (phy->dev))
@@ -556,8 +552,8 @@ static int msm_otg_resume(struct msm_otg *motg)if (motg->pdata->phy_type ==SNPS_28NM_INTEGRATED_PHY && motg->pdata->otg_control ==OTG_PMIC_CONTROL ) { -msm_hsusb_ldo_set_mode (1 ); -msm_hsusb_config_vddcx (1 ); +msm_hsusb_ldo_set_mode (motg,1 ); +msm_hsusb_config_vddcx (motg,1 );writel (readl (USB_PHY_CTRL ) & ~PHY_RETEN ,USB_PHY_CTRL ); }
@@ -1520,7 +1516,7 @@ static int __init msm_otg_probe(struct platform_device *pdev)dev_err (&pdev->dev,"hsusb vreg configuration failed\n" ); goto vddcx_exit; } - ret =msm_hsusb_ldo_set_mode (1 ); + ret =msm_hsusb_ldo_set_mode (motg,1 );if (ret) {dev_err (&pdev->dev,"hsusb vreg enable failed\n" ); goto ldo_exit;
include/linux/usb/msm_hsusb.h +3 -0
@@ -183,6 +183,9 @@ struct msm_otg {enum usb_chg_state chg_state;enum usb_chg_type chg_type;u8 dcd_retries; +struct regulator *v3p3; +struct regulator *v1p8; + struct regulator *vddcx; };#endif
Signature · 1 line
1.7.9.5
PATCH v4 3/15 usb: phy: msm: Migrate to Managed Device Resource allocation
In reply to Ivan T. IvanovFrom: "Ivan T. Ivanov" <[email protected]>
Move memory, regulators, clocks and irq allocation to devm_* variants. Properly check for valid clk handles.
--- drivers/usb/phy/phy-msm-usb.c | 192 ++++++++++++++++------------------------- 1 file changed, 74 insertions(+), 118 deletions(-)
drivers/usb/phy/phy-msm-usb.c +74 -118
@@ -63,27 +63,18 @@ static int msm_hsusb_init_vddcx(struct msm_otg *motg, int init)int ret =0 ;if (init) { - motg->vddcx =regulator_get (motg->phy.dev,"HSUSB_VDDCX" ); -if (IS_ERR (motg->vddcx)) { -dev_err (motg->phy.dev,"unable to get hsusb vddcx\n" ); -return PTR_ERR (motg->vddcx); - } - ret =regulator_set_voltage (motg->vddcx,USB_PHY_VDD_DIG_VOL_MIN ,USB_PHY_VDD_DIG_VOL_MAX );if (ret) {dev_err (motg->phy.dev,"unable to set the voltage " "for hsusb vddcx\n" ); -regulator_put (motg->vddcx);return ret; } ret =regulator_enable (motg->vddcx); -if (ret) { +if (ret)dev_err (motg->phy.dev,"unable to enable hsusb vddcx\n" ); -regulator_put (motg->vddcx); - } }else { ret =regulator_set_voltage (motg->vddcx,0 ,USB_PHY_VDD_DIG_VOL_MAX );
@@ -93,8 +84,6 @@ static int msm_hsusb_init_vddcx(struct msm_otg *motg, int init) ret =regulator_disable (motg->vddcx);if (ret)dev_err (motg->phy.dev,"unable to disable hsusb vddcx\n" ); - -regulator_put (motg->vddcx); }return ret;
@@ -105,53 +94,38 @@ static int msm_hsusb_ldo_init(struct msm_otg *motg, int init)int rc =0 ;if (init) { - motg->v3p3 =regulator_get (motg->phy.dev,"HSUSB_3p3" ); -if (IS_ERR (motg->v3p3)) { -dev_err (motg->phy.dev,"unable to get hsusb 3p3\n" ); -return PTR_ERR (motg->v3p3); - } - rc =regulator_set_voltage (motg->v3p3,USB_PHY_3P3_VOL_MIN ,USB_PHY_3P3_VOL_MAX );if (rc) {dev_err (motg->phy.dev,"unable to set voltage level " "for hsusb 3p3\n" ); - goto put_3p3; + goto exit; } rc =regulator_enable (motg->v3p3);if (rc) {dev_err (motg->phy.dev,"unable to enable the hsusb 3p3\n" ); - goto put_3p3; - } - motg->v1p8 =regulator_get (motg->phy.dev,"HSUSB_1p8" ); -if (IS_ERR (motg->v1p8)) { -dev_err (motg->phy.dev,"unable to get hsusb 1p8\n" ); - rc =PTR_ERR (motg->v1p8); - goto disable_3p3; + goto exit; } rc =regulator_set_voltage (motg->v1p8,USB_PHY_1P8_VOL_MIN ,USB_PHY_1P8_VOL_MAX );if (rc) {dev_err (motg->phy.dev,"unable to set voltage level " "for hsusb 1p8\n" ); - goto put_1p8; + goto disable_3p3; } rc =regulator_enable (motg->v1p8);if (rc) {dev_err (motg->phy.dev,"unable to enable the hsusb 1p8\n" ); - goto put_1p8; + goto disable_3p3; }return 0 ; }regulator_disable (motg->v1p8); -put_1p8: -regulator_put (motg->v1p8); disable_3p3:regulator_disable (motg->v3p3); -put_3p3: -regulator_put (motg->v3p3); +exit:return rc; }
@@ -507,7 +481,7 @@ static int msm_otg_suspend(struct msm_otg *motg)clk_disable_unprepare (motg->pclk);clk_disable_unprepare (motg->clk); -if (motg->core_clk) +if (!IS_ERR (motg->core_clk))clk_disable_unprepare (motg->core_clk);if (!IS_ERR (motg->pclk_src))
@@ -547,7 +521,7 @@ static int msm_otg_resume(struct msm_otg *motg)clk_prepare_enable (motg->pclk);clk_prepare_enable (motg->clk); -if (motg->core_clk) +if (!IS_ERR (motg->core_clk))clk_prepare_enable (motg->core_clk); if (motg->pdata->phy_type == SNPS_28NM_INTEGRATED_PHY &&
@@ -1415,13 +1389,14 @@ static int __init msm_otg_probe(struct platform_device *pdev)return -ENODEV ; } - motg =kzalloc (sizeof (struct msm_otg ),GFP_KERNEL ); + motg =devm_kzalloc (&pdev->dev,sizeof (struct msm_otg ),GFP_KERNEL );if (!motg) {dev_err (&pdev->dev,"unable to allocate msm_otg\n" );return -ENOMEM ; } - motg->phy.otg =kzalloc (sizeof (struct usb_otg ),GFP_KERNEL ); + motg->phy.otg =devm_kzalloc (&pdev->dev,sizeof (struct usb_otg ), +GFP_KERNEL );if (!motg->phy.otg) {dev_err (&pdev->dev,"unable to allocate msm_otg\n" );return -ENOMEM ;
@@ -1431,20 +1406,17 @@ static int __init msm_otg_probe(struct platform_device *pdev) phy = &motg->phy; phy->dev = &pdev->dev; - motg->phy_reset_clk =clk_get (&pdev->dev,"usb_phy_clk" ); + motg->phy_reset_clk =devm_clk_get (&pdev->dev,"usb_phy_clk" );if (IS_ERR (motg->phy_reset_clk)) {dev_err (&pdev->dev,"failed to get usb_phy_clk\n" ); - ret =PTR_ERR (motg->phy_reset_clk); - goto free_motg; +return PTR_ERR (motg->phy_reset_clk); } - motg->clk =clk_get (&pdev->dev,"usb_hs_clk" ); + motg->clk =devm_clk_get (&pdev->dev,"usb_hs_clk" );if (IS_ERR (motg->clk)) {dev_err (&pdev->dev,"failed to get usb_hs_clk\n" ); - ret =PTR_ERR (motg->clk); - goto put_phy_reset_clk; +return PTR_ERR (motg->clk); } -clk_set_rate (motg->clk,60000000 );/* * If USB Core is running its protocol engine based on CORE CLK,
@@ -1453,22 +1425,18 @@ static int __init msm_otg_probe(struct platform_device *pdev)* CORE CLK. For such USB cores, vote for maximum clk frequency * on pclk source */ + motg->pclk_src =ERR_PTR (-ENOENT );if (motg->pdata->pclk_src_name) { - motg->pclk_src =clk_get (&pdev->dev, - motg->pdata->pclk_src_name); + motg->pclk_src =devm_clk_get (&pdev->dev, + motg->pdata->pclk_src_name);if (IS_ERR (motg->pclk_src)) - goto put_clk; -clk_set_rate (motg->pclk_src,INT_MAX ); -clk_prepare_enable (motg->pclk_src); - }else - motg->pclk_src =ERR_PTR (-ENOENT ); - +return PTR_ERR (motg->pclk_src); + } - motg->pclk =clk_get (&pdev->dev,"usb_hs_pclk" ); + motg->pclk =devm_clk_get (&pdev->dev,"usb_hs_pclk" );if (IS_ERR (motg->pclk)) {dev_err (&pdev->dev,"failed to get usb_hs_pclk\n" ); - ret =PTR_ERR (motg->pclk); - goto put_pclk_src; +return PTR_ERR (motg->pclk); }/*
@@ -1476,65 +1444,78 @@ static int __init msm_otg_probe(struct platform_device *pdev)* clock is introduced to remove the dependency on AXI * bus frequency. */ - motg->core_clk =clk_get (&pdev->dev,"usb_hs_core_clk" ); -if (IS_ERR (motg->core_clk)) - motg->core_clk =NULL ; + motg->core_clk =devm_clk_get (&pdev->dev,"usb_hs_core_clk" ); res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); -if (!res) { -dev_err (&pdev->dev,"failed to get platform resource mem\n" ); - ret = -ENODEV ; - goto put_core_clk; - } + motg->regs =devm_ioremap (&pdev->dev, res->start,resource_size (res)); +if (IS_ERR (motg->regs)) +return PTR_ERR (motg->regs); - motg->regs =ioremap (res->start,resource_size (res)); -if (!motg->regs) { -dev_err (&pdev->dev,"ioremap failed\n" ); - ret = -ENOMEM ; - goto put_core_clk; - }dev_info (&pdev->dev,"OTG regs = %p\n" , motg->regs); motg->irq =platform_get_irq (pdev,0 );if (!motg->irq) {dev_err (&pdev->dev,"platform_get_irq failed\n" ); - ret = -ENODEV ; - goto free_regs; +return motg->irq; + } + + motg->vddcx =devm_regulator_get (motg->phy.dev,"HSUSB_VDDCX" ); +if (IS_ERR (motg->vddcx)) { +dev_err (motg->phy.dev,"unable to get hsusb vddcx\n" ); +return PTR_ERR (motg->vddcx); + } + + motg->v3p3 =devm_regulator_get (motg->phy.dev,"HSUSB_3p3" ); +if (IS_ERR (motg->v3p3)) { +dev_err (motg->phy.dev,"unable to get hsusb 3p3\n" ); +return PTR_ERR (motg->v3p3); + } + + motg->v1p8 =devm_regulator_get (motg->phy.dev,"HSUSB_1p8" ); +if (IS_ERR (motg->v1p8)) { +dev_err (motg->phy.dev,"unable to get hsusb 1p8\n" ); +return PTR_ERR (motg->v1p8); + } + +clk_set_rate (motg->clk,60000000 ); +if (!IS_ERR (motg->pclk_src)) { +clk_set_rate (motg->pclk_src,INT_MAX ); +clk_prepare_enable (motg->pclk_src); }clk_prepare_enable (motg->clk);clk_prepare_enable (motg->pclk); +if (!IS_ERR (motg->core_clk)) +clk_prepare_enable (motg->core_clk); + ret =msm_hsusb_init_vddcx (motg,1 );if (ret) {dev_err (&pdev->dev,"hsusb vddcx configuration failed\n" ); - goto free_regs; + goto disable_clks; } ret =msm_hsusb_ldo_init (motg,1 );if (ret) {dev_err (&pdev->dev,"hsusb vreg configuration failed\n" ); - goto vddcx_exit; + goto disable_vddcx; } ret =msm_hsusb_ldo_set_mode (motg,1 );if (ret) {dev_err (&pdev->dev,"hsusb vreg enable failed\n" ); - goto ldo_exit; + goto disable_ldo; } -if (motg->core_clk) -clk_prepare_enable (motg->core_clk); -writel (0 ,USB_USBINTR );writel (0 ,USB_OTGSC );INIT_WORK (&motg->sm_work, msm_otg_sm_work);INIT_DELAYED_WORK (&motg->chg_work, msm_chg_detect_work); - ret =request_irq (motg->irq, msm_otg_irq,IRQF_SHARED , + ret =devm_request_irq (&pdev->dev, motg->irq, msm_otg_irq,IRQF_SHARED ,"msm_otg" , motg);if (ret) {dev_err (&pdev->dev,"request irq failed\n" ); - goto disable_clks; + goto disable_ldo; } phy->init = msm_otg_reset;
@@ -1549,7 +1530,7 @@ static int __init msm_otg_probe(struct platform_device *pdev) ret =usb_add_phy (&motg->phy,USB_PHY_TYPE_USB2 );if (ret) {dev_err (&pdev->dev,"usb_add_phy failed\n" ); - goto free_irq; + goto disable_ldo; }platform_set_drvdata (pdev, motg);
@@ -1567,33 +1548,18 @@ static int __init msm_otg_probe(struct platform_device *pdev)pm_runtime_enable (&pdev->dev);return 0 ; -free_irq: -free_irq (motg->irq, motg); + +disable_ldo: +msm_hsusb_ldo_init (motg,0 ); +disable_vddcx: +msm_hsusb_init_vddcx (motg,0 ); disable_clks:clk_disable_unprepare (motg->pclk);clk_disable_unprepare (motg->clk); -ldo_exit: -msm_hsusb_ldo_init (motg,0 ); -vddcx_exit: -msm_hsusb_init_vddcx (motg,0 ); -free_regs: -iounmap (motg->regs); -put_core_clk: -if (motg->core_clk) -clk_put (motg->core_clk); -clk_put (motg->pclk); -put_pclk_src: -if (!IS_ERR (motg->pclk_src)) { +if (!IS_ERR (motg->core_clk)) +clk_disable_unprepare (motg->core_clk); +if (!IS_ERR (motg->pclk_src))clk_disable_unprepare (motg->pclk_src); -clk_put (motg->pclk_src); - } -put_clk: -clk_put (motg->clk); -put_phy_reset_clk: -clk_put (motg->phy_reset_clk); -free_motg: -kfree (motg->phy.otg); -kfree (motg);return ret; }
@@ -1616,7 +1582,7 @@ static int msm_otg_remove(struct platform_device *pdev)pm_runtime_disable (&pdev->dev);usb_remove_phy (phy); -free_irq (motg->irq, motg); +disable_irq (motg->irq);/* * Put PHY in low power mode.
@@ -1636,26 +1602,15 @@ static int msm_otg_remove(struct platform_device *pdev)clk_disable_unprepare (motg->pclk);clk_disable_unprepare (motg->clk); -if (motg->core_clk) +if (!IS_ERR (motg->core_clk))clk_disable_unprepare (motg->core_clk); -if (!IS_ERR (motg->pclk_src)) { +if (!IS_ERR (motg->pclk_src))clk_disable_unprepare (motg->pclk_src); -clk_put (motg->pclk_src); - } +msm_hsusb_ldo_init (motg,0 ); -iounmap (motg->regs);pm_runtime_set_suspended (&pdev->dev); -clk_put (motg->phy_reset_clk); -clk_put (motg->pclk); -clk_put (motg->clk); -if (motg->core_clk) -clk_put (motg->core_clk); - -kfree (motg->phy.otg); -kfree (motg); -return 0 ; }
@@ -1737,6 +1692,7 @@ static const struct dev_pm_ops msm_otg_dev_pm_ops = {#endif static struct platform_driver msm_otg_driver = { + .probe = msm_otg_probe, .remove = msm_otg_remove, .driver = { .name =DRIVER_NAME ,
@@ -1747,7 +1703,7 @@ static struct platform_driver msm_otg_driver = { }, }; -module_platform_driver_probe (msm_otg_driver, msm_otg_probe); +module_platform_driver (msm_otg_driver);MODULE_LICENSE ("GPL v2" );MODULE_DESCRIPTION ("MSM USB transceiver driver" );
Signature · 1 line
1.7.9.5
PATCH v4 4/15 usb: phy: msm: Remove unnecessarily check for valid regulators.
In reply to Ivan T. IvanovFrom: "Ivan T. Ivanov" <[email protected]>
Whether regulators are available or not is checked at driver probe. If they are not available driver will refuse to load, so no need to check them again.
--- drivers/usb/phy/phy-msm-usb.c | 10 ---------- 1 file changed, 10 deletions(-)
drivers/usb/phy/phy-msm-usb.c +0 -10
@@ -159,16 +159,6 @@ static int msm_hsusb_ldo_set_mode(struct msm_otg *motg, int on) {int ret =0 ; -if (!motg->v1p8 ||IS_ERR (motg->v1p8)) { -pr_err ("%s: HSUSB_1p8 is not initialized\n" , __func__); -return -ENODEV ; - } - -if (!motg->v3p3 ||IS_ERR (motg->v3p3)) { -pr_err ("%s: HSUSB_3p3 is not initialized\n" , __func__); -return -ENODEV ; - } -if (on) { ret =regulator_set_optimum_mode (motg->v1p8,USB_PHY_1P8_HPM_LOAD );
Signature · 1 line
1.7.9.5
PATCH v4 5/15 usb: phy: msm: Fix checkpatch.pl warnings
In reply to Ivan T. IvanovFrom: "Ivan T. Ivanov" <[email protected]>
This fixes following:
WARNING: quoted string split across lines
WARNING: Prefer seq_puts to seq_printf
--- drivers/usb/phy/phy-msm-usb.c | 39 ++++++++++++++------------------------- 1 file changed, 14 insertions(+), 25 deletions(-)
drivers/usb/phy/phy-msm-usb.c +14 -25
@@ -67,8 +67,7 @@ static int msm_hsusb_init_vddcx(struct msm_otg *motg, int init)USB_PHY_VDD_DIG_VOL_MIN , USB_PHY_VDD_DIG_VOL_MAX);if (ret) { -dev_err (motg->phy.dev,"unable to set the voltage " -"for hsusb vddcx\n" ); +dev_err (motg->phy.dev,"Cannot set vddcx voltage\n" );return ret; }
@@ -79,8 +78,7 @@ static int msm_hsusb_init_vddcx(struct msm_otg *motg, int init) ret =regulator_set_voltage (motg->vddcx,0 ,USB_PHY_VDD_DIG_VOL_MAX );if (ret) -dev_err (motg->phy.dev,"unable to set the voltage " -"for hsusb vddcx\n" ); +dev_err (motg->phy.dev,"Cannot set vddcx voltage\n" ); ret =regulator_disable (motg->vddcx);if (ret)dev_err (motg->phy.dev,"unable to disable hsusb vddcx\n" );
@@ -97,8 +95,7 @@ static int msm_hsusb_ldo_init(struct msm_otg *motg, int init) rc =regulator_set_voltage (motg->v3p3,USB_PHY_3P3_VOL_MIN ,USB_PHY_3P3_VOL_MAX );if (rc) { -dev_err (motg->phy.dev,"unable to set voltage level " -"for hsusb 3p3\n" ); +dev_err (motg->phy.dev,"Cannot set v3p3 voltage\n" ); goto exit; } rc =regulator_enable (motg->v3p3);
@@ -109,8 +106,7 @@ static int msm_hsusb_ldo_init(struct msm_otg *motg, int init) rc =regulator_set_voltage (motg->v1p8,USB_PHY_1P8_VOL_MIN ,USB_PHY_1P8_VOL_MAX );if (rc) { -dev_err (motg->phy.dev,"unable to set voltage level " -"for hsusb 1p8\n" ); +dev_err (motg->phy.dev,"Cannot set v1p8 voltage\n" ); goto disable_3p3; } rc =regulator_enable (motg->v1p8);
@@ -144,8 +140,7 @@ static int msm_hsusb_config_vddcx(struct msm_otg *motg, int high) ret =regulator_set_voltage (motg->vddcx, min_vol, max_vol);if (ret) { -pr_err ("%s: unable to set the voltage for regulator " -"HSUSB_VDDCX\n" , __func__); +dev_err (motg->phy.dev,"Cannot set vddcx voltage\n" );return ret; }
@@ -163,15 +158,13 @@ static int msm_hsusb_ldo_set_mode(struct msm_otg *motg, int on) ret =regulator_set_optimum_mode (motg->v1p8,USB_PHY_1P8_HPM_LOAD );if (ret <0 ) { -pr_err ("%s: Unable to set HPM of the regulator " -"HSUSB_1p8\n" , __func__); +pr_err ("Could not set HPM for v1p8\n" );return ret; } ret =regulator_set_optimum_mode (motg->v3p3,USB_PHY_3P3_HPM_LOAD );if (ret <0 ) { -pr_err ("%s: Unable to set HPM of the regulator " -"HSUSB_3p3\n" , __func__); +pr_err ("Could not set HPM for v3p3\n" );regulator_set_optimum_mode (motg->v1p8,USB_PHY_1P8_LPM_LOAD );return ret;
@@ -180,13 +173,11 @@ static int msm_hsusb_ldo_set_mode(struct msm_otg *motg, int on) ret =regulator_set_optimum_mode (motg->v1p8,USB_PHY_1P8_LPM_LOAD );if (ret <0 ) -pr_err ("%s: Unable to set LPM of the regulator " -"HSUSB_1p8\n" , __func__); +pr_err ("Could not set LPM for v1p8\n" ); ret =regulator_set_optimum_mode (motg->v3p3,USB_PHY_3P3_LPM_LOAD );if (ret <0 ) -pr_err ("%s: Unable to set LPM of the regulator " -"HSUSB_3p3\n" , __func__); +pr_err ("Could not set LPM for v3p3\n" ); }pr_debug ("reg (%s)\n" , on ?"HPM" :"LPM" );
@@ -547,8 +538,7 @@ static int msm_otg_resume(struct msm_otg *motg)* PHY. USB state can not be restored. Re-insertion * of USB cable is the only way to get USB working. */ -dev_err (phy->dev,"Unable to resume USB." -"Re-plugin the cable\n" ); +dev_err (phy->dev,"Unable to resume USB. Re-plugin the cable\n" );msm_otg_reset (phy); }
@@ -1242,13 +1232,13 @@ static int msm_otg_mode_show(struct seq_file *s, void *unused)switch (otg->phy->state) {case OTG_STATE_A_HOST : -seq_printf (s,"host\n" ); +seq_puts (s,"host\n" );break ;case OTG_STATE_B_PERIPHERAL : -seq_printf (s,"peripheral\n" ); +seq_puts (s,"peripheral\n" );break ;default : -seq_printf (s,"none\n" ); +seq_puts (s,"none\n" );break ; }
@@ -1530,8 +1520,7 @@ static int __init msm_otg_probe(struct platform_device *pdev) motg->pdata->otg_control == OTG_USER_CONTROL) { ret =msm_otg_debugfs_init (motg);if (ret) -dev_dbg (&pdev->dev,"mode debugfs file is" -"not available\n" ); +dev_dbg (&pdev->dev,"Can not create mode change file\n" ); }pm_runtime_set_active (&pdev->dev);
Signature · 1 line
1.7.9.5
PATCH v4 6/15 usb: phy: msm: Replace custom enum usb_mode_type with enum usb_dr_mode
In reply to Ivan T. IvanovFrom: "Ivan T. Ivanov" <[email protected]>
Use enum usb_dr_mode and drop default usb_dr_mode from platform data.
USB DT bindings states: dr_mode: "...In case this attribute isn't passed via DT, USB DRD controllers should default to OTG...", so remove redundand field.
--- arch/arm/mach-msm/board-msm7x30.c | 2 +- arch/arm/mach-msm/board-qsd8x50.c | 2 +- drivers/usb/phy/phy-msm-usb.c | 41 +++++++++++++++---------------------- include/linux/usb/msm_hsusb.h | 20 +----------------- 4 files changed, 20 insertions(+), 45 deletions(-)
arch/arm/mach-msm/board-msm7x30.c +1 -1
@@ -95,7 +95,7 @@ static int hsusb_phy_clk_reset(struct clk *phy_clk)static struct msm_otg_platform_data msm_otg_pdata = { .phy_init_seq = hsusb_phy_init_seq, - .mode =USB_PERIPHERAL , + .mode =USB_DR_MODE_PERIPHERAL , .otg_control =OTG_PHY_CONTROL , .link_clk_reset = hsusb_link_clk_reset, .phy_clk_reset = hsusb_phy_clk_reset,
arch/arm/mach-msm/board-qsd8x50.c +1 -1
@@ -116,7 +116,7 @@ static int hsusb_phy_clk_reset(struct clk *phy_clk)static struct msm_otg_platform_data msm_otg_pdata = { .phy_init_seq = hsusb_phy_init_seq, - .mode =USB_PERIPHERAL , + .mode =USB_DR_MODE_PERIPHERAL , .otg_control =OTG_PHY_CONTROL , .link_clk_reset = hsusb_link_clk_reset, .phy_clk_reset = hsusb_phy_clk_reset,
drivers/usb/phy/phy-msm-usb.c +17 -24
129 lines not on this page · raw message
include/linux/usb/msm_hsusb.h +1 -19
@@ -23,21 +23,6 @@#include <linux/clk.h> /** -* Supported USB modes -* -* USB_PERIPHERAL Only peripheral mode is supported. -* USB_HOST Only host mode is supported. -* USB_OTG OTG mode is supported. -* -*/ -enum usb_mode_type { -USB_NONE =0 , -USB_PERIPHERAL , -USB_HOST , -USB_OTG , -}; - -/** * OTG control * * OTG_NO_CONTROL Id/VBUS notifications not required. Useful in host
@@ -121,8 +106,6 @@ enum usb_chg_type {* @power_budget: VBUS power budget in mA (0 will be treated as 500mA). * @mode: Supported mode (OTG/peripheral/host). * @otg_control: OTG switch controlled by user/Id pin -* @default_mode: Default operational mode. Applicable only if -* OTG switch is controller by user. * @pclk_src_name: pclk is derived from ebi1_usb_clk in case of 7x27 and 8k * dfab_usb_hs_clk in case of 8660 and 8960. */
@@ -130,9 +113,8 @@ struct msm_otg_platform_data {int *phy_init_seq;void (*vbus_power)(bool on);unsigned power_budget; -enum usb_mode_type mode; +enum usb_dr_mode mode;enum otg_control_type otg_control; -enum usb_mode_type default_mode;enum msm_usb_phy_type phy_type;void (*setup_gpio)(enum usb_otg_state state);char *pclk_src_name;
Signature · 1 line
1.7.9.5
Re: [PATCH v4 06/15] usb: phy: msm: Replace custom enum usb_mode_type with enum usb_dr_mode
Quoted 4 lines · Ivan T. Ivanov
From: "Ivan T. Ivanov" <[email protected]>
Use enum
usb_dr_modeand drop defaultusb_dr_modefrom platform data.
Quoted 8 lines
USB DT bindings states:
dr_mode: "...In case this attribute isn't passed via DT, USB DRD controllers should default to OTG...", so remove redundand field.Signed-off-by Ivan T. Ivanov <[email protected]>---
arch/arm/mach-msm/board-msm7x30.c | 2 +- arch/arm/mach-msm/board-qsd8x50.c | 2 +-
Signature · 7 lines
sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v4 7/15 usb: phy: msm: Remove unused pclk_src_name
In reply to Ivan T. IvanovFrom: "Ivan T. Ivanov" <[email protected]>
There are no references to 'pclk_src_name' in plaform code, so it is unused.
--- drivers/usb/phy/phy-msm-usb.c | 26 +------------------------- include/linux/usb/msm_hsusb.h | 5 ----- 2 files changed, 1 insertion(+), 30 deletions(-)
drivers/usb/phy/phy-msm-usb.c +1 -25
@@ -465,9 +465,6 @@ static int msm_otg_suspend(struct msm_otg *motg)if (!IS_ERR (motg->core_clk))clk_disable_unprepare (motg->core_clk); -if (!IS_ERR (motg->pclk_src)) -clk_disable_unprepare (motg->pclk_src); -if (motg->pdata->phy_type ==SNPS_28NM_INTEGRATED_PHY && motg->pdata->otg_control ==OTG_PMIC_CONTROL ) {msm_hsusb_ldo_set_mode (motg,0 );
@@ -497,9 +494,6 @@ static int msm_otg_resume(struct msm_otg *motg)if (!atomic_read (&motg->in_lpm))return 0 ; -if (!IS_ERR (motg->pclk_src)) -clk_prepare_enable (motg->pclk_src); -clk_prepare_enable (motg->pclk);clk_prepare_enable (motg->clk);if (!IS_ERR (motg->core_clk))
@@ -1395,17 +1389,8 @@ static int __init msm_otg_probe(struct platform_device *pdev)* If USB Core is running its protocol engine based on CORE CLK, * CORE CLK must be running at >55Mhz for correct HSUSB * operation and USB core cannot tolerate frequency changes on -* CORE CLK. For such USB cores, vote for maximum clk frequency -* on pclk source +* CORE CLK. */ - motg->pclk_src =ERR_PTR (-ENOENT ); -if (motg->pdata->pclk_src_name) { - motg->pclk_src =devm_clk_get (&pdev->dev, - motg->pdata->pclk_src_name); -if (IS_ERR (motg->pclk_src)) -return PTR_ERR (motg->pclk_src); - } - motg->pclk =devm_clk_get (&pdev->dev,"usb_hs_pclk" );if (IS_ERR (motg->pclk)) {dev_err (&pdev->dev,"failed to get usb_hs_pclk\n" );
@@ -1451,10 +1436,6 @@ static int __init msm_otg_probe(struct platform_device *pdev) }clk_set_rate (motg->clk,60000000 ); -if (!IS_ERR (motg->pclk_src)) { -clk_set_rate (motg->pclk_src,INT_MAX ); -clk_prepare_enable (motg->pclk_src); - }clk_prepare_enable (motg->clk);clk_prepare_enable (motg->pclk);
@@ -1530,8 +1511,6 @@ disable_clks:clk_disable_unprepare (motg->clk);if (!IS_ERR (motg->core_clk))clk_disable_unprepare (motg->core_clk); -if (!IS_ERR (motg->pclk_src)) -clk_disable_unprepare (motg->pclk_src);return ret; }
@@ -1576,9 +1555,6 @@ static int msm_otg_remove(struct platform_device *pdev)clk_disable_unprepare (motg->clk);if (!IS_ERR (motg->core_clk))clk_disable_unprepare (motg->core_clk); -if (!IS_ERR (motg->pclk_src)) -clk_disable_unprepare (motg->pclk_src); -msm_hsusb_ldo_init (motg,0 );pm_runtime_set_suspended (&pdev->dev);
include/linux/usb/msm_hsusb.h +0 -5
@@ -106,8 +106,6 @@ enum usb_chg_type {* @power_budget: VBUS power budget in mA (0 will be treated as 500mA). * @mode: Supported mode (OTG/peripheral/host). * @otg_control: OTG switch controlled by user/Id pin -* @pclk_src_name: pclk is derived from ebi1_usb_clk in case of 7x27 and 8k -* dfab_usb_hs_clk in case of 8660 and 8960. */ struct msm_otg_platform_data {int *phy_init_seq;
@@ -117,7 +115,6 @@ struct msm_otg_platform_data {enum otg_control_type otg_control;enum msm_usb_phy_type phy_type;void (*setup_gpio)(enum usb_otg_state state); -char *pclk_src_name;int (*link_clk_reset)(struct clk *link_clk,bool assert);int (*phy_clk_reset)(struct clk *phy_clk); };
@@ -129,7 +126,6 @@ struct msm_otg_platform_data {* @irq: IRQ number assigned for HSUSB controller. * @clk: clock struct of usb_hs_clk. * @pclk: clock struct of usb_hs_pclk. -* @pclk_src: pclk source for voting. * @phy_reset_clk: clock struct of usb_phy_clk. * @core_clk: clock struct of usb_hs_core_clk. * @regs: ioremapped register base address.
@@ -150,7 +146,6 @@ struct msm_otg {int irq;struct clk *clk;struct clk *pclk; -struct clk *pclk_src;struct clk *phy_reset_clk;struct clk *core_clk;void __iomem *regs;
Signature · 1 line
1.7.9.5
PATCH v4 8/15 usb: phy: msm: Remove HSUSB prefix from regulator names
In reply to Ivan T. IvanovFrom: "Ivan T. Ivanov" <[email protected]>
Prefix did not bring any useful information. Currently none of the MSM platforms define these regulators, so it is safe to rename them.
--- drivers/usb/phy/phy-msm-usb.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/usb/phy/phy-msm-usb.c +3 -3
@@ -1417,19 +1417,19 @@ static int __init msm_otg_probe(struct platform_device *pdev)return motg->irq; } - motg->vddcx =devm_regulator_get (motg->phy.dev,"HSUSB_VDDCX" ); + motg->vddcx =devm_regulator_get (motg->phy.dev,"vddcx" );if (IS_ERR (motg->vddcx)) {dev_err (motg->phy.dev,"unable to get hsusb vddcx\n" );return PTR_ERR (motg->vddcx); } - motg->v3p3 =devm_regulator_get (motg->phy.dev,"HSUSB_3p3" ); + motg->v3p3 =devm_regulator_get (motg->phy.dev,"v3p3" );if (IS_ERR (motg->v3p3)) {dev_err (motg->phy.dev,"unable to get hsusb 3p3\n" );return PTR_ERR (motg->v3p3); } - motg->v1p8 =devm_regulator_get (motg->phy.dev,"HSUSB_1p8" ); + motg->v1p8 =devm_regulator_get (motg->phy.dev,"v1p8" );if (IS_ERR (motg->v1p8)) {dev_err (motg->phy.dev,"unable to get hsusb 1p8\n" );return PTR_ERR (motg->v1p8);
Signature · 1 line
1.7.9.5
PATCH v4 9/15 usb: phy: msm: Properly check result from platform_get_irq()
In reply to Ivan T. IvanovFrom: "Ivan T. Ivanov" <[email protected]>
Function return negative code on error.
--- drivers/usb/phy/phy-msm-usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/phy/phy-msm-usb.c +1 -1
@@ -1412,7 +1412,7 @@ static int __init msm_otg_probe(struct platform_device *pdev)dev_info (&pdev->dev,"OTG regs = %p\n" , motg->regs); motg->irq =platform_get_irq (pdev,0 ); -if (!motg->irq) { +if (motg->irq <0 ) {dev_err (&pdev->dev,"platform_get_irq failed\n" );return motg->irq; }
Signature · 6 lines
1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v4 10/15 usb: phy: msm: Add device tree support and binding information
In reply to Ivan T. IvanovFrom: "Ivan T. Ivanov" <[email protected]>
Allows MSM OTG controller to be specified via device tree.
--- .../devicetree/bindings/usb/msm-hsusb.txt | 57 +++++++++++++- drivers/usb/phy/phy-msm-usb.c | 79 +++++++++++++++++--- 2 files changed, 124 insertions(+), 12 deletions(-)
Documentation/devicetree/bindings/usb/msm-hsusb.txt +56 -1
@@ -30,4 +30,59 @@ Required properties: dr_mode = "peripheral"; interrupts = <0 134 0>; usb-phy = <&usb_otg>; - }; + }; + +USB PHY with optional OTG: + +Required properties: +- compatible: should contain "qcom,usb-otg-ci" for chipsets with + Chipidea 45nm PHY or "qcom,usb-otg-snps" for chipsets + with Synopsys 28nm PHY +- regs: offset and length of the register set in the memory map +- interrupts: interrupt-specifier for the OTG interrupt. + +- clocks: A list of phandle + clock-specifier pairs for the + clocks listed in clock-names +- clock-names: Should contain the following: + "phy" USB PHY reference clock + "core" Protocol engine clock + "iface" Interface bus clock + "alt_core" Optional: Protocol engine clock for targets with asynchronous + reset methodology. + +- dr_mode: One of "host", "peripheral" or "otg". Defaults to "otg" + +- vdccx-supply: phandle to the regulator for the vdd supply for + digital circuit operation. +- v1p8-supply: phandle to the regulator for the 1.8V supply +- v3p3-supply: phandle to the regulator for the 3.3V supply + +- qcom,otg-control: OTG control (VBUS and ID notifications) can be one of + 1 - PHY control + 2 - PMIC control + 3 - User control (via debugfs) + +Optional properties: +- qcom,phy-init-sequence: PHY configuration sequence. val, reg pairs + terminate with -1 + +Example HSUSB OTG controller device node: + + usb@f9a55000 { + compatible = "qcom,usb-otg-snps"; + reg = <0xf9a55000 0x400>; + interrupts = <0 134 0>;; + dr_mode = "peripheral"; + + clocks = <&gcc GCC_XO_CLK>, <&gcc GCC_USB_HS_SYSTEM_CLK>, + <&gcc GCC_USB_HS_AHB_CLK>; + + clock-names = "phy", "core", "iface"; + + vddcx-supply = <&pm8841_s2_corner>; + v1p8-supply = <&pm8941_l6>; + v3p3-supply = <&pm8941_l24>; + + qcom,otg-control = <1>; + qcom,phy-init-sequence = <0x01 0x90 0xffffffff>; + };
drivers/usb/phy/phy-msm-usb.c +68 -11
145 lines not on this page · raw message
Signature · 1 line
1.7.9.5
Re: [PATCH v4 10/15] usb: phy: msm: Add device tree support and binding information
Quoted 19 lines · Ivan T. Ivanov
From: "Ivan T. Ivanov" <[email protected]>
Allows MSM OTG controller to be specified via device tree.
Signed-off-by Ivan T. Ivanov <[email protected]>--- .../devicetree/bindings/usb/msm-hsusb.txt | 57 +++++++++++++- drivers/usb/phy/phy-msm-usb.c | 79 +++++++++++++++++--- 2 files changed, 124 insertions(+), 12 deletions(-)Documentation/devicetree/bindings/usb/msm-hsusb.txt +0
-0@@ -30,4 +30,59 @@ Required properties: dr_mode = "peripheral"; interrupts = <0 134 0>; usb-phy = <&usb_otg>;
Documentation/devicetree/bindings/usb/msm-hsusb.txt Required properties: · line 40
Quoted 10 lines
Documentation/devicetree/bindings/usb/msm-hsusb.txt +8
-1- }; + }; + +USB PHY with optional OTG: + +Required properties: +- compatible: should contain "qcom,usb-otg-ci" for chipsets with + Chipidea 45nm PHY or "qcom,usb-otg-snps" for chipsets + with Synopsys 28nm PHY
To make this easier to read and extend in future, I'd reorganise this like so:
compatible: should contain:
* "qcom,usb-otg-ci" for chipsets with Chipidea 45nm PHY
* "qcom,usb-otg-snps" for chipsets with Synopsys 28nm PHY
Documentation/devicetree/bindings/usb/msm-hsusb.txt Required properties: · line 51
Quoted 11 lines
Documentation/devicetree/bindings/usb/msm-hsusb.txt +11
-0+- regs: offset and length of the register set in the memory map +- interrupts: interrupt-specifier for the OTG interrupt. + +- clocks: A list of phandle + clock-specifier pairs for the + clocks listed in clock-names +- clock-names: Should contain the following: + "phy" USB PHY reference clock + "core" Protocol engine clock + "iface" Interface bus clock + "alt_core" Optional: Protocol engine clock for targets with asynchronous + reset methodology.
I'd rearrange that last entry:
"alt_core": Protocol engine clock for targets with asynchronous
reset methodology. (optional)
Documentation/devicetree/bindings/usb/msm-hsusb.txt Required properties: · line 53
Quoted 2 lines
Documentation/devicetree/bindings/usb/msm-hsusb.txt +2
-0+ +- dr_mode: One of "host", "peripheral" or "otg". Defaults to "otg"
If this has a default and thus isn't required, it should be listed as optional.
Documentation/devicetree/bindings/usb/msm-hsusb.txt Required properties: · line 63
Quoted 10 lines
Documentation/devicetree/bindings/usb/msm-hsusb.txt +10
-0+ +- vdccx-supply: phandle to the regulator for the vdd supply for + digital circuit operation. +- v1p8-supply: phandle to the regulator for the 1.8V supply +- v3p3-supply: phandle to the regulator for the 3.3V supply + +- qcom,otg-control: OTG control (VBUS and ID notifications) can be one of + 1 - PHY control + 2 - PMIC control + 3 - User control (via debugfs)
NAK. This does not seem like a description of the hardware, and given the debugfs comment is fundamentally tied to the way Linux functions today.
Documentation/devicetree/bindings/usb/msm-hsusb.txt Required properties: · line 67
Quoted 4 lines
Documentation/devicetree/bindings/usb/msm-hsusb.txt +4
-0+ +Optional properties: +- qcom,phy-init-sequence: PHY configuration sequence. val, reg pairs + terminate with -1
What is this? I'm really not keen on having arbitrary register/memory poking sequences in the dt.
Why does it need to be terminated? Surely the size of the property tells you that it's terminated.
Documentation/devicetree/bindings/usb/msm-hsusb.txt Required properties: · line 74
Quoted 7 lines
Documentation/devicetree/bindings/usb/msm-hsusb.txt +7
-0+ +Example HSUSB OTG controller device node: + + usb@f9a55000 { + compatible = "qcom,usb-otg-snps"; + reg = <0xf9a55000 0x400>; + interrupts = <0 134 0>;;
s/;;/;/
Documentation/devicetree/bindings/usb/msm-hsusb.txt Required properties: · line 87
Quoted 13 lines
Documentation/devicetree/bindings/usb/msm-hsusb.txt +13
-0+ dr_mode = "peripheral"; + + clocks = <&gcc GCC_XO_CLK>, <&gcc GCC_USB_HS_SYSTEM_CLK>, + <&gcc GCC_USB_HS_AHB_CLK>; + + clock-names = "phy", "core", "iface"; + + vddcx-supply = <&pm8841_s2_corner>; + v1p8-supply = <&pm8941_l6>; + v3p3-supply = <&pm8941_l24>; + + qcom,otg-control = <1>; + qcom,phy-init-sequence = <0x01 0x90 0xffffffff>;
I believe modern dtc versions can handle negative numbers directly.
[...]
Quoted 14 lines
Documentation/devicetree/bindings/usb/msm-hsusb.txt +14
-0+static int msm_otg_read_dt(struct platform_device *pdev, struct msm_otg *motg) +{ + struct msm_otg_platform_data *pdata; + const struct of_device_id *id; + struct device_node *node = pdev->dev.of_node; + int len = 0; + u32 val; + + pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); + if (!pdata) + return -ENOMEM; + + motg->pdata = pdata; +
Documentation/devicetree/bindings/usb/msm-hsusb.txt Required properties:
Quoted 10 lines
Documentation/devicetree/bindings/usb/msm-hsusb.txt +10
-0+ id = of_match_device(msm_otg_dt_match, &pdev->dev); + pdata->phy_type = (int) id->data; + + pdata->mode = of_usb_get_dr_mode(node); + if (pdata->mode == USB_DR_MODE_UNKNOWN) + pdata->mode = USB_DR_MODE_OTG; + + pdata->otg_control = OTG_PHY_CONTROL; + if (!of_property_read_u32(node, "qcom,otg-control", &val)) + pdata->otg_control = val;
Is this validated elsewhere?
Thanks,
Mark.
Re: [PATCH v4 10/15] usb: phy: msm: Add device tree support and binding information
Hi Mark,
Quoted 34 lines · Mark Rutland
Quoted 19 lines · Ivan T. Ivanov
From: "Ivan T. Ivanov" <[email protected]>
Allows MSM OTG controller to be specified via device tree.
Signed-off-by Ivan T. Ivanov <[email protected]>--- .../devicetree/bindings/usb/msm-hsusb.txt | 57 +++++++++++++- drivers/usb/phy/phy-msm-usb.c | 79 +++++++++++++++++--- 2 files changed, 124 insertions(+), 12 deletions(-)Documentation/devicetree/bindings/usb/msm-hsusb.txt +0
-0@@ -30,4 +30,59 @@ Required properties: dr_mode = "peripheral"; interrupts = <0 134 0>; usb-phy = <&usb_otg>;Documentation/devicetree/bindings/usb/msm-hsusb.txt Required properties: · line 40
Quoted 10 lines
Documentation/devicetree/bindings/usb/msm-hsusb.txt +8
-1- }; + }; + +USB PHY with optional OTG: + +Required properties: +- compatible: should contain "qcom,usb-otg-ci" for chipsets with + Chipidea 45nm PHY or "qcom,usb-otg-snps" for chipsets + with Synopsys 28nm PHYTo make this easier to read and extend in future, I'd reorganise this like so:
Quoted 3 lines
compatible: should contain:
* "qcom,usb-otg-ci" for chipsets with Chipidea 45nm PHY
* "qcom,usb-otg-snps" for chipsets with Synopsys 28nm PHY
Ok.
Quoted 15 lines
Documentation/devicetree/bindings/usb/msm-hsusb.txt Required properties: · line 51
Quoted 12 lines
Documentation/devicetree/bindings/usb/msm-hsusb.txt +11
-0+- regs: offset and length of the register set in the memory map +- interrupts: interrupt-specifier for the OTG interrupt. + +- clocks: A list of phandle + clock-specifier pairs for the + clocks listed in clock-names +- clock-names: Should contain the following: + "phy" USB PHY reference clock + "core" Protocol engine clock + "iface" Interface bus clock + "alt_core" Optional: Protocol engine clock for targets with asynchronous + reset methodology.I'd rearrange that last entry:
Quoted 2 lines
"
alt_core": Protocol engine clock for targets with asynchronous
reset methodology. (optional)
ok.
Quoted 6 lines
Documentation/devicetree/bindings/usb/msm-hsusb.txt Required properties: · line 53
Quoted 3 lines
Documentation/devicetree/bindings/usb/msm-hsusb.txt +2
-0+ +- dr_mode: One of "host", "peripheral" or "otg". Defaults to "otg"If this has a default and thus isn't required, it should be listed as optional.
This is part of the standard USB bindings, Perhaps I could just refer to: Documentation/devicetree/bindings/usb/generic.txt
Quoted 15 lines
Documentation/devicetree/bindings/usb/msm-hsusb.txt Required properties: · line 63
Quoted 11 lines
Documentation/devicetree/bindings/usb/msm-hsusb.txt +10
-0+ +- vdccx-supply: phandle to the regulator for the vdd supply for + digital circuit operation. +- v1p8-supply: phandle to the regulator for the 1.8V supply +- v3p3-supply: phandle to the regulator for the 3.3V supply + +- qcom,otg-control: OTG control (VBUS and ID notifications) can be one of + 1 - PHY control + 2 - PMIC control + 3 - User control (via debugfs)NAK. This does not seem like a description of the hardware, and given the debugfs comment is fundamentally tied to the way Linux functions today.
I will remove option 3, but rest are really property of the chipset.
Quoted 8 lines
Documentation/devicetree/bindings/usb/msm-hsusb.txt Required properties: · line 67
Quoted 5 lines
Documentation/devicetree/bindings/usb/msm-hsusb.txt +4
-0+ +Optional properties: +- qcom,phy-init-sequence: PHY configuration sequence. val, reg pairs + terminate with -1What is this? I'm really not keen on having arbitrary register/memory poking sequences in the dt.
This is related Device Mode Eye Diagram test and values used could be different between chipsets.
Quoted 3 lines
Why does it need to be terminated? Surely the size of the property tells you that it's terminated.
Yes. -1 termination could be done in driver.
Quoted 10 lines
Documentation/devicetree/bindings/usb/msm-hsusb.txt Required properties: · line 74
Quoted 8 lines
Documentation/devicetree/bindings/usb/msm-hsusb.txt +7
-0+ +Example HSUSB OTG controller device node: + + usb@f9a55000 { + compatible = "qcom,usb-otg-snps"; + reg = <0xf9a55000 0x400>; + interrupts = <0 134 0>;;s/;;/;/
thanks
Quoted 37 lines
Quoted 4 lines
Documentation/devicetree/bindings/usb/msm-hsusb.txt +3
-0+ dr_mode = "peripheral"; + + clocks = <&gcc GCC_XO_CLK>, <&gcc GCC_USB_HS_SYSTEM_CLK>,Documentation/devicetree/bindings/usb/msm-hsusb.txt Required properties: · line 87
Quoted 10 lines
Documentation/devicetree/bindings/usb/msm-hsusb.txt +10
-0+ <&gcc GCC_USB_HS_AHB_CLK>; + + clock-names = "phy", "core", "iface"; + + vddcx-supply = <&pm8841_s2_corner>; + v1p8-supply = <&pm8941_l6>; + v3p3-supply = <&pm8941_l24>; + + qcom,otg-control = <1>; + qcom,phy-init-sequence = <0x01 0x90 0xffffffff>;I believe modern dtc versions can handle negative numbers directly.
[...]
Quoted 18 lines
Documentation/devicetree/bindings/usb/msm-hsusb.txt +18
-0+static int msm_otg_read_dt(struct platform_device *pdev, struct msm_otg *motg) +{ + struct msm_otg_platform_data *pdata; + const struct of_device_id *id; + struct device_node *node = pdev->dev.of_node; + int len = 0; + u32 val; + + pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); + if (!pdata) + return -ENOMEM; + + motg->pdata = pdata; + + id = of_match_device(msm_otg_dt_match, &pdev->dev); + pdata->phy_type = (int) id->data; + + pdata->mode = of_usb_get_dr_mode(node);
Quoted 8 lines
Documentation/devicetree/bindings/usb/msm-hsusb.txt
Quoted 6 lines
Documentation/devicetree/bindings/usb/msm-hsusb.txt +6
-0+ if (pdata->mode == USB_DR_MODE_UNKNOWN) + pdata->mode = USB_DR_MODE_OTG; + + pdata->otg_control = OTG_PHY_CONTROL; + if (!of_property_read_u32(node, "qcom,otg-control", &val)) + pdata->otg_control = val;Is this validated elsewhere?
No. I will add check.
Thanks.
Ivan
Quoted 3 lines
Thanks,
Mark.
Re: [PATCH v4 10/15] usb: phy: msm: Add device tree support and binding information
Quoted 14 lines · Ivan T. Ivanov
Hi Mark,
Quoted 11 lines · Mark Rutland
Quoted 10 lines · Ivan T. Ivanov
From: "Ivan T. Ivanov" <[email protected]>
Allows MSM OTG controller to be specified via device tree.
Signed-off-by Ivan T. Ivanov <[email protected]>--- .../devicetree/bindings/usb/msm-hsusb.txt | 57 +++++++++++++- drivers/usb/phy/phy-msm-usb.c | 79 +++++++++++++++++--- 2 files changed, 124 insertions(+), 12 deletions(-)
[...]
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
+
+-dr_mode: One of "host", "peripheral" or "otg". Defaults to "otg"If this has a default and thus isn't required, it should be listed as optional.
This is part of the standard USB bindings, Perhaps I could just refer to:
Documentation/devicetree/bindings/usb/generic.txt
That would be fine, but it should also be moved to the optional properties section.
Quoted 18 lines
Quoted 17 lines
Documentation/devicetree/bindings/usb/msm-hsusb.txt Required properties: · line 63
Quoted 13 lines
Documentation/devicetree/bindings/usb/msm-hsusb.txt +10
-0+ +- vdccx-supply: phandle to the regulator for the vdd supply for + digital circuit operation. +- v1p8-supply: phandle to the regulator for the 1.8V supply +- v3p3-supply: phandle to the regulator for the 3.3V supply + +- qcom,otg-control: OTG control (VBUS and ID notifications) can be one of + 1 - PHY control + 2 - PMIC control + 3 - User control (via debugfs)NAK. This does not seem like a description of the hardware, and given the debugfs comment is fundamentally tied to the way Linux functions today.
Quoted 1 line
I will remove option 3, but rest are really property of the chipset.
Can you elaborate on the diffence please?
Quoted 10 lines
Quoted 9 lines
Documentation/devicetree/bindings/usb/msm-hsusb.txt Required properties: · line 67
Quoted 6 lines
Documentation/devicetree/bindings/usb/msm-hsusb.txt +4
-0+ +Optional properties: +- qcom,phy-init-sequence: PHY configuration sequence. val, reg pairs + terminate with -1What is this? I'm really not keen on having arbitrary register/memory poking sequences in the dt.
Quoted 2 lines
This is related Device Mode Eye Diagram test and values used could be different between chipsets.
Ok. Then we should encode the tuning data rather than adding a mechanism to allow for writes to arbitrary addresses.
Quoted 6 lines
Quoted 4 lines
Why does it need to be terminated? Surely the size of the property tells you that it's terminated.
Yes. -1 termination could be done in driver.
Please do. There's no need for it to be in the DT.
Cheers,
Mark.
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v4 10/15] usb: phy: msm: Add device tree support and binding information
Hi,
Quoted 21 lines · Mark Rutland
Quoted 14 lines · Ivan T. Ivanov
Hi Mark,
Quoted 11 lines · Mark Rutland
Quoted 10 lines · Ivan T. Ivanov
From: "Ivan T. Ivanov" <[email protected]>
Allows MSM OTG controller to be specified via device tree.
Signed-off-by Ivan T. Ivanov <[email protected]>--- .../devicetree/bindings/usb/msm-hsusb.txt | 57 +++++++++++++- drivers/usb/phy/phy-msm-usb.c | 79 +++++++++++++++++--- 2 files changed, 124 insertions(+), 12 deletions(-)[...]
Quoted 3 lines
Quoted 3 lines
Quoted 2 lines
+
+-dr_mode: One of "host", "peripheral" or "otg". Defaults to "otg"
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
If this has a default and thus isn't required, it should be listed as optional.
This is part of the standard USB bindings, Perhaps I could just refer to:
Documentation/devicetree/bindings/usb/generic.txtThat would be fine, but it should also be moved to the optional properties section.
Ok.
Quoted 19 lines
Quoted 19 lines
Quoted 18 lines
Quoted 4 lines
Documentation/devicetree/bindings/usb/msm-hsusb.txt Required properties: · line 63
Quoted 10 lines
Documentation/devicetree/bindings/usb/msm-hsusb.txt +10
-0+ +- vdccx-supply: phandle to the regulator for the vdd supply for + digital circuit operation. +- v1p8-supply: phandle to the regulator for the 1.8V supply +- v3p3-supply: phandle to the regulator for the 3.3V supply + +- qcom,otg-control: OTG control (VBUS and ID notifications) can be one of + 1 - PHY control + 2 - PMIC control + 3 - User control (via debugfs)NAK. This does not seem like a description of the hardware, and given the debugfs comment is fundamentally tied to the way Linux functions today.
Quoted 3 lines
Quoted 1 line
I will remove option 3, but rest are really property of the chipset.
Can you elaborate on the diffence please?
Difference is how VBUS, ID changes, Accessory and Charger detection is handled. In older chips-sets they are handled by PHY controller, while now they are handled by external PMIC logic.
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
Documentation/devicetree/bindings/usb/msm-hsusb.txt Required properties: · line 67
Quoted 7 lines
Documentation/devicetree/bindings/usb/msm-hsusb.txt +4
-0+ +Optional properties: +- qcom,phy-init-sequence: PHY configuration sequence. val, reg pairs + terminate with -1What is this? I'm really not keen on having arbitrary register/memory poking sequences in the dt.
Quoted 5 lines
Quoted 2 lines
This is related Device Mode Eye Diagram test and values used could be different between chipsets.
Ok. Then we should encode the tuning data rather than adding a mechanism to allow for writes to arbitrary addresses.
Currently:
for msm8226 sequence is < 0x44 0x80 0x68 0x81 0x24 0x82 0x13 0x83 > for msm8974 sequence is < 0x63 0x81 >
I could reserve -1 as "do not program" value and document that values in this array will be written to ULPI interface with ULPI_EXT_VENDOR_SPECIFIC as base address.
for msm8974 sequence will be < -1 0x63 >
Quoted 9 lines
Quoted 7 lines
Quoted 5 lines
Why does it need to be terminated? Surely the size of the property tells you that it's terminated.
Yes. -1 termination could be done in driver.
Please do. There's no need for it to be in the DT.
Thanks. Ivan
Quoted 7 lines
Cheers,
Mark.
--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v4 11/15 usb: phy: msm: Use reset framework for LINK and PHY resets
In reply to Ivan T. IvanovFrom: "Ivan T. Ivanov" <[email protected]>
--- .../devicetree/bindings/usb/msm-hsusb.txt | 9 ++++++ drivers/usb/phy/phy-msm-usb.c | 30 ++++++++++++++------ include/linux/usb/msm_hsusb.h | 3 ++ 3 files changed, 34 insertions(+), 8 deletions(-)
Documentation/devicetree/bindings/usb/msm-hsusb.txt +9 -0
@@ -57,6 +57,12 @@ Required properties: - v1p8-supply: phandle to the regulator for the 1.8V supply - v3p3-supply: phandle to the regulator for the 3.3V supply +- resets: A list of phandle + reset-specifier pairs for the + resets listed in reset-names +- reset-names: Should contain the following: + "phy" USB PHY controller reset + "link" USB LINK controller reset + - qcom,otg-control: OTG control (VBUS and ID notifications) can be one of 1 - PHY control 2 - PMIC control
@@ -83,6 +89,9 @@ Example HSUSB OTG controller device node: v1p8-supply = <&pm8941_l6>; v3p3-supply = <&pm8941_l24>; + resets = <&gcc GCC_USB2A_PHY_BCR>, <&gcc GCC_USB_HS_BCR>; + reset-names = "phy", "link"; + qcom,otg-control = <1>; qcom,phy-init-sequence = <0x01 0x90 0xffffffff>; };
drivers/usb/phy/phy-msm-usb.c +22 -8
@@ -32,6 +32,7 @@#include <linux/pm_runtime.h> #include <linux/of.h> #include <linux/of_device.h> +#include <linux/reset.h> #include <linux/usb.h> #include <linux/usb/otg.h>
@@ -260,12 +261,16 @@ static void ulpi_init(struct msm_otg *motg)static int msm_otg_link_clk_reset (struct msm_otg *motg,bool assert) { -int ret =0 ; +int ret; -if (!motg->pdata->link_clk_reset) -return ret; +if (motg->pdata->link_clk_reset) + ret = motg->pdata->link_clk_reset (motg->clk, assert); +else +if (assert) + ret =reset_control_assert (motg->link_rst); +else + ret =reset_control_deassert (motg->link_rst); - ret = motg->pdata->link_clk_reset (motg->clk, assert);if (ret)dev_err (motg->phy.dev,"usb link clk reset %s failed\n" , assert ?"assert" :"deassert" );
@@ -275,12 +280,13 @@ static int msm_otg_link_clk_reset(struct msm_otg *motg, bool assert)static int msm_otg_phy_clk_reset (struct msm_otg *motg) { -int ret =0 ; +int ret; -if (!motg->pdata->phy_clk_reset) -return ret; +if (motg->pdata->phy_clk_reset) + ret = motg->pdata->phy_clk_reset (motg->phy_reset_clk); +else + ret =reset_control_reset (motg->phy_rst); - ret = motg->pdata->phy_clk_reset (motg->phy_reset_clk);if (ret)dev_err (motg->phy.dev,"usb phy clk reset failed\n" );
@@ -1373,6 +1379,14 @@ static int msm_otg_read_dt(struct platform_device *pdev, struct msm_otg *motg) id =of_match_device (msm_otg_dt_match, &pdev->dev); pdata->phy_type = (int ) id->data; + motg->link_rst =devm_reset_control_get (&pdev->dev,"link" ); +if (IS_ERR (motg->link_rst)) +return PTR_ERR (motg->link_rst); + + motg->phy_rst =devm_reset_control_get (&pdev->dev,"phy" ); +if (IS_ERR (motg->phy_rst)) +return PTR_ERR (motg->phy_rst); + pdata->mode =of_usb_get_dr_mode (node);if (pdata->mode ==USB_DR_MODE_UNKNOWN ) pdata->mode =USB_DR_MODE_OTG ;
include/linux/usb/msm_hsusb.h +3 -0
@@ -163,6 +163,9 @@ struct msm_otg {struct regulator *v3p3;struct regulator *v1p8;struct regulator *vddcx; + +struct reset_control *phy_rst; + struct reset_control *link_rst; };#endif
Signature · 1 line
1.7.9.5
PATCH v4 12/15 usb: phy: msm: Add support for secondary PHY control
In reply to Ivan T. IvanovFrom: "Ivan T. Ivanov" <[email protected]>
Allow support to use 2nd HSPHY with USB2 Core.
Some platforms may have configuration to allow USB controller work with any of the two HSPHYs present. By default driver configures USB core to use primary HSPHY. Add support to allow user select 2nd HSPHY using DT parameter.
--- .../devicetree/bindings/usb/msm-hsusb.txt | 6 +++++ drivers/usb/phy/phy-msm-usb.c | 24 ++++++++++++++++++-- include/linux/usb/msm_hsusb.h | 1 + include/linux/usb/msm_hsusb_hw.h | 1 + 4 files changed, 30 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/usb/msm-hsusb.txt +6 -0
@@ -72,6 +72,12 @@ Optional properties: - qcom,phy-init-sequence: PHY configuration sequence. val, reg pairs terminate with -1 +- qcom,phy-num: Select number of pyco-phy to use, can be one of + 0 - PHY one, default + 1 - Second PHY + Some platforms may have configuration to allow USB + controller work with any of the two HSPHYs present. + Example HSUSB OTG controller device node: usb@f9a55000 {
drivers/usb/phy/phy-msm-usb.c +22 -2
@@ -340,6 +340,9 @@ static int msm_otg_phy_reset(struct msm_otg *motg)if (!retries)return -ETIMEDOUT ; +if (motg->phy_number) +writel (readl (USB_PHY_CTRL2 ) |BIT (16 ),USB_PHY_CTRL2 ); +dev_info (motg->phy.dev,"phy_reset: success\n" );return 0 ; }
@@ -394,6 +397,9 @@ static int msm_otg_reset(struct usb_phy *phy)ulpi_write (phy, ulpi_val,ULPI_USB_INT_EN_FALL ); } +if (motg->phy_number) +writel (readl (USB_PHY_CTRL2 ) |BIT (16 ),USB_PHY_CTRL2 ); +return 0 ; }
@@ -406,6 +412,7 @@ static int msm_otg_suspend(struct msm_otg *motg)struct usb_phy *phy = &motg->phy;struct usb_bus *bus = phy->otg->host;struct msm_otg_platform_data *pdata = motg->pdata; +void __iomem *addr;int cnt =0 ;if (atomic_read (&motg->in_lpm))
@@ -465,9 +472,13 @@ static int msm_otg_suspend(struct msm_otg *motg)*/ writel (readl (USB_USBCMD ) |ASYNC_INTR_CTRL |ULPI_STP_CTRL ,USB_USBCMD ); + addr =USB_PHY_CTRL ; +if (motg->phy_number) + addr =USB_PHY_CTRL2 ; +if (motg->pdata->phy_type ==SNPS_28NM_INTEGRATED_PHY && motg->pdata->otg_control ==OTG_PMIC_CONTROL ) -writel (readl (USB_PHY_CTRL ) |PHY_RETEN ,USB_PHY_CTRL ); +writel (readl (addr) |PHY_RETEN , addr);clk_disable_unprepare (motg->pclk);clk_disable_unprepare (motg->clk);
@@ -497,6 +508,7 @@ static int msm_otg_resume(struct msm_otg *motg) {struct usb_phy *phy = &motg->phy;struct usb_bus *bus = phy->otg->host; +void __iomem *addr;int cnt =0 ;unsigned temp;
@@ -510,9 +522,14 @@ static int msm_otg_resume(struct msm_otg *motg)if (motg->pdata->phy_type ==SNPS_28NM_INTEGRATED_PHY && motg->pdata->otg_control ==OTG_PMIC_CONTROL ) { + + addr =USB_PHY_CTRL ; +if (motg->phy_number) + addr =USB_PHY_CTRL2 ; +msm_hsusb_ldo_set_mode (motg,1 );msm_hsusb_config_vddcx (motg,1 ); -writel (readl (USB_PHY_CTRL ) & ~PHY_RETEN ,USB_PHY_CTRL ); +writel (readl (addr) & ~PHY_RETEN , addr); } temp =readl (USB_USBCMD );
@@ -1395,6 +1412,9 @@ static int msm_otg_read_dt(struct platform_device *pdev, struct msm_otg *motg)if (!of_property_read_u32 (node,"qcom,otg-control" , &val)) pdata->otg_control = val; +if (!of_property_read_u32 (node,"qcom,phy-num" , &val)) + motg->phy_number = val; +if (!of_get_property (node,"qcom,phy-init-sequence" , &len) || !len)return 0 ;
include/linux/usb/msm_hsusb.h +1 -0
@@ -156,6 +156,7 @@ struct msm_otg {atomic_t in_lpm;int async_int;unsigned cur_power; +int phy_number;struct delayed_work chg_work;enum usb_chg_state chg_state;enum usb_chg_type chg_type;
include/linux/usb/msm_hsusb_hw.h +1 -0
@@ -25,6 +25,7 @@#define USB_OTGSC (MSM_USB_BASE + 0x01A4)#define USB_USBMODE (MSM_USB_BASE + 0x01A8)#define USB_PHY_CTRL (MSM_USB_BASE + 0x0240) +#define USB_PHY_CTRL2 (MSM_USB_BASE + 0x0278)#define USBCMD_RESET 2#define USB_USBINTR (MSM_USB_BASE + 0x0148)
Signature · 6 lines
1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v4 12/15] usb: phy: msm: Add support for secondary PHY control
Quoted 23 lines · Ivan T. Ivanov
From: "Ivan T. Ivanov" <[email protected]>
Allow support to use 2nd HSPHY with USB2 Core.
Some platforms may have configuration to allow USB controller work with any of the two HSPHYs present. By default driver configures USB core to use primary HSPHY. Add support to allow user select 2nd HSPHY using DT parameter.Signed-off-by Ivan T. Ivanov <[email protected]>Cc Manu Gautam <[email protected]>--- .../devicetree/bindings/usb/msm-hsusb.txt | 6 +++++ drivers/usb/phy/phy-msm-usb.c | 24 ++++++++++++++++++-- include/linux/usb/msm_hsusb.h | 1 + include/linux/usb/msm_hsusb_hw.h | 1 + 4 files changed, 30 insertions(+), 2 deletions(-)Documentation/devicetree/bindings/usb/msm-hsusb.txt +0
-0
Documentation/devicetree/bindings/usb/msm-hsusb.txt Optional properties: · line 80
Quoted 9 lines
Documentation/devicetree/bindings/usb/msm-hsusb.txt +6
-0@@ -72,6 +72,12 @@ Optional properties: - qcom,phy-init-sequence: PHY configuration sequence. val, reg pairs terminate with -1 +- qcom,phy-num: Select number of pyco-phy to use, can be one of + 0 - PHY one, default + 1 - Second PHY + Some platforms may have configuration to allow USB + controller work with any of the two HSPHYs present. +
Only one can be used at a time?
[...]
Documentation/devicetree/bindings/usb/msm-hsusb.txt static int msm_otg_read_dt(struct platform_device *pdev, struct msm_otg *motg) · line 1416
Quoted 6 lines
Documentation/devicetree/bindings/usb/msm-hsusb.txt +2
-0@@ -1395,6 +1412,9 @@ static int msm_otg_read_dt(struct platform_device *pdev, struct msm_otg *motg) if (!of_property_read_u32(node, "qcom,otg-control", &val)) pdata->otg_control = val; + if (!of_property_read_u32(node, "qcom,phy-num", &val)) + motg->phy_number = val;
No sanity checking? If not all of your tests on the value of motg->phy_number are the same form, you may get undepected results...
Mark.
Re: [PATCH v4 12/15] usb: phy: msm: Add support for secondary PHY control
Hi Mark,
Quoted 27 lines · Mark Rutland
Quoted 26 lines · Ivan T. Ivanov
From: "Ivan T. Ivanov" <[email protected]>
Allow support to use 2nd HSPHY with USB2 Core.
Some platforms may have configuration to allow USB controller work with any of the two HSPHYs present. By default driver configures USB core to use primary HSPHY. Add support to allow user select 2nd HSPHY using DT parameter.Signed-off-by Ivan T. Ivanov <[email protected]>Cc Manu Gautam <[email protected]>--- .../devicetree/bindings/usb/msm-hsusb.txt | 6 +++++ drivers/usb/phy/phy-msm-usb.c | 24 ++++++++++++++++++-- include/linux/usb/msm_hsusb.h | 1 + include/linux/usb/msm_hsusb_hw.h | 1 + 4 files changed, 30 insertions(+), 2 deletions(-)Documentation/devicetree/bindings/usb/msm-hsusb.txt +0
-0@@ -72,6 +72,12 @@ Optional properties: - qcom,phy-init-sequence: PHY configuration sequence. val, reg pairs terminate with -1
Quoted 8 lines
Documentation/devicetree/bindings/usb/msm-hsusb.txt Optional properties: · line 80
Quoted 6 lines
Documentation/devicetree/bindings/usb/msm-hsusb.txt +6
-0+- qcom,phy-num: Select number of pyco-phy to use, can be one of + 0 - PHY one, default + 1 - Second PHY + Some platforms may have configuration to allow USB + controller work with any of the two HSPHYs present. +Only one can be used at a time?
Yes only one of them. Selected at driver init time.
Quoted 7 lines
[...]
Quoted 4 lines
Documentation/devicetree/bindings/usb/msm-hsusb.txt +0
-0@@ -1395,6 +1412,9 @@ static int msm_otg_read_dt(struct platform_device *pdev, struct msm_otg *motg) if (!of_property_read_u32(node, "qcom,otg-control", &val)) pdata->otg_control = val;
Quoted 5 lines
Documentation/devicetree/bindings/usb/msm-hsusb.txt static int msm_otg_read_dt(struct platform_device *pdev, struct msm_otg *motg) · line 1416
Quoted 2 lines
Documentation/devicetree/bindings/usb/msm-hsusb.txt +2
-0+ if (!of_property_read_u32(node, "qcom,phy-num", &val)) + motg->phy_number = val;No sanity checking? If not all of your tests on the value of
motg->phy_numberare the same form, you may get undepected results...
All checks are the same, but will add explicit check.
Thanks,
Ivan
Quoted 2 lines
Mark.
Re: [PATCH v4 12/15] usb: phy: msm: Add support for secondary PHY control
Quoted 40 lines · Ivan T. Ivanov
Hi Mark,
Quoted 27 lines · Mark Rutland
Quoted 26 lines · Ivan T. Ivanov
From: "Ivan T. Ivanov" <[email protected]>
Allow support to use 2nd HSPHY with USB2 Core.
Some platforms may have configuration to allow USB controller work with any of the two HSPHYs present. By default driver configures USB core to use primary HSPHY. Add support to allow user select 2nd HSPHY using DT parameter.Signed-off-by Ivan T. Ivanov <[email protected]>Cc Manu Gautam <[email protected]>--- .../devicetree/bindings/usb/msm-hsusb.txt | 6 +++++ drivers/usb/phy/phy-msm-usb.c | 24 ++++++++++++++++++-- include/linux/usb/msm_hsusb.h | 1 + include/linux/usb/msm_hsusb_hw.h | 1 + 4 files changed, 30 insertions(+), 2 deletions(-)Documentation/devicetree/bindings/usb/msm-hsusb.txt +0
-0@@ -72,6 +72,12 @@ Optional properties: - qcom,phy-init-sequence: PHY configuration sequence. val, reg pairs terminate with -1Quoted 8 lines
Documentation/devicetree/bindings/usb/msm-hsusb.txt Optional properties: · line 80
Quoted 6 lines
Documentation/devicetree/bindings/usb/msm-hsusb.txt +6
-0+- qcom,phy-num: Select number of pyco-phy to use, can be one of + 0 - PHY one, default + 1 - Second PHY + Some platforms may have configuration to allow USB + controller work with any of the two HSPHYs present. +Only one can be used at a time?
Quoted 1 line
Yes only one of them. Selected at driver init time.
Ok. For a given platform, is it likely that both are wired up and _possibly_ usable?
Thanks
Mark.
Re: [PATCH v4 12/15] usb: phy: msm: Add support for secondary PHY control
Hi,
Quoted 41 lines · Mark Rutland
Quoted 40 lines · Ivan T. Ivanov
Hi Mark,
Quoted 35 lines · Mark Rutland
Quoted 23 lines · Ivan T. Ivanov
From: "Ivan T. Ivanov" <[email protected]>
Allow support to use 2nd HSPHY with USB2 Core.
Some platforms may have configuration to allow USB controller work with any of the two HSPHYs present. By default driver configures USB core to use primary HSPHY. Add support to allow user select 2nd HSPHY using DT parameter.Signed-off-by Ivan T. Ivanov <[email protected]>Cc Manu Gautam <[email protected]>--- .../devicetree/bindings/usb/msm-hsusb.txt | 6 +++++ drivers/usb/phy/phy-msm-usb.c | 24 ++++++++++++++++++-- include/linux/usb/msm_hsusb.h | 1 + include/linux/usb/msm_hsusb_hw.h | 1 + 4 files changed, 30 insertions(+), 2 deletions(-)Documentation/devicetree/bindings/usb/msm-hsusb.txt +0
-0Documentation/devicetree/bindings/usb/msm-hsusb.txt Optional properties: · line 80
Quoted 9 lines
Documentation/devicetree/bindings/usb/msm-hsusb.txt +6
-0@@ -72,6 +72,12 @@ Optional properties: - qcom,phy-init-sequence: PHY configuration sequence. val, reg pairs terminate with -1 +- qcom,phy-num: Select number of pyco-phy to use, can be one of + 0 - PHY one, default + 1 - Second PHY + Some platforms may have configuration to allow USB + controller work with any of the two HSPHYs present. +Only one can be used at a time?
Quoted 4 lines
Quoted 1 line
Yes only one of them. Selected at driver init time.
Ok. For a given platform, is it likely that both are wired up and _possibly_ usable?
My guess is that this is possible :-) Regards. Ivan
Quoted 3 lines
Thanks
Mark.
PATCH v4 13/15 usb: phy: msm: Correct USB PHY Reset sequence for newer platform
In reply to Ivan T. IvanovFrom: "Ivan T. Ivanov" <[email protected]>
On few legacy platforms, USB PHY is having dedicated reset clk. It is used to reset USB PHY after putting USB PHY into low power mode and for calibration of USB PHY. Putting USB PHY into low power mode is causing ulpi read/write timeout as expected. USB PHY reset clk is not available on newer platform.
For 28nm PHY, reset USB PHY after resestting USB LINK. Also reset USB PHY using USB_PHY_PON bit with USB_OTG_HS_PHY_CTRL register after programming USB PHY Override registers as suggested with hardware programming guidelines.
--- drivers/usb/phy/phy-msm-usb.c | 141 ++++++++++++++++++++++++-------------- include/linux/usb/msm_hsusb_hw.h | 5 ++ 2 files changed, 94 insertions(+), 52 deletions(-)
drivers/usb/phy/phy-msm-usb.c +89 -52
@@ -48,6 +48,7 @@#define DRIVER_NAME "msm_otg"#define ULPI_IO_TIMEOUT_USEC (10 * 1000) +#define LINK_RESET_TIMEOUT_USEC (250 * 1000)#define USB_PHY_3P3_VOL_MIN 3050000/* uV */ #define USB_PHY_3P3_VOL_MAX 3300000/* uV */
@@ -293,77 +294,35 @@ static int msm_otg_phy_clk_reset(struct msm_otg *motg)return ret; } -static int msm_otg_phy_reset (struct msm_otg *motg) +static int msm_link_reset (struct msm_otg *motg) {u32 val;int ret; -int retries; ret =msm_otg_link_clk_reset (motg,1 );if (ret)return ret; - ret =msm_otg_phy_clk_reset (motg); -if (ret) -return ret; - ret =msm_otg_link_clk_reset (motg,0 ); -if (ret) -return ret; - val =readl (USB_PORTSC ) & ~PORTSC_PTS_MASK ; -writel (val |PORTSC_PTS_ULPI ,USB_PORTSC ); - -for (retries =3 ; retries >0 ; retries--) { - ret =ulpi_write (&motg->phy,ULPI_FUNC_CTRL_SUSPENDM , -ULPI_CLR (ULPI_FUNC_CTRL )); -if (!ret) -break ; - ret =msm_otg_phy_clk_reset (motg); -if (ret) -return ret; - } -if (!retries) -return -ETIMEDOUT ; +/* wait for 1ms delay as suggested in HPG. */ +usleep_range (1000 ,1200 ); -/* This reset calibrates the phy, if the above write succeeded */ - ret =msm_otg_phy_clk_reset (motg); + ret =msm_otg_link_clk_reset (motg,0 );if (ret)return ret; -for (retries =3 ; retries >0 ; retries--) { - ret =ulpi_read (&motg->phy,ULPI_DEBUG ); -if (ret != -ETIMEDOUT ) -break ; - ret =msm_otg_phy_clk_reset (motg); -if (ret) -return ret; - } -if (!retries) -return -ETIMEDOUT ; -if (motg->phy_number)writel (readl (USB_PHY_CTRL2 ) |BIT (16 ),USB_PHY_CTRL2 ); -dev_info (motg->phy.dev,"phy_reset: success\n" ); + val =readl (USB_PORTSC ) & ~PORTSC_PTS_MASK ; +writel (val |PORTSC_PTS_ULPI ,USB_PORTSC ); +return 0 ; } -#define LINK_RESET_TIMEOUT_USEC (250 * 1000)static int msm_otg_reset (struct usb_phy *phy) { struct msm_otg *motg = container_of(phy, struct msm_otg, phy); -struct msm_otg_platform_data *pdata = motg->pdata;int cnt =0 ; -int ret; -u32 val =0 ; -u32 ulpi_val =0 ; - - ret =msm_otg_phy_reset (motg); -if (ret) { -dev_err (phy->dev,"phy_reset failed\n" ); -return ret; - } - -ulpi_init (motg);writel (USBCMD_RESET ,USB_USBCMD );while (cnt <LINK_RESET_TIMEOUT_USEC ) {
@@ -377,11 +336,87 @@ static int msm_otg_reset(struct usb_phy *phy)/* select ULPI phy */ writel (0x80000000 ,USB_PORTSC ); +writel (0x0 ,USB_AHBBURST ); +writel (0x08 ,USB_AHBMODE ); + +if (motg->phy_number) +writel (readl (USB_PHY_CTRL2 ) |BIT (16 ),USB_PHY_CTRL2 ); +return 0 ; +} + +static void msm_phy_reset (struct msm_otg *motg) +{ +void __iomem *addr; +u32 val; + +if (motg->pdata->phy_type !=SNPS_28NM_INTEGRATED_PHY ) { +msm_otg_phy_clk_reset (motg); +return ; + } + + addr =USB_PHY_CTRL ; +if (motg->phy_number) + addr =USB_PHY_CTRL2 ; + +/* Assert USB PHY_PON */ + val =readl (addr); + val |=PHY_POR_ASSERT ; +writel (val, addr); + +/* wait for minimum 10 microseconds as suggested in HPG. */ +usleep_range (10 ,15 ); + +/* Deassert USB PHY_PON */ + val =readl (addr); + val &= ~PHY_POR_ASSERT ; +writel (val, addr); +} + +static int msm_usb_reset (struct usb_phy *phy) +{ + struct msm_otg *motg = container_of(phy, struct msm_otg, phy); +int ret; + +if (!IS_ERR (motg->core_clk)) +clk_prepare_enable (motg->core_clk); + + ret =msm_link_reset (motg); +if (ret) { +dev_err (phy->dev,"phy_reset failed\n" ); +return ret; + } + + ret =msm_otg_reset (&motg->phy); +if (ret) { +dev_err (phy->dev,"link reset failed\n" ); +return ret; + }msleep (100 ); -writel (0x0 ,USB_AHBBURST ); -writel (0x00 ,USB_AHBMODE ); +/* Reset USB PHY after performing USB Link RESET */ +msm_phy_reset (motg); + +if (!IS_ERR (motg->core_clk)) +clk_disable_unprepare (motg->core_clk); + +return 0 ; +} + +static int msm_phy_init (struct usb_phy *phy) +{ + struct msm_otg *motg = container_of(phy, struct msm_otg, phy); +struct msm_otg_platform_data *pdata = motg->pdata; +u32 val, ulpi_val =0 ; + +/* Program USB PHY Override registers. */ +ulpi_init (motg); + +/* +* It is recommended in HPG to reset USB PHY after programming +* USB PHY Override registers. +*/ +msm_phy_reset (motg);if (pdata->otg_control ==OTG_PHY_CONTROL ) { val =readl (USB_OTGSC );
@@ -1560,7 +1595,7 @@ static int __init msm_otg_probe(struct platform_device *pdev) goto disable_ldo; } - phy->init = msm_otg_reset; + phy->init = msm_phy_init; phy->set_power = msm_otg_set_power; phy->io_ops = &msm_otg_io_ops;
@@ -1569,6 +1604,8 @@ static int __init msm_otg_probe(struct platform_device *pdev) phy->otg->set_host = msm_otg_set_host; phy->otg->set_peripheral = msm_otg_set_peripheral; +msm_usb_reset (phy); + ret =usb_add_phy (&motg->phy,USB_PHY_TYPE_USB2 );if (ret) {dev_err (&pdev->dev,"usb_add_phy failed\n" );
include/linux/usb/msm_hsusb_hw.h +5 -0
@@ -42,9 +42,14 @@#define ULPI_DATA (n) ((n) & 255)#define ULPI_DATA_READ (n) (((n) >> 8) & 255) +/* synopsys 28nm phy registers */ +#define ULPI_PWR_CLK_MNG_REG 0x88 +#define OTG_COMP_DISABLE BIT(0) +#define ASYNC_INTR_CTRL (1 << 29)/* Enable async interrupt */ #define ULPI_STP_CTRL (1 << 30)/* Block communication with PHY */ #define PHY_RETEN (1 << 1)/* PHY retention enable/disable */ +#define PHY_POR_ASSERT (1 << 0)/* USB2 28nm PHY POR ASSERT */ /* OTG definitions */ #define OTGSC_INTSTS_MASK (0x7f << 16)
Signature · 6 lines
1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v4 14/15 usb: phy: msm: Handle disconnect events
In reply to Ivan T. IvanovFrom: "Ivan T. Ivanov" <[email protected]>
Put the transceiver in non-driving mode. Otherwise host may not detect soft-disconnection.
--- drivers/usb/phy/phy-msm-usb.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/usb/phy/phy-msm-usb.c +18 -0
@@ -260,6 +260,23 @@ static void ulpi_init(struct msm_otg *motg) } } +static int msm_phy_notify_disconnect (struct usb_phy *phy, +enum usb_device_speed speed) +{ +int val; + +/* +* Put the transceiver in non-driving mode. Otherwise host +* may not detect soft-disconnection. +*/ + val =ulpi_read (phy,ULPI_FUNC_CTRL ); + val &= ~ULPI_FUNC_CTRL_OPMODE_MASK ; + val |=ULPI_FUNC_CTRL_OPMODE_NONDRIVING ; +ulpi_write (phy, val,ULPI_FUNC_CTRL ); + +return 0 ; +} +static int msm_otg_link_clk_reset (struct msm_otg *motg,bool assert) {int ret;
@@ -1597,6 +1614,7 @@ static int __init msm_otg_probe(struct platform_device *pdev) phy->init = msm_phy_init; phy->set_power = msm_otg_set_power; + phy->notify_disconnect = msm_phy_notify_disconnect; phy->io_ops = &msm_otg_io_ops;
Signature · 1 line
1.7.9.5
PATCH v4 15/15 usb: phy: msm: Vote for corner of VDD CX instead of voltage of VDD CX
In reply to Ivan T. IvanovFrom: "Ivan T. Ivanov" <[email protected]>
New platform uses RBCPR hardware feature, with that voting for absolute voltage of VDD CX is not required. Hence vote for corner of VDD CX which uses nominal corner voltage on VDD CX.
--- .../devicetree/bindings/usb/msm-hsusb.txt | 6 ++++ drivers/usb/phy/phy-msm-usb.c | 35 +++++++++++++++----- include/linux/usb/msm_hsusb.h | 1 + 3 files changed, 34 insertions(+), 8 deletions(-)
Documentation/devicetree/bindings/usb/msm-hsusb.txt +6 -0
@@ -78,6 +78,11 @@ Optional properties: Some platforms may have configuration to allow USB controller work with any of the two HSPHYs present. +- qcom,vdd-levels: This property must be a list of three integer + values (no, min, max) where each value represents + either a voltage in microvolts or a value corresponding + to voltage corner. + Example HSUSB OTG controller device node: usb@f9a55000 {
@@ -100,4 +105,5 @@ Example HSUSB OTG controller device node: qcom,otg-control = <1>; qcom,phy-init-sequence = <0x01 0x90 0xffffffff>; + qcom,vdd-levels = <1 5 7>; };
drivers/usb/phy/phy-msm-usb.c +27 -8
@@ -62,6 +62,13 @@#define USB_PHY_VDD_DIG_VOL_MIN 1000000/* uV */ #define USB_PHY_VDD_DIG_VOL_MAX 1320000/* uV */ +#define USB_PHY_SUSP_DIG_VOL 500000/* uV */ + +enum vdd_levels { +VDD_LEVEL_NONE =0 , +VDD_LEVEL_MIN , +VDD_LEVEL_MAX , +};static int msm_hsusb_init_vddcx (struct msm_otg *motg,int init) {
@@ -69,8 +76,8 @@ static int msm_hsusb_init_vddcx(struct msm_otg *motg, int init)if (init) { ret =regulator_set_voltage (motg->vddcx, -USB_PHY_VDD_DIG_VOL_MIN , -USB_PHY_VDD_DIG_VOL_MAX ); + motg->vdd_levels[VDD_LEVEL_MIN ], + motg->vdd_levels[VDD_LEVEL_MAX ]);if (ret) {dev_err (motg->phy.dev,"Cannot set vddcx voltage\n" );return ret;
@@ -81,7 +88,7 @@ static int msm_hsusb_init_vddcx(struct msm_otg *motg, int init)dev_err (motg->phy.dev,"unable to enable hsusb vddcx\n" ); }else { ret =regulator_set_voltage (motg->vddcx,0 , -USB_PHY_VDD_DIG_VOL_MAX ); + motg->vdd_levels[VDD_LEVEL_MAX ]);if (ret)dev_err (motg->phy.dev,"Cannot set vddcx voltage\n" ); ret =regulator_disable (motg->vddcx);
@@ -131,17 +138,16 @@ exit: }#ifdef CONFIG_PM_SLEEP -#define USB_PHY_SUSP_DIG_VOL 500000static int msm_hsusb_config_vddcx (struct msm_otg *motg,int high) { -int max_vol =USB_PHY_VDD_DIG_VOL_MAX ; +int max_vol = motg->vdd_levels[VDD_LEVEL_MAX ];int min_vol;int ret;if (high) - min_vol =USB_PHY_VDD_DIG_VOL_MIN ; + min_vol = motg->vdd_levels[VDD_LEVEL_MIN ];else - min_vol =USB_PHY_SUSP_DIG_VOL ; + min_vol = motg->vdd_levels[VDD_LEVEL_NONE ]; ret =regulator_set_voltage (motg->vddcx, min_vol, max_vol);if (ret) {
@@ -1437,7 +1443,7 @@ static int msm_otg_read_dt(struct platform_device *pdev, struct msm_otg *motg)const struct of_device_id *id;struct device_node *node = pdev->dev.of_node;int len =0 ; -u32 val; +u32 val, tmp[3 ]; pdata =devm_kzalloc (&pdev->dev,sizeof (*pdata),GFP_KERNEL );if (!pdata)
@@ -1467,6 +1473,19 @@ static int msm_otg_read_dt(struct platform_device *pdev, struct msm_otg *motg)if (!of_property_read_u32 (node,"qcom,phy-num" , &val)) motg->phy_number = val; + motg->vdd_levels[VDD_LEVEL_NONE ] =USB_PHY_SUSP_DIG_VOL ; + motg->vdd_levels[VDD_LEVEL_MIN ] =USB_PHY_VDD_DIG_VOL_MIN ; + motg->vdd_levels[VDD_LEVEL_MAX ] =USB_PHY_VDD_DIG_VOL_MAX ; + +if (of_get_property (node,"qcom,vdd-levels" , &len) && + len ==sizeof (tmp)) { +of_property_read_u32_array (node,"qcom,vdd-levels" , + tmp, len /sizeof (*tmp)); + motg->vdd_levels[VDD_LEVEL_NONE ] = tmp[VDD_LEVEL_NONE ]; + motg->vdd_levels[VDD_LEVEL_MIN ] = tmp[VDD_LEVEL_MIN ]; + motg->vdd_levels[VDD_LEVEL_MAX ] = tmp[VDD_LEVEL_MAX ]; + } +if (!of_get_property (node,"qcom,phy-init-sequence" , &len) || !len)return 0 ;
include/linux/usb/msm_hsusb.h +1 -0
@@ -167,6 +167,7 @@ struct msm_otg {struct reset_control *phy_rst;struct reset_control *link_rst; + int vdd_levels[3]; };#endif
Signature · 1 line
1.7.9.5
Hi,
Quoted 15 lines · Ivan T. Ivanov
From: "Ivan T. Ivanov" <[email protected]>
Hi,
Patches have been tested on top of Stephen's clock controller patches[1] and recent fixes for chipidea msm glue layer driver posted here[2]. Hardware platform AP8074 DragonBoard. Only gadget mode utilized for now.
CV Test Suite engine "Chapter 9 tests" are passing except "Halt Endpoint Test".
usbtest driver report following failure:
test 13 --> 32 (Broken pipe) ep 81 couldn't set halt, -32
Quoted 8 lines
This will be investigated further.
Patches could be applied cleanly on top of the usb-3.13-rc1.Regards,
Ivan[1] http://comments.gmane.org/gmane.linux.ports.arm.msm/5375
[2] https://lkml.org/lkml/2013/11/11/310
I wonder how will this be taken upstream provided there are interdependencies between arch/ and drivers/ patches.
I can Ack patches but I'd really like to avoid merging of topic branches all over the place :-s
cheers
Signature · 1 line
balbi
Quoted 24 lines · Felipe Balbi
Hi,
Quoted 21 lines · Ivan T. Ivanov
From: "Ivan T. Ivanov" <[email protected]>
Hi,
Patches have been tested on top of Stephen's clock controller patches[1] and recent fixes for chipidea msm glue layer driver posted here[2]. Hardware platform AP8074 DragonBoard. Only gadget mode utilized for now.
CV Test Suite engine "Chapter 9 tests" are passing except "Halt Endpoint Test".
usbtest driver report following failure:
test 13 --> 32 (Broken pipe) ep 81 couldn't set halt, -32This will be investigated further.
Patches could be applied cleanly on top of the usb-3.13-rc1.Regards,
Ivan
Quoted 8 lines
Quoted 2 lines
[1] http://comments.gmane.org/gmane.linux.ports.arm.msm/5375
[2] https://lkml.org/lkml/2013/11/11/310I wonder how will this be taken upstream provided there are interdependencies between
arch/anddrivers/patches.I can Ack patches but I'd really like to avoid merging of topic branches all over the place :-s
Ivan's patches are the only ones in this window that touch these board files in MSM. It's probably easiest if I ack them, and you can bring the whole series through your tree.
David
Signature · 3 lines
sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation
Quoted 31 lines · David Brown
Quoted 30 lines · Felipe Balbi
Hi,
Quoted 15 lines · Ivan T. Ivanov
From: "Ivan T. Ivanov" <[email protected]>
Hi,
Patches have been tested on top of Stephen's clock controller patches[1] and recent fixes for chipidea msm glue layer driver posted here[2]. Hardware platform AP8074 DragonBoard. Only gadget mode utilized for now.
CV Test Suite engine "Chapter 9 tests" are passing except "Halt Endpoint Test".
usbtest driver report following failure:
test 13 --> 32 (Broken pipe) ep 81 couldn't set halt, -32Quoted 8 lines
This will be investigated further.
Patches could be applied cleanly on top of the usb-3.13-rc1.Regards,
Ivan[1] http://comments.gmane.org/gmane.linux.ports.arm.msm/5375
[2] https://lkml.org/lkml/2013/11/11/310I wonder how will this be taken upstream provided there are interdependencies between
arch/anddrivers/patches.
Quoted 6 lines
Quoted 2 lines
I can Ack patches but I'd really like to avoid merging of topic branches all over the place :-s
Ivan's patches are the only ones in this window that touch these board files in MSM. It's probably easiest if I ack them, and you can bring the whole series through your tree.
it's getting quite late for me. I still want to leave my stuff soaking in linux-next for a while. I'll try my best, though, if you ack it ASAP ;-)
cheers
Signature · 1 line
balbi
Quoted 2 lines · Felipe Balbi
it's getting quite late for me. I still want to leave my stuff soaking in linux-next for a while. I'll try my best, though, if you ack it ASAP
Thanks. Patch 1 already has my Ack in it, and I've sent an ack for number 6.
David
Signature · 3 lines
sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation
Quoted 8 lines · David Brown
Quoted 2 lines · Felipe Balbi
it's getting quite late for me. I still want to leave my stuff soaking in linux-next for a while. I'll try my best, though, if you ack it ASAP
Thanks. Patch 1 already has my Ack in it, and I've sent an ack for number 6.
Felipe,
If this isn't picked up for 3.14 can we get an ack on patch 1 so we can send it through arm-soc as part of the multi-platform patches I have for MSM[1]?
[1] https://lkml.org/lkml/2013/12/4/523
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation