* [PATCH 0/1] Fix static checker warning. @ 2020-07-28 17:02 周琰杰 (Zhou Yanjie) 2020-07-28 17:02 ` [PATCH 1/1] USB: PHY: JZ4770: " 周琰杰 (Zhou Yanjie) 0 siblings, 1 reply; 5+ messages in thread From: 周琰杰 (Zhou Yanjie) @ 2020-07-28 17:02 UTC (permalink / raw) To: balbi, gregkh Cc: linux-usb, linux-kernel, colin.king, dan.carpenter, paul, prasannatsmkumar, dongsheng.qiu, aric.pzqi, rick.tyliu, yanfei.li, sernia.zhou, zhenwenjin Fix the warning that appears during Static analysis. 周琰杰 (Zhou Yanjie) (1): USB: PHY: JZ4770: Fix static checker warning. drivers/usb/phy/phy-jz4770.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) -- 2.11.0 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/1] USB: PHY: JZ4770: Fix static checker warning. 2020-07-28 17:02 [PATCH 0/1] Fix static checker warning 周琰杰 (Zhou Yanjie) @ 2020-07-28 17:02 ` 周琰杰 (Zhou Yanjie) 2020-07-28 17:26 ` Andy Shevchenko 0 siblings, 1 reply; 5+ messages in thread From: 周琰杰 (Zhou Yanjie) @ 2020-07-28 17:02 UTC (permalink / raw) To: balbi, gregkh Cc: linux-usb, linux-kernel, colin.king, dan.carpenter, paul, prasannatsmkumar, dongsheng.qiu, aric.pzqi, rick.tyliu, yanfei.li, sernia.zhou, zhenwenjin The commit 2a6c0b82e651 ("USB: PHY: JZ4770: Add support for new Ingenic SoCs.") introduced the initialization function for different chips, but left the relevant code involved in the resetting process in the original function, resulting in uninitialized variable calls. This problem can be solved by putting this part of the code into the initialization function for each chip. Although the four processors currently supported have the same reset code, let us can solve this problem by adding the initialization of the reg variable to the original function, but when other processors with different reset methods (such as X2000) are introduced in the future, it will cause inevitable condition judgments to complicate the function, which violates the original intention of introducing initialization functions for each processor. Fixes: 2a6c0b82e651 ("USB: PHY: JZ4770: Add support for new Ingenic SoCs."). Reported-by: Colin Ian King <colin.king@canonical.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: 周琰杰 (Zhou Yanjie) <zhouyanjie@wanyeetech.com> --- drivers/usb/phy/phy-jz4770.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/drivers/usb/phy/phy-jz4770.c b/drivers/usb/phy/phy-jz4770.c index d4ee3cb721ea..23d38cbc150e 100644 --- a/drivers/usb/phy/phy-jz4770.c +++ b/drivers/usb/phy/phy-jz4770.c @@ -158,7 +158,6 @@ static int ingenic_usb_phy_init(struct usb_phy *phy) { struct jz4770_phy *priv = phy_to_jz4770_phy(phy); int err; - u32 reg; err = regulator_enable(priv->vcc_supply); if (err) { @@ -174,11 +173,6 @@ static int ingenic_usb_phy_init(struct usb_phy *phy) priv->soc_info->usb_phy_init(phy); - /* Wait for PHY to reset */ - usleep_range(30, 300); - writel(reg & ~USBPCR_POR, priv->base + REG_USBPCR_OFFSET); - usleep_range(300, 1000); - return 0; } @@ -205,6 +199,11 @@ static void jz4770_usb_phy_init(struct usb_phy *phy) USBPCR_TXFSLSTUNE_DFT | USBPCR_TXRISETUNE_DFT | USBPCR_TXVREFTUNE_DFT | USBPCR_POR; writel(reg, priv->base + REG_USBPCR_OFFSET); + + /* Wait for PHY to reset */ + usleep_range(30, 300); + writel(reg & ~USBPCR_POR, priv->base + REG_USBPCR_OFFSET); + usleep_range(300, 1000); } static void jz4780_usb_phy_init(struct usb_phy *phy) @@ -218,6 +217,11 @@ static void jz4780_usb_phy_init(struct usb_phy *phy) reg = USBPCR_TXPREEMPHTUNE | USBPCR_COMMONONN | USBPCR_POR; writel(reg, priv->base + REG_USBPCR_OFFSET); + + /* Wait for PHY to reset */ + usleep_range(30, 300); + writel(reg & ~USBPCR_POR, priv->base + REG_USBPCR_OFFSET); + usleep_range(300, 1000); } static void x1000_usb_phy_init(struct usb_phy *phy) @@ -232,6 +236,11 @@ static void x1000_usb_phy_init(struct usb_phy *phy) USBPCR_TXHSXVTUNE_DCR_15MV | USBPCR_TXVREFTUNE_INC_25PPT | USBPCR_COMMONONN | USBPCR_POR; writel(reg, priv->base + REG_USBPCR_OFFSET); + + /* Wait for PHY to reset */ + usleep_range(30, 300); + writel(reg & ~USBPCR_POR, priv->base + REG_USBPCR_OFFSET); + usleep_range(300, 1000); } static void x1830_usb_phy_init(struct usb_phy *phy) @@ -249,6 +258,11 @@ static void x1830_usb_phy_init(struct usb_phy *phy) reg = USBPCR_IDPULLUP_OTG | USBPCR_VBUSVLDEXT | USBPCR_TXPREEMPHTUNE | USBPCR_COMMONONN | USBPCR_POR; writel(reg, priv->base + REG_USBPCR_OFFSET); + + /* Wait for PHY to reset */ + usleep_range(30, 300); + writel(reg & ~USBPCR_POR, priv->base + REG_USBPCR_OFFSET); + usleep_range(300, 1000); } static const struct ingenic_soc_info jz4770_soc_info = { -- 2.11.0 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] USB: PHY: JZ4770: Fix static checker warning. 2020-07-28 17:02 ` [PATCH 1/1] USB: PHY: JZ4770: " 周琰杰 (Zhou Yanjie) @ 2020-07-28 17:26 ` Andy Shevchenko 0 siblings, 0 replies; 5+ messages in thread From: Andy Shevchenko @ 2020-07-28 17:26 UTC (permalink / raw) To: 周琰杰 (Zhou Yanjie) Cc: Felipe Balbi, Greg Kroah-Hartman, USB, Linux Kernel Mailing List, Colin King, Dan Carpenter, Paul Cercueil, prasannatsmkumar, dongsheng.qiu, aric.pzqi, rick.tyliu, yanfei.li, sernia.zhou, zhenwenjin On Tue, Jul 28, 2020 at 8:09 PM 周琰杰 (Zhou Yanjie) <zhouyanjie@wanyeetech.com> wrote: > > The commit 2a6c0b82e651 ("USB: PHY: JZ4770: Add support for new > Ingenic SoCs.") introduced the initialization function for different > chips, but left the relevant code involved in the resetting process > in the original function, resulting in uninitialized variable calls. > This problem can be solved by putting this part of the code into the > initialization function for each chip. Although the four processors > currently supported have the same reset code, let us can solve this 'can' -> '' > problem by adding the initialization of the reg variable to the > original function, but when other processors with different reset > methods (such as X2000) are introduced in the future, it will cause > inevitable condition judgments to complicate the function, which > violates the original intention of introducing initialization > functions for each processor. > > Fixes: 2a6c0b82e651 ("USB: PHY: JZ4770: Add support for new > Ingenic SoCs."). No period at the end > No blank line in the tag block. > Reported-by: Colin Ian King <colin.king@canonical.com> > Reported-by: Dan Carpenter <dan.carpenter@oracle.com> > Signed-off-by: 周琰杰 (Zhou Yanjie) <zhouyanjie@wanyeetech.com> ... > + /* Wait for PHY to reset */ > + usleep_range(30, 300); > + writel(reg & ~USBPCR_POR, priv->base + REG_USBPCR_OFFSET); > + usleep_range(300, 1000); Instead of copy'n'paste 4 times, you may provide a helper function. -- With Best Regards, Andy Shevchenko ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 0/1] Fix static checker warning. @ 2020-08-25 8:16 周琰杰 (Zhou Yanjie) 2020-08-25 8:16 ` [PATCH 1/1] USB: PHY: JZ4770: " 周琰杰 (Zhou Yanjie) 0 siblings, 1 reply; 5+ messages in thread From: 周琰杰 (Zhou Yanjie) @ 2020-08-25 8:16 UTC (permalink / raw) To: balbi, gregkh Cc: linux-usb, linux-kernel, zhenwenjin, sernia.zhou, yanfei.li, rick.tyliu, aric.pzqi, dongsheng.qiu Fix the warning that appears during Static analysis. 周琰杰 (Zhou Yanjie) (1): USB: PHY: JZ4770: Fix static checker warning. drivers/usb/phy/phy-jz4770.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) -- 2.11.0 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/1] USB: PHY: JZ4770: Fix static checker warning. 2020-08-25 8:16 [PATCH 0/1] " 周琰杰 (Zhou Yanjie) @ 2020-08-25 8:16 ` 周琰杰 (Zhou Yanjie) 2020-08-27 13:06 ` Felipe Balbi 0 siblings, 1 reply; 5+ messages in thread From: 周琰杰 (Zhou Yanjie) @ 2020-08-25 8:16 UTC (permalink / raw) To: balbi, gregkh Cc: linux-usb, linux-kernel, zhenwenjin, sernia.zhou, yanfei.li, rick.tyliu, aric.pzqi, dongsheng.qiu The commit 2a6c0b82e651 ("USB: PHY: JZ4770: Add support for new Ingenic SoCs.") introduced the initialization function for different chips, but left the relevant code involved in the resetting process in the original function, resulting in uninitialized variable calls. Fixes: 2a6c0b82e651 ("USB: PHY: JZ4770: Add support for new Ingenic SoCs."). Signed-off-by: 周琰杰 (Zhou Yanjie) <zhouyanjie@wanyeetech.com> --- drivers/usb/phy/phy-jz4770.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/phy/phy-jz4770.c b/drivers/usb/phy/phy-jz4770.c index d4ee3cb721ea..f6d3731581eb 100644 --- a/drivers/usb/phy/phy-jz4770.c +++ b/drivers/usb/phy/phy-jz4770.c @@ -176,6 +176,7 @@ static int ingenic_usb_phy_init(struct usb_phy *phy) /* Wait for PHY to reset */ usleep_range(30, 300); + reg = readl(priv->base + REG_USBPCR_OFFSET); writel(reg & ~USBPCR_POR, priv->base + REG_USBPCR_OFFSET); usleep_range(300, 1000); -- 2.11.0 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] USB: PHY: JZ4770: Fix static checker warning. 2020-08-25 8:16 ` [PATCH 1/1] USB: PHY: JZ4770: " 周琰杰 (Zhou Yanjie) @ 2020-08-27 13:06 ` Felipe Balbi 0 siblings, 0 replies; 5+ messages in thread From: Felipe Balbi @ 2020-08-27 13:06 UTC (permalink / raw) To: 周琰杰 (Zhou Yanjie), gregkh Cc: linux-usb, linux-kernel, zhenwenjin, sernia.zhou, yanfei.li, rick.tyliu, aric.pzqi, dongsheng.qiu [-- Attachment #1: Type: text/plain, Size: 713 bytes --] 周琰杰 (Zhou Yanjie) <zhouyanjie@wanyeetech.com> writes: > The commit 2a6c0b82e651 ("USB: PHY: JZ4770: Add support for new > Ingenic SoCs.") introduced the initialization function for different > chips, but left the relevant code involved in the resetting process > in the original function, resulting in uninitialized variable calls. > > Fixes: 2a6c0b82e651 ("USB: PHY: JZ4770: Add support for new > Ingenic SoCs."). These two lines here, they should be one line :-) For the Fixes: line, you shouldn't worry about the 72-char limit. Also, when resending, don't add a blank line between Fixes and Signed-off-by and since this is a bug fix, it seems like Cc: stable is in order. -- balbi [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 857 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-08-27 14:57 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2020-07-28 17:02 [PATCH 0/1] Fix static checker warning 周琰杰 (Zhou Yanjie) 2020-07-28 17:02 ` [PATCH 1/1] USB: PHY: JZ4770: " 周琰杰 (Zhou Yanjie) 2020-07-28 17:26 ` Andy Shevchenko 2020-08-25 8:16 [PATCH 0/1] " 周琰杰 (Zhou Yanjie) 2020-08-25 8:16 ` [PATCH 1/1] USB: PHY: JZ4770: " 周琰杰 (Zhou Yanjie) 2020-08-27 13:06 ` Felipe Balbi
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).