* [PATH] ppc32: Add usb support to IBM stb04xxx platforms
@ 2005-08-09 18:53 Dale Farnsworth
2005-08-09 19:03 ` Eugene Surovegin
0 siblings, 1 reply; 3+ messages in thread
From: Dale Farnsworth @ 2005-08-09 18:53 UTC (permalink / raw)
To: linuxppc-embedded
[ I previously submitted this on March 31st. Though I received a copy
back from the linuxppc-embedded mailing list, I don't find a copy in
the archive. (The same thing happend to my submission of asm-ppc/usb.h.)
So I'm resending. ]
Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
Index: linux-2.5-usb-405/arch/ppc/platforms/4xx/ibmstb4.c
===================================================================
--- linux-2.5-usb-405.orig/arch/ppc/platforms/4xx/ibmstb4.c
+++ linux-2.5-usb-405/arch/ppc/platforms/4xx/ibmstb4.c
@@ -72,12 +72,43 @@
.irq = IDE0_IRQ,
.pm = OCP_CPM_NA,
},
- { .vendor = OCP_VENDOR_IBM,
- .function = OCP_FUNC_USB,
- .paddr = USB0_BASE,
- .irq = USB0_IRQ,
- .pm = OCP_CPM_NA,
- },
{ .vendor = OCP_VENDOR_INVALID,
}
};
+
+static struct resource ohci_usb_resources[] = {
+ [0] = {
+ .start = USB0_BASE,
+ .end = USB0_BASE + USB0_SIZE - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = USB0_IRQ,
+ .end = USB0_IRQ,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+static u64 dma_mask = 0xffffffffULL;
+
+static struct platform_device ohci_usb_device = {
+ .name = "ppc-soc-ohci",
+ .id = 0,
+ .num_resources = ARRAY_SIZE(ohci_usb_resources),
+ .resource = ohci_usb_resources,
+ .dev = {
+ .dma_mask = &dma_mask,
+ .coherent_dma_mask = 0xffffffffULL,
+ }
+};
+
+static struct platform_device *ibmstb4_devs[] __initdata = {
+ &ohci_usb_device,
+};
+
+static int __init
+ibmstb4_platform_add_devices(void)
+{
+ return platform_add_devices(ibmstb4_devs, ARRAY_SIZE(ibmstb4_devs));
+}
+arch_initcall(ibmstb4_platform_add_devices);
Index: linux-2.5-usb-405/arch/ppc/platforms/4xx/ibmstb4.h
===================================================================
--- linux-2.5-usb-405.orig/arch/ppc/platforms/4xx/ibmstb4.h
+++ linux-2.5-usb-405/arch/ppc/platforms/4xx/ibmstb4.h
@@ -73,9 +73,9 @@
#define OPB0_BASE 0x40000000
#define GPIO0_BASE 0x40060000
+#define USB0_BASE 0x40010000
+#define USB0_SIZE 0xA0
#define USB0_IRQ 18
-#define USB0_BASE STB04xxx_MAP_IO_ADDR(0x40010000)
-#define USB0_EXTENT 4096
#define IIC_NUMS 2
#define UART_NUMS 3
Index: linux-2.5-usb-405/arch/ppc/platforms/4xx/redwood5.c
===================================================================
--- linux-2.5-usb-405.orig/arch/ppc/platforms/4xx/redwood5.c
+++ linux-2.5-usb-405/arch/ppc/platforms/4xx/redwood5.c
@@ -52,8 +52,18 @@
void __init
redwood5_setup_arch(void)
{
+ u32 mask;
+
ppc4xx_setup_arch();
+ /*
+ * Set up USB interrupt as positive polarity and level-sensitive.
+ * Firmware should do this, but apparently does not.
+ */
+ mask = 1 << (31 - USB0_IRQ);
+ mtdcr(DCRN_UIC_PR(UIC0), mfdcr(DCRN_UIC_PR(UIC0)) | mask);
+ mtdcr(DCRN_UIC_TR(UIC0), mfdcr(DCRN_UIC_TR(UIC0)) & ~mask);
+
#ifdef CONFIG_DEBUG_BRINGUP
printk("\n");
printk("machine\t: %s\n", PPC4xx_MACHINE_NAME);
_______________________________________________
Linuxppc-embedded mailing list
Linuxppc-embedded@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-embedded
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATH] ppc32: Add usb support to IBM stb04xxx platforms 2005-08-09 18:53 [PATH] ppc32: Add usb support to IBM stb04xxx platforms Dale Farnsworth @ 2005-08-09 19:03 ` Eugene Surovegin 2005-08-09 19:23 ` [PATCH] " Dale Farnsworth 0 siblings, 1 reply; 3+ messages in thread From: Eugene Surovegin @ 2005-08-09 19:03 UTC (permalink / raw) To: Dale Farnsworth; +Cc: linuxppc-embedded On Tue, Aug 09, 2005 at 11:53:27AM -0700, Dale Farnsworth wrote: [snip] > Index: linux-2.5-usb-405/arch/ppc/platforms/4xx/redwood5.c > =================================================================== > --- linux-2.5-usb-405.orig/arch/ppc/platforms/4xx/redwood5.c > +++ linux-2.5-usb-405/arch/ppc/platforms/4xx/redwood5.c > @@ -52,8 +52,18 @@ > void __init > redwood5_setup_arch(void) > { > + u32 mask; > + > ppc4xx_setup_arch(); > > + /* > + * Set up USB interrupt as positive polarity and level-sensitive. > + * Firmware should do this, but apparently does not. > + */ > + mask = 1 << (31 - USB0_IRQ); > + mtdcr(DCRN_UIC_PR(UIC0), mfdcr(DCRN_UIC_PR(UIC0)) | mask); > + mtdcr(DCRN_UIC_TR(UIC0), mfdcr(DCRN_UIC_TR(UIC0)) & ~mask); > + Please, DO NOT DO THIS. There is a way to configure UIC settings without messing with UIC registers directly. Refer to asm-ppc/ppc4xx_pic.h and other 4xx board ports for more information. -- Eugene ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ppc32: Add usb support to IBM stb04xxx platforms 2005-08-09 19:03 ` Eugene Surovegin @ 2005-08-09 19:23 ` Dale Farnsworth 0 siblings, 0 replies; 3+ messages in thread From: Dale Farnsworth @ 2005-08-09 19:23 UTC (permalink / raw) To: Dale Farnsworth, linuxppc-embedded On Tue, Aug 09, 2005 at 12:03:19PM -0700, Eugene Surovegin wrote: > On Tue, Aug 09, 2005 at 11:53:27AM -0700, Dale Farnsworth wrote: > [snip] > > > Index: linux-2.5-usb-405/arch/ppc/platforms/4xx/redwood5.c > > =================================================================== > > --- linux-2.5-usb-405.orig/arch/ppc/platforms/4xx/redwood5.c > > +++ linux-2.5-usb-405/arch/ppc/platforms/4xx/redwood5.c > > @@ -52,8 +52,18 @@ > > void __init > > redwood5_setup_arch(void) > > { > > + u32 mask; > > + > > ppc4xx_setup_arch(); > > > > + /* > > + * Set up USB interrupt as positive polarity and level-sensitive. > > + * Firmware should do this, but apparently does not. > > + */ > > + mask = 1 << (31 - USB0_IRQ); > > + mtdcr(DCRN_UIC_PR(UIC0), mfdcr(DCRN_UIC_PR(UIC0)) | mask); > > + mtdcr(DCRN_UIC_TR(UIC0), mfdcr(DCRN_UIC_TR(UIC0)) & ~mask); > > + > > Please, DO NOT DO THIS. > > There is a way to configure UIC settings without messing with UIC > registers directly. Refer to asm-ppc/ppc4xx_pic.h and other 4xx board > ports for more information. > > Eugene Deja vu all over again, eh Eugene? I re-submitted the wrong old patch. Correct (I hope) patch follows. Signed-off-by: Dale Farnsworth <dale@farnsworth.org> Index: linux-2.5-usb-405/arch/ppc/platforms/4xx/ibmstb4.c =================================================================== --- linux-2.5-usb-405.orig/arch/ppc/platforms/4xx/ibmstb4.c +++ linux-2.5-usb-405/arch/ppc/platforms/4xx/ibmstb4.c @@ -11,6 +11,7 @@ #include <linux/init.h> #include <asm/ocp.h> +#include <asm/ppc4xx_pic.h> #include <platforms/4xx/ibmstb4.h> static struct ocp_func_iic_data ibmstb4_iic0_def = { @@ -72,12 +73,51 @@ .irq = IDE0_IRQ, .pm = OCP_CPM_NA, }, - { .vendor = OCP_VENDOR_IBM, - .function = OCP_FUNC_USB, - .paddr = USB0_BASE, - .irq = USB0_IRQ, - .pm = OCP_CPM_NA, - }, { .vendor = OCP_VENDOR_INVALID, } }; + +/* Polarity and triggering settings for internal interrupt sources */ +struct ppc4xx_uic_settings ppc4xx_core_uic_cfg[] __initdata = { + { .polarity = 0x7fffff01, + .triggering = 0x00000000, + .ext_irq_mask = 0x0000007e, /* IRQ0 - IRQ5 */ + } +}; + +static struct resource ohci_usb_resources[] = { + [0] = { + .start = USB0_BASE, + .end = USB0_BASE + USB0_SIZE - 1, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = USB0_IRQ, + .end = USB0_IRQ, + .flags = IORESOURCE_IRQ, + }, +}; + +static u64 dma_mask = 0xffffffffULL; + +static struct platform_device ohci_usb_device = { + .name = "ppc-soc-ohci", + .id = 0, + .num_resources = ARRAY_SIZE(ohci_usb_resources), + .resource = ohci_usb_resources, + .dev = { + .dma_mask = &dma_mask, + .coherent_dma_mask = 0xffffffffULL, + } +}; + +static struct platform_device *ibmstb4_devs[] __initdata = { + &ohci_usb_device, +}; + +static int __init +ibmstb4_platform_add_devices(void) +{ + return platform_add_devices(ibmstb4_devs, ARRAY_SIZE(ibmstb4_devs)); +} +arch_initcall(ibmstb4_platform_add_devices); Index: linux-2.5-usb-405/arch/ppc/platforms/4xx/ibmstb4.h =================================================================== --- linux-2.5-usb-405.orig/arch/ppc/platforms/4xx/ibmstb4.h +++ linux-2.5-usb-405/arch/ppc/platforms/4xx/ibmstb4.h @@ -73,9 +73,9 @@ #define OPB0_BASE 0x40000000 #define GPIO0_BASE 0x40060000 +#define USB0_BASE 0x40010000 +#define USB0_SIZE 0xA0 #define USB0_IRQ 18 -#define USB0_BASE STB04xxx_MAP_IO_ADDR(0x40010000) -#define USB0_EXTENT 4096 #define IIC_NUMS 2 #define UART_NUMS 3 Index: linux-2.5-usb-405/arch/ppc/platforms/4xx/redwood5.c =================================================================== --- linux-2.5-usb-405.orig/arch/ppc/platforms/4xx/redwood5.c +++ linux-2.5-usb-405/arch/ppc/platforms/4xx/redwood5.c @@ -18,6 +18,19 @@ #include <linux/ioport.h> #include <asm/io.h> #include <asm/machdep.h> +#include <asm/ppc4xx_pic.h> + +/* + * Define external IRQ senses and polarities. + */ +unsigned char ppc4xx_uic_ext_irq_cfg[] __initdata = { + (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 0 */ + (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 1 */ + (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 2 */ + (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 3 */ + (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 4 */ + (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 5 */ +}; static struct resource smc91x_resources[] = { [0] = { _______________________________________________ Linuxppc-embedded mailing list Linuxppc-embedded@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-embedded ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-08-09 19:23 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2005-08-09 18:53 [PATH] ppc32: Add usb support to IBM stb04xxx platforms Dale Farnsworth 2005-08-09 19:03 ` Eugene Surovegin 2005-08-09 19:23 ` [PATCH] " Dale Farnsworth
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).