aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Fainelli <florian@openwrt.org>2012-10-08 09:11:24 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-10-22 14:23:58 -0400
commitb898f5fa39f8606d64f1760ac09400e9323fed83 (patch)
treec7642f8b0b16cf86c1169e5cb45f313ddbb1798b
parent1de7d89c76350de456143503d52447a466b4025e (diff)
ARM: cns3xxx: use ehci platform driver
This patch converts the cns3xxx platform to use the ehci-platform driver instead of the ehci-cns3xxx platform driver. The ehci-platform driver is provided with power_{on,off} callbacks to ensure proper block gating and USB configuration of the EHCI controller. Signed-off-by: Florian Fainelli <florian@openwrt.org> Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--arch/arm/mach-cns3xxx/cns3420vb.c44
1 files changed, 43 insertions, 1 deletions
diff --git a/arch/arm/mach-cns3xxx/cns3420vb.c b/arch/arm/mach-cns3xxx/cns3420vb.c
index 2c5fb4c7e509..906094cb23fb 100644
--- a/arch/arm/mach-cns3xxx/cns3420vb.c
+++ b/arch/arm/mach-cns3xxx/cns3420vb.c
@@ -24,6 +24,7 @@
24#include <linux/mtd/mtd.h> 24#include <linux/mtd/mtd.h>
25#include <linux/mtd/physmap.h> 25#include <linux/mtd/physmap.h>
26#include <linux/mtd/partitions.h> 26#include <linux/mtd/partitions.h>
27#include <linux/usb/ehci_pdriver.h>
27#include <asm/setup.h> 28#include <asm/setup.h>
28#include <asm/mach-types.h> 29#include <asm/mach-types.h>
29#include <asm/hardware/gic.h> 30#include <asm/hardware/gic.h>
@@ -32,6 +33,7 @@
32#include <asm/mach/time.h> 33#include <asm/mach/time.h>
33#include <mach/cns3xxx.h> 34#include <mach/cns3xxx.h>
34#include <mach/irqs.h> 35#include <mach/irqs.h>
36#include <mach/pm.h>
35#include "core.h" 37#include "core.h"
36#include "devices.h" 38#include "devices.h"
37 39
@@ -125,13 +127,53 @@ static struct resource cns3xxx_usb_ehci_resources[] = {
125 127
126static u64 cns3xxx_usb_ehci_dma_mask = DMA_BIT_MASK(32); 128static u64 cns3xxx_usb_ehci_dma_mask = DMA_BIT_MASK(32);
127 129
130static int csn3xxx_usb_ehci_power_on(struct platform_device *pdev)
131{
132 /*
133 * EHCI and OHCI share the same clock and power,
134 * resetting twice would cause the 1st controller been reset.
135 * Therefore only do power up at the first up device, and
136 * power down at the last down device.
137 *
138 * Set USB AHB INCR length to 16
139 */
140 if (atomic_inc_return(&usb_pwr_ref) == 1) {
141 cns3xxx_pwr_power_up(1 << PM_PLL_HM_PD_CTRL_REG_OFFSET_PLL_USB);
142 cns3xxx_pwr_clk_en(1 << PM_CLK_GATE_REG_OFFSET_USB_HOST);
143 cns3xxx_pwr_soft_rst(1 << PM_SOFT_RST_REG_OFFST_USB_HOST);
144 __raw_writel((__raw_readl(MISC_CHIP_CONFIG_REG) | (0X2 << 24)),
145 MISC_CHIP_CONFIG_REG);
146 }
147
148 return 0;
149}
150
151static void csn3xxx_usb_ehci_power_off(struct platform_device *pdev)
152{
153 /*
154 * EHCI and OHCI share the same clock and power,
155 * resetting twice would cause the 1st controller been reset.
156 * Therefore only do power up at the first up device, and
157 * power down at the last down device.
158 */
159 if (atomic_dec_return(&usb_pwr_ref) == 0)
160 cns3xxx_pwr_clk_dis(1 << PM_CLK_GATE_REG_OFFSET_USB_HOST);
161}
162
163static struct usb_ehci_pdata cns3xxx_usb_ehci_pdata = {
164 .port_power_off = 1,
165 .power_on = csn3xxx_usb_ehci_power_on,
166 .power_off = csn3xxx_usb_ehci_power_off,
167};
168
128static struct platform_device cns3xxx_usb_ehci_device = { 169static struct platform_device cns3xxx_usb_ehci_device = {
129 .name = "cns3xxx-ehci", 170 .name = "ehci-platform",
130 .num_resources = ARRAY_SIZE(cns3xxx_usb_ehci_resources), 171 .num_resources = ARRAY_SIZE(cns3xxx_usb_ehci_resources),
131 .resource = cns3xxx_usb_ehci_resources, 172 .resource = cns3xxx_usb_ehci_resources,
132 .dev = { 173 .dev = {
133 .dma_mask = &cns3xxx_usb_ehci_dma_mask, 174 .dma_mask = &cns3xxx_usb_ehci_dma_mask,
134 .coherent_dma_mask = DMA_BIT_MASK(32), 175 .coherent_dma_mask = DMA_BIT_MASK(32),
176 .platform_data = &cns3xxx_usb_ehci_pdata,
135 }, 177 },
136}; 178};
137 179