summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2013-04-10 16:20:50 +0000
committerFelix Fietkau <nbd@openwrt.org>2013-04-10 16:20:50 +0000
commit6436b3f7363c0968c4b469c62efe985e71c7a543 (patch)
treed5514af694b5d99f1c91e8898a8a6025fee3ffec
parentedd8048107d1c96775b4ce372a24ff5daba05eae (diff)
downloadmtk-20170518-6436b3f7363c0968c4b469c62efe985e71c7a543.zip
mtk-20170518-6436b3f7363c0968c4b469c62efe985e71c7a543.tar.gz
mtk-20170518-6436b3f7363c0968c4b469c62efe985e71c7a543.tar.bz2
cns3xxx: fix USB ehci/ohci platform driver
Update ehci/ohci driver registration to conform to the new platform drivers. This fixes missing USB host support in 3.8.x Signed-off-by: Tim Harvey <tharvey@gateworks.com> SVN-Revision: 36309
-rw-r--r--target/linux/cns3xxx/files/arch/arm/mach-cns3xxx/laguna.c54
-rw-r--r--target/linux/cns3xxx/patches-3.8/025-smp_support.patch2
2 files changed, 52 insertions, 4 deletions
diff --git a/target/linux/cns3xxx/files/arch/arm/mach-cns3xxx/laguna.c b/target/linux/cns3xxx/files/arch/arm/mach-cns3xxx/laguna.c
index cd1aa71..9c835f3 100644
--- a/target/linux/cns3xxx/files/arch/arm/mach-cns3xxx/laguna.c
+++ b/target/linux/cns3xxx/files/arch/arm/mach-cns3xxx/laguna.c
@@ -9,7 +9,7 @@
* Anton Vorontsov <avorontsov@mvista.com>
* Copyright 2011 Gateworks Corporation
* Chris Lang <clang@gateworks.com>
- * Copyright 2012 Gateworks Corporation
+ * Copyright 2012-2013 Gateworks Corporation
* Tim Harvey <tharvey@gateworks.com>
*
* This file is free software; you can redistribute it and/or modify
@@ -37,6 +37,8 @@
#include <linux/spi/flash.h>
#include <linux/if_ether.h>
#include <linux/pps-gpio.h>
+#include <linux/usb/ehci_pdriver.h>
+#include <linux/usb/ohci_pdriver.h>
#include <asm/setup.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
@@ -414,13 +416,52 @@ static struct resource cns3xxx_usb_ehci_resources[] = {
static u64 cns3xxx_usb_ehci_dma_mask = DMA_BIT_MASK(32);
+static int csn3xxx_usb_power_on(struct platform_device *pdev)
+{
+ /*
+ * EHCI and OHCI share the same clock and power,
+ * resetting twice would cause the 1st controller been reset.
+ * Therefore only do power up at the first up device, and
+ * power down at the last down device.
+ *
+ * Set USB AHB INCR length to 16
+ */
+ if (atomic_inc_return(&usb_pwr_ref) == 1) {
+ cns3xxx_pwr_power_up(1 << PM_PLL_HM_PD_CTRL_REG_OFFSET_PLL_USB);
+ cns3xxx_pwr_clk_en(1 << PM_CLK_GATE_REG_OFFSET_USB_HOST);
+ cns3xxx_pwr_soft_rst(1 << PM_SOFT_RST_REG_OFFST_USB_HOST);
+ __raw_writel((__raw_readl(MISC_CHIP_CONFIG_REG) | (0X2 << 24)),
+ MISC_CHIP_CONFIG_REG);
+ }
+
+ return 0;
+}
+
+static void csn3xxx_usb_power_off(struct platform_device *pdev)
+{
+ /*
+ * EHCI and OHCI share the same clock and power,
+ * resetting twice would cause the 1st controller been reset.
+ * Therefore only do power up at the first up device, and
+ * power down at the last down device.
+ */
+ if (atomic_dec_return(&usb_pwr_ref) == 0)
+ cns3xxx_pwr_clk_dis(1 << PM_CLK_GATE_REG_OFFSET_USB_HOST);
+}
+
+static struct usb_ehci_pdata cns3xxx_usb_ehci_pdata = {
+ .power_on = csn3xxx_usb_power_on,
+ .power_off = csn3xxx_usb_power_off,
+};
+
static struct platform_device cns3xxx_usb_ehci_device = {
- .name = "cns3xxx-ehci",
+ .name = "ehci-platform",
.num_resources = ARRAY_SIZE(cns3xxx_usb_ehci_resources),
.resource = cns3xxx_usb_ehci_resources,
.dev = {
.dma_mask = &cns3xxx_usb_ehci_dma_mask,
.coherent_dma_mask = DMA_BIT_MASK(32),
+ .platform_data = &cns3xxx_usb_ehci_pdata,
},
};
@@ -438,13 +479,20 @@ static struct resource cns3xxx_usb_ohci_resources[] = {
static u64 cns3xxx_usb_ohci_dma_mask = DMA_BIT_MASK(32);
+static struct usb_ohci_pdata cns3xxx_usb_ohci_pdata = {
+ .num_ports = 1,
+ .power_on = csn3xxx_usb_power_on,
+ .power_off = csn3xxx_usb_power_off,
+};
+
static struct platform_device cns3xxx_usb_ohci_device = {
- .name = "cns3xxx-ohci",
+ .name = "ohci-platform",
.num_resources = ARRAY_SIZE(cns3xxx_usb_ohci_resources),
.resource = cns3xxx_usb_ohci_resources,
.dev = {
.dma_mask = &cns3xxx_usb_ohci_dma_mask,
.coherent_dma_mask = DMA_BIT_MASK(32),
+ .platform_data = &cns3xxx_usb_ohci_pdata,
},
};
diff --git a/target/linux/cns3xxx/patches-3.8/025-smp_support.patch b/target/linux/cns3xxx/patches-3.8/025-smp_support.patch
index e777938..82b1ce6 100644
--- a/target/linux/cns3xxx/patches-3.8/025-smp_support.patch
+++ b/target/linux/cns3xxx/patches-3.8/025-smp_support.patch
@@ -28,7 +28,7 @@
#ifdef CONFIG_CACHE_L2X0
--- a/arch/arm/mach-cns3xxx/laguna.c
+++ b/arch/arm/mach-cns3xxx/laguna.c
-@@ -941,6 +941,7 @@ static int __init laguna_model_setup(voi
+@@ -989,6 +989,7 @@ static int __init laguna_model_setup(voi
late_initcall(laguna_model_setup);
MACHINE_START(GW2388, "Gateworks Corporation Laguna Platform")