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; Wed, 14 Oct 2009
 13:05:24 -0600
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 n9EJ5OYp021349	for
 <andy.sharp@lsi.com>; Wed, 14 Oct 2009 12:05:24 -0700
Received: from psmtp.com (na3sys009amx251.postini.com [74.125.149.135])	by
 mail1.lsil.com (8.12.11/8.12.11) with SMTP id n9EJ5N4A027839	for
 <andy.sharp@lsi.com>; Wed, 14 Oct 2009 12:05:23 -0700 (PDT)
Received: from source ([78.24.191.182]) by na3sys009amx251.postini.com
 ([74.125.148.14]) with SMTP;	Wed, 14 Oct 2009 15:05:23 EDT
Received: from localhost.localdomain ([127.0.0.1]:40771 "EHLO
	eddie.linux-mips.org" rhost-flags-OK-OK-OK-FAIL) by ftp.linux-mips.org	with
 ESMTP id S1493683AbZJNTFV (ORCPT <rfc822;andy.sharp@lsi.com>);	Wed, 14 Oct
 2009 21:05:21 +0200
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 14 Oct 2009 21:05:03
 +0200 (CEST)
Received: from mail3.caviumnetworks.com ([12.108.191.235]:1230 "EHLO
	mail3.caviumnetworks.com" rhost-flags-OK-OK-OK-OK)	by ftp.linux-mips.org with
 ESMTP id S1493617AbZJNTE4 (ORCPT	<rfc822;linux-mips@linux-mips.org>); Wed, 14
 Oct 2009 21:04:56 +0200
Received: from caexch01.caveonetworks.com (Not Verified[192.168.16.9]) by
 mail3.caviumnetworks.com with MailMarshal (v6,5,4,7535)	id <B4ad620d30002>;
 Wed, 14 Oct 2009 12:04:51 -0700
Received: from caexch01.caveonetworks.com ([192.168.16.9]) by
 caexch01.caveonetworks.com with Microsoft SMTPSVC(6.0.3790.3959);	 Wed, 14
 Oct 2009 12:04:48 -0700
Received: from dd1.caveonetworks.com ([12.108.191.236]) by
 caexch01.caveonetworks.com over TLS secured channel with Microsoft
 SMTPSVC(6.0.3790.3959);	 Wed, 14 Oct 2009 12:04:48 -0700
Received: from dd1.caveonetworks.com (localhost.localdomain [127.0.0.1])	by
 dd1.caveonetworks.com (8.14.2/8.14.2) with ESMTP id n9EJ4i64007422;	Wed, 14
 Oct 2009 12:04:44 -0700
Received: (from ddaney@localhost)	by dd1.caveonetworks.com
 (8.14.2/8.14.2/Submit) id n9EJ4iw8007421;	Wed, 14 Oct 2009 12:04:44 -0700
From: David Daney <ddaney@caviumnetworks.com>
To: "ralf@linux-mips.org" <ralf@linux-mips.org>, "linux-mips@linux-mips.org"
	<linux-mips@linux-mips.org>, "netdev@vger.kernel.org"
	<netdev@vger.kernel.org>
CC: David Daney <ddaney@caviumnetworks.com>
Sender: "linux-mips-bounce@linux-mips.org" <linux-mips-bounce@linux-mips.org>
Date: Wed, 14 Oct 2009 13:04:39 -0600
Subject: [PATCH 3/6] MIPS: Octeon: Add platform devices MGMT Ethernet ports.
Thread-Topic: [PATCH 3/6] MIPS: Octeon: Add platform devices MGMT Ethernet
 ports.
Thread-Index: AcpNAUkmvcHsLQq5Q6yJVAFAWRg7wA==
Message-ID: <1255547082-7388-3-git-send-email-ddaney@caviumnetworks.com>
References: <4AD6205A.8070200@caviumnetworks.com>
In-Reply-To: <4AD6205A.8070200@caviumnetworks.com>
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-originalarrivaltime: 14 Oct 2009 19:04:48.0456 (UTC)
 FILETIME=[334E5C80:01CA4D01]
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 <ddaney@caviumnetworks.com> [db-null] 
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

Signed-off-by: David Daney <ddaney@caviumnetworks.com>
---
 arch/mips/cavium-octeon/octeon-platform.c |   58 +++++++++++++++++++++++++=
++++
 1 files changed, 58 insertions(+), 0 deletions(-)

diff --git a/arch/mips/cavium-octeon/octeon-platform.c b/arch/mips/cavium-o=
cteon/octeon-platform.c
index febfdd7..cfdb4c2 100644
--- a/arch/mips/cavium-octeon/octeon-platform.c
+++ b/arch/mips/cavium-octeon/octeon-platform.c
@@ -189,6 +189,64 @@ out:
 }
 device_initcall(octeon_mdiobus_device_init);
=20
+/* Octeon mgmt port Ethernet interface.  */
+static int __init octeon_mgmt_device_init(void)
+{
+	struct platform_device *pd;
+	int ret =3D 0;
+	int port, num_ports;
+
+	struct resource mgmt_port_resource =3D {
+		.flags	=3D IORESOURCE_IRQ,
+		.start	=3D -1,
+		.end	=3D -1
+	};
+
+	if (!OCTEON_IS_MODEL(OCTEON_CN56XX) && !OCTEON_IS_MODEL(OCTEON_CN52XX))
+		return 0;
+
+	if (OCTEON_IS_MODEL(OCTEON_CN56XX))
+		num_ports =3D 1;
+	else
+		num_ports =3D 2;
+
+	for (port =3D 0; port < num_ports; port++) {
+		pd =3D platform_device_alloc("octeon_mgmt", port);
+		if (!pd) {
+			ret =3D -ENOMEM;
+			goto out;
+		}
+		switch (port) {
+		case 0:
+			mgmt_port_resource.start =3D OCTEON_IRQ_MII0;
+			break;
+		case 1:
+			mgmt_port_resource.start =3D OCTEON_IRQ_MII1;
+			break;
+		default:
+			BUG();
+		}
+		mgmt_port_resource.end =3D mgmt_port_resource.start;
+
+		ret =3D platform_device_add_resources(pd, &mgmt_port_resource, 1);
+
+		if (ret)
+			goto fail;
+
+		ret =3D platform_device_add(pd);
+		if (ret)
+			goto fail;
+	}
+	return ret;
+fail:
+	platform_device_put(pd);
+
+out:
+	return ret;
+
+}
+device_initcall(octeon_mgmt_device_init);
+
 MODULE_AUTHOR("David Daney <ddaney@caviumnetworks.com>");
 MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("Platform driver for Octeon SOC");
--=20
1.6.0.6


