diff options
| author | Vijayavardhan Vennapusa <vvreddy@codeaurora.org> | 2017-02-16 16:25:35 +0530 |
|---|---|---|
| committer | Vijayavardhan Vennapusa <vvreddy@codeaurora.org> | 2017-02-20 17:14:30 +0530 |
| commit | 4fd545a06e53f21842fb5c4a09693ad211153187 (patch) | |
| tree | 929ac0e09775aab72b8fbded99b042695711d7ae | |
| parent | 3a7e752617514960c5cecdf84e12b13dc63c04c7 (diff) | |
USB: qusb: Add support to change TUNEX registers dynamically
Add required support to change QUSB2PHY_PORT_TUNE1/2/3/4/5 registers
dynamically for testing USB electrical complaince.
Change-Id: Id84d460c8f8dc8cdedabe3887859d6b90acf7c3f
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
| -rw-r--r-- | drivers/usb/phy/phy-msm-qusb.c | 44 |
1 files changed, 39 insertions, 5 deletions
diff --git a/drivers/usb/phy/phy-msm-qusb.c b/drivers/usb/phy/phy-msm-qusb.c index 170cbf0a853f..c5ea793990ed 100644 --- a/drivers/usb/phy/phy-msm-qusb.c +++ b/drivers/usb/phy/phy-msm-qusb.c @@ -72,6 +72,7 @@ #define QUSB2PHY_PORT_TUNE2 0x84 #define QUSB2PHY_PORT_TUNE3 0x88 #define QUSB2PHY_PORT_TUNE4 0x8C +#define QUSB2PHY_PORT_TUNE5 0x90 /* In case Efuse register shows zero, use this value */ #define TUNE2_DEFAULT_HIGH_NIBBLE 0xB @@ -102,10 +103,27 @@ #define QUSB2PHY_REFCLK_ENABLE BIT(0) +unsigned int tune1; +module_param(tune1, uint, S_IRUGO | S_IWUSR); +MODULE_PARM_DESC(tune1, "QUSB PHY TUNE1"); + unsigned int tune2; module_param(tune2, uint, S_IRUGO | S_IWUSR); MODULE_PARM_DESC(tune2, "QUSB PHY TUNE2"); +unsigned int tune3; +module_param(tune3, uint, S_IRUGO | S_IWUSR); +MODULE_PARM_DESC(tune3, "QUSB PHY TUNE3"); + +unsigned int tune4; +module_param(tune4, uint, S_IRUGO | S_IWUSR); +MODULE_PARM_DESC(tune4, "QUSB PHY TUNE4"); + +unsigned int tune5; +module_param(tune5, uint, S_IRUGO | S_IWUSR); +MODULE_PARM_DESC(tune5, "QUSB PHY TUNE5"); + + struct qusb_phy { struct usb_phy phy; void __iomem *base; @@ -556,13 +574,29 @@ static int qusb_phy_init(struct usb_phy *phy) qphy->base + QUSB2PHY_PORT_TUNE2); } - /* If tune2 modparam set, override tune2 value */ - if (tune2) { - pr_debug("%s(): (modparam) TUNE2 val:0x%02x\n", - __func__, tune2); + /* If tune modparam set, override tune value */ + + pr_debug("%s():userspecified modparams TUNEX val:0x%x %x %x %x %x\n", + __func__, tune1, tune2, tune3, tune4, tune5); + if (tune1) + writel_relaxed(tune1, + qphy->base + QUSB2PHY_PORT_TUNE1); + + if (tune2) writel_relaxed(tune2, qphy->base + QUSB2PHY_PORT_TUNE2); - } + + if (tune3) + writel_relaxed(tune3, + qphy->base + QUSB2PHY_PORT_TUNE3); + + if (tune4) + writel_relaxed(tune4, + qphy->base + QUSB2PHY_PORT_TUNE4); + + if (tune5) + writel_relaxed(tune5, + qphy->base + QUSB2PHY_PORT_TUNE5); /* ensure above writes are completed before re-enabling PHY */ wmb(); |
