linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: mtu3: fix U3 port link issue
@ 2016-12-07  7:23 Chunfeng Yun
  2016-12-27 11:22 ` Felipe Balbi
  0 siblings, 1 reply; 3+ messages in thread
From: Chunfeng Yun @ 2016-12-07  7:23 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Felipe Balbi, Mathias Nyman, Matthias Brugger
  Cc: Oliver Neukum, Alan Stern, Sergei Shtylyov, Pawel Moll,
	Kumar Gala, Sascha Hauer, Alan Cooper, Chunfeng Yun, linux-usb,
	linux-kernel, linux-arm-kernel, linux-mediatek

the issue is introduced when @is_u3_ip is used in mtu3_device_enabe()
before initialized in mtu3_mem_alloc(), so get global IP information
at first before used by following functins.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/usb/mtu3/mtu3_core.c |   18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/mtu3/mtu3_core.c b/drivers/usb/mtu3/mtu3_core.c
index 520e55a..af3e531 100644
--- a/drivers/usb/mtu3/mtu3_core.c
+++ b/drivers/usb/mtu3/mtu3_core.c
@@ -481,21 +481,14 @@ static int mtu3_mem_alloc(struct mtu3 *mtu)
 	void __iomem *mbase = mtu->mac_base;
 	struct mtu3_ep *ep_array;
 	int in_ep_num, out_ep_num;
-	u32 cap_epinfo, cap_dev;
+	u32 cap_epinfo;
 	int ret;
 	int i;
 
-	mtu->hw_version = mtu3_readl(mtu->ippc_base, U3D_SSUSB_HW_ID);
-
-	cap_dev = mtu3_readl(mtu->ippc_base, U3D_SSUSB_IP_DEV_CAP);
-	mtu->is_u3_ip = !!SSUSB_IP_DEV_U3_PORT_NUM(cap_dev);
-
 	cap_epinfo = mtu3_readl(mbase, U3D_CAP_EPINFO);
 	in_ep_num = CAP_TX_EP_NUM(cap_epinfo);
 	out_ep_num = CAP_RX_EP_NUM(cap_epinfo);
 
-	dev_info(mtu->dev, "IP version 0x%x(%s IP)\n", mtu->hw_version,
-		mtu->is_u3_ip ? "U3" : "U2");
 	dev_info(mtu->dev, "fifosz/epnum: Tx=%#x/%d, Rx=%#x/%d\n",
 		 mtu3_readl(mbase, U3D_CAP_EPNTXFFSZ), in_ep_num,
 		 mtu3_readl(mbase, U3D_CAP_EPNRXFFSZ), out_ep_num);
@@ -730,8 +723,17 @@ irqreturn_t mtu3_irq(int irq, void *data)
 
 static int mtu3_hw_init(struct mtu3 *mtu)
 {
+	u32 cap_dev;
 	int ret;
 
+	mtu->hw_version = mtu3_readl(mtu->ippc_base, U3D_SSUSB_HW_ID);
+
+	cap_dev = mtu3_readl(mtu->ippc_base, U3D_SSUSB_IP_DEV_CAP);
+	mtu->is_u3_ip = !!SSUSB_IP_DEV_U3_PORT_NUM(cap_dev);
+
+	dev_info(mtu->dev, "IP version 0x%x(%s IP)\n", mtu->hw_version,
+		mtu->is_u3_ip ? "U3" : "U2");
+
 	mtu3_device_reset(mtu);
 
 	ret = mtu3_device_enable(mtu);
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] usb: mtu3: fix U3 port link issue
  2016-12-07  7:23 [PATCH] usb: mtu3: fix U3 port link issue Chunfeng Yun
@ 2016-12-27 11:22 ` Felipe Balbi
  2016-12-28  1:21   ` Chunfeng Yun
  0 siblings, 1 reply; 3+ messages in thread
From: Felipe Balbi @ 2016-12-27 11:22 UTC (permalink / raw)
  To: Chunfeng Yun, Greg Kroah-Hartman, Mathias Nyman, Matthias Brugger
  Cc: Oliver Neukum, Alan Stern, Sergei Shtylyov, Pawel Moll,
	Kumar Gala, Sascha Hauer, Alan Cooper, Chunfeng Yun, linux-usb,
	linux-kernel, linux-arm-kernel, linux-mediatek

[-- Attachment #1: Type: text/plain, Size: 385 bytes --]


Hi,

Chunfeng Yun <chunfeng.yun@mediatek.com> writes:
> the issue is introduced when @is_u3_ip is used in mtu3_device_enabe()
> before initialized in mtu3_mem_alloc(), so get global IP information
> at first before used by following functins.
>
> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>

patch doesn't apply to my testing/fixes. Please rebase

-- 
balbi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] usb: mtu3: fix U3 port link issue
  2016-12-27 11:22 ` Felipe Balbi
@ 2016-12-28  1:21   ` Chunfeng Yun
  0 siblings, 0 replies; 3+ messages in thread
From: Chunfeng Yun @ 2016-12-28  1:21 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Greg Kroah-Hartman, Mathias Nyman, Matthias Brugger,
	Oliver Neukum, Alan Stern, Sergei Shtylyov, Pawel Moll,
	Kumar Gala, Sascha Hauer, Alan Cooper, linux-usb, linux-kernel,
	linux-arm-kernel, linux-mediatek

Hi,

On Tue, 2016-12-27 at 13:22 +0200, Felipe Balbi wrote:
> Hi,
> 
> Chunfeng Yun <chunfeng.yun@mediatek.com> writes:
> > the issue is introduced when @is_u3_ip is used in mtu3_device_enabe()
> > before initialized in mtu3_mem_alloc(), so get global IP information
> > at first before used by following functins.
> >
> > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> 
> patch doesn't apply to my testing/fixes. Please rebase
It's already accepted into kernel4.10-rc1
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-12-28  1:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-07  7:23 [PATCH] usb: mtu3: fix U3 port link issue Chunfeng Yun
2016-12-27 11:22 ` Felipe Balbi
2016-12-28  1:21   ` Chunfeng Yun

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).