Skip to contentSkip to conversation

SuperH on-chip EHCI glue, v2

PATCH In review Paul Mundt 2 participants 2 messages Dec 1, 2010 – Dec 3, 2010

Subsystems (4)
lore
Share & tools
lore

Paul Mundt

author
#0 lore raw

PATCH 1/1 SuperH on-chip EHCI glue, v2

This is a simple patch series for adding EHCI glue for the SuperH on-chip controller. It's largely modelled after the ohci-sh driver with clock management added on top, which I plan to move out to be shared between the two like Octeon presently does in a future patch -- this just hasn't been done yet since I need to go through and audit all of the SH OHCI users first.

As before, if you don't have any issues with the series then you can feel free to pull the topic branch in to one of your trees as-is, or I can merge it via the SH tree (I don't have anything that depends on it, so I'm fine with whatever you prefer).

This round includes updates/fixes suggested by Alan Stern and David Daney.

The topic branch itself is at:

master.kernel.org:/pub/scm/linux/kernel/git/lethal/sh-2.6.git sh/ehci

and contains:

Paul Mundt (6):
usb: ohci-sh: Set IRQ as shared.
usb: ehci-hcd: Add support for SuperH EHCI.
sh: Add EHCI support for SH7786.
usb: ehci-sh: Fix up fault in shutdown path.
usb: ehci-sh: Add missing ehci helpers.
sh: Convert to USB_ARCH_HAS_OHCI/EHCI selects.

 arch/sh/Kconfig                        |    5 +
 arch/sh/kernel/cpu/sh4a/setup-sh7786.c |   35 ++++-
 drivers/usb/Kconfig                    |    5 -
 drivers/usb/host/ehci-hcd.c            |    5 +
 drivers/usb/host/ehci-sh.c             |  243 ++++++++++++++++++++++++++++++++
 drivers/usb/host/ohci-sh.c             |    2 +-
 6 files changed, 285 insertions(+), 10 deletions(-)
 create mode 100644 drivers/usb/host/ehci-sh.c
arch/sh/Kconfig +5 -0
index 5c075f5..e0e2234 100644
@@ -344,6 +344,7 @@ config CPU_SUBTYPE_SH7720
 	select CPU_SH3
 	select CPU_HAS_DSP
 	select SYS_SUPPORTS_CMT
+	select USB_ARCH_HAS_OHCI
 	help
 	  Select SH7720 if you have a SH3-DSP SH7720 CPU.
 
@@ -352,6 +353,7 @@ config CPU_SUBTYPE_SH7721
 	select CPU_SH3
 	select CPU_HAS_DSP
 	select SYS_SUPPORTS_CMT
+	select USB_ARCH_HAS_OHCI
 	help
 	  Select SH7721 if you have a SH3-DSP SH7721 CPU.
 
@@ -429,6 +431,7 @@ config CPU_SUBTYPE_SH7757
 config CPU_SUBTYPE_SH7763
 	bool "Support SH7763 processor"
 	select CPU_SH4A
+	select USB_ARCH_HAS_OHCI
 	help
 	  Select SH7763 if you have a SH4A SH7763(R5S77631) CPU.
 
@@ -453,6 +456,8 @@ config CPU_SUBTYPE_SH7786
 	select CPU_SHX3
 	select CPU_HAS_PTEAEX
 	select GENERIC_CLOCKEVENTS_BROADCAST if SMP
+	select USB_ARCH_HAS_OHCI
+	select USB_ARCH_HAS_EHCI
 
 config CPU_SUBTYPE_SHX3
 	bool "Support SH-X3 processor"
arch/sh/kernel/cpu/sh4a/setup-sh7786.c +31 -4
index c016c00..0170dbd 100644
@@ -522,10 +522,37 @@ static struct platform_device dma0_device = {
 	},
 };
 
