Received: from milmhbs1.lsil.com (147.145.21.209) by coscas01.lsi.com
 (172.21.36.60) with Microsoft SMTP Server id 8.1.393.1; Sat, 30 Jan 2010
 10:36:01 -0700
Received: from mail1.lsil.com (mail1.lsil.com [147.145.40.21])	by
 milmhbs1.lsil.com (8.12.11/8.12.11) with ESMTP id o0UHa1T0020487	for
 <andy.sharp@lsi.com>; Sat, 30 Jan 2010 09:36:01 -0800
Received: from psmtp.com (na3sys009amx177.postini.com [74.125.149.158])	by
 mail1.lsil.com (8.12.11/8.12.11) with SMTP id o0UHa0be016014	for
 <andy.sharp@lsi.com>; Sat, 30 Jan 2010 09:36:00 -0800 (PST)
Received: from source ([78.24.191.182]) by na3sys009amx177.postini.com
 ([74.125.148.14]) with SMTP;	Sat, 30 Jan 2010 11:36:00 CST
Received: from localhost.localdomain ([127.0.0.1]:36630 "EHLO
        eddie.linux-mips.org" rhost-flags-OK-OK-OK-FAIL)        by
 eddie.linux-mips.org with ESMTP id S1492441Ab0A3Rf4 (ORCPT
        <rfc822;andy.sharp@lsi.com>); Sat, 30 Jan 2010 18:35:56 +0100
Received: with ECARTIS (v1.0.0; list linux-mips); Sat, 30 Jan 2010 18:35:38
 +0100 (CET)
Received: from sakura.staff.proxad.net ([213.228.1.107]:53006 "EHLO
        sakura.staff.proxad.net" rhost-flags-OK-OK-OK-OK)        by
 eddie.linux-mips.org with ESMTP id S1492196Ab0A3RfK (ORCPT
        <rfc822;linux-mips@linux-mips.org>); Sat, 30 Jan 2010 18:35:10 +0100
Received: by sakura.staff.proxad.net (Postfix, from userid 1000)        id
 26EE8551082; Sat, 30 Jan 2010 18:35:10 +0100 (CET)
From: Maxime Bizon <mbizon@freebox.fr>
To: "linux-mips@linux-mips.org" <linux-mips@linux-mips.org>,
	"ralf@linux-mips.org" <ralf@linux-mips.org>
CC: Maxime Bizon <mbizon@freebox.fr>
Sender: "linux-mips-bounce@linux-mips.org" <linux-mips-bounce@linux-mips.org>
Date: Sat, 30 Jan 2010 10:34:52 -0700
Subject: [PATCH 1/7] MIPS: bcm63xx: register integrated OHCI controller
 device.
Thread-Topic: [PATCH 1/7] MIPS: bcm63xx: register integrated OHCI controller
 device.
Thread-Index: Acqh0rEov8rKoRENSauhfPrysxBYoQ==
Message-ID: <1264872898-28149-2-git-send-email-mbizon@freebox.fr>
References: <1264872898-28149-1-git-send-email-mbizon@freebox.fr>
In-Reply-To: <1264872898-28149-1-git-send-email-mbizon@freebox.fr>
Accept-Language: en-US
Content-Language: en-US
X-MS-Exchange-Organization-AuthAs: Anonymous
X-MS-Exchange-Organization-AuthSource: coscas01.lsi.com
X-MS-Has-Attach:
X-Auto-Response-Suppress: All
X-MS-TNEF-Correlator:
x-scanned-by: MIMEDefang 2.39
errors-to: linux-mips-bounce@linux-mips.org
x-pstn-levels: (S:99.90000/99.90000 CV:99.9000 FC:95.5390 LC:95.5390
 R:95.9108 P:95.9108 M:97.0282 C:98.6951 )
x-pstn-settings: 3 (1.0000:1.0000) s cv gt3 gt2 gt1 r p m c 
x-pstn-addresses: from <mbizon@freebox.fr> [22/1] 
x-pstn-neptune: 0/0/0.00/0
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0

The bcm63xx SOC has an integrated OHCI controller, this patch adds
platform device registration and change board code to register ohci
device when necessary.

Signed-off-by: Maxime Bizon <mbizon@freebox.fr>
---
 arch/mips/bcm63xx/Kconfig                          |    6 ++
 arch/mips/bcm63xx/Makefile                         |    3 +-
 arch/mips/bcm63xx/boards/board_bcm963xx.c          |    4 ++
 arch/mips/bcm63xx/dev-usb-ohci.c                   |   49 ++++++++++++++++=
++++
 .../asm/mach-bcm63xx/bcm63xx_dev_usb_ohci.h        |    6 ++
 5 files changed, 67 insertions(+), 1 deletions(-)
 create mode 100644 arch/mips/bcm63xx/dev-usb-ohci.c
 create mode 100644 arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_ohci=
.h

diff --git a/arch/mips/bcm63xx/Kconfig b/arch/mips/bcm63xx/Kconfig
index fb177d6..76fbbf7 100644
--- a/arch/mips/bcm63xx/Kconfig
+++ b/arch/mips/bcm63xx/Kconfig
@@ -16,10 +16,16 @@ config BCM63XX_CPU_6345
 config BCM63XX_CPU_6348
 	bool "support 6348 CPU"
 	select HW_HAS_PCI
+	select USB_ARCH_HAS_OHCI
+	select USB_OHCI_BIG_ENDIAN_DESC
+	select USB_OHCI_BIG_ENDIAN_MMIO
=20
 config BCM63XX_CPU_6358
 	bool "support 6358 CPU"
 	select HW_HAS_PCI
+	select USB_ARCH_HAS_OHCI
+	select USB_OHCI_BIG_ENDIAN_DESC
+	select USB_OHCI_BIG_ENDIAN_MMIO
 endmenu
=20
 source "arch/mips/bcm63xx/boards/Kconfig"
diff --git a/arch/mips/bcm63xx/Makefile b/arch/mips/bcm63xx/Makefile
index 00064b6..be5d7ad 100644
--- a/arch/mips/bcm63xx/Makefile
+++ b/arch/mips/bcm63xx/Makefile
@@ -1,5 +1,6 @@
 obj-y		+=3D clk.o cpu.o cs.o gpio.o irq.o prom.o setup.o timer.o \
-		   dev-dsp.o dev-enet.o dev-pcmcia.o dev-uart.o dev-wdt.o
+		   dev-dsp.o dev-enet.o dev-pcmcia.o dev-uart.o dev-wdt.o \
+		   dev-usb-ohci.o
 obj-$(CONFIG_EARLY_PRINTK)	+=3D early_printk.o
=20
 obj-y		+=3D boards/
diff --git a/arch/mips/bcm63xx/boards/board_bcm963xx.c b/arch/mips/bcm63xx/=
boards/board_bcm963xx.c
index ea17941..e2c0c36 100644
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
@@ -24,6 +24,7 @@
 #include <bcm63xx_dev_enet.h>
 #include <bcm63xx_dev_dsp.h>
 #include <bcm63xx_dev_pcmcia.h>
+#include <bcm63xx_dev_usb_ohci.h>
 #include <board_bcm963xx.h>
=20
 #define PFX	"board_bcm963xx: "
@@ -803,6 +804,9 @@ int __init board_register_devices(void)
 	    !board_get_mac_address(board.enet1.mac_addr))
 		bcm63xx_enet_register(1, &board.enet1);
=20
+	if (board.has_ohci0)
+		bcm63xx_ohci_register();
+
 	if (board.has_dsp)
 		bcm63xx_dsp_register(&board.dsp);
=20
diff --git a/arch/mips/bcm63xx/dev-usb-ohci.c b/arch/mips/bcm63xx/dev-usb-o=
hci.c
new file mode 100644
index 0000000..f1fb442
--- /dev/null
+++ b/arch/mips/bcm63xx/dev-usb-ohci.c
@@ -0,0 +1,49 @@
+/*
+ * This file is subject to the terms and conditions of the GNU General Pub=
lic
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2010 Maxime Bizon <mbizon@freebox.fr>
+ */
+
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/platform_device.h>
+#include <bcm63xx_cpu.h>
+#include <bcm63xx_dev_usb_ohci.h>
+
+static struct resource ohci_resources[] =3D {
+	{
+		/* start & end filled at runtime */
+		.flags		=3D IORESOURCE_MEM,
+	},
+	{
+		/* start filled at runtime */
+		.flags		=3D IORESOURCE_IRQ,
+	},
+};
+
+static u64 ohci_dmamask =3D ~(u32)0;
+
+static struct platform_device bcm63xx_ohci_device =3D {
+	.name		=3D "bcm63xx_ohci",
+	.id		=3D 0,
+	.num_resources	=3D ARRAY_SIZE(ohci_resources),
+	.resource	=3D ohci_resources,
+	.dev		=3D {
+		.dma_mask		=3D &ohci_dmamask,
+		.coherent_dma_mask	=3D 0xffffffff,
+	},
+};
+
+int __init bcm63xx_ohci_register(void)
+{
+	if (!BCMCPU_IS_6348() && !BCMCPU_IS_6358())
+		return 0;
+
+	ohci_resources[0].start =3D bcm63xx_regset_address(RSET_OHCI0);
+	ohci_resources[0].end =3D ohci_resources[0].start;
+	ohci_resources[0].end +=3D RSET_OHCI_SIZE - 1;
+	ohci_resources[1].start =3D bcm63xx_get_irq_number(IRQ_OHCI0);
+	return platform_device_register(&bcm63xx_ohci_device);
+}
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_ohci.h b/ar=
ch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_ohci.h
new file mode 100644
index 0000000..518a04d
--- /dev/null
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_ohci.h
@@ -0,0 +1,6 @@
+#ifndef BCM63XX_DEV_USB_OHCI_H_
+#define BCM63XX_DEV_USB_OHCI_H_
+
+int bcm63xx_ohci_register(void);
+
+#endif /* BCM63XX_DEV_USB_OHCI_H_ */
--=20
1.6.3.3


