Skip to contentSkip to conversation

sh: add resource of USB for SH7720

PATCH Applied Yoshihiro Shimoda 5 participants 9 messages Jan 10, 2008 – Jan 22, 2008 SuperH

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sh: add resource of USB for SH7720

add resource of USB for SH7720.

---
 arch/sh/kernel/cpu/sh3/setup-sh7720.c |   53 ++++++++++++++++++++++++
 1 file changed, 53 insertions(+)
arch/sh/kernel/cpu/sh3/setup-sh7720.c +53 -0
diff -uprN a/arch/sh/kernel/cpu/sh3/setup-sh7720.c b/arch/sh/kernel/cpu/sh3/setup-sh7720.c
@@ -85,9 +85,62 @@ static struct platform_device sci_device
 	},
 };
 
+static struct resource usb_ohci_resources[] = {
+	[0] = {
+		.start	= 0xA4428000,
+		.end	= 0xA44280FF,
+		.flags	= IORESOURCE_MEM,
+	},
+	[1] = {
+		.start	= 67,
+		.end	= 67,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static u64 usb_ohci_dma_mask = 0xffffffffUL;
+static struct platform_device usb_ohci_device = {
+	.name		= "sh_ohci",
+	.id		= -1,
+	.dev = {
+		.dma_mask		= &usb_ohci_dma_mask,
+		.coherent_dma_mask	= 0xffffffff,
+	},
+	.num_resources	= ARRAY_SIZE(usb_ohci_resources),
+	.resource	= usb_ohci_resources,
+};
+
+static struct resource usbf_resources[] = {
+	[0] = {
+		.name	= "sh_udc",
+		.start	= 0xA4420000,
+		.end	= 0xA44200FF,
+		.flags	= IORESOURCE_MEM,
+	},
+	[1] = {
+		.name	= "sh_udc",
+		.start	= 65,
+		.end	= 65,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static struct platform_device usbf_device = {
+	.name		= "sh_udc",
+	.id		= -1,
+	.dev = {
+		.dma_mask		= NULL,
+		.coherent_dma_mask	= 0xffffffff,
+	},
+	.num_resources	= ARRAY_SIZE(usbf_resources),
+	.resource	= usbf_resources,
+};
+
 static struct platform_device *sh7720_devices[] __initdata = {
 	&rtc_device,
 	&sci_device,
+	&usb_ohci_device,
+	&usbf_device,
 };
 
 static int __init sh7720_devices_setup(void)
#2 lore raw
In reply to Yoshihiro Shimoda

Greetings,

Without looking to heavily in the hd64465 datasheet, you think this would work for hd64465+SH7729 platform? It contains an OHCI based usb host.

Best wishes
Kristoffer

Quoted 77 lines · On Thu, 10 Jan 2008 21:08:26 +0900 Yoshihiro Shimoda…

add resource of USB for SH7720.

---
 arch/sh/kernel/cpu/sh3/setup-sh7720.c |   53 ++++++++++++++++++++++++
 1 file changed, 53 insertions(+)

diff -uprN a/arch/sh/kernel/cpu/sh3/setup-sh7720.c b/arch/sh/kernel/cpu/sh3/setup-sh7720.c

arch/sh/kernel/cpu/sh3/setup-sh7720.c +53 -1
@@ -85,9 +85,62 @@ static struct platform_device sci_device
 	},
 };
 
+static struct resource usb_ohci_resources[] = {
+	[0] = {
+		.start	= 0xA4428000,
+		.end	= 0xA44280FF,
+		.flags	= IORESOURCE_MEM,
+	},
+	[1] = {
+		.start	= 67,
+		.end	= 67,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static u64 usb_ohci_dma_mask = 0xffffffffUL;
+static struct platform_device usb_ohci_device = {
+	.name		= "sh_ohci",
+	.id		= -1,
+	.dev = {
+		.dma_mask		= &usb_ohci_dma_mask,
+		.coherent_dma_mask	= 0xffffffff,
+	},
+	.num_resources	= ARRAY_SIZE(usb_ohci_resources),
+	.resource	= usb_ohci_resources,
+};
+
+static struct resource usbf_resources[] = {
+	[0] = {
+		.name	= "sh_udc",
+		.start	= 0xA4420000,
+		.end	= 0xA44200FF,
+		.flags	= IORESOURCE_MEM,
+	},
+	[1] = {
+		.name	= "sh_udc",
+		.start	= 65,
+		.end	= 65,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static struct platform_device usbf_device = {
+	.name		= "sh_udc",
+	.id		= -1,
+	.dev = {
+		.dma_mask		= NULL,
+		.coherent_dma_mask	= 0xffffffff,
+	},
+	.num_resources	= ARRAY_SIZE(usbf_resources),
+	.resource	= usbf_resources,
+};
+
 static struct platform_device *sh7720_devices[] __initdata = {
 	&rtc_device,
 	&sci_device,
+	&usb_ohci_device,
+	&usbf_device,
 };
 
 static int __init sh7720_devices_setup(void)
-

To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 1 line
Kristoffer Ericson <[email protected]>
#3 lore raw
In reply to Yoshihiro Shimoda
Quoted 3 lines · Kristoffer Ericson

Greetings,

Without looking to heavily in the hd64465 datasheet, you think this would work for hd64465+SH7729 platform? It contains an OHCI based usb host.

Not without some additional changes to the OHCI stack. The HD64465 OHCI (and the SH7760 OHCI too) can only do transfers from/to its internal SRAM; the Linux OHCI stack simply assumes that the HC can read all Transfer Descriptors (TD) and data from main memory.
Also, SRAM is rather small (8kB IIRC) so you can forget about USB mass storage outright (and bluetooth dongles too), only keyboards and mice work right.
Finally, the SRAM has different addresses, depending on who's accessing it (HC or CPU), making it necessary to go over the TDs and adjust the data pointers to 'HC-view' before transfer and 'CPU-view' after they're done.

In short: the hardware sucks... ;-)

Manuel Lauss

#4 lore raw
In reply to Yoshihiro Shimoda
Quoted 20 lines · Manuel Lauss
Quoted 5 lines · Kristoffer Ericson

Greetings,

Without looking to heavily in the hd64465 datasheet, you think this would work for hd64465+SH7729 platform? It contains an OHCI based usb host.

Not without some additional changes to the OHCI stack. The HD64465 OHCI (and the SH7760 OHCI too) can only do transfers from/to its internal SRAM; the Linux OHCI stack simply assumes that the HC can read all Transfer Descriptors (TD) and data from main memory.
Also, SRAM is rather small (8kB IIRC) so you can forget about USB mass storage outright (and bluetooth dongles too), only keyboards and mice work right.
Finally, the SRAM has different addresses, depending on who's accessing it (HC or CPU), making it necessary to go over the TDs and adjust the data pointers to 'HC-view' before transfer and 'CPU-view' after they're done.

Quoted 2 lines

In short: the hardware sucks... ;-)

http://marc.info/?l=linux-usb-devel&m0027668329758&w=2
http://marc.info/?l=linux-usb-devel&m0055283608988&w=2

#5 lore raw
In reply to Yoshihiro Shimoda
Quoted 21 lines · Paul Mundt
Quoted 20 lines · Manuel Lauss
Quoted 5 lines · Kristoffer Ericson

Greetings,

Without looking to heavily in the hd64465 datasheet, you think this would work for hd64465+SH7729 platform? It contains an OHCI based usb host.

Not without some additional changes to the OHCI stack. The HD64465 OHCI (and the SH7760 OHCI too) can only do transfers from/to its internal SRAM; the Linux OHCI stack simply assumes that the HC can read all Transfer Descriptors (TD) and data from main memory.
Also, SRAM is rather small (8kB IIRC) so you can forget about USB mass storage outright (and bluetooth dongles too), only keyboards and mice work right.
Finally, the SRAM has different addresses, depending on who's accessing it (HC or CPU), making it necessary to go over the TDs and adjust the data pointers to 'HC-view' before transfer and 'CPU-view' after they're done.

Quoted 4 lines
Quoted 2 lines

In short: the hardware sucks... ;-)

http://marc.info/?l=linux-usb-devel&m0027668329758&w=2
http://marc.info/?l=linux-usb-devel&m0055283608988&w=2

Oooh, interesting, thanks!

Signature · 1 line
 Manuel Lauss
#7 lore raw
In reply to Yoshihiro Shimoda

Anyone willing to give a quick explanation for usb-newbie :)

Quoted 25 lines · On Mon, 21 Jan 2008 16:05:53 +0900 Paul Mundt <[email protected]> wrote:
Quoted 20 lines · Manuel Lauss
Quoted 5 lines · Kristoffer Ericson

Greetings,

Without looking to heavily in the hd64465 datasheet, you think this would work for hd64465+SH7729 platform? It contains an OHCI based usb host.

Not without some additional changes to the OHCI stack. The HD64465 OHCI (and the SH7760 OHCI too) can only do transfers from/to its internal SRAM; the Linux OHCI stack simply assumes that the HC can read all Transfer Descriptors (TD) and data from main memory.
Also, SRAM is rather small (8kB IIRC) so you can forget about USB mass storage outright (and bluetooth dongles too), only keyboards and mice work right.
Finally, the SRAM has different addresses, depending on who's accessing it (HC or CPU), making it necessary to go over the TDs and adjust the data pointers to 'HC-view' before transfer and 'CPU-view' after they're done.

Quoted 2 lines

In short: the hardware sucks... ;-)

http://marc.info/?l=linux-usb-devel&m0027668329758&w=2
http://marc.info/?l=linux-usb-devel&m0055283608988&w=2

#8 lore raw
In reply to Yoshihiro Shimoda
Quoted 2 lines · Kristoffer Ericson

Anyone willing to give a quick explanation for usb-newbie :)

What Manuel said was already pretty self-explanatory, if you don't understand the problem, you will probably want to wait until SH7760 OHCI drivers have been written and merged, and then see about writing an HD64465 driver modelled on top of that.

In summary, patches are in progress that should finally let us handle SH7760 OHCI (and the other crippled OHCI implementations), SM501 is just where most of that has been prototyped.

Finally, do not top post, ever.