From 217d16973db6239c88ca77c7ffe3e4abdaf58d57 Mon Sep 17 00:00:00 2001 From: Rajesh Bhagat Date: Sat, 18 Jun 2016 10:47:10 +0530 Subject: usb: fsl: Fix NULL terminating issue for usb controller name string Fixes NULL terminating issue for usb controller name string by using sizeof operator. Signed-off-by: Rajesh Bhagat --- drivers/usb/host/ehci-fsl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c index a43d37de0b..fa916ed77f 100644 --- a/drivers/usb/host/ehci-fsl.c +++ b/drivers/usb/host/ehci-fsl.c @@ -65,7 +65,8 @@ int ehci_hcd_init(int index, enum usb_init_type init, mdelay(5); } memset(current_usb_controller, '\0', 5); - snprintf(current_usb_controller, 4, "usb%d", index+1); + snprintf(current_usb_controller, sizeof(current_usb_controller), + "usb%d", index+1); switch (index) { case 0: -- cgit v1.2.1 From 429ff4473b8b1a98c528608a127de833ece0496a Mon Sep 17 00:00:00 2001 From: Peng Fan Date: Mon, 20 Jun 2016 09:43:08 +0800 Subject: ehci: mx7: fix usbnc_regs There is a 4 bytes hole between phy_cfg2 and phy_status, fix the usbnc_regs structure to include the hole. Signed-off-by: Ye Li Signed-off-by: Peng Fan --- drivers/usb/host/ehci-mx6.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-mx6.c index bb48d0dea0..cc3b11ce4e 100644 --- a/drivers/usb/host/ehci-mx6.c +++ b/drivers/usb/host/ehci-mx6.c @@ -194,8 +194,9 @@ struct usbnc_regs { u32 reserve1[10]; u32 phy_cfg1; u32 phy_cfg2; + u32 reserve2; u32 phy_status; - u32 reserve2[4]; + u32 reserve3[4]; u32 adp_cfg1; u32 adp_cfg2; u32 adp_status; -- cgit v1.2.1 From 57de41e9c944af8d2c7bfcc2358414c5dd8c39df Mon Sep 17 00:00:00 2001 From: Peng Fan Date: Mon, 20 Jun 2016 09:43:09 +0800 Subject: ehci: mx7: fix otg id detection The USBNC_PHYCFG2_ACAENB bit should be cleared to enable the OTG ID detection, not set it. When the bit is set, the ACA Resistance Detection is enabled, which disables the OTG ID detection, because the internal pull up is off. Signed-off-by: Ye Li Signed-off-by: Peng Fan --- drivers/usb/host/ehci-mx6.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'drivers') diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-mx6.c index cc3b11ce4e..069f116ed2 100644 --- a/drivers/usb/host/ehci-mx6.c +++ b/drivers/usb/host/ehci-mx6.c @@ -208,8 +208,11 @@ static void usb_power_config(int index) (0x10000 * index) + USBNC_OFFSET); void __iomem *phy_cfg2 = (void __iomem *)(&usbnc->phy_cfg2); - /* Enable usb_otg_id detection */ - setbits_le32(phy_cfg2, USBNC_PHYCFG2_ACAENB); + /* + * Clear the ACAENB to enable usb_otg_id detection, + * otherwise it is the ACA detection enabled. + */ + clrbits_le32(phy_cfg2, USBNC_PHYCFG2_ACAENB); } int usb_phy_mode(int port) -- cgit v1.2.1