SUPERH platform development
 help / color / mirror / Atom feed
* [PATCH] sh: Add SH Ethernet platform device for Solution Engine
@ 2008-01-18  8:40 Yoshihiro Shimoda
  2008-01-18  9:06 ` Paul Mundt
  0 siblings, 1 reply; 2+ messages in thread
From: Yoshihiro Shimoda @ 2008-01-18  8:40 UTC (permalink / raw)
  To: linux-sh

Add SH Ethernet platform device for Solution Engine.

Signed-off-by: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
---
 arch/sh/boards/se/770x/setup.c |   53 +++++++++++++++++++++++++++++++
 include/asm-sh/se.h            |   15 ++++++++
 2 files changed, 68 insertions(+)

diff -uprN a/arch/sh/boards/se/770x/setup.c b/arch/sh/boards/se/770x/setup.c
--- a/arch/sh/boards/se/770x/setup.c	2008-01-18 10:53:54.000000000 +0900
+++ b/arch/sh/boards/se/770x/setup.c	2008-01-18 16:49:15.000000000 +0900
@@ -2,6 +2,7 @@
  * linux/arch/sh/boards/se/770x/setup.c
  *
  * Copyright (C) 2000  Kazumoto Kojima
+ * Copyright (C) 2007,2008  Nobuhiro Iwamatsu
  *
  * Hitachi SolutionEngine Support.
  *
@@ -115,9 +116,61 @@ static struct platform_device heartbeat_
 	.resource	= heartbeat_resources,
 };

+#if defined(CONFIG_SH_ETH)
+static struct resource sh_eth0_resources[] = {
+	[0] = {
+		.start	= SH_ETH0_BASE,
+		.end	= SH_ETH0_BASE + 0x1B8,
+		.flags	= IORESOURCE_MEM,
+	},
+	[1] = {
+		.start	= IRQ_SH_ETH0,
+		.end	= IRQ_SH_ETH0,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static struct platform_device sh_eth0_device = {
+	.name	= "sh-eth",
+	.id	= 0,
+	.dev	= {
+		.platform_data = (void *)PHY_ID,
+	},
+	.num_resources	= ARRAY_SIZE(sh_eth0_resources),
+	.resource	= sh_eth0_resources,
+};
+
+static struct resource sh_eth1_resources[] = {
+	[0] = {
+		.start  = SH_ETH1_BASE,
+		.end    = SH_ETH1_BASE + 0x1B8,
+		.flags  = IORESOURCE_MEM,
+	},
+	[1] = {
+		.start	= IRQ_SH_ETH1,
+		.end	= IRQ_SH_ETH1,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static struct platform_device sh_eth1_device = {
+	.name	= "sh-eth",
+	.id	= 1,
+	.dev	= {
+		.platform_data = (void *)PHY_ID,
+	},
+	.num_resources	= ARRAY_SIZE(sh_eth1_resources),
+	.resource	= sh_eth1_resources,
+};
+#endif /* CONFIG_SH_ETH */
+
 static struct platform_device *se_devices[] __initdata = {
 	&heartbeat_device,
 	&cf_ide_device,
+#if defined(CONFIG_SH_ETH)
+	&sh_eth0_device,
+	&sh_eth1_device,
+#endif
 };

 static int __init se_devices_setup(void)
diff -uprN a/include/asm-sh/se.h b/include/asm-sh/se.h
--- a/include/asm-sh/se.h	2008-01-18 10:55:02.000000000 +0900
+++ b/include/asm-sh/se.h	2008-01-18 16:36:53.000000000 +0900
@@ -76,6 +76,21 @@
 #define IRQ_CFCARD	7
 #endif

+/* SH Ethernet */
+#if defined(CONFIG_CPU_SUBTYPE_SH7710)
+#define PHY_ID	0x00
+#elif defined(CONFIG_CPU_SUBTYPE_SH7712)
+#define PHY_ID	0x01
+#endif
+/* Ether Base Address */
+#define SH_ETH0_BASE	0xA7000000
+#define SH_ETH1_BASE	0xA7000400
+#define SH_TSU_ADDR	0xA7000804
+/* Ether IRQs */
+#define IRQ_SH_ETH0	80
+#define IRQ_SH_ETH1	81
+#define IRQ_SH_TSU	82
+
 #define __IO_PREFIX	se
 #include <asm/io_generic.h>


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] sh: Add SH Ethernet platform device for Solution Engine
  2008-01-18  8:40 [PATCH] sh: Add SH Ethernet platform device for Solution Engine Yoshihiro Shimoda
@ 2008-01-18  9:06 ` Paul Mundt
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Mundt @ 2008-01-18  9:06 UTC (permalink / raw)
  To: linux-sh

On Fri, Jan 18, 2008 at 05:40:05PM +0900, Yoshihiro Shimoda wrote:
> @@ -115,9 +116,61 @@ static struct platform_device heartbeat_
>  	.resource	= heartbeat_resources,
>  };
> 
> +#if defined(CONFIG_SH_ETH)
> +static struct resource sh_eth0_resources[] = {
> +	[0] = {
> +		.start	= SH_ETH0_BASE,
> +		.end	= SH_ETH0_BASE + 0x1B8,
> +		.flags	= IORESOURCE_MEM,
> +	},
> +	[1] = {
> +		.start	= IRQ_SH_ETH0,
> +		.end	= IRQ_SH_ETH0,
> +		.flags	= IORESOURCE_IRQ,
> +	},
> +};
Do not use ifdefs for platform devices. If they are unclaimed, they are
freed up due to being __initdata. ifdefs just make the code ugly.

Also, there's no point in merging the board stuff until the driver itself
has been merged. If people are going to keep the ethernet driver out of
tree, then the patch adding it to the board can go along with it.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-01-18  9:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-18  8:40 [PATCH] sh: Add SH Ethernet platform device for Solution Engine Yoshihiro Shimoda
2008-01-18  9:06 ` Paul Mundt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox