浏览代码

[ARM] 3958/1: add platform device (pxa2xx-udc)to ixp4xx

Create include/asm-arm/arch-ixp4xx/udc.h and
add platfrom device ixp4xx_udc_device into
arch/arm/mach-ixp4xx/common.c.

This allows us to use pxa2xx-udc on
the ixp4xx platfrom. Both pxa2xx and
ixp4xx use the same device controller.

Signed-off-by:Milan Svoboda <msvoboda@ra.rockwell.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Milan Svoboda 18 年之前
父节点
当前提交
e520a36de2
共有 2 个文件被更改,包括 49 次插入0 次删除
  1. 41 0
      arch/arm/mach-ixp4xx/common.c
  2. 8 0
      include/asm-arm/arch-ixp4xx/udc.h

+ 41 - 0
arch/arm/mach-ixp4xx/common.c

@@ -28,6 +28,7 @@
 #include <linux/timex.h>
 #include <linux/timex.h>
 #include <linux/clocksource.h>
 #include <linux/clocksource.h>
 
 
+#include <asm/arch/udc.h>
 #include <asm/hardware.h>
 #include <asm/hardware.h>
 #include <asm/uaccess.h>
 #include <asm/uaccess.h>
 #include <asm/io.h>
 #include <asm/io.h>
@@ -286,6 +287,44 @@ struct sys_timer ixp4xx_timer = {
 	.init		= ixp4xx_timer_init,
 	.init		= ixp4xx_timer_init,
 };
 };
 
 
+static struct pxa2xx_udc_mach_info ixp4xx_udc_info;
+
+void __init ixp4xx_set_udc_info(struct pxa2xx_udc_mach_info *info)
+{
+	memcpy(&ixp4xx_udc_info, info, sizeof *info);
+}
+
+static struct resource ixp4xx_udc_resources[] = {
+	[0] = {
+		.start  = 0xc800b000,
+		.end    = 0xc800bfff,
+		.flags  = IORESOURCE_MEM,
+	},
+	[1] = {
+		.start  = IRQ_IXP4XX_USB,
+		.end    = IRQ_IXP4XX_USB,
+		.flags  = IORESOURCE_IRQ,
+	},
+};
+
+/*
+ * USB device controller. The IXP4xx uses the same controller as PXA2XX,
+ * so we just use the same device.
+ */
+static struct platform_device ixp4xx_udc_device = {
+	.name           = "pxa2xx-udc",
+	.id             = -1,
+	.num_resources  = 2,
+	.resource       = ixp4xx_udc_resources,
+	.dev            = {
+		.platform_data = &ixp4xx_udc_info,
+	},
+};
+
+static struct platform_device *ixp4xx_devices[] __initdata = {
+	&ixp4xx_udc_device,
+};
+
 static struct resource ixp46x_i2c_resources[] = {
 static struct resource ixp46x_i2c_resources[] = {
 	[0] = {
 	[0] = {
 		.start 	= 0xc8011000,
 		.start 	= 0xc8011000,
@@ -321,6 +360,8 @@ void __init ixp4xx_sys_init(void)
 {
 {
 	ixp4xx_exp_bus_size = SZ_16M;
 	ixp4xx_exp_bus_size = SZ_16M;
 
 
+	platform_add_devices(ixp4xx_devices, ARRAY_SIZE(ixp4xx_devices));
+
 	if (cpu_is_ixp46x()) {
 	if (cpu_is_ixp46x()) {
 		int region;
 		int region;
 
 

+ 8 - 0
include/asm-arm/arch-ixp4xx/udc.h

@@ -0,0 +1,8 @@
+/*
+ * linux/include/asm-arm/arch-ixp4xx/udc.h
+ *
+ */
+#include <asm/mach/udc_pxa2xx.h>
+
+extern void ixp4xx_set_udc_info(struct pxa2xx_udc_mach_info *info);
+