From 843fc45e27e41beec8549ea1241a522bea3c7ea2 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Mon, 25 Aug 2014 16:31:05 +0000 Subject: [PATCH] ralink: fix mt7620 ohci 3.14 the ohci phy was not reset properly Signed-off-by: John Crispin SVN-Revision: 42291 --- .../0037-USB-phy-add-ralink-SoC-driver.patch | 37 ++++++------ .../0038-USB-add-OHCI-EHCI-OF-binding.patch | 58 +++++++++---------- 2 files changed, 45 insertions(+), 50 deletions(-) diff --git a/target/linux/ramips/patches-3.14/0037-USB-phy-add-ralink-SoC-driver.patch b/target/linux/ramips/patches-3.14/0037-USB-phy-add-ralink-SoC-driver.patch index b0c9a1af8b..38eae68563 100644 --- a/target/linux/ramips/patches-3.14/0037-USB-phy-add-ralink-SoC-driver.patch +++ b/target/linux/ramips/patches-3.14/0037-USB-phy-add-ralink-SoC-driver.patch @@ -11,11 +11,11 @@ Signed-off-by: John Crispin 3 files changed, 199 insertions(+) create mode 100644 drivers/usb/phy/ralink-phy.c -diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig -index 7d1451d..fc04d76 100644 ---- a/drivers/usb/phy/Kconfig -+++ b/drivers/usb/phy/Kconfig -@@ -251,6 +251,14 @@ config USB_RCAR_GEN2_PHY +Index: linux-3.14.16/drivers/usb/phy/Kconfig +=================================================================== +--- linux-3.14.16.orig/drivers/usb/phy/Kconfig 2014-08-08 01:50:59.000000000 +0200 ++++ linux-3.14.16/drivers/usb/phy/Kconfig 2014-08-24 12:39:21.094371467 +0200 +@@ -251,6 +251,14 @@ To compile this driver as a module, choose M here: the module will be called phy-rcar-gen2-usb. @@ -30,21 +30,20 @@ index 7d1451d..fc04d76 100644 config USB_ULPI bool "Generic ULPI Transceiver Driver" depends on ARM -diff --git a/drivers/usb/phy/Makefile b/drivers/usb/phy/Makefile -index be58ada..52d59c1 100644 ---- a/drivers/usb/phy/Makefile -+++ b/drivers/usb/phy/Makefile -@@ -33,3 +33,4 @@ obj-$(CONFIG_USB_RCAR_GEN2_PHY) += phy-rcar-gen2-usb.o +Index: linux-3.14.16/drivers/usb/phy/Makefile +=================================================================== +--- linux-3.14.16.orig/drivers/usb/phy/Makefile 2014-08-08 01:50:59.000000000 +0200 ++++ linux-3.14.16/drivers/usb/phy/Makefile 2014-08-24 12:39:21.094371467 +0200 +@@ -33,3 +33,4 @@ obj-$(CONFIG_USB_ULPI) += phy-ulpi.o obj-$(CONFIG_USB_ULPI_VIEWPORT) += phy-ulpi-viewport.o obj-$(CONFIG_KEYSTONE_USB_PHY) += phy-keystone.o +obj-$(CONFIG_RALINK_USBPHY) += ralink-phy.o -diff --git a/drivers/usb/phy/ralink-phy.c b/drivers/usb/phy/ralink-phy.c -new file mode 100644 -index 0000000..28046e5 ---- /dev/null -+++ b/drivers/usb/phy/ralink-phy.c -@@ -0,0 +1,190 @@ +Index: linux-3.14.16/drivers/usb/phy/ralink-phy.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ linux-3.14.16/drivers/usb/phy/ralink-phy.c 2014-08-24 14:28:35.886531881 +0200 +@@ -0,0 +1,191 @@ +/* + * Copyright (C) 2013 John Crispin + * @@ -75,6 +74,7 @@ index 0000000..28046e5 +#define RT_SYSCFG1_USB0_HOST_MODE BIT(10) + +#define MT7620_CLKCFG1_UPHY0_CLK_EN BIT(25) ++#define MT7620_CLKCFG1_UPHY1_CLK_EN BIT(22) +#define RT_CLKCFG1_UPHY1_CLK_EN BIT(20) +#define RT_CLKCFG1_UPHY0_CLK_EN BIT(18) + @@ -158,7 +158,7 @@ index 0000000..28046e5 + +static const struct of_device_id ralink_usbphy_dt_match[] = { + { .compatible = "ralink,rt3xxx-usbphy", .data = (void *) (RT_CLKCFG1_UPHY1_CLK_EN | RT_CLKCFG1_UPHY0_CLK_EN) }, -+ { .compatible = "ralink,mt7620a-usbphy", .data = (void *) MT7620_CLKCFG1_UPHY0_CLK_EN }, ++ { .compatible = "ralink,mt7620a-usbphy", .data = (void *) (MT7620_CLKCFG1_UPHY1_CLK_EN | MT7620_CLKCFG1_UPHY0_CLK_EN) }, + {}, +}; +MODULE_DEVICE_TABLE(of, ralink_usbphy_dt_match); @@ -235,6 +235,3 @@ index 0000000..28046e5 +MODULE_LICENSE("GPL v2"); +MODULE_DESCRIPTION("Ralink USB phy"); +MODULE_AUTHOR("John Crispin "); --- -1.7.10.4 - diff --git a/target/linux/ramips/patches-3.14/0038-USB-add-OHCI-EHCI-OF-binding.patch b/target/linux/ramips/patches-3.14/0038-USB-add-OHCI-EHCI-OF-binding.patch index 87d2c30232..e7861def47 100644 --- a/target/linux/ramips/patches-3.14/0038-USB-add-OHCI-EHCI-OF-binding.patch +++ b/target/linux/ramips/patches-3.14/0038-USB-add-OHCI-EHCI-OF-binding.patch @@ -12,11 +12,11 @@ Signed-off-by: John Crispin drivers/usb/host/ohci-platform.c | 37 +++++++++++++++++++++++++++++++------ 3 files changed, 50 insertions(+), 11 deletions(-) -diff --git a/drivers/usb/Makefile b/drivers/usb/Makefile -index 1ae2bf3..aaa15d9 100644 ---- a/drivers/usb/Makefile -+++ b/drivers/usb/Makefile -@@ -11,6 +11,8 @@ obj-$(CONFIG_USB_DWC2) += dwc2/ +Index: linux-3.14.16/drivers/usb/Makefile +=================================================================== +--- linux-3.14.16.orig/drivers/usb/Makefile 2014-08-08 01:50:59.000000000 +0200 ++++ linux-3.14.16/drivers/usb/Makefile 2014-08-24 14:33:57.590539754 +0200 +@@ -11,6 +11,8 @@ obj-$(CONFIG_USB_MON) += mon/ @@ -25,7 +25,7 @@ index 1ae2bf3..aaa15d9 100644 obj-$(CONFIG_PCI) += host/ obj-$(CONFIG_USB_EHCI_HCD) += host/ obj-$(CONFIG_USB_ISP116X_HCD) += host/ -@@ -41,7 +43,6 @@ obj-$(CONFIG_USB_TMC) += class/ +@@ -41,7 +43,6 @@ obj-$(CONFIG_USB_STORAGE) += storage/ obj-$(CONFIG_USB) += storage/ @@ -33,10 +33,10 @@ index 1ae2bf3..aaa15d9 100644 obj-$(CONFIG_USB_MICROTEK) += image/ obj-$(CONFIG_USB_SERIAL) += serial/ -diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c -index 01536cf..1b9a8f4 100644 ---- a/drivers/usb/host/ehci-platform.c -+++ b/drivers/usb/host/ehci-platform.c +Index: linux-3.14.16/drivers/usb/host/ehci-platform.c +=================================================================== +--- linux-3.14.16.orig/drivers/usb/host/ehci-platform.c 2014-08-24 12:39:18.806371411 +0200 ++++ linux-3.14.16/drivers/usb/host/ehci-platform.c 2014-08-24 12:39:21.102371467 +0200 @@ -29,6 +29,8 @@ #include #include @@ -46,7 +46,7 @@ index 01536cf..1b9a8f4 100644 #include "ehci.h" -@@ -123,6 +125,15 @@ static int ehci_platform_probe(struct platform_device *dev) +@@ -124,6 +126,15 @@ hcd->rsrc_start = res_mem->start; hcd->rsrc_len = resource_size(res_mem); @@ -62,7 +62,7 @@ index 01536cf..1b9a8f4 100644 hcd->regs = devm_ioremap_resource(&dev->dev, res_mem); if (IS_ERR(hcd->regs)) { err = PTR_ERR(hcd->regs); -@@ -160,6 +171,9 @@ static int ehci_platform_remove(struct platform_device *dev) +@@ -161,6 +172,9 @@ if (pdata == &ehci_platform_defaults) dev->dev.platform_data = NULL; @@ -72,7 +72,7 @@ index 01536cf..1b9a8f4 100644 return 0; } -@@ -204,9 +218,8 @@ static int ehci_platform_resume(struct device *dev) +@@ -205,9 +219,8 @@ #define ehci_platform_resume NULL #endif /* CONFIG_PM */ @@ -84,7 +84,7 @@ index 01536cf..1b9a8f4 100644 {} }; -@@ -230,7 +243,7 @@ static struct platform_driver ehci_platform_driver = { +@@ -231,7 +244,7 @@ .owner = THIS_MODULE, .name = "ehci-platform", .pm = &ehci_platform_pm_ops, @@ -93,13 +93,15 @@ index 01536cf..1b9a8f4 100644 } }; -diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c -index 68f674c..2a73fed 100644 ---- a/drivers/usb/host/ohci-platform.c -+++ b/drivers/usb/host/ohci-platform.c -@@ -23,17 +23,20 @@ +Index: linux-3.14.16/drivers/usb/host/ohci-platform.c +=================================================================== +--- linux-3.14.16.orig/drivers/usb/host/ohci-platform.c 2014-08-08 01:50:59.000000000 +0200 ++++ linux-3.14.16/drivers/usb/host/ohci-platform.c 2014-08-24 12:41:51.422375146 +0200 +@@ -22,18 +22,22 @@ + #include #include #include ++#include #include +#include +#include @@ -115,11 +117,11 @@ index 68f674c..2a73fed 100644 { struct platform_device *pdev = to_platform_device(hcd->self.controller); - struct usb_ohci_pdata *pdata = dev_get_platdata(&pdev->dev); -+ struct usb_ohci_pdata *pdata; ++ struct usb_ohci_pdata *pdata = dev_get_platdata(&pdev->dev);; struct ohci_hcd *ohci = hcd_to_ohci(hcd); if (pdata->big_endian_desc) -@@ -63,11 +66,18 @@ static int ohci_platform_probe(struct platform_device *dev) +@@ -63,11 +67,18 @@ int irq; int err = -ENOMEM; @@ -127,7 +129,6 @@ index 68f674c..2a73fed 100644 - WARN_ON(1); - return -ENODEV; - } -- + /* + * use reasonable defaults so platforms don't have to provide these. + * with DT probing on ARM, none of these are set. @@ -138,12 +139,12 @@ index 68f674c..2a73fed 100644 + dev->dev.dma_mask = &dev->dev.coherent_dma_mask; + if (!dev->dev.coherent_dma_mask) + dev->dev.coherent_dma_mask = DMA_BIT_MASK(32); -+ + + pdata = dev->dev.platform_data; if (usb_disabled()) return -ENODEV; -@@ -99,6 +109,12 @@ static int ohci_platform_probe(struct platform_device *dev) +@@ -99,6 +110,12 @@ hcd->rsrc_start = res_mem->start; hcd->rsrc_len = resource_size(res_mem); @@ -156,7 +157,7 @@ index 68f674c..2a73fed 100644 hcd->regs = devm_ioremap_resource(&dev->dev, res_mem); if (IS_ERR(hcd->regs)) { err = PTR_ERR(hcd->regs); -@@ -134,6 +150,9 @@ static int ohci_platform_remove(struct platform_device *dev) +@@ -134,6 +151,9 @@ if (pdata->power_off) pdata->power_off(dev); @@ -166,7 +167,7 @@ index 68f674c..2a73fed 100644 return 0; } -@@ -180,6 +199,11 @@ static int ohci_platform_resume(struct device *dev) +@@ -180,6 +200,11 @@ #define ohci_platform_resume NULL #endif /* CONFIG_PM */ @@ -178,7 +179,7 @@ index 68f674c..2a73fed 100644 static const struct platform_device_id ohci_platform_table[] = { { "ohci-platform", 0 }, { } -@@ -200,6 +224,7 @@ static struct platform_driver ohci_platform_driver = { +@@ -200,6 +225,7 @@ .owner = THIS_MODULE, .name = "ohci-platform", .pm = &ohci_platform_pm_ops, @@ -186,6 +187,3 @@ index 68f674c..2a73fed 100644 } }; --- -1.7.10.4 - -- 2.25.1