+#define USB_EHCI_START 0xffe70000
+#define USB_OHCI_START 0xffe70400
+
+static struct resource usb_ehci_resources[] = {
+	[0] = {
+		.start	= USB_EHCI_START,
+		.end	= USB_EHCI_START + 0x3ff,
+		.flags	= IORESOURCE_MEM,
+	},
+	[1] = {
+		.start	= 77,
+		.end	= 77,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static struct platform_device usb_ehci_device = {
+	.name		= "sh_ehci",
+	.id		= -1,
+	.dev = {
+		.dma_mask		= &usb_ehci_device.dev.coherent_dma_mask,
+		.coherent_dma_mask	= DMA_BIT_MASK(32),
+	},
+	.num_resources	= ARRAY_SIZE(usb_ehci_resources),
+	.resource	= usb_ehci_resources,
+};
+
 static struct resource usb_ohci_resources[] = {
 	[0] = {
-		.start	= 0xffe70400,
-		.end	= 0xffe704ff,
+		.start	= USB_OHCI_START,
+		.end	= USB_OHCI_START + 0x3ff,
 		.flags	= IORESOURCE_MEM,
 	},
 	[1] = {
@@ -535,12 +562,11 @@ static struct resource usb_ohci_resources[] = {
 	},
 };
 
-static u64 usb_ohci_dma_mask = DMA_BIT_MASK(32);
 static struct platform_device usb_ohci_device = {
 	.name		= "sh_ohci",
 	.id		= -1,
 	.dev = {
-		.dma_mask		= &usb_ohci_dma_mask,
+		.dma_mask		= &usb_ohci_device.dev.coherent_dma_mask,
 		.coherent_dma_mask	= DMA_BIT_MASK(32),
 	},
 	.num_resources	= ARRAY_SIZE(usb_ohci_resources),
@@ -570,6 +596,7 @@ static struct platform_device *sh7786_early_devices[] __initdata = {
 
 static struct platform_device *sh7786_devices[] __initdata = {
 	&dma0_device,
+	&usb_ehci_device,
 	&usb_ohci_device,
 };
 
drivers/usb/Kconfig +0 -5
index 67eb377..703a33b 100644
@@ -47,11 +47,6 @@ config USB_ARCH_HAS_OHCI
 	# MIPS:
 	default y if MIPS_ALCHEMY
 	default y if MACH_JZ4740
-	# SH:
-	default y if CPU_SUBTYPE_SH7720
-	default y if CPU_SUBTYPE_SH7721
-	default y if CPU_SUBTYPE_SH7763
-	default y if CPU_SUBTYPE_SH7786
 	# more:
 	default PCI
 
drivers/usb/host/ehci-hcd.c +5 -0
index 502a7e6..02ffbea 100644
@@ -1166,6 +1166,11 @@ MODULE_LICENSE ("GPL");
 #define PLATFORM_DRIVER		ehci_mxc_driver
 #endif
 
+#ifdef CONFIG_CPU_SUBTYPE_SH7786
+#include "ehci-sh.c"
+#define PLATFORM_DRIVER		ehci_hcd_sh_driver
+#endif
+
 #ifdef CONFIG_SOC_AU1200
 #include "ehci-au1xxx.c"
 #define	PLATFORM_DRIVER		ehci_hcd_au1xxx_driver
drivers/usb/host/ehci-sh.c new file +243 -0

243 lines not on this page · raw message

drivers/usb/host/ohci-sh.c +1 -1
index 0b35d22..f47867f 100644
@@ -109,7 +109,7 @@ static int ohci_hcd_sh_probe(struct platform_device *pdev)
 	hcd->regs = (void __iomem *)res->start;
 	hcd->rsrc_start = res->start;
 	hcd->rsrc_len = resource_size(res);
-	ret = usb_add_hcd(hcd, irq, IRQF_DISABLED);
+	ret = usb_add_hcd(hcd, irq, IRQF_DISABLED | IRQF_SHARED);
 	if (ret != 0) {
 		err("Failed to add hcd");
 		usb_put_hcd(hcd);
#1 lore raw
Quoted 11 lines · Paul Mundt

This is a simple patch series for adding EHCI glue for the SuperH on-chip controller. It's largely modelled after the ohci-sh driver with clock management added on top, which I plan to move out to be shared between the two like Octeon presently does in a future patch -- this just hasn't been done yet since I need to go through and audit all of the SH OHCI users first.

As before, if you don't have any issues with the series then you can feel free to pull the topic branch in to one of your trees as-is, or I can merge it via the SH tree (I don't have anything that depends on it, so I'm fine with whatever you prefer).

I've pulled this into my -next branch and pushed it out, so you don't have to worry about it anymore.

thanks,

greg k-h